{"constructor_args":"0x0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf020000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe","is_partially_verified":false,"is_changed_bytecode":false,"abi":[{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"collateral","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ActiveRouterCashRescue","type":"error"},{"inputs":[{"internalType":"address","name":"adapter","type":"address"},{"internalType":"address","name":"expectedAsset","type":"address"},{"internalType":"address","name":"actualAsset","type":"address"}],"name":"AdapterAssetMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"adapter","type":"address"},{"internalType":"address","name":"expectedAsset","type":"address"},{"internalType":"address","name":"actualAsset","type":"address"}],"name":"AdapterAssetMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"strategyShare","type":"address"}],"name":"AdapterNotFound","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualShares","type":"uint256"},{"internalType":"uint256","name":"reportedShares","type":"uint256"}],"name":"AdapterSharesMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualShares","type":"uint256"},{"internalType":"uint256","name":"reportedShares","type":"uint256"}],"name":"AdapterSharesMismatch","type":"error"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"AssetBalanceMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"AssetBalanceMismatch","type":"error"},{"inputs":[],"name":"DefaultDepositStrategyShareNotSet","type":"error"},{"inputs":[{"internalType":"uint256","name":"cap","type":"uint256"},{"internalType":"uint256","name":"currentManaged","type":"uint256"},{"internalType":"uint256","name":"incomingAssets","type":"uint256"}],"name":"DepositCapExceeded","type":"error"},{"inputs":[],"name":"EmptyArrays","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"address","name":"strategyShare","type":"address"},{"internalType":"address","name":"currentAdapter","type":"address"},{"internalType":"address","name":"replacementAdapter","type":"address"}],"name":"FundedStrategyAdapterReplacement","type":"error"},{"inputs":[],"name":"IndexOutOfBounds","type":"error"},{"inputs":[],"name":"InsufficientActiveVaults","type":"error"},{"inputs":[],"name":"InsufficientItems","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"newCap","type":"uint256"},{"internalType":"uint256","name":"currentManaged","type":"uint256"}],"name":"InvalidDepositCap","type":"error"},{"inputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"name":"InvalidMaxVaultCount","type":"error"},{"inputs":[{"internalType":"uint256","name":"incentiveBps","type":"uint256"},{"internalType":"uint256","name":"maxBps","type":"uint256"}],"name":"InvalidReinvestIncentive","type":"error"},{"inputs":[{"internalType":"uint256","name":"allowedLoss","type":"uint256"}],"name":"InvalidRoundingLoss","type":"error"},{"inputs":[],"name":"InvalidSelectionCount","type":"error"},{"inputs":[],"name":"InvalidVaultConfig","type":"error"},{"inputs":[{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"uint256","name":"maxFeeBps","type":"uint256"}],"name":"InvalidWithdrawalFee","type":"error"},{"inputs":[],"name":"ModuleCallFailed","type":"error"},{"inputs":[{"internalType":"address","name":"expected","type":"address"},{"internalType":"address","name":"actual","type":"address"}],"name":"ModuleCollateralVaultMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"ModuleMetadataQueryFailed","type":"error"},{"inputs":[],"name":"ModuleNotSet","type":"error"},{"inputs":[{"internalType":"bytes32","name":"expected","type":"bytes32"},{"internalType":"bytes32","name":"actual","type":"bytes32"}],"name":"ModuleStorageMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"expected","type":"address"},{"internalType":"address","name":"actual","type":"address"}],"name":"ModuleTokenMismatch","type":"error"},{"inputs":[],"name":"NoItemsAvailable","type":"error"},{"inputs":[],"name":"NoLiquidityAvailable","type":"error"},{"inputs":[],"name":"ReceiverZero","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"uint256","name":"shortfall","type":"uint256"},{"internalType":"uint256","name":"managedAssets","type":"uint256"}],"name":"SettlementShortfallTooHigh","type":"error"},{"inputs":[],"name":"ShareWithdrawalConversionFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualShares","type":"uint256"},{"internalType":"uint256","name":"minShares","type":"uint256"}],"name":"SharesBelowMinimum","type":"error"},{"inputs":[{"internalType":"uint256","name":"requestedShares","type":"uint256"},{"internalType":"uint256","name":"maxShares","type":"uint256"}],"name":"SharesExceedMaxRedeem","type":"error"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"actualAmount","type":"uint256"},{"internalType":"uint256","name":"requiredAmount","type":"uint256"}],"name":"SlippageCheckFailed","type":"error"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"actualAmount","type":"uint256"},{"internalType":"uint256","name":"requiredAmount","type":"uint256"}],"name":"SlippageCheckFailed","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"expectedShares","type":"uint256"},{"internalType":"uint256","name":"actualShares","type":"uint256"}],"name":"SolverShareDepositShortfall","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint8","name":"measure","type":"uint8"},{"internalType":"uint256","name":"beforeValue","type":"uint256"},{"internalType":"uint256","name":"afterValue","type":"uint256"},{"internalType":"uint256","name":"requiredIncrease","type":"uint256"}],"name":"StrategyBackingLoss","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint8","name":"measure","type":"uint8"},{"internalType":"uint256","name":"beforeValue","type":"uint256"},{"internalType":"uint256","name":"afterValue","type":"uint256"},{"internalType":"uint256","name":"requiredIncrease","type":"uint256"}],"name":"StrategyBackingLoss","type":"error"},{"inputs":[{"internalType":"address","name":"strategyShare","type":"address"}],"name":"StrategyShareAccountingNotSynchronized","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint8","name":"measure","type":"uint8"},{"internalType":"uint256","name":"valueLost","type":"uint256"},{"internalType":"uint256","name":"assetsReceived","type":"uint256"}],"name":"StrategyWithdrawalLoss","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint8","name":"measure","type":"uint8"},{"internalType":"uint256","name":"valueLost","type":"uint256"},{"internalType":"uint256","name":"assetsReceived","type":"uint256"}],"name":"StrategyWithdrawalLoss","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"name":"TotalAllocationInvalid","type":"error"},{"inputs":[],"name":"UnauthorizedConfigCaller","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"VaultAlreadyExists","type":"error"},{"inputs":[{"internalType":"address","name":"strategyShare","type":"address"},{"internalType":"address","name":"existingAdapter","type":"address"}],"name":"VaultAssetManagedByDifferentAdapter","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"VaultMustBeSuspended","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"VaultNotActive","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"VaultNotFound","type":"error"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"targetBps","type":"uint256"}],"name":"VaultTargetNotZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"reported","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"WithdrawalAssetsMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"reported","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"WithdrawalAssetsMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"expectedNet","type":"uint256"},{"internalType":"uint256","name":"actualNet","type":"uint256"}],"name":"WithdrawalShortfall","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"fromAsset","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"}],"name":"ZeroInputDStableValue","type":"error"},{"inputs":[{"internalType":"address","name":"strategyShare","type":"address"}],"name":"ZeroPreviewWithdrawAmount","type":"error"},{"inputs":[],"name":"ZeroWithdrawalAssets","type":"error"},{"inputs":[],"name":"ZeroWithdrawalAssets","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategyShare","type":"address"},{"indexed":false,"internalType":"address","name":"adapterAddress","type":"address"}],"name":"AdapterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategyShare","type":"address"},{"indexed":false,"internalType":"address","name":"adapterAddress","type":"address"}],"name":"AdapterSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"strategyShare","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strategyShares","type":"uint256"}],"name":"BackingCompounded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategyShare","type":"address"}],"name":"DefaultDepositStrategyShareSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"previousCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCap","type":"uint256"}],"name":"DepositCapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDustTolerance","type":"uint256"}],"name":"DustToleranceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"governanceModule","type":"address"}],"name":"GovernanceModuleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCount","type":"uint256"}],"name":"MaxVaultCountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PausedCashRescued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rebalanceModule","type":"address"}],"name":"RebalanceModuleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newIncentiveBps","type":"uint256"}],"name":"ReinvestIncentiveSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"initiator","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"strategyVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"RouterDepositRouted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountReinvested","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"incentivePaid","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"RouterFeesReinvested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sharesMinted","type":"uint256"}],"name":"RouterSolverDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"grossAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sharesBurned","type":"uint256"}],"name":"RouterSolverWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"initiator","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"strategyVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"grossAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"RouterWithdrawSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"previousShortfall","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newShortfall","type":"uint256"}],"name":"SettlementShortfallUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromVault","type":"address"},{"indexed":true,"internalType":"address","name":"toVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"initiator","type":"address"}],"name":"StrategiesRebalanced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"selectedVaults","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"depositAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"totalDStableAmount","type":"uint256"}],"name":"StrategyDepositRouted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromStrategyShare","type":"address"},{"indexed":true,"internalType":"address","name":"toStrategyShare","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromShareAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toShareAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dStableAmountEquivalent","type":"uint256"},{"indexed":true,"internalType":"address","name":"exchanger","type":"address"}],"name":"StrategySharesExchanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"selectedVaults","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"withdrawalAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"totalDStableAmount","type":"uint256"}],"name":"StrategyWithdrawalRouted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"vaultAsset","type":"address"}],"name":"SurplusSwept","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"adapter","type":"address"},{"indexed":false,"internalType":"uint256","name":"targetBps","type":"uint256"},{"indexed":false,"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"status","type":"uint8"}],"name":"VaultConfigAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"}],"name":"VaultConfigRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"adapter","type":"address"},{"indexed":false,"internalType":"uint256","name":"targetBps","type":"uint256"},{"indexed":false,"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"status","type":"uint8"}],"name":"VaultConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"previousFeeBps","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeBps","type":"uint256"}],"name":"WithdrawalFeeSet","type":"event"},{"inputs":[],"name":"ADAPTER_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BACKING_GUARD_VERSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONFIG_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DSTAKE_TOKEN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ACCOUNTING_ROUNDING_LOSS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REINVEST_INCENTIVE_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WITHDRAWAL_FEE_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STRATEGY_REBALANCER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"addAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"","type":"uint8"}],"name":"addVaultConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"strategyVault","type":"address"},{"internalType":"address","name":"adapter","type":"address"},{"internalType":"uint256","name":"targetBps","type":"uint256"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"status","type":"uint8"}],"internalType":"struct DStakeRouterV2Storage.VaultConfig","name":"","type":"tuple"}],"name":"addVaultConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"clearDefaultDepositStrategyShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"clearShortfall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collateralVault","outputs":[{"internalType":"contract IDStakeCollateralVaultV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"compoundDeposit","outputs":[{"internalType":"address","name":"strategyShare","type":"address"},{"internalType":"uint256","name":"strategyShares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentShortfall","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dStakeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultDepositStrategyShare","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"disposeRetiredStrategyDust","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dustTolerance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"emergencyPauseVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getActiveVaultsForDeposits","outputs":[{"internalType":"address[]","name":"activeVaults","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveVaultsForWithdrawals","outputs":[{"internalType":"address[]","name":"activeVaults","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentAllocations","outputs":[{"internalType":"address[]","name":"vaults","type":"address[]"},{"internalType":"uint256[]","name":"currentAllocations","type":"uint256[]"},{"internalType":"uint256[]","name":"targetAllocations","type":"uint256[]"},{"internalType":"uint256","name":"totalBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxSingleVaultWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"getVaultConfig","outputs":[{"components":[{"internalType":"address","name":"strategyVault","type":"address"},{"internalType":"address","name":"adapter","type":"address"},{"internalType":"uint256","name":"targetBps","type":"uint256"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"status","type":"uint8"}],"internalType":"struct DStakeRouterV2Storage.VaultConfig","name":"config","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getVaultConfigByIndex","outputs":[{"components":[{"internalType":"address","name":"strategyVault","type":"address"},{"internalType":"address","name":"adapter","type":"address"},{"internalType":"uint256","name":"targetBps","type":"uint256"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"status","type":"uint8"}],"internalType":"struct DStakeRouterV2Storage.VaultConfig","name":"config","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"initiator","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"handleDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"initiator","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"grossAssets","type":"uint256"},{"internalType":"uint256","name":"expectedNetAssets","type":"uint256"}],"name":"handleWithdraw","outputs":[{"internalType":"uint256","name":"netAssets","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"isVaultHealthyForDeposits","outputs":[{"internalType":"bool","name":"healthy","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"isVaultHealthyForWithdrawals","outputs":[{"internalType":"bool","name":"healthy","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxVaultCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWithdrawalFeeBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"operationRoundingLoss","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebalanceModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rebalanceStrategiesByShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rebalanceStrategiesBySharesViaExternalLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rebalanceStrategiesByValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"recordShortfall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reinvestFees","outputs":[{"internalType":"uint256","name":"amountReinvested","type":"uint256"},{"internalType":"uint256","name":"incentivePaid","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reinvestIncentiveBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"removeAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"removeVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"removeVaultConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescuePausedCash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"setDefaultDepositStrategyShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"setDepositCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"setDustTolerance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newModule","type":"address"}],"name":"setGovernanceModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"setMaxVaultCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"setOperationRoundingLoss","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newModule","type":"address"}],"name":"setRebalanceModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"setReinvestIncentive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"setStrategyRoundingLoss","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"strategyVault","type":"address"},{"internalType":"address","name":"adapter","type":"address"},{"internalType":"uint256","name":"targetBps","type":"uint256"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"status","type":"uint8"}],"internalType":"struct DStakeRouterV2Storage.VaultConfig[]","name":"","type":"tuple[]"}],"name":"setVaultConfigs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"","type":"uint8"}],"name":"setVaultStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"setWithdrawalFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settlementShortfall","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"vaults","type":"address[]"},{"internalType":"uint256[]","name":"assets","type":"uint256[]"},{"internalType":"uint256","name":"minShares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"solverDepositAssets","outputs":[{"internalType":"uint256","name":"sharesMinted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"vaults","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"},{"internalType":"uint256","name":"minShares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"solverDepositShares","outputs":[{"internalType":"uint256","name":"sharesMinted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"vaults","type":"address[]"},{"internalType":"uint256[]","name":"assets","type":"uint256[]"},{"internalType":"uint256","name":"maxShares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"solverWithdrawAssets","outputs":[{"internalType":"uint256","name":"netAssets","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"sharesBurned","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"vaults","type":"address[]"},{"internalType":"uint256[]","name":"strategyShares","type":"uint256[]"},{"internalType":"uint256","name":"maxShares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"solverWithdrawShares","outputs":[{"internalType":"uint256","name":"netAssets","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"sharesBurned","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategyShare","type":"address"}],"name":"strategyRoundingLoss","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"strategyShare","type":"address"}],"name":"strategyShareToAdapter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"suspendVaultForRemoval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"sweepSurplus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalManagedAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"","type":"uint8"}],"name":"updateVaultConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"strategyVault","type":"address"},{"internalType":"address","name":"adapter","type":"address"},{"internalType":"uint256","name":"targetBps","type":"uint256"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"status","type":"uint8"}],"internalType":"struct DStakeRouterV2Storage.VaultConfig","name":"","type":"tuple"}],"name":"updateVaultConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vaultConfigs","outputs":[{"internalType":"address","name":"strategyVault","type":"address"},{"internalType":"address","name":"adapter","type":"address"},{"internalType":"uint256","name":"targetBps","type":"uint256"},{"internalType":"enum DStakeRouterV2Storage.VaultStatus","name":"status","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vaultExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vaultToIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalFeeBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}],"conflicting_implementations":null,"certified":false,"additional_sources":[{"file_path":"@openzeppelin/contracts/access/AccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.20;\n\nimport {IAccessControl} from \"./IAccessControl.sol\";\nimport {Context} from \"../utils/Context.sol\";\nimport {IERC165, ERC165} from \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n    struct RoleData {\n        mapping(address account => bool) hasRole;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 role => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Modifier that checks that an account has a specific role. Reverts\n     * with an {AccessControlUnauthorizedAccount} error including the required role.\n     */\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role);\n        _;\n    }\n\n    /// @inheritdoc IERC165\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n        return _roles[role].hasRole[account];\n    }\n\n    /**\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n     */\n    function _checkRole(bytes32 role) internal view virtual {\n        _checkRole(role, _msgSender());\n    }\n\n    /**\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n     * is missing `role`.\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert AccessControlUnauthorizedAccount(account, role);\n        }\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `callerConfirmation`.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n        if (callerConfirmation != _msgSender()) {\n            revert AccessControlBadConfirmation();\n        }\n\n        _revokeRole(role, callerConfirmation);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /**\n     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n        if (!hasRole(role, account)) {\n            _roles[role].hasRole[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n        if (hasRole(role, account)) {\n            _roles[role].hasRole[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n            return true;\n        } else {\n            return false;\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/access/IAccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol)\n\npragma solidity >=0.8.4;\n\n/**\n * @dev External interface of AccessControl declared to support ERC-165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev The `account` is missing a role.\n     */\n    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n    /**\n     * @dev The caller of a function is not the expected one.\n     *\n     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n     */\n    error AccessControlBadConfirmation();\n\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted to signal this.\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).\n     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `callerConfirmation`.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n"},{"file_path":"@openzeppelin/contracts/interfaces/IERC1363.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n    /*\n     * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n     * 0xb0202a11 ===\n     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n     */\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @param data Additional data with no specified format, sent in call to `spender`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/interfaces/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"},{"file_path":"@openzeppelin/contracts/interfaces/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"},{"file_path":"@openzeppelin/contracts/interfaces/IERC4626.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC4626.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC-4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n    event Withdraw(\n        address indexed sender,\n        address indexed receiver,\n        address indexed owner,\n        uint256 assets,\n        uint256 shares\n    );\n\n    /**\n     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n     *\n     * - MUST be an ERC-20 token contract.\n     * - MUST NOT revert.\n     */\n    function asset() external view returns (address assetTokenAddress);\n\n    /**\n     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n     *\n     * - SHOULD include any compounding that occurs from yield.\n     * - MUST be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT revert.\n     */\n    function totalAssets() external view returns (uint256 totalManagedAssets);\n\n    /**\n     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n     * through a deposit call.\n     *\n     * - MUST return a limited value if receiver is subject to some deposit limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n     * - MUST NOT revert.\n     */\n    function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n     *   in the same transaction.\n     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   deposit execution, and are accounted for during deposit.\n     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n     * - MUST return a limited value if receiver is subject to some mint limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n     * - MUST NOT revert.\n     */\n    function maxMint(address receiver) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n     *   same transaction.\n     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n     *   would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by minting.\n     */\n    function previewMint(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n     *   execution, and are accounted for during mint.\n     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n     * Vault, through a withdraw call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n     *   called\n     *   in the same transaction.\n     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   withdraw execution, and are accounted for during withdraw.\n     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n     * through a redeem call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their redemption at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n     *   same transaction.\n     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n     *   redemption would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n     */\n    function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   redeem execution, and are accounted for during redeem.\n     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    /**\n     * @dev An operation with an ERC-20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     *\n     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n     * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n     * set here.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            safeTransfer(token, to, value);\n        } else if (!token.transferAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferFromAndCallRelaxed(\n        IERC1363 token,\n        address from,\n        address to,\n        uint256 value,\n        bytes memory data\n    ) internal {\n        if (to.code.length == 0) {\n            safeTransferFrom(token, from, to, value);\n        } else if (!token.transferFromAndCall(from, to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n     * once without retrying, and relies on the returned value to be true.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            forceApprove(token, to, value);\n        } else if (!token.approveAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly (\"memory-safe\") {\n            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n            // bubble errors\n            if iszero(success) {\n                let ptr := mload(0x40)\n                returndatacopy(ptr, 0, returndatasize())\n                revert(ptr, returndatasize())\n            }\n            returnSize := returndatasize()\n            returnValue := mload(0)\n        }\n\n        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        bool success;\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly (\"memory-safe\") {\n            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n            returnSize := returndatasize()\n            returnValue := mload(0)\n        }\n        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Panic.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n *      using Panic for uint256;\n *\n *      // Use any of the declared internal constants\n *      function foo() { Panic.GENERIC.panic(); }\n *\n *      // Alternatively\n *      function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n    /// @dev generic / unspecified error\n    uint256 internal constant GENERIC = 0x00;\n    /// @dev used by the assert() builtin\n    uint256 internal constant ASSERT = 0x01;\n    /// @dev arithmetic underflow or overflow\n    uint256 internal constant UNDER_OVERFLOW = 0x11;\n    /// @dev division or modulo by zero\n    uint256 internal constant DIVISION_BY_ZERO = 0x12;\n    /// @dev enum conversion error\n    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n    /// @dev invalid encoding in storage\n    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n    /// @dev empty array pop\n    uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n    /// @dev array out of bounds access\n    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n    /// @dev resource error (too large allocation or too large array)\n    uint256 internal constant RESOURCE_ERROR = 0x41;\n    /// @dev calling invalid internal function\n    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n    /// @dev Reverts with a panic code. Recommended to use with\n    /// the internal constants with predefined codes.\n    function panic(uint256 code) internal pure {\n        assembly (\"memory-safe\") {\n            mstore(0x00, 0x4e487b71)\n            mstore(0x20, code)\n            revert(0x1c, 0x24)\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Pausable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n    bool private _paused;\n\n    /**\n     * @dev Emitted when the pause is triggered by `account`.\n     */\n    event Paused(address account);\n\n    /**\n     * @dev Emitted when the pause is lifted by `account`.\n     */\n    event Unpaused(address account);\n\n    /**\n     * @dev The operation failed because the contract is paused.\n     */\n    error EnforcedPause();\n\n    /**\n     * @dev The operation failed because the contract is not paused.\n     */\n    error ExpectedPause();\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    modifier whenNotPaused() {\n        _requireNotPaused();\n        _;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is paused.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    modifier whenPaused() {\n        _requirePaused();\n        _;\n    }\n\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() public view virtual returns (bool) {\n        return _paused;\n    }\n\n    /**\n     * @dev Throws if the contract is paused.\n     */\n    function _requireNotPaused() internal view virtual {\n        if (paused()) {\n            revert EnforcedPause();\n        }\n    }\n\n    /**\n     * @dev Throws if the contract is not paused.\n     */\n    function _requirePaused() internal view virtual {\n        if (!paused()) {\n            revert ExpectedPause();\n        }\n    }\n\n    /**\n     * @dev Triggers stopped state.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    function _pause() internal virtual whenNotPaused {\n        _paused = true;\n        emit Paused(_msgSender());\n    }\n\n    /**\n     * @dev Returns to normal state.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    function _unpause() internal virtual whenPaused {\n        _paused = false;\n        emit Unpaused(_msgSender());\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/ReentrancyGuard.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n * consider using {ReentrancyGuardTransient} instead.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/ERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n    /// @inheritdoc IERC165\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/Math.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Return the 512-bit addition of two uint256.\n     *\n     * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.\n     */\n    function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        assembly (\"memory-safe\") {\n            low := add(a, b)\n            high := lt(low, a)\n        }\n    }\n\n    /**\n     * @dev Return the 512-bit multiplication of two uint256.\n     *\n     * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.\n     */\n    function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n        // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n        // variables such that product = high * 2²⁵⁶ + low.\n        assembly (\"memory-safe\") {\n            let mm := mulmod(a, b, not(0))\n            low := mul(a, b)\n            high := sub(sub(mm, low), lt(mm, low))\n        }\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a + b;\n            success = c >= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a - b;\n            success = c <= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a * b;\n            assembly (\"memory-safe\") {\n                // Only true when the multiplication doesn't overflow\n                // (c / a == b) || (a == 0)\n                success := or(eq(div(c, a), b), iszero(a))\n            }\n            // equivalent to: success ? c : 0\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `DIV` opcode returns zero when the denominator is 0.\n                result := div(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `MOD` opcode returns zero when the denominator is 0.\n                result := mod(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryAdd(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.\n     */\n    function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {\n        (, uint256 result) = trySub(a, b);\n        return result;\n    }\n\n    /**\n     * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryMul(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n     *\n     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n     * one branch when needed, making this function more expensive.\n     */\n    function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n        unchecked {\n            // branchless ternary works because:\n            // b ^ (a ^ b) == a\n            // b ^ 0 == b\n            return b ^ ((a ^ b) * SafeCast.toUint(condition));\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a > b, a, b);\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a < b, a, b);\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n\n        // The following calculation ensures accurate ceiling division without overflow.\n        // Since a is non-zero, (a - 1) / b will not overflow.\n        // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n        // but the largest value we can obtain is type(uint256).max - 1, which happens\n        // when a = type(uint256).max and b = 1.\n        unchecked {\n            return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n        }\n    }\n\n    /**\n     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     *\n     * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (high == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return low / denominator;\n            }\n\n            // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n            if (denominator <= high) {\n                Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [high low].\n            uint256 remainder;\n            assembly (\"memory-safe\") {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                high := sub(high, gt(remainder, low))\n                low := sub(low, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly (\"memory-safe\") {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [high low] by twos.\n                low := div(low, twos)\n\n                // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from high into low.\n            low |= high * twos;\n\n            // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n            inverse *= 2 - denominator * inverse; // inverse mod 2³²\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n            // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high\n            // is no longer required.\n            result = low * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n    }\n\n    /**\n     * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n            if (high >= 1 << n) {\n                Panic.panic(Panic.UNDER_OVERFLOW);\n            }\n            return (high << (256 - n)) | (low >> n);\n        }\n    }\n\n    /**\n     * @dev Calculates x * y >> n with full precision, following the selected rounding direction.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {\n        return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);\n    }\n\n    /**\n     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n     *\n     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n     *\n     * If the input value is not inversible, 0 is returned.\n     *\n     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n     * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n     */\n    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n        unchecked {\n            if (n == 0) return 0;\n\n            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n            // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n            // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n            // ax + ny = 1\n            // ax = 1 + (-y)n\n            // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n            // If the remainder is 0 the gcd is n right away.\n            uint256 remainder = a % n;\n            uint256 gcd = n;\n\n            // Therefore the initial coefficients are:\n            // ax + ny = gcd(a, n) = n\n            // 0a + 1n = n\n            int256 x = 0;\n            int256 y = 1;\n\n            while (remainder != 0) {\n                uint256 quotient = gcd / remainder;\n\n                (gcd, remainder) = (\n                    // The old remainder is the next gcd to try.\n                    remainder,\n                    // Compute the next remainder.\n                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n                    // where gcd is at most n (capped to type(uint256).max)\n                    gcd - remainder * quotient\n                );\n\n                (x, y) = (\n                    // Increment the coefficient of a.\n                    y,\n                    // Decrement the coefficient of n.\n                    // Can overflow, but the result is casted to uint256 so that the\n                    // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n                    x - y * int256(quotient)\n                );\n            }\n\n            if (gcd != 1) return 0; // No inverse exists.\n            return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n        }\n    }\n\n    /**\n     * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n     *\n     * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n     * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n     * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n     *\n     * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n     */\n    function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n        unchecked {\n            return Math.modExp(a, p - 2, p);\n        }\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n     *\n     * Requirements:\n     * - modulus can't be zero\n     * - underlying staticcall to precompile must succeed\n     *\n     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n     * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n     * interpreted as 0.\n     */\n    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n        (bool success, uint256 result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n     * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n     * to operate modulo 0 or if the underlying precompile reverted.\n     *\n     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n     * of a revert, but the result may be incorrectly interpreted as 0.\n     */\n    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n        if (m == 0) return (false, 0);\n        assembly (\"memory-safe\") {\n            let ptr := mload(0x40)\n            // | Offset    | Content    | Content (Hex)                                                      |\n            // |-----------|------------|--------------------------------------------------------------------|\n            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n            // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n            mstore(ptr, 0x20)\n            mstore(add(ptr, 0x20), 0x20)\n            mstore(add(ptr, 0x40), 0x20)\n            mstore(add(ptr, 0x60), b)\n            mstore(add(ptr, 0x80), e)\n            mstore(add(ptr, 0xa0), m)\n\n            // Given the result < m, it's guaranteed to fit in 32 bytes,\n            // so we can use the memory scratch space located at offset 0.\n            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n            result := mload(0x00)\n        }\n    }\n\n    /**\n     * @dev Variant of {modExp} that supports inputs of arbitrary length.\n     */\n    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n        (bool success, bytes memory result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n     */\n    function tryModExp(\n        bytes memory b,\n        bytes memory e,\n        bytes memory m\n    ) internal view returns (bool success, bytes memory result) {\n        if (_zeroBytes(m)) return (false, new bytes(0));\n\n        uint256 mLen = m.length;\n\n        // Encode call args in result and move the free memory pointer\n        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n        assembly (\"memory-safe\") {\n            let dataPtr := add(result, 0x20)\n            // Write result on top of args to avoid allocating extra memory.\n            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n            // Overwrite the length.\n            // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n            mstore(result, mLen)\n            // Set the memory pointer after the returned data.\n            mstore(0x40, add(dataPtr, mLen))\n        }\n    }\n\n    /**\n     * @dev Returns whether the provided byte array is zero.\n     */\n    function _zeroBytes(bytes memory byteArray) private pure returns (bool) {\n        for (uint256 i = 0; i < byteArray.length; ++i) {\n            if (byteArray[i] != 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n     * using integer operations.\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        unchecked {\n            // Take care of easy edge cases when a == 0 or a == 1\n            if (a <= 1) {\n                return a;\n            }\n\n            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n            // the current value as `ε_n = | x_n - sqrt(a) |`.\n            //\n            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n            // bigger than any uint256.\n            //\n            // By noticing that\n            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n            // to the msb function.\n            uint256 aa = a;\n            uint256 xn = 1;\n\n            if (aa >= (1 << 128)) {\n                aa >>= 128;\n                xn <<= 64;\n            }\n            if (aa >= (1 << 64)) {\n                aa >>= 64;\n                xn <<= 32;\n            }\n            if (aa >= (1 << 32)) {\n                aa >>= 32;\n                xn <<= 16;\n            }\n            if (aa >= (1 << 16)) {\n                aa >>= 16;\n                xn <<= 8;\n            }\n            if (aa >= (1 << 8)) {\n                aa >>= 8;\n                xn <<= 4;\n            }\n            if (aa >= (1 << 4)) {\n                aa >>= 4;\n                xn <<= 2;\n            }\n            if (aa >= (1 << 2)) {\n                xn <<= 1;\n            }\n\n            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n            //\n            // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n            // This is going to be our x_0 (and ε_0)\n            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n            // From here, Newton's method give us:\n            // x_{n+1} = (x_n + a / x_n) / 2\n            //\n            // One should note that:\n            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n            //              = ((x_n² + a) / (2 * x_n))² - a\n            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n            //              = (x_n² - a)² / (2 * x_n)²\n            //              = ((x_n² - a) / (2 * x_n))²\n            //              ≥ 0\n            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n            //\n            // This gives us the proof of quadratic convergence of the sequence:\n            // ε_{n+1} = | x_{n+1} - sqrt(a) |\n            //         = | (x_n + a / x_n) / 2 - sqrt(a) |\n            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n            //         = | (x_n - sqrt(a))² / (2 * x_n) |\n            //         = | ε_n² / (2 * x_n) |\n            //         = ε_n² / | (2 * x_n) |\n            //\n            // For the first iteration, we have a special case where x_0 is known:\n            // ε_1 = ε_0² / | (2 * x_0) |\n            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))\n            //     ≤ 2**(e-3) / 3\n            //     ≤ 2**(e-3-log2(3))\n            //     ≤ 2**(e-4.5)\n            //\n            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n            // ε_{n+1} = ε_n² / | (2 * x_n) |\n            //         ≤ (2**(e-k))² / (2 * 2**(e-1))\n            //         ≤ 2**(2*e-2*k) / 2**e\n            //         ≤ 2**(e-2*k)\n            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above\n            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5\n            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9\n            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18\n            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36\n            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72\n\n            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n            // sqrt(a) or sqrt(a) + 1.\n            return xn - SafeCast.toUint(xn > a / xn);\n        }\n    }\n\n    /**\n     * @dev Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // If upper 8 bits of 16-bit half set, add 8 to result\n        r |= SafeCast.toUint((x >> r) > 0xff) << 3;\n        // If upper 4 bits of 8-bit half set, add 4 to result\n        r |= SafeCast.toUint((x >> r) > 0xf) << 2;\n\n        // Shifts value right by the current result and use it as an index into this lookup table:\n        //\n        // | x (4 bits) |  index  | table[index] = MSB position |\n        // |------------|---------|-----------------------------|\n        // |    0000    |    0    |        table[0] = 0         |\n        // |    0001    |    1    |        table[1] = 0         |\n        // |    0010    |    2    |        table[2] = 1         |\n        // |    0011    |    3    |        table[3] = 1         |\n        // |    0100    |    4    |        table[4] = 2         |\n        // |    0101    |    5    |        table[5] = 2         |\n        // |    0110    |    6    |        table[6] = 2         |\n        // |    0111    |    7    |        table[7] = 2         |\n        // |    1000    |    8    |        table[8] = 3         |\n        // |    1001    |    9    |        table[9] = 3         |\n        // |    1010    |   10    |        table[10] = 3        |\n        // |    1011    |   11    |        table[11] = 3        |\n        // |    1100    |   12    |        table[12] = 3        |\n        // |    1101    |   13    |        table[13] = 3        |\n        // |    1110    |   14    |        table[14] = 3        |\n        // |    1111    |   15    |        table[15] = 3        |\n        //\n        // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.\n        assembly (\"memory-safe\") {\n            r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8\n        return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n    /**\n     * @dev Value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n    /**\n     * @dev An int value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedIntToUint(int256 value);\n\n    /**\n     * @dev Value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n    /**\n     * @dev An uint value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedUintToInt(uint256 value);\n\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        if (value > type(uint248).max) {\n            revert SafeCastOverflowedUintDowncast(248, value);\n        }\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        if (value > type(uint240).max) {\n            revert SafeCastOverflowedUintDowncast(240, value);\n        }\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        if (value > type(uint232).max) {\n            revert SafeCastOverflowedUintDowncast(232, value);\n        }\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        if (value > type(uint224).max) {\n            revert SafeCastOverflowedUintDowncast(224, value);\n        }\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        if (value > type(uint216).max) {\n            revert SafeCastOverflowedUintDowncast(216, value);\n        }\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        if (value > type(uint208).max) {\n            revert SafeCastOverflowedUintDowncast(208, value);\n        }\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        if (value > type(uint200).max) {\n            revert SafeCastOverflowedUintDowncast(200, value);\n        }\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        if (value > type(uint192).max) {\n            revert SafeCastOverflowedUintDowncast(192, value);\n        }\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        if (value > type(uint184).max) {\n            revert SafeCastOverflowedUintDowncast(184, value);\n        }\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        if (value > type(uint176).max) {\n            revert SafeCastOverflowedUintDowncast(176, value);\n        }\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        if (value > type(uint168).max) {\n            revert SafeCastOverflowedUintDowncast(168, value);\n        }\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        if (value > type(uint160).max) {\n            revert SafeCastOverflowedUintDowncast(160, value);\n        }\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        if (value > type(uint152).max) {\n            revert SafeCastOverflowedUintDowncast(152, value);\n        }\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        if (value > type(uint144).max) {\n            revert SafeCastOverflowedUintDowncast(144, value);\n        }\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        if (value > type(uint136).max) {\n            revert SafeCastOverflowedUintDowncast(136, value);\n        }\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        if (value > type(uint128).max) {\n            revert SafeCastOverflowedUintDowncast(128, value);\n        }\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        if (value > type(uint120).max) {\n            revert SafeCastOverflowedUintDowncast(120, value);\n        }\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        if (value > type(uint112).max) {\n            revert SafeCastOverflowedUintDowncast(112, value);\n        }\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        if (value > type(uint104).max) {\n            revert SafeCastOverflowedUintDowncast(104, value);\n        }\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        if (value > type(uint96).max) {\n            revert SafeCastOverflowedUintDowncast(96, value);\n        }\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        if (value > type(uint88).max) {\n            revert SafeCastOverflowedUintDowncast(88, value);\n        }\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        if (value > type(uint80).max) {\n            revert SafeCastOverflowedUintDowncast(80, value);\n        }\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        if (value > type(uint72).max) {\n            revert SafeCastOverflowedUintDowncast(72, value);\n        }\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert SafeCastOverflowedUintDowncast(64, value);\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        if (value > type(uint56).max) {\n            revert SafeCastOverflowedUintDowncast(56, value);\n        }\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        if (value > type(uint48).max) {\n            revert SafeCastOverflowedUintDowncast(48, value);\n        }\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert SafeCastOverflowedUintDowncast(40, value);\n        }\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        if (value > type(uint32).max) {\n            revert SafeCastOverflowedUintDowncast(32, value);\n        }\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        if (value > type(uint24).max) {\n            revert SafeCastOverflowedUintDowncast(24, value);\n        }\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        if (value > type(uint16).max) {\n            revert SafeCastOverflowedUintDowncast(16, value);\n        }\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        if (value > type(uint8).max) {\n            revert SafeCastOverflowedUintDowncast(8, value);\n        }\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        if (value < 0) {\n            revert SafeCastOverflowedIntToUint(value);\n        }\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(248, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(240, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(232, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(224, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(216, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(208, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(200, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(192, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(184, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(176, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(168, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(160, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(152, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(144, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(136, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(128, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(120, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(112, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(104, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(96, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(88, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(80, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(72, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(64, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(56, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(48, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(40, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(32, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(24, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(16, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(8, value);\n        }\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        if (value > uint256(type(int256).max)) {\n            revert SafeCastOverflowedUintToInt(value);\n        }\n        return int256(value);\n    }\n\n    /**\n     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n     */\n    function toUint(bool b) internal pure returns (uint256 u) {\n        assembly (\"memory-safe\") {\n            u := iszero(iszero(b))\n        }\n    }\n}\n"},{"file_path":"contracts/common/BasisPointConstants.sol","source_code":"// SPDX-License-Identifier: MIT\n/* ———————————————————————————————————————————————————————————————————————————————— *\n *    _____     ______   ______     __     __   __     __     ______   __  __       *\n *   /\\  __-.  /\\__  _\\ /\\  == \\   /\\ \\   /\\ \"-.\\ \\   /\\ \\   /\\__  _\\ /\\ \\_\\ \\      *\n *   \\ \\ \\/\\ \\ \\/_/\\ \\/ \\ \\  __<   \\ \\ \\  \\ \\ \\-.  \\  \\ \\ \\  \\/_/\\ \\/ \\ \\____ \\     *\n *    \\ \\____-    \\ \\_\\  \\ \\_\\ \\_\\  \\ \\_\\  \\ \\_\\\\\"\\_\\  \\ \\_\\    \\ \\_\\  \\/\\_____\\    *\n *     \\/____/     \\/_/   \\/_/ /_/   \\/_/   \\/_/ \\/_/   \\/_/     \\/_/   \\/_____/    *\n *                                                                                  *\n * ————————————————————————————————— dtrinity.org ————————————————————————————————— *\n *                                                                                  *\n *                                         ▲                                        *\n *                                        ▲ ▲                                       *\n *                                                                                  *\n * ———————————————————————————————————————————————————————————————————————————————— *\n * dTRINITY Protocol: https://github.com/dtrinity                                   *\n * ———————————————————————————————————————————————————————————————————————————————— */\n\npragma solidity ^0.8.20;\n\nlibrary BasisPointConstants {\n    // Shared definitions of how we represent percentages and basis points\n    uint16 public constant ONE_BPS = 100; // 1 basis point with 2 decimals\n    uint32 public constant ONE_PERCENT_BPS = ONE_BPS * 100;\n    uint32 public constant ONE_HUNDRED_PERCENT_BPS = ONE_PERCENT_BPS * 100;\n}\n"},{"file_path":"contracts/common/WithdrawalFeeMath.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport { BasisPointConstants } from \"./BasisPointConstants.sol\";\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\n\nlibrary WithdrawalFeeMath {\n    uint256 internal constant _SCALE = BasisPointConstants.ONE_HUNDRED_PERCENT_BPS;\n\n    // Calculates the fee portion of `grossAmount` using precise basis-point math.\n    function calculateWithdrawalFee(uint256 grossAmount, uint256 feeBps) internal pure returns (uint256) {\n        if (grossAmount == 0 || feeBps == 0) {\n            return 0;\n        }\n        if (feeBps >= _SCALE) {\n            return grossAmount;\n        }\n        return Math.mulDiv(grossAmount, feeBps, _SCALE);\n    }\n\n    // Returns the user-facing amount once the fee has been kept inside the vault.\n    // Clamp the result at zero so call sites never underflow when the fee equals or exceeds the gross amount.\n    function netAfterFee(uint256 grossAmount, uint256 feeBps) internal pure returns (uint256) {\n        if (grossAmount == 0) {\n            return 0;\n        }\n        if (feeBps == 0) {\n            return grossAmount;\n        }\n        if (feeBps >= _SCALE) {\n            return 0;\n        }\n\n        uint256 fee = calculateWithdrawalFee(grossAmount, feeBps);\n        if (fee >= grossAmount) {\n            return 0;\n        }\n        return grossAmount - fee;\n    }\n\n    // Computes the gross value that must be withdrawn in order to deliver `netAmount` to the user.\n    // We round up so the caller never under-delivers, then tighten by a single wei to avoid overpaying\n    // whenever the ceil step overshoots by one.\n    function grossFromNet(uint256 netAmount, uint256 feeBps) internal pure returns (uint256) {\n        if (netAmount == 0 || feeBps == 0) {\n            return netAmount;\n        }\n        if (feeBps >= _SCALE) {\n            return 0;\n        }\n\n        uint256 grossAmount = Math.mulDiv(netAmount, _SCALE, _SCALE - feeBps, Math.Rounding.Ceil);\n\n        if (grossAmount > 0) {\n            // Redo the math with one wei less; if the net is still sufficient we return the tighter value.\n            uint256 alternativeNet = netAfterFee(grossAmount - 1, feeBps);\n            if (alternativeNet >= netAmount) {\n                grossAmount -= 1;\n            }\n        }\n\n        return grossAmount;\n    }\n}\n"},{"file_path":"contracts/vaults/dstake/DStakeRouterV2.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Pausable } from \"@openzeppelin/contracts/utils/Pausable.sol\";\nimport { IERC4626 } from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\n\nimport { IDStakeRouterV2 } from \"./interfaces/IDStakeRouterV2.sol\";\nimport { IDStableConversionAdapterV2 } from \"./interfaces/IDStableConversionAdapterV2.sol\";\nimport { IDStakeCollateralVaultV2 } from \"./interfaces/IDStakeCollateralVaultV2.sol\";\nimport { DeterministicVaultSelector } from \"./libraries/DeterministicVaultSelector.sol\";\nimport { StrategyBackingGuard } from \"./libraries/StrategyBackingGuard.sol\";\nimport { AllocationCalculator } from \"./libraries/AllocationCalculator.sol\";\nimport { BasisPointConstants } from \"../../common/BasisPointConstants.sol\";\nimport { WithdrawalFeeMath } from \"../../common/WithdrawalFeeMath.sol\";\nimport { DStakeRouterV2Storage } from \"./DStakeRouterV2Storage.sol\";\nimport { IDStakeRouterV2Module } from \"./interfaces/IDStakeRouterV2Module.sol\";\n\ninterface IDStakeTokenV2Minimal {\n    function asset() external view returns (address);\n\n    function router() external view returns (address);\n\n    function balanceOf(address account) external view returns (uint256);\n\n    function totalAssets() external view returns (uint256);\n\n    function previewDeposit(uint256 assets) external view returns (uint256);\n\n    function previewMint(uint256 shares) external view returns (uint256);\n\n    function previewWithdraw(uint256 assets) external view returns (uint256);\n\n    function previewRedeem(uint256 shares) external view returns (uint256);\n\n    function mintForRouter(address initiator, address receiver, uint256 assets, uint256 shares) external;\n\n    function burnFromRouter(\n        address initiator,\n        address receiver,\n        address owner,\n        uint256 netAssets,\n        uint256 shares\n    ) external;\n}\n\n/**\n * @title DStakeRouterV2\n * @notice Provides deterministic routing for dSTAKE, pairing single-vault ERC4626 flows with solver-managed multi-vault operations.\n * @dev Extends the original single-dLEND router with allocation-aware selection and solver support for explicit multi-vault paths.\n */\ncontract DStakeRouterV2 is IDStakeRouterV2, DStakeRouterV2Storage {\n    using SafeERC20 for IERC20;\n    using AllocationCalculator for uint256[];\n    using Math for uint256;\n\n    // --- Errors ---\n    error AdapterNotFound(address strategyShare);\n    error ZeroPreviewWithdrawAmount(address strategyShare);\n    error VaultAssetManagedByDifferentAdapter(address strategyShare, address existingAdapter);\n    error ZeroInputDStableValue(address fromAsset, uint256 fromAmount);\n    error AdapterAssetMismatch(address adapter, address expectedAsset, address actualAsset);\n    error SlippageCheckFailed(address asset, uint256 actualAmount, uint256 requiredAmount);\n    error AdapterSharesMismatch(uint256 actualShares, uint256 reportedShares);\n    error ShareWithdrawalConversionFailed();\n    error SolverShareDepositShortfall(address vault, uint256 expectedShares, uint256 actualShares);\n    error InvalidAmount();\n    error InvalidVaultConfig();\n    error VaultNotActive(address vault);\n    error VaultNotFound(address vault);\n    error InsufficientActiveVaults();\n    error VaultAlreadyExists(address vault);\n    error TotalAllocationInvalid(uint256 total);\n    error NoLiquidityAvailable();\n    error InvalidMaxVaultCount(uint256 count);\n    error EmptyArrays();\n    error IndexOutOfBounds();\n    error WithdrawalShortfall(uint256 expectedNet, uint256 actualNet);\n    error ReceiverZero();\n    error DepositCapExceeded(uint256 cap, uint256 currentManaged, uint256 incomingAssets);\n    error SharesBelowMinimum(uint256 actualShares, uint256 minShares);\n    error SharesExceedMaxRedeem(uint256 requestedShares, uint256 maxShares);\n    error InvalidDepositCap(uint256 newCap, uint256 currentManaged);\n    error InvalidReinvestIncentive(uint256 incentiveBps, uint256 maxBps);\n    error SettlementShortfallTooHigh(uint256 shortfall, uint256 managedAssets);\n    error UnauthorizedConfigCaller();\n    error InvalidWithdrawalFee(uint256 feeBps, uint256 maxFeeBps);\n    error VaultMustBeSuspended(address vault);\n    error VaultTargetNotZero(address vault, uint256 targetBps);\n    error ModuleNotSet();\n    error ModuleCallFailed();\n    error ModuleMetadataQueryFailed(address module);\n    error ModuleStorageMismatch(bytes32 expected, bytes32 actual);\n    error ModuleTokenMismatch(address expected, address actual);\n    error ModuleCollateralVaultMismatch(address expected, address actual);\n    error ActiveRouterCashRescue();\n    error FundedStrategyAdapterReplacement(address strategyShare, address currentAdapter, address replacementAdapter);\n    error StrategyShareAccountingNotSynchronized(address strategyShare);\n\n    // Mirrored library errors keep the router ABI usable by existing clients.\n    error StrategyBackingLoss(\n        address vault,\n        uint8 measure,\n        uint256 beforeValue,\n        uint256 afterValue,\n        uint256 requiredIncrease\n    );\n    error StrategyWithdrawalLoss(address vault, uint8 measure, uint256 valueLost, uint256 assetsReceived);\n    error AssetBalanceMismatch(uint256 expected, uint256 actual);\n    error WithdrawalAssetsMismatch(uint256 reported, uint256 actual);\n    error ZeroWithdrawalAssets();\n\n    uint256 public constant BACKING_GUARD_VERSION = 3;\n\n    // --- Roles ---\n    bytes32 public constant DSTAKE_TOKEN_ROLE = keccak256(\"DSTAKE_TOKEN_ROLE\");\n    bytes32 public constant STRATEGY_REBALANCER_ROLE = keccak256(\"STRATEGY_REBALANCER_ROLE\");\n    bytes32 public constant ADAPTER_MANAGER_ROLE = keccak256(\"ADAPTER_MANAGER_ROLE\");\n    bytes32 public constant CONFIG_MANAGER_ROLE = keccak256(\"CONFIG_MANAGER_ROLE\");\n    bytes32 public constant VAULT_MANAGER_ROLE = keccak256(\"VAULT_MANAGER_ROLE\");\n    bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n    function _token() internal view returns (IDStakeTokenV2Minimal) {\n        return IDStakeTokenV2Minimal(_dStakeToken);\n    }\n\n    // --- Events ---\n    event RouterDepositRouted(\n        address indexed initiator,\n        address indexed receiver,\n        address indexed strategyVault,\n        uint256 assets,\n        uint256 shares\n    );\n    event RouterWithdrawSettled(\n        address indexed initiator,\n        address indexed receiver,\n        address indexed strategyVault,\n        uint256 grossAssets,\n        uint256 netAssets,\n        uint256 fee\n    );\n    event StrategySharesExchanged(\n        address indexed fromStrategyShare,\n        address indexed toStrategyShare,\n        uint256 fromShareAmount,\n        uint256 toShareAmount,\n        uint256 dStableAmountEquivalent,\n        address indexed exchanger\n    );\n    event AdapterSet(address indexed strategyShare, address adapterAddress);\n    event AdapterRemoved(address indexed strategyShare, address adapterAddress);\n    event DefaultDepositStrategyShareSet(address indexed strategyShare);\n    event DustToleranceSet(uint256 newDustTolerance);\n    event SurplusSwept(uint256 amount, address vaultAsset);\n    event PausedCashRescued(address indexed recipient, uint256 amount);\n    event StrategyDepositRouted(address[] selectedVaults, uint256[] depositAmounts, uint256 totalDStableAmount);\n    event StrategyWithdrawalRouted(address[] selectedVaults, uint256[] withdrawalAmounts, uint256 totalDStableAmount);\n    event RouterSolverDeposit(\n        address indexed caller,\n        address indexed receiver,\n        uint256 totalAssets,\n        uint256 sharesMinted\n    );\n    event RouterSolverWithdraw(\n        address indexed caller,\n        address indexed receiver,\n        uint256 grossAssets,\n        uint256 netAssets,\n        uint256 fee,\n        uint256 sharesBurned\n    );\n    event RouterFeesReinvested(uint256 amountReinvested, uint256 incentivePaid, address indexed caller);\n    event SettlementShortfallUpdated(uint256 previousShortfall, uint256 newShortfall);\n    event DepositCapUpdated(uint256 previousCap, uint256 newCap);\n    event ReinvestIncentiveSet(uint256 newIncentiveBps);\n    event WithdrawalFeeSet(uint256 previousFeeBps, uint256 newFeeBps);\n    event VaultConfigAdded(address indexed vault, address indexed adapter, uint256 targetBps, VaultStatus status);\n    event VaultConfigUpdated(address indexed vault, address indexed adapter, uint256 targetBps, VaultStatus status);\n    event VaultConfigRemoved(address indexed vault);\n    event StrategiesRebalanced(\n        address indexed fromVault,\n        address indexed toVault,\n        uint256 amount,\n        address indexed initiator\n    );\n    event MaxVaultCountUpdated(uint256 oldCount, uint256 newCount);\n    event GovernanceModuleSet(address indexed governanceModule);\n    event RebalanceModuleSet(address indexed rebalanceModule);\n\n    constructor(address _dStakeToken, address _collateralVault) DStakeRouterV2Storage(_dStakeToken, _collateralVault) {\n        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\n        _grantRole(ADAPTER_MANAGER_ROLE, msg.sender);\n        _grantRole(CONFIG_MANAGER_ROLE, msg.sender);\n        _grantRole(VAULT_MANAGER_ROLE, msg.sender);\n        _grantRole(PAUSER_ROLE, msg.sender);\n        _grantRole(DSTAKE_TOKEN_ROLE, _dStakeToken);\n    }\n\n    function setGovernanceModule(address newModule) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        if (newModule == address(0)) revert ZeroAddress();\n        _assertModuleCompatibility(newModule);\n        governanceModule = newModule;\n        emit GovernanceModuleSet(newModule);\n    }\n\n    function setRebalanceModule(address newModule) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        if (newModule == address(0)) revert ZeroAddress();\n        _assertModuleCompatibility(newModule);\n        rebalanceModule = newModule;\n        emit RebalanceModuleSet(newModule);\n    }\n\n    function _delegateToModule(address module) private returns (bytes memory result) {\n        if (module == address(0)) revert ModuleNotSet();\n\n        (bool success, bytes memory returndata) = module.delegatecall(msg.data);\n        if (!success) {\n            if (returndata.length == 0) revert ModuleCallFailed();\n            assembly {\n                revert(add(returndata, 32), mload(returndata))\n            }\n        }\n        return returndata;\n    }\n\n    function _assertModuleCompatibility(address module) private view {\n        bytes32 expectedFingerprint = STORAGE_FINGERPRINT;\n        address expectedToken = _dStakeToken;\n        address expectedVault = address(_collateralVault);\n\n        bytes32 actualFingerprint;\n        address moduleToken;\n        address moduleVault;\n        try IDStakeRouterV2Module(module).moduleMetadata() returns (bytes32 fingerprint, address token, address vault) {\n            actualFingerprint = fingerprint;\n            moduleToken = token;\n            moduleVault = vault;\n        } catch {\n            revert ModuleMetadataQueryFailed(module);\n        }\n\n        if (actualFingerprint != expectedFingerprint) {\n            revert ModuleStorageMismatch(expectedFingerprint, actualFingerprint);\n        }\n        if (moduleToken != expectedToken) {\n            revert ModuleTokenMismatch(expectedToken, moduleToken);\n        }\n        if (moduleVault != expectedVault) {\n            revert ModuleCollateralVaultMismatch(expectedVault, moduleVault);\n        }\n    }\n\n    // --- Core Router Functions ---\n\n    function collateralVault() public view override returns (IDStakeCollateralVaultV2) {\n        return _collateralVault;\n    }\n\n    function dStakeToken() public view override returns (address) {\n        return _dStakeToken;\n    }\n\n    function defaultDepositStrategyShare() public view override returns (address) {\n        return _defaultDepositStrategyShare;\n    }\n\n    function strategyShareToAdapter(address strategyShare) external view returns (address) {\n        return _strategyShareToAdapter[strategyShare];\n    }\n\n    function paused() public view override(IDStakeRouterV2, Pausable) returns (bool) {\n        return Pausable.paused();\n    }\n\n    function totalManagedAssets() public view override returns (uint256) {\n        uint256 vaultValue = _collateralVault.totalValueInDStable();\n        uint256 idle = IERC20(_dStable).balanceOf(address(this));\n        return vaultValue + idle;\n    }\n\n    function currentShortfall() public view override returns (uint256) {\n        return settlementShortfall;\n    }\n\n    function withdrawalFeeBps() public view override returns (uint256) {\n        return _withdrawalFeeBps;\n    }\n\n    function maxWithdrawalFeeBps() public pure override returns (uint256) {\n        return MAX_WITHDRAWAL_FEE_BPS;\n    }\n\n    function maxDeposit(address) public view override returns (uint256) {\n        if (paused()) {\n            return 0;\n        }\n        if (!_hasActiveVaultFor(OperationType.DEPOSIT)) {\n            return 0;\n        }\n\n        address targetVault = _selectAutoDepositVault();\n        uint256 vaultLimit = _vaultDepositLimit(targetVault);\n        if (vaultLimit == 0) {\n            return 0;\n        }\n\n        if (depositCap == 0) {\n            return vaultLimit;\n        }\n\n        uint256 managed = totalManagedAssets();\n        if (depositCap <= managed) {\n            return 0;\n        }\n\n        uint256 capRemaining = depositCap - managed;\n        return capRemaining < vaultLimit ? capRemaining : vaultLimit;\n    }\n\n    function maxMint(address) public view override returns (uint256) {\n        uint256 assetLimit = maxDeposit(address(0));\n        if (assetLimit == 0) {\n            return 0;\n        }\n        return _token().previewDeposit(assetLimit);\n    }\n\n    function maxWithdraw(address owner) public view override returns (uint256) {\n        if (paused()) {\n            return 0;\n        }\n        if (!_hasActiveVaultFor(OperationType.WITHDRAWAL)) {\n            return 0;\n        }\n\n        uint256 ownerShares = _token().balanceOf(owner);\n        if (ownerShares == 0) {\n            return 0;\n        }\n\n        uint256 netAssets = _token().previewRedeem(ownerShares);\n        if (netAssets == 0) {\n            return 0;\n        }\n\n        uint256 routerCapacityGross = _maxSingleVaultWithdraw();\n        if (routerCapacityGross == 0) {\n            return 0;\n        }\n\n        uint256 routerNetCapacity = _getNetAmount(routerCapacityGross);\n        return routerNetCapacity < netAssets ? routerNetCapacity : netAssets;\n    }\n\n    function maxRedeem(address owner) public view override returns (uint256) {\n        uint256 maxNetAssets = maxWithdraw(owner);\n        if (maxNetAssets == 0) {\n            return 0;\n        }\n        return _token().previewWithdraw(maxNetAssets);\n    }\n\n    function _hasActiveVaultFor(OperationType op) internal view returns (bool) {\n        (address[] memory activeVaults, , ) = _getActiveVaultsAndAllocations(op);\n        return activeVaults.length > 0;\n    }\n\n    function _calculateFee(uint256 grossAmount) internal view returns (uint256) {\n        return WithdrawalFeeMath.calculateWithdrawalFee(grossAmount, _withdrawalFeeBps);\n    }\n\n    function _enforceDepositCap(uint256 additionalAssets) internal view {\n        if (depositCap == 0) {\n            return;\n        }\n        uint256 managed = totalManagedAssets();\n        if (managed + additionalAssets > depositCap) {\n            revert DepositCapExceeded(depositCap, managed, additionalAssets);\n        }\n    }\n\n    function _getNetAmount(uint256 grossAmount) internal view returns (uint256) {\n        return WithdrawalFeeMath.netAfterFee(grossAmount, _withdrawalFeeBps);\n    }\n\n    function _getGrossAmountForNet(uint256 netAmount) internal view returns (uint256) {\n        return WithdrawalFeeMath.grossFromNet(netAmount, _withdrawalFeeBps);\n    }\n\n    function _requireConfigOrToken(address account) internal view {\n        if (account != _dStakeToken && !hasRole(CONFIG_MANAGER_ROLE, account)) {\n            revert UnauthorizedConfigCaller();\n        }\n    }\n\n    function _selectAutoDepositVault() internal view returns (address targetVault) {\n        (\n            address[] memory activeVaults,\n            uint256[] memory currentAllocations,\n            uint256[] memory targetAllocations\n        ) = _getActiveVaultsAndAllocations(OperationType.DEPOSIT);\n\n        if (activeVaults.length == 0) revert InsufficientActiveVaults();\n\n        (address[] memory sortedVaults, ) = DeterministicVaultSelector.selectTopUnderallocated(\n            activeVaults,\n            currentAllocations,\n            targetAllocations,\n            1\n        );\n\n        return sortedVaults[0];\n    }\n\n    function _vaultDepositLimit(address vault) internal view returns (uint256) {\n        if (vault == address(0)) {\n            return 0;\n        }\n        if (_strategyShareToAdapter[vault] == address(0)) {\n            return 0;\n        }\n\n        try IERC4626(vault).maxDeposit(address(_collateralVault)) returns (uint256 limit) {\n            return limit;\n        } catch {\n            return type(uint256).max;\n        }\n    }\n\n    function _depositToAutoVault(uint256 assets) internal returns (address targetVault) {\n        targetVault = _selectAutoDepositVault();\n        _depositToVaultAtomically(targetVault, assets);\n\n        address[] memory vaultArray = new address[](1);\n        uint256[] memory amountArray = new uint256[](1);\n        vaultArray[0] = targetVault;\n        amountArray[0] = assets;\n        emit StrategyDepositRouted(vaultArray, amountArray, assets);\n    }\n\n    function _selectVaultForWithdrawal(uint256 grossAssets) internal view returns (address targetVault) {\n        (\n            address[] memory activeVaults,\n            uint256[] memory currentAllocations,\n            uint256[] memory targetAllocations\n        ) = _getActiveVaultsAndAllocations(OperationType.WITHDRAWAL);\n\n        if (activeVaults.length == 0) revert InsufficientActiveVaults();\n\n        (address[] memory sortedVaults, ) = DeterministicVaultSelector.selectTopOverallocated(\n            activeVaults,\n            currentAllocations,\n            targetAllocations,\n            activeVaults.length\n        );\n\n        uint256 sortedLength = sortedVaults.length;\n        for (uint256 i; i < sortedLength; ) {\n            address candidate = sortedVaults[i];\n            if (_vaultCanSatisfyWithdrawal(candidate, grossAssets)) {\n                return candidate;\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        revert NoLiquidityAvailable();\n    }\n\n    function handleDeposit(\n        address initiator,\n        uint256 assets,\n        uint256 shares,\n        address receiver\n    ) external override onlyRole(DSTAKE_TOKEN_ROLE) nonReentrant whenNotPaused {\n        if (receiver == address(0)) revert ReceiverZero();\n        if (assets == 0) revert InvalidAmount();\n\n        _enforceDepositCap(assets);\n\n        uint256 backingBefore = totalManagedAssets();\n        StrategyBackingGuard.pull(_dStable, msg.sender, assets);\n        address targetVault = _depositToAutoVault(assets);\n        StrategyBackingGuard.assertIncrease(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            assets,\n            operationRoundingLoss\n        );\n        emit RouterDepositRouted(initiator, receiver, targetVault, assets, shares);\n    }\n\n    function handleWithdraw(\n        address initiator,\n        address receiver,\n        address /*owner*/,\n        uint256 grossAssets,\n        uint256 expectedNetAssets\n    )\n        external\n        override\n        onlyRole(DSTAKE_TOKEN_ROLE)\n        nonReentrant\n        whenNotPaused\n        returns (uint256 netAssets, uint256 fee)\n    {\n        if (receiver == address(0)) revert ReceiverZero();\n        if (grossAssets == 0) {\n            return (0, 0);\n        }\n\n        address targetVault = _selectVaultForWithdrawal(grossAssets);\n        uint256 grossWithdrawn = _withdrawFromVaultAtomically(targetVault, grossAssets);\n\n        fee = _calculateFee(grossWithdrawn);\n        netAssets = grossWithdrawn - fee;\n        if (netAssets < expectedNetAssets) {\n            revert WithdrawalShortfall(expectedNetAssets, netAssets);\n        }\n\n        if (netAssets > expectedNetAssets) {\n            fee += netAssets - expectedNetAssets;\n            netAssets = expectedNetAssets;\n        }\n        IERC20(_dStable).safeTransfer(receiver, netAssets);\n\n        address[] memory vaultArray = new address[](1);\n        uint256[] memory amountArray = new uint256[](1);\n        vaultArray[0] = targetVault;\n        amountArray[0] = grossWithdrawn;\n\n        emit StrategyWithdrawalRouted(vaultArray, amountArray, grossWithdrawn);\n        emit RouterWithdrawSettled(initiator, receiver, targetVault, grossWithdrawn, netAssets, fee);\n        return (netAssets, fee);\n    }\n\n    // --- Solver Mode Entrypoints ---\n\n    function solverDepositAssets(\n        address[] calldata vaults,\n        uint256[] calldata assets,\n        uint256 minShares,\n        address receiver\n    ) external override nonReentrant whenNotPaused returns (uint256 sharesMinted) {\n        if (receiver == address(0)) revert ReceiverZero();\n        if (vaults.length == 0) revert EmptyArrays();\n        if (vaults.length != assets.length) revert DeterministicVaultSelector.ArrayLengthMismatch();\n\n        uint256 totalAssets = 0;\n        uint256 assetCount = assets.length;\n        for (uint256 i; i < assetCount; ) {\n            totalAssets += assets[i];\n            unchecked {\n                ++i;\n            }\n        }\n\n        if (totalAssets == 0) revert InvalidAmount();\n\n        _enforceDepositCap(totalAssets);\n\n        sharesMinted = _token().previewDeposit(totalAssets);\n        if (sharesMinted < minShares) {\n            revert SharesBelowMinimum(sharesMinted, minShares);\n        }\n\n        uint256 backingBefore = totalManagedAssets();\n        StrategyBackingGuard.pull(_dStable, msg.sender, totalAssets);\n\n        uint256 vaultCount = vaults.length;\n        for (uint256 i; i < vaultCount; ) {\n            uint256 amount = assets[i];\n            if (amount > 0) {\n                _depositToVaultAtomically(vaults[i], amount);\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        StrategyBackingGuard.assertIncrease(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            totalAssets,\n            operationRoundingLoss\n        );\n        _token().mintForRouter(msg.sender, receiver, totalAssets, sharesMinted);\n\n        emit StrategyDepositRouted(vaults, assets, totalAssets);\n        emit RouterSolverDeposit(msg.sender, receiver, totalAssets, sharesMinted);\n        return sharesMinted;\n    }\n\n    function solverDepositShares(\n        address[] calldata vaults,\n        uint256[] calldata shares,\n        uint256 minShares,\n        address receiver\n    ) external override nonReentrant whenNotPaused returns (uint256 sharesMinted) {\n        if (receiver == address(0)) revert ReceiverZero();\n        if (vaults.length == 0) revert EmptyArrays();\n        if (vaults.length != shares.length) revert DeterministicVaultSelector.ArrayLengthMismatch();\n\n        uint256[] memory assetAmounts = new uint256[](vaults.length);\n        uint256 totalAssets = 0;\n\n        uint256 vaultCount = vaults.length;\n        for (uint256 i; i < vaultCount; ) {\n            uint256 shareAmount = shares[i];\n            if (shareAmount > 0) {\n                address vault = vaults[i];\n                VaultConfig memory config = _getVaultConfig(vault);\n                if (config.status != VaultStatus.Active) revert VaultNotActive(vault);\n\n                uint256 assetsNeeded = IERC4626(vault).previewMint(shareAmount);\n                assetAmounts[i] = assetsNeeded;\n                totalAssets += assetsNeeded;\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        if (totalAssets == 0) revert InvalidAmount();\n\n        _enforceDepositCap(totalAssets);\n\n        sharesMinted = _token().previewDeposit(totalAssets);\n        if (sharesMinted < minShares) {\n            revert SharesBelowMinimum(sharesMinted, minShares);\n        }\n\n        uint256 backingBefore = totalManagedAssets();\n        StrategyBackingGuard.pull(_dStable, msg.sender, totalAssets);\n\n        for (uint256 i; i < vaultCount; ) {\n            uint256 shareAmount = shares[i];\n            if (shareAmount > 0) {\n                address vault = vaults[i];\n                uint256 mintedShares = _depositToVaultAtomically(vault, assetAmounts[i]);\n                if (mintedShares < shareAmount) {\n                    revert SolverShareDepositShortfall(vault, shareAmount, mintedShares);\n                }\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        StrategyBackingGuard.assertIncrease(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            totalAssets,\n            operationRoundingLoss\n        );\n        _token().mintForRouter(msg.sender, receiver, totalAssets, sharesMinted);\n\n        emit StrategyDepositRouted(vaults, assetAmounts, totalAssets);\n        emit RouterSolverDeposit(msg.sender, receiver, totalAssets, sharesMinted);\n        return sharesMinted;\n    }\n\n    function solverWithdrawAssets(\n        address[] calldata vaults,\n        uint256[] calldata assets,\n        uint256 maxShares,\n        address receiver,\n        address owner\n    ) external override nonReentrant whenNotPaused returns (uint256 netAssets, uint256 fee, uint256 sharesBurned) {\n        if (receiver == address(0)) revert ReceiverZero();\n        if (vaults.length == 0) revert EmptyArrays();\n        if (vaults.length != assets.length) revert DeterministicVaultSelector.ArrayLengthMismatch();\n\n        uint256 totalNetAssets = 0;\n        uint256 totalGrossAssets = 0;\n        uint256[] memory grossRequests = new uint256[](assets.length);\n\n        for (uint256 i; i < assets.length; ) {\n            uint256 requestedNet = assets[i];\n            totalNetAssets += requestedNet;\n            if (requestedNet > 0) {\n                uint256 requestedGross = _getGrossAmountForNet(requestedNet);\n                grossRequests[i] = requestedGross;\n                totalGrossAssets += requestedGross;\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        if (totalNetAssets == 0) revert InvalidAmount();\n\n        uint256 aggregatedGross = _getGrossAmountForNet(totalNetAssets);\n        if (aggregatedGross > totalGrossAssets) {\n            uint256 shortfall = aggregatedGross - totalGrossAssets;\n            for (uint256 i = assets.length; i > 0; ) {\n                uint256 idx = i - 1;\n                if (grossRequests[idx] > 0) {\n                    grossRequests[idx] += shortfall;\n                    break;\n                }\n                unchecked {\n                    --i;\n                }\n            }\n            totalGrossAssets = aggregatedGross;\n        }\n\n        sharesBurned = _token().previewWithdraw(totalNetAssets);\n        if (sharesBurned > maxShares) {\n            revert SharesExceedMaxRedeem(sharesBurned, maxShares);\n        }\n\n        uint256 backingBefore = totalManagedAssets();\n        uint256 grossWithdrawn = _executeGrossWithdrawals(vaults, grossRequests);\n        StrategyBackingGuard.assertWithdrawal(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            0,\n            operationRoundingLoss\n        );\n\n        fee = _calculateFee(grossWithdrawn);\n        netAssets = grossWithdrawn - fee;\n\n        if (netAssets < totalNetAssets) {\n            revert WithdrawalShortfall(totalNetAssets, netAssets);\n        }\n        if (netAssets > totalNetAssets) {\n            uint256 roundingSurplus = netAssets - totalNetAssets;\n            fee += roundingSurplus;\n            netAssets = totalNetAssets;\n        }\n\n        _token().burnFromRouter(msg.sender, receiver, owner, netAssets, sharesBurned);\n\n        IERC20(_dStable).safeTransfer(receiver, netAssets);\n\n        emit StrategyWithdrawalRouted(vaults, grossRequests, grossWithdrawn);\n        emit RouterSolverWithdraw(msg.sender, receiver, grossWithdrawn, netAssets, fee, sharesBurned);\n        return (netAssets, fee, sharesBurned);\n    }\n\n    function solverWithdrawShares(\n        address[] calldata vaults,\n        uint256[] calldata strategyShares,\n        uint256 maxShares,\n        address receiver,\n        address owner\n    ) external override nonReentrant whenNotPaused returns (uint256 netAssets, uint256 fee, uint256 sharesBurned) {\n        if (receiver == address(0)) revert ReceiverZero();\n        if (vaults.length == 0) revert EmptyArrays();\n        if (vaults.length != strategyShares.length) revert DeterministicVaultSelector.ArrayLengthMismatch();\n\n        uint256[] memory grossAssetAmounts = new uint256[](vaults.length);\n        uint256 totalGrossAssets = 0;\n\n        uint256 vaultCount = vaults.length;\n        for (uint256 i; i < vaultCount; ) {\n            uint256 shareAmount = strategyShares[i];\n            if (shareAmount > 0) {\n                uint256 assetAmount = IERC4626(vaults[i]).previewRedeem(shareAmount);\n                grossAssetAmounts[i] = assetAmount;\n                totalGrossAssets += assetAmount;\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        if (totalGrossAssets == 0) revert InvalidAmount();\n\n        uint256 totalNetAssets = _getNetAmount(totalGrossAssets);\n\n        sharesBurned = _token().previewWithdraw(totalNetAssets);\n        if (sharesBurned > maxShares) {\n            revert SharesExceedMaxRedeem(sharesBurned, maxShares);\n        }\n\n        uint256 backingBefore = totalManagedAssets();\n        uint256 grossWithdrawn = _executeWithdrawShares(vaults, strategyShares);\n        StrategyBackingGuard.assertWithdrawal(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            0,\n            operationRoundingLoss\n        );\n\n        fee = _calculateFee(grossWithdrawn);\n        netAssets = grossWithdrawn - fee;\n\n        if (netAssets < totalNetAssets) {\n            revert WithdrawalShortfall(totalNetAssets, netAssets);\n        }\n        if (netAssets > totalNetAssets) {\n            uint256 roundingSurplus = netAssets - totalNetAssets;\n            fee += roundingSurplus;\n            netAssets = totalNetAssets;\n        }\n\n        _token().burnFromRouter(msg.sender, receiver, owner, netAssets, sharesBurned);\n\n        IERC20(_dStable).safeTransfer(receiver, netAssets);\n\n        emit StrategyWithdrawalRouted(vaults, grossAssetAmounts, grossWithdrawn);\n        emit RouterSolverWithdraw(msg.sender, receiver, grossWithdrawn, netAssets, fee, sharesBurned);\n        return (netAssets, fee, sharesBurned);\n    }\n\n    /**\n     * @notice Permissionless backing contribution; deliberately mints NO sdAsset.\n     * @dev Reward managers use this entry point instead of direct adapter authority.\n     *      Same active-strategy, cap, pause, actual-input and backing guards as deposits.\n     */\n    function compoundDeposit(\n        uint256 assets\n    ) external override nonReentrant whenNotPaused returns (address strategyShare, uint256 strategyShares) {\n        if (assets == 0) revert InvalidAmount();\n        _enforceDepositCap(assets);\n        strategyShare = _defaultDepositStrategyShare;\n        if (strategyShare == address(0)) revert DefaultDepositStrategyShareNotSet();\n        uint256 backingBefore = totalManagedAssets();\n        StrategyBackingGuard.pull(_dStable, msg.sender, assets);\n        strategyShares = _depositToVaultAtomically(strategyShare, assets);\n        StrategyBackingGuard.assertIncrease(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            assets,\n            operationRoundingLoss\n        );\n        emit BackingCompounded(msg.sender, strategyShare, assets, strategyShares);\n    }\n\n    error DefaultDepositStrategyShareNotSet();\n\n    event BackingCompounded(\n        address indexed caller,\n        address indexed strategyShare,\n        uint256 assets,\n        uint256 strategyShares\n    );\n\n    function setStrategyRoundingLoss(address, uint256) external onlyRole(CONFIG_MANAGER_ROLE) whenPaused {\n        _delegateToModule(governanceModule);\n    }\n\n    function setOperationRoundingLoss(uint256) external onlyRole(CONFIG_MANAGER_ROLE) whenPaused {\n        _delegateToModule(governanceModule);\n    }\n\n    function disposeRetiredStrategyDust(address) external onlyRole(ADAPTER_MANAGER_ROLE) nonReentrant whenPaused {\n        _delegateToModule(governanceModule);\n    }\n\n    function reinvestFees()\n        external\n        override\n        nonReentrant\n        whenNotPaused\n        returns (uint256 amountReinvested, uint256 incentivePaid)\n    {\n        uint256 balance = IERC20(_dStable).balanceOf(address(this));\n        if (balance == 0) {\n            return (0, 0);\n        }\n\n        uint256 incentive = Math.mulDiv(balance, reinvestIncentiveBps, BasisPointConstants.ONE_HUNDRED_PERCENT_BPS);\n        if (incentive > 0) {\n            IERC20(_dStable).safeTransfer(msg.sender, incentive);\n        }\n\n        amountReinvested = balance - incentive;\n        if (amountReinvested == 0) {\n            emit RouterFeesReinvested(0, incentive, msg.sender);\n            return (0, incentive);\n        }\n\n        uint256 backingBefore = totalManagedAssets();\n        _depositToAutoVault(amountReinvested);\n        StrategyBackingGuard.assertWithdrawal(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            0,\n            operationRoundingLoss\n        );\n        emit RouterFeesReinvested(amountReinvested, incentive, msg.sender);\n        incentivePaid = incentive;\n        return (amountReinvested, incentivePaid);\n    }\n\n    function setReinvestIncentive(uint256) external {\n        _requireConfigOrToken(_msgSender());\n        _delegateToModule(governanceModule);\n    }\n\n    function setWithdrawalFee(uint256) external override {\n        _requireConfigOrToken(_msgSender());\n        _delegateToModule(governanceModule);\n    }\n\n    function setDepositCap(uint256) external {\n        _requireConfigOrToken(_msgSender());\n        _delegateToModule(governanceModule);\n    }\n\n    function recordShortfall(uint256) external {\n        _requireConfigOrToken(_msgSender());\n        _delegateToModule(governanceModule);\n    }\n\n    function clearShortfall(uint256) external {\n        _requireConfigOrToken(_msgSender());\n        _delegateToModule(governanceModule);\n    }\n\n    // --- Rebalance/Exchange Functions ---\n\n    function rebalanceStrategiesByShares(\n        address,\n        address,\n        uint256,\n        uint256\n    ) external onlyRole(STRATEGY_REBALANCER_ROLE) nonReentrant whenNotPaused {\n        uint256 backingBefore = totalManagedAssets();\n        _delegateToModule(rebalanceModule);\n        StrategyBackingGuard.assertWithdrawal(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            0,\n            operationRoundingLoss\n        );\n    }\n\n    function rebalanceStrategiesBySharesViaExternalLiquidity(\n        address,\n        address,\n        uint256,\n        uint256\n    ) external onlyRole(STRATEGY_REBALANCER_ROLE) nonReentrant whenNotPaused {\n        uint256 backingBefore = totalManagedAssets();\n        _delegateToModule(rebalanceModule);\n        StrategyBackingGuard.assertWithdrawal(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            0,\n            operationRoundingLoss\n        );\n    }\n\n    function rebalanceStrategiesByValue(\n        address,\n        address,\n        uint256,\n        uint256\n    ) external onlyRole(STRATEGY_REBALANCER_ROLE) nonReentrant whenNotPaused {\n        uint256 backingBefore = totalManagedAssets();\n        _delegateToModule(rebalanceModule);\n        StrategyBackingGuard.assertWithdrawal(\n            address(0),\n            2,\n            backingBefore,\n            totalManagedAssets(),\n            0,\n            operationRoundingLoss\n        );\n    }\n\n    // --- Adapter Management ---\n\n    function addAdapter(address, address) external onlyRole(ADAPTER_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function removeAdapter(address) external onlyRole(ADAPTER_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function setDefaultDepositStrategyShare(address) external onlyRole(CONFIG_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function clearDefaultDepositStrategyShare() external onlyRole(CONFIG_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function setDustTolerance(uint256) external onlyRole(CONFIG_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function sweepSurplus(uint256) external onlyRole(DEFAULT_ADMIN_ROLE) nonReentrant whenNotPaused {\n        _delegateToModule(governanceModule);\n    }\n\n    // --- Vault Configuration ---\n\n    /**\n     * @notice Replaces all vault configs and enforces total target allocations sum to 100%.\n     * @dev This is the ONLY mutator that enforces the allocation-sum invariant on-chain.\n     *      Reverts with `TotalAllocationInvalid(total)` if the sum of all provided `targetBps`\n     *      is not exactly `BasisPointConstants.ONE_HUNDRED_PERCENT_BPS` (1,000,000 bps).\n     *      Use this after operational changes (add/remove/pause) to restore precise targets.\n     */\n    function setVaultConfigs(VaultConfig[] calldata) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function addVaultConfig(VaultConfig calldata) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function addVaultConfig(address, address, uint256, VaultStatus) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function updateVaultConfig(VaultConfig calldata) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function updateVaultConfig(address, address, uint256, VaultStatus) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function setVaultStatus(address, VaultStatus) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function removeVault(address) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function removeVaultConfig(address) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function suspendVaultForRemoval(address) external onlyRole(VAULT_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function emergencyPauseVault(address) external onlyRole(PAUSER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function setMaxVaultCount(uint256) external onlyRole(CONFIG_MANAGER_ROLE) {\n        _delegateToModule(governanceModule);\n    }\n\n    function pause() external onlyRole(PAUSER_ROLE) {\n        _pause();\n    }\n\n    function unpause() external onlyRole(PAUSER_ROLE) {\n        _unpause();\n    }\n\n    /// @notice Pulls idle dUSD to the caller while paused. Used to clear CREATE-window\n    ///         donations on a replacement router before migration begin(). No-op if empty.\n    function rescuePausedCash() external onlyRole(DEFAULT_ADMIN_ROLE) nonReentrant whenPaused {\n        if (\n            IDStakeTokenV2Minimal(_dStakeToken).router() == address(this) || _collateralVault.router() == address(this)\n        ) {\n            revert ActiveRouterCashRescue();\n        }\n        uint256 amount = IERC20(_dStable).balanceOf(address(this));\n        if (amount == 0) {\n            return;\n        }\n        IERC20(_dStable).safeTransfer(_msgSender(), amount);\n        emit PausedCashRescued(_msgSender(), amount);\n    }\n\n    // --- View Functions ---\n\n    function getCurrentAllocations()\n        external\n        view\n        returns (\n            address[] memory vaults,\n            uint256[] memory currentAllocations,\n            uint256[] memory targetAllocations,\n            uint256 totalBalance\n        )\n    {\n        return _getAllVaultsAndAllocations();\n    }\n\n    function getVaultConfig(address vault) external view returns (VaultConfig memory config) {\n        if (!vaultExists[vault]) revert VaultNotFound(vault);\n        return vaultConfigs[vaultToIndex[vault]];\n    }\n\n    function getVaultCount() external view returns (uint256) {\n        return vaultConfigs.length;\n    }\n\n    function isVaultHealthyForDeposits(address vault) external view returns (bool healthy) {\n        return _isVaultHealthyForDeposits(vault);\n    }\n\n    function isVaultHealthyForWithdrawals(address vault) external view returns (bool healthy) {\n        return _isVaultHealthyForWithdrawals(vault);\n    }\n\n    /**\n     * @notice Returns strategy vaults that are active and healthy for deposits.\n     * @dev Uses deposit health checks; does not guarantee suitability for withdrawals.\n     *      Prefer explicitness over the old generic name to avoid ambiguity.\n     */\n    function getActiveVaultsForDeposits() external view returns (address[] memory activeVaults) {\n        (activeVaults, , ) = _getActiveVaultsAndAllocations(OperationType.DEPOSIT);\n    }\n\n    /**\n     * @notice Returns strategy vaults that are active and healthy for withdrawals.\n     * @dev Uses withdrawal health checks; does not guarantee suitability for deposits.\n     */\n    function getActiveVaultsForWithdrawals() external view returns (address[] memory activeVaults) {\n        (activeVaults, , ) = _getActiveVaultsAndAllocations(OperationType.WITHDRAWAL);\n    }\n\n    function getVaultConfigByIndex(uint256 index) external view returns (VaultConfig memory config) {\n        if (index >= vaultConfigs.length) revert IndexOutOfBounds();\n        return vaultConfigs[index];\n    }\n\n    function getMaxSingleVaultWithdraw() external view returns (uint256) {\n        return _maxSingleVaultWithdraw();\n    }\n\n    function _maxSingleVaultWithdraw() internal view returns (uint256 maxAssets) {\n        (address[] memory activeVaults, , ) = _getActiveVaultsAndAllocations(OperationType.WITHDRAWAL);\n\n        uint256 activeLength = activeVaults.length;\n        for (uint256 i; i < activeLength; ) {\n            uint256 vaultBalance = _getVaultBalance(activeVaults[i]);\n            if (vaultBalance > maxAssets) {\n                maxAssets = vaultBalance;\n            }\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    // --- Internal Helpers ---\n\n    function _depositToVaultAtomically(address vault, uint256 dStableAmount) internal returns (uint256 actualShares) {\n        VaultConfig memory config = _getVaultConfig(vault);\n        if (!_isVaultStatusEligible(config.status, OperationType.DEPOSIT)) {\n            revert VaultNotActive(vault);\n        }\n\n        address adapterAddress = _strategyShareToAdapter[vault];\n        if (adapterAddress == address(0)) revert AdapterNotFound(vault);\n        return\n            StrategyBackingGuard.deposit(\n                _dStable,\n                vault,\n                adapterAddress,\n                _collateralVault,\n                dStableAmount,\n                strategyRoundingLoss(vault)\n            );\n    }\n\n    function _vaultCanSatisfyWithdrawal(address vault, uint256 dStableAmount) internal view returns (bool) {\n        if (dStableAmount == 0) {\n            return true;\n        }\n\n        try IERC4626(vault).previewWithdraw(dStableAmount) returns (uint256 strategyShareAmount) {\n            if (strategyShareAmount == 0) {\n                return false;\n            }\n\n            uint256 availableShares = IERC20(vault).balanceOf(address(_collateralVault));\n            return strategyShareAmount <= availableShares;\n        } catch {\n            return false;\n        }\n    }\n\n    function _withdrawFromVaultAtomically(\n        address vault,\n        uint256 dStableAmount\n    ) internal returns (uint256 receivedDStable) {\n        VaultConfig memory config = _getVaultConfig(vault);\n        if (!_isVaultStatusEligible(config.status, OperationType.WITHDRAWAL)) {\n            revert VaultNotActive(vault);\n        }\n\n        address adapter = _strategyShareToAdapter[vault];\n        if (adapter == address(0)) revert AdapterNotFound(vault);\n\n        // Determine how many strategy shares correspond to the requested _dStable amount\n        uint256 strategyShareAmount = IERC4626(vault).previewWithdraw(dStableAmount);\n        if (strategyShareAmount == 0) revert ZeroPreviewWithdrawAmount(vault);\n\n        uint256 availableShares = IERC20(vault).balanceOf(address(_collateralVault));\n        if (strategyShareAmount > availableShares) {\n            // Don't silently truncate - revert if insufficient shares\n            revert NoLiquidityAvailable();\n        }\n\n        receivedDStable = StrategyBackingGuard.withdraw(\n            _dStable,\n            vault,\n            adapter,\n            _collateralVault,\n            strategyShareAmount,\n            strategyRoundingLoss(vault)\n        );\n        if (receivedDStable < dStableAmount) {\n            revert SlippageCheckFailed(vault, receivedDStable, dStableAmount);\n        }\n        return receivedDStable;\n    }\n\n    function _withdrawSharesFromVaultAtomically(\n        address vault,\n        uint256 shares\n    ) internal returns (uint256 receivedDStable) {\n        VaultConfig memory config = _getVaultConfig(vault);\n\n        if (!_isVaultStatusEligible(config.status, OperationType.WITHDRAWAL)) {\n            revert VaultNotActive(vault);\n        }\n\n        address adapter = _strategyShareToAdapter[vault];\n        if (adapter == address(0)) revert AdapterNotFound(vault);\n\n        uint256 availableShares = IERC20(vault).balanceOf(address(_collateralVault));\n        if (shares > availableShares) revert NoLiquidityAvailable();\n\n        return\n            StrategyBackingGuard.withdraw(\n                _dStable,\n                vault,\n                adapter,\n                _collateralVault,\n                shares,\n                strategyRoundingLoss(vault)\n            );\n    }\n\n    function _executeGrossWithdrawals(\n        address[] calldata vaults,\n        uint256[] memory grossRequests\n    ) internal returns (uint256 totalWithdrawn) {\n        uint256 vaultCount = vaults.length;\n        for (uint256 i; i < vaultCount; ) {\n            uint256 grossRequest = grossRequests[i];\n            if (grossRequest > 0) {\n                totalWithdrawn += _withdrawFromVaultAtomically(vaults[i], grossRequest);\n            }\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function _executeWithdrawShares(\n        address[] calldata vaults,\n        uint256[] calldata shareAmounts\n    ) internal returns (uint256 totalWithdrawn) {\n        uint256 vaultCount = vaults.length;\n        for (uint256 i; i < vaultCount; ) {\n            uint256 shareAmount = shareAmounts[i];\n            if (shareAmount > 0) {\n                totalWithdrawn += _withdrawSharesFromVaultAtomically(vaults[i], shareAmount);\n            }\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function _getActiveVaultsAndAllocations(\n        OperationType operationType\n    )\n        internal\n        view\n        returns (address[] memory activeVaults, uint256[] memory currentAllocations, uint256[] memory targetAllocations)\n    {\n        uint256 activeCount = 0;\n        uint256 configCount = vaultConfigs.length;\n        for (uint256 i; i < configCount; ) {\n            VaultConfig memory config = vaultConfigs[i];\n            if (_isVaultEligibleForOperation(config, operationType)) {\n                if (_isVaultHealthyForOperation(config.strategyVault, operationType)) {\n                    unchecked {\n                        ++activeCount;\n                    }\n                }\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        if (activeCount == 0) return (new address[](0), new uint256[](0), new uint256[](0));\n\n        activeVaults = new address[](activeCount);\n        uint256[] memory balances = new uint256[](activeCount);\n        targetAllocations = new uint256[](activeCount);\n\n        uint256 activeIndex = 0;\n        for (uint256 i; i < configCount; ) {\n            VaultConfig memory config = vaultConfigs[i];\n            if (_isVaultEligibleForOperation(config, operationType)) {\n                if (_isVaultHealthyForOperation(config.strategyVault, operationType)) {\n                    activeVaults[activeIndex] = config.strategyVault;\n                    balances[activeIndex] = _getVaultBalance(config.strategyVault);\n                    targetAllocations[activeIndex] = config.targetBps;\n                    unchecked {\n                        ++activeIndex;\n                    }\n                }\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        (currentAllocations, ) = AllocationCalculator.calculateCurrentAllocations(balances);\n        return (activeVaults, currentAllocations, targetAllocations);\n    }\n\n    function _isVaultEligibleForOperation(\n        VaultConfig memory config,\n        OperationType operationType\n    ) internal pure returns (bool) {\n        if (!_isVaultStatusEligible(config.status, operationType)) {\n            return false;\n        }\n\n        if (config.adapter == address(0)) {\n            return false;\n        }\n\n        if (operationType == OperationType.DEPOSIT && config.targetBps == 0) {\n            return false;\n        }\n\n        return true;\n    }\n\n    function _isVaultStatusEligible(VaultStatus status, OperationType operationType) internal pure returns (bool) {\n        if (operationType == OperationType.DEPOSIT) {\n            return status == VaultStatus.Active;\n        }\n\n        return status == VaultStatus.Active || status == VaultStatus.Impaired;\n    }\n\n    function _getAllVaultsAndAllocations()\n        internal\n        view\n        returns (\n            address[] memory vaults,\n            uint256[] memory currentAllocations,\n            uint256[] memory targetAllocations,\n            uint256 totalBalance\n        )\n    {\n        uint256 vaultCount = vaultConfigs.length;\n        vaults = new address[](vaultCount);\n        uint256[] memory balances = new uint256[](vaultCount);\n        targetAllocations = new uint256[](vaultCount);\n\n        for (uint256 i; i < vaultCount; ) {\n            VaultConfig memory config = vaultConfigs[i];\n            vaults[i] = config.strategyVault;\n            balances[i] = _getVaultBalance(config.strategyVault);\n            targetAllocations[i] = config.targetBps;\n            unchecked {\n                ++i;\n            }\n        }\n\n        (currentAllocations, totalBalance) = AllocationCalculator.calculateCurrentAllocations(balances);\n    }\n\n    function _getVaultBalance(address vault) internal view returns (uint256 balance) {\n        return _getVaultBalanceWithAdapter(vault, address(0));\n    }\n\n    function _getVaultBalanceWithAdapter(address vault, address adapter) internal view returns (uint256 balance) {\n        try IERC20(vault).balanceOf(address(_collateralVault)) returns (uint256 shares) {\n            if (shares == 0) return 0;\n\n            if (adapter == address(0)) {\n                adapter = _strategyShareToAdapter[vault];\n            }\n            if (adapter == address(0)) return 0;\n\n            try IDStableConversionAdapterV2(adapter).strategyShareValueInDStable(vault, shares) returns (\n                uint256 value\n            ) {\n                return value;\n            } catch {\n                return 0;\n            }\n        } catch {\n            return 0;\n        }\n    }\n\n    function _getVaultConfig(address vault) internal view returns (VaultConfig memory config) {\n        if (!vaultExists[vault]) revert VaultNotFound(vault);\n        return vaultConfigs[vaultToIndex[vault]];\n    }\n\n    function _isVaultHealthyForOperation(\n        address vault,\n        OperationType operationType\n    ) internal view returns (bool healthy) {\n        if (operationType == OperationType.DEPOSIT) {\n            return _isVaultHealthyForDeposits(vault);\n        } else {\n            return _isVaultHealthyForWithdrawals(vault);\n        }\n    }\n\n    function _isVaultHealthyForDeposits(address vault) internal view returns (bool healthy) {\n        try IERC4626(vault).totalAssets() returns (uint256) {\n            try IERC4626(vault).previewDeposit(1e18) returns (uint256 shares) {\n                return shares > 0;\n            } catch {\n                return false;\n            }\n        } catch {\n            return false;\n        }\n    }\n\n    function _isVaultHealthyForWithdrawals(address vault) internal view returns (bool healthy) {\n        try IERC4626(vault).totalAssets() returns (uint256) {\n            uint256 vaultShares = IERC20(vault).balanceOf(address(_collateralVault));\n            if (vaultShares == 0) return false;\n\n            try IERC4626(vault).previewRedeem(vaultShares) returns (uint256 assets) {\n                return assets > 0;\n            } catch {\n                return false;\n            }\n        } catch {\n            return false;\n        }\n    }\n\n    function _totalSystemLiquidity(address[] memory activeVaults) internal view returns (uint256 totalLiquidity) {\n        uint256 vaultCount = activeVaults.length;\n        for (uint256 i; i < vaultCount; ) {\n            address vault = activeVaults[i];\n            uint256 vaultShares = IERC20(vault).balanceOf(address(_collateralVault));\n            if (vaultShares != 0) {\n                try IERC4626(vault).previewRedeem(vaultShares) returns (uint256 assets) {\n                    totalLiquidity += assets;\n                } catch {}\n            }\n            unchecked {\n                ++i;\n            }\n        }\n    }\n}\n"},{"file_path":"contracts/vaults/dstake/DStakeRouterV2Storage.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport { AccessControl } from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport { Pausable } from \"@openzeppelin/contracts/utils/Pausable.sol\";\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\nimport { BasisPointConstants } from \"../../common/BasisPointConstants.sol\";\nimport { IDStakeCollateralVaultV2 } from \"./interfaces/IDStakeCollateralVaultV2.sol\";\n\n/**\n * @title DStakeRouterV2Storage\n * @notice Shared storage layout for {@link DStakeRouterV2} and its delegatecall modules.\n * @dev Inherit this contract to guarantee storage slot alignment across the router and modules.\n */\nabstract contract DStakeRouterV2Storage is AccessControl, ReentrancyGuard, Pausable {\n    // --- Errors ---\n    error ZeroAddress();\n\n    // --- Immutable addresses ---\n    address internal immutable _dStakeToken;\n    IDStakeCollateralVaultV2 internal immutable _collateralVault;\n    address internal immutable _dStable;\n\n    // --- Mutable configuration ---\n    uint256 public dustTolerance;\n    uint256 public maxVaultCount;\n    uint256 public depositCap;\n    uint256 public settlementShortfall;\n    uint256 public reinvestIncentiveBps;\n    uint256 internal _withdrawalFeeBps;\n\n    // --- Adapter routing ---\n    mapping(address => address) internal _strategyShareToAdapter;\n    address internal _defaultDepositStrategyShare;\n\n    // --- Vault configuration ---\n    enum OperationType {\n        DEPOSIT,\n        WITHDRAWAL\n    }\n\n    enum VaultStatus {\n        Active,\n        Suspended,\n        Impaired\n    }\n\n    struct VaultConfig {\n        address strategyVault;\n        address adapter;\n        uint256 targetBps;\n        VaultStatus status;\n    }\n\n    VaultConfig[] public vaultConfigs;\n    mapping(address => uint256) public vaultToIndex;\n    mapping(address => bool) public vaultExists;\n\n    // --- Module wiring ---\n    address public governanceModule;\n    address public rebalanceModule;\n\n    // Append-only: replacement routers and their modules MUST share this layout.\n    // Zero encoding means the historical default of one underlying base unit.\n    mapping(address => uint256) internal _strategyRoundingLossPlusOne;\n    uint256 public operationRoundingLoss;\n\n    function strategyRoundingLoss(address strategyShare) public view returns (uint256) {\n        uint256 encoded = _strategyRoundingLossPlusOne[strategyShare];\n        return encoded == 0 ? 1 : encoded - 1;\n    }\n\n    // Hard absolute safety ceiling, never a percentage or donation-derived quote.\n    uint256 public constant MAX_ACCOUNTING_ROUNDING_LOSS = 16;\n\n    // --- Constants ---\n    uint256 public constant MAX_REINVEST_INCENTIVE_BPS = BasisPointConstants.ONE_PERCENT_BPS * 20;\n    uint256 public constant MAX_WITHDRAWAL_FEE_BPS = BasisPointConstants.ONE_PERCENT_BPS;\n    bytes32 internal constant STORAGE_FINGERPRINT =\n        keccak256(\"dtrinity.dstake.router.v2.storage:3:bounded-rounding-and-compounding\");\n\n    constructor(address dStakeToken_, address collateralVault_) {\n        if (dStakeToken_ == address(0) || collateralVault_ == address(0)) {\n            revert ZeroAddress();\n        }\n\n        _dStakeToken = dStakeToken_;\n        _collateralVault = IDStakeCollateralVaultV2(collateralVault_);\n        address dStableAddress = _collateralVault.dStable();\n        if (dStableAddress == address(0)) {\n            revert ZeroAddress();\n        }\n        _dStable = dStableAddress;\n\n        // Defaults mirror the original router constructor.\n        dustTolerance = 1;\n        operationRoundingLoss = 1;\n        maxVaultCount = 10;\n    }\n}\n"},{"file_path":"contracts/vaults/dstake/interfaces/IDStableConversionAdapterV2.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/**\n * @title IDStableConversionAdapterV2 Interface\n * @notice Interface for contracts that handle the conversion between the core stable asset (dUSD/dETH)\n *         and a specific yield-bearing or convertible ERC20 token (`strategy share`), as well as\n *         valuing that `strategy share` in terms of the stable asset.\n * @dev Implementations interact with specific protocols (lending pools, DEX LPs, wrappers, etc.).\n * @dev SECURITY: adapters must mint strategy shares straight to the collateral vault, burn (or transfer out) those\n *      shares before calling upstream withdraws, and rely on preview/rate helpers so wrapper supply cannot diverge from\n *      the underlying balance. See `WrappedDLendInvariant.test.ts` for the regression harness new adapters should copy.\n */\n// Integration invariant: matching preview / actual / reported share counts is\n// necessary but not sufficient. Routers check the change in the collateral\n// vault's complete strategy position against the actual underlying movement.\n// Withdrawal return values MUST equal the caller's actual asset balance increase.\n// Valuations still require a reviewed, honest ERC4626 implementation; neither an\n// adapter nor its vault's preview is an independent oracle for a malicious vault.\ninterface IDStableConversionAdapterV2 {\n    /**\n     * @notice Converts a specified amount of the stable asset into the specific `strategyShare`\n     *         managed by this adapter.\n     * @dev The adapter MUST pull `stableAmount` of the stable asset from the caller (expected to be the Router).\n     * @dev The resulting `strategyShare` MUST be sent/deposited/minted directly to the `collateralVault` address provided during adapter setup or retrieved.\n     * @param stableAmount The amount of stable asset to convert.\n     * @return strategyShare The address of the specific `strategy share` token managed by this adapter.\n     * @return strategyShareAmount The amount of `strategyShare` generated from the conversion.\n     */\n    function depositIntoStrategy(\n        uint256 stableAmount\n    ) external returns (address strategyShare, uint256 strategyShareAmount);\n\n    /**\n     * @notice Converts a specific amount of `strategyShare` back into the stable asset.\n     * @dev The adapter MUST pull the required amount of `strategyShare` from the caller (expected to be the Router).\n     * @dev The resulting stable asset MUST be sent to the caller.\n     * @param strategyShareAmount The amount of `strategyShare` to convert.\n     * @return stableAmount The amount of stable asset sent to the caller.\n     */\n    function withdrawFromStrategy(uint256 strategyShareAmount) external returns (uint256 stableAmount);\n\n    /**\n     * @notice Preview the result of converting a given stable amount to strategyShare (without state change).\n     * @param stableAmount The amount of stable asset to preview conversion for.\n     * @return strategyShare The address of the specific `strategy share` token managed by this adapter.\n     * @return strategyShareAmount The amount of `strategyShare` that would be received.\n     */\n    function previewDepositIntoStrategy(\n        uint256 stableAmount\n    ) external view returns (address strategyShare, uint256 strategyShareAmount);\n\n    /**\n     * @notice Preview the result of converting a given strategyShare amount to stable asset (without state change).\n     * @param strategyShareAmount The amount of `strategyShare` to preview conversion for.\n     * @return stableAmount The amount of stable asset that would be received.\n     */\n    function previewWithdrawFromStrategy(uint256 strategyShareAmount) external view returns (uint256 stableAmount);\n\n    /**\n     * @notice Calculates the value of a given amount of the specific `strategyShare` managed by this adapter\n     *         in terms of the stable asset.\n     * @param strategyShare The address of the strategy share token (should match strategyShare()). Included for explicitness.\n     * @param strategyShareAmount The amount of the `strategyShare` to value.\n     * @return stableValue The equivalent value in the stable asset.\n     */\n    function strategyShareValueInDStable(\n        address strategyShare,\n        uint256 strategyShareAmount\n    ) external view returns (uint256 stableValue);\n\n    /**\n     * @notice Returns the address of the specific `strategy share` token managed by this adapter.\n     * @return The address of the `strategy share`.\n     */\n    function strategyShare() external view returns (address);\n\n    /**\n     * @notice Returns the underlying vault asset associated with this adapter (legacy compatibility helper).\n     */\n    function vaultAsset() external view returns (address);\n}\n"},{"file_path":"contracts/vaults/dstake/interfaces/IDStakeCollateralVaultV2.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/**\n * @title IDStakeCollateralVaultV2 Interface\n * @notice Defines the external functions of the DStakeCollateralVaultV2 required by other\n *         contracts in the dSTAKE system, primarily the DStakeTokenV2.\n */\ninterface IDStakeCollateralVaultV2 {\n    /**\n     * @notice Calculates the total value of all managed `strategy shares` held by the vault,\n     *         denominated in the underlying dStable asset.\n     * @dev This is typically called by the DStakeTokenV2's `totalAssets()` function.\n     * @return dStableValue The total value of managed assets in terms of the dStable asset.\n     */\n    function totalValueInDStable() external view returns (uint256 dStableValue);\n\n    /**\n     * @notice Returns the address of the underlying dStable asset the vault operates with.\n     * @return The address of the dStable asset.\n     */\n    function dStable() external view returns (address);\n\n    /**\n     * @notice The DStakeTokenV2 contract address this vault serves.\n     */\n    function dStakeToken() external view returns (address);\n\n    /**\n     * @notice The DStakeRouter contract address allowed to interact.\n     */\n    function router() external view returns (address);\n\n    /**\n     * @notice Returns the strategy share at `index` from the internal supported list.\n     */\n    function supportedStrategyShares(uint256 index) external view returns (address);\n\n    /**\n     * @notice Returns the entire list of supported strategy shares. Convenient for UIs & off-chain analytics.\n     */\n    function getSupportedStrategyShares() external view returns (address[] memory);\n\n    /**\n     * @notice Transfers `amount` of `strategyShare` from this vault to the `recipient`.\n     * @dev Only callable by the registered router.\n     * @param strategyShare The address of the strategy share to send.\n     * @param amount The amount to send.\n     * @param recipient The address to receive the shares.\n     */\n    function transferStrategyShares(address strategyShare, uint256 amount, address recipient) external;\n\n    /**\n     * @notice Sets the address of the DStakeRouter contract.\n     * @dev Only callable by an address with the DEFAULT_ADMIN_ROLE.\n     * @param _newRouter The address of the new router contract.\n     */\n    function setRouter(address _newRouter) external;\n\n    /**\n     * @notice Adds a strategy share to the supported list. Callable only by the router.\n     */\n    function addSupportedStrategyShare(address strategyShare) external;\n\n    /**\n     * @notice Removes a strategy share from the supported list. Callable only by the router.\n     */\n    function removeSupportedStrategyShare(address strategyShare) external;\n\n    /**\n     * @notice Emitted when the router address is set.\n     * @param router The address of the new router.\n     */\n    event RouterSet(address indexed router);\n\n    /**\n     * @notice Emitted when a new strategy share is added to the supported list.\n     */\n    event StrategyShareSupported(address indexed strategyShare);\n\n    /**\n     * @notice Emitted when a strategy share is removed from the supported list.\n     */\n    event StrategyShareRemoved(address indexed strategyShare);\n}\n"},{"file_path":"contracts/vaults/dstake/interfaces/IDStakeRouterV2.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport { IDStakeCollateralVaultV2 } from \"./IDStakeCollateralVaultV2.sol\";\n\ninterface IDStakeRouterV2 {\n    // --- Views ---\n    function paused() external view returns (bool);\n\n    function collateralVault() external view returns (IDStakeCollateralVaultV2);\n\n    function dStakeToken() external view returns (address);\n\n    function totalManagedAssets() external view returns (uint256);\n\n    function currentShortfall() external view returns (uint256);\n\n    function withdrawalFeeBps() external view returns (uint256);\n\n    function maxWithdrawalFeeBps() external pure returns (uint256);\n\n    function maxDeposit(address receiver) external view returns (uint256);\n\n    function maxMint(address receiver) external view returns (uint256);\n\n    function maxWithdraw(address owner) external view returns (uint256);\n\n    function maxRedeem(address owner) external view returns (uint256);\n\n    function getActiveVaultsForDeposits() external view returns (address[] memory activeVaults);\n\n    function getMaxSingleVaultWithdraw() external view returns (uint256 maxAssets);\n\n    function strategyShareToAdapter(address strategyShare) external view returns (address);\n\n    function defaultDepositStrategyShare() external view returns (address);\n\n    // --- Token Hooks ---\n    function handleDeposit(address initiator, uint256 assets, uint256 shares, address receiver) external;\n\n    function handleWithdraw(\n        address initiator,\n        address receiver,\n        address owner,\n        uint256 grossAssets,\n        uint256 expectedNetAssets\n    ) external returns (uint256 netAssets, uint256 fee);\n\n    // --- Solver Flows ---\n    function solverDepositAssets(\n        address[] calldata vaults,\n        uint256[] calldata assets,\n        uint256 minShares,\n        address receiver\n    ) external returns (uint256 sharesMinted);\n\n    function solverDepositShares(\n        address[] calldata vaults,\n        uint256[] calldata strategyShares,\n        uint256 minShares,\n        address receiver\n    ) external returns (uint256 sharesMinted);\n\n    function solverWithdrawAssets(\n        address[] calldata vaults,\n        uint256[] calldata assets,\n        uint256 maxShares,\n        address receiver,\n        address owner\n    ) external returns (uint256 netAssets, uint256 fee, uint256 sharesBurned);\n\n    function solverWithdrawShares(\n        address[] calldata vaults,\n        uint256[] calldata strategyShares,\n        uint256 maxShares,\n        address receiver,\n        address owner\n    ) external returns (uint256 netAssets, uint256 fee, uint256 sharesBurned);\n\n    // --- Maintenance ---\n    /// @notice Adds backing for existing holders without minting outer shares.\n    function compoundDeposit(uint256 assets) external returns (address strategyShare, uint256 strategyShares);\n\n    function reinvestFees() external returns (uint256 amountReinvested, uint256 incentivePaid);\n\n    function setReinvestIncentive(uint256 newIncentiveBps) external;\n\n    function setWithdrawalFee(uint256 newFeeBps) external;\n\n    function recordShortfall(uint256 delta) external;\n\n    function clearShortfall(uint256 amount) external;\n}\n"},{"file_path":"contracts/vaults/dstake/interfaces/IDStakeRouterV2Module.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/**\n * @title IDStakeRouterV2Module\n * @notice Metadata surface every DStake router delegatecall module must expose so the router can validate wiring.\n */\ninterface IDStakeRouterV2Module {\n    /**\n     * @notice Returns module wiring metadata used to validate compatibility during router configuration.\n     * @return storageFingerprint Unique identifier for the expected storage layout version.\n     * @return dStakeTokenAddress Immutable dSTAKE token address baked into the module.\n     * @return collateralVaultAddress Immutable collateral vault address baked into the module.\n     */\n    function moduleMetadata()\n        external\n        view\n        returns (bytes32 storageFingerprint, address dStakeTokenAddress, address collateralVaultAddress);\n}\n"},{"file_path":"contracts/vaults/dstake/libraries/AllocationCalculator.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport { BasisPointConstants } from \"../../../common/BasisPointConstants.sol\";\n\n/**\n * @title AllocationCalculator\n * @notice Library for calculating allocations, deficits, and amount distributions\n * @dev Provides stateless functions for allocation calculations used in the DStake Morpho Router V2\n */\nlibrary AllocationCalculator {\n    // Unused error types removed in refactor\n\n    /**\n     * @notice Calculates current allocations in basis points from vault balances\n     * @dev Allocation for vault i = (balance[i] * BasisPointConstants.ONE_HUNDRED_PERCENT_BPS) / totalBalance\n     * @param vaultBalances Array of vault balances\n     * @return allocations Array of current allocations in basis points\n     * @return totalBalance Sum of all vault balances\n     */\n    function calculateCurrentAllocations(\n        uint256[] memory vaultBalances\n    ) internal pure returns (uint256[] memory allocations, uint256 totalBalance) {\n        if (vaultBalances.length == 0) {\n            return (new uint256[](0), 0);\n        }\n\n        // Calculate total balance\n        totalBalance = 0;\n        for (uint256 i = 0; i < vaultBalances.length; i++) {\n            totalBalance += vaultBalances[i];\n        }\n\n        allocations = new uint256[](vaultBalances.length);\n\n        // Handle edge case where all balances are zero\n        if (totalBalance == 0) {\n            // All allocations remain 0\n            return (allocations, totalBalance);\n        }\n\n        // Calculate allocations in basis points\n        for (uint256 i = 0; i < vaultBalances.length; i++) {\n            allocations[i] = (vaultBalances[i] * BasisPointConstants.ONE_HUNDRED_PERCENT_BPS) / totalBalance;\n        }\n\n        return (allocations, totalBalance);\n    }\n\n    // Unused AllocationCalculator helpers removed in refactor. Library intentionally only exposes\n    // calculateCurrentAllocations for production usage.\n}\n"},{"file_path":"contracts/vaults/dstake/libraries/DeterministicVaultSelector.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/**\n * @title DeterministicVaultSelector\n * @notice Library for selecting vaults based on allocation deltas for optimal rebalancing\n * @dev Used by DStake Router V2 to deterministically select top under/over allocated vaults\n *      during deposits and withdrawals. Provides gas-efficient alternative to weighted random\n *      selection by using partial sort algorithm for predictable vault selection.\n *\n * Key Features:\n * - Allocation-based prioritization: Selects most misallocated vaults to converge toward targets\n * - Partial sort algorithm: O(k*n) complexity optimized for selecting 1-3 vaults from 5-10 total\n */\nlibrary DeterministicVaultSelector {\n    /// @dev Error thrown when arrays have mismatched lengths\n    error ArrayLengthMismatch();\n\n    /// @dev Error thrown when no items are available for selection\n    error NoItemsAvailable();\n\n    /// @dev Error thrown when requesting more items than available\n    error InsufficientItems();\n\n    /// @dev Error thrown when selection count is zero\n    error InvalidSelectionCount();\n\n    /**\n     * @dev Struct to hold vault data during sorting operations\n     */\n    struct VaultData {\n        address vault;\n        uint256 delta;\n        uint256 originalIndex;\n    }\n\n    /**\n     * @notice Calculates underallocation amounts for deposit weight calculation\n     * @dev Underallocation = max(0, targetBps - currentBps) for underweight vaults\n     * @param currentAllocations Array of current allocations in basis points\n     * @param targetAllocations Array of target allocations in basis points\n     * @return underallocations Array of calculated underallocations\n     */\n    function calculateUnderallocations(\n        uint256[] memory currentAllocations,\n        uint256[] memory targetAllocations\n    ) internal pure returns (uint256[] memory underallocations) {\n        if (currentAllocations.length != targetAllocations.length) {\n            revert ArrayLengthMismatch();\n        }\n\n        underallocations = new uint256[](currentAllocations.length);\n\n        for (uint256 i = 0; i < currentAllocations.length; i++) {\n            // Underallocation = max(0, target - current) for underweight vaults\n            if (targetAllocations[i] > currentAllocations[i]) {\n                underallocations[i] = targetAllocations[i] - currentAllocations[i];\n            } else {\n                underallocations[i] = 0;\n            }\n        }\n\n        return underallocations;\n    }\n\n    /**\n     * @notice Calculates overallocation amounts for withdrawal weight calculation\n     * @dev Overallocation = max(0, currentBps - targetBps) for overweight vaults\n     * @param currentAllocations Array of current allocations in basis points\n     * @param targetAllocations Array of target allocations in basis points\n     * @return overallocations Array of calculated overallocations\n     */\n    function calculateOverallocations(\n        uint256[] memory currentAllocations,\n        uint256[] memory targetAllocations\n    ) internal pure returns (uint256[] memory overallocations) {\n        if (currentAllocations.length != targetAllocations.length) {\n            revert ArrayLengthMismatch();\n        }\n\n        overallocations = new uint256[](currentAllocations.length);\n\n        for (uint256 i = 0; i < currentAllocations.length; i++) {\n            // Overallocation = max(0, current - target) for overweight vaults\n            if (currentAllocations[i] > targetAllocations[i]) {\n                overallocations[i] = currentAllocations[i] - targetAllocations[i];\n            } else {\n                overallocations[i] = 0;\n            }\n        }\n\n        return overallocations;\n    }\n\n    /**\n     * @notice Selects top X most underallocated vaults for deposit operations\n     * @dev Uses partial sort algorithm to find vaults with highest (target - current) deltas\n     * @param vaults Array of vault addresses to select from\n     * @param currentBps Array of current allocations in basis points\n     * @param targetBps Array of target allocations in basis points\n     * @param count Number of vaults to select (must be <= vaults.length)\n     * @return selectedVaults Array of selected vault addresses\n     * @return selectedIndices Array of indices of selected vaults in original array\n     */\n    function selectTopUnderallocated(\n        address[] memory vaults,\n        uint256[] memory currentBps,\n        uint256[] memory targetBps,\n        uint256 count\n    ) internal pure returns (address[] memory selectedVaults, uint256[] memory selectedIndices) {\n        if (vaults.length != currentBps.length || currentBps.length != targetBps.length) {\n            revert ArrayLengthMismatch();\n        }\n\n        if (vaults.length == 0) {\n            revert NoItemsAvailable();\n        }\n\n        if (count == 0) {\n            revert InvalidSelectionCount();\n        }\n\n        if (count > vaults.length) {\n            revert InsufficientItems();\n        }\n\n        // Calculate underallocations\n        uint256[] memory underallocations = calculateUnderallocations(currentBps, targetBps);\n\n        // Check if any underallocations exist\n        bool hasUnderallocations = false;\n        for (uint256 i = 0; i < underallocations.length; i++) {\n            if (underallocations[i] > 0) {\n                hasUnderallocations = true;\n                break;\n            }\n        }\n\n        // If no underallocations, select first count vaults deterministically\n        if (!hasUnderallocations) {\n            selectedVaults = new address[](count);\n            selectedIndices = new uint256[](count);\n            for (uint256 i = 0; i < count; i++) {\n                selectedVaults[i] = vaults[i];\n                selectedIndices[i] = i;\n            }\n            return (selectedVaults, selectedIndices);\n        }\n\n        // Use partial sort to find top count underallocated vaults\n        return _selectTopVaultsByDelta(vaults, underallocations, count);\n    }\n\n    /**\n     * @notice Selects top X most overallocated vaults for withdrawal operations\n     * @dev Uses partial sort algorithm to find vaults with highest (current - target) deltas\n     * @param vaults Array of vault addresses to select from\n     * @param currentBps Array of current allocations in basis points\n     * @param targetBps Array of target allocations in basis points\n     * @param count Number of vaults to select (must be <= vaults.length)\n     * @return selectedVaults Array of selected vault addresses\n     * @return selectedIndices Array of indices of selected vaults in original array\n     */\n    function selectTopOverallocated(\n        address[] memory vaults,\n        uint256[] memory currentBps,\n        uint256[] memory targetBps,\n        uint256 count\n    ) internal pure returns (address[] memory selectedVaults, uint256[] memory selectedIndices) {\n        if (vaults.length != currentBps.length || currentBps.length != targetBps.length) {\n            revert ArrayLengthMismatch();\n        }\n\n        if (vaults.length == 0) {\n            revert NoItemsAvailable();\n        }\n\n        if (count == 0) {\n            revert InvalidSelectionCount();\n        }\n\n        if (count > vaults.length) {\n            revert InsufficientItems();\n        }\n\n        // Calculate overallocations\n        uint256[] memory overallocations = calculateOverallocations(currentBps, targetBps);\n\n        // Check if any overallocations exist\n        bool hasOverallocations = false;\n        for (uint256 i = 0; i < overallocations.length; i++) {\n            if (overallocations[i] > 0) {\n                hasOverallocations = true;\n                break;\n            }\n        }\n\n        // If no overallocations, select first count vaults deterministically\n        if (!hasOverallocations) {\n            selectedVaults = new address[](count);\n            selectedIndices = new uint256[](count);\n            for (uint256 i = 0; i < count; i++) {\n                selectedVaults[i] = vaults[i];\n                selectedIndices[i] = i;\n            }\n            return (selectedVaults, selectedIndices);\n        }\n\n        // Use partial sort to find top count overallocated vaults\n        return _selectTopVaultsByDelta(vaults, overallocations, count);\n    }\n\n    /**\n     * @notice Internal function that implements partial sort to select top vaults by delta\n     * @dev Uses selection algorithm optimized for small count values (O(k*n) complexity)\n     * @param vaults Array of vault addresses\n     * @param deltas Array of allocation deltas (under/over allocations)\n     * @param count Number of top vaults to select\n     * @return selectedVaults Array of selected vault addresses\n     * @return selectedIndices Array of indices of selected vaults in original array\n     */\n    function _selectTopVaultsByDelta(\n        address[] memory vaults,\n        uint256[] memory deltas,\n        uint256 count\n    ) private pure returns (address[] memory selectedVaults, uint256[] memory selectedIndices) {\n        // Create working array of vault data\n        VaultData[] memory vaultData = new VaultData[](vaults.length);\n        for (uint256 i = 0; i < vaults.length; i++) {\n            vaultData[i] = VaultData({ vault: vaults[i], delta: deltas[i], originalIndex: i });\n        }\n\n        // Perform partial sort using selection algorithm\n        // For each position in the top count, find the maximum in remaining array\n        for (uint256 pos = 0; pos < count; pos++) {\n            uint256 maxIndex = pos;\n            uint256 maxDelta = vaultData[pos].delta;\n\n            // Find the vault with maximum delta in remaining unsorted portion\n            for (uint256 i = pos + 1; i < vaultData.length; i++) {\n                if (\n                    vaultData[i].delta > maxDelta ||\n                    (vaultData[i].delta == maxDelta && vaultData[i].originalIndex < vaultData[maxIndex].originalIndex)\n                ) {\n                    maxIndex = i;\n                    maxDelta = vaultData[i].delta;\n                }\n            }\n\n            // Swap maximum element to current position\n            if (maxIndex != pos) {\n                VaultData memory temp = vaultData[pos];\n                vaultData[pos] = vaultData[maxIndex];\n                vaultData[maxIndex] = temp;\n            }\n        }\n\n        // Extract results from sorted portion\n        selectedVaults = new address[](count);\n        selectedIndices = new uint256[](count);\n\n        for (uint256 i = 0; i < count; i++) {\n            selectedVaults[i] = vaultData[i].vault;\n            selectedIndices[i] = vaultData[i].originalIndex;\n        }\n\n        return (selectedVaults, selectedIndices);\n    }\n}\n"},{"file_path":"contracts/vaults/dstake/libraries/StrategyBackingGuard.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC4626 } from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IDStableConversionAdapterV2 } from \"../interfaces/IDStableConversionAdapterV2.sol\";\nimport { IDStakeCollateralVaultV2 } from \"../interfaces/IDStakeCollateralVaultV2.sol\";\n\n/**\n * @notice Value-conservation checks shared by ALL router strategy movements.\n * @dev A preview/share-count match is not evidence of sufficient backing. Measure\n *      the change in the collateral vault's ENTIRE position, not just new shares.\n *      Both the strategy's redeemable value and the adapter's accounting value\n *      must pass. Neither an adapter return value nor existing router cash can\n *      substitute for actual assets received on withdrawal.\n *\n *      Trust boundary: these checks still require an honest, reviewed strategy\n *      valuation implementation. They are not an oracle for a malicious vault,\n *      a guarantee of immediate liquidity, or a cure for external NAV manipulation.\n *      The default is ONE smallest underlying-token unit. Explicit strategy and\n *      operation policies may allow up to SIXTEEN units, never basis points, and\n *      deliberately independent of configurable dustTolerance or share prices.\n */\nlibrary StrategyBackingGuard {\n    using SafeERC20 for IERC20;\n\n    uint256 internal constant MAX_ROUNDING_LOSS = 1;\n    uint256 internal constant HARD_ROUNDING_LOSS_LIMIT = 16;\n\n    error InvalidRoundingLoss(uint256 allowedLoss);\n\n    error StrategyBackingLoss(\n        address vault,\n        uint8 measure,\n        uint256 beforeValue,\n        uint256 afterValue,\n        uint256 requiredIncrease\n    );\n    error StrategyWithdrawalLoss(address vault, uint8 measure, uint256 valueLost, uint256 assetsReceived);\n    error AssetBalanceMismatch(uint256 expected, uint256 actual);\n    error WithdrawalAssetsMismatch(uint256 reported, uint256 actual);\n    error AdapterAssetMismatch(address adapter, address expectedAsset, address actualAsset);\n    error AdapterSharesMismatch(uint256 actualShares, uint256 reportedShares);\n    error SlippageCheckFailed(address asset, uint256 actualAmount, uint256 requiredAmount);\n    error ZeroWithdrawalAssets();\n\n    struct Position {\n        uint256 cash;\n        uint256 shares;\n        uint256 redeemable;\n        uint256 reported;\n    }\n\n    function position(\n        address asset,\n        address vault,\n        address adapter,\n        address collateral\n    ) internal view returns (Position memory p) {\n        p.cash = IERC20(asset).balanceOf(address(this));\n        p.shares = IERC20(vault).balanceOf(collateral);\n        if (p.shares != 0) {\n            p.redeemable = IERC4626(vault).previewRedeem(p.shares);\n            p.reported = IDStableConversionAdapterV2(adapter).strategyShareValueInDStable(vault, p.shares);\n        }\n    }\n\n    function deposit(\n        address asset,\n        address vault,\n        address adapterAddress,\n        IDStakeCollateralVaultV2 collateral,\n        uint256 assets\n    ) internal returns (uint256 actualShares) {\n        return deposit(asset, vault, adapterAddress, collateral, assets, MAX_ROUNDING_LOSS);\n    }\n\n    function deposit(\n        address asset,\n        address vault,\n        address adapterAddress,\n        IDStakeCollateralVaultV2 collateral,\n        uint256 assets,\n        uint256 allowedLoss\n    ) internal returns (uint256 actualShares) {\n        _validateRoundingLoss(allowedLoss);\n        Position memory beforePosition = position(asset, vault, adapterAddress, address(collateral));\n        IDStableConversionAdapterV2 adapter = IDStableConversionAdapterV2(adapterAddress);\n        (address expectedVault, uint256 expectedShares) = adapter.previewDepositIntoStrategy(assets);\n        if (expectedVault != vault) revert AdapterAssetMismatch(adapterAddress, vault, expectedVault);\n\n        IERC20(asset).forceApprove(adapterAddress, assets);\n        (address actualVault, uint256 reportedShares) = adapter.depositIntoStrategy(assets);\n        IERC20(asset).forceApprove(adapterAddress, 0);\n        if (actualVault != vault) revert AdapterAssetMismatch(adapterAddress, vault, actualVault);\n\n        Position memory afterPosition = position(asset, vault, adapterAddress, address(collateral));\n        actualShares = afterPosition.shares - beforePosition.shares;\n        if (actualShares < expectedShares) revert SlippageCheckFailed(vault, actualShares, expectedShares);\n        if (actualShares != reportedShares) revert AdapterSharesMismatch(actualShares, reportedShares);\n\n        uint256 spent = beforePosition.cash >= afterPosition.cash ? beforePosition.cash - afterPosition.cash : 0;\n        if (spent != assets) revert AssetBalanceMismatch(assets, spent);\n        assertIncrease(vault, 0, beforePosition.redeemable, afterPosition.redeemable, assets, allowedLoss);\n        assertIncrease(vault, 1, beforePosition.reported, afterPosition.reported, assets, allowedLoss);\n        // Intentionally no unconditional actualShares != 0 requirement: existing\n        // collateral-owned shares may receive the entire, sufficient NAV increase.\n    }\n\n    function withdraw(\n        address asset,\n        address vault,\n        address adapterAddress,\n        IDStakeCollateralVaultV2 collateral,\n        uint256 shares\n    ) internal returns (uint256 received) {\n        return withdraw(asset, vault, adapterAddress, collateral, shares, MAX_ROUNDING_LOSS);\n    }\n\n    function withdraw(\n        address asset,\n        address vault,\n        address adapterAddress,\n        IDStakeCollateralVaultV2 collateral,\n        uint256 shares,\n        uint256 allowedLoss\n    ) internal returns (uint256 received) {\n        _validateRoundingLoss(allowedLoss);\n        Position memory beforePosition = position(asset, vault, adapterAddress, address(collateral));\n        collateral.transferStrategyShares(vault, shares, address(this));\n        IERC20(vault).forceApprove(adapterAddress, shares);\n        uint256 reported = IDStableConversionAdapterV2(adapterAddress).withdrawFromStrategy(shares);\n        IERC20(vault).forceApprove(adapterAddress, 0);\n        Position memory afterPosition = position(asset, vault, adapterAddress, address(collateral));\n\n        received = afterPosition.cash >= beforePosition.cash ? afterPosition.cash - beforePosition.cash : 0;\n        if (received != reported) revert WithdrawalAssetsMismatch(reported, received);\n        if (received == 0) revert ZeroWithdrawalAssets();\n        assertWithdrawal(vault, 0, beforePosition.redeemable, afterPosition.redeemable, received, allowedLoss);\n        assertWithdrawal(vault, 1, beforePosition.reported, afterPosition.reported, received, allowedLoss);\n    }\n\n    function pull(address asset, address from, uint256 assets) internal {\n        uint256 beforeBalance = IERC20(asset).balanceOf(address(this));\n        IERC20(asset).safeTransferFrom(from, address(this), assets);\n        uint256 actual = IERC20(asset).balanceOf(address(this)) - beforeBalance;\n        if (actual != assets) revert AssetBalanceMismatch(assets, actual);\n    }\n\n    function assertIncrease(\n        address vault,\n        uint8 measure,\n        uint256 beforeValue,\n        uint256 afterValue,\n        uint256 requiredIncrease\n    ) internal pure {\n        assertIncrease(vault, measure, beforeValue, afterValue, requiredIncrease, MAX_ROUNDING_LOSS);\n    }\n\n    function assertIncrease(\n        address vault,\n        uint8 measure,\n        uint256 beforeValue,\n        uint256 afterValue,\n        uint256 requiredIncrease,\n        uint256 allowedLoss\n    ) internal pure {\n        _validateRoundingLoss(allowedLoss);\n        uint256 increase = afterValue > beforeValue ? afterValue - beforeValue : 0;\n        // Never allow a positive nominal credit with NO new backing, including\n        // one-unit deposits. Subtraction avoids overflowing afterValue + tolerance.\n        if (increase == 0 || (increase < requiredIncrease && requiredIncrease - increase > allowedLoss)) {\n            revert StrategyBackingLoss(vault, measure, beforeValue, afterValue, requiredIncrease);\n        }\n    }\n\n    function assertWithdrawal(\n        address vault,\n        uint8 measure,\n        uint256 beforeValue,\n        uint256 afterValue,\n        uint256 received\n    ) internal pure {\n        assertWithdrawal(vault, measure, beforeValue, afterValue, received, MAX_ROUNDING_LOSS);\n    }\n\n    function assertWithdrawal(\n        address vault,\n        uint8 measure,\n        uint256 beforeValue,\n        uint256 afterValue,\n        uint256 received,\n        uint256 allowedLoss\n    ) internal pure {\n        _validateRoundingLoss(allowedLoss);\n        uint256 lost = beforeValue > afterValue ? beforeValue - afterValue : 0;\n        if (lost > received && lost - received > allowedLoss) {\n            revert StrategyWithdrawalLoss(vault, measure, lost, received);\n        }\n    }\n\n    function _validateRoundingLoss(uint256 allowedLoss) private pure {\n        if (allowedLoss > HARD_ROUNDING_LOSS_LIMIT) revert InvalidRoundingLoss(allowedLoss);\n    }\n}\n"}],"is_verified_via_sourcify":false,"can_be_visualized_via_sol2uml":true,"evm_version":"paris","language":"solidity","is_verified_via_eth_bytecode_db":false,"is_fully_verified":true,"license_type":"none","is_blueprint":false,"name":"DStakeRouterV2Incident","creation_bytecode":"0x60e060409080825234620002c9578181620064b88038038091620000248285620002ce565b833981010312620002c9576200003a8162000308565b62000049602080930162000308565b600180556001600160a01b0390828216158015620002be575b620002ad5790838160049385608052168060a0528651938480926306617c6960e11b82525afa918215620002a25760009262000260575b508116156200024f5790620000fc9160c05260016003556001601155600a600455620000c5336200031d565b50620000d1336200039d565b50620000dd336200043f565b50620000e933620004dc565b50620000f53362000579565b5062000616565b5060025460ff81166200023e5760ff191660011760025581513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589190a151615de49081620006b48239608051818181610863015281816110fe0152818161175f01528181611b3401528181611d990152818161246c01528181612a8501528181612dcb01528181612e5e01528181612f690152613afc015260a051818181610c0f01528181612a6101528181612c430152818161322401528181613c1501528181613e0d01528181613eed015281816140270152818161429b015281816146d501526148d5015260c0518181816109a3015281816111740152818161184201528181611cc001528181611dea01528181612c95015281816135150152818161399201528181613b5501528181613e2f0152818161408c01526143270152f35b825163d93c066560e01b8152600490fd5b835163d92e233d60e01b8152600490fd5b90918482813d83116200029a575b6200027a8183620002ce565b810103126200029757506200028f9062000308565b903862000099565b80fd5b503d6200026e565b85513d6000823e3d90fd5b845163d92e233d60e01b8152600490fd5b508181161562000062565b600080fd5b601f909101601f19168101906001600160401b03821190821017620002f257604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620002c957565b6001600160a01b031660008181527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604081205490919060ff166200039957818052816020526040822081835260205260408220600160ff198254161790553391600080516020620064988339815191528180a4600190565b5090565b6001600160a01b031660008181527f6e98dd9cebd68294c714043e0bade2c9294a848cd8241ee0a4ddd32338d6eab260205260408120549091907f59ca4ce6e783b097a9f11fb884d7979754b2eaecccdca81c43de092ef5d947939060ff166200043a57808352826020526040832082845260205260408320600160ff1982541617905560008051602062006498833981519152339380a4600190565b505090565b6001600160a01b031660008181527f1a98536394a89bde21c352fe1c1076b59f564e1e17e1afe0b735e553ce9ce04460205260408120549091907fbbfb55d933c2bfa638763473275b1d84c4418e58d26cf9d2cd5758237756d9f09060ff166200043a57808352826020526040832082845260205260408320600160ff1982541617905560008051602062006498833981519152339380a4600190565b6001600160a01b031660008181527f892718e7a1a469066675b5f782493ac861b4f98b3c42b6d42b67d853aabe987b60205260408120549091907fd1473398bb66596de5d1ea1fc8e303ff2ac23265adc9144b1b52065dc4f0934b9060ff166200043a57808352826020526040832082845260205260408320600160ff1982541617905560008051602062006498833981519152339380a4600190565b6001600160a01b031660008181527ff7c9542c591017a21c74b6f3fab6263c7952fc0aaf9db4c22a2a04ddc7f8674f60205260408120549091907f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9060ff166200043a57808352826020526040832082845260205260408320600160ff1982541617905560008051602062006498833981519152339380a4600190565b6001600160a01b031660008181527fee6598bb9d8813ec5dcf0988fbc9935f3bd23c22de3e37b2654f2216372e6c0860205260408120549091907f7fee0d6ae731e4c26a7bffbf1bb702cb3aaa110506f5b2a78cc9372669d439ae9060ff166200043a57808352826020526040832082845260205260408320600160ff1982541617905560008051602062006498833981519152339380a460019056fe6080604052600436101561001257600080fd5b60003560e01c8063015d2de81461059657806301ffc9a71461059157806304336bb31461058c5780630489788a1461058757806305b2bfb0146105825780630b19ebb11461057d5780630bece79c146105785780630c345759146105555780630f04b97814610573578063100d0e991461056e57806311b2cd0214610569578063163e4d961461041a57806316d37595146105645780631bbf12241461048d5780631e9998141461055f5780631f0f1398146105325780631fb51daa1461055a578063204d44d114610555578063248a9ca3146105505780632591cfc81461054b578063259a77e114610546578063295891fd146105415780632b0a70321461053c5780632f2ff15d1461053757806334bad3201461053257806336568abe1461052d5780633a0920751461046a5780633ded0000146105285780633f4ba83a14610523578063402d267d1461051e57806341826c2d14610519578063583d50fb14610514578063585cd34b1461050f57806358fdc0551461041a5780635ab33b931461050a5780635c47df42146105055780635c975abb146105005780635e5a24a4146104fb5780636b052c18146104f65780636dacd3d7146104f157806373814cbb146104ec57806374d4e491146104e7578063772447f8146104385780637b1870d6146104e25780637e45f1e1146104dd5780638351812e146104d85780638404c1c1146104d35780638456cb59146104ce5780638562537c146104c957806386651203146104605780638f1ace30146104c457806391d14854146104bf57806392f5491c146104ba578063965a90e6146104b55780639665018a146104b05780639bb9461f146104ab578063a0c7f799146104a6578063a217fddf146104a1578063abbaafb01461049c578063ac1e502514610460578063ad07f2d114610460578063ad8aecc614610497578063b4da09f014610492578063b6783edd1461048d578063bc6d5a1014610488578063c19d91e714610483578063c63d75b61461047e578063c72a3dce14610447578063cabc3a4814610479578063cb4750cb14610460578063cc88bd5d14610474578063cd24728b1461046f578063cd7c75051461046a578063ce96cb7714610465578063ceb68c2314610438578063cf1638ba14610460578063d547741f1461045b578063d80a716314610456578063d905777e14610451578063dbd5edc71461044c578063dc369c6514610447578063dd16dfdc14610442578063de1eb9a31461043d578063df180cd514610438578063e63ab1e914610433578063ebf091f21461042e578063ecd041f114610429578063f00d1ae914610424578063f343cff01461041f578063f575a8fe1461041a578063f9b06b1c146104155763fd6fab8d1461041057600080fd5b612632565b612609565b610d16565b6125da565b6123ee565b6123d0565b6123b4565b612379565b61195f565b612351565b6122d9565b612138565b6122bb565b612294565b61227b565b612239565b611b18565b612212565b61101e565b6121f9565b61216f565b612151565b612112565b6120e1565b6120a6565b610e35565b612051565b612028565b611ffc565b611fe0565b611fa5565b611f7c565b611f5e565b611d1b565b611c2a565b611bd4565b611bb9565b611af1565b611a97565b611a5a565b6119fd565b6119c2565b611983565b611941565b61190f565b6118e8565b6117ec565b6117b1565b61178e565b611749565b61170d565b6116e9565b61167e565b611584565b6114ae565b611457565b61108f565b610fd3565b610e70565b610f91565b610f68565b610f4a565b610f2e565b610efd565b610ece565b610c3e565b610eaa565b610e52565b610df3565b610cf2565b610cb7565b610c5c565b610bf9565b6107d6565b61070a565b6106ac565b61061d565b6105c7565b6105ab565b60009103126105a657565b600080fd5b346105a65760003660031901126105a657602060405160108152f35b346105a65760203660031901126105a65760043563ffffffff60e01b81168091036105a657602090637965db0b60e01b811490811561060c575b506040519015158152f35b6301ffc9a760e01b14905038610601565b346105a65760003660031901126105a6576020600854604051908152f35b634e487b7160e01b600052602160045260246000fd5b6003111561065b57565b61063b565b90600382101561065b5752565b81516001600160a01b03908116825260208084015190911690820152604080830151908201526060918201516080820193926106aa920190610660565b565b346105a65760203660031901126105a6576004356106c8613c9b565b50600b548110156106f8576106e86106e26106f49261163f565b50613cc0565b6040519182918261066d565b0390f35b604051634e23d03560e01b8152600490fd5b346105a65760003660031901126105a6576020610725612c23565b604051908152f35b9181601f840112156105a6578235916001600160401b0383116105a6576020808501948460051b0101116105a657565b6001600160a01b038116036105a657565b60a06003198201126105a6576001600160401b03916004358381116105a6578261079a9160040161072d565b939093926024359182116105a6576107b49160040161072d565b9091604435906064356107c68161075d565b906084356107d38161075d565b90565b346105a6576107e43661076e565b9295939190946107f26132b7565b6107fa613299565b6000926001600160a01b03878116929091908315610be7578015610bd557898103610bc35785978661082b8c6133b7565b93885b8d808210610b70575050508915610b5e5761084b6008548b613811565b818111610ae7575b5050909192809495969798999a507f000000000000000000000000000000000000000000000000000000000000000016998a966108ae60208c60409a8b518080958194630a28a47760e01b8352600483019190602083019252565b03915afa998a15610a555799610ab7575b50808911610a9757506108d0612c23565b946108f16108df8686866141a3565b966108e8612c23565b60115491615c0f565b6108fd60085487612fef565b9b6109088d88612d1c565b9b808d10610a7757808d11610a5a575b50803b156105a6578851630ef1a41b60e11b81523360048201526001600160a01b0384811660248301529b909b1660448c015260648b018c905260848b018a90528a60a4815a6000948591f1948515610a55576109c88c6109d39489946106f49e7fb935df7c8ec5ab928816ed97360488365f862650eeaf5f9f96c9fc6897fb134b9a610a3c575b507f000000000000000000000000000000000000000000000000000000000000000016613637565b8851948594856137f6565b0390a1825190815260208101869052604081018790526060810184905233907fa191992edf1e50e292cf5996aae0dc5fc118dd8377c887fd047a8e6b6444fe5890608090a3610a2160018055565b51938493846040919493926060820195825260208201520152565b80610a49610a4f926129be565b8061059b565b386109a0565b612a3c565b9c610a698e610a6f939e612d1c565b90612c16565b9b9a38610918565b8951631f5c25a360e01b81526004810191909152602481018d9052604490fd5b875163f6ee017160e01b8152600481018a90526024810191909152604490fd5b610ad991995060203d8111610ae0575b610ad181836129f1565b810190612bf4565b97386108bf565b503d610ac7565b90610af191612d1c565b9a805b610aff575b80610853565b610b0881612d0d565b610b128186613179565b51610b2257506000190180610af4565b9192939495969798999a9b610b4d9150610b4690610b408488613179565b51612c16565b9185613179565b529089989796959493929138610af9565b60405163162908e360e11b8152600490fd5b610b7e82610b869285613740565b35809d612c16565b9b80610b96575b5060010161082e565b60019193610baa610bbc9260085490613811565b9081610bb6878b613179565b52612c16565b9290610b8d565b60405163512509d360e11b8152600490fd5b60405163a600c81d60e01b8152600490fd5b60405163220a42fb60e11b8152600490fd5b346105a65760003660031901126105a6576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346105a65760003660031901126105a6576020600654604051908152f35b346105a65760203660031901126105a6576001600160401b036004358181116105a657366023820112156105a65780600401359182116105a657602490369260071b0101116105a657610cad6126b7565b610cb561389a565b005b346105a65760003660031901126105a65760206040517f59ca4ce6e783b097a9f11fb884d7979754b2eaecccdca81c43de092ef5d947938152f35b346105a65760203660031901126105a657610d0e60043561075d565b610cad612659565b346105a65760803660031901126105a657610d3260043561075d565b610d3d60243561075d565b3360009081527f558dbed4104813a007d4614c5b743b91381b1a980614ba356594057f2c67b8ce60205260409020547fcf2f6d4b287b5b3ebfc9620610a356b6fff07ad64add1cd9a07a3a9f3d45f50c9060ff1615610dd557610d9e6132b7565b610da6613299565b610dcf610db1612c23565b600f54610dc6906001600160a01b03166138d1565b506108e8612c23565b60018055005b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b346105a65760203660031901126105a657600435610e108161075d565b60018060a01b0316600052600d602052602060ff604060002054166040519015158152f35b346105a65760003660031901126105a65760206040516127108152f35b346105a65760003660031901126105a6576020600354604051908152f35b346105a65760803660031901126105a657610e8c60043561075d565b610e9760243561075d565b600360643510156105a657610cad6126b7565b346105a65760203660031901126105a657610ec660043561075d565b610cad61270f565b346105a65760203660031901126105a65760043560005260006020526020600160406000200154604051908152f35b346105a65760203660031901126105a6576020610f24600435610f1f8161075d565b61488e565b6040519015158152f35b346105a65760003660031901126105a657602060405160038152f35b346105a65760003660031901126105a6576020600454604051908152f35b346105a65760003660031901126105a657600e546040516001600160a01b039091168152602090f35b346105a65760403660031901126105a657610cb5602435600435610fb48261075d565b806000526000602052610fce60016040600020015461286f565b61288e565b346105a65760403660031901126105a657602435610ff08161075d565b336001600160a01b0382160361100c57610cb59060043561291f565b60405163334bd91960e11b8152600490fd5b346105a65760803660031901126105a657610cad6126b7565b60806003198201126105a6576001600160401b03916004358381116105a657826110639160040161072d565b939093926024359182116105a65761107d9160040161072d565b9091604435906064356107d38161075d565b346105a65761109d36611037565b6110aa95929491956132b7565b6110b2613299565b6001600160a01b03818116939092908415610be7578115610bd557868203610bc3576110dd826133b7565b92600094855b84811061137957508515610b5e5785906110fc826132da565b7f0000000000000000000000000000000000000000000000000000000000000000169860409889519b63ef8b30f760e01b8d5260208d8d81806111486004998a83019190602083019252565b03915afa9c8d15610a555760009d611359575b50808d10611335575061116c612c23565b9161119889337f00000000000000000000000000000000000000000000000000000000000000006158fd565b60005b8781106112ad575050506111bb90876111b2612c23565b60115492615a41565b883b156105a65787516325b4f06160e11b8152339181019182526001600160a01b03909216602082015260408101869052606081018a90529098976000918a919082908490829060800103925af1978815610a5557847f532f13a056b54c036d5c3fc8feef04beb2a99aa9aac9dfc1ae768acbb52a11539461124c926106f49b61129a575b508851948594856137f6565b0390a182519081526020810184905233907fd1b7862c3523b3d49407e56072f1ef23224f9c1afaf15b3726ef601fa8bc292390604090a361128c60018055565b519081529081906020820190565b80610a496112a7926129be565b38611240565b6112b8818385613740565b35806112c8575b5060010161119b565b6112db6112d6838b8b613740565b613750565b906112f06112e9848d613179565b5183613db7565b908082106112ff5750506112bf565b8e5163a77b078360e01b81526001600160a01b039093168389019081526020810191909152604081019190915281906060010390fd5b8a5163d6781d5760e01b81528085018e815260208101929092529081906040010390fd5b611372919d5060203d8111610ae057610ad181836129f1565b9b3861115b565b611384818b8b613740565b3580611394575b506001016110e3565b90966113a46112d6898888613740565b916113b960606113b385613d08565b016137e9565b6113c281610651565b6114365760405163b3d7f6b960e01b81526004810191909152916020919082908490602490829088165afa908115610a555760019361141093600093611417575b505081610bb68b8b613179565b969061138b565b61142e929350803d10610ae057610ad181836129f1565b903880611403565b604051630f6762e560e01b81526001600160a01b0384166004820152602490fd5b346105a65760003660031901126105a65761147061270f565b6114786138b2565b60ff19600254166002557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b346105a65760203660031901126105a6576114ca60043561075d565b6020610725612d29565b90815180825260208080930193019160005b8281106114f4575050505090565b83516001600160a01b0316855293810193928101926001016114e6565b90815180825260208080930193019160005b828110611531575050505090565b835185529381019392810192600101611523565b94939261157160609361156361157f9460808a5260808a01906114d4565b9088820360208a0152611511565b908682036040880152611511565b930152565b346105a65760003660031901126105a657600b546115a1816133b7565b6115aa826133b7565b6115b3836133b7565b9260005b8181106115da5750506115cc6106f4916149dd565b909360405194859485611545565b8060406115eb6106e260019461163f565b61160b848060a01b0380835116611602868b613179565b528251166146be565b6116158488613179565b5201516116228288613179565b52016115b7565b634e487b7160e01b600052603260045260246000fd5b600b5481101561167957600b60005260021b7f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90190600090565b611629565b346105a65760203660031901126105a657600435600b548110156105a6576116a760809161163f565b506116e760018060a01b039182815416926001820154169060ff600360028301549201541691604051948552602085015260408401526060830190610660565bf35b346105a65760203660031901126105a65761170560043561075d565b610cad612767565b346105a65760203660031901126105a65761172960043561075d565b611731612767565b6117396132b7565b6117416138b2565b610dcf61389a565b346105a65760003660031901126105a6576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346105a65760003660031901126105a657602060ff600254166040519015158152f35b346105a65760003660031901126105a65760206040517fd1473398bb66596de5d1ea1fc8e303ff2ac23265adc9144b1b52065dc4f0934b8152f35b346105a65760203660031901126105a6576004356118086132b7565b611810613299565b8015610b5e5761181f816132da565b600a546001600160a01b03168080156118d65761183a612c23565b9261186681337f00000000000000000000000000000000000000000000000000000000000000006158fd565b61187d6118738285613db7565b94826111b2612c23565b604080519182526020820185905233917f4d0f99bc1f9d877fc67b25fe12c1e39507c59109af5d41eb83334678deb457e69190a36118ba60018055565b604080516001600160a01b039290921682526020820192909252f35b604051633a65e22f60e01b8152600490fd5b346105a65760403660031901126105a65761190460043561075d565b61170560243561075d565b346105a65760003660031901126105a6576106f461192b6143be565b50506040519182916020835260208301906114d4565b346105a65760003660031901126105a6576020600b54604051908152f35b346105a65760203660031901126105a65761197b60043561075d565b610cad6126b7565b346105a65760003660031901126105a65761199c6132b7565b6119a4613299565b6119ac613974565b6001805560408051928352602083019190915290f35b346105a65760003660031901126105a65760206040517fcf2f6d4b287b5b3ebfc9620610a356b6fff07ad64add1cd9a07a3a9f3d45f50c8152f35b346105a65760a03660031901126105a6576119ac600435611a1d8161075d565b60243590611a2a8261075d565b611a3560443561075d565b611a3d6127bf565b611a456132b7565b611a4d613299565b6084359160643591613491565b346105a65760203660031901126105a657600435611a778161075d565b60018060a01b0316600052600c6020526020604060002054604051908152f35b346105a65760003660031901126105a657611ab061270f565b611ab8613299565b600160ff1960025416176002557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346105a65760203660031901126105a6576020610f24600435611b138161075d565b6147d4565b346105a65760203660031901126105a6576001600160a01b03337f00000000000000000000000000000000000000000000000000000000000000008216141580611b80575b611b6e57610cb590600e54166138d1565b60405163753a613d60e01b8152600490fd5b503360009081527f1a98536394a89bde21c352fe1c1076b59f564e1e17e1afe0b735e553ce9ce044602052604090205460ff1615611b5d565b346105a65760003660031901126105a6576020610725613d62565b346105a65760403660031901126105a657602060ff611c1e602435611bf88161075d565b6004356000526000845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b346105a65760803660031901126105a657600435611c478161075d565b606435602435611c568261075d565b611c5e6127bf565b611c666132b7565b611c6e613299565b6001600160a01b03918216918215610be7578115610b5e577f65de205f6d75275ee9af2a4c295a8327d0af9970af2db8dd0f9c2d8974c15e7a90611cb1836132da565b611cb9612c23565b611ce484337f00000000000000000000000000000000000000000000000000000000000000006158fd565b611cfa611cf085613412565b91856111b2612c23565b6040805194855260443560208601529082169590911692a4610cb560018055565b346105a657611d2936611037565b92611d389592959491946132b7565b611d40613299565b6001600160a01b03848116939092908415610be7578115610bd557878203610bc357600093845b898110611f3e57508415610b5e57611d7e856132da565b6040805163ef8b30f760e01b815260048101879052989097917f0000000000000000000000000000000000000000000000000000000000000000169060208a602481855afa998a15610a555760009a611f1e575b50808a10611efe5750611de3612c23565b611e0e87337f00000000000000000000000000000000000000000000000000000000000000006158fd565b60005b8b868210611ec4575050611e2890876111b2612c23565b803b156105a65787516325b4f06160e11b81523360048201526001600160a01b0392909216602483015260448201869052606482018990526000908290608490829084905af18015610a55576106f4997f532f13a056b54c036d5c3fc8feef04beb2a99aa9aac9dfc1ae768acbb52a11539561124c938893611eb1575b508951958695866137a2565b80610a49611ebe926129be565b38611ea5565b90611ed2816001938a613740565b3580611ee0575b5001611e11565b611ef790611ef26112d6848b8b613740565b613db7565b5038611ed9565b885163d6781d5760e01b8152600481018b90526024810191909152604490fd5b611f37919a5060203d8111610ae057610ad181836129f1565b9838611dd2565b94611f57600191611f50888d89613740565b3590612c16565b9501611d67565b346105a65760003660031901126105a6576020601154604051908152f35b346105a65760203660031901126105a657611f95612817565b611f9d6132b7565b611741613299565b346105a65760003660031901126105a65760206040517fbbfb55d933c2bfa638763473275b1d84c4418e58d26cf9d2cd5758237756d9f08152f35b346105a65760003660031901126105a657602060405160008152f35b346105a65760403660031901126105a65761201860043561075d565b612020612659565b610cad6138b2565b346105a65760003660031901126105a657600a546040516001600160a01b039091168152602090f35b346105a65760203660031901126105a65760206004356120708161075d565b60018060a01b038091166000526009825260406000205416604051908152f35b634e487b7160e01b600052601160045260246000fd5b346105a65760003660031901126105a65760206040517f7fee0d6ae731e4c26a7bffbf1bb702cb3aaa110506f5b2a78cc9372669d439ae8152f35b346105a65760003660031901126105a6576120fa612817565b6121026132b7565b61210a6138b2565b610dcf613ada565b346105a65760203660031901126105a65761212e60043561075d565b6020610725612da0565b346105a65760203660031901126105a657610cad612659565b346105a65760003660031901126105a6576020600754604051908152f35b346105a65760203660031901126105a65760043561218c8161075d565b612194612817565b6001600160a01b0381169081156121e7576121ae90612a48565b600f80546001600160a01b031916821790557fbeef3b5508060a5c16820fa912c3580a296e5c9998cab97ec8999d823590ee74600080a2005b60405163d92e233d60e01b8152600490fd5b346105a65760003660031901126105a657610cad612659565b346105a65760203660031901126105a65760206107256004356122348161075d565b612e1f565b346105a65760403660031901126105a657610cb560243560043561225c8261075d565b80600052600060205261227660016040600020015461286f565b61291f565b346105a65760203660031901126105a657612020612659565b346105a65760203660031901126105a65760206107256004356122b68161075d565b612f3d565b346105a65760003660031901126105a6576020600554604051908152f35b346105a65760203660031901126105a6576004356122f68161075d565b6122fe612817565b6001600160a01b0381169081156121e75761231890612a48565b600e80546001600160a01b031916821790557f4cf0b78387d5b4cad8a97c3daee2b7106997db0ae19cf71c1054d53275fb1027600080a2005b346105a65760203660031901126105a6576106f46106e86004356123748161075d565b613d08565b346105a65760003660031901126105a65760206040517f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a8152f35b346105a65760003660031901126105a6576106f461192b614511565b346105a65760003660031901126105a657602060405162030d408152f35b346105a6576123fc3661076e565b9361240a96919395966132b7565b612412613299565b6001600160a01b0396600094888116939091908415610be7578115610bd557888203610bc357612441826133b7565b92879a885b84811061252257508b15610b5e5761246360209c60085490612fb5565b9a8b986124b1837f0000000000000000000000000000000000000000000000000000000000000000169e8f9b60409c8d518080958194630a28a47760e01b8352600483019190602083019252565b03915afa9b8c15610a55579b612502575b50808b116124e257506108df6108f1916124da612c23565b988787614203565b895163f6ee017160e01b8152600481018c90526024810191909152604490fd5b61251b919b5060203d8111610ae057610ad181836129f1565b99386124c2565b61252d818d89613740565b358061253d575b50600101612446565b909c612589906125648f6125586112d6612558928b8b613740565b6001600160a01b031690565b92604051809463266d6a8360e11b825281806020968795600483019190602083019252565b03915afa908115610a55578f6001946125b0948f946125b7575b5050610bb683918b613179565b9c90612534565b610bb6945090816125d392903d10610ae057610ad181836129f1565b92386125a3565b346105a65760403660031901126105a6576125f660043561075d565b600360243510156105a657610cad6126b7565b346105a65760003660031901126105a657600f546040516001600160a01b039091168152602090f35b346105a65760203660031901126105a65760206107256004356126548161075d565b614984565b3360009081527f1a98536394a89bde21c352fe1c1076b59f564e1e17e1afe0b735e553ce9ce044602052604090207fbbfb55d933c2bfa638763473275b1d84c4418e58d26cf9d2cd5758237756d9f09060ff905b541615610dd55750565b3360009081527f892718e7a1a469066675b5f782493ac861b4f98b3c42b6d42b67d853aabe987b602052604090207fd1473398bb66596de5d1ea1fc8e303ff2ac23265adc9144b1b52065dc4f0934b9060ff906126ad565b3360009081527ff7c9542c591017a21c74b6f3fab6263c7952fc0aaf9db4c22a2a04ddc7f8674f602052604090207f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9060ff906126ad565b3360009081527f6e98dd9cebd68294c714043e0bade2c9294a848cd8241ee0a4ddd32338d6eab2602052604090207f59ca4ce6e783b097a9f11fb884d7979754b2eaecccdca81c43de092ef5d947939060ff906126ad565b3360009081527fee6598bb9d8813ec5dcf0988fbc9935f3bd23c22de3e37b2654f2216372e6c08602052604090207f7fee0d6ae731e4c26a7bffbf1bb702cb3aaa110506f5b2a78cc9372669d439ae9060ff906126ad565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff161561285057565b60405163e2517d3f60e01b815233600482015260006024820152604490fd5b600081815260208181526040808320338452909152902060ff906126ad565b6000818152602081815260408083206001600160a01b038616845290915281205490919060ff1661291957808252602082815260408084206001600160a01b038616600090815292529020805460ff1916600117905533926001600160a01b0316917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b50905090565b6000818152602081815260408083206001600160a01b038616845290915281205490919060ff161561291957808252602082815260408084206001600160a01b038616600090815292529020805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116129d157604052565b6129a8565b608081019081106001600160401b038211176129d157604052565b90601f801991011681019081106001600160401b038211176129d157604052565b908160609103126105a65780519160406020830151612a308161075d565b9201516107d38161075d565b6040513d6000823e3d90fd5b60405162d95ee360e11b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116917f00000000000000000000000000000000000000000000000000000000000000006060826004818987165afa918286918794612bbc575b50612ae057604051634d5f621960e11b81526001600160a01b0388166004820152602490fd5b91955092939192907f1a9b62a15bc4bd4cb012dce03cb7343dc9dd85217e50217a1a61dafcaa4318308101612b7c575082811683831603612b535750508190831603612b2a575050565b6040516373f79df560e11b81526001600160a01b03918216600482015291166024820152604490fd5b60405163ab06191360e01b81526001600160a01b03918216600482015291166024820152604490fd5b6040516365ee57cf60e01b81527fe5649d5ea43b42b34fed231fc348cbc236227ade81afde85e59e250355bce7d060048201526024810191909152604490fd5b91509250612be291955060603d8111612bed575b612bda81836129f1565b810190612a12565b959190959238612aba565b503d612bd0565b908160209103126105a6575190565b9060018201809211612c1157565b612090565b91908201809211612c1157565b60405163700af38360e11b81526020906001600160a01b039082816004817f000000000000000000000000000000000000000000000000000000000000000086165afa908115610a5557600091612cf0575b506040516370a0823160e01b8152306004820152918390839060249082907f0000000000000000000000000000000000000000000000000000000000000000165afa918215610a55576107d393600093612cd1575b5050612c16565b612ce8929350803d10610ae057610ad181836129f1565b903880612cca565b612d079150833d8511610ae057610ad181836129f1565b38612c75565b600019810191908211612c1157565b91908203918211612c1157565b60ff60025416612d9b57612d3b614511565b50505115612d9b57612d53612d4e61318d565b6131d0565b8015612d9557600554908115612d8857612d6b612c23565b80831115612d8d578203918211612c115780821015612d88575090565b905090565b505050600090565b50600090565b600090565b612da8612d29565b8015612d955760405163ef8b30f760e01b815260048101919091526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610a5557600091612e07575090565b6107d3915060203d8111610ae057610ad181836129f1565b60ff60025416612d9557612e38612e34612fa5565b1590565b612d95576040516370a0823160e01b81526001600160a01b0391821660048201526020917f0000000000000000000000000000000000000000000000000000000000000000168282602481845afa918215610a5557600092612f1e575b508115612d8d5760405163266d6a8360e11b815260048101929092528290829060249082905afa918215610a5557600092612f01575b50508015612d9557612edb613d62565b8015612efa57600854612eed91612fb5565b9080821015612d88575090565b5050600090565b612f179250803d10610ae057610ad181836129f1565b3880612ecb565b612f36919250833d8511610ae057610ad181836129f1565b9038612e95565b612f4690612e1f565b8015612d9557604051630a28a47760e01b815260048101919091526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610a5557600091612e07575090565b612fad6143be565b505051151590565b908115612efa578015612feb57620f4240811015612efa57612fd79082612fef565b81811015612efa578103908111612c115790565b5090565b9081158015613011575b612efa57620f4240811015612feb576107d39161303e565b508015612ff9565b634e487b7160e01b600052601260045260246000fd5b8115613039570490565b613019565b90600019818309818302918280831092039180830392146130af57620f4240908282111561309c577fde8f6cefed634549b62c77574f722e1ac57e23f24d8fd5cb790fb65668c26139940990828211900360fa1b910360061c170290565b634e487b7160005260116020526024601cfd5b5050620f424091500490565b906130c582613155565b9190928315613138578382111561312b57620f424082910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b5015600302601118613144565b50906107d3925061302f565b634e487b716000526020526024601cfd5b620f42406000198183099102908180821091030391565b8051156116795760200190565b80518210156116795760209160051b010190565b613195614511565b908251156131be576131a692614a81565b5080511561167957602001516001600160a01b031690565b6040516354d0492760e01b8152600490fd5b6001600160a01b0390808216908115612d8d576001600160a01b0316600090815260096020526040902061321090612558905b546001600160a01b031690565b15612efa5760405163402d267d60e01b81527f0000000000000000000000000000000000000000000000000000000000000000929092166001600160a01b03166004830152602090829081806024810103915afa60009181613279575b506107d3575060001990565b61329291925060203d8111610ae057610ad181836129f1565b903861326d565b60ff600254166132a557565b60405163d93c066560e01b8152600490fd5b6002600154146132c8576002600155565b604051633ee5aeb560e01b8152600490fd5b600554801561332b576132eb612c23565b91808301808411612c1157821061330157505050565b604051634b98504560e01b8152600481019290925260248201929092526044810191909152606490fd5b5050565b60405190606082018281106001600160401b038211176129d157604052565b6001600160401b0381116129d15760051b60200190565b60405190604082018281106001600160401b038211176129d1576040526001825260203681840137565b604051602081018181106001600160401b038211176129d15760405260008152906000368137565b906133c18261334e565b6133ce60405191826129f1565b82815280926133df601f199161334e565b0190602036910137565b93929161157f906134046040936060885260608801906114d4565b908682036020880152611511565b9061341b61318d565b916134268184613db7565b5061342f613365565b613437613365565b90805115611679576001600160a01b03851660208201528151156116795761348c837f532f13a056b54c036d5c3fc8feef04beb2a99aa9aac9dfc1ae768acbb52a1153946020850152604051938493846133e9565b0390a1565b909392916001600160a01b0380861691908215610be7578115613628576134c16134ba836136cf565b9283613f90565b916134ce60085484612fef565b976134d98985612d1c565b96808810613607578088116135c6575b509061353a8784937f29fadedc9c067ceeb57f3d2497d942790271fb6e607c73874532f99031c1f0d8957f000000000000000000000000000000000000000000000000000000000000000016613637565b7fb935df7c8ec5ab928816ed97360488365f862650eeaf5f9f96c9fc6897fb134b613563613365565b61356b613365565b90613588846135798361316c565b6001600160a01b039091169052565b866135928361316c565b526135a387604051938493846133e9565b0390a1604080519485526020850188905284018990528116941691606090a49190565b986135fc61353a91610a698c7f29fadedc9c067ceeb57f3d2497d942790271fb6e607c73874532f99031c1f0d89796959b612d1c565b9997919293506134e9565b604051631f5c25a360e01b8152600481019190915260248101889052604490fd5b50505050509050600090600090565b60405163a9059cbb60e01b60208201526001600160a01b039290921660248301526044808301939093529181526106aa916136736064836129f1565b906000602091828151910182855af115612a3c576000513d6136c657506001600160a01b0381163b155b6136a45750565b604051635274afe760e01b81526001600160a01b039091166004820152602490fd5b6001141561369d565b6136d76143be565b82919251156131be576136ec92825192614c25565b509081519160005b83811061370d57604051636cdaa7bb60e01b8152600490fd5b6001600160a01b0361371f8284613179565b511661372b8482613e8f565b61373857506001016136f4565b935050505090565b91908110156116795760051b0190565b356107d38161075d565b91908082526020809201929160005b828110613777575050505090565b909192938280600192873561378b8161075d565b848060a01b03168152019501910192919092613769565b95949391906137b99160608852606088019161375a565b8581036020870152818152916001600160fb1b0382116105a65760409260209260051b8092848301370101930152565b51600381101561065b5790565b94939261340461157f9260409460608952606089019161375a565b80158015613892575b612d8857620f42409081831015612d8d57828203828111612c115761383f81836130bb565b9284811461303957820915158201809211612c1157819282613862575b50505090565b6138749061386f84612d0d565b612fb5565b1015613882575b808061385c565b61388c9150612d0d565b3861387b565b50811561381a565b600e546138af906001600160a01b03166138d1565b50565b60ff60025416156138bf57565b604051638dfc202b60e01b8152600490fd5b6001600160a01b0381161561396257604051600080928192368382378036810184815203915af43d15613959573d6001600160401b0381116129d15760405190613925601f8201601f1916602001836129f1565b8152809260203d92013e5b156139385790565b80511561394757602081519101fd5b604051633badd6bb60e21b8152600490fd5b60609150613930565b6040516303bca7b760e01b8152600490fd5b6040516370a0823160e01b8152306004820152906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602083602481845afa928315610a5557600093613aa5575b508215613a9c576139f2906139e16007548561303e565b9384918280613a8a575b5050612d1c565b8015613a4357613a0c613a03612c23565b610dc683613412565b604080518281526020810185905233917ffb024939c95e49083f2b22887a9c2d0ca4169bbecca9b2a86015ae5a1635832c91a29190565b506040517ffb024939c95e49083f2b22887a9c2d0ca4169bbecca9b2a86015ae5a1635832c339180613a818682919060206040840193600081520152565b0390a260009190565b613a95913390613637565b38826139eb565b50600091508190565b613abe91935060203d8111610ae057610ad181836129f1565b91386139ca565b908160209103126105a657516107d38161075d565b6040516303e21fa960e61b8082526020916001600160a01b03919083816004817f000000000000000000000000000000000000000000000000000000000000000087165afa908115610a5557600091613c7e575b5082163014908115613c05575b50613bf3576040516370a0823160e01b81523060048201527f000000000000000000000000000000000000000000000000000000000000000091909116908281602481855afa928315610a5557600093613bd4575b5050811561332b5781613ba4913390613637565b60405190815233907fbcfefe84ba8a2b4c5faac95ab797de36a7713daeb84f03c100d3f27383d48abf90602090a2565b613beb929350803d10610ae057610ad181836129f1565b903880613b90565b60405163079489e760e11b8152600490fd5b90506040519081528281600481857f0000000000000000000000000000000000000000000000000000000000000000165afa908115610a5557600091613c51575b508116301438613b3b565b613c719150833d8511613c77575b613c6981836129f1565b810190613ac5565b38613c46565b503d613c5f565b613c959150843d8611613c7757613c6981836129f1565b38613b2e565b60405190613ca8826129d6565b60006060838281528260208201528260408201520152565b90604051613ccd816129d6565b60ff6003829460018060a01b0380825416855260018201541660208501526002810154604085015201541690600382101561065b5760600152565b613d10613c9b565b506001600160a01b03166000818152600d602052604090205460ff1615613d4a57600052600c6020526107d36106e260406000205461163f565b6024906040519063c02219d960e01b82526004820152fd5b600090613d6d6143be565b505080519060005b828110613d8157505050565b613d9d6001600160a01b03613d968385613179565b51166146be565b858111613dae575b50600101613d75565b94506001613da5565b919091613dc860606113b383613d08565b600381101561065b57613e6d576001600160a01b038181166000908152600960205260409020549093908416918215613e53576107d3939450613e0a81614984565b927f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000615206565b60405163dfc24d3d60e01b81529085166004820152602490fd5b604051630f6762e560e01b81526001600160a01b039091166004820152602490fd5b908015613f8957604051630a28a47760e01b815260048101919091526020916001600160a01b039081168383602481845afa60009381613f6a575b50613ed85750505050600090565b8215613f61576040516370a0823160e01b81527f0000000000000000000000000000000000000000000000000000000000000000929092166001600160a01b031660048301528390829081806024810103915afa928315610a5557600093613f42575b5050111590565b613f59929350803d10610ae057610ad181836129f1565b903880613f3b565b50505050600090565b613f82919450853d8711610ae057610ad181836129f1565b9238613eca565b5050600190565b613fa9612e34613fa460606113b385613d08565b614697565b614180576001600160a01b0381166000908152600960205260409020613fce90613203565b6001600160a01b03908082161561415f57604051630a28a47760e01b815260048101859052828416926020908183602481885afa928315610a5557600093614140575b50821561411f576040516370a0823160e01b81527f00000000000000000000000000000000000000000000000000000000000000009182166001600160a01b0316600482015290948290829060249082905afa918215610a5557600092614102575b505081116140f0576140b09261408885614984565b92857f0000000000000000000000000000000000000000000000000000000000000000615755565b918083106140bd57505090565b604051636f85e6ff60e11b81526001600160a01b0392909216600483015260248201929092526044810191909152606490fd5b604051636cdaa7bb60e01b8152600490fd5b6141189250803d10610ae057610ad181836129f1565b3880614073565b6040516352e4307960e11b81526001600160a01b0387166004820152602490fd5b614158919350823d8411610ae057610ad181836129f1565b9138614011565b60405163dfc24d3d60e01b81526001600160a01b0384166004820152602490fd5b604051630f6762e560e01b81526001600160a01b03919091166004820152602490fd5b6000939291845b8181106141b75750505050565b6141c18185613179565b51806141d1575b506001016141aa565b6141f2906141e38385879a959a613740565b356141ed8161075d565b613f90565b8101809111612c11579460016141c8565b60009493859290835b82811061421b57505050505050565b614226818388613740565b3580614236575b5060010161420c565b6142448285879b949b613740565b359061424f8261075d565b614263612e34613fa460606113b386613d08565b61439d576001600160a01b038216600090815260096020526040902061428890613203565b6001600160a01b03908082161561437c577f000000000000000000000000000000000000000000000000000000000000000091604080516370a0823160e01b8152602090818160049581806142f0838c168a8301919091602081019260018060a01b03169052565b03918c165afa918215610a55578d9261435f575b505085116143525750509260019492610a699261434b9561432484614984565b937f0000000000000000000000000000000000000000000000000000000000000000615755565b979061422d565b51636cdaa7bb60e01b8152fd5b6143759250803d10610ae057610ad181836129f1565b3880614304565b60405163dfc24d3d60e01b81526001600160a01b0385166004820152602490fd5b604051630f6762e560e01b81526001600160a01b0383166004820152602490fd5b600b54600091825b8281106144c5575082156144a3576143dd836133b7565b926143f06143ea826133b7565b916133b7565b926000805b82811061440d57505050614408906149dd565b509190565b6144196106e28261163f565b61442281614631565b614430575b506001016143f5565b8051614444906001600160a01b031661488e565b15614427578260408261446f8b6135796001979861446989985160018060a01b031690565b92613179565b8051614483906001600160a01b03166146be565b61448d848a613179565b52015161449a828a613179565b52019190614427565b9150506144ae61338f565b6144b661338f565b916144bf61338f565b91929190565b6144d16106e28261163f565b6144da81614631565b6144e8575b506001016143c6565b516144fb906001600160a01b031661488e565b614506575b386144df565b600190930192614500565b600b54600091825b8281106145e5575082156144a357614530836133b7565b9261453d6143ea826133b7565b926000805b82811061455557505050614408906149dd565b6145616106e28261163f565b61456a81614664565b614578575b50600101614542565b805161458c906001600160a01b03166147d4565b1561456f57826040826145b18b6135796001979861446989985160018060a01b031690565b80516145c5906001600160a01b03166146be565b6145cf848a613179565b5201516145dc828a613179565b5201919061456f565b6145f16106e28261163f565b6145fa81614664565b614608575b50600101614519565b5161461b906001600160a01b03166147d4565b614626575b386145ff565b600190930192614620565b6060810151600381101561065b5761464890614697565b15612d9557602001516001600160a01b031615612d9b57600190565b6060810151600381101561065b57612d955760208101516001600160a01b031615612d95576040015115612d9b57600190565b6146a081610651565b80159081156146ad575090565b600291506146ba81610651565b1490565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152909160209182846024818585165afa600094816147b5575b506147215750505050600090565b8315613f61576001600160a01b038216600090815260096020526040902061474890613203565b16928315613f6157604051630147414360e31b81526001600160a01b039290921660048301526024820152918190839060449082905afa918291600093614796575b50506107d35750600090565b6147ad929350803d10610ae057610ad181836129f1565b90388061478a565b6147cd919550843d8611610ae057610ad181836129f1565b9338614713565b6040516278744560e21b81526001600160a01b0391909116906020908181600481865afa9081614871575b5061480b575050600090565b60405163ef8b30f760e01b8152670de0b6b3a7640000600482015291819083908180602481015b03915afa918291600093614852575b505061484d5750600090565b151590565b614869929350803d10610ae057610ad181836129f1565b903880614841565b61488790833d8511610ae057610ad181836129f1565b50386147ff565b6040516278744560e21b81526001600160a01b0391602091908316908281600481855afa9081614967575b506148c657505050600090565b6040516370a0823160e01b81527f0000000000000000000000000000000000000000000000000000000000000000939093166001600160a01b031660048401528183602481845afa928315610a5557600093614948575b508215612d8d5760405163266d6a8360e11b8152600481019390935281908390818060248101614832565b614960919350823d8411610ae057610ad181836129f1565b913861491d565b61497d90843d8611610ae057610ad181836129f1565b50386148b9565b6001600160a01b0316600090815260106020526040902054806149a75750600190565b6000198101908111612c115790565b6000198114612c115760010190565b90620f424091828102928184041490151715612c1157565b90815115614a7157600091825b8151841015614a1757614a0b614a1191614a048685613179565b5190612c16565b936149b6565b926149ea565b9250614a2381516133b7565b9083156144085760005b8151811015614a6b5780614a5686614a51614a4b614a669587613179565b516149c5565b61302f565b614a608286613179565b526149b6565b614a2d565b50509190565b9050614a7b61338f565b90600090565b9291908351815180911490811591614b91575b50610bc357835115614b7f578351916001928311614b6d57614ab591614b9d565b9060008181815b614b37575b505015614ad75750614ad39192614dfb565b9091565b9050614ae1613365565b90614aea613365565b9360005b828110614afc575050509190565b80614b27614b1d614b10614b329486613179565b516001600160a01b031690565b6135798388613179565b80614a608189613179565b614aee565b8451811015614b6857614b4a8186613179565b51614b5e57614b58906149b6565b81614abc565b5090508138614ac1565b614ac1565b60405163229bbef160e01b8152600490fd5b60405163012a9aeb60e31b8152600490fd5b90508251141538614a94565b9190918051835103610bc357614bb381516133b7565b926000805b8351811015614c1f57614bcb8184613179565b51614bd68286613179565b511015614c1057614be78184613179565b5190614bf38186613179565b518203918211612c1157614c0b91614a608289613179565b614bb8565b8082614a60614c0b9389613179565b50505050565b93918451825180911490811591614cf7575b50610bc357845115614b7f578315614ce55784518411614b6d57614c5a91614d03565b91600092835b8151811015614cdc57614c738183613179565b51614c8657614c81906149b6565b614c60565b509091925060015b15614c9d57614ad39293615014565b50614ca7816133b7565b90614cb1816133b7565b9360005b828110614cc3575050509190565b80614b27614b1d614b10614cd79486613179565b614cb5565b50909192614c8e565b604051636eb50e3160e11b8152600490fd5b90508151141538614c37565b91908251815103610bc357614d1883516133b7565b926000805b8251811015614c1f57614d308184613179565b51614d3b8286613179565b511015614d7557614d4c8184613179565b5190614d588186613179565b518203918211612c1157614d7091614a608289613179565b614d1d565b8082614a60614d709389613179565b90614d8e8261334e565b604090614d9d825191826129f1565b8381528093614dae601f199161334e565b0190600092835b838110614dc3575050505050565b81519060608201918083106001600160401b038411176129d15760209284528681528287818301528785830152828601015201614db5565b90614e068251614d84565b9160005b8151811015614e745780614e24614b10614e6f9385613179565b614e2e8286613179565b51614e49614e3a61332f565b6001600160a01b039093168352565b6020820152816040820152614e5e8287613179565b52614e698186613179565b506149b6565b614e0a565b505050906000915b60019283811015614fa5578093602080614e968486613179565b51015182614ea385612c03565b905b614f10575b505050508381614ec193949503614ec857506149b6565b9190614e7c565b614f0990614ed68386613179565b51614ee18287613179565b51614eec8588613179565b52614ef78487613179565b50614f028287613179565b5284613179565b5038614e69565b8551811015614fa0578183614f258389613179565b510151118015614f64575b614f45575b614f3f84916149b6565b90614ea5565b9650508582614f3f83614f588489613179565b51015192915050614f35565b508183614f718389613179565b510151148015614f305750604080614f898389613179565b51015190614f978a89613179565b51015111614f30565b614eaa565b509150614fb0613365565b614fb8613365565b9260005b60018110614fca5750509190565b80614ff6614fec614fde61500f9486613179565b51516001600160a01b031690565b6135798387613179565b60406150028285613179565b510151614a608288613179565b614fbc565b61501e8151614d84565b9360005b8251811015615077578061503c614b106150729386613179565b6150468287613179565b51615052614e3a61332f565b60208201528160408201526150678289613179565b52614e698188613179565b615022565b509291505060005b8181106150de5750615090816133b7565b9061509a816133b7565b9360005b8281106150ac575050509190565b806150c0614b1d614fde6150d99486613179565b60406150cc8285613179565b510151614a608289613179565b61509e565b928392602092836150ef8685613179565b510151916150fc86612c03565b84518110156151895783866151118388613179565b51015111801561514d575b61512f575b61512a906149b6565b6150fc565b965086925061512a856151428587613179565b510151939050615121565b50838661515a8388613179565b51015114801561511c57506040806151728388613179565b510151906151808a88613179565b5101511161511c565b5094915092506151a191948181036151a657506149b6565b61507f565b614f09906151b48388613179565b516151bf8289613179565b516151ca858a613179565b526151d58489613179565b506151e08289613179565b5286613179565b91908260409103126105a657602082516152008161075d565b92015190565b95939194929461521584615d8b565b6001600160a01b039586169661522d888385846155a3565b978783169260409283516314825f4560e31b81528481806152568b600483019190602083019252565b0381895afa9a8b15610a5557600091829c61546a575b5080881691828282160361543857509081866152b46000948616996152928d898d615568565b82516306f81a6b60e41b8152600481018e905295869283919082906024820190565b03925af1978815610a555760009384996153fe575b50856152d49161548b565b8216036153cc575090856152e893926155a3565b916152fc602084015160208b015190612d1c565b9780891061539d575080880361537d575087518251600091818110615376576153259250612d1c565b848103615356575060608861534b87878585966106aa9c9d9e0151908801519089615ad5565b015191015191615b72565b81516306bcaec160e31b8152600481018690526024810191909152604490fd5b5050615325565b8151636232875560e11b8152600481018990526024810191909152604490fd5b8251636f85e6ff60e11b81526001600160a01b0386166004820152602481018a90526044810191909152606490fd5b845163e8eebd3760e01b81526001600160a01b0384811660048301528881166024830152919091166044820152606490fd5b6152d491995086945061542690893d8b11615431575b61541e81836129f1565b8101906151e7565b9490949991506152c9565b503d615414565b865163e8eebd3760e01b81526001600160a01b0386811660048301528a81166024830152919091166044820152606490fd5b909b506154849150853d87116154315761541e81836129f1565b9a3861526c565b60405163095ea7b360e01b60208083018281526001600160a01b03861660248501526000604485018190529295939493909290919085606481015b03936154da601f19958681018952886129f1565b86519082875af16000513d82615543575b5050156154fa575b5050505050565b60405160208101959095526001600160a01b031660248501526000604485015260649081018452615539936136739161553390826129f1565b82613673565b38808080806154f3565b90915061556057506001600160a01b0383163b15155b38806154eb565b600114615559565b60405163095ea7b360e01b60208083018281526001600160a01b038616602485015260448401969096529094919390600085606481016154c6565b93926155ad613c9b565b6040516370a0823160e01b808252306004830152919660209592946001600160a01b039392909187908290602490829088165afa948515610a555761561d958892600091615738575b508a526040519687526001600160a01b031660048701528184169594859081906024820190565b0381885afa938415610a5557600094615719575b508588019484865284615648575b50505050505050565b60405163266d6a8360e11b815260048101959095528690859060249082905afa948515610a55576156b89587956000916156fc575b5060408a81019190915290519051630147414360e31b81526001600160a01b0390921660048301526024820152938492839182906044820190565b0392165afa918215610a55576000926156df575b505060608301523880808080808061563f565b6156f59250803d10610ae057610ad181836129f1565b38806156cc565b6157139150863d8811610ae057610ad181836129f1565b3861567d565b615731919450863d8811610ae057610ad181836129f1565b9238615631565b61574f9150833d8511610ae057610ad181836129f1565b386155f6565b9593949261576284615d8b565b6001600160a01b039081166157798185858b6155a3565b93813b156105a6576040805163989a5e6760e01b81526001600160a01b0386166004820152602481018a9052306044820152909960009990918a8160648183895af18015610a55578b968d93602093615800936158ea575b50818a16946157e1828988615568565b519d8e809481936348b1933560e01b8352600483019190602083019252565b039288165af1998a15610a5557859a6158b8575b50829161582661582b9594889361548b565b6155a3565b80518451919291908181106158b0576158449250612d1c565b925b83968085036158905750831561587f5760608161587487878c6106aa9b9c9d86970151908801519089615c81565b015191015191615d06565b87516347d4543760e01b8152600490fd5b885163794a362960e11b8152600481019190915260248101859052604490fd5b505092615846565b86919a5091615826846158dd61582b97969560203d8111610ae057610ad181836129f1565b9c93505050919293615814565b80610a496158f7926129be565b386157d1565b6040516370a0823160e01b80825230600483015260209391926001600160a01b031691908484602481865afa938415610a5557859287916000966159c4575b509061594a913090866159e9565b60405190815230600482015291829060249082905afa908115610a5557615979936000926159a7575050612d1c565b90808203615985575050565b6040516306bcaec160e31b815260048101919091526024810191909152604490fd5b6159bd9250803d10610ae057610ad181836129f1565b38806139eb565b61594a929196506159e190853d8711610ae057610ad181836129f1565b95909161593c565b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815260a08101918183106001600160401b038411176129d1576106aa92604052613673565b92615a4b81615d8b565b600084831115615ad05750838203828111612c11575b8015918215615aa7575b5050615a7657505050565b60a49350604051926377425d3960e01b84526000600485015260026024850152604484015260648301526084820152fd5b84821092509082615abc575b50503880615a6b565b9091508303838111612c1157113880615ab3565b615a61565b93615adf81615d8b565b600082841115615b6d5750818303838111612c11575b8015918215615b44575b5050615b0b5750505050565b6040516377425d3960e01b81526001600160a01b0390941660048501526000602485015260448401526064830152608482015260a49150fd5b85821092509082615b59575b50503880615aff565b9091508403848111612c1157113880615b50565b615af5565b93615b7c81615d8b565b600082841115615c0a5750818303838111612c11575b8015918215615be1575b5050615ba85750505050565b6040516377425d3960e01b81526001600160a01b0390941660048501526001602485015260448401526064830152608482015260a49150fd5b85821092509082615bf6575b50503880615b9c565b9091508403848111612c1157113880615bed565b615b92565b90615c1983615d8b565b600081831115615c7857508103908111612c1157905b8115159081615c6e575b50615c415750565b60849060405190635fd8a9dd60e01b82526000600483015260026024830152604482015260006064820152fd5b9050811138615c39565b91505090615c2f565b9391615c8c83615d8b565b600081831115615cfd57508103908111612c1157905b8282119081615cea575b50615cb657505050565b604051635fd8a9dd60e01b81526001600160a01b039093166004840152600060248401526044830152606482015260849150fd5b9050828203828111612c11571138615cac565b91505090615ca2565b9391615d1183615d8b565b600081831115615d8257508103908111612c1157905b8282119081615d6f575b50615d3b57505050565b604051635fd8a9dd60e01b81526001600160a01b039093166004840152600160248401526044830152606482015260849150fd5b9050828203828111612c11571138615d31565b91505090615d27565b60108111615d965750565b60249060405190633396879560e11b82526004820152fdfea2646970667358221220178e97810a3dd2e0d7b553bce589809bd2fb980d89bc0420fa1c5ef6a4fdf65264736f6c634300081400332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf020000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe","external_libraries":[],"proxy_type":null,"implementations":[],"verified_at":"2026-09-14T09:43:17.689434Z","is_verified_via_verifier_alliance":false,"compiler_version":"v0.8.20+commit.a1b79de6","decoded_constructor_args":[["0x7CB20517776636eD76b68EdB3D99DCce356ABf02",{"internalType":"address","name":"token","type":"address"}],["0x4aCBcFa29fb085097c5f31783403EF7A7930F6Fe",{"internalType":"address","name":"collateral","type":"address"}]],"sourcify_repo_url":null,"optimization_runs":200,"compiler_settings":{"evmVersion":"paris","libraries":{},"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"":["*"],"*":["*"]}},"viaIR":true},"is_verified":true,"verified_twin_address_hash":null,"optimization_enabled":true,"deployed_bytecode":"0x6080604052600436101561001257600080fd5b60003560e01c8063015d2de81461059657806301ffc9a71461059157806304336bb31461058c5780630489788a1461058757806305b2bfb0146105825780630b19ebb11461057d5780630bece79c146105785780630c345759146105555780630f04b97814610573578063100d0e991461056e57806311b2cd0214610569578063163e4d961461041a57806316d37595146105645780631bbf12241461048d5780631e9998141461055f5780631f0f1398146105325780631fb51daa1461055a578063204d44d114610555578063248a9ca3146105505780632591cfc81461054b578063259a77e114610546578063295891fd146105415780632b0a70321461053c5780632f2ff15d1461053757806334bad3201461053257806336568abe1461052d5780633a0920751461046a5780633ded0000146105285780633f4ba83a14610523578063402d267d1461051e57806341826c2d14610519578063583d50fb14610514578063585cd34b1461050f57806358fdc0551461041a5780635ab33b931461050a5780635c47df42146105055780635c975abb146105005780635e5a24a4146104fb5780636b052c18146104f65780636dacd3d7146104f157806373814cbb146104ec57806374d4e491146104e7578063772447f8146104385780637b1870d6146104e25780637e45f1e1146104dd5780638351812e146104d85780638404c1c1146104d35780638456cb59146104ce5780638562537c146104c957806386651203146104605780638f1ace30146104c457806391d14854146104bf57806392f5491c146104ba578063965a90e6146104b55780639665018a146104b05780639bb9461f146104ab578063a0c7f799146104a6578063a217fddf146104a1578063abbaafb01461049c578063ac1e502514610460578063ad07f2d114610460578063ad8aecc614610497578063b4da09f014610492578063b6783edd1461048d578063bc6d5a1014610488578063c19d91e714610483578063c63d75b61461047e578063c72a3dce14610447578063cabc3a4814610479578063cb4750cb14610460578063cc88bd5d14610474578063cd24728b1461046f578063cd7c75051461046a578063ce96cb7714610465578063ceb68c2314610438578063cf1638ba14610460578063d547741f1461045b578063d80a716314610456578063d905777e14610451578063dbd5edc71461044c578063dc369c6514610447578063dd16dfdc14610442578063de1eb9a31461043d578063df180cd514610438578063e63ab1e914610433578063ebf091f21461042e578063ecd041f114610429578063f00d1ae914610424578063f343cff01461041f578063f575a8fe1461041a578063f9b06b1c146104155763fd6fab8d1461041057600080fd5b612632565b612609565b610d16565b6125da565b6123ee565b6123d0565b6123b4565b612379565b61195f565b612351565b6122d9565b612138565b6122bb565b612294565b61227b565b612239565b611b18565b612212565b61101e565b6121f9565b61216f565b612151565b612112565b6120e1565b6120a6565b610e35565b612051565b612028565b611ffc565b611fe0565b611fa5565b611f7c565b611f5e565b611d1b565b611c2a565b611bd4565b611bb9565b611af1565b611a97565b611a5a565b6119fd565b6119c2565b611983565b611941565b61190f565b6118e8565b6117ec565b6117b1565b61178e565b611749565b61170d565b6116e9565b61167e565b611584565b6114ae565b611457565b61108f565b610fd3565b610e70565b610f91565b610f68565b610f4a565b610f2e565b610efd565b610ece565b610c3e565b610eaa565b610e52565b610df3565b610cf2565b610cb7565b610c5c565b610bf9565b6107d6565b61070a565b6106ac565b61061d565b6105c7565b6105ab565b60009103126105a657565b600080fd5b346105a65760003660031901126105a657602060405160108152f35b346105a65760203660031901126105a65760043563ffffffff60e01b81168091036105a657602090637965db0b60e01b811490811561060c575b506040519015158152f35b6301ffc9a760e01b14905038610601565b346105a65760003660031901126105a6576020600854604051908152f35b634e487b7160e01b600052602160045260246000fd5b6003111561065b57565b61063b565b90600382101561065b5752565b81516001600160a01b03908116825260208084015190911690820152604080830151908201526060918201516080820193926106aa920190610660565b565b346105a65760203660031901126105a6576004356106c8613c9b565b50600b548110156106f8576106e86106e26106f49261163f565b50613cc0565b6040519182918261066d565b0390f35b604051634e23d03560e01b8152600490fd5b346105a65760003660031901126105a6576020610725612c23565b604051908152f35b9181601f840112156105a6578235916001600160401b0383116105a6576020808501948460051b0101116105a657565b6001600160a01b038116036105a657565b60a06003198201126105a6576001600160401b03916004358381116105a6578261079a9160040161072d565b939093926024359182116105a6576107b49160040161072d565b9091604435906064356107c68161075d565b906084356107d38161075d565b90565b346105a6576107e43661076e565b9295939190946107f26132b7565b6107fa613299565b6000926001600160a01b03878116929091908315610be7578015610bd557898103610bc35785978661082b8c6133b7565b93885b8d808210610b70575050508915610b5e5761084b6008548b613811565b818111610ae7575b5050909192809495969798999a507f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf0216998a966108ae60208c60409a8b518080958194630a28a47760e01b8352600483019190602083019252565b03915afa998a15610a555799610ab7575b50808911610a9757506108d0612c23565b946108f16108df8686866141a3565b966108e8612c23565b60115491615c0f565b6108fd60085487612fef565b9b6109088d88612d1c565b9b808d10610a7757808d11610a5a575b50803b156105a6578851630ef1a41b60e11b81523360048201526001600160a01b0384811660248301529b909b1660448c015260648b018c905260848b018a90528a60a4815a6000948591f1948515610a55576109c88c6109d39489946106f49e7fb935df7c8ec5ab928816ed97360488365f862650eeaf5f9f96c9fc6897fb134b9a610a3c575b507f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca23616613637565b8851948594856137f6565b0390a1825190815260208101869052604081018790526060810184905233907fa191992edf1e50e292cf5996aae0dc5fc118dd8377c887fd047a8e6b6444fe5890608090a3610a2160018055565b51938493846040919493926060820195825260208201520152565b80610a49610a4f926129be565b8061059b565b386109a0565b612a3c565b9c610a698e610a6f939e612d1c565b90612c16565b9b9a38610918565b8951631f5c25a360e01b81526004810191909152602481018d9052604490fd5b875163f6ee017160e01b8152600481018a90526024810191909152604490fd5b610ad991995060203d8111610ae0575b610ad181836129f1565b810190612bf4565b97386108bf565b503d610ac7565b90610af191612d1c565b9a805b610aff575b80610853565b610b0881612d0d565b610b128186613179565b51610b2257506000190180610af4565b9192939495969798999a9b610b4d9150610b4690610b408488613179565b51612c16565b9185613179565b529089989796959493929138610af9565b60405163162908e360e11b8152600490fd5b610b7e82610b869285613740565b35809d612c16565b9b80610b96575b5060010161082e565b60019193610baa610bbc9260085490613811565b9081610bb6878b613179565b52612c16565b9290610b8d565b60405163512509d360e11b8152600490fd5b60405163a600c81d60e01b8152600490fd5b60405163220a42fb60e11b8152600490fd5b346105a65760003660031901126105a6576040517f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe6001600160a01b03168152602090f35b346105a65760003660031901126105a6576020600654604051908152f35b346105a65760203660031901126105a6576001600160401b036004358181116105a657366023820112156105a65780600401359182116105a657602490369260071b0101116105a657610cad6126b7565b610cb561389a565b005b346105a65760003660031901126105a65760206040517f59ca4ce6e783b097a9f11fb884d7979754b2eaecccdca81c43de092ef5d947938152f35b346105a65760203660031901126105a657610d0e60043561075d565b610cad612659565b346105a65760803660031901126105a657610d3260043561075d565b610d3d60243561075d565b3360009081527f558dbed4104813a007d4614c5b743b91381b1a980614ba356594057f2c67b8ce60205260409020547fcf2f6d4b287b5b3ebfc9620610a356b6fff07ad64add1cd9a07a3a9f3d45f50c9060ff1615610dd557610d9e6132b7565b610da6613299565b610dcf610db1612c23565b600f54610dc6906001600160a01b03166138d1565b506108e8612c23565b60018055005b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b346105a65760203660031901126105a657600435610e108161075d565b60018060a01b0316600052600d602052602060ff604060002054166040519015158152f35b346105a65760003660031901126105a65760206040516127108152f35b346105a65760003660031901126105a6576020600354604051908152f35b346105a65760803660031901126105a657610e8c60043561075d565b610e9760243561075d565b600360643510156105a657610cad6126b7565b346105a65760203660031901126105a657610ec660043561075d565b610cad61270f565b346105a65760203660031901126105a65760043560005260006020526020600160406000200154604051908152f35b346105a65760203660031901126105a6576020610f24600435610f1f8161075d565b61488e565b6040519015158152f35b346105a65760003660031901126105a657602060405160038152f35b346105a65760003660031901126105a6576020600454604051908152f35b346105a65760003660031901126105a657600e546040516001600160a01b039091168152602090f35b346105a65760403660031901126105a657610cb5602435600435610fb48261075d565b806000526000602052610fce60016040600020015461286f565b61288e565b346105a65760403660031901126105a657602435610ff08161075d565b336001600160a01b0382160361100c57610cb59060043561291f565b60405163334bd91960e11b8152600490fd5b346105a65760803660031901126105a657610cad6126b7565b60806003198201126105a6576001600160401b03916004358381116105a657826110639160040161072d565b939093926024359182116105a65761107d9160040161072d565b9091604435906064356107d38161075d565b346105a65761109d36611037565b6110aa95929491956132b7565b6110b2613299565b6001600160a01b03818116939092908415610be7578115610bd557868203610bc3576110dd826133b7565b92600094855b84811061137957508515610b5e5785906110fc826132da565b7f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf02169860409889519b63ef8b30f760e01b8d5260208d8d81806111486004998a83019190602083019252565b03915afa9c8d15610a555760009d611359575b50808d10611335575061116c612c23565b9161119889337f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca2366158fd565b60005b8781106112ad575050506111bb90876111b2612c23565b60115492615a41565b883b156105a65787516325b4f06160e11b8152339181019182526001600160a01b03909216602082015260408101869052606081018a90529098976000918a919082908490829060800103925af1978815610a5557847f532f13a056b54c036d5c3fc8feef04beb2a99aa9aac9dfc1ae768acbb52a11539461124c926106f49b61129a575b508851948594856137f6565b0390a182519081526020810184905233907fd1b7862c3523b3d49407e56072f1ef23224f9c1afaf15b3726ef601fa8bc292390604090a361128c60018055565b519081529081906020820190565b80610a496112a7926129be565b38611240565b6112b8818385613740565b35806112c8575b5060010161119b565b6112db6112d6838b8b613740565b613750565b906112f06112e9848d613179565b5183613db7565b908082106112ff5750506112bf565b8e5163a77b078360e01b81526001600160a01b039093168389019081526020810191909152604081019190915281906060010390fd5b8a5163d6781d5760e01b81528085018e815260208101929092529081906040010390fd5b611372919d5060203d8111610ae057610ad181836129f1565b9b3861115b565b611384818b8b613740565b3580611394575b506001016110e3565b90966113a46112d6898888613740565b916113b960606113b385613d08565b016137e9565b6113c281610651565b6114365760405163b3d7f6b960e01b81526004810191909152916020919082908490602490829088165afa908115610a555760019361141093600093611417575b505081610bb68b8b613179565b969061138b565b61142e929350803d10610ae057610ad181836129f1565b903880611403565b604051630f6762e560e01b81526001600160a01b0384166004820152602490fd5b346105a65760003660031901126105a65761147061270f565b6114786138b2565b60ff19600254166002557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b346105a65760203660031901126105a6576114ca60043561075d565b6020610725612d29565b90815180825260208080930193019160005b8281106114f4575050505090565b83516001600160a01b0316855293810193928101926001016114e6565b90815180825260208080930193019160005b828110611531575050505090565b835185529381019392810192600101611523565b94939261157160609361156361157f9460808a5260808a01906114d4565b9088820360208a0152611511565b908682036040880152611511565b930152565b346105a65760003660031901126105a657600b546115a1816133b7565b6115aa826133b7565b6115b3836133b7565b9260005b8181106115da5750506115cc6106f4916149dd565b909360405194859485611545565b8060406115eb6106e260019461163f565b61160b848060a01b0380835116611602868b613179565b528251166146be565b6116158488613179565b5201516116228288613179565b52016115b7565b634e487b7160e01b600052603260045260246000fd5b600b5481101561167957600b60005260021b7f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90190600090565b611629565b346105a65760203660031901126105a657600435600b548110156105a6576116a760809161163f565b506116e760018060a01b039182815416926001820154169060ff600360028301549201541691604051948552602085015260408401526060830190610660565bf35b346105a65760203660031901126105a65761170560043561075d565b610cad612767565b346105a65760203660031901126105a65761172960043561075d565b611731612767565b6117396132b7565b6117416138b2565b610dcf61389a565b346105a65760003660031901126105a6576040517f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf026001600160a01b03168152602090f35b346105a65760003660031901126105a657602060ff600254166040519015158152f35b346105a65760003660031901126105a65760206040517fd1473398bb66596de5d1ea1fc8e303ff2ac23265adc9144b1b52065dc4f0934b8152f35b346105a65760203660031901126105a6576004356118086132b7565b611810613299565b8015610b5e5761181f816132da565b600a546001600160a01b03168080156118d65761183a612c23565b9261186681337f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca2366158fd565b61187d6118738285613db7565b94826111b2612c23565b604080519182526020820185905233917f4d0f99bc1f9d877fc67b25fe12c1e39507c59109af5d41eb83334678deb457e69190a36118ba60018055565b604080516001600160a01b039290921682526020820192909252f35b604051633a65e22f60e01b8152600490fd5b346105a65760403660031901126105a65761190460043561075d565b61170560243561075d565b346105a65760003660031901126105a6576106f461192b6143be565b50506040519182916020835260208301906114d4565b346105a65760003660031901126105a6576020600b54604051908152f35b346105a65760203660031901126105a65761197b60043561075d565b610cad6126b7565b346105a65760003660031901126105a65761199c6132b7565b6119a4613299565b6119ac613974565b6001805560408051928352602083019190915290f35b346105a65760003660031901126105a65760206040517fcf2f6d4b287b5b3ebfc9620610a356b6fff07ad64add1cd9a07a3a9f3d45f50c8152f35b346105a65760a03660031901126105a6576119ac600435611a1d8161075d565b60243590611a2a8261075d565b611a3560443561075d565b611a3d6127bf565b611a456132b7565b611a4d613299565b6084359160643591613491565b346105a65760203660031901126105a657600435611a778161075d565b60018060a01b0316600052600c6020526020604060002054604051908152f35b346105a65760003660031901126105a657611ab061270f565b611ab8613299565b600160ff1960025416176002557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346105a65760203660031901126105a6576020610f24600435611b138161075d565b6147d4565b346105a65760203660031901126105a6576001600160a01b03337f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf028216141580611b80575b611b6e57610cb590600e54166138d1565b60405163753a613d60e01b8152600490fd5b503360009081527f1a98536394a89bde21c352fe1c1076b59f564e1e17e1afe0b735e553ce9ce044602052604090205460ff1615611b5d565b346105a65760003660031901126105a6576020610725613d62565b346105a65760403660031901126105a657602060ff611c1e602435611bf88161075d565b6004356000526000845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b346105a65760803660031901126105a657600435611c478161075d565b606435602435611c568261075d565b611c5e6127bf565b611c666132b7565b611c6e613299565b6001600160a01b03918216918215610be7578115610b5e577f65de205f6d75275ee9af2a4c295a8327d0af9970af2db8dd0f9c2d8974c15e7a90611cb1836132da565b611cb9612c23565b611ce484337f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca2366158fd565b611cfa611cf085613412565b91856111b2612c23565b6040805194855260443560208601529082169590911692a4610cb560018055565b346105a657611d2936611037565b92611d389592959491946132b7565b611d40613299565b6001600160a01b03848116939092908415610be7578115610bd557878203610bc357600093845b898110611f3e57508415610b5e57611d7e856132da565b6040805163ef8b30f760e01b815260048101879052989097917f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf02169060208a602481855afa998a15610a555760009a611f1e575b50808a10611efe5750611de3612c23565b611e0e87337f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca2366158fd565b60005b8b868210611ec4575050611e2890876111b2612c23565b803b156105a65787516325b4f06160e11b81523360048201526001600160a01b0392909216602483015260448201869052606482018990526000908290608490829084905af18015610a55576106f4997f532f13a056b54c036d5c3fc8feef04beb2a99aa9aac9dfc1ae768acbb52a11539561124c938893611eb1575b508951958695866137a2565b80610a49611ebe926129be565b38611ea5565b90611ed2816001938a613740565b3580611ee0575b5001611e11565b611ef790611ef26112d6848b8b613740565b613db7565b5038611ed9565b885163d6781d5760e01b8152600481018b90526024810191909152604490fd5b611f37919a5060203d8111610ae057610ad181836129f1565b9838611dd2565b94611f57600191611f50888d89613740565b3590612c16565b9501611d67565b346105a65760003660031901126105a6576020601154604051908152f35b346105a65760203660031901126105a657611f95612817565b611f9d6132b7565b611741613299565b346105a65760003660031901126105a65760206040517fbbfb55d933c2bfa638763473275b1d84c4418e58d26cf9d2cd5758237756d9f08152f35b346105a65760003660031901126105a657602060405160008152f35b346105a65760403660031901126105a65761201860043561075d565b612020612659565b610cad6138b2565b346105a65760003660031901126105a657600a546040516001600160a01b039091168152602090f35b346105a65760203660031901126105a65760206004356120708161075d565b60018060a01b038091166000526009825260406000205416604051908152f35b634e487b7160e01b600052601160045260246000fd5b346105a65760003660031901126105a65760206040517f7fee0d6ae731e4c26a7bffbf1bb702cb3aaa110506f5b2a78cc9372669d439ae8152f35b346105a65760003660031901126105a6576120fa612817565b6121026132b7565b61210a6138b2565b610dcf613ada565b346105a65760203660031901126105a65761212e60043561075d565b6020610725612da0565b346105a65760203660031901126105a657610cad612659565b346105a65760003660031901126105a6576020600754604051908152f35b346105a65760203660031901126105a65760043561218c8161075d565b612194612817565b6001600160a01b0381169081156121e7576121ae90612a48565b600f80546001600160a01b031916821790557fbeef3b5508060a5c16820fa912c3580a296e5c9998cab97ec8999d823590ee74600080a2005b60405163d92e233d60e01b8152600490fd5b346105a65760003660031901126105a657610cad612659565b346105a65760203660031901126105a65760206107256004356122348161075d565b612e1f565b346105a65760403660031901126105a657610cb560243560043561225c8261075d565b80600052600060205261227660016040600020015461286f565b61291f565b346105a65760203660031901126105a657612020612659565b346105a65760203660031901126105a65760206107256004356122b68161075d565b612f3d565b346105a65760003660031901126105a6576020600554604051908152f35b346105a65760203660031901126105a6576004356122f68161075d565b6122fe612817565b6001600160a01b0381169081156121e75761231890612a48565b600e80546001600160a01b031916821790557f4cf0b78387d5b4cad8a97c3daee2b7106997db0ae19cf71c1054d53275fb1027600080a2005b346105a65760203660031901126105a6576106f46106e86004356123748161075d565b613d08565b346105a65760003660031901126105a65760206040517f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a8152f35b346105a65760003660031901126105a6576106f461192b614511565b346105a65760003660031901126105a657602060405162030d408152f35b346105a6576123fc3661076e565b9361240a96919395966132b7565b612412613299565b6001600160a01b0396600094888116939091908415610be7578115610bd557888203610bc357612441826133b7565b92879a885b84811061252257508b15610b5e5761246360209c60085490612fb5565b9a8b986124b1837f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf02169e8f9b60409c8d518080958194630a28a47760e01b8352600483019190602083019252565b03915afa9b8c15610a55579b612502575b50808b116124e257506108df6108f1916124da612c23565b988787614203565b895163f6ee017160e01b8152600481018c90526024810191909152604490fd5b61251b919b5060203d8111610ae057610ad181836129f1565b99386124c2565b61252d818d89613740565b358061253d575b50600101612446565b909c612589906125648f6125586112d6612558928b8b613740565b6001600160a01b031690565b92604051809463266d6a8360e11b825281806020968795600483019190602083019252565b03915afa908115610a55578f6001946125b0948f946125b7575b5050610bb683918b613179565b9c90612534565b610bb6945090816125d392903d10610ae057610ad181836129f1565b92386125a3565b346105a65760403660031901126105a6576125f660043561075d565b600360243510156105a657610cad6126b7565b346105a65760003660031901126105a657600f546040516001600160a01b039091168152602090f35b346105a65760203660031901126105a65760206107256004356126548161075d565b614984565b3360009081527f1a98536394a89bde21c352fe1c1076b59f564e1e17e1afe0b735e553ce9ce044602052604090207fbbfb55d933c2bfa638763473275b1d84c4418e58d26cf9d2cd5758237756d9f09060ff905b541615610dd55750565b3360009081527f892718e7a1a469066675b5f782493ac861b4f98b3c42b6d42b67d853aabe987b602052604090207fd1473398bb66596de5d1ea1fc8e303ff2ac23265adc9144b1b52065dc4f0934b9060ff906126ad565b3360009081527ff7c9542c591017a21c74b6f3fab6263c7952fc0aaf9db4c22a2a04ddc7f8674f602052604090207f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9060ff906126ad565b3360009081527f6e98dd9cebd68294c714043e0bade2c9294a848cd8241ee0a4ddd32338d6eab2602052604090207f59ca4ce6e783b097a9f11fb884d7979754b2eaecccdca81c43de092ef5d947939060ff906126ad565b3360009081527fee6598bb9d8813ec5dcf0988fbc9935f3bd23c22de3e37b2654f2216372e6c08602052604090207f7fee0d6ae731e4c26a7bffbf1bb702cb3aaa110506f5b2a78cc9372669d439ae9060ff906126ad565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff161561285057565b60405163e2517d3f60e01b815233600482015260006024820152604490fd5b600081815260208181526040808320338452909152902060ff906126ad565b6000818152602081815260408083206001600160a01b038616845290915281205490919060ff1661291957808252602082815260408084206001600160a01b038616600090815292529020805460ff1916600117905533926001600160a01b0316917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b50905090565b6000818152602081815260408083206001600160a01b038616845290915281205490919060ff161561291957808252602082815260408084206001600160a01b038616600090815292529020805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116129d157604052565b6129a8565b608081019081106001600160401b038211176129d157604052565b90601f801991011681019081106001600160401b038211176129d157604052565b908160609103126105a65780519160406020830151612a308161075d565b9201516107d38161075d565b6040513d6000823e3d90fd5b60405162d95ee360e11b81526000906001600160a01b037f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe8116917f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf026060826004818987165afa918286918794612bbc575b50612ae057604051634d5f621960e11b81526001600160a01b0388166004820152602490fd5b91955092939192907f1a9b62a15bc4bd4cb012dce03cb7343dc9dd85217e50217a1a61dafcaa4318308101612b7c575082811683831603612b535750508190831603612b2a575050565b6040516373f79df560e11b81526001600160a01b03918216600482015291166024820152604490fd5b60405163ab06191360e01b81526001600160a01b03918216600482015291166024820152604490fd5b6040516365ee57cf60e01b81527fe5649d5ea43b42b34fed231fc348cbc236227ade81afde85e59e250355bce7d060048201526024810191909152604490fd5b91509250612be291955060603d8111612bed575b612bda81836129f1565b810190612a12565b959190959238612aba565b503d612bd0565b908160209103126105a6575190565b9060018201809211612c1157565b612090565b91908201809211612c1157565b60405163700af38360e11b81526020906001600160a01b039082816004817f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe86165afa908115610a5557600091612cf0575b506040516370a0823160e01b8152306004820152918390839060249082907f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca236165afa918215610a55576107d393600093612cd1575b5050612c16565b612ce8929350803d10610ae057610ad181836129f1565b903880612cca565b612d079150833d8511610ae057610ad181836129f1565b38612c75565b600019810191908211612c1157565b91908203918211612c1157565b60ff60025416612d9b57612d3b614511565b50505115612d9b57612d53612d4e61318d565b6131d0565b8015612d9557600554908115612d8857612d6b612c23565b80831115612d8d578203918211612c115780821015612d88575090565b905090565b505050600090565b50600090565b600090565b612da8612d29565b8015612d955760405163ef8b30f760e01b815260048101919091526020816024817f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf026001600160a01b03165afa908115610a5557600091612e07575090565b6107d3915060203d8111610ae057610ad181836129f1565b60ff60025416612d9557612e38612e34612fa5565b1590565b612d95576040516370a0823160e01b81526001600160a01b0391821660048201526020917f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf02168282602481845afa918215610a5557600092612f1e575b508115612d8d5760405163266d6a8360e11b815260048101929092528290829060249082905afa918215610a5557600092612f01575b50508015612d9557612edb613d62565b8015612efa57600854612eed91612fb5565b9080821015612d88575090565b5050600090565b612f179250803d10610ae057610ad181836129f1565b3880612ecb565b612f36919250833d8511610ae057610ad181836129f1565b9038612e95565b612f4690612e1f565b8015612d9557604051630a28a47760e01b815260048101919091526020816024817f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf026001600160a01b03165afa908115610a5557600091612e07575090565b612fad6143be565b505051151590565b908115612efa578015612feb57620f4240811015612efa57612fd79082612fef565b81811015612efa578103908111612c115790565b5090565b9081158015613011575b612efa57620f4240811015612feb576107d39161303e565b508015612ff9565b634e487b7160e01b600052601260045260246000fd5b8115613039570490565b613019565b90600019818309818302918280831092039180830392146130af57620f4240908282111561309c577fde8f6cefed634549b62c77574f722e1ac57e23f24d8fd5cb790fb65668c26139940990828211900360fa1b910360061c170290565b634e487b7160005260116020526024601cfd5b5050620f424091500490565b906130c582613155565b9190928315613138578382111561312b57620f424082910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b5015600302601118613144565b50906107d3925061302f565b634e487b716000526020526024601cfd5b620f42406000198183099102908180821091030391565b8051156116795760200190565b80518210156116795760209160051b010190565b613195614511565b908251156131be576131a692614a81565b5080511561167957602001516001600160a01b031690565b6040516354d0492760e01b8152600490fd5b6001600160a01b0390808216908115612d8d576001600160a01b0316600090815260096020526040902061321090612558905b546001600160a01b031690565b15612efa5760405163402d267d60e01b81527f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe929092166001600160a01b03166004830152602090829081806024810103915afa60009181613279575b506107d3575060001990565b61329291925060203d8111610ae057610ad181836129f1565b903861326d565b60ff600254166132a557565b60405163d93c066560e01b8152600490fd5b6002600154146132c8576002600155565b604051633ee5aeb560e01b8152600490fd5b600554801561332b576132eb612c23565b91808301808411612c1157821061330157505050565b604051634b98504560e01b8152600481019290925260248201929092526044810191909152606490fd5b5050565b60405190606082018281106001600160401b038211176129d157604052565b6001600160401b0381116129d15760051b60200190565b60405190604082018281106001600160401b038211176129d1576040526001825260203681840137565b604051602081018181106001600160401b038211176129d15760405260008152906000368137565b906133c18261334e565b6133ce60405191826129f1565b82815280926133df601f199161334e565b0190602036910137565b93929161157f906134046040936060885260608801906114d4565b908682036020880152611511565b9061341b61318d565b916134268184613db7565b5061342f613365565b613437613365565b90805115611679576001600160a01b03851660208201528151156116795761348c837f532f13a056b54c036d5c3fc8feef04beb2a99aa9aac9dfc1ae768acbb52a1153946020850152604051938493846133e9565b0390a1565b909392916001600160a01b0380861691908215610be7578115613628576134c16134ba836136cf565b9283613f90565b916134ce60085484612fef565b976134d98985612d1c565b96808810613607578088116135c6575b509061353a8784937f29fadedc9c067ceeb57f3d2497d942790271fb6e607c73874532f99031c1f0d8957f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca23616613637565b7fb935df7c8ec5ab928816ed97360488365f862650eeaf5f9f96c9fc6897fb134b613563613365565b61356b613365565b90613588846135798361316c565b6001600160a01b039091169052565b866135928361316c565b526135a387604051938493846133e9565b0390a1604080519485526020850188905284018990528116941691606090a49190565b986135fc61353a91610a698c7f29fadedc9c067ceeb57f3d2497d942790271fb6e607c73874532f99031c1f0d89796959b612d1c565b9997919293506134e9565b604051631f5c25a360e01b8152600481019190915260248101889052604490fd5b50505050509050600090600090565b60405163a9059cbb60e01b60208201526001600160a01b039290921660248301526044808301939093529181526106aa916136736064836129f1565b906000602091828151910182855af115612a3c576000513d6136c657506001600160a01b0381163b155b6136a45750565b604051635274afe760e01b81526001600160a01b039091166004820152602490fd5b6001141561369d565b6136d76143be565b82919251156131be576136ec92825192614c25565b509081519160005b83811061370d57604051636cdaa7bb60e01b8152600490fd5b6001600160a01b0361371f8284613179565b511661372b8482613e8f565b61373857506001016136f4565b935050505090565b91908110156116795760051b0190565b356107d38161075d565b91908082526020809201929160005b828110613777575050505090565b909192938280600192873561378b8161075d565b848060a01b03168152019501910192919092613769565b95949391906137b99160608852606088019161375a565b8581036020870152818152916001600160fb1b0382116105a65760409260209260051b8092848301370101930152565b51600381101561065b5790565b94939261340461157f9260409460608952606089019161375a565b80158015613892575b612d8857620f42409081831015612d8d57828203828111612c115761383f81836130bb565b9284811461303957820915158201809211612c1157819282613862575b50505090565b6138749061386f84612d0d565b612fb5565b1015613882575b808061385c565b61388c9150612d0d565b3861387b565b50811561381a565b600e546138af906001600160a01b03166138d1565b50565b60ff60025416156138bf57565b604051638dfc202b60e01b8152600490fd5b6001600160a01b0381161561396257604051600080928192368382378036810184815203915af43d15613959573d6001600160401b0381116129d15760405190613925601f8201601f1916602001836129f1565b8152809260203d92013e5b156139385790565b80511561394757602081519101fd5b604051633badd6bb60e21b8152600490fd5b60609150613930565b6040516303bca7b760e01b8152600490fd5b6040516370a0823160e01b8152306004820152906001600160a01b037f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca23616602083602481845afa928315610a5557600093613aa5575b508215613a9c576139f2906139e16007548561303e565b9384918280613a8a575b5050612d1c565b8015613a4357613a0c613a03612c23565b610dc683613412565b604080518281526020810185905233917ffb024939c95e49083f2b22887a9c2d0ca4169bbecca9b2a86015ae5a1635832c91a29190565b506040517ffb024939c95e49083f2b22887a9c2d0ca4169bbecca9b2a86015ae5a1635832c339180613a818682919060206040840193600081520152565b0390a260009190565b613a95913390613637565b38826139eb565b50600091508190565b613abe91935060203d8111610ae057610ad181836129f1565b91386139ca565b908160209103126105a657516107d38161075d565b6040516303e21fa960e61b8082526020916001600160a01b03919083816004817f0000000000000000000000007cb20517776636ed76b68edb3d99dcce356abf0287165afa908115610a5557600091613c7e575b5082163014908115613c05575b50613bf3576040516370a0823160e01b81523060048201527f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca23691909116908281602481855afa928315610a5557600093613bd4575b5050811561332b5781613ba4913390613637565b60405190815233907fbcfefe84ba8a2b4c5faac95ab797de36a7713daeb84f03c100d3f27383d48abf90602090a2565b613beb929350803d10610ae057610ad181836129f1565b903880613b90565b60405163079489e760e11b8152600490fd5b90506040519081528281600481857f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe165afa908115610a5557600091613c51575b508116301438613b3b565b613c719150833d8511613c77575b613c6981836129f1565b810190613ac5565b38613c46565b503d613c5f565b613c959150843d8611613c7757613c6981836129f1565b38613b2e565b60405190613ca8826129d6565b60006060838281528260208201528260408201520152565b90604051613ccd816129d6565b60ff6003829460018060a01b0380825416855260018201541660208501526002810154604085015201541690600382101561065b5760600152565b613d10613c9b565b506001600160a01b03166000818152600d602052604090205460ff1615613d4a57600052600c6020526107d36106e260406000205461163f565b6024906040519063c02219d960e01b82526004820152fd5b600090613d6d6143be565b505080519060005b828110613d8157505050565b613d9d6001600160a01b03613d968385613179565b51166146be565b858111613dae575b50600101613d75565b94506001613da5565b919091613dc860606113b383613d08565b600381101561065b57613e6d576001600160a01b038181166000908152600960205260409020549093908416918215613e53576107d3939450613e0a81614984565b927f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe917f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca236615206565b60405163dfc24d3d60e01b81529085166004820152602490fd5b604051630f6762e560e01b81526001600160a01b039091166004820152602490fd5b908015613f8957604051630a28a47760e01b815260048101919091526020916001600160a01b039081168383602481845afa60009381613f6a575b50613ed85750505050600090565b8215613f61576040516370a0823160e01b81527f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe929092166001600160a01b031660048301528390829081806024810103915afa928315610a5557600093613f42575b5050111590565b613f59929350803d10610ae057610ad181836129f1565b903880613f3b565b50505050600090565b613f82919450853d8711610ae057610ad181836129f1565b9238613eca565b5050600190565b613fa9612e34613fa460606113b385613d08565b614697565b614180576001600160a01b0381166000908152600960205260409020613fce90613203565b6001600160a01b03908082161561415f57604051630a28a47760e01b815260048101859052828416926020908183602481885afa928315610a5557600093614140575b50821561411f576040516370a0823160e01b81527f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe9182166001600160a01b0316600482015290948290829060249082905afa918215610a5557600092614102575b505081116140f0576140b09261408885614984565b92857f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca236615755565b918083106140bd57505090565b604051636f85e6ff60e11b81526001600160a01b0392909216600483015260248201929092526044810191909152606490fd5b604051636cdaa7bb60e01b8152600490fd5b6141189250803d10610ae057610ad181836129f1565b3880614073565b6040516352e4307960e11b81526001600160a01b0387166004820152602490fd5b614158919350823d8411610ae057610ad181836129f1565b9138614011565b60405163dfc24d3d60e01b81526001600160a01b0384166004820152602490fd5b604051630f6762e560e01b81526001600160a01b03919091166004820152602490fd5b6000939291845b8181106141b75750505050565b6141c18185613179565b51806141d1575b506001016141aa565b6141f2906141e38385879a959a613740565b356141ed8161075d565b613f90565b8101809111612c11579460016141c8565b60009493859290835b82811061421b57505050505050565b614226818388613740565b3580614236575b5060010161420c565b6142448285879b949b613740565b359061424f8261075d565b614263612e34613fa460606113b386613d08565b61439d576001600160a01b038216600090815260096020526040902061428890613203565b6001600160a01b03908082161561437c577f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe91604080516370a0823160e01b8152602090818160049581806142f0838c168a8301919091602081019260018060a01b03169052565b03918c165afa918215610a55578d9261435f575b505085116143525750509260019492610a699261434b9561432484614984565b937f00000000000000000000000007fff99e1664d9b116fbc158c0e99785f81ca236615755565b979061422d565b51636cdaa7bb60e01b8152fd5b6143759250803d10610ae057610ad181836129f1565b3880614304565b60405163dfc24d3d60e01b81526001600160a01b0385166004820152602490fd5b604051630f6762e560e01b81526001600160a01b0383166004820152602490fd5b600b54600091825b8281106144c5575082156144a3576143dd836133b7565b926143f06143ea826133b7565b916133b7565b926000805b82811061440d57505050614408906149dd565b509190565b6144196106e28261163f565b61442281614631565b614430575b506001016143f5565b8051614444906001600160a01b031661488e565b15614427578260408261446f8b6135796001979861446989985160018060a01b031690565b92613179565b8051614483906001600160a01b03166146be565b61448d848a613179565b52015161449a828a613179565b52019190614427565b9150506144ae61338f565b6144b661338f565b916144bf61338f565b91929190565b6144d16106e28261163f565b6144da81614631565b6144e8575b506001016143c6565b516144fb906001600160a01b031661488e565b614506575b386144df565b600190930192614500565b600b54600091825b8281106145e5575082156144a357614530836133b7565b9261453d6143ea826133b7565b926000805b82811061455557505050614408906149dd565b6145616106e28261163f565b61456a81614664565b614578575b50600101614542565b805161458c906001600160a01b03166147d4565b1561456f57826040826145b18b6135796001979861446989985160018060a01b031690565b80516145c5906001600160a01b03166146be565b6145cf848a613179565b5201516145dc828a613179565b5201919061456f565b6145f16106e28261163f565b6145fa81614664565b614608575b50600101614519565b5161461b906001600160a01b03166147d4565b614626575b386145ff565b600190930192614620565b6060810151600381101561065b5761464890614697565b15612d9557602001516001600160a01b031615612d9b57600190565b6060810151600381101561065b57612d955760208101516001600160a01b031615612d95576040015115612d9b57600190565b6146a081610651565b80159081156146ad575090565b600291506146ba81610651565b1490565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe81166004830152909160209182846024818585165afa600094816147b5575b506147215750505050600090565b8315613f61576001600160a01b038216600090815260096020526040902061474890613203565b16928315613f6157604051630147414360e31b81526001600160a01b039290921660048301526024820152918190839060449082905afa918291600093614796575b50506107d35750600090565b6147ad929350803d10610ae057610ad181836129f1565b90388061478a565b6147cd919550843d8611610ae057610ad181836129f1565b9338614713565b6040516278744560e21b81526001600160a01b0391909116906020908181600481865afa9081614871575b5061480b575050600090565b60405163ef8b30f760e01b8152670de0b6b3a7640000600482015291819083908180602481015b03915afa918291600093614852575b505061484d5750600090565b151590565b614869929350803d10610ae057610ad181836129f1565b903880614841565b61488790833d8511610ae057610ad181836129f1565b50386147ff565b6040516278744560e21b81526001600160a01b0391602091908316908281600481855afa9081614967575b506148c657505050600090565b6040516370a0823160e01b81527f0000000000000000000000004acbcfa29fb085097c5f31783403ef7a7930f6fe939093166001600160a01b031660048401528183602481845afa928315610a5557600093614948575b508215612d8d5760405163266d6a8360e11b8152600481019390935281908390818060248101614832565b614960919350823d8411610ae057610ad181836129f1565b913861491d565b61497d90843d8611610ae057610ad181836129f1565b50386148b9565b6001600160a01b0316600090815260106020526040902054806149a75750600190565b6000198101908111612c115790565b6000198114612c115760010190565b90620f424091828102928184041490151715612c1157565b90815115614a7157600091825b8151841015614a1757614a0b614a1191614a048685613179565b5190612c16565b936149b6565b926149ea565b9250614a2381516133b7565b9083156144085760005b8151811015614a6b5780614a5686614a51614a4b614a669587613179565b516149c5565b61302f565b614a608286613179565b526149b6565b614a2d565b50509190565b9050614a7b61338f565b90600090565b9291908351815180911490811591614b91575b50610bc357835115614b7f578351916001928311614b6d57614ab591614b9d565b9060008181815b614b37575b505015614ad75750614ad39192614dfb565b9091565b9050614ae1613365565b90614aea613365565b9360005b828110614afc575050509190565b80614b27614b1d614b10614b329486613179565b516001600160a01b031690565b6135798388613179565b80614a608189613179565b614aee565b8451811015614b6857614b4a8186613179565b51614b5e57614b58906149b6565b81614abc565b5090508138614ac1565b614ac1565b60405163229bbef160e01b8152600490fd5b60405163012a9aeb60e31b8152600490fd5b90508251141538614a94565b9190918051835103610bc357614bb381516133b7565b926000805b8351811015614c1f57614bcb8184613179565b51614bd68286613179565b511015614c1057614be78184613179565b5190614bf38186613179565b518203918211612c1157614c0b91614a608289613179565b614bb8565b8082614a60614c0b9389613179565b50505050565b93918451825180911490811591614cf7575b50610bc357845115614b7f578315614ce55784518411614b6d57614c5a91614d03565b91600092835b8151811015614cdc57614c738183613179565b51614c8657614c81906149b6565b614c60565b509091925060015b15614c9d57614ad39293615014565b50614ca7816133b7565b90614cb1816133b7565b9360005b828110614cc3575050509190565b80614b27614b1d614b10614cd79486613179565b614cb5565b50909192614c8e565b604051636eb50e3160e11b8152600490fd5b90508151141538614c37565b91908251815103610bc357614d1883516133b7565b926000805b8251811015614c1f57614d308184613179565b51614d3b8286613179565b511015614d7557614d4c8184613179565b5190614d588186613179565b518203918211612c1157614d7091614a608289613179565b614d1d565b8082614a60614d709389613179565b90614d8e8261334e565b604090614d9d825191826129f1565b8381528093614dae601f199161334e565b0190600092835b838110614dc3575050505050565b81519060608201918083106001600160401b038411176129d15760209284528681528287818301528785830152828601015201614db5565b90614e068251614d84565b9160005b8151811015614e745780614e24614b10614e6f9385613179565b614e2e8286613179565b51614e49614e3a61332f565b6001600160a01b039093168352565b6020820152816040820152614e5e8287613179565b52614e698186613179565b506149b6565b614e0a565b505050906000915b60019283811015614fa5578093602080614e968486613179565b51015182614ea385612c03565b905b614f10575b505050508381614ec193949503614ec857506149b6565b9190614e7c565b614f0990614ed68386613179565b51614ee18287613179565b51614eec8588613179565b52614ef78487613179565b50614f028287613179565b5284613179565b5038614e69565b8551811015614fa0578183614f258389613179565b510151118015614f64575b614f45575b614f3f84916149b6565b90614ea5565b9650508582614f3f83614f588489613179565b51015192915050614f35565b508183614f718389613179565b510151148015614f305750604080614f898389613179565b51015190614f978a89613179565b51015111614f30565b614eaa565b509150614fb0613365565b614fb8613365565b9260005b60018110614fca5750509190565b80614ff6614fec614fde61500f9486613179565b51516001600160a01b031690565b6135798387613179565b60406150028285613179565b510151614a608288613179565b614fbc565b61501e8151614d84565b9360005b8251811015615077578061503c614b106150729386613179565b6150468287613179565b51615052614e3a61332f565b60208201528160408201526150678289613179565b52614e698188613179565b615022565b509291505060005b8181106150de5750615090816133b7565b9061509a816133b7565b9360005b8281106150ac575050509190565b806150c0614b1d614fde6150d99486613179565b60406150cc8285613179565b510151614a608289613179565b61509e565b928392602092836150ef8685613179565b510151916150fc86612c03565b84518110156151895783866151118388613179565b51015111801561514d575b61512f575b61512a906149b6565b6150fc565b965086925061512a856151428587613179565b510151939050615121565b50838661515a8388613179565b51015114801561511c57506040806151728388613179565b510151906151808a88613179565b5101511161511c565b5094915092506151a191948181036151a657506149b6565b61507f565b614f09906151b48388613179565b516151bf8289613179565b516151ca858a613179565b526151d58489613179565b506151e08289613179565b5286613179565b91908260409103126105a657602082516152008161075d565b92015190565b95939194929461521584615d8b565b6001600160a01b039586169661522d888385846155a3565b978783169260409283516314825f4560e31b81528481806152568b600483019190602083019252565b0381895afa9a8b15610a5557600091829c61546a575b5080881691828282160361543857509081866152b46000948616996152928d898d615568565b82516306f81a6b60e41b8152600481018e905295869283919082906024820190565b03925af1978815610a555760009384996153fe575b50856152d49161548b565b8216036153cc575090856152e893926155a3565b916152fc602084015160208b015190612d1c565b9780891061539d575080880361537d575087518251600091818110615376576153259250612d1c565b848103615356575060608861534b87878585966106aa9c9d9e0151908801519089615ad5565b015191015191615b72565b81516306bcaec160e31b8152600481018690526024810191909152604490fd5b5050615325565b8151636232875560e11b8152600481018990526024810191909152604490fd5b8251636f85e6ff60e11b81526001600160a01b0386166004820152602481018a90526044810191909152606490fd5b845163e8eebd3760e01b81526001600160a01b0384811660048301528881166024830152919091166044820152606490fd5b6152d491995086945061542690893d8b11615431575b61541e81836129f1565b8101906151e7565b9490949991506152c9565b503d615414565b865163e8eebd3760e01b81526001600160a01b0386811660048301528a81166024830152919091166044820152606490fd5b909b506154849150853d87116154315761541e81836129f1565b9a3861526c565b60405163095ea7b360e01b60208083018281526001600160a01b03861660248501526000604485018190529295939493909290919085606481015b03936154da601f19958681018952886129f1565b86519082875af16000513d82615543575b5050156154fa575b5050505050565b60405160208101959095526001600160a01b031660248501526000604485015260649081018452615539936136739161553390826129f1565b82613673565b38808080806154f3565b90915061556057506001600160a01b0383163b15155b38806154eb565b600114615559565b60405163095ea7b360e01b60208083018281526001600160a01b038616602485015260448401969096529094919390600085606481016154c6565b93926155ad613c9b565b6040516370a0823160e01b808252306004830152919660209592946001600160a01b039392909187908290602490829088165afa948515610a555761561d958892600091615738575b508a526040519687526001600160a01b031660048701528184169594859081906024820190565b0381885afa938415610a5557600094615719575b508588019484865284615648575b50505050505050565b60405163266d6a8360e11b815260048101959095528690859060249082905afa948515610a55576156b89587956000916156fc575b5060408a81019190915290519051630147414360e31b81526001600160a01b0390921660048301526024820152938492839182906044820190565b0392165afa918215610a55576000926156df575b505060608301523880808080808061563f565b6156f59250803d10610ae057610ad181836129f1565b38806156cc565b6157139150863d8811610ae057610ad181836129f1565b3861567d565b615731919450863d8811610ae057610ad181836129f1565b9238615631565b61574f9150833d8511610ae057610ad181836129f1565b386155f6565b9593949261576284615d8b565b6001600160a01b039081166157798185858b6155a3565b93813b156105a6576040805163989a5e6760e01b81526001600160a01b0386166004820152602481018a9052306044820152909960009990918a8160648183895af18015610a55578b968d93602093615800936158ea575b50818a16946157e1828988615568565b519d8e809481936348b1933560e01b8352600483019190602083019252565b039288165af1998a15610a5557859a6158b8575b50829161582661582b9594889361548b565b6155a3565b80518451919291908181106158b0576158449250612d1c565b925b83968085036158905750831561587f5760608161587487878c6106aa9b9c9d86970151908801519089615c81565b015191015191615d06565b87516347d4543760e01b8152600490fd5b885163794a362960e11b8152600481019190915260248101859052604490fd5b505092615846565b86919a5091615826846158dd61582b97969560203d8111610ae057610ad181836129f1565b9c93505050919293615814565b80610a496158f7926129be565b386157d1565b6040516370a0823160e01b80825230600483015260209391926001600160a01b031691908484602481865afa938415610a5557859287916000966159c4575b509061594a913090866159e9565b60405190815230600482015291829060249082905afa908115610a5557615979936000926159a7575050612d1c565b90808203615985575050565b6040516306bcaec160e31b815260048101919091526024810191909152604490fd5b6159bd9250803d10610ae057610ad181836129f1565b38806139eb565b61594a929196506159e190853d8711610ae057610ad181836129f1565b95909161593c565b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815260a08101918183106001600160401b038411176129d1576106aa92604052613673565b92615a4b81615d8b565b600084831115615ad05750838203828111612c11575b8015918215615aa7575b5050615a7657505050565b60a49350604051926377425d3960e01b84526000600485015260026024850152604484015260648301526084820152fd5b84821092509082615abc575b50503880615a6b565b9091508303838111612c1157113880615ab3565b615a61565b93615adf81615d8b565b600082841115615b6d5750818303838111612c11575b8015918215615b44575b5050615b0b5750505050565b6040516377425d3960e01b81526001600160a01b0390941660048501526000602485015260448401526064830152608482015260a49150fd5b85821092509082615b59575b50503880615aff565b9091508403848111612c1157113880615b50565b615af5565b93615b7c81615d8b565b600082841115615c0a5750818303838111612c11575b8015918215615be1575b5050615ba85750505050565b6040516377425d3960e01b81526001600160a01b0390941660048501526001602485015260448401526064830152608482015260a49150fd5b85821092509082615bf6575b50503880615b9c565b9091508403848111612c1157113880615bed565b615b92565b90615c1983615d8b565b600081831115615c7857508103908111612c1157905b8115159081615c6e575b50615c415750565b60849060405190635fd8a9dd60e01b82526000600483015260026024830152604482015260006064820152fd5b9050811138615c39565b91505090615c2f565b9391615c8c83615d8b565b600081831115615cfd57508103908111612c1157905b8282119081615cea575b50615cb657505050565b604051635fd8a9dd60e01b81526001600160a01b039093166004840152600060248401526044830152606482015260849150fd5b9050828203828111612c11571138615cac565b91505090615ca2565b9391615d1183615d8b565b600081831115615d8257508103908111612c1157905b8282119081615d6f575b50615d3b57505050565b604051635fd8a9dd60e01b81526001600160a01b039093166004840152600160248401526044830152606482015260849150fd5b9050828203828111612c11571138615d31565b91505090615d27565b60108111615d965750565b60249060405190633396879560e11b82526004820152fdfea2646970667358221220178e97810a3dd2e0d7b553bce589809bd2fb980d89bc0420fa1c5ef6a4fdf65264736f6c63430008140033","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport { DStakeRouterV2 } from \"../DStakeRouterV2.sol\";\n\n/**\n * @notice Incident replacement starts paused IN ITS CONSTRUCTOR, before exposure.\n * @dev Non-proxy. Uses the existing token/collateral vault, not new holder shares.\n *      Governance must wire, verify, and separately authorize reopening.\n */\ncontract DStakeRouterV2Incident is DStakeRouterV2 {\n    constructor(address token, address collateral) DStakeRouterV2(token, collateral) {\n        _pause();\n    }\n}\n","creation_status":"success","file_path":"contracts/vaults/dstake/incident/DStakeRouterV2Incident.sol"}