diff --git a/packages/contracts/.gas-snapshot b/packages/contracts/.gas-snapshot index 52158ee6..9c256c68 100644 --- a/packages/contracts/.gas-snapshot +++ b/packages/contracts/.gas-snapshot @@ -2,58 +2,58 @@ AddressListTest:testAdd(uint8) (runs: 256, μ: 314342, ~: 94547) AddressListTest:testContains() (gas: 144445) AddressListTest:testContainsFuzz(uint8,uint8) (runs: 256, μ: 427494, ~: 234483) AddressListTest:testRemove() (gas: 103778) -AddressListTest:testRemoveFuzz(uint8,uint8) (runs: 256, μ: 447004, ~: 264675) +AddressListTest:testRemoveFuzz(uint8,uint8) (runs: 256, μ: 449945, ~: 275885) AddressListTest:testReorder() (gas: 126359) AddressListTest:testReorderFailIfNewOrderHasDifferentItems() (gas: 120917) AddressListTest:testReorderFailIfNewOrderHasDifferentLength() (gas: 120810) AddressListTest:testReorderWithTheSameItems() (gas: 112619) -ApeLendingStrategyTest:testHarvestIfThereIsNoPosition(uint128,uint128) (runs: 256, μ: 74497, ~: 75900) -ApeLendingStrategyTest:testHarvestWithLossCase(uint128,uint128,uint128,uint128) (runs: 256, μ: 147142, ~: 149782) +ApeLendingStrategyTest:testHarvestIfThereIsNoPosition(uint128,uint128) (runs: 256, μ: 74497, ~: 75893) +ApeLendingStrategyTest:testHarvestWithLossCase(uint128,uint128,uint128,uint128) (runs: 256, μ: 146986, ~: 149782) ApeLendingStrategyTest:testHarvestWithProfitCaseWhenActualProfitGreaterThanFreeAssets(uint128,uint128,uint128,uint128) (runs: 256, μ: 149325, ~: 150417) ApeLendingStrategyTest:testHarvestWithProfitCaseWhenFreeAssetsGreaterThanProfitAndDebt(uint128,uint128,uint128,uint128) (runs: 256, μ: 150208, ~: 150208) ApeLendingStrategyTest:testHarvestWithProfitCaseWhenFreeAssetsGreaterThanProfitButLessThanProfitAndDebt(uint128,uint128,uint128,uint128) (runs: 256, μ: 150428, ~: 150428) ApeLendingStrategyTest:testShouldAdjustPositionWhenNotPaused(uint256) (runs: 256, μ: 24153, ~: 24153) ApeLendingStrategyTest:testShouldCalculateDepositedBalanceFromSnapshot(uint128,uint32) (runs: 256, μ: 58235, ~: 59712) ApeLendingStrategyTest:testShouldCalculateEstimatedAccruedBanana(uint128,uint32,uint192,uint64,uint64,uint64):(uint256) (runs: 256, μ: 141075, ~: 141075) -ApeLendingStrategyTest:testShouldCalculateEstimatedAccruedBananaPerBlock(uint128,uint32,uint192,uint64):(uint256) (runs: 256, μ: 123883, ~: 122221) -ApeLendingStrategyTest:testShouldCalculateTotalBananaBalanceInAsset(uint128,uint32,uint192,uint64,uint64,uint64,uint128) (runs: 256, μ: 214181, ~: 214192) -ApeLendingStrategyTest:testShouldClaimAndSwapBananaOnHarvest(uint128,uint128,uint128,uint128) (runs: 256, μ: 249380, ~: 251988) +ApeLendingStrategyTest:testShouldCalculateEstimatedAccruedBananaPerBlock(uint128,uint32,uint192,uint64):(uint256) (runs: 256, μ: 123945, ~: 122221) +ApeLendingStrategyTest:testShouldCalculateTotalBananaBalanceInAsset(uint128,uint32,uint192,uint64,uint64,uint64,uint128) (runs: 256, μ: 214192, ~: 214192) +ApeLendingStrategyTest:testShouldClaimAndSwapBananaOnHarvest(uint128,uint128,uint128,uint128) (runs: 256, μ: 249356, ~: 251948) ApeLendingStrategyTest:testShouldClaimBanana() (gas: 24767) ApeLendingStrategyTest:testShouldConstructCorrectSwapPath() (gas: 21168) ApeLendingStrategyTest:testShouldDisplayCorrectName() (gas: 16064) ApeLendingStrategyTest:testShouldGiveFullAllowanceToDeps() (gas: 18417) ApeLendingStrategyTest:testShouldLiquidateAll(uint128) (runs: 256, μ: 15999, ~: 15999) -ApeLendingStrategyTest:testShouldLiquidatePosition(uint128,uint128,uint128) (runs: 256, μ: 86962, ~: 89441) -ApeLendingStrategyTest:testShouldLiquidatePositionIfBalanceLessThanDebt(uint128,uint128,uint128) (runs: 256, μ: 131324, ~: 134554) +ApeLendingStrategyTest:testShouldLiquidatePosition(uint128,uint128,uint128) (runs: 256, μ: 87429, ~: 89441) +ApeLendingStrategyTest:testShouldLiquidatePositionIfBalanceLessThanDebt(uint128,uint128,uint128) (runs: 256, μ: 131282, ~: 134554) ApeLendingStrategyTest:testShouldMintCTokenIfBalanceGreaterThanDebt(uint128,uint128) (runs: 256, μ: 130465, ~: 130465) ApeLendingStrategyTest:testShouldNotAdjustPositionWhenPaused(uint256) (runs: 256, μ: 57240, ~: 57240) ApeLendingStrategyTest:testShouldNotLiquidatePositionIfHasSufficeBalance(uint128,uint128) (runs: 256, μ: 83093, ~: 83249) -ApeLendingStrategyTest:testShouldNotSwapBananaToAssetIfBalanceLessThanMinimumAmount(uint128,uint128) (runs: 256, μ: 77097, ~: 80051) +ApeLendingStrategyTest:testShouldNotSwapBananaToAssetIfBalanceLessThanMinimumAmount(uint128,uint128) (runs: 256, μ: 77252, ~: 80051) ApeLendingStrategyTest:testShouldReturnCorrectCurrentBananaBalance(uint256):(uint256) (runs: 256, μ: 58561, ~: 60738) ApeLendingStrategyTest:testShouldReturnDepositedBalance(uint192) (runs: 256, μ: 59671, ~: 61071) ApeLendingStrategyTest:testShouldReturnZeroEstimatedAccruedBananaIfBlockAmountIsZero() (gas: 18044) ApeLendingStrategyTest:testShouldReturnZeroEstimatedAccruedBananaIfReportWasInCurrentBlock(uint128,uint32,uint192,uint64,uint64) (runs: 256, μ: 140246, ~: 140246) -ApeLendingStrategyTest:testShouldReturnZeroEstimatedAccruedBananaPerBlockIfBalanceIsZero(uint32) (runs: 256, μ: 38635, ~: 39724) -ApeLendingStrategyTest:testShouldReturnZeroEstimatedAccruedBananaPerBlockIfRateIsZero(uint32) (runs: 256, μ: 38689, ~: 39778) -ApeLendingStrategyTest:testShouldReturnZeroEstimatedAccruedBananaPerBlockIfTotalSupplyIsZero(uint128,uint32,uint64) (runs: 256, μ: 83210, ~: 81433) +ApeLendingStrategyTest:testShouldReturnZeroEstimatedAccruedBananaPerBlockIfBalanceIsZero(uint32) (runs: 256, μ: 38557, ~: 39724) +ApeLendingStrategyTest:testShouldReturnZeroEstimatedAccruedBananaPerBlockIfRateIsZero(uint32) (runs: 256, μ: 38611, ~: 39778) +ApeLendingStrategyTest:testShouldReturnZeroEstimatedAccruedBananaPerBlockIfTotalSupplyIsZero(uint128,uint32,uint64) (runs: 256, μ: 83070, ~: 81433) ApeLendingStrategyTest:testShouldReturnZeroTotalBananaAssetBalanceIfNoBanana() (gas: 30180) -ApeLendingStrategyTest:testShouldRevertIfAssetAndCTokenUnderlyingAreNotSame() (gas: 6215389) +ApeLendingStrategyTest:testShouldRevertIfAssetAndCTokenUnderlyingAreNotSame() (gas: 6610133) ApeLendingStrategyTest:testShouldRevertIfAssetDecimalsAreWrong() (gas: 513772) ApeLendingStrategyTest:testShouldRevertIfCTokenDecimalsAreWrong() (gas: 513824) -ApeLendingStrategyTest:testShouldSwapBananaToAsset(uint128,uint128) (runs: 256, μ: 122278, ~: 122865) +ApeLendingStrategyTest:testShouldSwapBananaToAsset(uint128,uint128) (runs: 256, μ: 122353, ~: 122865) BackCombatibleTransferTest:testBackCombatibleTransferERC20Token(uint96) (runs: 256, μ: 119528, ~: 119528) BackCombatibleTransferTest:testBackCombatibleTransferNativeToken(uint96) (runs: 256, μ: 40561, ~: 40561) BackCombatibleTransferTest:testFailSafeNativeTransferTokens(uint256) (runs: 256, μ: 39771, ~: 39771) BackCombatibleTransferTest:testSafeNativeTransferTokens(uint96) (runs: 256, μ: 40435, ~: 40435) -BaseStrategyTest:testCanWorkIfDebtGreaterThanThreshold(uint256,uint192,bool) (runs: 256, μ: 84005, ~: 99208) -BaseStrategyTest:testCanWorkIfStrategyHasLoss(uint192,uint192,uint192) (runs: 256, μ: 86698, ~: 89108) -BaseStrategyTest:testCanWorkIfVaultIsDeactivated() (gas: 13952) -BaseStrategyTest:testCheckGasPriceAgainstProfit(uint128,uint192,uint192,uint128) (runs: 256, μ: 81894, ~: 84540) +BaseStrategyTest:testCanWorkIfDebtGreaterThanThreshold(uint256,uint192,bool) (runs: 256, μ: 84023, ~: 99226) +BaseStrategyTest:testCanWorkIfStrategyHasLoss(uint192,uint192,uint192) (runs: 256, μ: 86793, ~: 89126) +BaseStrategyTest:testCanWorkIfVaultIsDeactivated() (gas: 13970) +BaseStrategyTest:testCheckGasPriceAgainstProfit(uint128,uint192,uint192,uint128) (runs: 256, μ: 81565, ~: 84540) BaseStrategyTest:testGrantFullAssetsAccessToVault() (gas: 12322) BaseStrategyTest:testLiquidateAndSendOnWithdraw(uint256) (runs: 256, μ: 77429, ~: 79606) -BaseStrategyTest:testPauseAndRevokingOnShutdown() (gas: 53566) -BaseStrategyTest:testProperHarvestFunctionCalledOnWork(bool) (runs: 256, μ: 89824, ~: 84110) -BaseStrategyTest:testProperReportFunctionCalledOnWork() (gas: 95723) +BaseStrategyTest:testPauseAndRevokingOnShutdown() (gas: 53672) +BaseStrategyTest:testProperHarvestFunctionCalledOnWork(bool) (runs: 256, μ: 89801, ~: 84087) +BaseStrategyTest:testProperReportFunctionCalledOnWork() (gas: 95633) BaseStrategyTest:testRevertIfPriceFeedDecimalsAreDifferent() (gas: 760378) BaseStrategyTest:testRevertOnSetDebtThresholdIfCallerIsNotAnOwner(uint256) (runs: 256, μ: 13659, ~: 13659) BaseStrategyTest:testRevertOnSetEstimatedWorkGasIfCallerIsNotAnOwner(uint256) (runs: 256, μ: 13733, ~: 13733) @@ -62,11 +62,11 @@ BaseStrategyTest:testRevertOnShutdownIfCallerIsNotAnOwner() (gas: 18597) BaseStrategyTest:testRevertOnWithdrawIfCallerIsNotAVault(uint256) (runs: 256, μ: 10607, ~: 10607) BaseStrategyTest:testShouldGainProfitIfFreedGreaterOrEqualToDebt(uint256,uint256) (runs: 256, μ: 33032, ~: 33114) BaseStrategyTest:testShouldRealiseLossIfFreedLowerThanDebt(uint256,uint256) (runs: 256, μ: 31679, ~: 33234) -BaseStrategyTest:testShouldSetDebtThreshold(uint256) (runs: 256, μ: 35603, ~: 36692) -BaseStrategyTest:testShouldSetEstimatedWorkGas(uint256) (runs: 256, μ: 35534, ~: 36623) -BaseStrategyTest:testShouldSetProfitFactor(uint256) (runs: 256, μ: 19284, ~: 19547) -BaseStrategyTest:testShouldTakeIntoAccountTotalDebtWhenAdjustPosition(uint192,uint192,uint192,bool) (runs: 256, μ: 62347, ~: 62354) -BaseStrategyTest:testShouldTakeVaultAsset() (gas: 15310) +BaseStrategyTest:testShouldSetDebtThreshold(uint256) (runs: 256, μ: 35621, ~: 36710) +BaseStrategyTest:testShouldSetEstimatedWorkGas(uint256) (runs: 256, μ: 35552, ~: 36641) +BaseStrategyTest:testShouldSetProfitFactor(uint256) (runs: 256, μ: 19302, ~: 19565) +BaseStrategyTest:testShouldTakeIntoAccountTotalDebtWhenAdjustPosition(uint192,uint192,uint192,bool) (runs: 256, μ: 62325, ~: 62331) +BaseStrategyTest:testShouldTakeVaultAsset() (gas: 15332) CTokenBaseStrategyTest:testShouldClaimBanana() (gas: 24720) CTokenBaseStrategyTest:testShouldDisplayCorrectName() (gas: 7052) CTokenBaseStrategyTest:testShouldGiveFullAllowanceToDeps() (gas: 12301) @@ -77,12 +77,12 @@ CTokenBaseStrategyTest:testShouldReturnCorrectExchangeRateStored(uint256) (runs: CTokenBaseStrategyTest:testShouldReturnCorrectInterestRatePerBlock(bool,uint256) (runs: 256, μ: 47234, ~: 43352) CTokenBaseStrategyTest:testShouldReturnCorrectSupplyRatePerBlock(bool,uint256) (runs: 256, μ: 47132, ~: 43250) CTokenBaseStrategyTest:testShouldReturnZeroTotalBananaAssetBalanceIfNoBanana() (gas: 15350) -CTokenBaseStrategyTest:testShouldRevertIfAssetAndCTokenUnderlyingAreNotSame() (gas: 6223262) +CTokenBaseStrategyTest:testShouldRevertIfAssetAndCTokenUnderlyingAreNotSame() (gas: 10349508) CTokenBaseStrategyTest:testShouldRevertIfAssetDecimalsAreWrong() (gas: 520231) CTokenBaseStrategyTest:testShouldRevertIfCTokenDecimalsAreWrong() (gas: 520216) CTokenBaseStrategyTest:testShouldaccrueInterest(uint256) (runs: 256, μ: 34815, ~: 35904) -ERC4626Test:invariantMetadata() (runs: 256, calls: 3840, reverts: 1382) -ERC4626Test:invariantMetadata() (runs: 256, calls: 3840, reverts: 1604) +ERC4626Test:invariantMetadata() (runs: 256, calls: 3840, reverts: 1384) +ERC4626Test:invariantMetadata() (runs: 256, calls: 3840, reverts: 1603) ERC4626Test:testFailDepositWithNoApproval(uint128) (runs: 256, μ: 26754, ~: 27028) ERC4626Test:testFailDepositWithNoApproval(uint128) (runs: 256, μ: 26784, ~: 27059) ERC4626Test:testFailDepositWithNotEnoughApproval(uint128,uint128) (runs: 256, μ: 102850, ~: 102850) @@ -102,21 +102,40 @@ ERC4626Test:testFailWithdrawWithNoUnderlyingAmount(uint128) (runs: 256, μ: 4682 ERC4626Test:testFailWithdrawWithNoUnderlyingAmount(uint128) (runs: 256, μ: 46831, ~: 46831) ERC4626Test:testFailWithdrawWithNotEnoughUnderlyingAmount(uint128,uint128) (runs: 256, μ: 236300, ~: 236300) ERC4626Test:testFailWithdrawWithNotEnoughUnderlyingAmount(uint128,uint128) (runs: 256, μ: 236315, ~: 236315) -ERC4626Test:testMetadata(string,string) (runs: 256, μ: 2034966, ~: 2025292) -ERC4626Test:testMetadata(string,string) (runs: 256, μ: 2105221, ~: 2096074) +ERC4626Test:testMetadata(string,string) (runs: 256, μ: 2034725, ~: 2025292) +ERC4626Test:testMetadata(string,string) (runs: 256, μ: 2105748, ~: 2096074) ERC4626Test:testMintZeroAllowed() (gas: 77783) ERC4626Test:testMintZeroAllowed() (gas: 81603) ERC4626Test:testMultipleMintDepositRedeemWithdraw() (gas: 682932) ERC4626Test:testMultipleMintDepositRedeemWithdraw() (gas: 712774) ERC4626Test:testSingleDepositWithdraw(uint96,uint96,uint128) (runs: 256, μ: 237457, ~: 237397) -ERC4626Test:testSingleDepositWithdraw(uint96,uint96,uint128,bool,bool) (runs: 256, μ: 230606, ~: 230434) -ERC4626Test:testSingleMintRedeem(uint96,uint96,uint128) (runs: 256, μ: 237767, ~: 237457) -ERC4626Test:testSingleMintRedeem(uint96,uint96,uint128,bool,bool) (runs: 256, μ: 231161, ~: 230540) -ERC4626Test:testVaultInteractionsForSomeoneElse(uint96,uint96) (runs: 256, μ: 354126, ~: 354125) +ERC4626Test:testSingleDepositWithdraw(uint96,uint96,uint128,bool,bool) (runs: 256, μ: 230614, ~: 230434) +ERC4626Test:testSingleMintRedeem(uint96,uint96,uint128) (runs: 256, μ: 237828, ~: 237457) +ERC4626Test:testSingleMintRedeem(uint96,uint96,uint128,bool,bool) (runs: 256, μ: 231227, ~: 230540) +ERC4626Test:testVaultInteractionsForSomeoneElse(uint96,uint96) (runs: 256, μ: 354127, ~: 354128) ERC4626Test:testVaultInteractionsForSomeoneElseNotWorking(uint96,uint96) (runs: 256, μ: 340391, ~: 340392) -ERC4626Test:testVaultInteractionsThroughApprove(uint96,uint96) (runs: 256, μ: 415752, ~: 415753) +ERC4626Test:testVaultInteractionsThroughApprove(uint96,uint96) (runs: 256, μ: 415752, ~: 415752) ERC4626Test:testWithdrawZeroAllowed() (gas: 73256) ERC4626Test:testWithdrawZeroAllowed() (gas: 77742) +ERC5484UpgradeableTest:testBurnAuth(string) (runs: 256, μ: 184678, ~: 192380) +ERC5484UpgradeableTest:testBurnAuthFail() (gas: 10712) +ERC5484UpgradeableTest:testBurnTokenForIssuerOnly(string,bool) (runs: 256, μ: 2299338, ~: 2294577) +ERC5484UpgradeableTest:testBurnTokenForIssuerOnlyFail(string,bool) (runs: 256, μ: 2443677, ~: 2444380) +ERC5484UpgradeableTest:testBurnTokenForOwnerAndIssuerOnly(string,bool) (runs: 256, μ: 2415957, ~: 2416964) +ERC5484UpgradeableTest:testBurnTokenForOwnerOnly(string,bool) (runs: 256, μ: 2312847, ~: 2313409) +ERC5484UpgradeableTest:testBurnTokenForOwnerOnlyFail(string,bool) (runs: 256, μ: 2481612, ~: 2486897) +ERC5484UpgradeableTest:testCorrectRewardClaimed() (gas: 352258) +ERC5484UpgradeableTest:testDepositReward(uint192) (runs: 256, μ: 243074, ~: 243074) +ERC5484UpgradeableTest:testDepositRewardFail(uint192) (runs: 256, μ: 334227, ~: 334227) +ERC5484UpgradeableTest:testMintToken() (gas: 307616) +ERC5484UpgradeableTest:testMintTokenMultipleTimeForSingleUser(string) (runs: 256, μ: 2744817, ~: 2769484) +ERC5484UpgradeableTest:testMintTokenOnceFail(string) (runs: 256, μ: 186969, ~: 194679) +ERC5484UpgradeableTest:testSetupNewOwnerFail() (gas: 963516) +ERC5484UpgradeableTest:testSetupNewsOwner() (gas: 42072) +ERC5484UpgradeableTest:testSupportsInterface() (gas: 12079) +ERC5484UpgradeableTest:testTokenBurnFailed(string) (runs: 256, μ: 253867, ~: 261569) +ERC5484UpgradeableTest:testTokenTransferFail(string) (runs: 256, μ: 193522, ~: 201224) +ERC5484UpgradeableTest:testVaultMetadata() (gas: 14855) FixedPointMathLibTest:testDivWadDown() (gas: 875) FixedPointMathLibTest:testDivWadDown(uint256,uint256) (runs: 256, μ: 746, ~: 848) FixedPointMathLibTest:testDivWadDownEdgeCases() (gas: 427) @@ -153,7 +172,7 @@ FixedPointMathLibTest:testRPow() (gas: 2192) FixedPointMathLibTest:testSqrt() (gas: 2120) FixedPointMathLibTest:testSqrt(uint256) (runs: 256, μ: 1034, ~: 1050) GelatoJobAdapterTest:testCanWorkReturnTrueOnlyWhenTimeCame(uint96) (runs: 256, μ: 83814, ~: 83814) -GelatoJobAdapterTest:testChecker(uint96,bool,bool) (runs: 256, μ: 68382, ~: 55453) +GelatoJobAdapterTest:testChecker(uint96,bool,bool) (runs: 256, μ: 68381, ~: 55453) GelatoJobAdapterTest:testFailPaybleWorkNotByOps(uint96,uint96) (runs: 256, μ: 141207, ~: 141207) GelatoJobAdapterTest:testPayableWorkNotAllowedWhenIsPrepaid(uint96,uint96) (runs: 256, μ: 162011, ~: 162011) GelatoJobAdapterTest:testPaybleWorkERC20Fee(uint96,uint96) (runs: 256, μ: 248666, ~: 248666) @@ -177,7 +196,7 @@ JobTest:testCheckTimeMinimumbBetweenExecutions(uint96,bool) (runs: 256, μ: 4141 JobTest:testWorkCallsRefreshTheTimeout(uint96,uint96,uint96) (runs: 256, μ: 127804, ~: 127804) JobTest:testWorkHaveCheckForCanWork(uint96) (runs: 256, μ: 30873, ~: 30873) JobTest:testWorkHaveCheckForCanWorkTime(uint96) (runs: 256, μ: 71315, ~: 71315) -LenderTest:testAddingBorrower(uint256,uint256) (runs: 256, μ: 180607, ~: 184339) +LenderTest:testAddingBorrower(uint256,uint256) (runs: 256, μ: 180763, ~: 184339) LenderTest:testAddingBorrowerWithExceededRatio(uint256) (runs: 256, μ: 108795, ~: 108795) LenderTest:testAddingExistingBorrower() (gas: 103307) LenderTest:testAvailableCreditCalculation(uint192,uint64) (runs: 256, μ: 128548, ~: 132842) @@ -185,27 +204,27 @@ LenderTest:testAvailableCreditCalculationMaxRatio(uint192,uint192) (runs: 256, LenderTest:testAvailableCreditCalculationPaused(uint192,uint192) (runs: 256, μ: 189024, ~: 191512) LenderTest:testBorrowerCurrentDebt(uint192,uint192,uint64) (runs: 256, μ: 169291, ~: 170535) LenderTest:testBorrowerIsActivated(uint192,uint192,uint64) (runs: 256, μ: 170930, ~: 172174) -LenderTest:testBorrowerNegativeReport(uint192,uint256,uint256) (runs: 256, μ: 217909, ~: 242691) -LenderTest:testBorrowerPositiveReport(uint192,uint64,uint32) (runs: 256, μ: 218659, ~: 239813) +LenderTest:testBorrowerNegativeReport(uint192,uint256,uint256) (runs: 256, μ: 219423, ~: 242691) +LenderTest:testBorrowerPositiveReport(uint192,uint64,uint32) (runs: 256, μ: 218905, ~: 239813) LenderTest:testBorrowerReportWithWrongCaller() (gas: 17263) LenderTest:testFalsePositiveReport(uint192) (runs: 256, μ: 139510, ~: 140210) LenderTest:testFeesCharged(uint192,uint256,uint64) (runs: 256, μ: 268800, ~: 268800) LenderTest:testFeesNotChargedIfReportedTwice() (gas: 223420) -LenderTest:testIdempotentZeroReports(uint192,uint32) (runs: 256, μ: 1512161, ~: 1560798) -LenderTest:testMultipleBorrowersReports(uint192,uint256,uint256,uint64,uint64) (runs: 256, μ: 369571, ~: 369772) +LenderTest:testIdempotentZeroReports(uint192,uint32) (runs: 256, μ: 1517444, ~: 1560798) +LenderTest:testMultipleBorrowersReports(uint192,uint256,uint256,uint64,uint64) (runs: 256, μ: 369591, ~: 369772) LenderTest:testNegativeReportWithDebtPayment() (gas: 4473914) -LenderTest:testNegativeReportWithDebtPaymentFuzz(uint192,uint64,uint64,uint64) (runs: 256, μ: 329095, ~: 328059) -LenderTest:testOutstandingDebtCalculation(uint192,uint128,uint64,bool) (runs: 256, μ: 238828, ~: 220338) +LenderTest:testNegativeReportWithDebtPaymentFuzz(uint192,uint64,uint64,uint64) (runs: 256, μ: 329122, ~: 328059) +LenderTest:testOutstandingDebtCalculation(uint192,uint128,uint64,bool) (runs: 256, μ: 240684, ~: 220338) LenderTest:testOutstandingDebtCalculationPaused(uint256,uint256,uint256) (runs: 256, μ: 189511, ~: 194409) LenderTest:testOutstandingDebtCalculationZeroRatio(uint256,uint256) (runs: 256, μ: 127579, ~: 129601) -LenderTest:testPositiveReportWithOutstandingDebtPayment(uint192,uint64,uint64,uint64) (runs: 256, μ: 350805, ~: 352682) +LenderTest:testPositiveReportWithOutstandingDebtPayment(uint192,uint64,uint64,uint64) (runs: 256, μ: 350539, ~: 352682) LenderTest:testReportShouldChangeLastReportTime(bool) (runs: 256, μ: 193834, ~: 193805) LenderTest:testSetBorrowerDebtRatio(uint64,uint64) (runs: 256, μ: 106662, ~: 108392) LenderTest:testSetBorrowerDebtRatioRevertWithBorrowerDoesNotExist(uint256) (runs: 256, μ: 13438, ~: 13438) LenderTest:testSetBorrowerDebtRatioRevertWithExceededRatio(uint256,uint64) (runs: 256, μ: 106111, ~: 106111) -LenderTest:testSetBorrowerDebtRatioWithMultipleBorrowers(uint64,uint64,uint64) (runs: 256, μ: 179114, ~: 183792) +LenderTest:testSetBorrowerDebtRatioWithMultipleBorrowers(uint64,uint64,uint64) (runs: 256, μ: 178958, ~: 183792) LenderTest:testSetMultipleBorrowersDebtRatioRevertWithExceededRatio(uint64,uint64) (runs: 256, μ: 177630, ~: 178952) -LenderTest:testUtilizationRate(uint96,uint256,uint256,uint96,uint96) (runs: 256, μ: 271541, ~: 277686) +LenderTest:testUtilizationRate(uint96,uint256,uint256,uint96,uint96) (runs: 256, μ: 271230, ~: 277686) OpsReadyTest:testFailCallNotByOpsProtected() (gas: 7627) OpsReadyTest:testInvariant(address) (runs: 256, μ: 749082, ~: 749082) OpsReadyTest:testOnlyOpsProtected() (gas: 35535) @@ -215,15 +234,18 @@ PriceConverterTest:testAcceptOnlyPositivePriceNumber(uint256,uint8) (runs: 256, PriceConverterTest:testPriceIsTheSameForTokensWithDifferentDecimals() (gas: 57145) PriceConverterTest:testPriceIsTheSameForTokensWithDifferentDecimalsFuzz(uint8,uint8,uint8) (runs: 256, μ: 54852, ~: 61077) PriceConverterTest:testShouldConvertPrice(uint8) (runs: 256, μ: 63834, ~: 63856) -PriceConverterTest:testShouldConvertPriceIfPriceDecimalsBiggerThan18(uint8) (runs: 256, μ: 61504, ~: 61554) +PriceConverterTest:testShouldConvertPriceIfPriceDecimalsBiggerThan18(uint8) (runs: 256, μ: 61503, ~: 61554) PriceConverterTest:testShouldTakeIntoAccountTheTokensDecimals() (gas: 56597) +SafeERC4626LifecycleTest:invariantMetadata() (runs: 256, calls: 3840, reverts: 1393) +SafeERC4626LifecycleTest:testRegisterAndRunAfterDepositTriggerHook(uint128) (runs: 256, μ: 614355, ~: 623373) +SafeERC4626LifecycleTest:testRegisterAndRunBeforeWithdrawalHook(uint128) (runs: 256, μ: 576720, ~: 595688) SafeInitializableTest:testShouldNotAllowInitializeWhemDisabled() (gas: 190637) SafeInitializableTest:testShouldNotInitializeTwice() (gas: 191658) SafeUUPSUpgradeableTest:testShouldAuthorizeUpgradeFromAuthorizedAddress(address) (runs: 256, μ: 12836, ~: 12836) SafeUUPSUpgradeableTest:testShouldNotAuthorizeUpgradeFromNonAuthorizedAddress(address) (runs: 256, μ: 13624, ~: 13624) -StrategiesLenderTest:testAddingStrategy(uint16) (runs: 256, μ: 175547, ~: 180833) +StrategiesLenderTest:testAddingStrategy(uint16) (runs: 256, μ: 175391, ~: 180833) StrategiesLenderTest:testAddingStrategyToQueue() (gas: 151185) -StrategiesLenderTest:testInterestRatePerBlock(uint256,uint128,uint128,uint128,uint128) (runs: 256, μ: 704449, ~: 707781) +StrategiesLenderTest:testInterestRatePerBlock(uint256,uint128,uint128,uint128,uint128) (runs: 256, μ: 704776, ~: 707781) StrategiesLenderTest:testRemovingStrategy(bool) (runs: 256, μ: 111136, ~: 111305) StrategiesLenderTest:testReorderingWithdrawalQueue() (gas: 595928) StrategiesLenderTest:testReorderingWithdrawalQueueFromNonOwnerAccount() (gas: 595326) @@ -238,52 +260,75 @@ StrategiesLenderTest:testRevertWhenRemovingStrategyFromNonOwnerAccount(bool) (ru StrategiesLenderTest:testRevertWhenRemovingStrategyWithDebt(uint16) (runs: 256, μ: 138219, ~: 138219) StrategiesLenderTest:testRevertWhenRevokingStrategyFromNonOwnerAccount() (gas: 178855) StrategiesLenderTest:testRevokingStrategy(uint16) (runs: 256, μ: 146930, ~: 146930) -VaultTest:testAddingStrategy(uint16) (runs: 256, μ: 163123, ~: 168409) -VaultTest:testAddingStrategyToQueue() (gas: 137068) -VaultTest:testChargingFees() (gas: 5779741) -VaultTest:testChargingFeesFuzz(uint192,uint16,uint16,uint256) (runs: 256, μ: 5778863, ~: 5807736) -VaultTest:testDepositAndAssessShares(uint192) (runs: 256, μ: 165232, ~: 165232) -VaultTest:testDepositReentrance(uint192) (runs: 256, μ: 95703, ~: 97103) -VaultTest:testDepositWhenVaultIsPaused(uint192) (runs: 256, μ: 69003, ~: 69003) -VaultTest:testDepositWithoutAllowance(uint192) (runs: 256, μ: 30377, ~: 30377) -VaultTest:testDepositWithoutBalance(uint192) (runs: 256, μ: 58333, ~: 58568) -VaultTest:testLockedProfitRelease() (gas: 5743053) -VaultTest:testLockedProfitReleaseWithFees() (gas: 5814560) -VaultTest:testLockedProfitReleaseWithNegativeReport() (gas: 5770207) -VaultTest:testRemovingStrategy(bool) (runs: 256, μ: 101846, ~: 102015) -VaultTest:testReorderingWithdrawalQueue() (gas: 584333) -VaultTest:testReorderingWithdrawalQueueFromNonOwnerAccount() (gas: 583731) -VaultTest:testRevertAddingStrategyToQueueIfAlreadyExists() (gas: 126817) -VaultTest:testRevertAddingStrategyToQueueIfNotRegistered() (gas: 17282) -VaultTest:testRevertAddingStrategyToQueueWithZeroAddress() (gas: 10789) -VaultTest:testRevertWhenAddingInvalidStrategy() (gas: 6465986) -VaultTest:testRevertWhenAddingStrategyAndVaultIsPaused() (gas: 38146) +VaultFounderTokenTest:testBurnTokenFail(string) (runs: 256, μ: 249155, ~: 256596) +VaultFounderTokenTest:testCreateMoreTokenThanAllowedFail() (gas: 559128) +VaultFounderTokenTest:testMintToken() (gas: 388512) +VaultFounderTokenTest:testMintTokenFail(string) (runs: 256, μ: 242856, ~: 250306) +VaultFounderTokenTest:testNextTokenPrice() (gas: 587456) +VaultFounderTokenTest:testNextTokenPriceGasUsage() (gas: 40769) +VaultFounderTokenTest:testPriceOf() (gas: 563128) +VaultFounderTokenTest:testPriceOfFail() (gas: 10656) +VaultFounderTokenTest:testSetTokenMultiplier() (gas: 235282) +VaultFounderTokenTest:testSetTokenMultiplierFail() (gas: 106001) +VaultFounderTokenTest:testSetTokenURI() (gas: 211552) +VaultFounderTokenTest:testSetTokenURI2() (gas: 210526) +VaultFounderTokenTest:testSetTokenURI2Fail() (gas: 273461) +VaultFounderTokenTest:testSetTokenURIFail() (gas: 207894) +VaultFounderTokenTest:testSetVault() (gas: 6096156) +VaultFounderTokenTest:testVaultMetadata() (gas: 14810) +VaultTest:testAddingStrategy(uint16) (runs: 256, μ: 162901, ~: 168498) +VaultTest:testAddingStrategyToQueue() (gas: 137104) +VaultTest:testChargingAndFounderFeesFail() (gas: 304697) +VaultTest:testChargingFees() (gas: 6196655) +VaultTest:testChargingFeesFuzz(uint192,uint16,uint16,uint256,uint256) (runs: 256, μ: 6095250, ~: 6080420) +VaultTest:testChargingFoundersFees() (gas: 6455649) +VaultTest:testChargingManagementFeesWithoutVaultFounderToken() (gas: 6172114) +VaultTest:testChargingManagmentAndFoundersFees() (gas: 6531581) +VaultTest:testDepositAndAssessShares(uint192) (runs: 256, μ: 340325, ~: 371118) +VaultTest:testDepositReentrance(uint192) (runs: 256, μ: 95747, ~: 97147) +VaultTest:testDepositWhenVaultIsPaused(uint192) (runs: 256, μ: 69059, ~: 69059) +VaultTest:testDepositWithoutAllowance(uint192) (runs: 256, μ: 30344, ~: 30344) +VaultTest:testDepositWithoutBalance(uint192) (runs: 256, μ: 58323, ~: 58558) +VaultTest:testFounderFeeCanBeClaimed() (gas: 6828675) +VaultTest:testFounderTokenMint(uint192) (runs: 256, μ: 9425180, ~: 9425180) +VaultTest:testFounderTokenMintWithoutVaultFounderToken(uint192) (runs: 256, μ: 5449804, ~: 5449804) +VaultTest:testLockedProfitRelease1() (gas: 6184984) +VaultTest:testLockedProfitReleaseWithFees() (gas: 6318545) +VaultTest:testLockedProfitReleaseWithNegativeReport() (gas: 6212137) +VaultTest:testRemovingStrategy(bool) (runs: 256, μ: 101808, ~: 101980) +VaultTest:testReorderingWithdrawalQueue() (gas: 584267) +VaultTest:testReorderingWithdrawalQueueFromNonOwnerAccount() (gas: 583578) +VaultTest:testRevertAddingStrategyToQueueIfAlreadyExists() (gas: 126905) +VaultTest:testRevertAddingStrategyToQueueIfNotRegistered() (gas: 17348) +VaultTest:testRevertAddingStrategyToQueueWithZeroAddress() (gas: 10899) +VaultTest:testRevertWhenAddingInvalidStrategy() (gas: 6791177) +VaultTest:testRevertWhenAddingStrategyAndVaultIsPaused() (gas: 38212) VaultTest:testRevertWhenAddingStrategyFromNonOwnerAccount() (gas: 15883) -VaultTest:testRevertWhenAddingStrategyToQueueFromNonOwnerAccount() (gas: 15802) -VaultTest:testRevertWhenInitFunctionsCalled() (gas: 21798) -VaultTest:testRevertWhenRemovingMissingStrategy(bool) (runs: 256, μ: 15429, ~: 15429) -VaultTest:testRevertWhenRemovingStrategyFromNonOwnerAccount(bool) (runs: 256, μ: 127246, ~: 127246) -VaultTest:testRevertWhenRemovingStrategyWithDebt(uint16) (runs: 256, μ: 128922, ~: 128924) -VaultTest:testRevertWhenRevokingStrategyFromNonOwnerAccount() (gas: 167111) -VaultTest:testRevertWhenSetLockedProfitReleaseRateWithWrongValue() (gas: 16359) -VaultTest:testRevertWhenSetManagementFeeFromNonOwnerAccount(uint256) (runs: 256, μ: 14072, ~: 14072) -VaultTest:testRevertWhenSetManagementFeeOverMaxAmount() (gas: 10827) -VaultTest:testRevertWhenSetRewardsAddressFromNonOwnerAccount() (gas: 14099) -VaultTest:testRevertWithdrawWhenVaultAndStrategiesHasNoBalance(uint128) (runs: 256, μ: 153729, ~: 153729) -VaultTest:testRevokingStrategy(uint16) (runs: 256, μ: 134401, ~: 134516) -VaultTest:testSetEmergencyShutdown() (gas: 31332) -VaultTest:testSetEmergencyShutdownFromNonOwnerAccount() (gas: 16780) -VaultTest:testSetLockedProfitReleaseRate(uint256) (runs: 256, μ: 22596, ~: 23009) -VaultTest:testSetManagementFee(uint256) (runs: 256, μ: 19092, ~: 19692) -VaultTest:testSetRewardsAddress() (gas: 20284) -VaultTest:testTotalAssetsAmountAfterNegativeReport(uint192,uint256) (runs: 256, μ: 346211, ~: 346278) -VaultTest:testTotalAssetsAmountAfterPositiveReport(uint192,uint256) (runs: 256, μ: 425317, ~: 450244) -VaultTest:testTotalAssetsAmountStaysTheConsistent(uint192) (runs: 256, μ: 862793, ~: 875777) -VaultTest:testUnderlyingAsset() (gas: 9900) -VaultTest:testVaultFromStrategyLendingFunctionality() (gas: 387869) -VaultTest:testVaultMetadata() (gas: 14840) -VaultTest:testVaultToStrategyLendingFunctionality(uint192,uint16) (runs: 256, μ: 311652, ~: 338740) -VaultTest:testWithdrawReentrance(uint192) (runs: 256, μ: 100674, ~: 102074) -VaultTest:testWithdrawWhenVaultShouldTakeFundsFromStrategies(uint128,uint128,uint128) (runs: 256, μ: 444752, ~: 447170) -VaultTest:testWithdrawWithSufficeVaultUnderlyingBalance(uint128) (runs: 256, μ: 142482, ~: 142493) -VaultTest:testWithdrawWithoutUserShareBalance(uint128) (runs: 256, μ: 84596, ~: 84596) \ No newline at end of file +VaultTest:testRevertWhenAddingStrategyToQueueFromNonOwnerAccount() (gas: 15890) +VaultTest:testRevertWhenInitFunctionsCalled() (gas: 24055) +VaultTest:testRevertWhenRemovingMissingStrategy(bool) (runs: 256, μ: 15473, ~: 15473) +VaultTest:testRevertWhenRemovingStrategyFromNonOwnerAccount(bool) (runs: 256, μ: 127312, ~: 127312) +VaultTest:testRevertWhenRemovingStrategyWithDebt(uint16) (runs: 256, μ: 128921, ~: 128923) +VaultTest:testRevertWhenRevokingStrategyFromNonOwnerAccount() (gas: 167139) +VaultTest:testRevertWhenSetLockedProfitReleaseRateWithWrongValue() (gas: 16336) +VaultTest:testRevertWhenSetManagementFeeFromNonOwnerAccount(uint256) (runs: 256, μ: 14094, ~: 14094) +VaultTest:testRevertWhenSetManagementFeeOverMaxAmount() (gas: 13027) +VaultTest:testRevertWhenSetRewardsAddressFromNonOwnerAccount() (gas: 14122) +VaultTest:testRevertWithdrawWhenVaultAndStrategiesHasNoBalance(uint128) (runs: 256, μ: 153753, ~: 153753) +VaultTest:testRevokingStrategy(uint16) (runs: 256, μ: 134414, ~: 134535) +VaultTest:testSetEmergencyShutdown() (gas: 31455) +VaultTest:testSetEmergencyShutdownFromNonOwnerAccount() (gas: 16890) +VaultTest:testSetLockedProfitReleaseRate(uint256) (runs: 256, μ: 22643, ~: 23075) +VaultTest:testSetManagementFee(uint256) (runs: 256, μ: 23380, ~: 23962) +VaultTest:testSetRewardsAddress() (gas: 20397) +VaultTest:testTotalAssetsAmountAfterNegativeReport(uint192,uint256) (runs: 256, μ: 346204, ~: 346256) +VaultTest:testTotalAssetsAmountAfterPositiveReport(uint192,uint256) (runs: 256, μ: 458090, ~: 478219) +VaultTest:testTotalAssetsAmountStaysTheConsistent(uint192) (runs: 256, μ: 862771, ~: 875755) +VaultTest:testUnderlyingAsset() (gas: 9944) +VaultTest:testVaultFromStrategyLendingFunctionality() (gas: 387803) +VaultTest:testVaultMetadata() (gas: 14884) +VaultTest:testVaultToStrategyLendingFunctionality(uint192,uint16) (runs: 256, μ: 310761, ~: 338696) +VaultTest:testWithdrawReentrance(uint192) (runs: 256, μ: 100542, ~: 101942) +VaultTest:testWithdrawWhenVaultShouldTakeFundsFromStrategies(uint128,uint128,uint128) (runs: 256, μ: 448793, ~: 449401) +VaultTest:testWithdrawWithSufficeVaultUnderlyingBalance(uint128) (runs: 256, μ: 142448, ~: 142460) +VaultTest:testWithdrawWithoutUserShareBalance(uint128) (runs: 256, μ: 84597, ~: 84597) \ No newline at end of file diff --git a/packages/contracts/deploy/020_USDT_Vault.deploy.ts b/packages/contracts/deploy/020_USDT_Vault.deploy.ts index a4d90538..ab1a333e 100644 --- a/packages/contracts/deploy/020_USDT_Vault.deploy.ts +++ b/packages/contracts/deploy/020_USDT_Vault.deploy.ts @@ -24,6 +24,7 @@ const func = deployOrUpgrade({ "Eonian USDT Vault Shares", // name "eonUSDT", // symbol [], // defaultOperators + 100, // vault founder tokens fee 1% ], }); diff --git a/packages/contracts/deploy/040_USDT_VaultFounderToken.deploy.ts b/packages/contracts/deploy/040_USDT_VaultFounderToken.deploy.ts new file mode 100644 index 00000000..9faa1a1d --- /dev/null +++ b/packages/contracts/deploy/040_USDT_VaultFounderToken.deploy.ts @@ -0,0 +1,36 @@ +import { deployOrUpgrade } from "../hardhat/deploy-or-upgrade"; +import { BlockchainType } from "../hardhat.config"; + +/** + * Deploy Vault Founder Token contract + */ +const func = deployOrUpgrade({ + contract: "VaultFounderToken", + chains: [ + BlockchainType.Mainnet, + BlockchainType.Testnet, + BlockchainType.Local, + ], + tags: ["asset:USDT"], + dependencies: ["Vault"], + getArgs: () => [ + 100, // maxCountTokens + 12_000, // nextTokenPriceMultiplier + 200, // initialTokenPrice + ], + afterDeploy: async ({ ethers, deployments: { log } }, Strategy, [vault]) => { + log("Adding Vault to VaultFounderToken"); + const Vault = await ethers.getContractAt("Vault", vault.address); + const VaultFounderToken = await ethers.getContract("VaultFounderToken"); + + const txVault = await Vault.setFounders(VaultFounderToken.address); + const resultAddingVaultFounderToken = await txVault.wait(); + log("VaultFounderToken added to vault", resultAddingVaultFounderToken); + + const txVaultFounderToken = await VaultFounderToken.setVault(Vault.address); + const resultAddingVault = await txVaultFounderToken.wait(); + log("Vault added to VaultFounderToken", resultAddingVault); + }, +}); + +export default func; diff --git a/packages/contracts/deployments/deployed.json b/packages/contracts/deployments/deployed.json index 7354feea..5d45a031 100644 --- a/packages/contracts/deployments/deployed.json +++ b/packages/contracts/deployments/deployed.json @@ -7563,6 +7563,51 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "depositHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "founders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "foundersFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "fundAssets", @@ -7638,6 +7683,11 @@ "internalType": "address[]", "name": "_defaultOperators", "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" } ], "name": "initialize", @@ -8321,6 +8371,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_founders", + "type": "address" + } + ], + "name": "setFounders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" + } + ], + "name": "setFoundersFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -8376,23 +8452,2604 @@ "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "strategy", + "type": "address" + } + ], + "name": "strategyRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], + "name": "utilizationRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "withdrawHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "withdrawalQueue", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ] + }, + "VaultFounderToken": { + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fromTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_toTokenId", + "type": "uint256" + } + ], + "name": "BatchMetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IERC5484.BurnAuth", + "name": "burnAuth", + "type": "uint8" + } + ], + "name": "Issued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "MetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "RewardClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "RewardDeposited", + "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": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BALANCE_UPDATER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BURNER_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": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_CLAIMER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "afterDepositTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "beforeWithdrawTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burnAuth", + "outputs": [ + { + "internalType": "enum IERC5484.BurnAuth", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "plusReward", + "type": "uint256" + } + ], + "name": "depositReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "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": "uint256", + "name": "maxCountTokens_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialTokenPrice_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextTokenPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numberCoins", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "priceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "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": [], + "name": "rewardIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardOwnerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "safeMint", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + } + ], + "name": "setNextTokenMultiplier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract Vault", + "name": "vault_", + "type": "address" + } + ], + "name": "setVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "contract Vault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ] + }, + "VaultFounderToken_Implementation": { + "address": "0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78", + "abi": [ + { + "inputs": [ + { + "internalType": "bool", + "name": "needDisableInitializers", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fromTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_toTokenId", + "type": "uint256" + } + ], + "name": "BatchMetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IERC5484.BurnAuth", + "name": "burnAuth", + "type": "uint8" + } + ], + "name": "Issued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "MetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "RewardClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "RewardDeposited", + "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": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "BALANCE_UPDATER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BURNER_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": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_CLAIMER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "afterDepositTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "beforeWithdrawTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burnAuth", + "outputs": [ + { + "internalType": "enum IERC5484.BurnAuth", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "plusReward", + "type": "uint256" + } + ], + "name": "depositReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "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": "uint256", + "name": "maxCountTokens_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialTokenPrice_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextTokenPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numberCoins", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "priceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "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": [], + "name": "rewardIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardOwnerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "safeMint", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + } + ], + "name": "setNextTokenMultiplier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract Vault", + "name": "vault_", + "type": "address" + } + ], + "name": "setVault", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "address", - "name": "strategy", - "type": "address" + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" } ], - "name": "strategyRatio", + "name": "supportsInterface", "outputs": [ { - "internalType": "uint256", + "internalType": "bool", "name": "", - "type": "uint256" + "type": "bool" } ], "stateMutability": "view", @@ -8412,21 +11069,14 @@ "type": "function" }, { - "inputs": [], - "name": "totalAssets", - "outputs": [ + "inputs": [ { "internalType": "uint256", - "name": "", + "name": "index", "type": "uint256" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalDebt", + "name": "tokenByIndex", "outputs": [ { "internalType": "uint256", @@ -8438,8 +11088,19 @@ "type": "function" }, { - "inputs": [], - "name": "totalSupply", + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", "outputs": [ { "internalType": "uint256", @@ -8452,54 +11113,56 @@ }, { "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, { "internalType": "uint256", - "name": "amount", + "name": "tokenId", "type": "uint256" } ], - "name": "transfer", + "name": "tokenURI", "outputs": [ { - "internalType": "bool", + "internalType": "string", "name": "", - "type": "bool" + "type": "string" } ], - "stateMutability": "nonpayable", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", - "name": "holder", + "name": "from", "type": "address" }, { "internalType": "address", - "name": "recipient", + "name": "to", "type": "address" }, { "internalType": "uint256", - "name": "amount", + "name": "tokenId", "type": "uint256" } ], "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -8548,19 +11211,13 @@ "type": "function" }, { - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - } - ], - "name": "utilizationRate", + "inputs": [], + "name": "vault", "outputs": [ { - "internalType": "uint256", + "internalType": "contract Vault", "name": "", - "type": "uint256" + "type": "address" } ], "stateMutability": "view", @@ -8578,94 +11235,85 @@ ], "stateMutability": "pure", "type": "function" - }, + } + ] + }, + "VaultFounderToken_Proxy": { + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "abi": [ { "inputs": [ { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [ + "internalType": "address", + "name": "_logic", + "type": "address" + }, { - "internalType": "uint256", - "name": "shares", - "type": "uint256" + "internalType": "bytes", + "name": "_data", + "type": "bytes" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "payable", + "type": "constructor" }, { + "anonymous": false, "inputs": [ { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { + "indexed": false, "internalType": "address", - "name": "", + "name": "previousAdmin", "type": "address" }, { + "indexed": false, "internalType": "address", - "name": "", + "name": "newAdmin", "type": "address" } ], - "name": "withdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "name": "AdminChanged", + "type": "event" }, { + "anonymous": false, "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "withdrawalQueue", - "outputs": [ - { + "indexed": true, "internalType": "address", - "name": "", + "name": "beacon", "type": "address" } ], - "stateMutability": "view", - "type": "function" + "name": "BeaconUpgraded", + "type": "event" }, { + "anonymous": false, "inputs": [ { + "indexed": true, "internalType": "address", - "name": "_logic", + "name": "implementation", "type": "address" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" } ], + "name": "Upgraded", + "type": "event" + }, + { "stateMutability": "payable", - "type": "constructor" + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" } ] }, "Vault_Implementation": { - "address": "0xbE55cCd98Fd5b2f915768bF73F664B4a0864C5cB", + "address": "0xF716c8d40bA6e7b3C639d5C559Aa17d99f7e6551", "abi": [ { "inputs": [ @@ -9658,6 +12306,51 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "depositHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "founders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "foundersFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "fundAssets", @@ -9733,6 +12426,11 @@ "internalType": "address[]", "name": "_defaultOperators", "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" } ], "name": "initialize", @@ -10416,6 +13114,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_founders", + "type": "address" + } + ], + "name": "setFounders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" + } + ], + "name": "setFoundersFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -10722,6 +13446,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "withdrawHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/packages/contracts/deployments/deployed.ts b/packages/contracts/deployments/deployed.ts index 0e7416a9..13bda214 100644 --- a/packages/contracts/deployments/deployed.ts +++ b/packages/contracts/deployments/deployed.ts @@ -7563,6 +7563,51 @@ export default { "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "depositHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "founders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "foundersFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "fundAssets", @@ -7638,6 +7683,11 @@ export default { "internalType": "address[]", "name": "_defaultOperators", "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" } ], "name": "initialize", @@ -8321,6 +8371,32 @@ export default { "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_founders", + "type": "address" + } + ], + "name": "setFounders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" + } + ], + "name": "setFoundersFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -8376,23 +8452,2604 @@ export default { "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "strategy", + "type": "address" + } + ], + "name": "strategyRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], + "name": "utilizationRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "withdrawHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "withdrawalQueue", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ] + }, + "VaultFounderToken": { + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fromTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_toTokenId", + "type": "uint256" + } + ], + "name": "BatchMetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IERC5484.BurnAuth", + "name": "burnAuth", + "type": "uint8" + } + ], + "name": "Issued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "MetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "RewardClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "RewardDeposited", + "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": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BALANCE_UPDATER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BURNER_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": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_CLAIMER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "afterDepositTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "beforeWithdrawTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burnAuth", + "outputs": [ + { + "internalType": "enum IERC5484.BurnAuth", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "plusReward", + "type": "uint256" + } + ], + "name": "depositReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "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": "uint256", + "name": "maxCountTokens_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialTokenPrice_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextTokenPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numberCoins", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "priceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "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": [], + "name": "rewardIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardOwnerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "safeMint", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + } + ], + "name": "setNextTokenMultiplier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract Vault", + "name": "vault_", + "type": "address" + } + ], + "name": "setVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "contract Vault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ] + }, + "VaultFounderToken_Implementation": { + "address": "0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78", + "abi": [ + { + "inputs": [ + { + "internalType": "bool", + "name": "needDisableInitializers", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fromTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_toTokenId", + "type": "uint256" + } + ], + "name": "BatchMetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IERC5484.BurnAuth", + "name": "burnAuth", + "type": "uint8" + } + ], + "name": "Issued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "MetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "RewardClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "RewardDeposited", + "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": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "BALANCE_UPDATER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BURNER_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": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_CLAIMER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "afterDepositTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "beforeWithdrawTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burnAuth", + "outputs": [ + { + "internalType": "enum IERC5484.BurnAuth", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "plusReward", + "type": "uint256" + } + ], + "name": "depositReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "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": "uint256", + "name": "maxCountTokens_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialTokenPrice_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextTokenPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numberCoins", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "priceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "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": [], + "name": "rewardIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardOwnerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "safeMint", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + } + ], + "name": "setNextTokenMultiplier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract Vault", + "name": "vault_", + "type": "address" + } + ], + "name": "setVault", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "address", - "name": "strategy", - "type": "address" + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" } ], - "name": "strategyRatio", + "name": "supportsInterface", "outputs": [ { - "internalType": "uint256", + "internalType": "bool", "name": "", - "type": "uint256" + "type": "bool" } ], "stateMutability": "view", @@ -8412,21 +11069,14 @@ export default { "type": "function" }, { - "inputs": [], - "name": "totalAssets", - "outputs": [ + "inputs": [ { "internalType": "uint256", - "name": "", + "name": "index", "type": "uint256" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalDebt", + "name": "tokenByIndex", "outputs": [ { "internalType": "uint256", @@ -8438,8 +11088,19 @@ export default { "type": "function" }, { - "inputs": [], - "name": "totalSupply", + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", "outputs": [ { "internalType": "uint256", @@ -8452,54 +11113,56 @@ export default { }, { "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, { "internalType": "uint256", - "name": "amount", + "name": "tokenId", "type": "uint256" } ], - "name": "transfer", + "name": "tokenURI", "outputs": [ { - "internalType": "bool", + "internalType": "string", "name": "", - "type": "bool" + "type": "string" } ], - "stateMutability": "nonpayable", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", - "name": "holder", + "name": "from", "type": "address" }, { "internalType": "address", - "name": "recipient", + "name": "to", "type": "address" }, { "internalType": "uint256", - "name": "amount", + "name": "tokenId", "type": "uint256" } ], "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -8548,19 +11211,13 @@ export default { "type": "function" }, { - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - } - ], - "name": "utilizationRate", + "inputs": [], + "name": "vault", "outputs": [ { - "internalType": "uint256", + "internalType": "contract Vault", "name": "", - "type": "uint256" + "type": "address" } ], "stateMutability": "view", @@ -8578,94 +11235,85 @@ export default { ], "stateMutability": "pure", "type": "function" - }, + } + ] + }, + "VaultFounderToken_Proxy": { + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "abi": [ { "inputs": [ { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [ + "internalType": "address", + "name": "_logic", + "type": "address" + }, { - "internalType": "uint256", - "name": "shares", - "type": "uint256" + "internalType": "bytes", + "name": "_data", + "type": "bytes" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "payable", + "type": "constructor" }, { + "anonymous": false, "inputs": [ { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { + "indexed": false, "internalType": "address", - "name": "", + "name": "previousAdmin", "type": "address" }, { + "indexed": false, "internalType": "address", - "name": "", + "name": "newAdmin", "type": "address" } ], - "name": "withdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "name": "AdminChanged", + "type": "event" }, { + "anonymous": false, "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "withdrawalQueue", - "outputs": [ - { + "indexed": true, "internalType": "address", - "name": "", + "name": "beacon", "type": "address" } ], - "stateMutability": "view", - "type": "function" + "name": "BeaconUpgraded", + "type": "event" }, { + "anonymous": false, "inputs": [ { + "indexed": true, "internalType": "address", - "name": "_logic", + "name": "implementation", "type": "address" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" } ], + "name": "Upgraded", + "type": "event" + }, + { "stateMutability": "payable", - "type": "constructor" + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" } ] }, "Vault_Implementation": { - "address": "0xbE55cCd98Fd5b2f915768bF73F664B4a0864C5cB", + "address": "0xF716c8d40bA6e7b3C639d5C559Aa17d99f7e6551", "abi": [ { "inputs": [ @@ -9658,6 +12306,51 @@ export default { "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "depositHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "founders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "foundersFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "fundAssets", @@ -9733,6 +12426,11 @@ export default { "internalType": "address[]", "name": "_defaultOperators", "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" } ], "name": "initialize", @@ -10416,6 +13114,32 @@ export default { "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_founders", + "type": "address" + } + ], + "name": "setFounders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" + } + ], + "name": "setFoundersFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -10722,6 +13446,25 @@ export default { "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "withdrawHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/packages/contracts/deployments/sepolia/Vault.json b/packages/contracts/deployments/sepolia/Vault.json index b6375688..91d337d6 100644 --- a/packages/contracts/deployments/sepolia/Vault.json +++ b/packages/contracts/deployments/sepolia/Vault.json @@ -989,6 +989,51 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "depositHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "founders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "foundersFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "fundAssets", @@ -1064,6 +1109,11 @@ "internalType": "address[]", "name": "_defaultOperators", "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" } ], "name": "initialize", @@ -1747,6 +1797,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_founders", + "type": "address" + } + ], + "name": "setFounders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" + } + ], + "name": "setFoundersFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -2053,6 +2129,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "withdrawHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -2191,12 +2286,12 @@ "0xD2BA929B68B29521c6c2d7d94C75b9f0ed4F5625", "0x861fe6cb0000000000000000000000006175a8471c2122f778445e7e07a164250a19e6610000000000000000000000005ecc8564556901132aeaae1e55ec3f4ea521dba600000000000000000000000000000000000000000000000000000000000005dc0000000000000000000000000000000000000000000000000000fca32dc55c7100000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000018456f6e69616e2055534454205661756c742053686172657300000000000000000000000000000000000000000000000000000000000000000000000000000007656f6e55534454000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ], - "numDeployments": 2, - "solcInputHash": "fbb06ecd625fb8e32e2a0927532c850e", + "numDeployments": 3, + "solcInputHash": "c49e2950159d0667a0032186292b7773", "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"},\"BeaconUpgraded(address)\":{\"details\":\"Emitted when the beacon is changed.\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":contracts/=src/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":solmate/=lib/solmate/src/\"]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1967.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967 {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x3cbef5ebc24b415252e2f8c0c9254555d30d9f085603b4b80d9b5ed20ab87e90\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/IERC1967.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967Upgrade is IERC1967 {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3b21ae06bf5957f73fa16754b0669c77b7abd8ba6c072d35c3281d446fdb86c2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf09e68aa0dc6722a25bc46490e8d48ed864466d17313b8a0b254c36b54e49899\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x60806040526040516104e13803806104e1833981016040819052610022916102de565b61002e82826000610035565b50506103fb565b61003e83610061565b60008251118061004b5750805b1561005c5761005a83836100a1565b505b505050565b61006a816100cd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100c683836040518060600160405280602781526020016104ba60279139610180565b9392505050565b6001600160a01b0381163b61013f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080856001600160a01b03168560405161019d91906103ac565b600060405180830381855af49150503d80600081146101d8576040519150601f19603f3d011682016040523d82523d6000602084013e6101dd565b606091505b5090925090506101ef868383876101f9565b9695505050505050565b60608315610268578251600003610261576001600160a01b0385163b6102615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610136565b5081610272565b610272838361027a565b949350505050565b81511561028a5781518083602001fd5b8060405162461bcd60e51b815260040161013691906103c8565b634e487b7160e01b600052604160045260246000fd5b60005b838110156102d55781810151838201526020016102bd565b50506000910152565b600080604083850312156102f157600080fd5b82516001600160a01b038116811461030857600080fd5b60208401519092506001600160401b038082111561032557600080fd5b818501915085601f83011261033957600080fd5b81518181111561034b5761034b6102a4565b604051601f8201601f19908116603f01168101908382118183101715610373576103736102a4565b8160405282815288602084870101111561038c57600080fd5b61039d8360208301602088016102ba565b80955050505050509250929050565b600082516103be8184602087016102ba565b9190910192915050565b60208152600082518060208401526103e78160408501602087016102ba565b601f01601f19169190910160400192915050565b60b1806104096000396000f3fe608060405236601057600e6013565b005b600e5b601f601b6021565b6058565b565b600060537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156076573d6000f35b3d6000fdfea2646970667358221220a913bb1324f82fbcd856e3a1700aae977ecf4d4766af60243a7f02f170f8705764736f6c63430008130033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", "deployedBytecode": "0x608060405236601057600e6013565b005b600e5b601f601b6021565b6058565b565b600060537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156076573d6000f35b3d6000fdfea2646970667358221220a913bb1324f82fbcd856e3a1700aae977ecf4d4766af60243a7f02f170f8705764736f6c63430008130033", - "implementation": "0xbE55cCd98Fd5b2f915768bF73F664B4a0864C5cB", + "implementation": "0xF716c8d40bA6e7b3C639d5C559Aa17d99f7e6551", "devdoc": { "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", "events": { diff --git a/packages/contracts/deployments/sepolia/VaultFounderToken.json b/packages/contracts/deployments/sepolia/VaultFounderToken.json new file mode 100644 index 00000000..8cd7cadb --- /dev/null +++ b/packages/contracts/deployments/sepolia/VaultFounderToken.json @@ -0,0 +1,1351 @@ +{ + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fromTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_toTokenId", + "type": "uint256" + } + ], + "name": "BatchMetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IERC5484.BurnAuth", + "name": "burnAuth", + "type": "uint8" + } + ], + "name": "Issued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "MetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "RewardClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "RewardDeposited", + "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": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BALANCE_UPDATER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BURNER_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": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_CLAIMER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "afterDepositTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "beforeWithdrawTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burnAuth", + "outputs": [ + { + "internalType": "enum IERC5484.BurnAuth", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "plusReward", + "type": "uint256" + } + ], + "name": "depositReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "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": "uint256", + "name": "maxCountTokens_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialTokenPrice_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextTokenPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numberCoins", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "priceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "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": [], + "name": "rewardIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardOwnerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "safeMint", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + } + ], + "name": "setNextTokenMultiplier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract Vault", + "name": "vault_", + "type": "address" + } + ], + "name": "setVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "contract Vault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "receipt": { + "to": null, + "from": "0x5eCC8564556901132aEaae1E55eC3F4Ea521DBA6", + "contractAddress": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "transactionIndex": 26, + "gasUsed": "344506", + "logsBloom": "0x00000004000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000002000000000000000000000000000000000000040000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000080200000000000000000040000000000000200000000000400000000000000000000001000000008000000000020000000000000000000040000000000000000000100000000000020008000000000000000000000000000000000000000000000000000000000000001", + "blockHash": "0x361c96f1bdcfac1130082b74c342ba2aa105ca88e5c6ec7d5f74614f759e6255", + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "logs": [ + { + "transactionIndex": 26, + "blockNumber": 3799246, + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000944a7bde4bc84d325aeb3079b193ae1ff2f09b78" + ], + "data": "0x", + "logIndex": 39, + "blockHash": "0x361c96f1bdcfac1130082b74c342ba2aa105ca88e5c6ec7d5f74614f759e6255" + }, + { + "transactionIndex": 26, + "blockNumber": 3799246, + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000005ecc8564556901132aeaae1e55ec3f4ea521dba6", + "0x0000000000000000000000005ecc8564556901132aeaae1e55ec3f4ea521dba6" + ], + "data": "0x", + "logIndex": 40, + "blockHash": "0x361c96f1bdcfac1130082b74c342ba2aa105ca88e5c6ec7d5f74614f759e6255" + }, + { + "transactionIndex": 26, + "blockNumber": 3799246, + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 41, + "blockHash": "0x361c96f1bdcfac1130082b74c342ba2aa105ca88e5c6ec7d5f74614f759e6255" + } + ], + "blockNumber": 3799246, + "cumulativeGasUsed": "3104963", + "status": 1, + "byzantium": true + }, + "args": [ + "0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78", + "0x80d8591100000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000002ee000000000000000000000000000000000000000000000000000000000000000c8" + ], + "numDeployments": 1, + "solcInputHash": "c49e2950159d0667a0032186292b7773", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"},\"BeaconUpgraded(address)\":{\"details\":\"Emitted when the beacon is changed.\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":contracts/=src/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":solmate/=lib/solmate/src/\"]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1967.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967 {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x3cbef5ebc24b415252e2f8c0c9254555d30d9f085603b4b80d9b5ed20ab87e90\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/IERC1967.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967Upgrade is IERC1967 {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3b21ae06bf5957f73fa16754b0669c77b7abd8ba6c072d35c3281d446fdb86c2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf09e68aa0dc6722a25bc46490e8d48ed864466d17313b8a0b254c36b54e49899\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526040516104e13803806104e1833981016040819052610022916102de565b61002e82826000610035565b50506103fb565b61003e83610061565b60008251118061004b5750805b1561005c5761005a83836100a1565b505b505050565b61006a816100cd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100c683836040518060600160405280602781526020016104ba60279139610180565b9392505050565b6001600160a01b0381163b61013f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080856001600160a01b03168560405161019d91906103ac565b600060405180830381855af49150503d80600081146101d8576040519150601f19603f3d011682016040523d82523d6000602084013e6101dd565b606091505b5090925090506101ef868383876101f9565b9695505050505050565b60608315610268578251600003610261576001600160a01b0385163b6102615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610136565b5081610272565b610272838361027a565b949350505050565b81511561028a5781518083602001fd5b8060405162461bcd60e51b815260040161013691906103c8565b634e487b7160e01b600052604160045260246000fd5b60005b838110156102d55781810151838201526020016102bd565b50506000910152565b600080604083850312156102f157600080fd5b82516001600160a01b038116811461030857600080fd5b60208401519092506001600160401b038082111561032557600080fd5b818501915085601f83011261033957600080fd5b81518181111561034b5761034b6102a4565b604051601f8201601f19908116603f01168101908382118183101715610373576103736102a4565b8160405282815288602084870101111561038c57600080fd5b61039d8360208301602088016102ba565b80955050505050509250929050565b600082516103be8184602087016102ba565b9190910192915050565b60208152600082518060208401526103e78160408501602087016102ba565b601f01601f19169190910160400192915050565b60b1806104096000396000f3fe608060405236601057600e6013565b005b600e5b601f601b6021565b6058565b565b600060537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156076573d6000f35b3d6000fdfea2646970667358221220a913bb1324f82fbcd856e3a1700aae977ecf4d4766af60243a7f02f170f8705764736f6c63430008130033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x608060405236601057600e6013565b005b600e5b601f601b6021565b6058565b565b600060537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156076573d6000f35b3d6000fdfea2646970667358221220a913bb1324f82fbcd856e3a1700aae977ecf4d4766af60243a7f02f170f8705764736f6c63430008130033", + "execute": { + "methodName": "initialize", + "args": [ + 100, + 12000, + 200 + ] + }, + "implementation": "0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78", + "devdoc": { + "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + }, + "BeaconUpgraded(address)": { + "details": "Emitted when the beacon is changed." + }, + "Upgraded(address)": { + "details": "Emitted when the implementation is upgraded." + } + }, + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/sepolia/VaultFounderToken_Implementation.json b/packages/contracts/deployments/sepolia/VaultFounderToken_Implementation.json new file mode 100644 index 00000000..406572ad --- /dev/null +++ b/packages/contracts/deployments/sepolia/VaultFounderToken_Implementation.json @@ -0,0 +1,2003 @@ +{ + "address": "0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78", + "abi": [ + { + "inputs": [ + { + "internalType": "bool", + "name": "needDisableInitializers", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fromTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_toTokenId", + "type": "uint256" + } + ], + "name": "BatchMetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IERC5484.BurnAuth", + "name": "burnAuth", + "type": "uint8" + } + ], + "name": "Issued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "MetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "RewardClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "RewardDeposited", + "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": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "BALANCE_UPDATER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BURNER_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": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_CLAIMER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "afterDepositTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requestSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderMaxWithdraw", + "type": "uint256" + }, + { + "internalType": "uint256[46]", + "name": "gap", + "type": "uint256[46]" + } + ], + "internalType": "struct ERC4626UpgradeableRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "beforeWithdrawTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burnAuth", + "outputs": [ + { + "internalType": "enum IERC5484.BurnAuth", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "plusReward", + "type": "uint256" + } + ], + "name": "depositReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "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": "uint256", + "name": "maxCountTokens_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialTokenPrice_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextTokenPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numberCoins", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "priceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "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": [], + "name": "rewardIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardOwnerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "safeMint", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nextTokenPriceMultiplier_", + "type": "uint256" + } + ], + "name": "setNextTokenMultiplier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_tokenURI", + "type": "string" + } + ], + "name": "setTokenURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract Vault", + "name": "vault_", + "type": "address" + } + ], + "name": "setVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "contract Vault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x14a80e40867b22f814fb3a7444ef3fc23832bc0e33cceb37a69604ae8d99339a", + "receipt": { + "to": null, + "from": "0x5eCC8564556901132aEaae1E55eC3F4Ea521DBA6", + "contractAddress": "0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78", + "transactionIndex": 42, + "gasUsed": "3688250", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000040000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000080000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x77bb4bb39dff143ced7726815c4f7fcaedb743de1eb4513cd00ba19995792a0f", + "transactionHash": "0x14a80e40867b22f814fb3a7444ef3fc23832bc0e33cceb37a69604ae8d99339a", + "logs": [ + { + "transactionIndex": 42, + "blockNumber": 3799245, + "transactionHash": "0x14a80e40867b22f814fb3a7444ef3fc23832bc0e33cceb37a69604ae8d99339a", + "address": "0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 113, + "blockHash": "0x77bb4bb39dff143ced7726815c4f7fcaedb743de1eb4513cd00ba19995792a0f" + } + ], + "blockNumber": 3799245, + "cumulativeGasUsed": "8590091", + "status": 1, + "byzantium": true + }, + "args": [ + true + ], + "numDeployments": 1, + "solcInputHash": "c49e2950159d0667a0032186292b7773", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"needDisableInitializers\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_fromTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_toTokenId\",\"type\":\"uint256\"}],\"name\":\"BatchMetadataUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum IERC5484.BurnAuth\",\"name\":\"burnAuth\",\"type\":\"uint8\"}],\"name\":\"Issued\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"MetadataUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"RewardClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"RewardDeposited\",\"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\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BALANCE_UPDATER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURNER_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\":\"MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REWARD_CLAIMER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"requestSender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"senderMaxWithdraw\",\"type\":\"uint256\"},{\"internalType\":\"uint256[46]\",\"name\":\"gap\",\"type\":\"uint256[46]\"}],\"internalType\":\"struct ERC4626UpgradeableRequest\",\"name\":\"request\",\"type\":\"tuple\"}],\"name\":\"afterDepositTrigger\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"requestSender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"senderMaxWithdraw\",\"type\":\"uint256\"},{\"internalType\":\"uint256[46]\",\"name\":\"gap\",\"type\":\"uint256[46]\"}],\"internalType\":\"struct ERC4626UpgradeableRequest\",\"name\":\"request\",\"type\":\"tuple\"}],\"name\":\"beforeWithdrawTrigger\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"burnAuth\",\"outputs\":[{\"internalType\":\"enum IERC5484.BurnAuth\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"plusReward\",\"type\":\"uint256\"}],\"name\":\"depositReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"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\":\"uint256\",\"name\":\"maxCountTokens_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nextTokenPriceMultiplier_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initialTokenPrice_\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextTokenPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberCoins\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"priceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"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\":[],\"name\":\"rewardIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewardOwnerIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"uri\",\"type\":\"string\"}],\"name\":\"safeMint\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nextTokenPriceMultiplier_\",\"type\":\"uint256\"}],\"name\":\"setNextTokenMultiplier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenURI\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"setTokenURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenURI\",\"type\":\"string\"}],\"name\":\"setTokenURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract Vault\",\"name\":\"vault_\",\"type\":\"address\"}],\"name\":\"setVault\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vault\",\"outputs\":[{\"internalType\":\"contract Vault\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"},\"Approval(address,address,uint256)\":{\"details\":\"Emitted when `owner` enables `approved` to manage the `tokenId` token.\"},\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\"},\"BatchMetadataUpdate(uint256,uint256)\":{\"details\":\"This event emits when the metadata of a range of tokens is changed. So that the third-party platforms such as NFT market could timely update the images and related attributes of the NFTs.\"},\"BeaconUpgraded(address)\":{\"details\":\"Emitted when the beacon is changed.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Issued(address,address,uint256,uint8)\":{\"details\":\"This emit is an add-on to nft's transfer emit in order to distinguish sbt from vanilla nft while providing backward compatibility.\",\"params\":{\"from\":\"The issuer\",\"to\":\"The receiver\",\"tokenId\":\"The id of the issued token\"}},\"MetadataUpdate(uint256)\":{\"details\":\"This event emits when the metadata of a token is changed. So that the third-party platforms such as NFT market could timely update the images and related attributes of the NFT.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `tokenId` token is transferred from `from` to `to`.\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\"},\"burn(uint256)\":{\"details\":\"Burns `tokenId`. See {ERC721-_burn}.\"},\"burnAuth(uint256)\":{\"details\":\"unassigned tokenIds are invalid, and queries do throw\",\"params\":{\"tokenId\":\"The identifier for a token.\"}},\"claimReward()\":{\"details\":\"claim reward for token owner\"},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"depositReward(uint256)\":{\"details\":\"deposit reward to the contract to be claimed by token owners\",\"params\":{\"plusReward\":\"amount of reward to be deposited\"}},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"nextTokenPrice()\":{\"details\":\"calculate price for the next token\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"details\":\"See {IERC721-ownerOf}.\"},\"priceOf(uint256)\":{\"details\":\"implementation for calculate price for the next token based on the current sequential token id\"},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"safeMint(address,string)\":{\"details\":\"function for mint new SBT token\",\"params\":{\"to\":\"address of user who will receive token\",\"uri\":\"token metadata uri\"},\"returns\":{\"_0\":\"true if token was minted\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"setNextTokenMultiplier(uint256)\":{\"details\":\"set multiplicator for the next token in percents in case nextTokenPriceMultiplier_ = 13_000 the next price of the token will be: curPrice * 130%\",\"params\":{\"nextTokenPriceMultiplier_\":\"persent multiplicator\"}},\"setTokenURI(string)\":{\"details\":\"set token metadata uri can be used as utility method and custom logic on front-end\"},\"setTokenURI(string,uint256)\":{\"details\":\"set token metadata uri can be used as utility method and custom logic on front-end by owner of the contract in case of end user has a wrong uri or somebody corrupted it\"},\"setVault(address)\":{\"details\":\"set vault\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenByIndex(uint256)\":{\"details\":\"See {IERC721Enumerable-tokenByIndex}.\"},\"tokenOfOwnerByIndex(address,uint256)\":{\"details\":\"See {IERC721Enumerable-tokenOfOwnerByIndex}.\"},\"tokenURI(uint256)\":{\"details\":\"See {IERC721Metadata-tokenURI}.\"},\"totalSupply()\":{\"details\":\"See {IERC721Enumerable-totalSupply}.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"upgradeTo(address)\":{\"custom:oz-upgrades-unsafe-allow-reachable\":\"delegatecall\",\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"custom:oz-upgrades-unsafe-allow-reachable\":\"delegatecall\",\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"version()\":{\"returns\":{\"_0\":\"a version in semantic versioning format\"}}},\"stateVariables\":{\"__gap\":{\"details\":\"This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\"}},\"version\":1},\"userdoc\":{\"events\":{\"Issued(address,address,uint256,uint8)\":{\"notice\":\"Emitted when a soulbound token is issued.\"},\"RewardClaimed(uint256,address)\":{\"notice\":\"Emitted reward is claimed by a token owner\"},\"RewardDeposited(address,uint256)\":{\"notice\":\"Emitted when new rewards are deposited\"}},\"kind\":\"user\",\"methods\":{\"burnAuth(uint256)\":{\"notice\":\"provides burn authorization of the token id.\"},\"depositReward(uint256)\":{\"notice\":\"only role with BALANCE_UPDATER_ROLE can call this function\"},\"rewardIndex()\":{\"notice\":\"Accumulator of the total earned interest rate since the opening of the token\"},\"rewardOwnerIndex(address)\":{\"notice\":\"The owners' reward indexes for eachas of the last time they accrued\"},\"setVault(address)\":{\"notice\":\"that is mandatory to be set before reward can be claimed\"},\"version()\":{\"notice\":\"Returns the current version of this contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/tokens/VaultFounderToken.sol\":\"VaultFounderToken\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":contracts/=src/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":solmate/=lib/solmate/src/\"]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => 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 a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).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 override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\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 override 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 override 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 override 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 `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\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 Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\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 signaling this.\\n *\\n * _Available since v3.1._\\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, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\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 `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165Upgradeable.sol\\\";\\n\",\"keccak256\":\"0x121966b3220d263a6669dcf59c1254bd48ed237adf4d8a595add70a7927eada1\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967Upgradeable {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x47d6e06872b12e72c79d1b5eb55842f860b5fb1207b2317c2358d2766b950a7b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC4906Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4906.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"./IERC721Upgradeable.sol\\\";\\n\\n/// @title EIP-721 Metadata Update Extension\\ninterface IERC4906Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\\n /// @dev This event emits when the metadata of a token is changed.\\n /// So that the third-party platforms such as NFT market could\\n /// timely update the images and related attributes of the NFT.\\n event MetadataUpdate(uint256 _tokenId);\\n\\n /// @dev This event emits when the metadata of a range of tokens is changed.\\n /// So that the third-party platforms such as NFT market could\\n /// timely update the images and related attributes of the NFTs.\\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\\n}\\n\",\"keccak256\":\"0x869de080935f0a9f8ae29134bc7bd33176d2912ab13f080ff678a5a26ea542b7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC721/IERC721Upgradeable.sol\\\";\\n\",\"keccak256\":\"0x9256117dac3a66dbce2e7245c6ceb7361f8ae7425e3d896ac26ecece3e3d12e3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1967Upgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x584ebdf9c1118a7c773f98788e3f3ede01982bdf8932aa06f5acc7d54876e161\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeTo(address newImplementation) public virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xb607cb94c27e89750f5ae2ccebcb94e654e926f6125f4fd4c6262c89875118ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {\\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 bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal onlyInitializing {\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal onlyInitializing {\\n _paused = false;\\n }\\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 require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\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 /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x40c636b4572ff5f1dc50cf22097e93c0723ee14eff87e99ac2b02636eeca1250\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\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 function __ReentrancyGuard_init() internal onlyInitializing {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb82ef33f43b6b96109687d91b39c94573fdccaaa423fe28e8ba0977b31c023e0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1f0f5f62f67a881cd1a9597acbc0a5e4071f3c2c10449a183b922ae7272e3f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20PermitUpgradeable {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xd60f939a3ca0199014d079b4dd66aa757954334947d81eb5c1d35d7a83061ab3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\nimport \\\"../extensions/IERC20PermitUpgradeable.sol\\\";\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\\n * 0 before setting it to a non-zero value.\\n */\\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20PermitUpgradeable token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x4dae161227d332808312ee2caf6384929321b83c16cc89b5642985fbec6b814c\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721ReceiverUpgradeable {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721EnumerableUpgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\\n * enumerability of all the token ids in the contract as well as all token ids owned by each\\n * account.\\n */\\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\\n function __ERC721Enumerable_init() internal onlyInitializing {\\n }\\n\\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\\n }\\n // Mapping from owner to list of owned token IDs\\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\\n\\n // Mapping from token ID to index of the owner tokens list\\n mapping(uint256 => uint256) private _ownedTokensIndex;\\n\\n // Array with all token ids, used for enumeration\\n uint256[] private _allTokens;\\n\\n // Mapping from token id to position in the allTokens array\\n mapping(uint256 => uint256) private _allTokensIndex;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\\n */\\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\\n require(index < ERC721Upgradeable.balanceOf(owner), \\\"ERC721Enumerable: owner index out of bounds\\\");\\n return _ownedTokens[owner][index];\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _allTokens.length;\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-tokenByIndex}.\\n */\\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \\\"ERC721Enumerable: global index out of bounds\\\");\\n return _allTokens[index];\\n }\\n\\n /**\\n * @dev See {ERC721-_beforeTokenTransfer}.\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual override {\\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\\n\\n if (batchSize > 1) {\\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\\n revert(\\\"ERC721Enumerable: consecutive transfers not supported\\\");\\n }\\n\\n uint256 tokenId = firstTokenId;\\n\\n if (from == address(0)) {\\n _addTokenToAllTokensEnumeration(tokenId);\\n } else if (from != to) {\\n _removeTokenFromOwnerEnumeration(from, tokenId);\\n }\\n if (to == address(0)) {\\n _removeTokenFromAllTokensEnumeration(tokenId);\\n } else if (to != from) {\\n _addTokenToOwnerEnumeration(to, tokenId);\\n }\\n }\\n\\n /**\\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\\n * @param to address representing the new owner of the given token ID\\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\\n */\\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\\n uint256 length = ERC721Upgradeable.balanceOf(to);\\n _ownedTokens[to][length] = tokenId;\\n _ownedTokensIndex[tokenId] = length;\\n }\\n\\n /**\\n * @dev Private function to add a token to this extension's token tracking data structures.\\n * @param tokenId uint256 ID of the token to be added to the tokens list\\n */\\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\\n _allTokensIndex[tokenId] = _allTokens.length;\\n _allTokens.push(tokenId);\\n }\\n\\n /**\\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\\n * @param from address representing the previous owner of the given token ID\\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\\n */\\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary\\n if (tokenIndex != lastTokenIndex) {\\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\\n\\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n }\\n\\n // This also deletes the contents at the last position of the array\\n delete _ownedTokensIndex[tokenId];\\n delete _ownedTokens[from][lastTokenIndex];\\n }\\n\\n /**\\n * @dev Private function to remove a token from this extension's token tracking data structures.\\n * This has O(1) time complexity, but alters the order of the _allTokens array.\\n * @param tokenId uint256 ID of the token to be removed from the tokens list\\n */\\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = _allTokens.length - 1;\\n uint256 tokenIndex = _allTokensIndex[tokenId];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\\n uint256 lastTokenId = _allTokens[lastTokenIndex];\\n\\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n\\n // This also deletes the contents at the last position of the array\\n delete _allTokensIndex[tokenId];\\n _allTokens.pop();\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[46] private __gap;\\n}\\n\",\"keccak256\":\"0x2c98457c4171d86094adf9a4fd8cd2402b7e3e309e961f07910a60a576dd100f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/extensions/ERC721URIStorage.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC721Upgradeable.sol\\\";\\nimport \\\"../../../interfaces/IERC4906Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev ERC721 token with storage based token URI management.\\n */\\nabstract contract ERC721URIStorageUpgradeable is Initializable, IERC4906Upgradeable, ERC721Upgradeable {\\n function __ERC721URIStorage_init() internal onlyInitializing {\\n }\\n\\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\\n }\\n using StringsUpgradeable for uint256;\\n\\n // Optional mapping for token URIs\\n mapping(uint256 => string) private _tokenURIs;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) {\\n return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory _tokenURI = _tokenURIs[tokenId];\\n string memory base = _baseURI();\\n\\n // If there is no base URI, return the token URI.\\n if (bytes(base).length == 0) {\\n return _tokenURI;\\n }\\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\\n if (bytes(_tokenURI).length > 0) {\\n return string(abi.encodePacked(base, _tokenURI));\\n }\\n\\n return super.tokenURI(tokenId);\\n }\\n\\n /**\\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\\n *\\n * Emits {MetadataUpdate}.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\\n require(_exists(tokenId), \\\"ERC721URIStorage: URI set of nonexistent token\\\");\\n _tokenURIs[tokenId] = _tokenURI;\\n\\n emit MetadataUpdate(tokenId);\\n }\\n\\n /**\\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\\n * token-specific URI was set for the token, and if so, it deletes the token URI from\\n * the storage mapping.\\n */\\n function _burn(uint256 tokenId) internal virtual override {\\n super._burn(tokenId);\\n\\n if (bytes(_tokenURIs[tokenId]).length != 0) {\\n delete _tokenURIs[tokenId];\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x486985bf5203d0ee4568f8f89ae35b8accf6a95ecee280435102eedb807c2764\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\\n /**\\n * @dev Returns the total amount of tokens stored by the contract.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\\n */\\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\\n\\n /**\\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\\n * Use along with {totalSupply} to enumerate all tokens.\\n */\\n function tokenByIndex(uint256 index) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xf1870306db8391db9cf14b41be0da76857a88df0e5c623d2b2338fb30a3bd5ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/ERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC777Upgradeable.sol\\\";\\nimport \\\"./IERC777RecipientUpgradeable.sol\\\";\\nimport \\\"./IERC777SenderUpgradeable.sol\\\";\\nimport \\\"../ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/IERC1820RegistryUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC777} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n *\\n * Support for ERC20 is included in this contract, as specified by the EIP: both\\n * the ERC777 and ERC20 interfaces can be safely used when interacting with it.\\n * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token\\n * movements.\\n *\\n * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there\\n * are no special restrictions in the amount of tokens that created, moved, or\\n * destroyed. This makes integration with ERC20 applications seamless.\\n *\\n * CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.\\n */\\ncontract ERC777Upgradeable is Initializable, ContextUpgradeable, IERC777Upgradeable, IERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n IERC1820RegistryUpgradeable internal constant _ERC1820_REGISTRY = IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\\n\\n mapping(address => uint256) private _balances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256(\\\"ERC777TokensSender\\\");\\n bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\\\"ERC777TokensRecipient\\\");\\n\\n // This isn't ever read from - it's only used to respond to the defaultOperators query.\\n address[] private _defaultOperatorsArray;\\n\\n // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).\\n mapping(address => bool) private _defaultOperators;\\n\\n // For each account, a mapping of its operators and revoked default operators.\\n mapping(address => mapping(address => bool)) private _operators;\\n mapping(address => mapping(address => bool)) private _revokedDefaultOperators;\\n\\n // ERC20-allowances\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n /**\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __ERC777_init(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\\n __ERC777_init_unchained(name_, symbol_, defaultOperators_);\\n }\\n\\n function __ERC777_init_unchained(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n\\n _defaultOperatorsArray = defaultOperators_;\\n for (uint256 i = 0; i < defaultOperators_.length; i++) {\\n _defaultOperators[defaultOperators_[i]] = true;\\n }\\n\\n // register interfaces\\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\\\"ERC777Token\\\"), address(this));\\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\\\"ERC20Token\\\"), address(this));\\n }\\n\\n /**\\n * @dev See {IERC777-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC777-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {ERC20-decimals}.\\n *\\n * Always returns 18, as per the\\n * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\\n */\\n function decimals() public pure virtual returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC777-granularity}.\\n *\\n * This implementation always returns `1`.\\n */\\n function granularity() public view virtual override returns (uint256) {\\n return 1;\\n }\\n\\n /**\\n * @dev See {IERC777-totalSupply}.\\n */\\n function totalSupply() public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`tokenHolder`).\\n */\\n function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\\n return _balances[tokenHolder];\\n }\\n\\n /**\\n * @dev See {IERC777-send}.\\n *\\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\\n */\\n function send(address recipient, uint256 amount, bytes memory data) public virtual override {\\n _send(_msgSender(), recipient, amount, data, \\\"\\\", true);\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}\\n * interface if it is a contract.\\n *\\n * Also emits a {Sent} event.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _send(_msgSender(), recipient, amount, \\\"\\\", \\\"\\\", false);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC777-burn}.\\n *\\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\\n */\\n function burn(uint256 amount, bytes memory data) public virtual override {\\n _burn(_msgSender(), amount, data, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC777-isOperatorFor}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) {\\n return\\n operator == tokenHolder ||\\n (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||\\n _operators[tokenHolder][operator];\\n }\\n\\n /**\\n * @dev See {IERC777-authorizeOperator}.\\n */\\n function authorizeOperator(address operator) public virtual override {\\n require(_msgSender() != operator, \\\"ERC777: authorizing self as operator\\\");\\n\\n if (_defaultOperators[operator]) {\\n delete _revokedDefaultOperators[_msgSender()][operator];\\n } else {\\n _operators[_msgSender()][operator] = true;\\n }\\n\\n emit AuthorizedOperator(operator, _msgSender());\\n }\\n\\n /**\\n * @dev See {IERC777-revokeOperator}.\\n */\\n function revokeOperator(address operator) public virtual override {\\n require(operator != _msgSender(), \\\"ERC777: revoking self as operator\\\");\\n\\n if (_defaultOperators[operator]) {\\n _revokedDefaultOperators[_msgSender()][operator] = true;\\n } else {\\n delete _operators[_msgSender()][operator];\\n }\\n\\n emit RevokedOperator(operator, _msgSender());\\n }\\n\\n /**\\n * @dev See {IERC777-defaultOperators}.\\n */\\n function defaultOperators() public view virtual override returns (address[] memory) {\\n return _defaultOperatorsArray;\\n }\\n\\n /**\\n * @dev See {IERC777-operatorSend}.\\n *\\n * Emits {Sent} and {IERC20-Transfer} events.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes memory data,\\n bytes memory operatorData\\n ) public virtual override {\\n require(isOperatorFor(_msgSender(), sender), \\\"ERC777: caller is not an operator for holder\\\");\\n _send(sender, recipient, amount, data, operatorData, true);\\n }\\n\\n /**\\n * @dev See {IERC777-operatorBurn}.\\n *\\n * Emits {Burned} and {IERC20-Transfer} events.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes memory data,\\n bytes memory operatorData\\n ) public virtual override {\\n require(isOperatorFor(_msgSender(), account), \\\"ERC777: caller is not an operator for holder\\\");\\n _burn(account, amount, data, operatorData);\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n *\\n * Note that operator and allowance concepts are orthogonal: operators may\\n * not have allowance, and accounts with allowance may not be operators\\n * themselves.\\n */\\n function allowance(address holder, address spender) public view virtual override returns (uint256) {\\n return _allowances[holder][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Note that accounts cannot have allowance issued by their operators.\\n */\\n function approve(address spender, uint256 value) public virtual override returns (bool) {\\n address holder = _msgSender();\\n _approve(holder, spender, value);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Note that operator and allowance concepts are orthogonal: operators cannot\\n * call `transferFrom` (unless they have allowance), and accounts with\\n * allowance cannot call `operatorSend` (unless they are operators).\\n *\\n * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\\n */\\n function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(holder, spender, amount);\\n _send(holder, recipient, amount, \\\"\\\", \\\"\\\", false);\\n return true;\\n }\\n\\n /**\\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with the caller address as the `operator` and with\\n * `userData` and `operatorData`.\\n *\\n * See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits {Minted} and {IERC20-Transfer} events.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - if `account` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual {\\n _mint(account, amount, userData, operatorData, true);\\n }\\n\\n /**\\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * If `requireReceptionAck` is set to true, and if a send hook is\\n * registered for `account`, the corresponding function will be called with\\n * `operator`, `data` and `operatorData`.\\n *\\n * See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits {Minted} and {IERC20-Transfer} events.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - if `account` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function _mint(\\n address account,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) internal virtual {\\n require(account != address(0), \\\"ERC777: mint to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, address(0), account, amount);\\n\\n // Update state variables\\n _totalSupply += amount;\\n _balances[account] += amount;\\n\\n _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck);\\n\\n emit Minted(operator, account, amount, userData, operatorData);\\n emit Transfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Send tokens\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\\n */\\n function _send(\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) internal virtual {\\n require(from != address(0), \\\"ERC777: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC777: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _callTokensToSend(operator, from, to, amount, userData, operatorData);\\n\\n _move(operator, from, to, amount, userData, operatorData);\\n\\n _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);\\n }\\n\\n /**\\n * @dev Burn tokens\\n * @param from address token holder address\\n * @param amount uint256 amount of tokens to burn\\n * @param data bytes extra information provided by the token holder\\n * @param operatorData bytes extra information provided by the operator (if any)\\n */\\n function _burn(address from, uint256 amount, bytes memory data, bytes memory operatorData) internal virtual {\\n require(from != address(0), \\\"ERC777: burn from the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _callTokensToSend(operator, from, address(0), amount, data, operatorData);\\n\\n _beforeTokenTransfer(operator, from, address(0), amount);\\n\\n // Update state variables\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC777: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Burned(operator, from, amount, data, operatorData);\\n emit Transfer(from, address(0), amount);\\n }\\n\\n function _move(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData\\n ) private {\\n _beforeTokenTransfer(operator, from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC777: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _balances[to] += amount;\\n\\n emit Sent(operator, from, to, amount, userData, operatorData);\\n emit Transfer(from, to, amount);\\n }\\n\\n /**\\n * @dev See {ERC20-_approve}.\\n *\\n * Note that accounts cannot have allowance issued by their operators.\\n */\\n function _approve(address holder, address spender, uint256 value) internal virtual {\\n require(holder != address(0), \\\"ERC777: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC777: approve to the zero address\\\");\\n\\n _allowances[holder][spender] = value;\\n emit Approval(holder, spender, value);\\n }\\n\\n /**\\n * @dev Call from.tokensToSend() if the interface is registered\\n * @param operator address operator requesting the transfer\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n */\\n function _callTokensToSend(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData\\n ) private {\\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);\\n if (implementer != address(0)) {\\n IERC777SenderUpgradeable(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);\\n }\\n }\\n\\n /**\\n * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but\\n * tokensReceived() was not registered for the recipient\\n * @param operator address operator requesting the transfer\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\\n */\\n function _callTokensReceived(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) private {\\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);\\n if (implementer != address(0)) {\\n IERC777RecipientUpgradeable(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);\\n } else if (requireReceptionAck) {\\n require(!to.isContract(), \\\"ERC777: token recipient contract has no implementer for ERC777TokensRecipient\\\");\\n }\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {IERC20-Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC777: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes\\n * calls to {send}, {transfer}, {operatorSend}, {transferFrom}, minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be to transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address operator, address from, address to, uint256 amount) internal virtual {}\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[41] private __gap;\\n}\\n\",\"keccak256\":\"0x828f2bcdf4a940221fffc84f904d1ae56f25cf90039b73572e3ec71c995abee2\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\\n *\\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\\n * contract implement this interface (contract holders can be their own\\n * implementer) and registering it on the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\\n *\\n * See {IERC1820Registry} and {ERC1820Implementer}.\\n */\\ninterface IERC777RecipientUpgradeable {\\n /**\\n * @dev Called by an {IERC777} token contract whenever tokens are being\\n * moved or created into a registered account (`to`). The type of operation\\n * is conveyed by `from` being the zero address or not.\\n *\\n * This call occurs _after_ the token contract's state is updated, so\\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\\n *\\n * This function may revert to prevent the operation from being executed.\\n */\\n function tokensReceived(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes calldata userData,\\n bytes calldata operatorData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1fbcfef49c67aea4ca9417b337a363e933127047e73194011b78c1741602615b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777TokensSender standard as defined in the EIP.\\n *\\n * {IERC777} Token holders can be notified of operations performed on their\\n * tokens by having a contract implement this interface (contract holders can be\\n * their own implementer) and registering it on the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\\n *\\n * See {IERC1820Registry} and {ERC1820Implementer}.\\n */\\ninterface IERC777SenderUpgradeable {\\n /**\\n * @dev Called by an {IERC777} token contract whenever a registered holder's\\n * (`from`) tokens are about to be moved or destroyed. The type of operation\\n * is conveyed by `to` being the zero address or not.\\n *\\n * This call occurs _before_ the token contract's state is updated, so\\n * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.\\n *\\n * This function may revert to prevent the operation from being executed.\\n */\\n function tokensToSend(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes calldata userData,\\n bytes calldata operatorData\\n ) external;\\n}\\n\",\"keccak256\":\"0x79fc5ced00b0715d84b75e016754292e434cf2cbbc58c1f275ef0754653a6d78\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777Upgradeable {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0xfcc6168646fb2829c61565249e12d02ea4bd2831faebe1ca096412ceca37bd02\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Counters\\n * @author Matt Condon (@shrugs)\\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\\n *\\n * Include with `using Counters for Counters.Counter;`\\n */\\nlibrary CountersUpgradeable {\\n struct Counter {\\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\\n // this feature: see https://github.com/ethereum/solidity/issues/4637\\n uint256 _value; // default: 0\\n }\\n\\n function current(Counter storage counter) internal view returns (uint256) {\\n return counter._value;\\n }\\n\\n function increment(Counter storage counter) internal {\\n unchecked {\\n counter._value += 1;\\n }\\n }\\n\\n function decrement(Counter storage counter) internal {\\n uint256 value = counter._value;\\n require(value > 0, \\\"Counter: decrement overflow\\\");\\n unchecked {\\n counter._value = value - 1;\\n }\\n }\\n\\n function reset(Counter storage counter) internal {\\n counter._value = 0;\\n }\\n}\\n\",\"keccak256\":\"0x798741e231b22b81e2dd2eddaaf8832dee4baf5cd8e2dbaa5c1dd12a1c053c4d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x07ac95acad040f1fb1f6120dd0aa5f702db69446e95f82613721879d30de0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC1820RegistryUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/IERC1820Registry.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the global ERC1820 Registry, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register\\n * implementers for interfaces in this registry, as well as query support.\\n *\\n * Implementers may be shared by multiple accounts, and can also implement more\\n * than a single interface for each account. Contracts can implement interfaces\\n * for themselves, but externally-owned accounts (EOA) must delegate this to a\\n * contract.\\n *\\n * {IERC165} interfaces can also be queried via the registry.\\n *\\n * For an in-depth explanation and source code analysis, see the EIP text.\\n */\\ninterface IERC1820RegistryUpgradeable {\\n event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);\\n\\n event ManagerChanged(address indexed account, address indexed newManager);\\n\\n /**\\n * @dev Sets `newManager` as the manager for `account`. A manager of an\\n * account is able to set interface implementers for it.\\n *\\n * By default, each account is its own manager. Passing a value of `0x0` in\\n * `newManager` will reset the manager to this initial state.\\n *\\n * Emits a {ManagerChanged} event.\\n *\\n * Requirements:\\n *\\n * - the caller must be the current manager for `account`.\\n */\\n function setManager(address account, address newManager) external;\\n\\n /**\\n * @dev Returns the manager for `account`.\\n *\\n * See {setManager}.\\n */\\n function getManager(address account) external view returns (address);\\n\\n /**\\n * @dev Sets the `implementer` contract as ``account``'s implementer for\\n * `interfaceHash`.\\n *\\n * `account` being the zero address is an alias for the caller's address.\\n * The zero address can also be used in `implementer` to remove an old one.\\n *\\n * See {interfaceHash} to learn how these are created.\\n *\\n * Emits an {InterfaceImplementerSet} event.\\n *\\n * Requirements:\\n *\\n * - the caller must be the current manager for `account`.\\n * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not\\n * end in 28 zeroes).\\n * - `implementer` must implement {IERC1820Implementer} and return true when\\n * queried for support, unless `implementer` is the caller. See\\n * {IERC1820Implementer-canImplementInterfaceForAddress}.\\n */\\n function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;\\n\\n /**\\n * @dev Returns the implementer of `interfaceHash` for `account`. If no such\\n * implementer is registered, returns the zero address.\\n *\\n * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28\\n * zeroes), `account` will be queried for support of it.\\n *\\n * `account` being the zero address is an alias for the caller's address.\\n */\\n function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);\\n\\n /**\\n * @dev Returns the interface hash for an `interfaceName`, as defined in the\\n * corresponding\\n * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].\\n */\\n function interfaceHash(string calldata interfaceName) external pure returns (bytes32);\\n\\n /**\\n * @notice Updates the cache with whether the contract implements an ERC165 interface or not.\\n * @param account Address of the contract for which to update the cache.\\n * @param interfaceId ERC165 interface for which to update the cache.\\n */\\n function updateERC165Cache(address account, bytes4 interfaceId) external;\\n\\n /**\\n * @notice Checks whether a contract implements an ERC165 interface or not.\\n * If the result is not cached a direct lookup on the contract address is performed.\\n * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\\n * {updateERC165Cache} with the contract address.\\n * @param account Address of the contract to check.\\n * @param interfaceId ERC165 interface to check.\\n * @return True if `account` implements `interfaceId`, false otherwise.\\n */\\n function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);\\n\\n /**\\n * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.\\n * @param account Address of the contract to check.\\n * @param interfaceId ERC165 interface to check.\\n * @return True if `account` implements `interfaceId`, false otherwise.\\n */\\n function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x02761f489482c11d04fda6e9e21592e819d4c349c20d133162445b46854b4660\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\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 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 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 up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 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 prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / 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 prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\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 works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\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^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice 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 uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"lib/solmate/src/utils/FixedPointMathLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.0;\\n\\n/// @notice Arithmetic library with operations for fixed-point numbers.\\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)\\nlibrary FixedPointMathLib {\\n /*//////////////////////////////////////////////////////////////\\n SIMPLIFIED FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\\n\\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\\n }\\n\\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\\n }\\n\\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\\n }\\n\\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\\n }\\n\\n function powWad(int256 x, int256 y) internal pure returns (int256) {\\n // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)\\n return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.\\n }\\n\\n function expWad(int256 x) internal pure returns (int256 r) {\\n unchecked {\\n // When the result is < 0.5 we return zero. This happens when\\n // x <= floor(log(0.5e18) * 1e18) ~ -42e18\\n if (x <= -42139678854452767551) return 0;\\n\\n // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\\n // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\\n if (x >= 135305999368893231589) revert(\\\"EXP_OVERFLOW\\\");\\n\\n // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\\n // for more intermediate precision and a binary basis. This base conversion\\n // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\\n x = (x << 78) / 5**18;\\n\\n // Reduce range of x to (-\\u00bd ln 2, \\u00bd ln 2) * 2**96 by factoring out powers\\n // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\\n // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\\n int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\\n x = x - k * 54916777467707473351141471128;\\n\\n // k is in the range [-61, 195].\\n\\n // Evaluate using a (6, 7)-term rational approximation.\\n // p is made monic, we'll multiply by a scale factor later.\\n int256 y = x + 1346386616545796478920950773328;\\n y = ((y * x) >> 96) + 57155421227552351082224309758442;\\n int256 p = y + x - 94201549194550492254356042504812;\\n p = ((p * y) >> 96) + 28719021644029726153956944680412240;\\n p = p * x + (4385272521454847904659076985693276 << 96);\\n\\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\\n int256 q = x - 2855989394907223263936484059900;\\n q = ((q * x) >> 96) + 50020603652535783019961831881945;\\n q = ((q * x) >> 96) - 533845033583426703283633433725380;\\n q = ((q * x) >> 96) + 3604857256930695427073651918091429;\\n q = ((q * x) >> 96) - 14423608567350463180887372962807573;\\n q = ((q * x) >> 96) + 26449188498355588339934803723976023;\\n\\n assembly {\\n // Div in assembly because solidity adds a zero check despite the unchecked.\\n // The q polynomial won't have zeros in the domain as all its roots are complex.\\n // No scaling is necessary because p is already 2**96 too large.\\n r := sdiv(p, q)\\n }\\n\\n // r should be in the range (0.09, 0.25) * 2**96.\\n\\n // We now need to multiply r by:\\n // * the scale factor s = ~6.031367120.\\n // * the 2**k factor from the range reduction.\\n // * the 1e18 / 2**96 factor for base conversion.\\n // We do this all at once, with an intermediate result in 2**213\\n // basis, so the final right shift is always by a positive amount.\\n r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\\n }\\n }\\n\\n function lnWad(int256 x) internal pure returns (int256 r) {\\n unchecked {\\n require(x > 0, \\\"UNDEFINED\\\");\\n\\n // We want to convert x from 10**18 fixed point to 2**96 fixed point.\\n // We do this by multiplying by 2**96 / 10**18. But since\\n // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\\n // and add ln(2**96 / 10**18) at the end.\\n\\n // Reduce range of x to (1, 2) * 2**96\\n // ln(2^k * x) = k * ln(2) + ln(x)\\n int256 k = int256(log2(uint256(x))) - 96;\\n x <<= uint256(159 - k);\\n x = int256(uint256(x) >> 159);\\n\\n // Evaluate using a (8, 8)-term rational approximation.\\n // p is made monic, we will multiply by a scale factor later.\\n int256 p = x + 3273285459638523848632254066296;\\n p = ((p * x) >> 96) + 24828157081833163892658089445524;\\n p = ((p * x) >> 96) + 43456485725739037958740375743393;\\n p = ((p * x) >> 96) - 11111509109440967052023855526967;\\n p = ((p * x) >> 96) - 45023709667254063763336534515857;\\n p = ((p * x) >> 96) - 14706773417378608786704636184526;\\n p = p * x - (795164235651350426258249787498 << 96);\\n\\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\\n // q is monic by convention.\\n int256 q = x + 5573035233440673466300451813936;\\n q = ((q * x) >> 96) + 71694874799317883764090561454958;\\n q = ((q * x) >> 96) + 283447036172924575727196451306956;\\n q = ((q * x) >> 96) + 401686690394027663651624208769553;\\n q = ((q * x) >> 96) + 204048457590392012362485061816622;\\n q = ((q * x) >> 96) + 31853899698501571402653359427138;\\n q = ((q * x) >> 96) + 909429971244387300277376558375;\\n assembly {\\n // Div in assembly because solidity adds a zero check despite the unchecked.\\n // The q polynomial is known not to have zeros in the domain.\\n // No scaling required because p is already 2**96 too large.\\n r := sdiv(p, q)\\n }\\n\\n // r is in the range (0, 0.125) * 2**96\\n\\n // Finalization, we need to:\\n // * multiply by the scale factor s = 5.549\\u2026\\n // * add ln(2**96 / 10**18)\\n // * add k * ln(2)\\n // * multiply by 10**18 / 2**96 = 5**18 >> 78\\n\\n // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\\n r *= 1677202110996718588342820967067443963516166;\\n // add ln(2) * k * 5e18 * 2**192\\n r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\\n // add ln(2**96 / 10**18) * 5e18 * 2**192\\n r += 600920179829731861736702779321621459595472258049074101567377883020018308;\\n // base conversion: mul 2**18 / 2**192\\n r >>= 174;\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n LOW LEVEL FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function mulDivDown(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n assembly {\\n // Store x * y in z for now.\\n z := mul(x, y)\\n\\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\\n revert(0, 0)\\n }\\n\\n // Divide z by the denominator.\\n z := div(z, denominator)\\n }\\n }\\n\\n function mulDivUp(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n assembly {\\n // Store x * y in z for now.\\n z := mul(x, y)\\n\\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\\n revert(0, 0)\\n }\\n\\n // First, divide z - 1 by the denominator and add 1.\\n // We allow z - 1 to underflow if z is 0, because we multiply the\\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\\n }\\n }\\n\\n function rpow(\\n uint256 x,\\n uint256 n,\\n uint256 scalar\\n ) internal pure returns (uint256 z) {\\n assembly {\\n switch x\\n case 0 {\\n switch n\\n case 0 {\\n // 0 ** 0 = 1\\n z := scalar\\n }\\n default {\\n // 0 ** n = 0\\n z := 0\\n }\\n }\\n default {\\n switch mod(n, 2)\\n case 0 {\\n // If n is even, store scalar in z for now.\\n z := scalar\\n }\\n default {\\n // If n is odd, store x in z for now.\\n z := x\\n }\\n\\n // Shifting right by 1 is like dividing by 2.\\n let half := shr(1, scalar)\\n\\n for {\\n // Shift n right by 1 before looping to halve it.\\n n := shr(1, n)\\n } n {\\n // Shift n right by 1 each iteration to halve it.\\n n := shr(1, n)\\n } {\\n // Revert immediately if x ** 2 would overflow.\\n // Equivalent to iszero(eq(div(xx, x), x)) here.\\n if shr(128, x) {\\n revert(0, 0)\\n }\\n\\n // Store x squared.\\n let xx := mul(x, x)\\n\\n // Round to the nearest number.\\n let xxRound := add(xx, half)\\n\\n // Revert if xx + half overflowed.\\n if lt(xxRound, xx) {\\n revert(0, 0)\\n }\\n\\n // Set x to scaled xxRound.\\n x := div(xxRound, scalar)\\n\\n // If n is even:\\n if mod(n, 2) {\\n // Compute z * x.\\n let zx := mul(z, x)\\n\\n // If z * x overflowed:\\n if iszero(eq(div(zx, x), z)) {\\n // Revert if x is non-zero.\\n if iszero(iszero(x)) {\\n revert(0, 0)\\n }\\n }\\n\\n // Round to the nearest number.\\n let zxRound := add(zx, half)\\n\\n // Revert if zx + half overflowed.\\n if lt(zxRound, zx) {\\n revert(0, 0)\\n }\\n\\n // Return properly scaled zxRound.\\n z := div(zxRound, scalar)\\n }\\n }\\n }\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n GENERAL NUMBER UTILITIES\\n //////////////////////////////////////////////////////////////*/\\n\\n function sqrt(uint256 x) internal pure returns (uint256 z) {\\n assembly {\\n let y := x // We start y at x, which will help us make our initial estimate.\\n\\n z := 181 // The \\\"correct\\\" value is 1, but this saves a multiplication later.\\n\\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\\n\\n // We check y >= 2^(k + 8) but shift right by k bits\\n // each branch to ensure that if x >= 256, then y >= 256.\\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\\n y := shr(128, y)\\n z := shl(64, z)\\n }\\n if iszero(lt(y, 0x1000000000000000000)) {\\n y := shr(64, y)\\n z := shl(32, z)\\n }\\n if iszero(lt(y, 0x10000000000)) {\\n y := shr(32, y)\\n z := shl(16, z)\\n }\\n if iszero(lt(y, 0x1000000)) {\\n y := shr(16, y)\\n z := shl(8, z)\\n }\\n\\n // Goal was to get z*z*y within a small factor of x. More iterations could\\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\\n\\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\\n\\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\\n\\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\\n\\n // There is no overflow risk here since y < 2^136 after the first branch above.\\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\\n\\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n\\n // If x+1 is a perfect square, the Babylonian method cycles between\\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\\n z := sub(z, lt(div(x, z), z))\\n }\\n }\\n\\n function log2(uint256 x) internal pure returns (uint256 r) {\\n require(x > 0, \\\"UNDEFINED\\\");\\n\\n assembly {\\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\\n r := or(r, shl(3, lt(0xff, shr(r, x))))\\n r := or(r, shl(2, lt(0xf, shr(r, x))))\\n r := or(r, shl(1, lt(0x3, shr(r, x))))\\n r := or(r, lt(0x1, shr(r, x)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x622fcd8a49e132df5ec7651cc6ae3aaf0cf59bdcd67a9a804a1b9e2485113b7d\",\"license\":\"MIT\"},\"src/IVault.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IStrategiesLender} from \\\"./lending/IStrategiesLender.sol\\\";\\nimport {IERC4626} from \\\"./tokens/IERC4626.sol\\\";\\n\\ninterface IVault is IStrategiesLender, IERC4626 { // solhint-disable-line no-empty-blocks\\n\\n}\\n\",\"keccak256\":\"0xff813ad44bf332ed444da13c7df42b2e3e325056c16665f4a9edd1c361e7912f\",\"license\":\"AGPL-3.0\"},\"src/Vault.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {MathUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\\\";\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {IERC20Metadata} from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport {PausableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\n\\nimport {IVault} from \\\"./IVault.sol\\\";\\nimport {ILender} from \\\"./lending/ILender.sol\\\";\\nimport {Lender, BorrowerDoesNotExist} from \\\"./lending/Lender.sol\\\";\\nimport {StrategiesLender} from \\\"./lending/StrategiesLender.sol\\\";\\nimport {SafeERC4626Upgradeable, ERC4626Upgradeable} from \\\"./tokens/SafeERC4626Upgradeable.sol\\\";\\nimport {IERC4626} from \\\"./tokens/IERC4626.sol\\\";\\nimport {IStrategy} from \\\"./strategies/IStrategy.sol\\\";\\nimport {AddressList} from \\\"./structures/AddressList.sol\\\";\\nimport {SafeInitializable} from \\\"./upgradeable/SafeInitializable.sol\\\";\\nimport {SafeUUPSUpgradeable} from \\\"./upgradeable/SafeUUPSUpgradeable.sol\\\";\\nimport {IVersionable} from \\\"./upgradeable/IVersionable.sol\\\";\\nimport {SafeERC4626Lifecycle} from \\\"./tokens/SafeERC4626Lifecycle.sol\\\";\\nimport {IVaultHook} from \\\"./tokens/IVaultHook.sol\\\";\\nimport {VaultFounderToken} from \\\"./tokens/VaultFounderToken.sol\\\";\\n\\n\\nerror ExceededMaximumFeeValue();\\n\\nerror InsufficientVaultBalance(uint256 assets, uint256 shares);\\nerror InvalidLockedProfitReleaseRate(uint256 durationInSeconds);\\nerror InappropriateStrategy();\\n\\ncontract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, StrategiesLender, SafeERC4626Lifecycle {\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n\\n /// @notice Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\\n uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;\\n\\n /// @notice Rewards contract where management fees are sent to.\\n address public rewards;\\n\\n /// @notice Vault Founders Token contract where rewards for founders are sent to.\\n address public founders;\\n\\n /// @notice Vault management fee (in BPS).\\n uint256 public managementFee;\\n\\n /// @notice Vault founders reward (in BPS).\\n uint256 public foundersFee;\\n\\n /// @notice The amount of funds that cannot be withdrawn by users.\\n /// Decreases with time at the rate of \\\"lockedProfitReleaseRate\\\".\\n uint256 public lockedProfitBaseline;\\n\\n /// @notice The rate of \\\"lockedProfitBaseline\\\" decline on the locked-in profit scale (scaled to 1e18).\\n /// Represents the amount of funds that will be unlocked when one second passes.\\n uint256 public lockedProfitReleaseRate;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[50] private __gap;\\n\\n /// @notice Event that should happen when the locked-in profit release rate changed.\\n event LockedProfitReleaseRateChanged(uint256 rate);\\n\\n /// @inheritdoc IVersionable\\n function version() external pure override returns (string memory) {\\n return \\\"0.2.0\\\";\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\\n\\n function initialize(\\n address _asset,\\n address _rewards,\\n uint256 _managementFee,\\n uint256 _lockedProfitReleaseRate,\\n string memory _name,\\n string memory _symbol,\\n address[] memory _defaultOperators,\\n uint256 _foundersFee\\n ) public initializer {\\n __SafeUUPSUpgradeable_init(); // Ownable under the hood\\n __StrategiesLender_init_lenderSpecific(); // require Ownable\\n __SafeERC4626_init(\\n IERC20Upgradeable(_asset),\\n bytes(_name).length == 0\\n ? string.concat(\\n IERC20Metadata(_asset).symbol(),\\n \\\" Eonian Vault Shares\\\"\\n )\\n : _name,\\n bytes(_symbol).length == 0\\n ? string.concat(\\\"eon\\\", IERC20Metadata(_asset).symbol())\\n : _symbol,\\n _defaultOperators\\n );\\n\\n setRewards(_rewards);\\n setManagementFee(_managementFee);\\n setLockedProfitReleaseRate(_lockedProfitReleaseRate);\\n setFoundersFee(_foundersFee);\\n }\\n\\n /// @dev Override to add the \\\"whenNotPaused\\\" modifier\\n /// @inheritdoc SafeERC4626Upgradeable\\n function deposit(uint256 assets)\\n public\\n override\\n whenNotPaused\\n returns (uint256 shares)\\n {\\n return super.deposit(assets);\\n }\\n\\n /// @notice Hook that is used before withdrawals to release assets from strategies if necessary.\\n /// @inheritdoc ERC4626Upgradeable\\n function beforeWithdraw(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\\n // There is no need to withdraw assets from strategies, the vault has sufficient funds\\n if (_freeAssets() >= assets) {\\n return;\\n }\\n\\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\\n // If the vault already has the required amount of funds, we need to finish the withdrawal\\n uint256 vaultBalance = _freeAssets();\\n if (assets <= vaultBalance) {\\n break;\\n }\\n\\n address strategy = withdrawalQueue[i];\\n\\n // We can only withdraw the amount that the strategy has as debt,\\n // so that the strategy can work on the unreported (yet) funds it has earned\\n uint256 requiredAmount = MathUpgradeable.min(\\n assets - vaultBalance,\\n borrowersData[strategy].debt\\n );\\n\\n // Skip this strategy is there is nothing to withdraw\\n if (requiredAmount == 0) {\\n continue;\\n }\\n\\n // Withdraw the required amount of funds from the strategy\\n uint256 loss = IStrategy(strategy).withdraw(requiredAmount);\\n\\n // If the strategy failed to return all of the requested funds, we need to reduce the strategy's debt ratio\\n if (loss > 0) {\\n _decreaseBorrowerCredibility(strategy, loss);\\n }\\n }\\n\\n // Revert if insufficient assets remain in the vault after withdrawal from all strategies\\n if (_freeAssets() < assets) {\\n revert InsufficientVaultBalance(assets, shares);\\n }\\n\\n // apply the hook\\n SafeERC4626Lifecycle.beforeWithdraw(assets, shares);\\n }\\n\\n /// Check that all new strategies refer to this vault and has the same underlying asset\\n function _beforeStrategyRegistered(IStrategy strategy) internal view override {\\n if (this != strategy.lender() || asset != strategy.asset()) {\\n revert InappropriateStrategy();\\n }\\n }\\n\\n /// @notice Sets the vault rewards address.\\n /// @param _rewards a new rewards address.\\n function setRewards(address _rewards) public onlyOwner {\\n rewards = _rewards;\\n }\\n\\n /// @notice Sets the vault management fee. Both management and foundersReward fee can't exceed 100%\\n /// @param _managementFee a new management fee value (in BPS).\\n function setManagementFee(uint256 _managementFee) public onlyOwner {\\n if (_managementFee + foundersFee > MAX_BPS) {\\n revert ExceededMaximumFeeValue();\\n }\\n\\n managementFee = _managementFee;\\n }\\n\\n /// @notice Sets the vault founder token contract;\\n /// @param _founders a new founder token contract address.\\n function setFounders(address _founders) external onlyOwner {\\n founders = _founders;\\n addDepositHook(IVaultHook(founders));\\n }\\n\\n /// @notice Sets the vault founder token reward rate. Both management and foundersReward fee can't exceed 100%\\n /// @param _foundersFee a new founder token reward fee (in BPS).\\n function setFoundersFee(uint256 _foundersFee) public onlyOwner {\\n if (_foundersFee + managementFee > MAX_BPS) {\\n revert ExceededMaximumFeeValue();\\n }\\n foundersFee = _foundersFee;\\n }\\n\\n /// @notice Changes the rate of release of locked-in profit.\\n /// @param rate the rate of release of locked profit (percent per second scaled to 1e18).\\n /// The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\\n function setLockedProfitReleaseRate(uint256 rate) public onlyOwner {\\n if (rate > LOCKED_PROFIT_RELEASE_SCALE) {\\n revert InvalidLockedProfitReleaseRate(rate);\\n }\\n\\n lockedProfitReleaseRate = rate;\\n emit LockedProfitReleaseRateChanged(rate);\\n }\\n\\n /// @notice Calculates the locked profit, takes into account the change since the last report.\\n function _lockedProfit() internal view returns (uint256) {\\n // Release rate should be small, since the timestamp can be manipulated by the node operator,\\n // not expected to have much impact, since the changes will be applied to all users and cannot be abused directly.\\n uint256 ratio = (block.timestamp - lastReportTimestamp) * lockedProfitReleaseRate; // solhint-disable-line not-rely-on-time\\n\\n // In case the ratio >= scale, the calculation anyway leads to zero.\\n if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) {\\n return 0;\\n }\\n\\n uint256 lockedProfitChange = (ratio * lockedProfitBaseline) / LOCKED_PROFIT_RELEASE_SCALE;\\n\\n // Reducing locked profits over time frees up profits for users\\n return lockedProfitBaseline - lockedProfitChange;\\n }\\n\\n /// @inheritdoc Lender\\n function _chargeFees(uint256 extraFreeFunds)\\n internal\\n override\\n returns (uint256)\\n {\\n uint256 fee = (extraFreeFunds * managementFee) / MAX_BPS;\\n if (fee > 0) {\\n _mint(rewards, convertToShares(fee), \\\"\\\", \\\"\\\", false);\\n }\\n if(founders == address(0)) {\\n return fee;\\n }\\n uint256 vaultFoundersReward = (extraFreeFunds * foundersFee) / MAX_BPS;\\n if (vaultFoundersReward > 0) {\\n _mint(founders, convertToShares(vaultFoundersReward), \\\"\\\", \\\"\\\", false);\\n }\\n return fee + vaultFoundersReward;\\n }\\n\\n /// @notice Updates the locked-in profit value according to the positive debt management report of the strategy\\n /// @inheritdoc Lender\\n function _afterPositiveDebtManagementReport(\\n uint256 extraFreeFunds,\\n uint256 chargedFees\\n ) internal override {\\n // Locking every reported strategy profit, taking into account the charged fees.\\n lockedProfitBaseline = _lockedProfit() + extraFreeFunds - chargedFees;\\n }\\n\\n /// @notice Updates the locked-in profit value according to the negative debt management report of the strategy\\n /// @inheritdoc Lender\\n function _afterNegativeDebtManagementReport(uint256 loss)\\n internal\\n override\\n {\\n uint256 currentLockedProfit = _lockedProfit();\\n\\n // If a loss occurs, it is necessary to release the appropriate amount of funds that users were able to withdraw it.\\n lockedProfitBaseline = currentLockedProfit > loss\\n ? currentLockedProfit - loss\\n : 0;\\n }\\n\\n /// @inheritdoc Lender\\n function _freeAssets() internal view override returns (uint256) {\\n return asset.balanceOf(address(this));\\n }\\n\\n /// @inheritdoc Lender\\n function _borrowerFreeAssets(address borrower)\\n internal\\n view\\n override\\n returns (uint256)\\n {\\n return asset.balanceOf(borrower);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function totalAssets() public view override(ERC4626Upgradeable, IERC4626) returns (uint256) {\\n return super.fundAssets() - _lockedProfit();\\n }\\n\\n /// @inheritdoc ILender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, StrategiesLender)\\n returns (bool)\\n {\\n return super.paused();\\n }\\n\\n /// @inheritdoc Lender\\n function _transferFundsToBorrower(address borrower, uint256 amount)\\n internal\\n override\\n {\\n asset.safeTransfer(borrower, amount);\\n }\\n\\n /// @inheritdoc Lender\\n function _takeFundsFromBorrower(address borrower, uint256 amount)\\n internal\\n override\\n {\\n asset.safeTransferFrom(borrower, address(this), amount);\\n }\\n\\n function afterDeposit(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\\n SafeERC4626Lifecycle.afterDeposit(assets, shares);\\n }\\n}\\n\",\"keccak256\":\"0xeb730bdd8c21a7eb7c8e213588b4d5ec364bb3a5e48adbbe909eaf99c1ef01c2\",\"license\":\"AGPL-3.0\"},\"src/lending/ILender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\n/// Base contract for lending protocols, can be used for colletaralized and not colletaralized lending.\\ninterface ILender {\\n\\n /// @notice Returns the number of tokens the borrower (caller of this function) can take from the lender\\n /// @return Available credit as amount of tokens\\n function availableCredit() external view returns (uint256);\\n\\n /// @notice Returns the outstanding debt that the borrower (caller of this function) must repay\\n /// @return Outstanding debt as amount of tokens\\n function outstandingDebt() external view returns (uint256);\\n\\n /// @notice Returns the amount of funds taken by the borrower (caller of this function).\\n /// @return Debt as amount of tokens\\n function currentDebt() external view returns (uint256);\\n\\n /// @notice Returns the debt ratio of the borrower (caller of this function).\\n function currentDebtRatio() external view returns (uint256);\\n\\n /// @notice Returns the last report timestamp of the borrower (caller of this function).\\n function lastReport() external view returns (uint256);\\n\\n /// @notice Returns the activation status of the borrower (caller of this function).\\n /// @return \\\"true\\\" if the borrower is active\\n function isActivated() external view returns (bool);\\n\\n /// @notice Indicates if the vault was shutted down or not.\\n /// @return \\\"true\\\" if the contract is paused, and \\\"false\\\" otherwise.\\n function paused() external view returns (bool);\\n\\n /// @notice Reports a positive result of the borrower's debt management.\\n /// Borrower must call this function if he has made any profit\\n /// or/and has a free funds available to repay the outstanding debt (if any).\\n /// @param extraFreeFunds an extra amount of free funds borrower's contract has.\\n /// This reporting amount must be greater than the borrower's outstanding debt.\\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\\n function reportPositiveDebtManagement(\\n uint256 extraFreeFunds,\\n uint256 debtPayment\\n ) external;\\n\\n /// @notice Reports a negative result of the borrower's debt management.\\n /// The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\\n /// May include a portion of the outstanding debt that the borrower was unable to repay.\\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\\n external;\\n}\\n\",\"keccak256\":\"0x5d79dc98497b5172dab5fb9184b1eb6531f4949e3435d273c1327fe4e14fb752\",\"license\":\"AGPL-3.0\"},\"src/lending/IStrategiesLender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {ILender} from \\\"./ILender.sol\\\";\\n\\n/// Lender contract which targeted to lend specifically for investments strategies.\\n/// Basically represent specific case of implementation of whitelist not colletaraized lending contract.\\ninterface IStrategiesLender is ILender {\\n\\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\\n function withdrawalQueue(uint256 index) external view returns (address);\\n\\n /// @notice Revokes a strategy from the vault.\\n /// Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\\n /// @param strategy a strategy to revoke.\\n function revokeStrategy(address strategy) external;\\n\\n /// @notice Returns average interst rate of lender per block. \\n /// Based on last report utilization rate and possibly cached interest rate of each strategy.\\n /// Can be outadated, but close enough to real state for on chain calculations.\\n /// Calculate average by combining utilisation rate of each strategy with its interest rate.\\n /// Returns additional total utilisation rate of lender, as additional product of calculation, usefull to safe gas.\\n /// @return interstRate - The interest rate per block, scaled by 1e18\\n /// @return utilisationRate - The utilisation rate of the lender, in BPS (scaled by 1e4)\\n function interestRatePerBlock() external view returns (uint256 interstRate, uint256 utilisationRate);\\n}\\n\",\"keccak256\":\"0xa70a854391820bf8c7314c9fffefd3e07cca320acd72bf4a539ea5fcd6637139\",\"license\":\"AGPL-3.0\"},\"src/lending/Lender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {MathUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\\\";\\nimport {PausableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport {ReentrancyGuardUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\n\\nimport {ILender} from \\\"./ILender.sol\\\";\\nimport {SafeInitializable} from \\\"../upgradeable/SafeInitializable.sol\\\";\\n\\nerror BorrowerAlreadyExists();\\nerror BorrowerDoesNotExist();\\nerror BorrowerHasDebt();\\nerror CallerIsNotABorrower();\\nerror LenderRatioExceeded(uint256 freeRatio);\\nerror FalsePositiveReport();\\n\\nabstract contract Lender is\\n ILender,\\n SafeInitializable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n struct BorrowerData {\\n /// Timestamp of the block in which the borrower was activated\\n uint256 activationTimestamp;\\n /// Last time a borrower made a report\\n uint256 lastReportTimestamp;\\n /// Amount of tokens taken by the borrower\\n uint256 debt;\\n /// Maximum portion of the loan that the borrower can take (in BPS)\\n /// Represents credibility of the borrower\\n uint256 debtRatio;\\n }\\n\\n uint256 public constant MAX_BPS = 10_000;\\n\\n /// @notice Amount of tokens that all borrowers have taken\\n uint256 public totalDebt;\\n\\n /// @notice Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\\n uint256 public debtRatio;\\n\\n /// @notice Last time a report occurred by any borrower\\n uint256 public lastReportTimestamp;\\n\\n /// @notice Records with information on each borrower using the lender's services\\n mapping(address => BorrowerData) public borrowersData;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /// @notice Event that must occur when the borrower reported the results of his debt management\\n /// @param borrower Borrower's contract address\\n /// @param debtPayment Amount of outstanding debt repaid by the borrower\\n /// @param freeFunds Free funds on the borrower's contract that remain after the debt is paid\\n /// @param fundsGiven Funds issued to the borrower by this lender\\n /// @param fundsTaken Funds that have been taken from the borrower by the lender\\n /// @param loss Amount of funds that the borrower realised as loss\\n event BorrowerDebtManagementReported(\\n address indexed borrower,\\n uint256 debtPayment,\\n uint256 freeFunds,\\n uint256 fundsGiven,\\n uint256 fundsTaken,\\n uint256 loss\\n );\\n\\n modifier onlyBorrowers() {\\n if (borrowersData[msg.sender].activationTimestamp == 0) {\\n revert CallerIsNotABorrower();\\n }\\n _;\\n }\\n\\n /// @notice Updates the last report timestamp for the specified borrower and this lender.\\n modifier updateLastReportTime() {\\n _;\\n borrowersData[msg.sender].lastReportTimestamp = lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n function __Lender_init() internal onlyInitializing {\\n __Pausable_init();\\n __ReentrancyGuard_init();\\n\\n __Lender_init_unchained();\\n }\\n\\n function __Lender_init_unchained() internal onlyInitializing {\\n lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /// @inheritdoc ILender\\n function availableCredit() external view override returns (uint256) {\\n return _availableCredit(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function outstandingDebt() external view override returns (uint256) {\\n return _outstandingDebt(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function currentDebt() external view override returns (uint256) {\\n return currentDebt(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function currentDebtRatio() external view override returns (uint256) {\\n return borrowersData[msg.sender].debt;\\n }\\n\\n /// @inheritdoc ILender\\n function isActivated() external view override returns (bool) {\\n return isActivated(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function lastReport() external view override returns (uint256) {\\n return lastReport(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function reportPositiveDebtManagement(\\n uint256 extraFreeFunds,\\n uint256 debtPayment\\n ) external override onlyBorrowers updateLastReportTime nonReentrant {\\n // Checking whether the borrower is telling the truth about his available funds\\n if (_borrowerFreeAssets(msg.sender) < extraFreeFunds + debtPayment) {\\n revert FalsePositiveReport();\\n }\\n\\n uint256 chargedFees = 0;\\n // We can only charge a fees if the borrower has reported extra free funds,\\n // if it's the first report at this block and only if the borrower was registered some time ago\\n if (\\n extraFreeFunds > 0 &&\\n borrowersData[msg.sender].lastReportTimestamp < block.timestamp && // solhint-disable-line not-rely-on-time\\n borrowersData[msg.sender].activationTimestamp < block.timestamp // solhint-disable-line not-rely-on-time\\n ) {\\n chargedFees = _chargeFees(extraFreeFunds);\\n }\\n\\n _rebalanceBorrowerFunds(msg.sender, debtPayment, extraFreeFunds, 0);\\n\\n _afterPositiveDebtManagementReport(extraFreeFunds, chargedFees);\\n }\\n\\n /// @inheritdoc ILender\\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\\n external\\n override\\n onlyBorrowers\\n updateLastReportTime\\n nonReentrant\\n {\\n // Checking whether the borrower has available funds for debt payment\\n require(_borrowerFreeAssets(msg.sender) >= debtPayment, \\\"Not enough assets for payment\\\");\\n\\n // Debt wasn't repaid, we need to decrease the ratio of this borrower\\n if (loss > 0) {\\n _decreaseBorrowerCredibility(msg.sender, loss);\\n }\\n\\n _rebalanceBorrowerFunds(msg.sender, debtPayment, 0, loss);\\n\\n _afterNegativeDebtManagementReport(loss);\\n }\\n\\n /// @notice Balances the borrower's account and adjusts the current amount of funds the borrower can take.\\n /// @param borrower a borrower's contract address.\\n /// @param debtPayment an amount of outstanding debt since the previous report, that the borrower managed to cover. Can be zero.\\n /// @param borrowerFreeFunds a funds that the borrower has earned since the previous report. Can be zero.\\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\\n function _rebalanceBorrowerFunds(\\n address borrower,\\n uint256 debtPayment,\\n uint256 borrowerFreeFunds,\\n uint256 loss\\n ) private {\\n // Calculate the amount of credit the lender can provide to the borrower (if any)\\n uint256 borrowerAvailableCredit = _availableCredit(borrower);\\n\\n // Make sure that the borrower's debt payment doesn't exceed his actual outstanding debt\\n uint256 borrowerOutstandingDebt = _outstandingDebt(msg.sender);\\n debtPayment = MathUpgradeable.min(debtPayment, borrowerOutstandingDebt);\\n\\n // Take into account repaid debt, if any\\n if (debtPayment > 0) {\\n borrowersData[borrower].debt -= debtPayment;\\n totalDebt -= debtPayment;\\n }\\n\\n // Allocate some funds to the borrower if possible\\n if (borrowerAvailableCredit > 0) {\\n borrowersData[borrower].debt += borrowerAvailableCredit;\\n totalDebt += borrowerAvailableCredit;\\n }\\n\\n // Now we need to compare the allocated funds to the borrower and his current free balance.\\n // If the number of unrealized tokens on the borrower's contract is less than the available credit, \\n // the lender must give that difference to the borrower.\\n // Otherwise (if the amount of the borrower's available funds is greater than \\n // he should have according to his share), the lender must take that portion of the funds for himself.\\n uint256 freeBorrowerBalance = borrowerFreeFunds + debtPayment;\\n uint256 fundsGiven = 0;\\n uint256 fundsTaken = 0;\\n if (freeBorrowerBalance < borrowerAvailableCredit) {\\n fundsGiven = borrowerAvailableCredit - freeBorrowerBalance;\\n _transferFundsToBorrower(borrower, fundsGiven);\\n } else if (freeBorrowerBalance > borrowerAvailableCredit) {\\n fundsTaken = freeBorrowerBalance - borrowerAvailableCredit;\\n _takeFundsFromBorrower(borrower, fundsTaken);\\n }\\n\\n emit BorrowerDebtManagementReported(\\n borrower,\\n debtPayment,\\n borrowerFreeFunds,\\n fundsGiven,\\n fundsTaken,\\n loss\\n );\\n }\\n\\n /// @notice Returns the unrealized amount of the lender's tokens (lender's contract balance)\\n function _freeAssets() internal view virtual returns (uint256);\\n\\n /// @notice Returns the unrealized amount of the borrower's tokens (contract balance of the specified borrower)\\n function _borrowerFreeAssets(address borrower)\\n internal\\n view\\n virtual\\n returns (uint256);\\n\\n /// @notice Transfers a specified amount of tokens to the borrower\\n function _transferFundsToBorrower(address borrower, uint256 amount)\\n internal\\n virtual;\\n\\n /// @notice Takes a specified amount of tokens from the borrower\\n function _takeFundsFromBorrower(address borrower, uint256 amount)\\n internal\\n virtual;\\n\\n /// @notice Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\\n function fundAssets() public view virtual returns (uint256) {\\n return _freeAssets() + totalDebt;\\n }\\n\\n /// @notice Returns the current debt that the strategy has.\\n function currentDebt(address borrower) public view returns (uint256) {\\n return borrowersData[borrower].debt;\\n }\\n\\n /// @notice Returns the activation status of the specified borrower.\\n function isActivated(address borrower) public view returns (bool) {\\n return borrowersData[borrower].activationTimestamp > 0;\\n }\\n\\n /// @notice Returns the last report timestamp of the specified borrower.\\n function lastReport(address borrower) public view returns (uint256) {\\n return borrowersData[borrower].lastReportTimestamp;\\n }\\n\\n /// @notice Returns the total number of tokens borrowers can take.\\n function _debtLimit() private view returns (uint256) {\\n return (debtRatio * fundAssets()) / MAX_BPS;\\n }\\n\\n /// @notice Lowers the borrower's debt he can take by specified loss and decreases his credibility.\\n /// @dev This function has \\\"internal\\\" visibility because it's used in tests.\\n function _decreaseBorrowerCredibility(address borrower, uint256 loss)\\n internal\\n {\\n uint256 debt = borrowersData[borrower].debt;\\n\\n // Make sure the borrower's loss is less than his entire debt\\n require(debt >= loss, \\\"Loss is greater than the debt\\\");\\n\\n // To decrease credibility of the borrower we should lower his \\\"debtRatio\\\"\\n if (debtRatio > 0) {\\n uint256 debtRatioChange = MathUpgradeable.min(\\n (debtRatio * loss) / totalDebt,\\n borrowersData[borrower].debtRatio\\n );\\n if (debtRatioChange != 0) {\\n borrowersData[borrower].debtRatio -= debtRatioChange;\\n debtRatio -= debtRatioChange;\\n }\\n }\\n\\n // Also, need to reduce the max amount of funds that can be taken by the borrower\\n borrowersData[borrower].debt -= loss;\\n totalDebt -= loss;\\n }\\n\\n /// @notice See external implementation\\n function _availableCredit(address borrower)\\n internal\\n view\\n returns (uint256)\\n {\\n // Lender is paused, no funds available for the borrower\\n if (paused()) {\\n return 0;\\n }\\n\\n uint256 lenderDebtLimit = _debtLimit();\\n uint256 lenderDebt = totalDebt;\\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\\n fundAssets()) / MAX_BPS;\\n uint256 borrowerDebt = borrowersData[borrower].debt;\\n\\n // There're no more funds for the borrower because he has outstanding debt or the lender's available funds have been exhausted\\n if (\\n lenderDebtLimit <= lenderDebt || borrowerDebtLimit <= borrowerDebt\\n ) {\\n return 0;\\n }\\n\\n uint256 lenderAvailableFunds = lenderDebtLimit - lenderDebt;\\n uint256 borrowerIntendedCredit = borrowerDebtLimit - borrowerDebt;\\n\\n // Borrower may not take more funds than the lender's limit\\n uint256 borrowerAvailableCredit = MathUpgradeable.min(\\n lenderAvailableFunds,\\n borrowerIntendedCredit\\n );\\n\\n // Available credit is limited by the existing number of tokens on the lender's contract\\n borrowerAvailableCredit = MathUpgradeable.min(\\n borrowerAvailableCredit,\\n _freeAssets()\\n );\\n\\n return borrowerAvailableCredit;\\n }\\n\\n /// @notice See external implementation\\n function _outstandingDebt(address borrower)\\n internal\\n view\\n returns (uint256)\\n {\\n uint256 borrowerDebt = borrowersData[borrower].debt;\\n if (paused() || debtRatio == 0) {\\n return borrowerDebt;\\n }\\n\\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\\n fundAssets()) / MAX_BPS;\\n if (borrowerDebt <= borrowerDebtLimit) {\\n return 0;\\n }\\n\\n return borrowerDebt - borrowerDebtLimit;\\n }\\n\\n /// @notice Registers a new borrower and sets for him a certain debt ratio\\n function _registerBorrower(address borrower, uint256 borrowerDebtRatio)\\n internal\\n {\\n // Check if specified borrower has already registered\\n if (isActivated(borrower)) {\\n revert BorrowerAlreadyExists();\\n }\\n\\n if (debtRatio + borrowerDebtRatio > MAX_BPS) {\\n revert LenderRatioExceeded(MAX_BPS - debtRatio);\\n }\\n\\n borrowersData[borrower] = BorrowerData(\\n // Activation timestamp \\n block.timestamp, // solhint-disable-line not-rely-on-time\\n // Last report timestamp\\n block.timestamp, // solhint-disable-line not-rely-on-time\\n // Initial debt\\n 0, \\n // Debt ratio\\n borrowerDebtRatio \\n );\\n\\n debtRatio += borrowerDebtRatio;\\n }\\n\\n /// @notice Sets the borrower's debt ratio. Will be reverted if the borrower doesn't exist or the total debt ratio is exceeded.\\n /// @dev In the case where you want to disable the borrower, you need to set its ratio to 0.\\n /// Thus, the borrower's current debt becomes an outstanding debt, which he must repay to the lender.\\n function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)\\n internal\\n {\\n if (!isActivated(borrower)) {\\n revert BorrowerDoesNotExist();\\n }\\n\\n debtRatio -= borrowersData[borrower].debtRatio;\\n borrowersData[borrower].debtRatio = borrowerDebtRatio;\\n debtRatio += borrowerDebtRatio;\\n\\n if (debtRatio > MAX_BPS) {\\n revert LenderRatioExceeded(\\n MAX_BPS - (debtRatio - borrowerDebtRatio)\\n );\\n }\\n }\\n\\n /// @notice Deletes the borrower from the list\\n /// @dev Should be called after the borrower's debt ratio is changed to 0, because the lender must take back all the released funds.\\n function _unregisterBorrower(address borrower) internal {\\n if (borrowersData[borrower].debtRatio > 0) {\\n revert BorrowerHasDebt();\\n }\\n delete borrowersData[borrower];\\n }\\n\\n /// Calculate utilisation rate for specific borrower\\n /// @notice Based on last report data, can be outdated, but close to latest state of fund\\n /// @return percent of total assets taken by strategy in BPS\\n function utilizationRate(address borrower) public virtual view returns (uint256) {\\n // assets in vault + amount lent to strategies\\n uint256 _fundAssets = fundAssets(); \\n // to decrease amount of calls to borrower contract,\\n // assume that borrower have same amount like in last update\\n uint256 borrowerAssets = borrowersData[borrower].debt; \\n\\n if (_fundAssets == 0) {\\n return 0;\\n }\\n\\n return borrowerAssets * MAX_BPS / _fundAssets;\\n }\\n\\n /// @notice Charges a fee on the borrower's income.\\n /// @param extraFreeFunds an income from which the fees will be calculated.\\n /// @return The total amount of fees charged.\\n function _chargeFees(uint256 extraFreeFunds)\\n internal\\n virtual\\n returns (uint256);\\n\\n /// @notice Callback that is called at the end of the positive report function.\\n /// @param extraFreeFunds the reported extra amount of borrower's funds.\\n /// @param chargedFees the total amount of charged fees.\\n function _afterPositiveDebtManagementReport(\\n uint256 extraFreeFunds,\\n uint256 chargedFees\\n ) internal virtual;\\n\\n /// @notice Callback that is called at the end of the negative report function.\\n /// @param loss the number of tokens by which the borrower's balance has decreased since the last report.\\n function _afterNegativeDebtManagementReport(uint256 loss) internal virtual;\\n\\n /// @inheritdoc ILender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, PausableUpgradeable)\\n virtual\\n returns (bool)\\n {\\n return super.paused();\\n }\\n}\\n\",\"keccak256\":\"0x0d7afe11c9c01322013f677cdd5934f2086d90dcd2344748440a74746800f903\",\"license\":\"AGPL-3.0\"},\"src/lending/StrategiesLender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\nimport {Lender, BorrowerDoesNotExist} from \\\"./Lender.sol\\\";\\nimport {ILender} from \\\"./ILender.sol\\\";\\nimport {IStrategiesLender} from \\\"./IStrategiesLender.sol\\\";\\nimport {IStrategy} from \\\"../strategies/IStrategy.sol\\\";\\nimport {AddressList} from \\\"../structures/AddressList.sol\\\";\\n\\nerror UnexpectedZeroAddress();\\nerror StrategyNotFound();\\nerror StrategyAlreadyExists();\\nerror AccessDeniedForCaller(address caller);\\n\\n/// Lender contract which targeted to lend specifically for investments strategies.\\n/// Basically represent specific case of implementation of whitelist not colletaraized lending contract.\\nabstract contract StrategiesLender is IStrategiesLender, Lender, OwnableUpgradeable {\\n\\n using AddressList for address[];\\n\\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\\n address[] public withdrawalQueue;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[50] private __gap;\\n\\n /// @notice Event that should happen when the strategy connects to the vault.\\n /// @param strategy Address of the strategy contract.\\n /// @param debtRatio Maximum portion of the loan that the strategy can take (in BPS).\\n event StrategyAdded(address indexed strategy, uint256 debtRatio);\\n\\n /// @notice Event that should happen when the strategy has been revoked from the vault.\\n /// @param strategy Address of the strategy contract.\\n event StrategyRevoked(address indexed strategy);\\n\\n /// @notice Event that should happen when the strategy has been removed from the vault.\\n /// @param strategy Address of the strategy contract.\\n /// @param fromQueueOnly If \\\"true\\\", then the strategy has only been removed from the withdrawal queue.\\n event StrategyRemoved(address indexed strategy, bool fromQueueOnly);\\n\\n /// @notice Event that should happen when the strategy has been returned to the withdrawal queue.\\n /// @param strategy Address of the strategy contract.\\n event StrategyReturnedToQueue(address indexed strategy);\\n\\n modifier onlyOwnerOrStrategy(address strategy) {\\n if (msg.sender != owner() && msg.sender != strategy) {\\n revert AccessDeniedForCaller(msg.sender);\\n }\\n _;\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n function __StrategiesLender_init() internal onlyInitializing {\\n __Ownable_init();\\n\\n __StrategiesLender_init_lenderSpecific();\\n }\\n\\n /// Init only direct constructors of business logic, ignore Ownable and simular common contracts\\n function __StrategiesLender_init_lenderSpecific() internal onlyInitializing {\\n require(owner() != address(0), \\\"StrategiesLender must be ownable\\\");\\n\\n __Lender_init();\\n }\\n\\n /// @notice Switches the vault pause state.\\n /// @param shutdown a new vault pause state. If \\\"true\\\" is passed, the vault will be paused.\\n function setEmergencyShutdown(bool shutdown) external onlyOwner {\\n shutdown ? _pause() : _unpause();\\n }\\n\\n /// @notice Returns the current debt of the strategy.\\n /// @param strategy the strategy address.\\n function strategyDebt(address strategy) external view returns (uint256) {\\n return borrowersData[strategy].debt;\\n }\\n\\n /// @notice Returns the debt ratio of the strategy.\\n /// @param strategy the strategy address.\\n function strategyRatio(address strategy) external view returns (uint256) {\\n return borrowersData[strategy].debtRatio;\\n }\\n\\n /// @notice Adds a new strategy to the vault.\\n /// @param strategy a new strategy address.\\n /// @param debtRatio a ratio that shows how much of the new strategy can take, relative to other strategies.\\n function addStrategy(address strategy, uint256 debtRatio)\\n external\\n onlyOwner\\n whenNotPaused\\n {\\n if (strategy == address(0)) {\\n revert UnexpectedZeroAddress();\\n }\\n \\n _beforeStrategyRegistered(IStrategy(strategy));\\n\\n _registerBorrower(strategy, debtRatio);\\n withdrawalQueue.add(strategy);\\n\\n emit StrategyAdded(strategy, debtRatio);\\n }\\n\\n /// Allow check strategy complience before it added\\n function _beforeStrategyRegistered(IStrategy strategy) internal virtual;\\n\\n /// @notice Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\\n /// @param strategy a strategy address.\\n function addStrategyToQueue(address strategy) external onlyOwner {\\n if (strategy == address(0)) {\\n revert UnexpectedZeroAddress();\\n }\\n\\n if (withdrawalQueue.contains(strategy)) {\\n revert StrategyAlreadyExists();\\n }\\n\\n if (borrowersData[strategy].activationTimestamp == 0) {\\n revert BorrowerDoesNotExist();\\n }\\n\\n withdrawalQueue.add(strategy);\\n\\n emit StrategyReturnedToQueue(strategy);\\n }\\n\\n /// @inheritdoc IStrategiesLender\\n function revokeStrategy(address strategy)\\n external\\n onlyOwnerOrStrategy(strategy)\\n {\\n _setBorrowerDebtRatio(strategy, 0);\\n emit StrategyRevoked(strategy);\\n }\\n\\n /// @notice Removes a strategy from the vault.\\n /// @param strategy a strategy to remove.\\n /// @param fromQueueOnly if \\\"true\\\", then the strategy will only be removed from the withdrawal queue.\\n function removeStrategy(address strategy, bool fromQueueOnly)\\n external\\n onlyOwner\\n {\\n bool removedFromQueue = withdrawalQueue.remove(strategy);\\n if (!removedFromQueue) {\\n revert StrategyNotFound();\\n }\\n\\n if (!fromQueueOnly) {\\n _unregisterBorrower(strategy);\\n }\\n\\n emit StrategyRemoved(strategy, fromQueueOnly);\\n }\\n\\n /// @notice Sets the withdrawal queue.\\n /// @param queue a new queue that will replace the existing one.\\n /// Should contain only those elements that already present in the existing queue.\\n function reorderWithdrawalQueue(address[] memory queue) external onlyOwner {\\n withdrawalQueue = withdrawalQueue.reorder(queue);\\n }\\n\\n /// @notice Returns the size of the withdrawal queue.\\n function getQueueSize() external view returns (uint256) {\\n return withdrawalQueue.length;\\n }\\n \\n /// @inheritdoc IStrategiesLender\\n function interestRatePerBlock() public view returns (uint256, uint256) {\\n uint256 totalUtilisationRate;\\n uint256 totalInterestRate;\\n\\n if(totalDebt == 0) {\\n return (0, 0);\\n }\\n\\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\\n IStrategy strategy = IStrategy(withdrawalQueue[i]);\\n\\n uint256 utilisationRate = utilizationRate(address(strategy)); // in BPS\\n totalUtilisationRate += utilisationRate;\\n \\n // interest rate scaled by 1e18\\n // utilisation rate in BPS * interest rate scaled by 1e18 / BPS = total interest rate scaled by 1e18\\n totalInterestRate += utilisationRate * strategy.interestRatePerBlock() / MAX_BPS; \\n }\\n\\n // sanity check\\n if (totalUtilisationRate == 0) {\\n return (0, 0);\\n }\\n\\n return (totalInterestRate, totalUtilisationRate);\\n }\\n\\n /// @inheritdoc Lender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, Lender)\\n virtual\\n returns (bool)\\n {\\n return super.paused();\\n }\\n\\n}\",\"keccak256\":\"0x610e7cb1848bc5c1808a2444e825ce280e645321c9b4aea2032b0b1ea305b7ce\",\"license\":\"AGPL-3.0\"},\"src/strategies/IStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {IStrategiesLender} from \\\"../lending/IStrategiesLender.sol\\\";\\n\\ninterface IStrategy {\\n /// @notice Returns the name of this strategy.\\n function name() external view returns (string memory);\\n\\n /// @notice Returns the contract address of the underlying asset of this strategy.\\n function asset() external view returns (IERC20Upgradeable);\\n\\n /// @notice Returns the contract address of the Lender to which this strategy is connected.\\n function lender() external view returns (IStrategiesLender);\\n\\n /// @notice Transfers a specified amount of tokens to the vault.\\n /// @param assets A amount of tokens to withdraw.\\n /// @return loss A number of tokens that the strategy could not return.\\n function withdraw(uint256 assets) external returns (uint256 loss);\\n\\n /// @notice Returns interst rate of strategy per block, for current block or block prior to this one.\\n /// @dev Can be calculated not for all strategies and usally not such accurate as sliding window averages,\\n /// but still can be usafull for on chain calculations and as fallback method.\\n /// @return The interest rate per block, scaled by 1e18\\n function interestRatePerBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xc22f6bf472cc43d96347263eeb615d0b57ef02395bbe303ccd2981d4beadcbfd\",\"license\":\"AGPL-3.0\"},\"src/structures/AddressList.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nerror ListsDoNotMatch();\\n\\nlibrary AddressList {\\n /// @notice Adds an address to the list.\\n /// @param list the list of addresses.\\n /// @param addr the address to add.\\n function add(address[] storage list, address addr) internal {\\n list.push(addr);\\n }\\n\\n /// @notice Checks if the list contains the specified item.\\n /// @param list the list of addresses.\\n /// @param addr the address to find.\\n function contains(address[] storage list, address addr)\\n internal\\n view\\n returns (bool)\\n {\\n for (uint256 i = 0; i < list.length; i++) {\\n if (list[i] == addr) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /// @notice Removes an address from the list and fills the gap with the following items by moving them up.\\n /// @param list the list of addresses.\\n /// @param addr the address to remove.\\n /// @return A boolean value that indicates if the address was found and removed from the list.\\n function remove(address[] storage list, address addr)\\n internal\\n returns (bool)\\n {\\n bool addressFound;\\n for (uint256 i = 0; i < list.length; i++) {\\n if (list[i] == addr) {\\n addressFound = true;\\n }\\n if (addressFound && i < list.length - 1) {\\n list[i] = list[i + 1];\\n }\\n }\\n if (addressFound) {\\n list.pop();\\n }\\n return addressFound;\\n }\\n\\n /// @notice Checks if the list can be reordered in the specified way.\\n /// @param list the list of addresses.\\n /// @param reoderedList the desired reordered list, which must have the same content as the existing list.\\n /// @return A reordered list\\n function reorder(address[] storage list, address[] memory reoderedList)\\n internal\\n view\\n returns (address[] memory)\\n {\\n uint256 length = list.length;\\n if (length != reoderedList.length) {\\n revert ListsDoNotMatch();\\n }\\n for (uint256 i = 0; i < length; i++) {\\n address existingAddress = list[i];\\n for (uint256 j = 0; j < length; j++) {\\n // Address is found, move to the next item\\n if (existingAddress == reoderedList[j]) {\\n break;\\n }\\n // If this is the last iteration, then the address is not found\\n if (j == length - 1) {\\n revert ListsDoNotMatch();\\n }\\n }\\n }\\n return reoderedList;\\n }\\n}\\n\",\"keccak256\":\"0x6d1ba8d87163661acbb468bcfdd3339d7b23f20866e6bd62546a69b81d3c16df\",\"license\":\"AGPL-3.0\"},\"src/tokens/ERC4626Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {ERC777Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\\\";\\nimport {ReentrancyGuardUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\nimport {FixedPointMathLib} from \\\"solmate/utils/FixedPointMathLib.sol\\\";\\n\\nimport {IERC4626} from \\\"./IERC4626.sol\\\";\\nimport {SafeInitializable} from \\\"../upgradeable/SafeInitializable.sol\\\";\\n\\n/// @title ERC4626 upgradable tokenized Vault implementation based on ERC-777.\\n/// More info in [EIP](https://eips.ethereum.org/EIPS/eip-4626)\\n/// Based on Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/mixins/ERC4626.sol)\\n///\\n/// ERC-777 and ERC-20 tokens represent \\\"shares\\\"\\n/// Vault \\u201cshares\\u201d which represent a claim to ownership on a fraction of the Vault\\u2019s underlying holdings.\\n/// -\\n/// @notice Rationale\\n/// The mint method was included for symmetry and feature completeness.\\n/// Most current use cases of share-based Vaults do not ascribe special meaning to the shares\\n/// such that a user would optimize for a specific number of shares (mint)\\n/// rather than specific amount of underlying (deposit).\\n/// However, it is easy to imagine future Vault strategies which would have unique\\n/// and independently useful share representations.\\n/// The convertTo functions serve as rough estimates that do not account for operation specific details\\n/// like withdrawal fees, etc. They were included for frontends and applications that need an average\\n/// value of shares or assets, not an exact value possibly including slippage or other fees.\\n/// For applications that need an exact value that attempts to account for fees and slippage we have\\n/// included a corresponding preview function to match each mutable function.\\n/// These functions must not account for deposit or withdrawal limits, to ensure they are easily composable,\\n/// the max functions are provided for that purpose.\\nabstract contract ERC4626Upgradeable is\\n SafeInitializable,\\n ERC777Upgradeable,\\n ReentrancyGuardUpgradeable,\\n IERC4626\\n{\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n using FixedPointMathLib for uint256;\\n\\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n IERC20Upgradeable public asset;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n /**\\n * Constructor for the ERC4626Upgradeable contract\\n * @param _asset which will be stored in this Vault\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __ERC4626_init(\\n IERC20Upgradeable _asset,\\n string memory name_,\\n string memory symbol_,\\n address[] memory defaultOperators_\\n ) internal onlyInitializing {\\n __ERC777_init(name_, symbol_, defaultOperators_);\\n __ReentrancyGuard_init();\\n\\n __ERC4626_init_unchained(_asset);\\n }\\n\\n /**\\n * Unchained constructor for the ERC4626Upgradeable contract, without parents contracts init\\n * @param _asset which will be stored in this Vault\\n */\\n function __ERC4626_init_unchained(IERC20Upgradeable _asset)\\n internal\\n onlyInitializing\\n {\\n asset = _asset;\\n }\\n\\n /* ///////////////////////////// DEPOSIT / WITHDRAWAL ///////////////////////////// */\\n\\n /// @notice Mints Vault shares to receiver by depositing exactly amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage,\\n /// the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function deposit(uint256 assets, address receiver)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n shares = previewDeposit(assets);\\n // Check for rounding error since we round down in previewDeposit.\\n require(shares != 0, \\\"Given assets result in 0 shares.\\\");\\n\\n _receiveAndDeposit(assets, shares, receiver);\\n }\\n\\n /// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function mint(uint256 shares, address receiver)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n // No need to check for rounding error, previewMint rounds up.\\n assets = previewMint(shares);\\n\\n _receiveAndDeposit(assets, shares, receiver);\\n }\\n\\n /// @notice Base deposit logic which common for public deposit and mint function\\n /// Trasfer assets from sender and mint shares for receiver\\n function _receiveAndDeposit(\\n uint256 assets,\\n uint256 shares,\\n address receiver\\n ) internal {\\n // cases when msg.sender != receiver are error prone\\n // but they are allowed by the standard... we need take care of it ourselves\\n\\n // Need to transfer before minting or ERC777s could reenter.\\n asset.safeTransferFrom(msg.sender, address(this), assets);\\n\\n _mint(receiver, shares, \\\"\\\", \\\"\\\");\\n\\n emit Deposit(msg.sender, receiver, assets, shares);\\n\\n afterDeposit(assets, shares);\\n }\\n\\n /// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n /// - emit the Withdraw event.\\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - support a withdraw flow where the shares are burned from owner directly where msg.sender\\n /// has ERC-20 approval over the shares of owner.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the withdraw execution, and are accounted for during withdraw.\\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) public virtual nonReentrant returns (uint256 shares) {\\n // No need to check for rounding error, previewWithdraw rounds up.\\n shares = previewWithdraw(assets);\\n\\n _withdrawAndSend(assets, shares, receiver, owner);\\n }\\n\\n /// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n /// - emit the Withdraw event.\\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - support a redeem flow where the shares are burned from owner directly where msg.sender\\n /// has ERC-20 approval over the shares of owner.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the redeem execution, and are accounted for during redeem.\\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) public virtual nonReentrant returns (uint256 assets) {\\n assets = previewRedeem(shares);\\n // Check for rounding error since we round down in previewRedeem.\\n require(assets != 0, \\\"Given shares result in 0 assets.\\\");\\n\\n _withdrawAndSend(assets, shares, receiver, owner);\\n }\\n\\n /// @notice Burn owner shares and send tokens to receiver.\\n function _withdrawAndSend(\\n uint256 assets,\\n uint256 shares,\\n address receiver,\\n address owner\\n ) internal {\\n // cases when msg.sender != receiver != owner is error prune\\n // but they allowed by standard... take care of it by self\\n if (msg.sender != owner) {\\n _spendAllowance(owner, msg.sender, shares);\\n }\\n\\n beforeWithdraw(assets, shares);\\n\\n _burn(owner, shares, \\\"\\\", \\\"\\\");\\n\\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\\n\\n asset.safeTransfer(receiver, assets);\\n }\\n\\n /* ///////////////////////////// ACCOUNTING ///////////////////////////// */\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block,\\n /// given current on-chain conditions.\\n /// - return as close to and no more than the exact amount of Vault shares that would be minted\\n /// in a deposit call in the same transaction.\\n /// I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction.\\n /// - NOT account for deposit limits like those returned from maxDeposit\\n /// and should always act as though the deposit would be accepted,\\n /// regardless if the user has enough tokens approved, etc.\\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n /// - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert.\\n /// Note that any unfavorable discrepancy between convertToShares and previewDeposit\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by depositing.\\n function previewDeposit(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n return convertToShares(assets);\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block,\\n /// given current on-chain conditions.\\n /// - return as close to and no fewer than the exact amount of assets that would be deposited\\n /// in a mint call in the same transaction.\\n /// I.e. mint should return the same or fewer assets as previewMint if called in the same transaction.\\n /// - NOT account for mint limits like those returned from maxMint\\n /// and should always act as though the mint would be accepted,\\n /// regardless if the user has enough tokens approved, etc.\\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause mint to revert.\\n /// Note that any unfavorable discrepancy between convertToAssets and previewMint\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by minting.\\n function previewMint(uint256 shares) public view virtual returns (uint256) {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return shares;\\n }\\n\\n return shares.mulDivUp(totalAssets(), supply);\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal\\n /// at the current block, given current on-chain conditions.\\n /// - return as close to and no fewer than the exact amount of Vault shares\\n /// that would be burned in a withdraw call in the same transaction.\\n /// I.e. withdraw should return the same or fewer shares as previewWithdraw\\n /// if called in the same transaction.\\n /// - NOT account for withdrawal limits like those returned from maxWithdraw\\n /// and should always act as though the withdrawal would be accepted,\\n /// regardless if the user has enough shares, etc.\\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause withdraw to revert.\\n /// Note that any unfavorable discrepancy between convertToShares and previewWithdraw\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by depositing.\\n function previewWithdraw(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return assets;\\n }\\n return assets.mulDivUp(supply, totalAssets());\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their\\n /// redeemption at the current block, given current on-chain conditions.\\n /// - return as close to and no more than the exact amount of assets that would be withdrawn\\n /// in a redeem call in the same transaction.\\n /// I.e. redeem should return the same or more assets as previewRedeem\\n /// if called in the same transaction.\\n /// - NOT account for redemption limits like those returned from maxRedeem\\n /// and should always act as though the redemption would be accepted,\\n /// regardless if the user has enough shares, etc.\\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause redeem to revert.\\n /// Note that any unfavorable discrepancy between convertToAssets and previewRedeem\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by redeeming.\\n function previewRedeem(uint256 shares)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n return convertToAssets(shares);\\n }\\n\\n /// @notice The amount of shares that the Vault would exchange for the amount of assets provided,\\n /// in an ideal scenario where all the conditions are met.\\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\\n /// - do NOT show any variations depending on the caller.\\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\\n /// - round down towards 0.\\n /// This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share,\\n /// and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share,\\n /// meaning what the average user should expect to see when exchanging to and from.\\n function convertToShares(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return assets;\\n }\\n\\n return assets.mulDivDown(supply, totalAssets());\\n }\\n\\n /// @notice The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.\\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\\n /// - do NOT show any variations depending on the caller.\\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\\n /// - round down towards 0.\\n /// This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share,\\n /// and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share,\\n /// meaning what the average user should expect to see when exchanging to and from.\\n function convertToAssets(uint256 shares)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return shares;\\n }\\n\\n return shares.mulDivDown(totalAssets(), supply);\\n }\\n\\n /// @notice Total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n /// - include any compounding that occurs from yield.\\n /// - inclusive of any fees that are charged against assets in the Vault.\\n /// - is NOT revert\\n /// @dev Must be implemented by child contract.\\n function totalAssets() public view virtual returns (uint256);\\n\\n /* //////////////////////////////// DEPOSIT / WITHDRAWAL LIMIT //////////////////////////////// */\\n\\n /// @notice Maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n /// through a deposit call.\\n /// - returns the maximum amount of assets deposit would allow to be deposited\\n /// for receiver and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\\n /// - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.\\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n function maxDeposit(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n /// @notice Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call.\\n /// - return the maximum amount of shares mint would allow to be deposited to receiver\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\\n /// - factor in both global and user-specific limits,\\n /// like if mints are entirely disabled (even temporarily) it MUST return 0.\\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n function maxMint(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n /// @notice Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault,\\n /// through a withdraw call.\\n /// - return the maximum amount of assets that could be transferred from owner through withdraw\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// - factor in both global and user-specific limits,\\n /// like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\\n function maxWithdraw(address owner) public view virtual returns (uint256) {\\n return convertToAssets(balanceOf(owner));\\n }\\n\\n /// @notice Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n /// through a redeem call.\\n /// - return the maximum amount of shares that could be transferred from owner through redeem\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// - factor in both global and user-specific limits,\\n /// like if redemption is entirely disabled (even temporarily) it MUST return 0.\\n function maxRedeem(address owner) public view virtual returns (uint256) {\\n return balanceOf(owner);\\n }\\n\\n /* //////////////////////////////// INTERNAL HOOKS //////////////////////////////// */\\n\\n /// @notice Called before withdraw will be made the Vault.\\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\\n\\n /// @notice Called when a deposit is made to the Vault.\\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\\n}\\n\",\"keccak256\":\"0x48f7146146afdf654bcc6b1208c7855e45f6c45b0cd4f93dd4700894432a455e\",\"license\":\"AGPL-3.0\"},\"src/tokens/ERC5484Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {ERC721EnumerableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\\\";\\nimport {ERC721URIStorageUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\\\";\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {IAccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {CountersUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\\\";\\nimport {IERC5484} from \\\"./IERC5484.sol\\\";\\n\\ncontract ERC5484Upgradeable is\\n IERC5484,\\n Initializable,\\n ERC721Upgradeable,\\n ERC721EnumerableUpgradeable,\\n ERC721URIStorageUpgradeable,\\n AccessControlUpgradeable\\n{\\n using CountersUpgradeable for CountersUpgradeable.Counter;\\n\\n // @dev utility object for counting tokens\\n CountersUpgradeable.Counter private _tokenIdCounter;\\n\\n /// @dev burn mode with different behavior\\n BurnAuth private _burnAuth;\\n\\n /// @dev Token can me minted only once per user\\n bool private _mintOnce;\\n\\n /// @dev Role for minting tokens\\n /// value is 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6\\n bytes32 public constant MINTER_ROLE = keccak256(\\\"MINTER_ROLE\\\");\\n /// @dev Role for burning tokens which can be used only if _burnAuth isn't BurnAuth.None\\n /// value is 0x3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848\\n bytes32 public constant BURNER_ROLE = keccak256(\\\"BURNER_ROLE\\\");\\n\\n /// @dev Modifier to protect a burn a token without permission\\n modifier allowedTransfer(address to, address from, uint256 tokenId) {\\n bool isMint = from == address(0);\\n bool isBurner = hasRole(BURNER_ROLE, msg.sender);\\n bool isBurn = !isMint && to == address(0);\\n if(_burnAuth == BurnAuth.Neither) {\\n // nobody can burn token\\n require(isMint, \\\"ERC5484: can't be transferred\\\");\\n } else if(_burnAuth == BurnAuth.IssuerOnly) {\\n // only issuer can burn token\\n // so we are checking if token is generation with condition from == address(0)\\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\\n bool isBurnOperation = isBurner && isBurn;\\n require(isMint || isBurnOperation, \\\"ERC5484: can't be transferred\\\");\\n } else if (_burnAuth == BurnAuth.OwnerOnly){\\n // only owner can burn token\\n // so we are checking if token is generation with condition from == ownerOf(tokenId) and it is burn operation\\n bool isOwner = _ownerOf(tokenId) == msg.sender && hasRole(BURNER_ROLE, msg.sender);\\n require(isMint || (isOwner && isBurn), \\\"ERC5484: can't be transferred\\\");\\n } else if (_burnAuth == BurnAuth.Both) {\\n // both owner and issuer can burn token\\n // so we are checking if token is minting with condition from == address(0)\\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\\n require(isMint || (isBurn && isBurner), \\\"ERC5484: can't be transferred\\\");\\n }\\n _;\\n }\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n function __ERC5484Upgradeable_init(\\n string memory name_,\\n string memory symbol_,\\n BurnAuth burnAuth_,\\n bool mintOnce_\\n ) internal onlyInitializing {\\n __ERC721_init(name_, symbol_);\\n __ERC721Enumerable_init();\\n __ERC721URIStorage_init();\\n __AccessControl_init();\\n _burnAuth = burnAuth_;\\n _mintOnce = mintOnce_;\\n\\n // setup roles depend on mode for SoulBound token\\n _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\\n }\\n\\n /// @dev function for mint new SBT token\\n /// @param to address of user who will receive token\\n /// @param uri token metadata uri\\n /// @return true if token was minted\\n function safeMint(address to, string memory uri)\\n public\\n virtual\\n onlyRole(MINTER_ROLE)\\n returns(bool)\\n {\\n // allow to mint only once per user if _mintOnce is true\\n if(_mintOnce && balanceOf(to) != 0) {\\n return false;\\n }\\n\\n // mint token\\n uint256 tokenId = _tokenIdCounter.current();\\n _tokenIdCounter.increment();\\n _safeMint(to, tokenId);\\n _setTokenURI(tokenId, uri);\\n\\n // set permission to burn token\\n if(_burnAuth == BurnAuth.OwnerOnly || _burnAuth == BurnAuth.Both) {\\n _setupRole(BURNER_ROLE, to);\\n }\\n\\n // emit event\\n emit Issued(address(0), to, tokenId, _burnAuth);\\n return true;\\n }\\n\\n /// @dev Token is SOUL BOUND and it is not allowed to move token between users\\n function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)\\n internal\\n virtual\\n allowedTransfer(to, from, tokenId)\\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\\n {\\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\\n }\\n\\n /// @dev Burns `tokenId`. See {ERC721-_burn}.\\n function burn(uint256 tokenId) external\\n onlyRole(BURNER_ROLE)\\n virtual\\n {\\n _burn(tokenId);\\n }\\n\\n /// @dev See {ERC721-_burn}\\n function _burn(uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable){\\n super._burn(tokenId);\\n }\\n\\n /// @dev See {IERC721Metadata-tokenURI}.\\n function tokenURI(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable)\\n returns (string memory)\\n {\\n return super.tokenURI(tokenId);\\n }\\n\\n /// @dev See {IERC165-supportsInterface}.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable, AccessControlUpgradeable)\\n virtual\\n returns (bool)\\n {\\n return interfaceId == type(IERC5484).interfaceId\\n || interfaceId == type(IAccessControlUpgradeable).interfaceId\\n || super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice provides burn authorization of the token id.\\n /// @dev unassigned tokenIds are invalid, and queries do throw\\n /// @param tokenId The identifier for a token.\\n function burnAuth(uint256 tokenId) external view virtual returns (BurnAuth){\\n require(_exists(tokenId), \\\"ERC5484: token doesn't exists\\\");\\n return _burnAuth;\\n }\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[48] private __gap;\\n}\",\"keccak256\":\"0x4678458e960596e4a85fdfddaa45741a4563e7ecad5b0d42de2f4f7ac02ea3db\",\"license\":\"AGPL-3.0\"},\"src/tokens/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n */\\ninterface IERC4626 {\\n\\n /* ///////////////////////////// EVENTS ///////////////////////////// */\\n\\n /// `sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`.\\n /// emitted when tokens are deposited into the Vault via the mint and deposit methods.\\n event Deposit(\\n address indexed caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /// `sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`.\\n /// emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\\n * Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\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 (IERC20Upgradeable);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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\\u2019s 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\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0xe0b1a2e19aa78ee17783644981a5b1f1b725b4b031fbb8214ed3f02da3cdd516\",\"license\":\"AGPL-3.0\"},\"src/tokens/IERC5484.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\ninterface IERC5484 {\\n /// A guideline to standardlize burn-authorization's number coding\\n enum BurnAuth {\\n IssuerOnly,\\n OwnerOnly,\\n Both,\\n Neither\\n }\\n\\n /// @notice Emitted when a soulbound token is issued.\\n /// @dev This emit is an add-on to nft's transfer emit in order to distinguish sbt\\n /// from vanilla nft while providing backward compatibility.\\n /// @param from The issuer\\n /// @param to The receiver\\n /// @param tokenId The id of the issued token\\n event Issued (\\n address indexed from,\\n address indexed to,\\n uint256 indexed tokenId,\\n BurnAuth burnAuth\\n );\\n\\n /// @notice provides burn authorization of the token id.\\n /// @dev unassigned tokenIds are invalid, and queries do throw\\n /// @param tokenId The identifier for a token.\\n function burnAuth(uint256 tokenId) external view returns (BurnAuth);\\n}\",\"keccak256\":\"0xc96f708b45ebb1010db2b0b829360f12ec67dc83ec67e2a95df06f6afc467b3a\",\"license\":\"AGPL-3.0\"},\"src/tokens/IVaultFounderToken.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\\\";\\nimport {IERC721MetadataUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport {IERC721EnumerableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\\\";\\nimport {IERC5484} from \\\"./IERC5484.sol\\\";\\n\\n/// @title ERC721 complient Token interface\\ninterface IVaultFounderToken is\\n IERC5484,\\n IERC721Upgradeable,\\n IERC721MetadataUpgradeable,\\n IERC721EnumerableUpgradeable\\n{\\n /// @dev implementation for calculate price for the next token based on\\n /// the current sequential token id\\n function priceOf(uint256 tokenId) external view returns (uint256);\\n /// @dev calculate price for the next token\\n function nextTokenPrice() external view returns (uint256);\\n /// @dev set token metadata uri\\n /// can be used as utility method and custom logic on front-end\\n function setTokenURI(string memory _tokenURI) external;\\n /// @dev set token metadata uri\\n /// can be used as utility method and custom logic on front-end by owner of the contract\\n /// in case of end user has a wrong uri or somebody corrupted it\\n function setTokenURI(string memory _tokenURI, uint256 tokenId) external;\\n}\",\"keccak256\":\"0x8be89639be429f4cff7da513344ff8f685c3a44a8c4c32d98d7552b71daf62a8\",\"license\":\"AGPL-3.0\"},\"src/tokens/IVaultHook.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\n\\n/// @title ERC4626 Vault Token lifecycle hook interface\\ninterface IVaultHook {\\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request) external;\\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external;\\n}\\n\\nstruct ERC4626UpgradeableRequest {\\n /// @dev The amount of assets to be deposited.\\n uint256 assets;\\n\\n /// @dev The amount of shares to be minted.\\n uint256 shares;\\n\\n /// @dev The address that initiated the request.\\n address requestSender;\\n\\n /// @dev The amount of assets the sender is allowed to withdraw.\\n uint256 senderMaxWithdraw;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[46] gap;\\n}\",\"keccak256\":\"0x971fc6a2686ac8f6433b5544b31a4f25bec320698dc4aab4065f5bad3824ee6c\",\"license\":\"AGPL-3.0\"},\"src/tokens/RewardHolder.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ReentrancyGuardUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\n\\nimport {FixedPointMathLib} from \\\"solmate/utils/FixedPointMathLib.sol\\\";\\nimport {Vault} from \\\"../Vault.sol\\\";\\n\\ncontract RewardHolder is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable {\\n using FixedPointMathLib for uint256;\\n\\n /// @notice Emitted reward is claimed by a token owner\\n event RewardClaimed(uint256 reward, address receiver);\\n /// @notice Emitted when new rewards are deposited\\n event RewardDeposited(address sender, uint value);\\n\\n /// @notice Accumulator of the total earned interest rate since the opening of the token\\n uint public rewardIndex = 1e8;\\n\\n /// @notice The owners' reward indexes for eachas of the last time they accrued\\n mapping(address => uint) public rewardOwnerIndex;\\n\\n /// @notice\\n uint16 public numberCoins;\\n\\n Vault public vault;\\n\\n // 0xbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb7716\\n bytes32 public constant BALANCE_UPDATER_ROLE = keccak256(\\\"BALANCE_UPDATE_ROLE\\\");\\n // 0x350f4eb58665205037e4a10647f66a623dc93281f72575646a8f0c90d88b72ae\\n bytes32 public constant REWARD_CLAIMER_ROLE = keccak256(\\\"REWARD_CLAIMER_ROLE\\\");\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n function __RewardHolder_init() internal onlyInitializing {\\n __AccessControl_init();\\n _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\\n __ReentrancyGuard_init();\\n }\\n\\n /// @dev set vault\\n /// @notice that is mandatory to be set before reward can be claimed\\n function setVault(Vault vault_) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n vault = vault_;\\n }\\n\\n /// @dev deposit reward to the contract to be claimed by token owners\\n /// @notice only role with BALANCE_UPDATER_ROLE can call this function\\n /// @param plusReward amount of reward to be deposited\\n function depositReward(uint256 plusReward) public onlyRole(BALANCE_UPDATER_ROLE) nonReentrant {\\n // update reward index for claim reward logic\\n rewardIndex += plusReward;\\n emit RewardDeposited(_msgSender(), plusReward);\\n }\\n\\n /// @dev claim reward for token owner\\n function claimReward() external nonReentrant {\\n require(vault != Vault(address(0)), \\\"Vault not set.\\\");\\n\\n require(rewardOwnerIndex[msg.sender] != 0, \\\"Caller doesn't have reward.\\\");\\n\\n uint deltaIndex = rewardIndex - rewardOwnerIndex[msg.sender];\\n\\n // calculate reward for token owner\\n //todo discuss the proper calculation mechanism\\n uint256 tokenOwnerReward = deltaIndex.mulDivDown(1, numberCoins);\\n rewardOwnerIndex[msg.sender] = rewardIndex;\\n\\n // transfer reward to token owner\\n vault.transfer(msg.sender, tokenOwnerReward);\\n emit RewardClaimed(tokenOwnerReward, address(msg.sender));\\n }\\n\\n /// @dev setup new owner for reward usually called when minting new token\\n function setupNewOwner(address rewardOwner) internal virtual onlyRole(BALANCE_UPDATER_ROLE) {\\n rewardOwnerIndex[rewardOwner] = rewardIndex;\\n numberCoins++;\\n }\\n}\",\"keccak256\":\"0xddee10afce7b6f2aa5437d763ed3f3bb094acaef8ea93aa20be1feffc2565692\",\"license\":\"AGPL-3.0\"},\"src/tokens/SafeERC4626Lifecycle.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {SafeERC4626Upgradeable} from \\\"./SafeERC4626Upgradeable.sol\\\";\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\nimport {IVaultHook, ERC4626UpgradeableRequest} from \\\"./IVaultHook.sol\\\";\\n\\nabstract contract SafeERC4626Lifecycle is SafeERC4626Upgradeable {\\n // list of hooks\\n IVaultHook[] public withdrawHooks;\\n IVaultHook[] public depositHooks;\\n\\n /// @dev Adds hook to the list of deposit hooks\\n function addDepositHook(IVaultHook hook) internal {\\n depositHooks.push(hook);\\n }\\n\\n /// @dev Adds hook to the list of withdraw hooks\\n function addWithdrawHook(IVaultHook hook) internal {\\n withdrawHooks.push(hook);\\n }\\n\\n /// @dev Removes hook from the list of deposit hooks\\n function removeDepositHook(IVaultHook hook) internal {\\n // find hook\\n for (uint256 i = 0; i < depositHooks.length; i++)\\n {\\n if (depositHooks[i] == hook)\\n {\\n // remove hook\\n depositHooks[i] = depositHooks[depositHooks.length - 1];\\n depositHooks.pop();\\n return;\\n }\\n }\\n }\\n\\n /// @dev Removes hook from the list of withdraw hooks\\n function removeWithdrawHook(IVaultHook hook) internal {\\n // find hook\\n for (uint256 i = 0; i < withdrawHooks.length; i++)\\n {\\n if (withdrawHooks[i] == hook)\\n {\\n // remove hook\\n withdrawHooks[i] = withdrawHooks[withdrawHooks.length - 1];\\n withdrawHooks.pop();\\n return;\\n }\\n }\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function beforeWithdraw(uint256 assets, uint256 shares)\\n internal virtual override(ERC4626Upgradeable)\\n {\\n // if there are no hooks, then return to save gas\\n if(withdrawHooks.length == 0) {\\n return;\\n }\\n uint256[46] memory gap_; // this is needed for future upgrades\\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\\n assets: assets,\\n shares: shares,\\n requestSender: msg.sender,\\n senderMaxWithdraw: maxWithdraw(msg.sender),\\n gap: gap_\\n });\\n // iterate over hooks and call it\\n for (uint256 i = 0; i < withdrawHooks.length; i++)\\n {\\n IVaultHook hook = withdrawHooks[i];\\n hook.beforeWithdrawTrigger(request);\\n }\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function afterDeposit(uint256 assets, uint256 shares)\\n internal virtual override(ERC4626Upgradeable)\\n {\\n // if there are no depositHooks, then return to save gas\\n if(depositHooks.length == 0) {\\n return;\\n }\\n uint256[46] memory gap_; // this is needed for future upgrades\\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\\n assets: assets,\\n shares: shares,\\n requestSender: msg.sender,\\n senderMaxWithdraw: maxWithdraw(msg.sender),\\n gap: gap_\\n });\\n // iterate over depositHooks and call it\\n for (uint256 i = 0; i < depositHooks.length; i++)\\n {\\n IVaultHook hook = depositHooks[i];\\n hook.afterDepositTrigger(request);\\n }\\n }\\n}\",\"keccak256\":\"0x4bcb991d6c94589ef649777adbb21f5b1bbf7ca36ace8aeddf506bd3fdcef06c\",\"license\":\"AGPL-3.0\"},\"src/tokens/SafeERC4626Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {FixedPointMathLib} from \\\"solmate/utils/FixedPointMathLib.sol\\\";\\n\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\n\\n/// @title Safier and limited implementation of ERC-4626\\n/// @notice ERC-4626 standard allow deposit and withdraw not for message sender.\\n/// It commonly known issue, which hardly to test and much error prune.\\n/// Such interfaces caused vulnarabilities, which resulted in million dollars hacks.\\n/// On anther hand, this interfaces not have any use cases which cannot be implemented without `transferFrom` method.\\n/// This implementation prevent spends and allowances from any methods except transferFrom/send\\n/// Also main business logic simplified to reduce gas consumption.\\nabstract contract SafeERC4626Upgradeable is ERC4626Upgradeable {\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n using FixedPointMathLib for uint256;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n /**\\n * Constructor for the SafeERC4626Upgradeable contract\\n * @param _asset which will be stored in this Vault\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __SafeERC4626_init(\\n IERC20Upgradeable _asset,\\n string memory name_,\\n string memory symbol_,\\n address[] memory defaultOperators_\\n ) internal onlyInitializing {\\n __ERC4626_init(_asset, name_, symbol_, defaultOperators_);\\n }\\n\\n /**\\n * Unchained constructor for the SafeERC4626Upgradeable contract, without parents contracts init\\n * @param _asset which will be stored in this Vault\\n */\\n function __SafeERC4626Upgradeable_init_unchained(IERC20Upgradeable _asset)\\n internal\\n onlyInitializing\\n {\\n __ERC4626_init_unchained(_asset);\\n }\\n\\n /// @notice Mints the Vault shares for msg.sender, according to the number of deposited base tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function deposit(uint256 assets)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n shares = previewDeposit(assets);\\n // Check for rounding error since we round down in previewDeposit.\\n require(shares != 0, \\\"Given assets result in 0 shares.\\\");\\n\\n _receiveAndDeposit(assets, shares, msg.sender);\\n }\\n\\n /// @notice Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function mint(uint256 shares)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n // No need to check for rounding error, previewMint rounds up.\\n assets = previewMint(shares);\\n\\n _receiveAndDeposit(assets, shares, msg.sender);\\n }\\n\\n /// @notice Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender.\\n /// - emit the Withdraw event.\\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the withdraw execution, and are accounted for during withdraw.\\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function withdraw(uint256 assets)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n // No need to check for rounding error, previewWithdraw rounds up.\\n shares = previewWithdraw(assets);\\n\\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\\n }\\n\\n /// @notice Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender.\\n /// - emit the Withdraw event.\\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the redeem execution, and are accounted for during redeem.\\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function redeem(uint256 shares)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n assets = previewRedeem(shares);\\n // Check for rounding error since we round down in previewRedeem.\\n require(assets != 0, \\\"Given shares result in 0 assets.\\\");\\n\\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\\n }\\n\\n /* //////////////////// Backwards compatible methods ////////////////////////// */\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function deposit(\\n uint256 assets,\\n address /* receiver */\\n ) public virtual override returns (uint256 shares) {\\n // nonReentrant under the hood\\n return deposit(assets);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function mint(\\n uint256 shares,\\n address /* receiver */\\n ) public virtual override returns (uint256 assets) {\\n // nonReentrant under the hood\\n return mint(shares);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function withdraw(\\n uint256 assets,\\n address, /* receiver */\\n address /* owner */\\n ) public virtual override returns (uint256 shares) {\\n // nonReentrant under the hood\\n return withdraw(assets);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function redeem(\\n uint256 shares,\\n address, /* receiver */\\n address /* owner */\\n ) public virtual override returns (uint256 assets) {\\n // nonReentrant under the hood\\n return redeem(shares);\\n }\\n}\\n\",\"keccak256\":\"0x8c3eaf2ed84e1ebff549cf33feb30788baec1f352a0a98a723621094535cf89e\",\"license\":\"AGPL-3.0\"},\"src/tokens/VaultFounderToken.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {IERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {ERC721URIStorageUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\\\";\\n\\nimport {SafeInitializable} from \\\"../upgradeable/SafeInitializable.sol\\\";\\nimport {SafeUUPSUpgradeable} from \\\"../upgradeable/SafeUUPSUpgradeable.sol\\\";\\nimport {IVersionable} from \\\"../upgradeable/IVersionable.sol\\\";\\nimport {ERC5484Upgradeable} from \\\"./ERC5484Upgradeable.sol\\\";\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\nimport {IVaultFounderToken} from \\\"./IVaultFounderToken.sol\\\";\\nimport {IVaultHook, ERC4626UpgradeableRequest} from \\\"./IVaultHook.sol\\\";\\nimport {RewardHolder} from \\\"./RewardHolder.sol\\\";\\n\\ncontract VaultFounderToken is IVaultFounderToken, SafeUUPSUpgradeable, ERC5484Upgradeable, IVaultHook, RewardHolder {\\n\\n // Max number of tokens that can be minted\\n uint256 private _maxCountTokens;\\n\\n // Next token price multiplier in percents\\n uint256 private _nextTokenPriceMultiplier;\\n\\n // Initial token price\\n uint256 private _initialTokenPrice;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[46] private __gap;\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\\n\\n function initialize(\\n uint256 maxCountTokens_,\\n uint256 nextTokenPriceMultiplier_,\\n uint256 initialTokenPrice_\\n ) public initializer {\\n __SafeUUPSUpgradeable_init_direct();\\n __ERC5484Upgradeable_init(\\\"Eonian Vault Founder Token\\\", \\\"EVFT\\\", BurnAuth.Neither, true);\\n __RewardHolder_init();\\n _maxCountTokens = maxCountTokens_;\\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\\n _initialTokenPrice = initialTokenPrice_;\\n }\\n\\n /// @inheritdoc IVersionable\\n function version() external pure returns (string memory) {\\n return \\\"0.1.0\\\";\\n }\\n\\n /// @dev function for mint new SBT token\\n /// @param to address of user who will receive token\\n /// @param uri token metadata uri\\n /// @return true if token was minted\\n function safeMint(address to, string memory uri) public virtual override(ERC5484Upgradeable) returns(bool){\\n if(totalSupply() < _maxCountTokens) {\\n bool tokenCreated = super.safeMint(to, uri);\\n if(tokenCreated) {\\n setupNewOwner(to);\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /// @inheritdoc ERC721Upgradeable\\n function _safeMint(address to, uint256 tokenId) internal override {\\n require(totalSupply() < _maxCountTokens, \\\"EVFT: max number of tokens\\\");\\n super._safeMint(to, tokenId);\\n }\\n\\n /// @inheritdoc IVaultFounderToken\\n function priceOf(uint256 tokenId) external view returns (uint256) {\\n require(tokenId < totalSupply(), \\\"EVFT: Token does not exist\\\");\\n return _priceOf(tokenId);\\n }\\n\\n /// @dev internal implementation for calculate price for the next token based on\\n /// the current sequential token id\\n function _priceOf(uint256 tokenId) internal view returns (uint256) {\\n uint256 price = _initialTokenPrice;\\n for (uint256 i = 0; i < tokenId; i++) {\\n price = (price * _nextTokenPriceMultiplier) / 10_000;\\n }\\n return price;\\n }\\n\\n /// @dev set multiplicator for the next token in percents\\n /// in case nextTokenPriceMultiplier_ = 13_000 the next price of the token will be: curPrice * 130%\\n /// @param nextTokenPriceMultiplier_ persent multiplicator\\n function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\\n }\\n\\n /// @inheritdoc IVaultFounderToken\\n function nextTokenPrice() external view returns (uint256){\\n return _nextTokenPrice();\\n }\\n\\n /// @dev calculate price for the next token\\n function _nextTokenPrice() internal view returns (uint256){\\n return _priceOf(totalSupply());\\n }\\n\\n /// @inheritdoc IVaultFounderToken\\n function setTokenURI(string memory _tokenURI) external override {\\n address tokenOwner = msg.sender;\\n uint256 tokenId = tokenOfOwnerByIndex(tokenOwner, 0);\\n _setTokenURI(tokenId, _tokenURI);\\n }\\n\\n /// @inheritdoc IVaultFounderToken\\n function setTokenURI(string memory _tokenURI, uint256 tokenId) external override onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setTokenURI(tokenId, _tokenURI);\\n }\\n\\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request)\\n external override\\n {\\n if(request.senderMaxWithdraw >= _nextTokenPrice()) {\\n safeMint(request.requestSender, \\\"\\\");\\n }\\n }\\n\\n /* solhint-disable no-empty-blocks */\\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external override\\n {\\n //empty code\\n }\\n /* solhint-disable no-empty-blocks */\\n\\n /// @dev See {IERC165-supportsInterface}.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n override(ERC5484Upgradeable, AccessControlUpgradeable, IERC165Upgradeable)\\n virtual\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceId);\\n }\\n}\",\"keccak256\":\"0x162dc48f0a3e74451be5371f6666ef6c9aa435055e925d8c46bd6e9a4b6ff99d\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/IVersionable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\n/** \\n * Allow properly identify different versions of the same contract \\n * and track upgrades results \\n * */\\ninterface IVersionable {\\n /// @notice Returns the current version of this contract\\n /// @return a version in semantic versioning format\\n function version() external pure returns (string memory);\\n}\\n\",\"keccak256\":\"0x13e08376fa8013858c0031556eaae03e4c8d517597cb5f0524040ef36a7c9006\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/SafeInitializable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IVersionable} from \\\"./IVersionable.sol\\\";\\n\\n/** Implement best practices for initializable contracts */\\nabstract contract SafeInitializable is IVersionable, Initializable {\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /**\\n * This constructor prevents UUPS Uninitialized Proxies Vulnerability in all contracts which inherit from it.\\n * More info about vulnerability: https://medium.com/immunefi/wormhole-uninitialized-proxy-bugfix-review-90250c41a43a\\n * \\n * @dev Initial fix for this vulnerability was suggested as using `_disableInitializers()` function in constructor,\\n * but later, in version 4.3.2, OpenZeppelin implemented `onlyProxy` modifier for UUPS upgradable contracts,\\n * which fixed this vulnerability. Still, `_disableInitializers()` is a best practice which prevents unintended access \\n * to implementation contracts that can be used maliciously.\\n * \\n * More info: https://forum.openzeppelin.com/t/how-to-test-upgradeability-for-proxies/33436/7 \\n * and https://forum.openzeppelin.com/t/uupsupgradeable-vulnerability-post-mortem/15680\\n * \\n * To prevent code duplication of constructor, this contract can be used. On the other hand, \\n * it can be used as a marker for contracts that are safe from this vulnerability.\\n * Additionally, `needDisableInitializers` parameter can be used to enable initializers in mocks and unit tests.\\n *\\n * @param needDisableInitializers - if true, initializers will be disabled\\n */\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(bool needDisableInitializers) {\\n if(needDisableInitializers) {\\n _disableInitializers();\\n }\\n }\\n}\",\"keccak256\":\"0xece22d8416967bebd1c1008f135e19224ed4afe81e30204fbf3b2d97c73db8b6\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/SafeUUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {UUPSUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {SafeInitializable} from \\\"./SafeInitializable.sol\\\";\\n\\n/** \\n * Implement basic safety mechanism for UUPS proxy\\n * based on owner authorization for upgrades\\n * */\\nabstract contract SafeUUPSUpgradeable is UUPSUpgradeable, SafeInitializable, OwnableUpgradeable {\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /** Init all required constructors, including ownable */\\n function __SafeUUPSUpgradeable_init() internal onlyInitializing {\\n __SafeUUPSUpgradeable_init_direct();\\n\\n __Ownable_init();\\n }\\n\\n /** Init only direct constructors, UUPS only */\\n function __SafeUUPSUpgradeable_init_direct() internal onlyInitializing {\\n __UUPSUpgradeable_init();\\n }\\n\\n /** Authorise that upgrades can do only owner */\\n function _authorizeUpgrade(address newImplementation) internal onlyOwner override {} // solhint-disable-line no-empty-blocks\\n}\\n\",\"keccak256\":\"0xaf322f5c5eeb718b7834b2eac8bfee7ce8062383840acc1d28b27351a759304e\",\"license\":\"AGPL-3.0\"}},\"version\":1}", + "bytecode": "0x60a0604052306080526305f5e10061028b553480156200001e57600080fd5b50604051620042583803806200425883398101604081905262000041916200011c565b8080156200005357620000536200005b565b505062000147565b600054610100900460ff1615620000c85760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146200011a576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200012f57600080fd5b815180151581146200014057600080fd5b9392505050565b6080516140d96200017f60003960008181610e4601528181610e8601528181610f5e01528181610f9e01526110c201526140d96000f3fe6080604052600436106102e45760003560e01c8063715018a611610190578063b9186d7d116100dc578063e0df5b6f11610095578063ed0693ff1161006f578063ed0693ff14610928578063f27d340d1461095c578063f2fde38b14610990578063fbfa77cf146109b057600080fd5b8063e0df5b6f146108a7578063e985e9c5146108c7578063e9ee2fa91461091157600080fd5b8063b9186d7d146107d3578063c87b56dd146107f3578063d204c45e14610813578063d3f4ccd814610833578063d539139314610853578063d547741f1461088757600080fd5b806391d1485411610149578063a217fddf11610123578063a217fddf14610769578063a22cb4651461077e578063b88a802f1461079e578063b88d4fde146107b357600080fd5b806391d148541461071457806395d89b41146107345780639c76796c1461074957600080fd5b8063715018a61461065f57806376a939441461067457806380d8591114610689578063894a16f5146106a9578063899cf361146106c75780638da5cb5b146106f557600080fd5b80632f745c591161024f5780634f6ccce7116102085780636352211e116101e25780636352211e146105d0578063675cccfe146105f05780636817031b1461061f57806370a082311461063f57600080fd5b80634f6ccce71461056d57806352d1902d1461058d57806354fd4d50146105a257600080fd5b80632f745c59146104ba57806336568abe146104da5780633659cfe6146104fa57806342842e0e1461051a57806342966c681461053a5780634f1ef2861461055a57600080fd5b806318160ddd116102a157806318160ddd146103e75780631e2720ff1461040757806323b872dd14610427578063248a9ca314610447578063282c51f3146104785780632f2ff15d1461049a57600080fd5b806301ffc9a7146102e95780630489b56f1461031e57806306fdde031461034b578063081812fc1461036d578063095ea7b3146103a557806309a3beef146103c7575b600080fd5b3480156102f557600080fd5b506103096103043660046135bd565b6109d7565b60405190151581526020015b60405180910390f35b34801561032a57600080fd5b5061033e6103393660046135da565b6109e8565b6040516103159190613609565b34801561035757600080fd5b50610360610a5d565b6040516103159190613681565b34801561037957600080fd5b5061038d6103883660046135da565b610aef565b6040516001600160a01b039091168152602001610315565b3480156103b157600080fd5b506103c56103c03660046136a9565b610b16565b005b3480156103d357600080fd5b506103c56103e23660046137c5565b610c2b565b3480156103f357600080fd5b50610193545b604051908152602001610315565b34801561041357600080fd5b506103c56104223660046135da565b610c40565b34801561043357600080fd5b506103c561044236600461380a565b610cd4565b34801561045357600080fd5b506103f96104623660046135da565b60009081526101f5602052604090206001015490565b34801561048457600080fd5b506103f960008051602061403d83398151915281565b3480156104a657600080fd5b506103c56104b536600461384b565b610d05565b3480156104c657600080fd5b506103f96104d53660046136a9565b610d2b565b3480156104e657600080fd5b506103c56104f536600461384b565b610dc2565b34801561050657600080fd5b506103c561051536600461387b565b610e3c565b34801561052657600080fd5b506103c561053536600461380a565b610f18565b34801561054657600080fd5b506103c56105553660046135da565b610f33565b6103c5610568366004613898565b610f54565b34801561057957600080fd5b506103f96105883660046135da565b611020565b34801561059957600080fd5b506103f96110b5565b3480156105ae57600080fd5b506040805180820190915260058152640302e312e360dc1b6020820152610360565b3480156105dc57600080fd5b5061038d6105eb3660046135da565b611168565b3480156105fc57600080fd5b5061028d5461060c9061ffff1681565b60405161ffff9091168152602001610315565b34801561062b57600080fd5b506103c561063a36600461387b565b6111c8565b34801561064b57600080fd5b506103f961065a36600461387b565b6111ff565b34801561066b57600080fd5b506103c5611285565b34801561068057600080fd5b506103f9611299565b34801561069557600080fd5b506103c56106a43660046138e8565b6112a8565b3480156106b557600080fd5b506103c56106c4366004613914565b50565b3480156106d357600080fd5b506103f96106e236600461387b565b61028c6020526000908152604090205481565b34801561070157600080fd5b5061012d546001600160a01b031661038d565b34801561072057600080fd5b5061030961072f36600461384b565b611435565b34801561074057600080fd5b50610360611461565b34801561075557600080fd5b506103c56107643660046135da565b611470565b34801561077557600080fd5b506103f9600081565b34801561078a57600080fd5b506103c56107993660046139c1565b611482565b3480156107aa57600080fd5b506103c561148d565b3480156107bf57600080fd5b506103c56107ce3660046139ef565b61165d565b3480156107df57600080fd5b506103f96107ee3660046135da565b61168f565b3480156107ff57600080fd5b5061036061080e3660046135da565b6116f2565b34801561081f57600080fd5b5061030961082e366004613898565b6116fd565b34801561083f57600080fd5b506103c561084e366004613914565b611745565b34801561085f57600080fd5b506103f97f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b34801561089357600080fd5b506103c56108a236600461384b565b611774565b3480156108b357600080fd5b506103c56108c2366004613a5b565b61179a565b3480156108d357600080fd5b506103096108e2366004613a90565b6001600160a01b0391821660009081526101006020908152604080832093909416825291909152205460ff1690565b34801561091d57600080fd5b506103f961028b5481565b34801561093457600080fd5b506103f97fbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb771681565b34801561096857600080fd5b506103f97f350f4eb58665205037e4a10647f66a623dc93281f72575646a8f0c90d88b72ae81565b34801561099c57600080fd5b506103c56109ab36600461387b565b6117b3565b3480156109bc57600080fd5b5061028d5461038d906201000090046001600160a01b031681565b60006109e282611829565b92915050565b600081815260fd60205260408120546001600160a01b0316610a515760405162461bcd60e51b815260206004820152601d60248201527f455243353438343a20746f6b656e20646f65736e27742065786973747300000060448201526064015b60405180910390fd5b50506102285460ff1690565b606060fb8054610a6c90613abe565b80601f0160208091040260200160405190810160405280929190818152602001828054610a9890613abe565b8015610ae55780601f10610aba57610100808354040283529160200191610ae5565b820191906000526020600020905b815481529060010190602001808311610ac857829003601f168201915b5050505050905090565b6000610afa82611869565b50600090815260ff60205260409020546001600160a01b031690565b6000610b2182611168565b9050806001600160a01b0316836001600160a01b031603610b8e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a48565b336001600160a01b0382161480610baa5750610baa81336108e2565b610c1c5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610a48565b610c2683836118c8565b505050565b6000610c3681611936565b610c268284611940565b7fbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb7716610c6a81611936565b610c72611a0c565b8161028b6000828254610c859190613b0e565b9091555050604080513381526020810184905281517f7dbc080e4530c8bcf265eb5c9a35ae096ca1eb607b7e802b96581ef4c5e1a703929181900390910190a1610cd0600161025955565b5050565b610cde3382611a6f565b610cfa5760405162461bcd60e51b8152600401610a4890613b21565b610c26838383611aef565b60008281526101f56020526040902060010154610d2181611936565b610c268383611c60565b6000610d36836111ff565b8210610d985760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610a48565b506001600160a01b0391909116600090815261019160209081526040808320938352929052205490565b6001600160a01b0381163314610e325760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a48565b610cd08282611ce7565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610e845760405162461bcd60e51b8152600401610a4890613b6e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610ecd60008051602061405d833981519152546001600160a01b031690565b6001600160a01b031614610ef35760405162461bcd60e51b8152600401610a4890613bba565b610efc81611d4f565b604080516000808252602082019092526106c491839190611d57565b610c268383836040518060200160405280600081525061165d565b60008051602061403d833981519152610f4b81611936565b610cd082611ec2565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610f9c5760405162461bcd60e51b8152600401610a4890613b6e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610fe560008051602061405d833981519152546001600160a01b031690565b6001600160a01b03161461100b5760405162461bcd60e51b8152600401610a4890613bba565b61101482611d4f565b610cd082826001611d57565b600061102c6101935490565b821061108f5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610a48565b61019382815481106110a3576110a3613c06565b90600052602060002001549050919050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146111555760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610a48565b5060008051602061405d83398151915290565b600081815260fd60205260408120546001600160a01b0316806109e25760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610a48565b60006111d381611936565b5061028d80546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60006001600160a01b0382166112695760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610a48565b506001600160a01b0316600090815260fe602052604090205490565b61128d611ecb565b6112976000611f26565b565b60006112a3611f79565b905090565b600054610100900460ff16158080156112c85750600054600160ff909116105b806112e25750303b1580156112e2575060005460ff166001145b6113455760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a48565b6000805460ff191660011790558015611368576000805461ff0019166101001790555b611370611f8d565b6113cf6040518060400160405280601a81526020017f456f6e69616e205661756c7420466f756e64657220546f6b656e000000000000815250604051806040016040528060048152602001631155919560e21b81525060036001611fbc565b6113d7612049565b61028e84905561028f839055610290829055801561142f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60009182526101f5602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060fc8054610a6c90613abe565b600061147b81611936565b5061028f55565b610cd033838361208b565b611495611a0c565b61028d546201000090046001600160a01b03166114e55760405162461bcd60e51b815260206004820152600e60248201526d2b30bab63a103737ba1039b2ba1760911b6044820152606401610a48565b33600090815261028c602052604081205490036115445760405162461bcd60e51b815260206004820152601b60248201527f43616c6c657220646f65736e27742068617665207265776172642e00000000006044820152606401610a48565b33600090815261028c602052604081205461028b546115639190613c1c565b61028d5490915060009061157f90839060019061ffff1661215a565b61028b5433600081815261028c6020526040908190209290925561028d54915163a9059cbb60e01b81526004810191909152602481018390529192506201000090046001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190613c2f565b50604080518281523360208201527f5dd59f4285b36241394b73f8f7ae03d0290b030a86803cf2562ecf33eeb617bd910160405180910390a15050611297600161025955565b6116673383611a6f565b6116835760405162461bcd60e51b8152600401610a4890613b21565b61142f84848484612179565b600061169b6101935490565b82106116e95760405162461bcd60e51b815260206004820152601a60248201527f455646543a20546f6b656e20646f6573206e6f742065786973740000000000006044820152606401610a48565b6109e2826121ac565b60606109e2826121f4565b600061028e5461170d6101935490565b101561173c57600061171f84846122fd565b9050801561173a576117308461243a565b60019150506109e2565b505b50600092915050565b61174d611f79565b8160600151106106c457610cd08160400151604051806020016040528060008152506116fd565b60008281526101f5602052604090206001015461179081611936565b610c268383611ce7565b3360006117a78282610d2b565b9050610c268184611940565b6117bb611ecb565b6001600160a01b0381166118205760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a48565b6106c481611f26565b60006001600160e01b03198216630489b56f60e01b148061185a57506001600160e01b03198216637965db0b60e01b145b806109e257506109e2826124b7565b600081815260fd60205260409020546001600160a01b03166106c45760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610a48565b600081815260ff6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118fd82611168565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6106c481336124dc565b600082815260fd60205260409020546001600160a01b03166119bb5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610a48565b60008281526101c3602052604090206119d48282613c9a565b506040518281527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b60026102595403611a5f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a48565b600261025955565b600161025955565b600080611a7b83611168565b9050806001600160a01b0316846001600160a01b03161480611ac357506001600160a01b038082166000908152610100602090815260408083209388168352929052205460ff165b80611ae75750836001600160a01b0316611adc84610aef565b6001600160a01b0316145b949350505050565b826001600160a01b0316611b0282611168565b6001600160a01b031614611b285760405162461bcd60e51b8152600401610a4890613d5a565b6001600160a01b038216611b8a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a48565b611b978383836001612535565b826001600160a01b0316611baa82611168565b6001600160a01b031614611bd05760405162461bcd60e51b8152600401610a4890613d5a565b600081815260ff6020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260fe855283862080546000190190559087168086528386208054600101905586865260fd90945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611c6a8282611435565b610cd05760008281526101f5602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611ca33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611cf18282611435565b15610cd05760008281526101f5602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6106c4611ecb565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611d8a57610c26836126fb565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611de4575060408051601f3d908101601f19168201909252611de191810190613d9f565b60015b611e475760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610a48565b60008051602061405d8339815191528114611eb65760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610a48565b50610c26838383612797565b6106c4816127bc565b61012d546001600160a01b031633146112975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a48565b61012d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006112a3611f886101935490565b6121ac565b600054610100900460ff16611fb45760405162461bcd60e51b8152600401610a4890613db8565b6112976127fe565b600054610100900460ff16611fe35760405162461bcd60e51b8152600401610a4890613db8565b611fed8484612825565b611ff56127fe565b611ffd6127fe565b6120056127fe565b610228805483919060ff19166001836003811115612025576120256135f3565b0217905550610228805461ff0019166101008315150217905561142f600033612856565b600054610100900460ff166120705760405162461bcd60e51b8152600401610a4890613db8565b6120786127fe565b612083600033612856565b611297612860565b816001600160a01b0316836001600160a01b0316036120ec5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a48565b6001600160a01b0383811660008181526101006020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b82820281151584158583048514171661217257600080fd5b0492915050565b612184848484611aef565b6121908484848461288f565b61142f5760405162461bcd60e51b8152600401610a4890613e03565b61029054600090815b838110156121ed5761271061028f54836121cf9190613e55565b6121d99190613e6c565b9150806121e581613e8e565b9150506121b5565b5092915050565b60606121ff82611869565b60008281526101c360205260408120805461221990613abe565b80601f016020809104026020016040519081016040528092919081815260200182805461224590613abe565b80156122925780601f1061226757610100808354040283529160200191612292565b820191906000526020600020905b81548152906001019060200180831161227557829003601f168201915b5050505050905060006122b060408051602081019091526000815290565b905080516000036122c2575092915050565b8151156122f45780826040516020016122dc929190613ea7565b60405160208183030381529060405292505050919050565b611ae784612990565b60007f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661232981611936565b61022854610100900460ff1680156123485750612345846111ff565b15155b1561235657600091506121ed565b60006123626102275490565b905061237361022780546001019055565b61237d8582612a04565b6123878185611940565b60016102285460ff1660038111156123a1576123a16135f3565b14806123c4575060026102285460ff1660038111156123c2576123c26135f3565b145b156123e1576123e160008051602061403d83398151915286612856565b6102285460405182916001600160a01b038816916000917f135ffb3383e06280e062ac5095bbf8faa98517161e596a2536bd98a9a8b64a88916124279160ff1690613609565b60405180910390a4506001949350505050565b7fbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb771661246481611936565b61028b546001600160a01b038316600090815261028c602052604081209190915561028d805461ffff169161249883613ed6565b91906101000a81548161ffff021916908361ffff160217905550505050565b60006001600160e01b03198216637965db0b60e01b14806109e257506109e282612a63565b6124e68282611435565b610cd0576124f381612a88565b6124fe836020612a9a565b60405160200161250f929190613ef7565b60408051601f198184030181529082905262461bcd60e51b8252610a4891600401613681565b8284836001600160a01b03821615600061255d60008051602061403d83398151915233611435565b905060008215801561257657506001600160a01b038616155b905060036102285460ff166003811115612592576125926135f3565b036125b957826125b45760405162461bcd60e51b8152600401610a4890613f6c565b6126e3565b60006102285460ff1660038111156125d3576125d36135f3565b036126115760008280156125e45750815b905083806125ef5750805b61260b5760405162461bcd60e51b8152600401610a4890613f6c565b506126e3565b60016102285460ff16600381111561262b5761262b6135f3565b0361269757600084815260fd60205260408120546001600160a01b031633148015612669575061266960008051602061403d83398151915233611435565b905083806125ef57508080156125ef57508161260b5760405162461bcd60e51b8152600401610a4890613f6c565b60026102285460ff1660038111156126b1576126b16135f3565b036126e35782806126c757508080156126c75750815b6126e35760405162461bcd60e51b8152600401610a4890613f6c565b6126ef8a8a8a8a612c36565b50505050505050505050565b6001600160a01b0381163b6127685760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610a48565b60008051602061405d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6127a083612d6c565b6000825111806127ad5750805b15610c265761142f8383612dac565b6127c581612dd1565b60008181526101c36020526040902080546127df90613abe565b1590506106c45760008181526101c3602052604081206106c491613559565b600054610100900460ff166112975760405162461bcd60e51b8152600401610a4890613db8565b600054610100900460ff1661284c5760405162461bcd60e51b8152600401610a4890613db8565b610cd08282612e74565b610cd08282611c60565b600054610100900460ff166128875760405162461bcd60e51b8152600401610a4890613db8565b611297612eb4565b60006001600160a01b0384163b1561298557604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906128d3903390899088908890600401613fa3565b6020604051808303816000875af192505050801561290e575060408051601f3d908101601f1916820190925261290b91810190613fd6565b60015b61296b573d80801561293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b5080516000036129635760405162461bcd60e51b8152600401610a4890613e03565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ae7565b506001949350505050565b606061299b82611869565b60006129b260408051602081019091526000815290565b905060008151116129d257604051806020016040528060008152506129fd565b806129dc84612edb565b6040516020016129ed929190613ea7565b6040516020818303038152906040525b9392505050565b61028e546101935410612a595760405162461bcd60e51b815260206004820152601a60248201527f455646543a206d6178206e756d626572206f6620746f6b656e730000000000006044820152606401610a48565b610cd08282612f6e565b60006001600160e01b03198216632483248360e11b14806109e257506109e282612f88565b60606109e26001600160a01b03831660145b60606000612aa9836002613e55565b612ab4906002613b0e565b67ffffffffffffffff811115612acc57612acc6136d5565b6040519080825280601f01601f191660200182016040528015612af6576020820181803683370190505b509050600360fc1b81600081518110612b1157612b11613c06565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612b4057612b40613c06565b60200101906001600160f81b031916908160001a9053506000612b64846002613e55565b612b6f906001613b0e565b90505b6001811115612be7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612ba357612ba3613c06565b1a60f81b828281518110612bb957612bb9613c06565b60200101906001600160f81b031916908160001a90535060049490941c93612be081613ff3565b9050612b72565b5083156129fd5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a48565b6001811115612ca55760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610a48565b816001600160a01b038516612d0357612cfe816101938054600083815261019460205260408120829055600182018355919091527ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc680155565b612d26565b836001600160a01b0316856001600160a01b031614612d2657612d268582612fad565b6001600160a01b038416612d4257612d3d8161304f565b612d65565b846001600160a01b0316846001600160a01b031614612d6557612d658482613104565b5050505050565b612d75816126fb565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606129fd838360405180606001604052806027815260200161407d6027913961314a565b6000612ddc82611168565b9050612dec816000846001612535565b612df582611168565b600083815260ff6020908152604080832080546001600160a01b03199081169091556001600160a01b03851680855260fe8452828520805460001901905587855260fd909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600054610100900460ff16612e9b5760405162461bcd60e51b8152600401610a4890613db8565b60fb612ea78382613c9a565b5060fc610c268282613c9a565b600054610100900460ff16611a675760405162461bcd60e51b8152600401610a4890613db8565b60606000612ee8836131c2565b600101905060008167ffffffffffffffff811115612f0857612f086136d5565b6040519080825280601f01601f191660200182016040528015612f32576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612f3c57509392505050565b610cd082826040518060200160405280600081525061329a565b60006001600160e01b0319821663780e9d6360e01b14806109e257506109e2826132cd565b60006001612fba846111ff565b612fc49190613c1c565b6000838152610192602052604090205490915080821461301a576001600160a01b038416600090815261019160209081526040808320858452825280832054848452818420819055835261019290915290208190555b506000918252610192602090815260408084208490556001600160a01b03909416835261019181528383209183525290812055565b6101935460009061306290600190613c1c565b60008381526101946020526040812054610193805493945090928490811061308c5761308c613c06565b906000526020600020015490508061019383815481106130ae576130ae613c06565b600091825260208083209091019290925582815261019490915260408082208490558582528120556101938054806130e8576130e861400a565b6001900381819060005260206000200160009055905550505050565b600061310f836111ff565b6001600160a01b0390931660009081526101916020908152604080832086845282528083208590559382526101929052919091209190915550565b6060600080856001600160a01b0316856040516131679190614020565b600060405180830381855af49150503d80600081146131a2576040519150601f19603f3d011682016040523d82523d6000602084013e6131a7565b606091505b50915091506131b88683838761331d565b9695505050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106132015772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061322d576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061324b57662386f26fc10000830492506010015b6305f5e1008310613263576305f5e100830492506008015b612710831061327757612710830492506004015b60648310613289576064830492506002015b600a83106109e25760010192915050565b6132a48383613396565b6132b1600084848461288f565b610c265760405162461bcd60e51b8152600401610a4890613e03565b60006001600160e01b031982166380ac58cd60e01b14806132fe57506001600160e01b03198216635b5e139f60e01b145b806109e257506301ffc9a760e01b6001600160e01b03198316146109e2565b6060831561338c578251600003613385576001600160a01b0385163b6133855760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a48565b5081611ae7565b611ae7838361352f565b6001600160a01b0382166133ec5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a48565b600081815260fd60205260409020546001600160a01b0316156134515760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a48565b61345f600083836001612535565b600081815260fd60205260409020546001600160a01b0316156134c45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a48565b6001600160a01b038216600081815260fe602090815260408083208054600101905584835260fd90915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b81511561353f5781518083602001fd5b8060405162461bcd60e51b8152600401610a489190613681565b50805461356590613abe565b6000825580601f10613575575050565b601f0160209004906000526020600020908101906106c491905b808211156135a3576000815560010161358f565b5090565b6001600160e01b0319811681146106c457600080fd5b6000602082840312156135cf57600080fd5b81356129fd816135a7565b6000602082840312156135ec57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b602081016004831061362b57634e487b7160e01b600052602160045260246000fd5b91905290565b60005b8381101561364c578181015183820152602001613634565b50506000910152565b6000815180845261366d816020860160208601613631565b601f01601f19169290920160200192915050565b6020815260006129fd6020830184613655565b6001600160a01b03811681146106c457600080fd5b600080604083850312156136bc57600080fd5b82356136c781613694565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff8111828210171561370e5761370e6136d5565b60405290565b6040516105c0810167ffffffffffffffff8111828210171561370e5761370e6136d5565b600082601f83011261374957600080fd5b813567ffffffffffffffff80821115613764576137646136d5565b604051601f8301601f19908116603f0116810190828211818310171561378c5761378c6136d5565b816040528381528660208588010111156137a557600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080604083850312156137d857600080fd5b823567ffffffffffffffff8111156137ef57600080fd5b6137fb85828601613738565b95602094909401359450505050565b60008060006060848603121561381f57600080fd5b833561382a81613694565b9250602084013561383a81613694565b929592945050506040919091013590565b6000806040838503121561385e57600080fd5b82359150602083013561387081613694565b809150509250929050565b60006020828403121561388d57600080fd5b81356129fd81613694565b600080604083850312156138ab57600080fd5b82356138b681613694565b9150602083013567ffffffffffffffff8111156138d257600080fd5b6138de85828601613738565b9150509250929050565b6000806000606084860312156138fd57600080fd5b505081359360208301359350604090920135919050565b600061064080838503121561392857600080fd5b6139306136eb565b8335815260208085013581830152604085013561394c81613694565b806040840152506060850135606083015285609f86011261396c57600080fd5b613974613714565b92850192808785111561398657600080fd5b608087015b858110156139a2578035835291830191830161398b565b506080840152509095945050505050565b80151581146106c457600080fd5b600080604083850312156139d457600080fd5b82356139df81613694565b91506020830135613870816139b3565b60008060008060808587031215613a0557600080fd5b8435613a1081613694565b93506020850135613a2081613694565b925060408501359150606085013567ffffffffffffffff811115613a4357600080fd5b613a4f87828801613738565b91505092959194509250565b600060208284031215613a6d57600080fd5b813567ffffffffffffffff811115613a8457600080fd5b611ae784828501613738565b60008060408385031215613aa357600080fd5b8235613aae81613694565b9150602083013561387081613694565b600181811c90821680613ad257607f821691505b602082108103613af257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156109e2576109e2613af8565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b818103818111156109e2576109e2613af8565b600060208284031215613c4157600080fd5b81516129fd816139b3565b601f821115610c2657600081815260208120601f850160051c81016020861015613c735750805b601f850160051c820191505b81811015613c9257828155600101613c7f565b505050505050565b815167ffffffffffffffff811115613cb457613cb46136d5565b613cc881613cc28454613abe565b84613c4c565b602080601f831160018114613cfd5760008415613ce55750858301515b600019600386901b1c1916600185901b178555613c92565b600085815260208120601f198616915b82811015613d2c57888601518255948401946001909101908401613d0d565b5085821015613d4a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b600060208284031215613db157600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b80820281158282048414176109e2576109e2613af8565b600082613e8957634e487b7160e01b600052601260045260246000fd5b500490565b600060018201613ea057613ea0613af8565b5060010190565b60008351613eb9818460208801613631565b835190830190613ecd818360208801613631565b01949350505050565b600061ffff808316818103613eed57613eed613af8565b6001019392505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613f2f816017850160208801613631565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613f60816028840160208801613631565b01602801949350505050565b6020808252601d908201527f455243353438343a2063616e2774206265207472616e73666572726564000000604082015260600190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906131b890830184613655565b600060208284031215613fe857600080fd5b81516129fd816135a7565b60008161400257614002613af8565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251614032818460208701613631565b919091019291505056fe3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122023a590a6b598f29d17e9420d5adc01314a67cf07e077a9a203f61255f305ef6264736f6c63430008130033", + "deployedBytecode": "0x6080604052600436106102e45760003560e01c8063715018a611610190578063b9186d7d116100dc578063e0df5b6f11610095578063ed0693ff1161006f578063ed0693ff14610928578063f27d340d1461095c578063f2fde38b14610990578063fbfa77cf146109b057600080fd5b8063e0df5b6f146108a7578063e985e9c5146108c7578063e9ee2fa91461091157600080fd5b8063b9186d7d146107d3578063c87b56dd146107f3578063d204c45e14610813578063d3f4ccd814610833578063d539139314610853578063d547741f1461088757600080fd5b806391d1485411610149578063a217fddf11610123578063a217fddf14610769578063a22cb4651461077e578063b88a802f1461079e578063b88d4fde146107b357600080fd5b806391d148541461071457806395d89b41146107345780639c76796c1461074957600080fd5b8063715018a61461065f57806376a939441461067457806380d8591114610689578063894a16f5146106a9578063899cf361146106c75780638da5cb5b146106f557600080fd5b80632f745c591161024f5780634f6ccce7116102085780636352211e116101e25780636352211e146105d0578063675cccfe146105f05780636817031b1461061f57806370a082311461063f57600080fd5b80634f6ccce71461056d57806352d1902d1461058d57806354fd4d50146105a257600080fd5b80632f745c59146104ba57806336568abe146104da5780633659cfe6146104fa57806342842e0e1461051a57806342966c681461053a5780634f1ef2861461055a57600080fd5b806318160ddd116102a157806318160ddd146103e75780631e2720ff1461040757806323b872dd14610427578063248a9ca314610447578063282c51f3146104785780632f2ff15d1461049a57600080fd5b806301ffc9a7146102e95780630489b56f1461031e57806306fdde031461034b578063081812fc1461036d578063095ea7b3146103a557806309a3beef146103c7575b600080fd5b3480156102f557600080fd5b506103096103043660046135bd565b6109d7565b60405190151581526020015b60405180910390f35b34801561032a57600080fd5b5061033e6103393660046135da565b6109e8565b6040516103159190613609565b34801561035757600080fd5b50610360610a5d565b6040516103159190613681565b34801561037957600080fd5b5061038d6103883660046135da565b610aef565b6040516001600160a01b039091168152602001610315565b3480156103b157600080fd5b506103c56103c03660046136a9565b610b16565b005b3480156103d357600080fd5b506103c56103e23660046137c5565b610c2b565b3480156103f357600080fd5b50610193545b604051908152602001610315565b34801561041357600080fd5b506103c56104223660046135da565b610c40565b34801561043357600080fd5b506103c561044236600461380a565b610cd4565b34801561045357600080fd5b506103f96104623660046135da565b60009081526101f5602052604090206001015490565b34801561048457600080fd5b506103f960008051602061403d83398151915281565b3480156104a657600080fd5b506103c56104b536600461384b565b610d05565b3480156104c657600080fd5b506103f96104d53660046136a9565b610d2b565b3480156104e657600080fd5b506103c56104f536600461384b565b610dc2565b34801561050657600080fd5b506103c561051536600461387b565b610e3c565b34801561052657600080fd5b506103c561053536600461380a565b610f18565b34801561054657600080fd5b506103c56105553660046135da565b610f33565b6103c5610568366004613898565b610f54565b34801561057957600080fd5b506103f96105883660046135da565b611020565b34801561059957600080fd5b506103f96110b5565b3480156105ae57600080fd5b506040805180820190915260058152640302e312e360dc1b6020820152610360565b3480156105dc57600080fd5b5061038d6105eb3660046135da565b611168565b3480156105fc57600080fd5b5061028d5461060c9061ffff1681565b60405161ffff9091168152602001610315565b34801561062b57600080fd5b506103c561063a36600461387b565b6111c8565b34801561064b57600080fd5b506103f961065a36600461387b565b6111ff565b34801561066b57600080fd5b506103c5611285565b34801561068057600080fd5b506103f9611299565b34801561069557600080fd5b506103c56106a43660046138e8565b6112a8565b3480156106b557600080fd5b506103c56106c4366004613914565b50565b3480156106d357600080fd5b506103f96106e236600461387b565b61028c6020526000908152604090205481565b34801561070157600080fd5b5061012d546001600160a01b031661038d565b34801561072057600080fd5b5061030961072f36600461384b565b611435565b34801561074057600080fd5b50610360611461565b34801561075557600080fd5b506103c56107643660046135da565b611470565b34801561077557600080fd5b506103f9600081565b34801561078a57600080fd5b506103c56107993660046139c1565b611482565b3480156107aa57600080fd5b506103c561148d565b3480156107bf57600080fd5b506103c56107ce3660046139ef565b61165d565b3480156107df57600080fd5b506103f96107ee3660046135da565b61168f565b3480156107ff57600080fd5b5061036061080e3660046135da565b6116f2565b34801561081f57600080fd5b5061030961082e366004613898565b6116fd565b34801561083f57600080fd5b506103c561084e366004613914565b611745565b34801561085f57600080fd5b506103f97f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b34801561089357600080fd5b506103c56108a236600461384b565b611774565b3480156108b357600080fd5b506103c56108c2366004613a5b565b61179a565b3480156108d357600080fd5b506103096108e2366004613a90565b6001600160a01b0391821660009081526101006020908152604080832093909416825291909152205460ff1690565b34801561091d57600080fd5b506103f961028b5481565b34801561093457600080fd5b506103f97fbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb771681565b34801561096857600080fd5b506103f97f350f4eb58665205037e4a10647f66a623dc93281f72575646a8f0c90d88b72ae81565b34801561099c57600080fd5b506103c56109ab36600461387b565b6117b3565b3480156109bc57600080fd5b5061028d5461038d906201000090046001600160a01b031681565b60006109e282611829565b92915050565b600081815260fd60205260408120546001600160a01b0316610a515760405162461bcd60e51b815260206004820152601d60248201527f455243353438343a20746f6b656e20646f65736e27742065786973747300000060448201526064015b60405180910390fd5b50506102285460ff1690565b606060fb8054610a6c90613abe565b80601f0160208091040260200160405190810160405280929190818152602001828054610a9890613abe565b8015610ae55780601f10610aba57610100808354040283529160200191610ae5565b820191906000526020600020905b815481529060010190602001808311610ac857829003601f168201915b5050505050905090565b6000610afa82611869565b50600090815260ff60205260409020546001600160a01b031690565b6000610b2182611168565b9050806001600160a01b0316836001600160a01b031603610b8e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a48565b336001600160a01b0382161480610baa5750610baa81336108e2565b610c1c5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610a48565b610c2683836118c8565b505050565b6000610c3681611936565b610c268284611940565b7fbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb7716610c6a81611936565b610c72611a0c565b8161028b6000828254610c859190613b0e565b9091555050604080513381526020810184905281517f7dbc080e4530c8bcf265eb5c9a35ae096ca1eb607b7e802b96581ef4c5e1a703929181900390910190a1610cd0600161025955565b5050565b610cde3382611a6f565b610cfa5760405162461bcd60e51b8152600401610a4890613b21565b610c26838383611aef565b60008281526101f56020526040902060010154610d2181611936565b610c268383611c60565b6000610d36836111ff565b8210610d985760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610a48565b506001600160a01b0391909116600090815261019160209081526040808320938352929052205490565b6001600160a01b0381163314610e325760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a48565b610cd08282611ce7565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610e845760405162461bcd60e51b8152600401610a4890613b6e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610ecd60008051602061405d833981519152546001600160a01b031690565b6001600160a01b031614610ef35760405162461bcd60e51b8152600401610a4890613bba565b610efc81611d4f565b604080516000808252602082019092526106c491839190611d57565b610c268383836040518060200160405280600081525061165d565b60008051602061403d833981519152610f4b81611936565b610cd082611ec2565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610f9c5760405162461bcd60e51b8152600401610a4890613b6e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610fe560008051602061405d833981519152546001600160a01b031690565b6001600160a01b03161461100b5760405162461bcd60e51b8152600401610a4890613bba565b61101482611d4f565b610cd082826001611d57565b600061102c6101935490565b821061108f5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610a48565b61019382815481106110a3576110a3613c06565b90600052602060002001549050919050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146111555760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610a48565b5060008051602061405d83398151915290565b600081815260fd60205260408120546001600160a01b0316806109e25760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610a48565b60006111d381611936565b5061028d80546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60006001600160a01b0382166112695760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610a48565b506001600160a01b0316600090815260fe602052604090205490565b61128d611ecb565b6112976000611f26565b565b60006112a3611f79565b905090565b600054610100900460ff16158080156112c85750600054600160ff909116105b806112e25750303b1580156112e2575060005460ff166001145b6113455760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a48565b6000805460ff191660011790558015611368576000805461ff0019166101001790555b611370611f8d565b6113cf6040518060400160405280601a81526020017f456f6e69616e205661756c7420466f756e64657220546f6b656e000000000000815250604051806040016040528060048152602001631155919560e21b81525060036001611fbc565b6113d7612049565b61028e84905561028f839055610290829055801561142f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60009182526101f5602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060fc8054610a6c90613abe565b600061147b81611936565b5061028f55565b610cd033838361208b565b611495611a0c565b61028d546201000090046001600160a01b03166114e55760405162461bcd60e51b815260206004820152600e60248201526d2b30bab63a103737ba1039b2ba1760911b6044820152606401610a48565b33600090815261028c602052604081205490036115445760405162461bcd60e51b815260206004820152601b60248201527f43616c6c657220646f65736e27742068617665207265776172642e00000000006044820152606401610a48565b33600090815261028c602052604081205461028b546115639190613c1c565b61028d5490915060009061157f90839060019061ffff1661215a565b61028b5433600081815261028c6020526040908190209290925561028d54915163a9059cbb60e01b81526004810191909152602481018390529192506201000090046001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190613c2f565b50604080518281523360208201527f5dd59f4285b36241394b73f8f7ae03d0290b030a86803cf2562ecf33eeb617bd910160405180910390a15050611297600161025955565b6116673383611a6f565b6116835760405162461bcd60e51b8152600401610a4890613b21565b61142f84848484612179565b600061169b6101935490565b82106116e95760405162461bcd60e51b815260206004820152601a60248201527f455646543a20546f6b656e20646f6573206e6f742065786973740000000000006044820152606401610a48565b6109e2826121ac565b60606109e2826121f4565b600061028e5461170d6101935490565b101561173c57600061171f84846122fd565b9050801561173a576117308461243a565b60019150506109e2565b505b50600092915050565b61174d611f79565b8160600151106106c457610cd08160400151604051806020016040528060008152506116fd565b60008281526101f5602052604090206001015461179081611936565b610c268383611ce7565b3360006117a78282610d2b565b9050610c268184611940565b6117bb611ecb565b6001600160a01b0381166118205760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a48565b6106c481611f26565b60006001600160e01b03198216630489b56f60e01b148061185a57506001600160e01b03198216637965db0b60e01b145b806109e257506109e2826124b7565b600081815260fd60205260409020546001600160a01b03166106c45760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610a48565b600081815260ff6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118fd82611168565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6106c481336124dc565b600082815260fd60205260409020546001600160a01b03166119bb5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610a48565b60008281526101c3602052604090206119d48282613c9a565b506040518281527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b60026102595403611a5f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a48565b600261025955565b600161025955565b600080611a7b83611168565b9050806001600160a01b0316846001600160a01b03161480611ac357506001600160a01b038082166000908152610100602090815260408083209388168352929052205460ff165b80611ae75750836001600160a01b0316611adc84610aef565b6001600160a01b0316145b949350505050565b826001600160a01b0316611b0282611168565b6001600160a01b031614611b285760405162461bcd60e51b8152600401610a4890613d5a565b6001600160a01b038216611b8a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a48565b611b978383836001612535565b826001600160a01b0316611baa82611168565b6001600160a01b031614611bd05760405162461bcd60e51b8152600401610a4890613d5a565b600081815260ff6020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260fe855283862080546000190190559087168086528386208054600101905586865260fd90945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611c6a8282611435565b610cd05760008281526101f5602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611ca33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611cf18282611435565b15610cd05760008281526101f5602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6106c4611ecb565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611d8a57610c26836126fb565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611de4575060408051601f3d908101601f19168201909252611de191810190613d9f565b60015b611e475760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610a48565b60008051602061405d8339815191528114611eb65760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610a48565b50610c26838383612797565b6106c4816127bc565b61012d546001600160a01b031633146112975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a48565b61012d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006112a3611f886101935490565b6121ac565b600054610100900460ff16611fb45760405162461bcd60e51b8152600401610a4890613db8565b6112976127fe565b600054610100900460ff16611fe35760405162461bcd60e51b8152600401610a4890613db8565b611fed8484612825565b611ff56127fe565b611ffd6127fe565b6120056127fe565b610228805483919060ff19166001836003811115612025576120256135f3565b0217905550610228805461ff0019166101008315150217905561142f600033612856565b600054610100900460ff166120705760405162461bcd60e51b8152600401610a4890613db8565b6120786127fe565b612083600033612856565b611297612860565b816001600160a01b0316836001600160a01b0316036120ec5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a48565b6001600160a01b0383811660008181526101006020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b82820281151584158583048514171661217257600080fd5b0492915050565b612184848484611aef565b6121908484848461288f565b61142f5760405162461bcd60e51b8152600401610a4890613e03565b61029054600090815b838110156121ed5761271061028f54836121cf9190613e55565b6121d99190613e6c565b9150806121e581613e8e565b9150506121b5565b5092915050565b60606121ff82611869565b60008281526101c360205260408120805461221990613abe565b80601f016020809104026020016040519081016040528092919081815260200182805461224590613abe565b80156122925780601f1061226757610100808354040283529160200191612292565b820191906000526020600020905b81548152906001019060200180831161227557829003601f168201915b5050505050905060006122b060408051602081019091526000815290565b905080516000036122c2575092915050565b8151156122f45780826040516020016122dc929190613ea7565b60405160208183030381529060405292505050919050565b611ae784612990565b60007f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661232981611936565b61022854610100900460ff1680156123485750612345846111ff565b15155b1561235657600091506121ed565b60006123626102275490565b905061237361022780546001019055565b61237d8582612a04565b6123878185611940565b60016102285460ff1660038111156123a1576123a16135f3565b14806123c4575060026102285460ff1660038111156123c2576123c26135f3565b145b156123e1576123e160008051602061403d83398151915286612856565b6102285460405182916001600160a01b038816916000917f135ffb3383e06280e062ac5095bbf8faa98517161e596a2536bd98a9a8b64a88916124279160ff1690613609565b60405180910390a4506001949350505050565b7fbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb771661246481611936565b61028b546001600160a01b038316600090815261028c602052604081209190915561028d805461ffff169161249883613ed6565b91906101000a81548161ffff021916908361ffff160217905550505050565b60006001600160e01b03198216637965db0b60e01b14806109e257506109e282612a63565b6124e68282611435565b610cd0576124f381612a88565b6124fe836020612a9a565b60405160200161250f929190613ef7565b60408051601f198184030181529082905262461bcd60e51b8252610a4891600401613681565b8284836001600160a01b03821615600061255d60008051602061403d83398151915233611435565b905060008215801561257657506001600160a01b038616155b905060036102285460ff166003811115612592576125926135f3565b036125b957826125b45760405162461bcd60e51b8152600401610a4890613f6c565b6126e3565b60006102285460ff1660038111156125d3576125d36135f3565b036126115760008280156125e45750815b905083806125ef5750805b61260b5760405162461bcd60e51b8152600401610a4890613f6c565b506126e3565b60016102285460ff16600381111561262b5761262b6135f3565b0361269757600084815260fd60205260408120546001600160a01b031633148015612669575061266960008051602061403d83398151915233611435565b905083806125ef57508080156125ef57508161260b5760405162461bcd60e51b8152600401610a4890613f6c565b60026102285460ff1660038111156126b1576126b16135f3565b036126e35782806126c757508080156126c75750815b6126e35760405162461bcd60e51b8152600401610a4890613f6c565b6126ef8a8a8a8a612c36565b50505050505050505050565b6001600160a01b0381163b6127685760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610a48565b60008051602061405d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6127a083612d6c565b6000825111806127ad5750805b15610c265761142f8383612dac565b6127c581612dd1565b60008181526101c36020526040902080546127df90613abe565b1590506106c45760008181526101c3602052604081206106c491613559565b600054610100900460ff166112975760405162461bcd60e51b8152600401610a4890613db8565b600054610100900460ff1661284c5760405162461bcd60e51b8152600401610a4890613db8565b610cd08282612e74565b610cd08282611c60565b600054610100900460ff166128875760405162461bcd60e51b8152600401610a4890613db8565b611297612eb4565b60006001600160a01b0384163b1561298557604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906128d3903390899088908890600401613fa3565b6020604051808303816000875af192505050801561290e575060408051601f3d908101601f1916820190925261290b91810190613fd6565b60015b61296b573d80801561293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b5080516000036129635760405162461bcd60e51b8152600401610a4890613e03565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ae7565b506001949350505050565b606061299b82611869565b60006129b260408051602081019091526000815290565b905060008151116129d257604051806020016040528060008152506129fd565b806129dc84612edb565b6040516020016129ed929190613ea7565b6040516020818303038152906040525b9392505050565b61028e546101935410612a595760405162461bcd60e51b815260206004820152601a60248201527f455646543a206d6178206e756d626572206f6620746f6b656e730000000000006044820152606401610a48565b610cd08282612f6e565b60006001600160e01b03198216632483248360e11b14806109e257506109e282612f88565b60606109e26001600160a01b03831660145b60606000612aa9836002613e55565b612ab4906002613b0e565b67ffffffffffffffff811115612acc57612acc6136d5565b6040519080825280601f01601f191660200182016040528015612af6576020820181803683370190505b509050600360fc1b81600081518110612b1157612b11613c06565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612b4057612b40613c06565b60200101906001600160f81b031916908160001a9053506000612b64846002613e55565b612b6f906001613b0e565b90505b6001811115612be7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612ba357612ba3613c06565b1a60f81b828281518110612bb957612bb9613c06565b60200101906001600160f81b031916908160001a90535060049490941c93612be081613ff3565b9050612b72565b5083156129fd5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a48565b6001811115612ca55760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610a48565b816001600160a01b038516612d0357612cfe816101938054600083815261019460205260408120829055600182018355919091527ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc680155565b612d26565b836001600160a01b0316856001600160a01b031614612d2657612d268582612fad565b6001600160a01b038416612d4257612d3d8161304f565b612d65565b846001600160a01b0316846001600160a01b031614612d6557612d658482613104565b5050505050565b612d75816126fb565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606129fd838360405180606001604052806027815260200161407d6027913961314a565b6000612ddc82611168565b9050612dec816000846001612535565b612df582611168565b600083815260ff6020908152604080832080546001600160a01b03199081169091556001600160a01b03851680855260fe8452828520805460001901905587855260fd909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600054610100900460ff16612e9b5760405162461bcd60e51b8152600401610a4890613db8565b60fb612ea78382613c9a565b5060fc610c268282613c9a565b600054610100900460ff16611a675760405162461bcd60e51b8152600401610a4890613db8565b60606000612ee8836131c2565b600101905060008167ffffffffffffffff811115612f0857612f086136d5565b6040519080825280601f01601f191660200182016040528015612f32576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612f3c57509392505050565b610cd082826040518060200160405280600081525061329a565b60006001600160e01b0319821663780e9d6360e01b14806109e257506109e2826132cd565b60006001612fba846111ff565b612fc49190613c1c565b6000838152610192602052604090205490915080821461301a576001600160a01b038416600090815261019160209081526040808320858452825280832054848452818420819055835261019290915290208190555b506000918252610192602090815260408084208490556001600160a01b03909416835261019181528383209183525290812055565b6101935460009061306290600190613c1c565b60008381526101946020526040812054610193805493945090928490811061308c5761308c613c06565b906000526020600020015490508061019383815481106130ae576130ae613c06565b600091825260208083209091019290925582815261019490915260408082208490558582528120556101938054806130e8576130e861400a565b6001900381819060005260206000200160009055905550505050565b600061310f836111ff565b6001600160a01b0390931660009081526101916020908152604080832086845282528083208590559382526101929052919091209190915550565b6060600080856001600160a01b0316856040516131679190614020565b600060405180830381855af49150503d80600081146131a2576040519150601f19603f3d011682016040523d82523d6000602084013e6131a7565b606091505b50915091506131b88683838761331d565b9695505050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106132015772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061322d576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061324b57662386f26fc10000830492506010015b6305f5e1008310613263576305f5e100830492506008015b612710831061327757612710830492506004015b60648310613289576064830492506002015b600a83106109e25760010192915050565b6132a48383613396565b6132b1600084848461288f565b610c265760405162461bcd60e51b8152600401610a4890613e03565b60006001600160e01b031982166380ac58cd60e01b14806132fe57506001600160e01b03198216635b5e139f60e01b145b806109e257506301ffc9a760e01b6001600160e01b03198316146109e2565b6060831561338c578251600003613385576001600160a01b0385163b6133855760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a48565b5081611ae7565b611ae7838361352f565b6001600160a01b0382166133ec5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a48565b600081815260fd60205260409020546001600160a01b0316156134515760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a48565b61345f600083836001612535565b600081815260fd60205260409020546001600160a01b0316156134c45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a48565b6001600160a01b038216600081815260fe602090815260408083208054600101905584835260fd90915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b81511561353f5781518083602001fd5b8060405162461bcd60e51b8152600401610a489190613681565b50805461356590613abe565b6000825580601f10613575575050565b601f0160209004906000526020600020908101906106c491905b808211156135a3576000815560010161358f565b5090565b6001600160e01b0319811681146106c457600080fd5b6000602082840312156135cf57600080fd5b81356129fd816135a7565b6000602082840312156135ec57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b602081016004831061362b57634e487b7160e01b600052602160045260246000fd5b91905290565b60005b8381101561364c578181015183820152602001613634565b50506000910152565b6000815180845261366d816020860160208601613631565b601f01601f19169290920160200192915050565b6020815260006129fd6020830184613655565b6001600160a01b03811681146106c457600080fd5b600080604083850312156136bc57600080fd5b82356136c781613694565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff8111828210171561370e5761370e6136d5565b60405290565b6040516105c0810167ffffffffffffffff8111828210171561370e5761370e6136d5565b600082601f83011261374957600080fd5b813567ffffffffffffffff80821115613764576137646136d5565b604051601f8301601f19908116603f0116810190828211818310171561378c5761378c6136d5565b816040528381528660208588010111156137a557600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080604083850312156137d857600080fd5b823567ffffffffffffffff8111156137ef57600080fd5b6137fb85828601613738565b95602094909401359450505050565b60008060006060848603121561381f57600080fd5b833561382a81613694565b9250602084013561383a81613694565b929592945050506040919091013590565b6000806040838503121561385e57600080fd5b82359150602083013561387081613694565b809150509250929050565b60006020828403121561388d57600080fd5b81356129fd81613694565b600080604083850312156138ab57600080fd5b82356138b681613694565b9150602083013567ffffffffffffffff8111156138d257600080fd5b6138de85828601613738565b9150509250929050565b6000806000606084860312156138fd57600080fd5b505081359360208301359350604090920135919050565b600061064080838503121561392857600080fd5b6139306136eb565b8335815260208085013581830152604085013561394c81613694565b806040840152506060850135606083015285609f86011261396c57600080fd5b613974613714565b92850192808785111561398657600080fd5b608087015b858110156139a2578035835291830191830161398b565b506080840152509095945050505050565b80151581146106c457600080fd5b600080604083850312156139d457600080fd5b82356139df81613694565b91506020830135613870816139b3565b60008060008060808587031215613a0557600080fd5b8435613a1081613694565b93506020850135613a2081613694565b925060408501359150606085013567ffffffffffffffff811115613a4357600080fd5b613a4f87828801613738565b91505092959194509250565b600060208284031215613a6d57600080fd5b813567ffffffffffffffff811115613a8457600080fd5b611ae784828501613738565b60008060408385031215613aa357600080fd5b8235613aae81613694565b9150602083013561387081613694565b600181811c90821680613ad257607f821691505b602082108103613af257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156109e2576109e2613af8565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b818103818111156109e2576109e2613af8565b600060208284031215613c4157600080fd5b81516129fd816139b3565b601f821115610c2657600081815260208120601f850160051c81016020861015613c735750805b601f850160051c820191505b81811015613c9257828155600101613c7f565b505050505050565b815167ffffffffffffffff811115613cb457613cb46136d5565b613cc881613cc28454613abe565b84613c4c565b602080601f831160018114613cfd5760008415613ce55750858301515b600019600386901b1c1916600185901b178555613c92565b600085815260208120601f198616915b82811015613d2c57888601518255948401946001909101908401613d0d565b5085821015613d4a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b600060208284031215613db157600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b80820281158282048414176109e2576109e2613af8565b600082613e8957634e487b7160e01b600052601260045260246000fd5b500490565b600060018201613ea057613ea0613af8565b5060010190565b60008351613eb9818460208801613631565b835190830190613ecd818360208801613631565b01949350505050565b600061ffff808316818103613eed57613eed613af8565b6001019392505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613f2f816017850160208801613631565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613f60816028840160208801613631565b01602801949350505050565b6020808252601d908201527f455243353438343a2063616e2774206265207472616e73666572726564000000604082015260600190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906131b890830184613655565b600060208284031215613fe857600080fd5b81516129fd816135a7565b60008161400257614002613af8565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251614032818460208701613631565b919091019291505056fe3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122023a590a6b598f29d17e9420d5adc01314a67cf07e077a9a203f61255f305ef6264736f6c63430008130033", + "devdoc": { + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + }, + "Approval(address,address,uint256)": { + "details": "Emitted when `owner` enables `approved` to manage the `tokenId` token." + }, + "ApprovalForAll(address,address,bool)": { + "details": "Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets." + }, + "BatchMetadataUpdate(uint256,uint256)": { + "details": "This event emits when the metadata of a range of tokens is changed. So that the third-party platforms such as NFT market could timely update the images and related attributes of the NFTs." + }, + "BeaconUpgraded(address)": { + "details": "Emitted when the beacon is changed." + }, + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "Issued(address,address,uint256,uint8)": { + "details": "This emit is an add-on to nft's transfer emit in order to distinguish sbt from vanilla nft while providing backward compatibility.", + "params": { + "from": "The issuer", + "to": "The receiver", + "tokenId": "The id of the issued token" + } + }, + "MetadataUpdate(uint256)": { + "details": "This event emits when the metadata of a token is changed. So that the third-party platforms such as NFT market could timely update the images and related attributes of the NFT." + }, + "RoleAdminChanged(bytes32,bytes32,bytes32)": { + "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._" + }, + "RoleGranted(bytes32,address,address)": { + "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}." + }, + "RoleRevoked(bytes32,address,address)": { + "details": "Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)" + }, + "Transfer(address,address,uint256)": { + "details": "Emitted when `tokenId` token is transferred from `from` to `to`." + }, + "Upgraded(address)": { + "details": "Emitted when the implementation is upgraded." + } + }, + "kind": "dev", + "methods": { + "approve(address,uint256)": { + "details": "See {IERC721-approve}." + }, + "balanceOf(address)": { + "details": "See {IERC721-balanceOf}." + }, + "burn(uint256)": { + "details": "Burns `tokenId`. See {ERC721-_burn}." + }, + "burnAuth(uint256)": { + "details": "unassigned tokenIds are invalid, and queries do throw", + "params": { + "tokenId": "The identifier for a token." + } + }, + "claimReward()": { + "details": "claim reward for token owner" + }, + "constructor": { + "custom:oz-upgrades-unsafe-allow": "constructor" + }, + "depositReward(uint256)": { + "details": "deposit reward to the contract to be claimed by token owners", + "params": { + "plusReward": "amount of reward to be deposited" + } + }, + "getApproved(uint256)": { + "details": "See {IERC721-getApproved}." + }, + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC721-isApprovedForAll}." + }, + "name()": { + "details": "See {IERC721Metadata-name}." + }, + "nextTokenPrice()": { + "details": "calculate price for the next token" + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "details": "See {IERC721-ownerOf}." + }, + "priceOf(uint256)": { + "details": "implementation for calculate price for the next token based on the current sequential token id" + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "safeMint(address,string)": { + "details": "function for mint new SBT token", + "params": { + "to": "address of user who will receive token", + "uri": "token metadata uri" + }, + "returns": { + "_0": "true if token was minted" + } + }, + "safeTransferFrom(address,address,uint256)": { + "details": "See {IERC721-safeTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,bytes)": { + "details": "See {IERC721-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC721-setApprovalForAll}." + }, + "setNextTokenMultiplier(uint256)": { + "details": "set multiplicator for the next token in percents in case nextTokenPriceMultiplier_ = 13_000 the next price of the token will be: curPrice * 130%", + "params": { + "nextTokenPriceMultiplier_": "persent multiplicator" + } + }, + "setTokenURI(string)": { + "details": "set token metadata uri can be used as utility method and custom logic on front-end" + }, + "setTokenURI(string,uint256)": { + "details": "set token metadata uri can be used as utility method and custom logic on front-end by owner of the contract in case of end user has a wrong uri or somebody corrupted it" + }, + "setVault(address)": { + "details": "set vault" + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "symbol()": { + "details": "See {IERC721Metadata-symbol}." + }, + "tokenByIndex(uint256)": { + "details": "See {IERC721Enumerable-tokenByIndex}." + }, + "tokenOfOwnerByIndex(address,uint256)": { + "details": "See {IERC721Enumerable-tokenOfOwnerByIndex}." + }, + "tokenURI(uint256)": { + "details": "See {IERC721Metadata-tokenURI}." + }, + "totalSupply()": { + "details": "See {IERC721Enumerable-totalSupply}." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC721-transferFrom}." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "upgradeTo(address)": { + "custom:oz-upgrades-unsafe-allow-reachable": "delegatecall", + "details": "Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "upgradeToAndCall(address,bytes)": { + "custom:oz-upgrades-unsafe-allow-reachable": "delegatecall", + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "version()": { + "returns": { + "_0": "a version in semantic versioning format" + } + } + }, + "stateVariables": { + "__gap": { + "details": "This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps" + } + }, + "version": 1 + }, + "userdoc": { + "events": { + "Issued(address,address,uint256,uint8)": { + "notice": "Emitted when a soulbound token is issued." + }, + "RewardClaimed(uint256,address)": { + "notice": "Emitted reward is claimed by a token owner" + }, + "RewardDeposited(address,uint256)": { + "notice": "Emitted when new rewards are deposited" + } + }, + "kind": "user", + "methods": { + "burnAuth(uint256)": { + "notice": "provides burn authorization of the token id." + }, + "depositReward(uint256)": { + "notice": "only role with BALANCE_UPDATER_ROLE can call this function" + }, + "rewardIndex()": { + "notice": "Accumulator of the total earned interest rate since the opening of the token" + }, + "rewardOwnerIndex(address)": { + "notice": "The owners' reward indexes for eachas of the last time they accrued" + }, + "setVault(address)": { + "notice": "that is mandatory to be set before reward can be claimed" + }, + "version()": { + "notice": "Returns the current version of this contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 986, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 989, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 968, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 1283, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 17126, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 5398, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 5855, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "201", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2039, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_name", + "offset": 0, + "slot": "251", + "type": "t_string_storage" + }, + { + "astId": 2041, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_symbol", + "offset": 0, + "slot": "252", + "type": "t_string_storage" + }, + { + "astId": 2045, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_owners", + "offset": 0, + "slot": "253", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 2049, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_balances", + "offset": 0, + "slot": "254", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 2053, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_tokenApprovals", + "offset": 0, + "slot": "255", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 2059, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_operatorApprovals", + "offset": 0, + "slot": "256", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 2961, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "257", + "type": "t_array(t_uint256)44_storage" + }, + { + "astId": 465, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_owner", + "offset": 0, + "slot": "301", + "type": "t_address" + }, + { + "astId": 585, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "302", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 17160, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "351", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 3126, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_ownedTokens", + "offset": 0, + "slot": "401", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 3130, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_ownedTokensIndex", + "offset": 0, + "slot": "402", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 3133, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_allTokens", + "offset": 0, + "slot": "403", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 3137, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_allTokensIndex", + "offset": 0, + "slot": "404", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 3469, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "405", + "type": "t_array(t_uint256)46_storage" + }, + { + "astId": 3501, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_tokenURIs", + "offset": 0, + "slot": "451", + "type": "t_mapping(t_uint256,t_string_storage)" + }, + { + "astId": 3645, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "452", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 85, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_roles", + "offset": 0, + "slot": "501", + "type": "t_mapping(t_bytes32,t_struct(RoleData)80_storage)" + }, + { + "astId": 380, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "502", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 15355, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_tokenIdCounter", + "offset": 0, + "slot": "551", + "type": "t_struct(Counter)5405_storage" + }, + { + "astId": 15359, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_burnAuth", + "offset": 0, + "slot": "552", + "type": "t_enum(BurnAuth)15917" + }, + { + "astId": 15362, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_mintOnce", + "offset": 1, + "slot": "552", + "type": "t_bool" + }, + { + "astId": 15742, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "553", + "type": "t_array(t_uint256)48_storage" + }, + { + "astId": 1425, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_status", + "offset": 0, + "slot": "601", + "type": "t_uint256" + }, + { + "astId": 1494, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "602", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 16062, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "rewardIndex", + "offset": 0, + "slot": "651", + "type": "t_uint256" + }, + { + "astId": 16067, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "rewardOwnerIndex", + "offset": 0, + "slot": "652", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 16070, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "numberCoins", + "offset": 0, + "slot": "653", + "type": "t_uint16" + }, + { + "astId": 16073, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "vault", + "offset": 2, + "slot": "653", + "type": "t_contract(Vault)9956" + }, + { + "astId": 16783, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_maxCountTokens", + "offset": 0, + "slot": "654", + "type": "t_uint256" + }, + { + "astId": 16785, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_nextTokenPriceMultiplier", + "offset": 0, + "slot": "655", + "type": "t_uint256" + }, + { + "astId": 16787, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_initialTokenPrice", + "offset": 0, + "slot": "656", + "type": "t_uint256" + }, + { + "astId": 16792, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "__gap", + "offset": 0, + "slot": "657", + "type": "t_array(t_uint256)46_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)44_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[44]", + "numberOfBytes": "1408" + }, + "t_array(t_uint256)46_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[46]", + "numberOfBytes": "1472" + }, + "t_array(t_uint256)48_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[48]", + "numberOfBytes": "1536" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Vault)9956": { + "encoding": "inplace", + "label": "contract Vault", + "numberOfBytes": "20" + }, + "t_enum(BurnAuth)15917": { + "encoding": "inplace", + "label": "enum IERC5484.BurnAuth", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_struct(RoleData)80_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)80_storage" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_string_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Counter)5405_storage": { + "encoding": "inplace", + "label": "struct CountersUpgradeable.Counter", + "members": [ + { + "astId": 5404, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "_value", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(RoleData)80_storage": { + "encoding": "inplace", + "label": "struct AccessControlUpgradeable.RoleData", + "members": [ + { + "astId": 77, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 79, + "contract": "src/tokens/VaultFounderToken.sol:VaultFounderToken", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/sepolia/VaultFounderToken_Proxy.json b/packages/contracts/deployments/sepolia/VaultFounderToken_Proxy.json new file mode 100644 index 00000000..794ec3f1 --- /dev/null +++ b/packages/contracts/deployments/sepolia/VaultFounderToken_Proxy.json @@ -0,0 +1,170 @@ +{ + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "receipt": { + "to": null, + "from": "0x5eCC8564556901132aEaae1E55eC3F4Ea521DBA6", + "contractAddress": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "transactionIndex": 26, + "gasUsed": "344506", + "logsBloom": "0x00000004000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000002000000000000000000000000000000000000040000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000080200000000000000000040000000000000200000000000400000000000000000000001000000008000000000020000000000000000000040000000000000000000100000000000020008000000000000000000000000000000000000000000000000000000000000001", + "blockHash": "0x361c96f1bdcfac1130082b74c342ba2aa105ca88e5c6ec7d5f74614f759e6255", + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "logs": [ + { + "transactionIndex": 26, + "blockNumber": 3799246, + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000944a7bde4bc84d325aeb3079b193ae1ff2f09b78" + ], + "data": "0x", + "logIndex": 39, + "blockHash": "0x361c96f1bdcfac1130082b74c342ba2aa105ca88e5c6ec7d5f74614f759e6255" + }, + { + "transactionIndex": 26, + "blockNumber": 3799246, + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000005ecc8564556901132aeaae1e55ec3f4ea521dba6", + "0x0000000000000000000000005ecc8564556901132aeaae1e55ec3f4ea521dba6" + ], + "data": "0x", + "logIndex": 40, + "blockHash": "0x361c96f1bdcfac1130082b74c342ba2aa105ca88e5c6ec7d5f74614f759e6255" + }, + { + "transactionIndex": 26, + "blockNumber": 3799246, + "transactionHash": "0x98950ebc63c36769de0c2aeca769ae2555ab469050363bc0e9fa4c2e8e2926da", + "address": "0xCF12D4F16261e1Be068ff81bC0Db49fe03F21cA3", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 41, + "blockHash": "0x361c96f1bdcfac1130082b74c342ba2aa105ca88e5c6ec7d5f74614f759e6255" + } + ], + "blockNumber": 3799246, + "cumulativeGasUsed": "3104963", + "status": 1, + "byzantium": true + }, + "args": [ + "0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78", + "0x80d8591100000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000002ee000000000000000000000000000000000000000000000000000000000000000c8" + ], + "numDeployments": 1, + "solcInputHash": "c49e2950159d0667a0032186292b7773", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"},\"BeaconUpgraded(address)\":{\"details\":\"Emitted when the beacon is changed.\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":contracts/=src/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":solmate/=lib/solmate/src/\"]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1967.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967 {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x3cbef5ebc24b415252e2f8c0c9254555d30d9f085603b4b80d9b5ed20ab87e90\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/IERC1967.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967Upgrade is IERC1967 {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3b21ae06bf5957f73fa16754b0669c77b7abd8ba6c072d35c3281d446fdb86c2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf09e68aa0dc6722a25bc46490e8d48ed864466d17313b8a0b254c36b54e49899\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526040516104e13803806104e1833981016040819052610022916102de565b61002e82826000610035565b50506103fb565b61003e83610061565b60008251118061004b5750805b1561005c5761005a83836100a1565b505b505050565b61006a816100cd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100c683836040518060600160405280602781526020016104ba60279139610180565b9392505050565b6001600160a01b0381163b61013f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080856001600160a01b03168560405161019d91906103ac565b600060405180830381855af49150503d80600081146101d8576040519150601f19603f3d011682016040523d82523d6000602084013e6101dd565b606091505b5090925090506101ef868383876101f9565b9695505050505050565b60608315610268578251600003610261576001600160a01b0385163b6102615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610136565b5081610272565b610272838361027a565b949350505050565b81511561028a5781518083602001fd5b8060405162461bcd60e51b815260040161013691906103c8565b634e487b7160e01b600052604160045260246000fd5b60005b838110156102d55781810151838201526020016102bd565b50506000910152565b600080604083850312156102f157600080fd5b82516001600160a01b038116811461030857600080fd5b60208401519092506001600160401b038082111561032557600080fd5b818501915085601f83011261033957600080fd5b81518181111561034b5761034b6102a4565b604051601f8201601f19908116603f01168101908382118183101715610373576103736102a4565b8160405282815288602084870101111561038c57600080fd5b61039d8360208301602088016102ba565b80955050505050509250929050565b600082516103be8184602087016102ba565b9190910192915050565b60208152600082518060208401526103e78160408501602087016102ba565b601f01601f19169190910160400192915050565b60b1806104096000396000f3fe608060405236601057600e6013565b005b600e5b601f601b6021565b6058565b565b600060537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156076573d6000f35b3d6000fdfea2646970667358221220a913bb1324f82fbcd856e3a1700aae977ecf4d4766af60243a7f02f170f8705764736f6c63430008130033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x608060405236601057600e6013565b005b600e5b601f601b6021565b6058565b565b600060537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156076573d6000f35b3d6000fdfea2646970667358221220a913bb1324f82fbcd856e3a1700aae977ecf4d4766af60243a7f02f170f8705764736f6c63430008130033", + "devdoc": { + "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + }, + "BeaconUpgraded(address)": { + "details": "Emitted when the beacon is changed." + }, + "Upgraded(address)": { + "details": "Emitted when the implementation is upgraded." + } + }, + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/sepolia/Vault_Implementation.json b/packages/contracts/deployments/sepolia/Vault_Implementation.json index 43a38275..e40cfee4 100644 --- a/packages/contracts/deployments/sepolia/Vault_Implementation.json +++ b/packages/contracts/deployments/sepolia/Vault_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0xbE55cCd98Fd5b2f915768bF73F664B4a0864C5cB", + "address": "0xF716c8d40bA6e7b3C639d5C559Aa17d99f7e6551", "abi": [ { "inputs": [ @@ -992,6 +992,51 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "depositHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "founders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "foundersFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "fundAssets", @@ -1067,6 +1112,11 @@ "internalType": "address[]", "name": "_defaultOperators", "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" } ], "name": "initialize", @@ -1750,6 +1800,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_founders", + "type": "address" + } + ], + "name": "setFounders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_foundersFee", + "type": "uint256" + } + ], + "name": "setFoundersFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -2056,6 +2132,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "withdrawHooks", + "outputs": [ + { + "internalType": "contract IVaultHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -2076,43 +2171,43 @@ "type": "function" } ], - "transactionHash": "0xb63333ef25eceae745ac66a422af854a05970a7e5961bebf925dba97f5e304ea", + "transactionHash": "0x20d7d72063e80b79f1566267e5fca7cc533c2f408af20e1365a7acb37ee2d744", "receipt": { "to": null, "from": "0x5eCC8564556901132aEaae1E55eC3F4Ea521DBA6", - "contractAddress": "0xbE55cCd98Fd5b2f915768bF73F664B4a0864C5cB", - "transactionIndex": 30, - "gasUsed": "4941444", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7e779ef5845fc8a7c10ebb8f17e14bba21c4febb94755fa5d2593979acd567a5", - "transactionHash": "0xb63333ef25eceae745ac66a422af854a05970a7e5961bebf925dba97f5e304ea", + "contractAddress": "0xF716c8d40bA6e7b3C639d5C559Aa17d99f7e6551", + "transactionIndex": 24, + "gasUsed": "5215084", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000200000000000000400000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbf3412f7f6106da1bc4ef948765a9351899d46bd712c90a82624852dbc9c660a", + "transactionHash": "0x20d7d72063e80b79f1566267e5fca7cc533c2f408af20e1365a7acb37ee2d744", "logs": [ { - "transactionIndex": 30, - "blockNumber": 3793793, - "transactionHash": "0xb63333ef25eceae745ac66a422af854a05970a7e5961bebf925dba97f5e304ea", - "address": "0xbE55cCd98Fd5b2f915768bF73F664B4a0864C5cB", + "transactionIndex": 24, + "blockNumber": 3799243, + "transactionHash": "0x20d7d72063e80b79f1566267e5fca7cc533c2f408af20e1365a7acb37ee2d744", + "address": "0xF716c8d40bA6e7b3C639d5C559Aa17d99f7e6551", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "logIndex": 43, - "blockHash": "0x7e779ef5845fc8a7c10ebb8f17e14bba21c4febb94755fa5d2593979acd567a5" + "logIndex": 38, + "blockHash": "0xbf3412f7f6106da1bc4ef948765a9351899d46bd712c90a82624852dbc9c660a" } ], - "blockNumber": 3793793, - "cumulativeGasUsed": "7944625", + "blockNumber": 3799243, + "cumulativeGasUsed": "7837784", "status": 1, "byzantium": true }, "args": [ true ], - "numDeployments": 2, - "solcInputHash": "fbb06ecd625fb8e32e2a0927532c850e", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"needDisableInitializers\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"AccessDeniedForCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BorrowerAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BorrowerDoesNotExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BorrowerHasDebt\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerIsNotABorrower\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExceededMaximumFeeValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FalsePositiveReport\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InappropriateStrategy\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"InsufficientVaultBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"durationInSeconds\",\"type\":\"uint256\"}],\"name\":\"InvalidLockedProfitReleaseRate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"freeRatio\",\"type\":\"uint256\"}],\"name\":\"LenderRatioExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ListsDoNotMatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StrategyAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StrategyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnexpectedZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenHolder\",\"type\":\"address\"}],\"name\":\"AuthorizedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtPayment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"freeFunds\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fundsGiven\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fundsTaken\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"loss\",\"type\":\"uint256\"}],\"name\":\"BorrowerDebtManagementReported\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"Burned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"LockedProfitReleaseRateChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"Minted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenHolder\",\"type\":\"address\"}],\"name\":\"RevokedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"Sent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtRatio\",\"type\":\"uint256\"}],\"name\":\"StrategyAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"fromQueueOnly\",\"type\":\"bool\"}],\"name\":\"StrategyRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"StrategyReturnedToQueue\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"StrategyRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"LOCKED_PROFIT_RELEASE_SCALE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_BPS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"debtRatio\",\"type\":\"uint256\"}],\"name\":\"addStrategy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"addStrategyToQueue\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"holder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"asset\",\"outputs\":[{\"internalType\":\"contract IERC20Upgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"authorizeOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"availableCredit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenHolder\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowersData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"activationTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastReportTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debtRatio\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"convertToAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"convertToShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"currentDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentDebtRatio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debtRatio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultOperators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fundAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"granularity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_rewards\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_managementFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_lockedProfitReleaseRate\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_defaultOperators\",\"type\":\"address[]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"isActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenHolder\",\"type\":\"address\"}],\"name\":\"isOperatorFor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"lastReport\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastReport\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastReportTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lockedProfitBaseline\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lockedProfitReleaseRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"managementFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"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\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"maxWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"operatorBurn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"operatorSend\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outstandingDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"previewDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"previewMint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"previewRedeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"previewWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"fromQueueOnly\",\"type\":\"bool\"}],\"name\":\"removeStrategy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"queue\",\"type\":\"address[]\"}],\"name\":\"reorderWithdrawalQueue\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"loss\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debtPayment\",\"type\":\"uint256\"}],\"name\":\"reportNegativeDebtManagement\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"extraFreeFunds\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debtPayment\",\"type\":\"uint256\"}],\"name\":\"reportPositiveDebtManagement\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"revokeOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"revokeStrategy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"send\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"shutdown\",\"type\":\"bool\"}],\"name\":\"setEmergencyShutdown\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"setLockedProfitReleaseRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_managementFee\",\"type\":\"uint256\"}],\"name\":\"setManagementFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_rewards\",\"type\":\"address\"}],\"name\":\"setRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"strategyDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"strategyRatio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"holder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"utilizationRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"withdrawalQueue\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"},\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"AuthorizedOperator(address,address)\":{\"details\":\"Emitted when `operator` is made operator for `tokenHolder`.\"},\"BeaconUpgraded(address)\":{\"details\":\"Emitted when the beacon is changed.\"},\"BorrowerDebtManagementReported(address,uint256,uint256,uint256,uint256,uint256)\":{\"params\":{\"borrower\":\"Borrower's contract address\",\"debtPayment\":\"Amount of outstanding debt repaid by the borrower\",\"freeFunds\":\"Free funds on the borrower's contract that remain after the debt is paid\",\"fundsGiven\":\"Funds issued to the borrower by this lender\",\"fundsTaken\":\"Funds that have been taken from the borrower by the lender\",\"loss\":\"Amount of funds that the borrower realised as loss\"}},\"Burned(address,address,uint256,bytes,bytes)\":{\"details\":\"Emitted when `operator` destroys `amount` tokens from `account`. Note that some additional user `data` and `operatorData` can be logged in the event.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Minted(address,address,uint256,bytes,bytes)\":{\"details\":\"Emitted when `amount` tokens are created by `operator` and assigned to `to`. Note that some additional user `data` and `operatorData` can be logged in the event.\"},\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"RevokedOperator(address,address)\":{\"details\":\"Emitted when `operator` is revoked its operator status for `tokenHolder`.\"},\"StrategyAdded(address,uint256)\":{\"params\":{\"debtRatio\":\"Maximum portion of the loan that the strategy can take (in BPS).\",\"strategy\":\"Address of the strategy contract.\"}},\"StrategyRemoved(address,bool)\":{\"params\":{\"fromQueueOnly\":\"If \\\"true\\\", then the strategy has only been removed from the withdrawal queue.\",\"strategy\":\"Address of the strategy contract.\"}},\"StrategyReturnedToQueue(address)\":{\"params\":{\"strategy\":\"Address of the strategy contract.\"}},\"StrategyRevoked(address)\":{\"params\":{\"strategy\":\"Address of the strategy contract.\"}},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"addStrategy(address,uint256)\":{\"params\":{\"debtRatio\":\"a ratio that shows how much of the new strategy can take, relative to other strategies.\",\"strategy\":\"a new strategy address.\"}},\"addStrategyToQueue(address)\":{\"params\":{\"strategy\":\"a strategy address.\"}},\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}. Note that operator and allowance concepts are orthogonal: operators may not have allowance, and accounts with allowance may not be operators themselves.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Note that accounts cannot have allowance issued by their operators.\"},\"authorizeOperator(address)\":{\"details\":\"See {IERC777-authorizeOperator}.\"},\"availableCredit()\":{\"returns\":{\"_0\":\"Available credit as amount of tokens\"}},\"balanceOf(address)\":{\"details\":\"Returns the amount of tokens owned by an account (`tokenHolder`).\"},\"burn(uint256,bytes)\":{\"details\":\"See {IERC777-burn}. Also emits a {IERC20-Transfer} event for ERC20 compatibility.\"},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"currentDebt()\":{\"returns\":{\"_0\":\"Debt as amount of tokens\"}},\"decimals()\":{\"details\":\"See {ERC20-decimals}. Always returns 18, as per the [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\"},\"defaultOperators()\":{\"details\":\"See {IERC777-defaultOperators}.\"},\"deposit(uint256)\":{\"details\":\"Override to add the \\\"whenNotPaused\\\" modifier\"},\"granularity()\":{\"details\":\"See {IERC777-granularity}. This implementation always returns `1`.\"},\"interestRatePerBlock()\":{\"returns\":{\"_0\":\"- The interest rate per block, scaled by 1e18\",\"_1\":\"- The utilisation rate of the lender, in BPS (scaled by 1e4)\"}},\"isActivated()\":{\"returns\":{\"_0\":\"\\\"true\\\" if the borrower is active\"}},\"isOperatorFor(address,address)\":{\"details\":\"See {IERC777-isOperatorFor}.\"},\"name()\":{\"details\":\"See {IERC777-name}.\"},\"operatorBurn(address,uint256,bytes,bytes)\":{\"details\":\"See {IERC777-operatorBurn}. Emits {Burned} and {IERC20-Transfer} events.\"},\"operatorSend(address,address,uint256,bytes,bytes)\":{\"details\":\"See {IERC777-operatorSend}. Emits {Sent} and {IERC20-Transfer} events.\"},\"outstandingDebt()\":{\"returns\":{\"_0\":\"Outstanding debt as amount of tokens\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\",\"returns\":{\"_0\":\"\\\"true\\\" if the contract is paused, and \\\"false\\\" otherwise.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"removeStrategy(address,bool)\":{\"params\":{\"fromQueueOnly\":\"if \\\"true\\\", then the strategy will only be removed from the withdrawal queue.\",\"strategy\":\"a strategy to remove.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"reorderWithdrawalQueue(address[])\":{\"params\":{\"queue\":\"a new queue that will replace the existing one. Should contain only those elements that already present in the existing queue.\"}},\"reportNegativeDebtManagement(uint256,uint256)\":{\"params\":{\"debtPayment\":\"is the funds that the borrower must release in order to pay off his outstanding debt (if any).\",\"loss\":\"a number of tokens by which the borrower's balance has decreased since the last report. May include a portion of the outstanding debt that the borrower was unable to repay.\"}},\"reportPositiveDebtManagement(uint256,uint256)\":{\"params\":{\"debtPayment\":\"is the funds that the borrower must release in order to pay off his outstanding debt (if any).\",\"extraFreeFunds\":\"an extra amount of free funds borrower's contract has. This reporting amount must be greater than the borrower's outstanding debt.\"}},\"revokeOperator(address)\":{\"details\":\"See {IERC777-revokeOperator}.\"},\"revokeStrategy(address)\":{\"params\":{\"strategy\":\"a strategy to revoke.\"}},\"send(address,uint256,bytes)\":{\"details\":\"See {IERC777-send}. Also emits a {IERC20-Transfer} event for ERC20 compatibility.\"},\"setEmergencyShutdown(bool)\":{\"params\":{\"shutdown\":\"a new vault pause state. If \\\"true\\\" is passed, the vault will be paused.\"}},\"setLockedProfitReleaseRate(uint256)\":{\"params\":{\"rate\":\"the rate of release of locked profit (percent per second scaled to 1e18). The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\"}},\"setManagementFee(uint256)\":{\"params\":{\"_managementFee\":\"a new management fee value (in BPS).\"}},\"setRewards(address)\":{\"params\":{\"_rewards\":\"a new rewards address.\"}},\"strategyDebt(address)\":{\"params\":{\"strategy\":\"the strategy address.\"}},\"strategyRatio(address)\":{\"params\":{\"strategy\":\"the strategy address.\"}},\"symbol()\":{\"details\":\"See {IERC777-symbol}.\"},\"totalAssets()\":{\"details\":\"Must be implemented by child contract.\"},\"totalSupply()\":{\"details\":\"See {IERC777-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient} interface if it is a contract. Also emits a {Sent} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Note that operator and allowance concepts are orthogonal: operators cannot call `transferFrom` (unless they have allowance), and accounts with allowance cannot call `operatorSend` (unless they are operators). Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"upgradeTo(address)\":{\"custom:oz-upgrades-unsafe-allow-reachable\":\"delegatecall\",\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"custom:oz-upgrades-unsafe-allow-reachable\":\"delegatecall\",\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"utilizationRate(address)\":{\"returns\":{\"_0\":\"percent of total assets taken by strategy in BPS\"}},\"version()\":{\"returns\":{\"_0\":\"a version in semantic versioning format\"}}},\"stateVariables\":{\"__gap\":{\"details\":\"This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\"}},\"version\":1},\"userdoc\":{\"events\":{\"BorrowerDebtManagementReported(address,uint256,uint256,uint256,uint256,uint256)\":{\"notice\":\"Event that must occur when the borrower reported the results of his debt management\"},\"Deposit(address,address,uint256,uint256)\":{\"notice\":\"`sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`. emitted when tokens are deposited into the Vault via the mint and deposit methods.\"},\"LockedProfitReleaseRateChanged(uint256)\":{\"notice\":\"Event that should happen when the locked-in profit release rate changed.\"},\"StrategyAdded(address,uint256)\":{\"notice\":\"Event that should happen when the strategy connects to the vault.\"},\"StrategyRemoved(address,bool)\":{\"notice\":\"Event that should happen when the strategy has been removed from the vault.\"},\"StrategyReturnedToQueue(address)\":{\"notice\":\"Event that should happen when the strategy has been returned to the withdrawal queue.\"},\"StrategyRevoked(address)\":{\"notice\":\"Event that should happen when the strategy has been revoked from the vault.\"},\"Withdraw(address,address,address,uint256,uint256)\":{\"notice\":\"`sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`. emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\"}},\"kind\":\"user\",\"methods\":{\"LOCKED_PROFIT_RELEASE_SCALE()\":{\"notice\":\"Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\"},\"addStrategy(address,uint256)\":{\"notice\":\"Adds a new strategy to the vault.\"},\"addStrategyToQueue(address)\":{\"notice\":\"Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\"},\"asset()\":{\"notice\":\"The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract. Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\"},\"availableCredit()\":{\"notice\":\"Returns the number of tokens the borrower (caller of this function) can take from the lender\"},\"borrowersData(address)\":{\"notice\":\"Records with information on each borrower using the lender's services\"},\"convertToAssets(uint256)\":{\"notice\":\"The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met. - is NOT inclusive of any fees that are charged against assets in the Vault. - do NOT show any variations depending on the caller. - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange. - do NOT revert unless due to integer overflow caused by an unreasonably large input. - round down towards 0. This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and from.\"},\"convertToShares(uint256)\":{\"notice\":\"The amount of shares that the Vault would exchange for the amount of assets provided, in an ideal scenario where all the conditions are met. - is NOT inclusive of any fees that are charged against assets in the Vault. - do NOT show any variations depending on the caller. - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange. - do NOT revert unless due to integer overflow caused by an unreasonably large input. - round down towards 0. This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and from.\"},\"currentDebt()\":{\"notice\":\"Returns the amount of funds taken by the borrower (caller of this function).\"},\"currentDebt(address)\":{\"notice\":\"Returns the current debt that the strategy has.\"},\"currentDebtRatio()\":{\"notice\":\"Returns the debt ratio of the borrower (caller of this function).\"},\"debtRatio()\":{\"notice\":\"Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\"},\"deposit(uint256)\":{\"notice\":\"Mints the Vault shares for msg.sender, according to the number of deposited base tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\"},\"deposit(uint256,address)\":{\"notice\":\"Mints Vault shares to receiver by depositing exactly amount of underlying tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\"},\"fundAssets()\":{\"notice\":\"Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\"},\"getQueueSize()\":{\"notice\":\"Returns the size of the withdrawal queue.\"},\"interestRatePerBlock()\":{\"notice\":\"Returns average interst rate of lender per block. Based on last report utilization rate and possibly cached interest rate of each strategy. Can be outadated, but close enough to real state for on chain calculations. Calculate average by combining utilisation rate of each strategy with its interest rate. Returns additional total utilisation rate of lender, as additional product of calculation, usefull to safe gas.\"},\"isActivated()\":{\"notice\":\"Returns the activation status of the borrower (caller of this function).\"},\"isActivated(address)\":{\"notice\":\"Returns the activation status of the specified borrower.\"},\"lastReport()\":{\"notice\":\"Returns the last report timestamp of the borrower (caller of this function).\"},\"lastReport(address)\":{\"notice\":\"Returns the last report timestamp of the specified borrower.\"},\"lastReportTimestamp()\":{\"notice\":\"Last time a report occurred by any borrower\"},\"lockedProfitBaseline()\":{\"notice\":\"The amount of funds that cannot be withdrawn by users. Decreases with time at the rate of \\\"lockedProfitReleaseRate\\\".\"},\"lockedProfitReleaseRate()\":{\"notice\":\"The rate of \\\"lockedProfitBaseline\\\" decline on the locked-in profit scale (scaled to 1e18). Represents the amount of funds that will be unlocked when one second passes.\"},\"managementFee()\":{\"notice\":\"Vault management fee (in BPS).\"},\"maxDeposit(address)\":{\"notice\":\"Maximum amount of the underlying asset that can be deposited into the Vault for the receiver, through a deposit call. - returns the maximum amount of assets deposit would allow to be deposited for receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset. - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0. - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\"},\"maxMint(address)\":{\"notice\":\"Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call. - return the maximum amount of shares mint would allow to be deposited to receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset. - factor in both global and user-specific limits, like if mints are entirely disabled (even temporarily) it MUST return 0. - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\"},\"maxRedeem(address)\":{\"notice\":\"Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, through a redeem call. - return the maximum amount of shares that could be transferred from owner through redeem and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). - factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.\"},\"maxWithdraw(address)\":{\"notice\":\"Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault, through a withdraw call. - return the maximum amount of assets that could be transferred from owner through withdraw and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). - factor in both global and user-specific limits, like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\"},\"mint(uint256)\":{\"notice\":\"Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\"},\"mint(uint256,address)\":{\"notice\":\"Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\"},\"outstandingDebt()\":{\"notice\":\"Returns the outstanding debt that the borrower (caller of this function) must repay\"},\"paused()\":{\"notice\":\"Indicates if the vault was shutted down or not.\"},\"previewDeposit(uint256)\":{\"notice\":\"Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given current on-chain conditions. - return as close to and no more than the exact amount of Vault shares that would be minted in a deposit call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction. - NOT account for deposit limits like those returned from maxDeposit and should always act as though the deposit would be accepted, regardless if the user has enough tokens approved, etc. - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert. Note that any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing.\"},\"previewMint(uint256)\":{\"notice\":\"Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given current on-chain conditions. - return as close to and no fewer than the exact amount of assets that would be deposited in a mint call in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the same transaction. - NOT account for mint limits like those returned from maxMint and should always act as though the mint would be accepted, regardless if the user has enough tokens approved, etc. - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause mint to revert. Note that any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by minting.\"},\"previewRedeem(uint256)\":{\"notice\":\"Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, given current on-chain conditions. - return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the same transaction. - NOT account for redemption limits like those returned from maxRedeem and should always act as though the redemption would be accepted, regardless if the user has enough shares, etc. - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause redeem to revert. Note that any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by redeeming.\"},\"previewWithdraw(uint256)\":{\"notice\":\"Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, given current on-chain conditions. - return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if called in the same transaction. - NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though the withdrawal would be accepted, regardless if the user has enough shares, etc. - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause withdraw to revert. Note that any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing.\"},\"redeem(uint256)\":{\"notice\":\"Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender. - emit the Withdraw event. - support a redeem flow where the shares are burned from owner directly where owner is msg.sender. - MAY support an additional flow in which the shares are transferred to the Vault contract before the redeem execution, and are accounted for during redeem. - revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.\"},\"redeem(uint256,address,address)\":{\"notice\":\"Burns exactly shares from owner and sends assets of underlying tokens to receiver. - emit the Withdraw event. - support a redeem flow where the shares are burned from owner directly where owner is msg.sender. - support a redeem flow where the shares are burned from owner directly where msg.sender has ERC-20 approval over the shares of owner. - MAY support an additional flow in which the shares are transferred to the Vault contract before the redeem execution, and are accounted for during redeem. - revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.\"},\"removeStrategy(address,bool)\":{\"notice\":\"Removes a strategy from the vault.\"},\"reorderWithdrawalQueue(address[])\":{\"notice\":\"Sets the withdrawal queue.\"},\"reportNegativeDebtManagement(uint256,uint256)\":{\"notice\":\"Reports a negative result of the borrower's debt management. The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\"},\"reportPositiveDebtManagement(uint256,uint256)\":{\"notice\":\"Reports a positive result of the borrower's debt management. Borrower must call this function if he has made any profit or/and has a free funds available to repay the outstanding debt (if any).\"},\"revokeStrategy(address)\":{\"notice\":\"Revokes a strategy from the vault. Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\"},\"rewards()\":{\"notice\":\"Rewards contract where management fees are sent to.\"},\"setEmergencyShutdown(bool)\":{\"notice\":\"Switches the vault pause state.\"},\"setLockedProfitReleaseRate(uint256)\":{\"notice\":\"Changes the rate of release of locked-in profit.\"},\"setManagementFee(uint256)\":{\"notice\":\"Sets the vault management fee.\"},\"setRewards(address)\":{\"notice\":\"Sets the vault rewards address.\"},\"strategyDebt(address)\":{\"notice\":\"Returns the current debt of the strategy.\"},\"strategyRatio(address)\":{\"notice\":\"Returns the debt ratio of the strategy.\"},\"totalAssets()\":{\"notice\":\"Total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault. - include any compounding that occurs from yield. - inclusive of any fees that are charged against assets in the Vault. - is NOT revert\"},\"totalDebt()\":{\"notice\":\"Amount of tokens that all borrowers have taken\"},\"utilizationRate(address)\":{\"notice\":\"Calculate utilisation rate for specific borrowerBased on last report data, can be outdated, but close to latest state of fund\"},\"version()\":{\"notice\":\"Returns the current version of this contract\"},\"withdraw(uint256)\":{\"notice\":\"Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender. - emit the Withdraw event. - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender. - MAY support an additional flow in which the shares are transferred to the Vault contract before the withdraw execution, and are accounted for during withdraw. - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.\"},\"withdraw(uint256,address,address)\":{\"notice\":\"Burns shares from owner and sends exactly assets of underlying tokens to receiver. - emit the Withdraw event. - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender. - support a withdraw flow where the shares are burned from owner directly where msg.sender has ERC-20 approval over the shares of owner. - MAY support an additional flow in which the shares are transferred to the Vault contract before the withdraw execution, and are accounted for during withdraw. - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.\"},\"withdrawalQueue(uint256)\":{\"notice\":\"Arranged list of addresses of strategies, which defines the order for withdrawal.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/Vault.sol\":\"Vault\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":contracts/=src/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":solmate/=lib/solmate/src/\"]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967Upgradeable {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x47d6e06872b12e72c79d1b5eb55842f860b5fb1207b2317c2358d2766b950a7b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1967Upgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x584ebdf9c1118a7c773f98788e3f3ede01982bdf8932aa06f5acc7d54876e161\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeTo(address newImplementation) public virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xb607cb94c27e89750f5ae2ccebcb94e654e926f6125f4fd4c6262c89875118ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {\\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 bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal onlyInitializing {\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal onlyInitializing {\\n _paused = false;\\n }\\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 require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\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 /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x40c636b4572ff5f1dc50cf22097e93c0723ee14eff87e99ac2b02636eeca1250\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\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 function __ReentrancyGuard_init() internal onlyInitializing {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb82ef33f43b6b96109687d91b39c94573fdccaaa423fe28e8ba0977b31c023e0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1f0f5f62f67a881cd1a9597acbc0a5e4071f3c2c10449a183b922ae7272e3f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20PermitUpgradeable {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xd60f939a3ca0199014d079b4dd66aa757954334947d81eb5c1d35d7a83061ab3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\nimport \\\"../extensions/IERC20PermitUpgradeable.sol\\\";\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\\n * 0 before setting it to a non-zero value.\\n */\\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20PermitUpgradeable token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x4dae161227d332808312ee2caf6384929321b83c16cc89b5642985fbec6b814c\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/ERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC777Upgradeable.sol\\\";\\nimport \\\"./IERC777RecipientUpgradeable.sol\\\";\\nimport \\\"./IERC777SenderUpgradeable.sol\\\";\\nimport \\\"../ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/IERC1820RegistryUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC777} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n *\\n * Support for ERC20 is included in this contract, as specified by the EIP: both\\n * the ERC777 and ERC20 interfaces can be safely used when interacting with it.\\n * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token\\n * movements.\\n *\\n * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there\\n * are no special restrictions in the amount of tokens that created, moved, or\\n * destroyed. This makes integration with ERC20 applications seamless.\\n *\\n * CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.\\n */\\ncontract ERC777Upgradeable is Initializable, ContextUpgradeable, IERC777Upgradeable, IERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n IERC1820RegistryUpgradeable internal constant _ERC1820_REGISTRY = IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\\n\\n mapping(address => uint256) private _balances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256(\\\"ERC777TokensSender\\\");\\n bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\\\"ERC777TokensRecipient\\\");\\n\\n // This isn't ever read from - it's only used to respond to the defaultOperators query.\\n address[] private _defaultOperatorsArray;\\n\\n // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).\\n mapping(address => bool) private _defaultOperators;\\n\\n // For each account, a mapping of its operators and revoked default operators.\\n mapping(address => mapping(address => bool)) private _operators;\\n mapping(address => mapping(address => bool)) private _revokedDefaultOperators;\\n\\n // ERC20-allowances\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n /**\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __ERC777_init(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\\n __ERC777_init_unchained(name_, symbol_, defaultOperators_);\\n }\\n\\n function __ERC777_init_unchained(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n\\n _defaultOperatorsArray = defaultOperators_;\\n for (uint256 i = 0; i < defaultOperators_.length; i++) {\\n _defaultOperators[defaultOperators_[i]] = true;\\n }\\n\\n // register interfaces\\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\\\"ERC777Token\\\"), address(this));\\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\\\"ERC20Token\\\"), address(this));\\n }\\n\\n /**\\n * @dev See {IERC777-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC777-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {ERC20-decimals}.\\n *\\n * Always returns 18, as per the\\n * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\\n */\\n function decimals() public pure virtual returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC777-granularity}.\\n *\\n * This implementation always returns `1`.\\n */\\n function granularity() public view virtual override returns (uint256) {\\n return 1;\\n }\\n\\n /**\\n * @dev See {IERC777-totalSupply}.\\n */\\n function totalSupply() public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`tokenHolder`).\\n */\\n function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\\n return _balances[tokenHolder];\\n }\\n\\n /**\\n * @dev See {IERC777-send}.\\n *\\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\\n */\\n function send(address recipient, uint256 amount, bytes memory data) public virtual override {\\n _send(_msgSender(), recipient, amount, data, \\\"\\\", true);\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}\\n * interface if it is a contract.\\n *\\n * Also emits a {Sent} event.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _send(_msgSender(), recipient, amount, \\\"\\\", \\\"\\\", false);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC777-burn}.\\n *\\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\\n */\\n function burn(uint256 amount, bytes memory data) public virtual override {\\n _burn(_msgSender(), amount, data, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC777-isOperatorFor}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) {\\n return\\n operator == tokenHolder ||\\n (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||\\n _operators[tokenHolder][operator];\\n }\\n\\n /**\\n * @dev See {IERC777-authorizeOperator}.\\n */\\n function authorizeOperator(address operator) public virtual override {\\n require(_msgSender() != operator, \\\"ERC777: authorizing self as operator\\\");\\n\\n if (_defaultOperators[operator]) {\\n delete _revokedDefaultOperators[_msgSender()][operator];\\n } else {\\n _operators[_msgSender()][operator] = true;\\n }\\n\\n emit AuthorizedOperator(operator, _msgSender());\\n }\\n\\n /**\\n * @dev See {IERC777-revokeOperator}.\\n */\\n function revokeOperator(address operator) public virtual override {\\n require(operator != _msgSender(), \\\"ERC777: revoking self as operator\\\");\\n\\n if (_defaultOperators[operator]) {\\n _revokedDefaultOperators[_msgSender()][operator] = true;\\n } else {\\n delete _operators[_msgSender()][operator];\\n }\\n\\n emit RevokedOperator(operator, _msgSender());\\n }\\n\\n /**\\n * @dev See {IERC777-defaultOperators}.\\n */\\n function defaultOperators() public view virtual override returns (address[] memory) {\\n return _defaultOperatorsArray;\\n }\\n\\n /**\\n * @dev See {IERC777-operatorSend}.\\n *\\n * Emits {Sent} and {IERC20-Transfer} events.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes memory data,\\n bytes memory operatorData\\n ) public virtual override {\\n require(isOperatorFor(_msgSender(), sender), \\\"ERC777: caller is not an operator for holder\\\");\\n _send(sender, recipient, amount, data, operatorData, true);\\n }\\n\\n /**\\n * @dev See {IERC777-operatorBurn}.\\n *\\n * Emits {Burned} and {IERC20-Transfer} events.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes memory data,\\n bytes memory operatorData\\n ) public virtual override {\\n require(isOperatorFor(_msgSender(), account), \\\"ERC777: caller is not an operator for holder\\\");\\n _burn(account, amount, data, operatorData);\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n *\\n * Note that operator and allowance concepts are orthogonal: operators may\\n * not have allowance, and accounts with allowance may not be operators\\n * themselves.\\n */\\n function allowance(address holder, address spender) public view virtual override returns (uint256) {\\n return _allowances[holder][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Note that accounts cannot have allowance issued by their operators.\\n */\\n function approve(address spender, uint256 value) public virtual override returns (bool) {\\n address holder = _msgSender();\\n _approve(holder, spender, value);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Note that operator and allowance concepts are orthogonal: operators cannot\\n * call `transferFrom` (unless they have allowance), and accounts with\\n * allowance cannot call `operatorSend` (unless they are operators).\\n *\\n * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\\n */\\n function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(holder, spender, amount);\\n _send(holder, recipient, amount, \\\"\\\", \\\"\\\", false);\\n return true;\\n }\\n\\n /**\\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with the caller address as the `operator` and with\\n * `userData` and `operatorData`.\\n *\\n * See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits {Minted} and {IERC20-Transfer} events.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - if `account` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual {\\n _mint(account, amount, userData, operatorData, true);\\n }\\n\\n /**\\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * If `requireReceptionAck` is set to true, and if a send hook is\\n * registered for `account`, the corresponding function will be called with\\n * `operator`, `data` and `operatorData`.\\n *\\n * See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits {Minted} and {IERC20-Transfer} events.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - if `account` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function _mint(\\n address account,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) internal virtual {\\n require(account != address(0), \\\"ERC777: mint to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, address(0), account, amount);\\n\\n // Update state variables\\n _totalSupply += amount;\\n _balances[account] += amount;\\n\\n _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck);\\n\\n emit Minted(operator, account, amount, userData, operatorData);\\n emit Transfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Send tokens\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\\n */\\n function _send(\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) internal virtual {\\n require(from != address(0), \\\"ERC777: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC777: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _callTokensToSend(operator, from, to, amount, userData, operatorData);\\n\\n _move(operator, from, to, amount, userData, operatorData);\\n\\n _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);\\n }\\n\\n /**\\n * @dev Burn tokens\\n * @param from address token holder address\\n * @param amount uint256 amount of tokens to burn\\n * @param data bytes extra information provided by the token holder\\n * @param operatorData bytes extra information provided by the operator (if any)\\n */\\n function _burn(address from, uint256 amount, bytes memory data, bytes memory operatorData) internal virtual {\\n require(from != address(0), \\\"ERC777: burn from the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _callTokensToSend(operator, from, address(0), amount, data, operatorData);\\n\\n _beforeTokenTransfer(operator, from, address(0), amount);\\n\\n // Update state variables\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC777: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Burned(operator, from, amount, data, operatorData);\\n emit Transfer(from, address(0), amount);\\n }\\n\\n function _move(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData\\n ) private {\\n _beforeTokenTransfer(operator, from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC777: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _balances[to] += amount;\\n\\n emit Sent(operator, from, to, amount, userData, operatorData);\\n emit Transfer(from, to, amount);\\n }\\n\\n /**\\n * @dev See {ERC20-_approve}.\\n *\\n * Note that accounts cannot have allowance issued by their operators.\\n */\\n function _approve(address holder, address spender, uint256 value) internal virtual {\\n require(holder != address(0), \\\"ERC777: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC777: approve to the zero address\\\");\\n\\n _allowances[holder][spender] = value;\\n emit Approval(holder, spender, value);\\n }\\n\\n /**\\n * @dev Call from.tokensToSend() if the interface is registered\\n * @param operator address operator requesting the transfer\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n */\\n function _callTokensToSend(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData\\n ) private {\\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);\\n if (implementer != address(0)) {\\n IERC777SenderUpgradeable(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);\\n }\\n }\\n\\n /**\\n * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but\\n * tokensReceived() was not registered for the recipient\\n * @param operator address operator requesting the transfer\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\\n */\\n function _callTokensReceived(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) private {\\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);\\n if (implementer != address(0)) {\\n IERC777RecipientUpgradeable(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);\\n } else if (requireReceptionAck) {\\n require(!to.isContract(), \\\"ERC777: token recipient contract has no implementer for ERC777TokensRecipient\\\");\\n }\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {IERC20-Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC777: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes\\n * calls to {send}, {transfer}, {operatorSend}, {transferFrom}, minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be to transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address operator, address from, address to, uint256 amount) internal virtual {}\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[41] private __gap;\\n}\\n\",\"keccak256\":\"0x828f2bcdf4a940221fffc84f904d1ae56f25cf90039b73572e3ec71c995abee2\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\\n *\\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\\n * contract implement this interface (contract holders can be their own\\n * implementer) and registering it on the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\\n *\\n * See {IERC1820Registry} and {ERC1820Implementer}.\\n */\\ninterface IERC777RecipientUpgradeable {\\n /**\\n * @dev Called by an {IERC777} token contract whenever tokens are being\\n * moved or created into a registered account (`to`). The type of operation\\n * is conveyed by `from` being the zero address or not.\\n *\\n * This call occurs _after_ the token contract's state is updated, so\\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\\n *\\n * This function may revert to prevent the operation from being executed.\\n */\\n function tokensReceived(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes calldata userData,\\n bytes calldata operatorData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1fbcfef49c67aea4ca9417b337a363e933127047e73194011b78c1741602615b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777TokensSender standard as defined in the EIP.\\n *\\n * {IERC777} Token holders can be notified of operations performed on their\\n * tokens by having a contract implement this interface (contract holders can be\\n * their own implementer) and registering it on the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\\n *\\n * See {IERC1820Registry} and {ERC1820Implementer}.\\n */\\ninterface IERC777SenderUpgradeable {\\n /**\\n * @dev Called by an {IERC777} token contract whenever a registered holder's\\n * (`from`) tokens are about to be moved or destroyed. The type of operation\\n * is conveyed by `to` being the zero address or not.\\n *\\n * This call occurs _before_ the token contract's state is updated, so\\n * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.\\n *\\n * This function may revert to prevent the operation from being executed.\\n */\\n function tokensToSend(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes calldata userData,\\n bytes calldata operatorData\\n ) external;\\n}\\n\",\"keccak256\":\"0x79fc5ced00b0715d84b75e016754292e434cf2cbbc58c1f275ef0754653a6d78\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777Upgradeable {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0xfcc6168646fb2829c61565249e12d02ea4bd2831faebe1ca096412ceca37bd02\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x07ac95acad040f1fb1f6120dd0aa5f702db69446e95f82613721879d30de0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC1820RegistryUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/IERC1820Registry.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the global ERC1820 Registry, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register\\n * implementers for interfaces in this registry, as well as query support.\\n *\\n * Implementers may be shared by multiple accounts, and can also implement more\\n * than a single interface for each account. Contracts can implement interfaces\\n * for themselves, but externally-owned accounts (EOA) must delegate this to a\\n * contract.\\n *\\n * {IERC165} interfaces can also be queried via the registry.\\n *\\n * For an in-depth explanation and source code analysis, see the EIP text.\\n */\\ninterface IERC1820RegistryUpgradeable {\\n event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);\\n\\n event ManagerChanged(address indexed account, address indexed newManager);\\n\\n /**\\n * @dev Sets `newManager` as the manager for `account`. A manager of an\\n * account is able to set interface implementers for it.\\n *\\n * By default, each account is its own manager. Passing a value of `0x0` in\\n * `newManager` will reset the manager to this initial state.\\n *\\n * Emits a {ManagerChanged} event.\\n *\\n * Requirements:\\n *\\n * - the caller must be the current manager for `account`.\\n */\\n function setManager(address account, address newManager) external;\\n\\n /**\\n * @dev Returns the manager for `account`.\\n *\\n * See {setManager}.\\n */\\n function getManager(address account) external view returns (address);\\n\\n /**\\n * @dev Sets the `implementer` contract as ``account``'s implementer for\\n * `interfaceHash`.\\n *\\n * `account` being the zero address is an alias for the caller's address.\\n * The zero address can also be used in `implementer` to remove an old one.\\n *\\n * See {interfaceHash} to learn how these are created.\\n *\\n * Emits an {InterfaceImplementerSet} event.\\n *\\n * Requirements:\\n *\\n * - the caller must be the current manager for `account`.\\n * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not\\n * end in 28 zeroes).\\n * - `implementer` must implement {IERC1820Implementer} and return true when\\n * queried for support, unless `implementer` is the caller. See\\n * {IERC1820Implementer-canImplementInterfaceForAddress}.\\n */\\n function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;\\n\\n /**\\n * @dev Returns the implementer of `interfaceHash` for `account`. If no such\\n * implementer is registered, returns the zero address.\\n *\\n * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28\\n * zeroes), `account` will be queried for support of it.\\n *\\n * `account` being the zero address is an alias for the caller's address.\\n */\\n function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);\\n\\n /**\\n * @dev Returns the interface hash for an `interfaceName`, as defined in the\\n * corresponding\\n * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].\\n */\\n function interfaceHash(string calldata interfaceName) external pure returns (bytes32);\\n\\n /**\\n * @notice Updates the cache with whether the contract implements an ERC165 interface or not.\\n * @param account Address of the contract for which to update the cache.\\n * @param interfaceId ERC165 interface for which to update the cache.\\n */\\n function updateERC165Cache(address account, bytes4 interfaceId) external;\\n\\n /**\\n * @notice Checks whether a contract implements an ERC165 interface or not.\\n * If the result is not cached a direct lookup on the contract address is performed.\\n * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\\n * {updateERC165Cache} with the contract address.\\n * @param account Address of the contract to check.\\n * @param interfaceId ERC165 interface to check.\\n * @return True if `account` implements `interfaceId`, false otherwise.\\n */\\n function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);\\n\\n /**\\n * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.\\n * @param account Address of the contract to check.\\n * @param interfaceId ERC165 interface to check.\\n * @return True if `account` implements `interfaceId`, false otherwise.\\n */\\n function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x02761f489482c11d04fda6e9e21592e819d4c349c20d133162445b46854b4660\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\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 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 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 up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 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 prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / 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 prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\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 works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\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^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice 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 uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"lib/solmate/src/utils/FixedPointMathLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.0;\\n\\n/// @notice Arithmetic library with operations for fixed-point numbers.\\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)\\nlibrary FixedPointMathLib {\\n /*//////////////////////////////////////////////////////////////\\n SIMPLIFIED FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\\n\\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\\n }\\n\\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\\n }\\n\\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\\n }\\n\\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\\n }\\n\\n function powWad(int256 x, int256 y) internal pure returns (int256) {\\n // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)\\n return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.\\n }\\n\\n function expWad(int256 x) internal pure returns (int256 r) {\\n unchecked {\\n // When the result is < 0.5 we return zero. This happens when\\n // x <= floor(log(0.5e18) * 1e18) ~ -42e18\\n if (x <= -42139678854452767551) return 0;\\n\\n // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\\n // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\\n if (x >= 135305999368893231589) revert(\\\"EXP_OVERFLOW\\\");\\n\\n // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\\n // for more intermediate precision and a binary basis. This base conversion\\n // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\\n x = (x << 78) / 5**18;\\n\\n // Reduce range of x to (-\\u00bd ln 2, \\u00bd ln 2) * 2**96 by factoring out powers\\n // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\\n // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\\n int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\\n x = x - k * 54916777467707473351141471128;\\n\\n // k is in the range [-61, 195].\\n\\n // Evaluate using a (6, 7)-term rational approximation.\\n // p is made monic, we'll multiply by a scale factor later.\\n int256 y = x + 1346386616545796478920950773328;\\n y = ((y * x) >> 96) + 57155421227552351082224309758442;\\n int256 p = y + x - 94201549194550492254356042504812;\\n p = ((p * y) >> 96) + 28719021644029726153956944680412240;\\n p = p * x + (4385272521454847904659076985693276 << 96);\\n\\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\\n int256 q = x - 2855989394907223263936484059900;\\n q = ((q * x) >> 96) + 50020603652535783019961831881945;\\n q = ((q * x) >> 96) - 533845033583426703283633433725380;\\n q = ((q * x) >> 96) + 3604857256930695427073651918091429;\\n q = ((q * x) >> 96) - 14423608567350463180887372962807573;\\n q = ((q * x) >> 96) + 26449188498355588339934803723976023;\\n\\n assembly {\\n // Div in assembly because solidity adds a zero check despite the unchecked.\\n // The q polynomial won't have zeros in the domain as all its roots are complex.\\n // No scaling is necessary because p is already 2**96 too large.\\n r := sdiv(p, q)\\n }\\n\\n // r should be in the range (0.09, 0.25) * 2**96.\\n\\n // We now need to multiply r by:\\n // * the scale factor s = ~6.031367120.\\n // * the 2**k factor from the range reduction.\\n // * the 1e18 / 2**96 factor for base conversion.\\n // We do this all at once, with an intermediate result in 2**213\\n // basis, so the final right shift is always by a positive amount.\\n r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\\n }\\n }\\n\\n function lnWad(int256 x) internal pure returns (int256 r) {\\n unchecked {\\n require(x > 0, \\\"UNDEFINED\\\");\\n\\n // We want to convert x from 10**18 fixed point to 2**96 fixed point.\\n // We do this by multiplying by 2**96 / 10**18. But since\\n // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\\n // and add ln(2**96 / 10**18) at the end.\\n\\n // Reduce range of x to (1, 2) * 2**96\\n // ln(2^k * x) = k * ln(2) + ln(x)\\n int256 k = int256(log2(uint256(x))) - 96;\\n x <<= uint256(159 - k);\\n x = int256(uint256(x) >> 159);\\n\\n // Evaluate using a (8, 8)-term rational approximation.\\n // p is made monic, we will multiply by a scale factor later.\\n int256 p = x + 3273285459638523848632254066296;\\n p = ((p * x) >> 96) + 24828157081833163892658089445524;\\n p = ((p * x) >> 96) + 43456485725739037958740375743393;\\n p = ((p * x) >> 96) - 11111509109440967052023855526967;\\n p = ((p * x) >> 96) - 45023709667254063763336534515857;\\n p = ((p * x) >> 96) - 14706773417378608786704636184526;\\n p = p * x - (795164235651350426258249787498 << 96);\\n\\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\\n // q is monic by convention.\\n int256 q = x + 5573035233440673466300451813936;\\n q = ((q * x) >> 96) + 71694874799317883764090561454958;\\n q = ((q * x) >> 96) + 283447036172924575727196451306956;\\n q = ((q * x) >> 96) + 401686690394027663651624208769553;\\n q = ((q * x) >> 96) + 204048457590392012362485061816622;\\n q = ((q * x) >> 96) + 31853899698501571402653359427138;\\n q = ((q * x) >> 96) + 909429971244387300277376558375;\\n assembly {\\n // Div in assembly because solidity adds a zero check despite the unchecked.\\n // The q polynomial is known not to have zeros in the domain.\\n // No scaling required because p is already 2**96 too large.\\n r := sdiv(p, q)\\n }\\n\\n // r is in the range (0, 0.125) * 2**96\\n\\n // Finalization, we need to:\\n // * multiply by the scale factor s = 5.549\\u2026\\n // * add ln(2**96 / 10**18)\\n // * add k * ln(2)\\n // * multiply by 10**18 / 2**96 = 5**18 >> 78\\n\\n // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\\n r *= 1677202110996718588342820967067443963516166;\\n // add ln(2) * k * 5e18 * 2**192\\n r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\\n // add ln(2**96 / 10**18) * 5e18 * 2**192\\n r += 600920179829731861736702779321621459595472258049074101567377883020018308;\\n // base conversion: mul 2**18 / 2**192\\n r >>= 174;\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n LOW LEVEL FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function mulDivDown(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n assembly {\\n // Store x * y in z for now.\\n z := mul(x, y)\\n\\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\\n revert(0, 0)\\n }\\n\\n // Divide z by the denominator.\\n z := div(z, denominator)\\n }\\n }\\n\\n function mulDivUp(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n assembly {\\n // Store x * y in z for now.\\n z := mul(x, y)\\n\\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\\n revert(0, 0)\\n }\\n\\n // First, divide z - 1 by the denominator and add 1.\\n // We allow z - 1 to underflow if z is 0, because we multiply the\\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\\n }\\n }\\n\\n function rpow(\\n uint256 x,\\n uint256 n,\\n uint256 scalar\\n ) internal pure returns (uint256 z) {\\n assembly {\\n switch x\\n case 0 {\\n switch n\\n case 0 {\\n // 0 ** 0 = 1\\n z := scalar\\n }\\n default {\\n // 0 ** n = 0\\n z := 0\\n }\\n }\\n default {\\n switch mod(n, 2)\\n case 0 {\\n // If n is even, store scalar in z for now.\\n z := scalar\\n }\\n default {\\n // If n is odd, store x in z for now.\\n z := x\\n }\\n\\n // Shifting right by 1 is like dividing by 2.\\n let half := shr(1, scalar)\\n\\n for {\\n // Shift n right by 1 before looping to halve it.\\n n := shr(1, n)\\n } n {\\n // Shift n right by 1 each iteration to halve it.\\n n := shr(1, n)\\n } {\\n // Revert immediately if x ** 2 would overflow.\\n // Equivalent to iszero(eq(div(xx, x), x)) here.\\n if shr(128, x) {\\n revert(0, 0)\\n }\\n\\n // Store x squared.\\n let xx := mul(x, x)\\n\\n // Round to the nearest number.\\n let xxRound := add(xx, half)\\n\\n // Revert if xx + half overflowed.\\n if lt(xxRound, xx) {\\n revert(0, 0)\\n }\\n\\n // Set x to scaled xxRound.\\n x := div(xxRound, scalar)\\n\\n // If n is even:\\n if mod(n, 2) {\\n // Compute z * x.\\n let zx := mul(z, x)\\n\\n // If z * x overflowed:\\n if iszero(eq(div(zx, x), z)) {\\n // Revert if x is non-zero.\\n if iszero(iszero(x)) {\\n revert(0, 0)\\n }\\n }\\n\\n // Round to the nearest number.\\n let zxRound := add(zx, half)\\n\\n // Revert if zx + half overflowed.\\n if lt(zxRound, zx) {\\n revert(0, 0)\\n }\\n\\n // Return properly scaled zxRound.\\n z := div(zxRound, scalar)\\n }\\n }\\n }\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n GENERAL NUMBER UTILITIES\\n //////////////////////////////////////////////////////////////*/\\n\\n function sqrt(uint256 x) internal pure returns (uint256 z) {\\n assembly {\\n let y := x // We start y at x, which will help us make our initial estimate.\\n\\n z := 181 // The \\\"correct\\\" value is 1, but this saves a multiplication later.\\n\\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\\n\\n // We check y >= 2^(k + 8) but shift right by k bits\\n // each branch to ensure that if x >= 256, then y >= 256.\\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\\n y := shr(128, y)\\n z := shl(64, z)\\n }\\n if iszero(lt(y, 0x1000000000000000000)) {\\n y := shr(64, y)\\n z := shl(32, z)\\n }\\n if iszero(lt(y, 0x10000000000)) {\\n y := shr(32, y)\\n z := shl(16, z)\\n }\\n if iszero(lt(y, 0x1000000)) {\\n y := shr(16, y)\\n z := shl(8, z)\\n }\\n\\n // Goal was to get z*z*y within a small factor of x. More iterations could\\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\\n\\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\\n\\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\\n\\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\\n\\n // There is no overflow risk here since y < 2^136 after the first branch above.\\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\\n\\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n\\n // If x+1 is a perfect square, the Babylonian method cycles between\\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\\n z := sub(z, lt(div(x, z), z))\\n }\\n }\\n\\n function log2(uint256 x) internal pure returns (uint256 r) {\\n require(x > 0, \\\"UNDEFINED\\\");\\n\\n assembly {\\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\\n r := or(r, shl(3, lt(0xff, shr(r, x))))\\n r := or(r, shl(2, lt(0xf, shr(r, x))))\\n r := or(r, shl(1, lt(0x3, shr(r, x))))\\n r := or(r, lt(0x1, shr(r, x)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x622fcd8a49e132df5ec7651cc6ae3aaf0cf59bdcd67a9a804a1b9e2485113b7d\",\"license\":\"MIT\"},\"src/IVault.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IStrategiesLender} from \\\"./lending/IStrategiesLender.sol\\\";\\nimport {IERC4626} from \\\"./tokens/IERC4626.sol\\\";\\n\\ninterface IVault is IStrategiesLender, IERC4626 { // solhint-disable-line no-empty-blocks\\n\\n}\\n\",\"keccak256\":\"0xff813ad44bf332ed444da13c7df42b2e3e325056c16665f4a9edd1c361e7912f\",\"license\":\"AGPL-3.0\"},\"src/Vault.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {MathUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\\\";\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {IERC20Metadata} from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport {PausableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\n\\nimport {IVault} from \\\"./IVault.sol\\\";\\nimport {ILender} from \\\"./lending/ILender.sol\\\";\\nimport {Lender, BorrowerDoesNotExist} from \\\"./lending/Lender.sol\\\";\\nimport {StrategiesLender} from \\\"./lending/StrategiesLender.sol\\\";\\nimport {SafeERC4626Upgradeable, ERC4626Upgradeable} from \\\"./tokens/SafeERC4626Upgradeable.sol\\\";\\nimport {IERC4626} from \\\"./tokens/IERC4626.sol\\\";\\nimport {IStrategy} from \\\"./strategies/IStrategy.sol\\\";\\nimport {AddressList} from \\\"./structures/AddressList.sol\\\";\\nimport {SafeInitializable} from \\\"./upgradeable/SafeInitializable.sol\\\";\\nimport {SafeUUPSUpgradeable} from \\\"./upgradeable/SafeUUPSUpgradeable.sol\\\";\\nimport {IVersionable} from \\\"./upgradeable/IVersionable.sol\\\";\\n\\nerror ExceededMaximumFeeValue();\\n\\nerror InsufficientVaultBalance(uint256 assets, uint256 shares);\\nerror InvalidLockedProfitReleaseRate(uint256 durationInSeconds);\\nerror InappropriateStrategy();\\n\\ncontract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, StrategiesLender {\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n\\n /// @notice Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\\n uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;\\n\\n /// @notice Rewards contract where management fees are sent to.\\n address public rewards;\\n\\n /// @notice Vault management fee (in BPS).\\n uint256 public managementFee;\\n\\n /// @notice The amount of funds that cannot be withdrawn by users.\\n /// Decreases with time at the rate of \\\"lockedProfitReleaseRate\\\".\\n uint256 public lockedProfitBaseline;\\n\\n /// @notice The rate of \\\"lockedProfitBaseline\\\" decline on the locked-in profit scale (scaled to 1e18).\\n /// Represents the amount of funds that will be unlocked when one second passes.\\n uint256 public lockedProfitReleaseRate;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[50] private __gap;\\n\\n /// @notice Event that should happen when the locked-in profit release rate changed.\\n event LockedProfitReleaseRateChanged(uint256 rate);\\n\\n /// @inheritdoc IVersionable\\n function version() external pure override returns (string memory) {\\n return \\\"0.2.0\\\";\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\\n\\n function initialize(\\n address _asset,\\n address _rewards,\\n uint256 _managementFee,\\n uint256 _lockedProfitReleaseRate,\\n string memory _name,\\n string memory _symbol,\\n address[] memory _defaultOperators\\n ) public initializer {\\n __SafeUUPSUpgradeable_init(); // Ownable under the hood\\n __StrategiesLender_init_lenderSpecific(); // require Ownable\\n __SafeERC4626_init(\\n IERC20Upgradeable(_asset),\\n bytes(_name).length == 0\\n ? string.concat(\\n IERC20Metadata(_asset).symbol(),\\n \\\" Eonian Vault Shares\\\"\\n )\\n : _name,\\n bytes(_symbol).length == 0\\n ? string.concat(\\\"eon\\\", IERC20Metadata(_asset).symbol())\\n : _symbol,\\n _defaultOperators\\n );\\n\\n setRewards(_rewards);\\n setManagementFee(_managementFee);\\n setLockedProfitReleaseRate(_lockedProfitReleaseRate);\\n }\\n\\n /// @dev Override to add the \\\"whenNotPaused\\\" modifier\\n /// @inheritdoc SafeERC4626Upgradeable\\n function deposit(uint256 assets)\\n public\\n override\\n whenNotPaused\\n returns (uint256 shares)\\n {\\n return super.deposit(assets);\\n }\\n\\n /// @notice Hook that is used before withdrawals to release assets from strategies if necessary.\\n /// @inheritdoc ERC4626Upgradeable\\n function beforeWithdraw(uint256 assets, uint256 shares) internal override {\\n // There is no need to withdraw assets from strategies, the vault has sufficient funds\\n if (_freeAssets() >= assets) {\\n return;\\n }\\n\\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\\n // If the vault already has the required amount of funds, we need to finish the withdrawal\\n uint256 vaultBalance = _freeAssets();\\n if (assets <= vaultBalance) {\\n break;\\n }\\n\\n address strategy = withdrawalQueue[i];\\n\\n // We can only withdraw the amount that the strategy has as debt,\\n // so that the strategy can work on the unreported (yet) funds it has earned\\n uint256 requiredAmount = MathUpgradeable.min(\\n assets - vaultBalance,\\n borrowersData[strategy].debt\\n );\\n\\n // Skip this strategy is there is nothing to withdraw\\n if (requiredAmount == 0) {\\n continue;\\n }\\n\\n // Withdraw the required amount of funds from the strategy\\n uint256 loss = IStrategy(strategy).withdraw(requiredAmount);\\n\\n // If the strategy failed to return all of the requested funds, we need to reduce the strategy's debt ratio\\n if (loss > 0) {\\n _decreaseBorrowerCredibility(strategy, loss);\\n }\\n }\\n\\n // Revert if insufficient assets remain in the vault after withdrawal from all strategies\\n if (_freeAssets() < assets) {\\n revert InsufficientVaultBalance(assets, shares);\\n }\\n }\\n\\n /// Check that all new strategies refer to this vault and has the same underlying asset\\n function _beforeStrategyRegistered(IStrategy strategy) internal view override {\\n if (this != strategy.lender() || asset != strategy.asset()) {\\n revert InappropriateStrategy();\\n }\\n }\\n\\n /// @notice Sets the vault rewards address.\\n /// @param _rewards a new rewards address.\\n function setRewards(address _rewards) public onlyOwner {\\n rewards = _rewards;\\n }\\n\\n /// @notice Sets the vault management fee.\\n /// @param _managementFee a new management fee value (in BPS).\\n function setManagementFee(uint256 _managementFee) public onlyOwner {\\n if (_managementFee > MAX_BPS) {\\n revert ExceededMaximumFeeValue();\\n }\\n\\n managementFee = _managementFee;\\n }\\n\\n /// @notice Changes the rate of release of locked-in profit.\\n /// @param rate the rate of release of locked profit (percent per second scaled to 1e18).\\n /// The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\\n function setLockedProfitReleaseRate(uint256 rate) public onlyOwner {\\n if (rate > LOCKED_PROFIT_RELEASE_SCALE) {\\n revert InvalidLockedProfitReleaseRate(rate);\\n }\\n\\n lockedProfitReleaseRate = rate;\\n emit LockedProfitReleaseRateChanged(rate);\\n }\\n\\n /// @notice Calculates the locked profit, takes into account the change since the last report.\\n function _lockedProfit() internal view returns (uint256) {\\n // Release rate should be small, since the timestamp can be manipulated by the node operator,\\n // not expected to have much impact, since the changes will be applied to all users and cannot be abused directly.\\n uint256 ratio = (block.timestamp - lastReportTimestamp) * lockedProfitReleaseRate; // solhint-disable-line not-rely-on-time\\n\\n // In case the ratio >= scale, the calculation anyway leads to zero.\\n if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) {\\n return 0;\\n }\\n\\n uint256 lockedProfitChange = (ratio * lockedProfitBaseline) / LOCKED_PROFIT_RELEASE_SCALE;\\n\\n // Reducing locked profits over time frees up profits for users\\n return lockedProfitBaseline - lockedProfitChange;\\n }\\n\\n /// @inheritdoc Lender\\n function _chargeFees(uint256 extraFreeFunds)\\n internal\\n override\\n returns (uint256)\\n {\\n uint256 fee = (extraFreeFunds * managementFee) / MAX_BPS;\\n if (fee > 0) {\\n _mint(rewards, convertToShares(fee), \\\"\\\", \\\"\\\", false);\\n }\\n\\n return fee;\\n }\\n\\n /// @notice Updates the locked-in profit value according to the positive debt management report of the strategy\\n /// @inheritdoc Lender\\n function _afterPositiveDebtManagementReport(\\n uint256 extraFreeFunds,\\n uint256 chargedFees\\n ) internal override {\\n // Locking every reported strategy profit, taking into account the charged fees.\\n lockedProfitBaseline = _lockedProfit() + extraFreeFunds - chargedFees;\\n }\\n\\n /// @notice Updates the locked-in profit value according to the negative debt management report of the strategy\\n /// @inheritdoc Lender\\n function _afterNegativeDebtManagementReport(uint256 loss)\\n internal\\n override\\n {\\n uint256 currentLockedProfit = _lockedProfit();\\n\\n // If a loss occurs, it is necessary to release the appropriate amount of funds that users were able to withdraw it.\\n lockedProfitBaseline = currentLockedProfit > loss\\n ? currentLockedProfit - loss\\n : 0;\\n }\\n\\n /// @inheritdoc Lender\\n function _freeAssets() internal view override returns (uint256) {\\n return asset.balanceOf(address(this));\\n }\\n\\n /// @inheritdoc Lender\\n function _borrowerFreeAssets(address borrower)\\n internal\\n view\\n override\\n returns (uint256)\\n {\\n return asset.balanceOf(borrower);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function totalAssets() public view override(ERC4626Upgradeable, IERC4626) returns (uint256) {\\n return super.fundAssets() - _lockedProfit();\\n }\\n\\n /// @inheritdoc ILender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, StrategiesLender)\\n returns (bool)\\n {\\n return super.paused();\\n }\\n\\n /// @inheritdoc Lender\\n function _transferFundsToBorrower(address borrower, uint256 amount)\\n internal\\n override\\n {\\n asset.safeTransfer(borrower, amount);\\n }\\n\\n /// @inheritdoc Lender\\n function _takeFundsFromBorrower(address borrower, uint256 amount)\\n internal\\n override\\n {\\n asset.safeTransferFrom(borrower, address(this), amount);\\n }\\n}\\n\",\"keccak256\":\"0xfafef05cfa50a4ad297ceecb42499c096363e04592947e1347c95b620196f586\",\"license\":\"AGPL-3.0\"},\"src/lending/ILender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\n/// Base contract for lending protocols, can be used for colletaralized and not colletaralized lending.\\ninterface ILender {\\n\\n /// @notice Returns the number of tokens the borrower (caller of this function) can take from the lender\\n /// @return Available credit as amount of tokens\\n function availableCredit() external view returns (uint256);\\n\\n /// @notice Returns the outstanding debt that the borrower (caller of this function) must repay\\n /// @return Outstanding debt as amount of tokens\\n function outstandingDebt() external view returns (uint256);\\n\\n /// @notice Returns the amount of funds taken by the borrower (caller of this function).\\n /// @return Debt as amount of tokens\\n function currentDebt() external view returns (uint256);\\n\\n /// @notice Returns the debt ratio of the borrower (caller of this function).\\n function currentDebtRatio() external view returns (uint256);\\n\\n /// @notice Returns the last report timestamp of the borrower (caller of this function).\\n function lastReport() external view returns (uint256);\\n\\n /// @notice Returns the activation status of the borrower (caller of this function).\\n /// @return \\\"true\\\" if the borrower is active\\n function isActivated() external view returns (bool);\\n\\n /// @notice Indicates if the vault was shutted down or not.\\n /// @return \\\"true\\\" if the contract is paused, and \\\"false\\\" otherwise.\\n function paused() external view returns (bool);\\n\\n /// @notice Reports a positive result of the borrower's debt management.\\n /// Borrower must call this function if he has made any profit\\n /// or/and has a free funds available to repay the outstanding debt (if any).\\n /// @param extraFreeFunds an extra amount of free funds borrower's contract has.\\n /// This reporting amount must be greater than the borrower's outstanding debt.\\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\\n function reportPositiveDebtManagement(\\n uint256 extraFreeFunds,\\n uint256 debtPayment\\n ) external;\\n\\n /// @notice Reports a negative result of the borrower's debt management.\\n /// The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\\n /// May include a portion of the outstanding debt that the borrower was unable to repay.\\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\\n external;\\n}\\n\",\"keccak256\":\"0x5d79dc98497b5172dab5fb9184b1eb6531f4949e3435d273c1327fe4e14fb752\",\"license\":\"AGPL-3.0\"},\"src/lending/IStrategiesLender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {ILender} from \\\"./ILender.sol\\\";\\n\\n/// Lender contract which targeted to lend specifically for investments strategies.\\n/// Basically represent specific case of implementation of whitelist not colletaraized lending contract.\\ninterface IStrategiesLender is ILender {\\n\\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\\n function withdrawalQueue(uint256 index) external view returns (address);\\n\\n /// @notice Revokes a strategy from the vault.\\n /// Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\\n /// @param strategy a strategy to revoke.\\n function revokeStrategy(address strategy) external;\\n\\n /// @notice Returns average interst rate of lender per block. \\n /// Based on last report utilization rate and possibly cached interest rate of each strategy.\\n /// Can be outadated, but close enough to real state for on chain calculations.\\n /// Calculate average by combining utilisation rate of each strategy with its interest rate.\\n /// Returns additional total utilisation rate of lender, as additional product of calculation, usefull to safe gas.\\n /// @return interstRate - The interest rate per block, scaled by 1e18\\n /// @return utilisationRate - The utilisation rate of the lender, in BPS (scaled by 1e4)\\n function interestRatePerBlock() external view returns (uint256 interstRate, uint256 utilisationRate);\\n}\\n\",\"keccak256\":\"0xa70a854391820bf8c7314c9fffefd3e07cca320acd72bf4a539ea5fcd6637139\",\"license\":\"AGPL-3.0\"},\"src/lending/Lender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {MathUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\\\";\\nimport {PausableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport {ReentrancyGuardUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\n\\nimport {ILender} from \\\"./ILender.sol\\\";\\nimport {SafeInitializable} from \\\"../upgradeable/SafeInitializable.sol\\\";\\n\\nerror BorrowerAlreadyExists();\\nerror BorrowerDoesNotExist();\\nerror BorrowerHasDebt();\\nerror CallerIsNotABorrower();\\nerror LenderRatioExceeded(uint256 freeRatio);\\nerror FalsePositiveReport();\\n\\nabstract contract Lender is\\n ILender,\\n SafeInitializable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n struct BorrowerData {\\n /// Timestamp of the block in which the borrower was activated\\n uint256 activationTimestamp;\\n /// Last time a borrower made a report\\n uint256 lastReportTimestamp;\\n /// Amount of tokens taken by the borrower\\n uint256 debt;\\n /// Maximum portion of the loan that the borrower can take (in BPS)\\n /// Represents credibility of the borrower\\n uint256 debtRatio;\\n }\\n\\n uint256 public constant MAX_BPS = 10_000;\\n\\n /// @notice Amount of tokens that all borrowers have taken\\n uint256 public totalDebt;\\n\\n /// @notice Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\\n uint256 public debtRatio;\\n\\n /// @notice Last time a report occurred by any borrower\\n uint256 public lastReportTimestamp;\\n\\n /// @notice Records with information on each borrower using the lender's services\\n mapping(address => BorrowerData) public borrowersData;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /// @notice Event that must occur when the borrower reported the results of his debt management\\n /// @param borrower Borrower's contract address\\n /// @param debtPayment Amount of outstanding debt repaid by the borrower\\n /// @param freeFunds Free funds on the borrower's contract that remain after the debt is paid\\n /// @param fundsGiven Funds issued to the borrower by this lender\\n /// @param fundsTaken Funds that have been taken from the borrower by the lender\\n /// @param loss Amount of funds that the borrower realised as loss\\n event BorrowerDebtManagementReported(\\n address indexed borrower,\\n uint256 debtPayment,\\n uint256 freeFunds,\\n uint256 fundsGiven,\\n uint256 fundsTaken,\\n uint256 loss\\n );\\n\\n modifier onlyBorrowers() {\\n if (borrowersData[msg.sender].activationTimestamp == 0) {\\n revert CallerIsNotABorrower();\\n }\\n _;\\n }\\n\\n /// @notice Updates the last report timestamp for the specified borrower and this lender.\\n modifier updateLastReportTime() {\\n _;\\n borrowersData[msg.sender].lastReportTimestamp = lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n function __Lender_init() internal onlyInitializing {\\n __Pausable_init();\\n __ReentrancyGuard_init();\\n\\n __Lender_init_unchained();\\n }\\n\\n function __Lender_init_unchained() internal onlyInitializing {\\n lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /// @inheritdoc ILender\\n function availableCredit() external view override returns (uint256) {\\n return _availableCredit(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function outstandingDebt() external view override returns (uint256) {\\n return _outstandingDebt(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function currentDebt() external view override returns (uint256) {\\n return currentDebt(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function currentDebtRatio() external view override returns (uint256) {\\n return borrowersData[msg.sender].debt;\\n }\\n\\n /// @inheritdoc ILender\\n function isActivated() external view override returns (bool) {\\n return isActivated(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function lastReport() external view override returns (uint256) {\\n return lastReport(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function reportPositiveDebtManagement(\\n uint256 extraFreeFunds,\\n uint256 debtPayment\\n ) external override onlyBorrowers updateLastReportTime nonReentrant {\\n // Checking whether the borrower is telling the truth about his available funds\\n if (_borrowerFreeAssets(msg.sender) < extraFreeFunds + debtPayment) {\\n revert FalsePositiveReport();\\n }\\n\\n uint256 chargedFees = 0;\\n // We can only charge a fees if the borrower has reported extra free funds,\\n // if it's the first report at this block and only if the borrower was registered some time ago\\n if (\\n extraFreeFunds > 0 &&\\n borrowersData[msg.sender].lastReportTimestamp < block.timestamp && // solhint-disable-line not-rely-on-time\\n borrowersData[msg.sender].activationTimestamp < block.timestamp // solhint-disable-line not-rely-on-time\\n ) {\\n chargedFees = _chargeFees(extraFreeFunds);\\n }\\n\\n _rebalanceBorrowerFunds(msg.sender, debtPayment, extraFreeFunds, 0);\\n\\n _afterPositiveDebtManagementReport(extraFreeFunds, chargedFees);\\n }\\n\\n /// @inheritdoc ILender\\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\\n external\\n override\\n onlyBorrowers\\n updateLastReportTime\\n nonReentrant\\n {\\n // Checking whether the borrower has available funds for debt payment\\n require(_borrowerFreeAssets(msg.sender) >= debtPayment, \\\"Not enough assets for payment\\\");\\n\\n // Debt wasn't repaid, we need to decrease the ratio of this borrower\\n if (loss > 0) {\\n _decreaseBorrowerCredibility(msg.sender, loss);\\n }\\n\\n _rebalanceBorrowerFunds(msg.sender, debtPayment, 0, loss);\\n\\n _afterNegativeDebtManagementReport(loss);\\n }\\n\\n /// @notice Balances the borrower's account and adjusts the current amount of funds the borrower can take.\\n /// @param borrower a borrower's contract address.\\n /// @param debtPayment an amount of outstanding debt since the previous report, that the borrower managed to cover. Can be zero.\\n /// @param borrowerFreeFunds a funds that the borrower has earned since the previous report. Can be zero.\\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\\n function _rebalanceBorrowerFunds(\\n address borrower,\\n uint256 debtPayment,\\n uint256 borrowerFreeFunds,\\n uint256 loss\\n ) private {\\n // Calculate the amount of credit the lender can provide to the borrower (if any)\\n uint256 borrowerAvailableCredit = _availableCredit(borrower);\\n\\n // Make sure that the borrower's debt payment doesn't exceed his actual outstanding debt\\n uint256 borrowerOutstandingDebt = _outstandingDebt(msg.sender);\\n debtPayment = MathUpgradeable.min(debtPayment, borrowerOutstandingDebt);\\n\\n // Take into account repaid debt, if any\\n if (debtPayment > 0) {\\n borrowersData[borrower].debt -= debtPayment;\\n totalDebt -= debtPayment;\\n }\\n\\n // Allocate some funds to the borrower if possible\\n if (borrowerAvailableCredit > 0) {\\n borrowersData[borrower].debt += borrowerAvailableCredit;\\n totalDebt += borrowerAvailableCredit;\\n }\\n\\n // Now we need to compare the allocated funds to the borrower and his current free balance.\\n // If the number of unrealized tokens on the borrower's contract is less than the available credit, \\n // the lender must give that difference to the borrower.\\n // Otherwise (if the amount of the borrower's available funds is greater than \\n // he should have according to his share), the lender must take that portion of the funds for himself.\\n uint256 freeBorrowerBalance = borrowerFreeFunds + debtPayment;\\n uint256 fundsGiven = 0;\\n uint256 fundsTaken = 0;\\n if (freeBorrowerBalance < borrowerAvailableCredit) {\\n fundsGiven = borrowerAvailableCredit - freeBorrowerBalance;\\n _transferFundsToBorrower(borrower, fundsGiven);\\n } else if (freeBorrowerBalance > borrowerAvailableCredit) {\\n fundsTaken = freeBorrowerBalance - borrowerAvailableCredit;\\n _takeFundsFromBorrower(borrower, fundsTaken);\\n }\\n\\n emit BorrowerDebtManagementReported(\\n borrower,\\n debtPayment,\\n borrowerFreeFunds,\\n fundsGiven,\\n fundsTaken,\\n loss\\n );\\n }\\n\\n /// @notice Returns the unrealized amount of the lender's tokens (lender's contract balance)\\n function _freeAssets() internal view virtual returns (uint256);\\n\\n /// @notice Returns the unrealized amount of the borrower's tokens (contract balance of the specified borrower)\\n function _borrowerFreeAssets(address borrower)\\n internal\\n view\\n virtual\\n returns (uint256);\\n\\n /// @notice Transfers a specified amount of tokens to the borrower\\n function _transferFundsToBorrower(address borrower, uint256 amount)\\n internal\\n virtual;\\n\\n /// @notice Takes a specified amount of tokens from the borrower\\n function _takeFundsFromBorrower(address borrower, uint256 amount)\\n internal\\n virtual;\\n\\n /// @notice Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\\n function fundAssets() public view virtual returns (uint256) {\\n return _freeAssets() + totalDebt;\\n }\\n\\n /// @notice Returns the current debt that the strategy has.\\n function currentDebt(address borrower) public view returns (uint256) {\\n return borrowersData[borrower].debt;\\n }\\n\\n /// @notice Returns the activation status of the specified borrower.\\n function isActivated(address borrower) public view returns (bool) {\\n return borrowersData[borrower].activationTimestamp > 0;\\n }\\n\\n /// @notice Returns the last report timestamp of the specified borrower.\\n function lastReport(address borrower) public view returns (uint256) {\\n return borrowersData[borrower].lastReportTimestamp;\\n }\\n\\n /// @notice Returns the total number of tokens borrowers can take.\\n function _debtLimit() private view returns (uint256) {\\n return (debtRatio * fundAssets()) / MAX_BPS;\\n }\\n\\n /// @notice Lowers the borrower's debt he can take by specified loss and decreases his credibility.\\n /// @dev This function has \\\"internal\\\" visibility because it's used in tests.\\n function _decreaseBorrowerCredibility(address borrower, uint256 loss)\\n internal\\n {\\n uint256 debt = borrowersData[borrower].debt;\\n\\n // Make sure the borrower's loss is less than his entire debt\\n require(debt >= loss, \\\"Loss is greater than the debt\\\");\\n\\n // To decrease credibility of the borrower we should lower his \\\"debtRatio\\\"\\n if (debtRatio > 0) {\\n uint256 debtRatioChange = MathUpgradeable.min(\\n (debtRatio * loss) / totalDebt,\\n borrowersData[borrower].debtRatio\\n );\\n if (debtRatioChange != 0) {\\n borrowersData[borrower].debtRatio -= debtRatioChange;\\n debtRatio -= debtRatioChange;\\n }\\n }\\n\\n // Also, need to reduce the max amount of funds that can be taken by the borrower\\n borrowersData[borrower].debt -= loss;\\n totalDebt -= loss;\\n }\\n\\n /// @notice See external implementation\\n function _availableCredit(address borrower)\\n internal\\n view\\n returns (uint256)\\n {\\n // Lender is paused, no funds available for the borrower\\n if (paused()) {\\n return 0;\\n }\\n\\n uint256 lenderDebtLimit = _debtLimit();\\n uint256 lenderDebt = totalDebt;\\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\\n fundAssets()) / MAX_BPS;\\n uint256 borrowerDebt = borrowersData[borrower].debt;\\n\\n // There're no more funds for the borrower because he has outstanding debt or the lender's available funds have been exhausted\\n if (\\n lenderDebtLimit <= lenderDebt || borrowerDebtLimit <= borrowerDebt\\n ) {\\n return 0;\\n }\\n\\n uint256 lenderAvailableFunds = lenderDebtLimit - lenderDebt;\\n uint256 borrowerIntendedCredit = borrowerDebtLimit - borrowerDebt;\\n\\n // Borrower may not take more funds than the lender's limit\\n uint256 borrowerAvailableCredit = MathUpgradeable.min(\\n lenderAvailableFunds,\\n borrowerIntendedCredit\\n );\\n\\n // Available credit is limited by the existing number of tokens on the lender's contract\\n borrowerAvailableCredit = MathUpgradeable.min(\\n borrowerAvailableCredit,\\n _freeAssets()\\n );\\n\\n return borrowerAvailableCredit;\\n }\\n\\n /// @notice See external implementation\\n function _outstandingDebt(address borrower)\\n internal\\n view\\n returns (uint256)\\n {\\n uint256 borrowerDebt = borrowersData[borrower].debt;\\n if (paused() || debtRatio == 0) {\\n return borrowerDebt;\\n }\\n\\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\\n fundAssets()) / MAX_BPS;\\n if (borrowerDebt <= borrowerDebtLimit) {\\n return 0;\\n }\\n\\n return borrowerDebt - borrowerDebtLimit;\\n }\\n\\n /// @notice Registers a new borrower and sets for him a certain debt ratio\\n function _registerBorrower(address borrower, uint256 borrowerDebtRatio)\\n internal\\n {\\n // Check if specified borrower has already registered\\n if (isActivated(borrower)) {\\n revert BorrowerAlreadyExists();\\n }\\n\\n if (debtRatio + borrowerDebtRatio > MAX_BPS) {\\n revert LenderRatioExceeded(MAX_BPS - debtRatio);\\n }\\n\\n borrowersData[borrower] = BorrowerData(\\n // Activation timestamp \\n block.timestamp, // solhint-disable-line not-rely-on-time\\n // Last report timestamp\\n block.timestamp, // solhint-disable-line not-rely-on-time\\n // Initial debt\\n 0, \\n // Debt ratio\\n borrowerDebtRatio \\n );\\n\\n debtRatio += borrowerDebtRatio;\\n }\\n\\n /// @notice Sets the borrower's debt ratio. Will be reverted if the borrower doesn't exist or the total debt ratio is exceeded.\\n /// @dev In the case where you want to disable the borrower, you need to set its ratio to 0.\\n /// Thus, the borrower's current debt becomes an outstanding debt, which he must repay to the lender.\\n function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)\\n internal\\n {\\n if (!isActivated(borrower)) {\\n revert BorrowerDoesNotExist();\\n }\\n\\n debtRatio -= borrowersData[borrower].debtRatio;\\n borrowersData[borrower].debtRatio = borrowerDebtRatio;\\n debtRatio += borrowerDebtRatio;\\n\\n if (debtRatio > MAX_BPS) {\\n revert LenderRatioExceeded(\\n MAX_BPS - (debtRatio - borrowerDebtRatio)\\n );\\n }\\n }\\n\\n /// @notice Deletes the borrower from the list\\n /// @dev Should be called after the borrower's debt ratio is changed to 0, because the lender must take back all the released funds.\\n function _unregisterBorrower(address borrower) internal {\\n if (borrowersData[borrower].debtRatio > 0) {\\n revert BorrowerHasDebt();\\n }\\n delete borrowersData[borrower];\\n }\\n\\n /// Calculate utilisation rate for specific borrower\\n /// @notice Based on last report data, can be outdated, but close to latest state of fund\\n /// @return percent of total assets taken by strategy in BPS\\n function utilizationRate(address borrower) public virtual view returns (uint256) {\\n // assets in vault + amount lent to strategies\\n uint256 _fundAssets = fundAssets(); \\n // to decrease amount of calls to borrower contract,\\n // assume that borrower have same amount like in last update\\n uint256 borrowerAssets = borrowersData[borrower].debt; \\n\\n if (_fundAssets == 0) {\\n return 0;\\n }\\n\\n return borrowerAssets * MAX_BPS / _fundAssets;\\n }\\n\\n /// @notice Charges a fee on the borrower's income.\\n /// @param extraFreeFunds an income from which the fees will be calculated.\\n /// @return The total amount of fees charged.\\n function _chargeFees(uint256 extraFreeFunds)\\n internal\\n virtual\\n returns (uint256);\\n\\n /// @notice Callback that is called at the end of the positive report function.\\n /// @param extraFreeFunds the reported extra amount of borrower's funds.\\n /// @param chargedFees the total amount of charged fees.\\n function _afterPositiveDebtManagementReport(\\n uint256 extraFreeFunds,\\n uint256 chargedFees\\n ) internal virtual;\\n\\n /// @notice Callback that is called at the end of the negative report function.\\n /// @param loss the number of tokens by which the borrower's balance has decreased since the last report.\\n function _afterNegativeDebtManagementReport(uint256 loss) internal virtual;\\n\\n /// @inheritdoc ILender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, PausableUpgradeable)\\n virtual\\n returns (bool)\\n {\\n return super.paused();\\n }\\n}\\n\",\"keccak256\":\"0x0d7afe11c9c01322013f677cdd5934f2086d90dcd2344748440a74746800f903\",\"license\":\"AGPL-3.0\"},\"src/lending/StrategiesLender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\nimport {Lender, BorrowerDoesNotExist} from \\\"./Lender.sol\\\";\\nimport {ILender} from \\\"./ILender.sol\\\";\\nimport {IStrategiesLender} from \\\"./IStrategiesLender.sol\\\";\\nimport {IStrategy} from \\\"../strategies/IStrategy.sol\\\";\\nimport {AddressList} from \\\"../structures/AddressList.sol\\\";\\n\\nerror UnexpectedZeroAddress();\\nerror StrategyNotFound();\\nerror StrategyAlreadyExists();\\nerror AccessDeniedForCaller(address caller);\\n\\n/// Lender contract which targeted to lend specifically for investments strategies.\\n/// Basically represent specific case of implementation of whitelist not colletaraized lending contract.\\nabstract contract StrategiesLender is IStrategiesLender, Lender, OwnableUpgradeable {\\n\\n using AddressList for address[];\\n\\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\\n address[] public withdrawalQueue;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[50] private __gap;\\n\\n /// @notice Event that should happen when the strategy connects to the vault.\\n /// @param strategy Address of the strategy contract.\\n /// @param debtRatio Maximum portion of the loan that the strategy can take (in BPS).\\n event StrategyAdded(address indexed strategy, uint256 debtRatio);\\n\\n /// @notice Event that should happen when the strategy has been revoked from the vault.\\n /// @param strategy Address of the strategy contract.\\n event StrategyRevoked(address indexed strategy);\\n\\n /// @notice Event that should happen when the strategy has been removed from the vault.\\n /// @param strategy Address of the strategy contract.\\n /// @param fromQueueOnly If \\\"true\\\", then the strategy has only been removed from the withdrawal queue.\\n event StrategyRemoved(address indexed strategy, bool fromQueueOnly);\\n\\n /// @notice Event that should happen when the strategy has been returned to the withdrawal queue.\\n /// @param strategy Address of the strategy contract.\\n event StrategyReturnedToQueue(address indexed strategy);\\n\\n modifier onlyOwnerOrStrategy(address strategy) {\\n if (msg.sender != owner() && msg.sender != strategy) {\\n revert AccessDeniedForCaller(msg.sender);\\n }\\n _;\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n function __StrategiesLender_init() internal onlyInitializing {\\n __Ownable_init();\\n\\n __StrategiesLender_init_lenderSpecific();\\n }\\n\\n /// Init only direct constructors of business logic, ignore Ownable and simular common contracts\\n function __StrategiesLender_init_lenderSpecific() internal onlyInitializing {\\n require(owner() != address(0), \\\"StrategiesLender must be ownable\\\");\\n\\n __Lender_init();\\n }\\n\\n /// @notice Switches the vault pause state.\\n /// @param shutdown a new vault pause state. If \\\"true\\\" is passed, the vault will be paused.\\n function setEmergencyShutdown(bool shutdown) external onlyOwner {\\n shutdown ? _pause() : _unpause();\\n }\\n\\n /// @notice Returns the current debt of the strategy.\\n /// @param strategy the strategy address.\\n function strategyDebt(address strategy) external view returns (uint256) {\\n return borrowersData[strategy].debt;\\n }\\n\\n /// @notice Returns the debt ratio of the strategy.\\n /// @param strategy the strategy address.\\n function strategyRatio(address strategy) external view returns (uint256) {\\n return borrowersData[strategy].debtRatio;\\n }\\n\\n /// @notice Adds a new strategy to the vault.\\n /// @param strategy a new strategy address.\\n /// @param debtRatio a ratio that shows how much of the new strategy can take, relative to other strategies.\\n function addStrategy(address strategy, uint256 debtRatio)\\n external\\n onlyOwner\\n whenNotPaused\\n {\\n if (strategy == address(0)) {\\n revert UnexpectedZeroAddress();\\n }\\n \\n _beforeStrategyRegistered(IStrategy(strategy));\\n\\n _registerBorrower(strategy, debtRatio);\\n withdrawalQueue.add(strategy);\\n\\n emit StrategyAdded(strategy, debtRatio);\\n }\\n\\n /// Allow check strategy complience before it added\\n function _beforeStrategyRegistered(IStrategy strategy) internal virtual;\\n\\n /// @notice Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\\n /// @param strategy a strategy address.\\n function addStrategyToQueue(address strategy) external onlyOwner {\\n if (strategy == address(0)) {\\n revert UnexpectedZeroAddress();\\n }\\n\\n if (withdrawalQueue.contains(strategy)) {\\n revert StrategyAlreadyExists();\\n }\\n\\n if (borrowersData[strategy].activationTimestamp == 0) {\\n revert BorrowerDoesNotExist();\\n }\\n\\n withdrawalQueue.add(strategy);\\n\\n emit StrategyReturnedToQueue(strategy);\\n }\\n\\n /// @inheritdoc IStrategiesLender\\n function revokeStrategy(address strategy)\\n external\\n onlyOwnerOrStrategy(strategy)\\n {\\n _setBorrowerDebtRatio(strategy, 0);\\n emit StrategyRevoked(strategy);\\n }\\n\\n /// @notice Removes a strategy from the vault.\\n /// @param strategy a strategy to remove.\\n /// @param fromQueueOnly if \\\"true\\\", then the strategy will only be removed from the withdrawal queue.\\n function removeStrategy(address strategy, bool fromQueueOnly)\\n external\\n onlyOwner\\n {\\n bool removedFromQueue = withdrawalQueue.remove(strategy);\\n if (!removedFromQueue) {\\n revert StrategyNotFound();\\n }\\n\\n if (!fromQueueOnly) {\\n _unregisterBorrower(strategy);\\n }\\n\\n emit StrategyRemoved(strategy, fromQueueOnly);\\n }\\n\\n /// @notice Sets the withdrawal queue.\\n /// @param queue a new queue that will replace the existing one.\\n /// Should contain only those elements that already present in the existing queue.\\n function reorderWithdrawalQueue(address[] memory queue) external onlyOwner {\\n withdrawalQueue = withdrawalQueue.reorder(queue);\\n }\\n\\n /// @notice Returns the size of the withdrawal queue.\\n function getQueueSize() external view returns (uint256) {\\n return withdrawalQueue.length;\\n }\\n \\n /// @inheritdoc IStrategiesLender\\n function interestRatePerBlock() public view returns (uint256, uint256) {\\n uint256 totalUtilisationRate;\\n uint256 totalInterestRate;\\n\\n if(totalDebt == 0) {\\n return (0, 0);\\n }\\n\\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\\n IStrategy strategy = IStrategy(withdrawalQueue[i]);\\n\\n uint256 utilisationRate = utilizationRate(address(strategy)); // in BPS\\n totalUtilisationRate += utilisationRate;\\n \\n // interest rate scaled by 1e18\\n // utilisation rate in BPS * interest rate scaled by 1e18 / BPS = total interest rate scaled by 1e18\\n totalInterestRate += utilisationRate * strategy.interestRatePerBlock() / MAX_BPS; \\n }\\n\\n // sanity check\\n if (totalUtilisationRate == 0) {\\n return (0, 0);\\n }\\n\\n return (totalInterestRate, totalUtilisationRate);\\n }\\n\\n /// @inheritdoc Lender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, Lender)\\n virtual\\n returns (bool)\\n {\\n return super.paused();\\n }\\n\\n}\",\"keccak256\":\"0x610e7cb1848bc5c1808a2444e825ce280e645321c9b4aea2032b0b1ea305b7ce\",\"license\":\"AGPL-3.0\"},\"src/strategies/IStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {IStrategiesLender} from \\\"../lending/IStrategiesLender.sol\\\";\\n\\ninterface IStrategy {\\n /// @notice Returns the name of this strategy.\\n function name() external view returns (string memory);\\n\\n /// @notice Returns the contract address of the underlying asset of this strategy.\\n function asset() external view returns (IERC20Upgradeable);\\n\\n /// @notice Returns the contract address of the Lender to which this strategy is connected.\\n function lender() external view returns (IStrategiesLender);\\n\\n /// @notice Transfers a specified amount of tokens to the vault.\\n /// @param assets A amount of tokens to withdraw.\\n /// @return loss A number of tokens that the strategy could not return.\\n function withdraw(uint256 assets) external returns (uint256 loss);\\n\\n /// @notice Returns interst rate of strategy per block, for current block or block prior to this one.\\n /// @dev Can be calculated not for all strategies and usally not such accurate as sliding window averages,\\n /// but still can be usafull for on chain calculations and as fallback method.\\n /// @return The interest rate per block, scaled by 1e18\\n function interestRatePerBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xc22f6bf472cc43d96347263eeb615d0b57ef02395bbe303ccd2981d4beadcbfd\",\"license\":\"AGPL-3.0\"},\"src/structures/AddressList.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nerror ListsDoNotMatch();\\n\\nlibrary AddressList {\\n /// @notice Adds an address to the list.\\n /// @param list the list of addresses.\\n /// @param addr the address to add.\\n function add(address[] storage list, address addr) internal {\\n list.push(addr);\\n }\\n\\n /// @notice Checks if the list contains the specified item.\\n /// @param list the list of addresses.\\n /// @param addr the address to find.\\n function contains(address[] storage list, address addr)\\n internal\\n view\\n returns (bool)\\n {\\n for (uint256 i = 0; i < list.length; i++) {\\n if (list[i] == addr) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /// @notice Removes an address from the list and fills the gap with the following items by moving them up.\\n /// @param list the list of addresses.\\n /// @param addr the address to remove.\\n /// @return A boolean value that indicates if the address was found and removed from the list.\\n function remove(address[] storage list, address addr)\\n internal\\n returns (bool)\\n {\\n bool addressFound;\\n for (uint256 i = 0; i < list.length; i++) {\\n if (list[i] == addr) {\\n addressFound = true;\\n }\\n if (addressFound && i < list.length - 1) {\\n list[i] = list[i + 1];\\n }\\n }\\n if (addressFound) {\\n list.pop();\\n }\\n return addressFound;\\n }\\n\\n /// @notice Checks if the list can be reordered in the specified way.\\n /// @param list the list of addresses.\\n /// @param reoderedList the desired reordered list, which must have the same content as the existing list.\\n /// @return A reordered list\\n function reorder(address[] storage list, address[] memory reoderedList)\\n internal\\n view\\n returns (address[] memory)\\n {\\n uint256 length = list.length;\\n if (length != reoderedList.length) {\\n revert ListsDoNotMatch();\\n }\\n for (uint256 i = 0; i < length; i++) {\\n address existingAddress = list[i];\\n for (uint256 j = 0; j < length; j++) {\\n // Address is found, move to the next item\\n if (existingAddress == reoderedList[j]) {\\n break;\\n }\\n // If this is the last iteration, then the address is not found\\n if (j == length - 1) {\\n revert ListsDoNotMatch();\\n }\\n }\\n }\\n return reoderedList;\\n }\\n}\\n\",\"keccak256\":\"0x6d1ba8d87163661acbb468bcfdd3339d7b23f20866e6bd62546a69b81d3c16df\",\"license\":\"AGPL-3.0\"},\"src/tokens/ERC4626Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {ERC777Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\\\";\\nimport {ReentrancyGuardUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\nimport {FixedPointMathLib} from \\\"solmate/utils/FixedPointMathLib.sol\\\";\\n\\nimport {IERC4626} from \\\"./IERC4626.sol\\\";\\nimport {SafeInitializable} from \\\"../upgradeable/SafeInitializable.sol\\\";\\n\\n/// @title ERC4626 upgradable tokenized Vault implementation based on ERC-777.\\n/// More info in [EIP](https://eips.ethereum.org/EIPS/eip-4626)\\n/// Based on Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/mixins/ERC4626.sol)\\n///\\n/// ERC-777 and ERC-20 tokens represent \\\"shares\\\"\\n/// Vault \\u201cshares\\u201d which represent a claim to ownership on a fraction of the Vault\\u2019s underlying holdings.\\n/// -\\n/// @notice Rationale\\n/// The mint method was included for symmetry and feature completeness.\\n/// Most current use cases of share-based Vaults do not ascribe special meaning to the shares\\n/// such that a user would optimize for a specific number of shares (mint)\\n/// rather than specific amount of underlying (deposit).\\n/// However, it is easy to imagine future Vault strategies which would have unique\\n/// and independently useful share representations.\\n/// The convertTo functions serve as rough estimates that do not account for operation specific details\\n/// like withdrawal fees, etc. They were included for frontends and applications that need an average\\n/// value of shares or assets, not an exact value possibly including slippage or other fees.\\n/// For applications that need an exact value that attempts to account for fees and slippage we have\\n/// included a corresponding preview function to match each mutable function.\\n/// These functions must not account for deposit or withdrawal limits, to ensure they are easily composable,\\n/// the max functions are provided for that purpose.\\nabstract contract ERC4626Upgradeable is\\n SafeInitializable,\\n ERC777Upgradeable,\\n ReentrancyGuardUpgradeable,\\n IERC4626\\n{\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n using FixedPointMathLib for uint256;\\n\\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n IERC20Upgradeable public asset;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n /**\\n * Constructor for the ERC4626Upgradeable contract\\n * @param _asset which will be stored in this Vault\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __ERC4626_init(\\n IERC20Upgradeable _asset,\\n string memory name_,\\n string memory symbol_,\\n address[] memory defaultOperators_\\n ) internal onlyInitializing {\\n __ERC777_init(name_, symbol_, defaultOperators_);\\n __ReentrancyGuard_init();\\n\\n __ERC4626_init_unchained(_asset);\\n }\\n\\n /**\\n * Unchained constructor for the ERC4626Upgradeable contract, without parents contracts init\\n * @param _asset which will be stored in this Vault\\n */\\n function __ERC4626_init_unchained(IERC20Upgradeable _asset)\\n internal\\n onlyInitializing\\n {\\n asset = _asset;\\n }\\n\\n /* ///////////////////////////// DEPOSIT / WITHDRAWAL ///////////////////////////// */\\n\\n /// @notice Mints Vault shares to receiver by depositing exactly amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage,\\n /// the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function deposit(uint256 assets, address receiver)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n shares = previewDeposit(assets);\\n // Check for rounding error since we round down in previewDeposit.\\n require(shares != 0, \\\"Given assets result in 0 shares.\\\");\\n\\n _receiveAndDeposit(assets, shares, receiver);\\n }\\n\\n /// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function mint(uint256 shares, address receiver)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n // No need to check for rounding error, previewMint rounds up.\\n assets = previewMint(shares);\\n\\n _receiveAndDeposit(assets, shares, receiver);\\n }\\n\\n /// @notice Base deposit logic which common for public deposit and mint function\\n /// Trasfer assets from sender and mint shares for receiver\\n function _receiveAndDeposit(\\n uint256 assets,\\n uint256 shares,\\n address receiver\\n ) internal {\\n // cases when msg.sender != receiver are error prone\\n // but they are allowed by the standard... we need take care of it ourselves\\n\\n // Need to transfer before minting or ERC777s could reenter.\\n asset.safeTransferFrom(msg.sender, address(this), assets);\\n\\n _mint(receiver, shares, \\\"\\\", \\\"\\\");\\n\\n emit Deposit(msg.sender, receiver, assets, shares);\\n\\n afterDeposit(assets, shares);\\n }\\n\\n /// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n /// - emit the Withdraw event.\\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - support a withdraw flow where the shares are burned from owner directly where msg.sender\\n /// has ERC-20 approval over the shares of owner.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the withdraw execution, and are accounted for during withdraw.\\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) public virtual nonReentrant returns (uint256 shares) {\\n // No need to check for rounding error, previewWithdraw rounds up.\\n shares = previewWithdraw(assets);\\n\\n _withdrawAndSend(assets, shares, receiver, owner);\\n }\\n\\n /// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n /// - emit the Withdraw event.\\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - support a redeem flow where the shares are burned from owner directly where msg.sender\\n /// has ERC-20 approval over the shares of owner.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the redeem execution, and are accounted for during redeem.\\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) public virtual nonReentrant returns (uint256 assets) {\\n assets = previewRedeem(shares);\\n // Check for rounding error since we round down in previewRedeem.\\n require(assets != 0, \\\"Given shares result in 0 assets.\\\");\\n\\n _withdrawAndSend(assets, shares, receiver, owner);\\n }\\n\\n /// @notice Burn owner shares and send tokens to receiver.\\n function _withdrawAndSend(\\n uint256 assets,\\n uint256 shares,\\n address receiver,\\n address owner\\n ) internal {\\n // cases when msg.sender != receiver != owner is error prune\\n // but they allowed by standard... take care of it by self\\n if (msg.sender != owner) {\\n _spendAllowance(owner, msg.sender, shares);\\n }\\n\\n beforeWithdraw(assets, shares);\\n\\n _burn(owner, shares, \\\"\\\", \\\"\\\");\\n\\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\\n\\n asset.safeTransfer(receiver, assets);\\n }\\n\\n /* ///////////////////////////// ACCOUNTING ///////////////////////////// */\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block,\\n /// given current on-chain conditions.\\n /// - return as close to and no more than the exact amount of Vault shares that would be minted\\n /// in a deposit call in the same transaction.\\n /// I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction.\\n /// - NOT account for deposit limits like those returned from maxDeposit\\n /// and should always act as though the deposit would be accepted,\\n /// regardless if the user has enough tokens approved, etc.\\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n /// - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert.\\n /// Note that any unfavorable discrepancy between convertToShares and previewDeposit\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by depositing.\\n function previewDeposit(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n return convertToShares(assets);\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block,\\n /// given current on-chain conditions.\\n /// - return as close to and no fewer than the exact amount of assets that would be deposited\\n /// in a mint call in the same transaction.\\n /// I.e. mint should return the same or fewer assets as previewMint if called in the same transaction.\\n /// - NOT account for mint limits like those returned from maxMint\\n /// and should always act as though the mint would be accepted,\\n /// regardless if the user has enough tokens approved, etc.\\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause mint to revert.\\n /// Note that any unfavorable discrepancy between convertToAssets and previewMint\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by minting.\\n function previewMint(uint256 shares) public view virtual returns (uint256) {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return shares;\\n }\\n\\n return shares.mulDivUp(totalAssets(), supply);\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal\\n /// at the current block, given current on-chain conditions.\\n /// - return as close to and no fewer than the exact amount of Vault shares\\n /// that would be burned in a withdraw call in the same transaction.\\n /// I.e. withdraw should return the same or fewer shares as previewWithdraw\\n /// if called in the same transaction.\\n /// - NOT account for withdrawal limits like those returned from maxWithdraw\\n /// and should always act as though the withdrawal would be accepted,\\n /// regardless if the user has enough shares, etc.\\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause withdraw to revert.\\n /// Note that any unfavorable discrepancy between convertToShares and previewWithdraw\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by depositing.\\n function previewWithdraw(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return assets;\\n }\\n return assets.mulDivUp(supply, totalAssets());\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their\\n /// redeemption at the current block, given current on-chain conditions.\\n /// - return as close to and no more than the exact amount of assets that would be withdrawn\\n /// in a redeem call in the same transaction.\\n /// I.e. redeem should return the same or more assets as previewRedeem\\n /// if called in the same transaction.\\n /// - NOT account for redemption limits like those returned from maxRedeem\\n /// and should always act as though the redemption would be accepted,\\n /// regardless if the user has enough shares, etc.\\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause redeem to revert.\\n /// Note that any unfavorable discrepancy between convertToAssets and previewRedeem\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by redeeming.\\n function previewRedeem(uint256 shares)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n return convertToAssets(shares);\\n }\\n\\n /// @notice The amount of shares that the Vault would exchange for the amount of assets provided,\\n /// in an ideal scenario where all the conditions are met.\\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\\n /// - do NOT show any variations depending on the caller.\\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\\n /// - round down towards 0.\\n /// This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share,\\n /// and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share,\\n /// meaning what the average user should expect to see when exchanging to and from.\\n function convertToShares(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return assets;\\n }\\n\\n return assets.mulDivDown(supply, totalAssets());\\n }\\n\\n /// @notice The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.\\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\\n /// - do NOT show any variations depending on the caller.\\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\\n /// - round down towards 0.\\n /// This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share,\\n /// and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share,\\n /// meaning what the average user should expect to see when exchanging to and from.\\n function convertToAssets(uint256 shares)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return shares;\\n }\\n\\n return shares.mulDivDown(totalAssets(), supply);\\n }\\n\\n /// @notice Total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n /// - include any compounding that occurs from yield.\\n /// - inclusive of any fees that are charged against assets in the Vault.\\n /// - is NOT revert\\n /// @dev Must be implemented by child contract.\\n function totalAssets() public view virtual returns (uint256);\\n\\n /* //////////////////////////////// DEPOSIT / WITHDRAWAL LIMIT //////////////////////////////// */\\n\\n /// @notice Maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n /// through a deposit call.\\n /// - returns the maximum amount of assets deposit would allow to be deposited\\n /// for receiver and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\\n /// - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.\\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n function maxDeposit(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n /// @notice Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call.\\n /// - return the maximum amount of shares mint would allow to be deposited to receiver\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\\n /// - factor in both global and user-specific limits,\\n /// like if mints are entirely disabled (even temporarily) it MUST return 0.\\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n function maxMint(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n /// @notice Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault,\\n /// through a withdraw call.\\n /// - return the maximum amount of assets that could be transferred from owner through withdraw\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// - factor in both global and user-specific limits,\\n /// like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\\n function maxWithdraw(address owner) public view virtual returns (uint256) {\\n return convertToAssets(balanceOf(owner));\\n }\\n\\n /// @notice Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n /// through a redeem call.\\n /// - return the maximum amount of shares that could be transferred from owner through redeem\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// - factor in both global and user-specific limits,\\n /// like if redemption is entirely disabled (even temporarily) it MUST return 0.\\n function maxRedeem(address owner) public view virtual returns (uint256) {\\n return balanceOf(owner);\\n }\\n\\n /* //////////////////////////////// INTERNAL HOOKS //////////////////////////////// */\\n\\n /// @notice Called before withdraw will be made the Vault.\\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\\n\\n /// @notice Called when a deposit is made to the Vault.\\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\\n}\\n\",\"keccak256\":\"0x48f7146146afdf654bcc6b1208c7855e45f6c45b0cd4f93dd4700894432a455e\",\"license\":\"AGPL-3.0\"},\"src/tokens/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n */\\ninterface IERC4626 {\\n \\n /* ///////////////////////////// EVENTS ///////////////////////////// */\\n\\n /// `sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`.\\n /// emitted when tokens are deposited into the Vault via the mint and deposit methods.\\n event Deposit(\\n address indexed caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /// `sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`.\\n /// emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\\n * Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\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 (IERC20Upgradeable);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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\\u2019s 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\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0xaf5d3610b9a366e2294f4997bf8b0a7a5ac3b0817e8bfb58fa64314ae6a2a91f\",\"license\":\"AGPL-3.0\"},\"src/tokens/SafeERC4626Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {FixedPointMathLib} from \\\"solmate/utils/FixedPointMathLib.sol\\\";\\n\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\n\\n/// @title Safier and limited implementation of ERC-4626\\n/// @notice ERC-4626 standard allow deposit and withdraw not for message sender.\\n/// It commonly known issue, which hardly to test and much error prune.\\n/// Such interfaces caused vulnarabilities, which resulted in million dollars hacks.\\n/// On anther hand, this interfaces not have any use cases which cannot be implemented without `transferFrom` method.\\n/// This implementation prevent spends and allowances from any methods except transferFrom/send\\n/// Also main business logic simplified to reduce gas consumption.\\nabstract contract SafeERC4626Upgradeable is ERC4626Upgradeable {\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n using FixedPointMathLib for uint256;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n /**\\n * Constructor for the SafeERC4626Upgradeable contract\\n * @param _asset which will be stored in this Vault\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __SafeERC4626_init(\\n IERC20Upgradeable _asset,\\n string memory name_,\\n string memory symbol_,\\n address[] memory defaultOperators_\\n ) internal onlyInitializing {\\n __ERC4626_init(_asset, name_, symbol_, defaultOperators_);\\n }\\n\\n /**\\n * Unchained constructor for the SafeERC4626Upgradeable contract, without parents contracts init\\n * @param _asset which will be stored in this Vault\\n */\\n function __SafeERC4626Upgradeable_init_unchained(IERC20Upgradeable _asset)\\n internal\\n onlyInitializing\\n {\\n __ERC4626_init_unchained(_asset);\\n }\\n\\n /// @notice Mints the Vault shares for msg.sender, according to the number of deposited base tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function deposit(uint256 assets)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n shares = previewDeposit(assets);\\n // Check for rounding error since we round down in previewDeposit.\\n require(shares != 0, \\\"Given assets result in 0 shares.\\\");\\n\\n _receiveAndDeposit(assets, shares, msg.sender);\\n }\\n\\n /// @notice Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function mint(uint256 shares)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n // No need to check for rounding error, previewMint rounds up.\\n assets = previewMint(shares);\\n\\n _receiveAndDeposit(assets, shares, msg.sender);\\n }\\n\\n /// @notice Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender.\\n /// - emit the Withdraw event.\\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the withdraw execution, and are accounted for during withdraw.\\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function withdraw(uint256 assets)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n // No need to check for rounding error, previewWithdraw rounds up.\\n shares = previewWithdraw(assets);\\n\\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\\n }\\n\\n /// @notice Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender.\\n /// - emit the Withdraw event.\\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the redeem execution, and are accounted for during redeem.\\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function redeem(uint256 shares)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n assets = previewRedeem(shares);\\n // Check for rounding error since we round down in previewRedeem.\\n require(assets != 0, \\\"Given shares result in 0 assets.\\\");\\n\\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\\n }\\n\\n /* //////////////////// Backwards compatible methods ////////////////////////// */\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function deposit(\\n uint256 assets,\\n address /* receiver */\\n ) public virtual override returns (uint256 shares) {\\n // nonReentrant under the hood\\n return deposit(assets);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function mint(\\n uint256 shares,\\n address /* receiver */\\n ) public virtual override returns (uint256 assets) {\\n // nonReentrant under the hood\\n return mint(shares);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function withdraw(\\n uint256 assets,\\n address, /* receiver */\\n address /* owner */\\n ) public virtual override returns (uint256 shares) {\\n // nonReentrant under the hood\\n return withdraw(assets);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function redeem(\\n uint256 shares,\\n address, /* receiver */\\n address /* owner */\\n ) public virtual override returns (uint256 assets) {\\n // nonReentrant under the hood\\n return redeem(shares);\\n }\\n}\\n\",\"keccak256\":\"0x8c3eaf2ed84e1ebff549cf33feb30788baec1f352a0a98a723621094535cf89e\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/IVersionable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\n/** \\n * Allow properly identify different versions of the same contract \\n * and track upgrades results \\n * */\\ninterface IVersionable {\\n /// @notice Returns the current version of this contract\\n /// @return a version in semantic versioning format\\n function version() external pure returns (string memory);\\n}\\n\",\"keccak256\":\"0x13e08376fa8013858c0031556eaae03e4c8d517597cb5f0524040ef36a7c9006\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/SafeInitializable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IVersionable} from \\\"./IVersionable.sol\\\";\\n\\n/** Implement best practices for initializable contracts */\\nabstract contract SafeInitializable is IVersionable, Initializable {\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /**\\n * This constructor prevents UUPS Uninitialized Proxies Vulnerability in all contracts which inherit from it.\\n * More info about vulnerability: https://medium.com/immunefi/wormhole-uninitialized-proxy-bugfix-review-90250c41a43a\\n * \\n * @dev Initial fix for this vulnerability was suggested as using `_disableInitializers()` function in constructor,\\n * but later, in version 4.3.2, OpenZeppelin implemented `onlyProxy` modifier for UUPS upgradable contracts,\\n * which fixed this vulnerability. Still, `_disableInitializers()` is a best practice which prevents unintended access \\n * to implementation contracts that can be used maliciously.\\n * \\n * More info: https://forum.openzeppelin.com/t/how-to-test-upgradeability-for-proxies/33436/7 \\n * and https://forum.openzeppelin.com/t/uupsupgradeable-vulnerability-post-mortem/15680\\n * \\n * To prevent code duplication of constructor, this contract can be used. On the other hand, \\n * it can be used as a marker for contracts that are safe from this vulnerability.\\n * Additionally, `needDisableInitializers` parameter can be used to enable initializers in mocks and unit tests.\\n *\\n * @param needDisableInitializers - if true, initializers will be disabled\\n */\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(bool needDisableInitializers) {\\n if(needDisableInitializers) {\\n _disableInitializers();\\n }\\n }\\n}\",\"keccak256\":\"0xece22d8416967bebd1c1008f135e19224ed4afe81e30204fbf3b2d97c73db8b6\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/SafeUUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {UUPSUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {SafeInitializable} from \\\"./SafeInitializable.sol\\\";\\n\\n/** \\n * Implement basic safety mechanism for UUPS proxy\\n * based on owner authorization for upgrades\\n * */\\nabstract contract SafeUUPSUpgradeable is UUPSUpgradeable, SafeInitializable, OwnableUpgradeable {\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /** Init all required constructors, including ownable */\\n function __SafeUUPSUpgradeable_init() internal onlyInitializing {\\n __SafeUUPSUpgradeable_init_direct();\\n\\n __Ownable_init();\\n }\\n\\n /** Init only direct constructors, UUPS only */\\n function __SafeUUPSUpgradeable_init_direct() internal onlyInitializing {\\n __UUPSUpgradeable_init();\\n }\\n\\n /** Authorise that upgrades can do only owner */\\n function _authorizeUpgrade(address newImplementation) internal onlyOwner override {} // solhint-disable-line no-empty-blocks\\n}\\n\",\"keccak256\":\"0xaf322f5c5eeb718b7834b2eac8bfee7ce8062383840acc1d28b27351a759304e\",\"license\":\"AGPL-3.0\"}},\"version\":1}", - "bytecode": "0x60a0604052306080523480156200001557600080fd5b506040516200595e3803806200595e833981016040819052620000389162000113565b8080156200004a576200004a62000052565b50506200013e565b600054610100900460ff1615620000bf5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161462000111576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200012657600080fd5b815180151581146200013757600080fd5b9392505050565b6080516157e8620001766000396000818161130e01528181611357015281816114f60152818161153601526115c901526157e86000f3fe60806040526004361061049f5760003560e01c80638dfa4f0711610260578063c9faa7c511610144578063ec38a862116100c1578063fad8b32a11610085578063fad8b32a14610e9c578063fc673c4f14610ebc578063fc7b9c1814610edc578063fd967f4714610ef3578063fe56e23214610f09578063fe9d930314610f2957600080fd5b8063ec38a86214610db9578063ef8b30f714610dd9578063f2fde38b14610df9578063f5a3bfad14610e19578063f76e4caa14610e7c57600080fd5b8063d905777e11610108578063d905777e14610cf3578063d95b637114610d13578063db006a7514610d33578063dd62ed3e14610d53578063dd723c1b14610d9957600080fd5b8063c9faa7c514610c4d578063ce348c6f14610c86578063ce96cb7714610c9c578063cea55f5714610cbc578063cfbde32614610cd357600080fd5b8063b3d7f6b9116101dd578063c17047ed116101a1578063c17047ed14610b8d578063c3535b5214610bc7578063c63d75b6146107a8578063c6e6f59214610bed578063c822adda14610c0d578063c9411e2214610c2d57600080fd5b8063b3d7f6b914610aed578063b460af9414610b0d578063b6b55f2514610b2d578063ba08765214610b4d578063bb994d4814610b6d57600080fd5b80639bd9bbc6116102245780639bd9bbc614610a555780639ec5a89414610a75578063a0712d6814610a96578063a6f7f5d614610ab6578063a9059cbb14610acd57600080fd5b80638dfa4f07146109c957806394bf804d146109e0578063959b8c3f14610a0057806395d89b4114610a2057806399089a4e14610a3557600080fd5b806339d97c53116103875780635c975abb11610304578063759076e5116102c8578063759076e5146105aa57806380d5785514610930578063861d68d91461096a578063861fe6cb1461098a578063884719f2146109305780638da5cb5b146109aa57600080fd5b80635c975abb1461089057806362ad1b83146108a55780636e553f65146108c557806370a08231146108e5578063715018a61461091b57600080fd5b80634f1ef2861161034b5780634f1ef2861461080f57806352d1902d1461082257806354fd4d5014610837578063556f0dc71461086557806357db845a1461087957600080fd5b806339d97c53146107735780633c93b9f214610793578063402d267d146107a85780634a8c1fb4146107ca5780634cdad506146107ef57600080fd5b806314c64402116104205780632e1a7d4d116103e45780632e1a7d4d1461067a5780632ff7709e1461069a578063313ce567146106c45780633306bc5b146106e05780633659cfe61461071a57806338d52e0f1461073a57600080fd5b806314c64402146105e757806318160ddd14610609578063207b27df1461061e57806323b872dd1461063e578063267c14081461065e57600080fd5b806307cc692f1161046757806307cc692f14610545578063095ea7b31461055a5780630a28a4771461058a5780630baabd7a146105aa57806312531729146105d057600080fd5b806301e1d114146104a457806306e48538146104cc57806306f94a0d146104ee57806306fdde031461050357806307a2d13a14610525575b600080fd5b3480156104b057600080fd5b506104b9610f49565b6040519081526020015b60405180910390f35b3480156104d857600080fd5b506104e1610f6a565b6040516104c39190614bd0565b3480156104fa57600080fd5b506104b9610fcc565b34801561050f57600080fd5b50610518610fd7565b6040516104c39190614c6d565b34801561053157600080fd5b506104b9610540366004614c80565b611060565b34801561055157600080fd5b506104b9611097565b34801561056657600080fd5b5061057a610575366004614cae565b6110a2565b60405190151581526020016104c3565b34801561059657600080fd5b506104b96105a5366004614c80565b6110bc565b3480156105b657600080fd5b5033600090815261016260205260409020600201546104b9565b3480156105dc57600080fd5b506104b96102935481565b3480156105f357600080fd5b50610607610602366004614ce8565b6110ed565b005b34801561061557600080fd5b5060ca546104b9565b34801561062a57600080fd5b506104b9610639366004614d05565b61110d565b34801561064a57600080fd5b5061057a610659366004614d22565b611168565b34801561066a57600080fd5b506104b9670de0b6b3a764000081565b34801561068657600080fd5b506104b9610695366004614c80565b6111ae565b3480156106a657600080fd5b506106af6111df565b604080519283526020830191909152016104c3565b3480156106d057600080fd5b50604051601281526020016104c3565b3480156106ec57600080fd5b506104b96106fb366004614d05565b6001600160a01b03166000908152610162602052604090206001015490565b34801561072657600080fd5b50610607610735366004614d05565b611304565b34801561074657600080fd5b506101f95461075b906001600160a01b031681565b6040516001600160a01b0390911681526020016104c3565b34801561077f57600080fd5b5061060761078e366004614d63565b6113e9565b34801561079f57600080fd5b506104b96114c9565b3480156107b457600080fd5b506104b96107c3366004614d05565b5060001990565b3480156107d657600080fd5b503360009081526101626020526040902054151561057a565b3480156107fb57600080fd5b506104b961080a366004614c80565b6114e1565b61060761081d366004614e4a565b6114ec565b34801561082e57600080fd5b506104b96115bc565b34801561084357600080fd5b506040805180820190915260058152640302e322e360dc1b6020820152610518565b34801561087157600080fd5b5060016104b9565b34801561088557600080fd5b506104b96101615481565b34801561089c57600080fd5b5061057a61166f565b3480156108b157600080fd5b506106076108c0366004614e9a565b611679565b3480156108d157600080fd5b506104b96108e0366004614f2d565b6116b5565b3480156108f157600080fd5b506104b9610900366004614d05565b6001600160a01b0316600090815260c9602052604090205490565b34801561092757600080fd5b506106076116c0565b34801561093c57600080fd5b506104b961094b366004614d05565b6001600160a01b03166000908152610162602052604090206002015490565b34801561097657600080fd5b50610607610985366004614f5d565b6116d4565b34801561099657600080fd5b506106076109a5366004615009565b611762565b3480156109b657600080fd5b50610195546001600160a01b031661075b565b3480156109d557600080fd5b506104b96102945481565b3480156109ec57600080fd5b506104b96109fb366004614f2d565b6119cf565b348015610a0c57600080fd5b50610607610a1b366004614d05565b6119da565b348015610a2c57600080fd5b50610518611af7565b348015610a4157600080fd5b50610607610a503660046150ca565b611b06565b348015610a6157600080fd5b50610607610a703660046150ff565b611b2f565b348015610a8157600080fd5b506102915461075b906001600160a01b031681565b348015610aa257600080fd5b506104b9610ab1366004614c80565b611b52565b348015610ac257600080fd5b506104b96102925481565b348015610ad957600080fd5b5061057a610ae8366004614cae565b611b72565b348015610af957600080fd5b506104b9610b08366004614c80565b611baa565b348015610b1957600080fd5b506104b9610b28366004615158565b611bda565b348015610b3957600080fd5b506104b9610b48366004614c80565b611be5565b348015610b5957600080fd5b506104b9610b68366004615158565b611bf8565b348015610b7957600080fd5b50610607610b88366004614d05565b611c03565b348015610b9957600080fd5b506104b9610ba8366004614d05565b6001600160a01b03166000908152610162602052604090206003015490565b348015610bd357600080fd5b5033600090815261016260205260409020600101546104b9565b348015610bf957600080fd5b506104b9610c08366004614c80565b611ca4565b348015610c1957600080fd5b5061075b610c28366004614c80565b611cd5565b348015610c3957600080fd5b50610607610c48366004614cae565b611d00565b348015610c5957600080fd5b5061057a610c68366004614d05565b6001600160a01b031660009081526101626020526040902054151590565b348015610c9257600080fd5b5061025e546104b9565b348015610ca857600080fd5b506104b9610cb7366004614d05565b611d9d565b348015610cc857600080fd5b506104b96101605481565b348015610cdf57600080fd5b50610607610cee366004614c80565b611dbf565b348015610cff57600080fd5b506104b9610d0e366004614d05565b611e2f565b348015610d1f57600080fd5b5061057a610d2e36600461519a565b611e4d565b348015610d3f57600080fd5b506104b9610d4e366004614c80565b611eee565b348015610d5f57600080fd5b506104b9610d6e36600461519a565b6001600160a01b03918216600090815260d16020908152604080832093909416825291909152205490565b348015610da557600080fd5b50610607610db4366004614d63565b611f5f565b348015610dc557600080fd5b50610607610dd4366004614d05565b61203b565b348015610de557600080fd5b506104b9610df4366004614c80565b612066565b348015610e0557600080fd5b50610607610e14366004614d05565b612071565b348015610e2557600080fd5b50610e5c610e34366004614d05565b6101626020526000908152604090208054600182015460028301546003909301549192909184565b6040805194855260208501939093529183015260608201526080016104c3565b348015610e8857600080fd5b50610607610e97366004614d05565b6120e7565b348015610ea857600080fd5b50610607610eb7366004614d05565b6121bc565b348015610ec857600080fd5b50610607610ed73660046151c8565b6122d7565b348015610ee857600080fd5b506104b961015f5481565b348015610eff57600080fd5b506104b961271081565b348015610f1557600080fd5b50610607610f24366004614c80565b61230f565b348015610f3557600080fd5b50610607610f44366004615248565b612340565b6000610f5361235b565b610f5b6114c9565b610f65919061528f565b905090565b606060cd805480602002602001604051908101604052809291908181526020018280548015610fc257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610fa4575b5050505050905090565b6000610f65336123d0565b606060cb8054610fe6906152a2565b80601f0160208091040260200160405190810160405280929190818152602001828054611012906152a2565b8015610fc25780601f1061103457610100808354040283529160200191610fc2565b820191906000526020600020905b81548152906001019060200180831161104257509395945050505050565b60008061106c60ca5490565b90508060000361107d575090919050565b611090611088610f49565b849083612467565b9392505050565b6000610f6533612486565b6000336110b0818585612574565b60019150505b92915050565b6000806110c860ca5490565b9050806000036110d9575090919050565b611090816110e5610f49565b85919061269b565b6110f56126c9565b8061110557611102612724565b50565b611102612776565b6000806111186114c9565b6001600160a01b03841660009081526101626020526040812060020154919250829003611149575060009392505050565b81611156612710836152dc565b61116091906152f3565b949350505050565b6000336111768582856127b3565b6111a38585856040518060200160405280600081525060405180602001604052806000815250600061283f565b506001949350505050565b60006111b861293b565b6111c1826110bc565b90506111cf82823333612996565b6111da600161012d55565b919050565b60008060008061015f546000036111fc5750600093849350915050565b60005b61025e548110156112e757600061025e828154811061122057611220615315565b60009182526020822001546001600160a01b0316915061123f8261110d565b905061124b818661532b565b9450612710826001600160a01b0316632ff7709e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561128e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b2919061533e565b6112bc90836152dc565b6112c691906152f3565b6112d0908561532b565b9350505080806112df90615357565b9150506111ff565b50816000036112fc5750600093849350915050565b939092509050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036113555760405162461bcd60e51b815260040161134c90615370565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661139e60008051602061576c833981519152546001600160a01b031690565b6001600160a01b0316146113c45760405162461bcd60e51b815260040161134c906153bc565b6113cd81612a50565b6040805160008082526020820190925261110291839190612a58565b3360009081526101626020526040812054900361141957604051630160ef0b60e51b815260040160405180910390fd5b61142161293b565b8061142b33612bc3565b10156114795760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f7567682061737365747320666f72207061796d656e74000000604482015260640161134c565b8115611489576114893383612c33565b6114963382600085612d93565b61149f82612f14565b6114aa600161012d55565b5050426101618190553360009081526101626020526040902060010155565b600061015f546114d7612f40565b610f65919061532b565b60006110b682611060565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115345760405162461bcd60e51b815260040161134c90615370565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661157d60008051602061576c833981519152546001600160a01b031690565b6001600160a01b0316146115a35760405162461bcd60e51b815260040161134c906153bc565b6115ac82612a50565b6115b882826001612a58565b5050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461165c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161134c565b5060008051602061576c83398151915290565b6000610f65612fae565b6116833386611e4d565b61169f5760405162461bcd60e51b815260040161134c90615408565b6116ae8585858585600161283f565b5050505050565b600061109083611be5565b6116c86126c9565b6116d26000612fb8565b565b6116dc6126c9565b60006116ea61025e8461300b565b90508061170a57604051632df15a4160e11b815260040160405180910390fd5b816117185761171883613140565b826001600160a01b03167fb6a4d3fee462ca7c56e3e87f5942581b478433cf0003d49e1750c1ad1539ee3083604051611755911515815260200190565b60405180910390a2505050565b600054610100900460ff16158080156117825750600054600160ff909116105b8061179c5750303b15801561179c575060005460ff166001145b6117ff5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161134c565b6000805460ff191660011790558015611822576000805461ff0019166101001790555b61182a6131aa565b6118326131e1565b61196488855160001461184557856118cb565b896001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015611883573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ab9190810190615454565b6040516020016118bb91906154cb565b6040516020818303038152906040525b8551156118d8578561195e565b8a6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015611916573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261193e9190810190615454565b60405160200161194e9190615503565b6040516020818303038152906040525b8561327b565b61196d8761203b565b6119768661230f565b61197f85611dbf565b80156119c5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600061109083611b52565b6001600160a01b0381163303611a3e5760405162461bcd60e51b8152602060048201526024808201527f4552433737373a20617574686f72697a696e672073656c66206173206f70657260448201526330ba37b960e11b606482015260840161134c565b6001600160a01b038116600090815260ce602052604090205460ff1615611a8f5733600090815260d0602090815260408083206001600160a01b03851684529091529020805460ff19169055611abe565b33600090815260cf602090815260408083206001600160a01b03851684529091529020805460ff191660011790555b60405133906001600160a01b038316907ff4caeb2d6ca8932a215a353d0703c326ec2d81fc68170f320eb2ab49e9df61f990600090a350565b606060cc8054610fe6906152a2565b611b0e6126c9565b611b1a61025e826132ae565b80516115b89161025e91602090910190614b56565b611b4d3384848460405180602001604052806000815250600161283f565b505050565b6000611b5c61293b565b611b6582611baa565b90506111cf8183336133a0565b6000611ba13384846040518060200160405280600081525060405180602001604052806000815250600061283f565b50600192915050565b600080611bb660ca5490565b905080600003611bc7575090919050565b611090611bd2610f49565b84908361269b565b6000611160846111ae565b6000611bef61342e565b6110b682613476565b600061116084611eee565b80611c17610195546001600160a01b031690565b6001600160a01b0316336001600160a01b031614158015611c415750336001600160a01b03821614155b15611c6157604051630869704160e41b815233600482015260240161134c565b611c6c8260006134e6565b6040516001600160a01b038316907f4201c688d84c01154d321afa0c72f1bffe9eef53005c9de9d035074e71e9b32a90600090a25050565b600080611cb060ca5490565b905080600003611cc1575090919050565b61109081611ccd610f49565b859190612467565b61025e8181548110611ce657600080fd5b6000918252602090912001546001600160a01b0316905081565b611d086126c9565b611d1061342e565b6001600160a01b038216611d375760405163f5bf603960e01b815260040160405180910390fd5b611d40826135ce565b611d4a82826136df565b611d5661025e836137af565b816001600160a01b03167f2f564a83158ad1831793ad3e69257b52f39ece5d49cb0d8746708ecb9ef964da82604051611d9191815260200190565b60405180910390a25050565b6001600160a01b038116600090815260c960205260408120546110b690611060565b611dc76126c9565b670de0b6b3a7640000811115611df357604051639058c3f760e01b81526004810182905260240161134c565b6102948190556040518181527f6619a135102d0d043ca15a77ad3878b0c97fb8ead5829208b0f79c00711fa7c79060200160405180910390a150565b6001600160a01b038116600090815260c960205260408120546110b6565b6000816001600160a01b0316836001600160a01b03161480611eb857506001600160a01b038316600090815260ce602052604090205460ff168015611eb857506001600160a01b03808316600090815260d0602090815260408083209387168352929052205460ff16155b806110905750506001600160a01b03908116600090815260cf602090815260408083209490931682529290925290205460ff1690565b6000611ef861293b565b611f01826114e1565b905080600003611f535760405162461bcd60e51b815260206004820181905260248201527f476976656e2073686172657320726573756c7420696e2030206173736574732e604482015260640161134c565b6111cf81833333612996565b33600090815261016260205260408120549003611f8f57604051630160ef0b60e51b815260040160405180910390fd5b611f9761293b565b611fa1818361532b565b611faa33612bc3565b1015611fc95760405163112093df60e31b815260040160405180910390fd5b60008083118015611fec5750336000908152610162602052604090206001015442115b80156120075750336000908152610162602052604090205442115b1561201857612015836137e3565b90505b6120253383856000612d93565b61202f838261384b565b506114aa600161012d55565b6120436126c9565b61029180546001600160a01b0319166001600160a01b0392909216919091179055565b60006110b682611ca4565b6120796126c9565b6001600160a01b0381166120de5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161134c565b61110281612fb8565b6120ef6126c9565b6001600160a01b0381166121165760405163f5bf603960e01b815260040160405180910390fd5b61212261025e82613869565b156121405760405163c45546f760e01b815260040160405180910390fd5b6001600160a01b038116600090815261016260205260408120549003612179576040516332ffc55b60e11b815260040160405180910390fd5b61218561025e826137af565b6040516001600160a01b038216907f0bd7504c563a4658373bef3dbb51f91f63b8c6d5ba60806c678e75df33b4569890600090a250565b336001600160a01b0382160361221e5760405162461bcd60e51b815260206004820152602160248201527f4552433737373a207265766f6b696e672073656c66206173206f70657261746f6044820152603960f91b606482015260840161134c565b6001600160a01b038116600090815260ce602052604090205460ff16156122725733600090815260d0602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561229e565b33600090815260cf602090815260408083206001600160a01b03851684529091529020805460ff191690555b60405133906001600160a01b038316907f50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa190600090a350565b6122e13385611e4d565b6122fd5760405162461bcd60e51b815260040161134c90615408565b612309848484846138d2565b50505050565b6123176126c9565b61271081111561233a57604051630bc4369360e21b815260040160405180910390fd5b61029255565b6115b8338383604051806020016040528060008152506138d2565b600080610294546101615442612371919061528f565b61237b91906152dc565b9050670de0b6b3a7640000811061239457600091505090565b6000670de0b6b3a764000061029354836123ae91906152dc565b6123b891906152f3565b905080610293546123c9919061528f565b9250505090565b6001600160a01b038116600090815261016260205260408120600201546123f561166f565b80612401575061016054155b1561240c5792915050565b60006127106124196114c9565b6001600160a01b0386166000908152610162602052604090206003015461244091906152dc565b61244a91906152f3565b905080821161245d575060009392505050565b611160818361528f565b82820281151584158583048514171661247f57600080fd5b0492915050565b600061249061166f565b1561249d57506000919050565b60006124a7613a87565b61015f5490915060006127106124bb6114c9565b6001600160a01b038716600090815261016260205260409020600301546124e291906152dc565b6124ec91906152f3565b6001600160a01b03861660009081526101626020526040902060020154909150828411158061251b5750808211155b1561252c5750600095945050505050565b6000612538848661528f565b90506000612546838561528f565b905060006125548383613aac565b905061256781612562612f40565b613aac565b9998505050505050505050565b6001600160a01b0383166125d85760405162461bcd60e51b815260206004820152602560248201527f4552433737373a20617070726f76652066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161134c565b6001600160a01b03821661263a5760405162461bcd60e51b815260206004820152602360248201527f4552433737373a20617070726f766520746f20746865207a65726f206164647260448201526265737360e81b606482015260840161134c565b6001600160a01b03838116600081815260d1602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b8282028115158415858304851417166126b357600080fd5b6001826001830304018115150290509392505050565b610195546001600160a01b031633146116d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161134c565b61272c613ac2565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61277e61342e565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586127593390565b6001600160a01b03838116600090815260d16020908152604080832093861683529290522054600019811461230957818110156128325760405162461bcd60e51b815260206004820152601e60248201527f4552433737373a20696e73756666696369656e7420616c6c6f77616e63650000604482015260640161134c565b6123098484848403612574565b6001600160a01b0386166128a45760405162461bcd60e51b815260206004820152602660248201527f4552433737373a207472616e736665722066726f6d20746865207a65726f206160448201526564647265737360d01b606482015260840161134c565b6001600160a01b0385166129065760405162461bcd60e51b8152602060048201526024808201527f4552433737373a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161134c565b33612915818888888888613b0d565b612923818888888888613c34565b61293281888888888888613d9a565b50505050505050565b600261012d540361298e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161134c565b600261012d55565b336001600160a01b038216146129b1576129b18133856127b3565b6129bb8484613f55565b6129e5818460405180602001604052806000815250604051806020016040528060008152506138d2565b60408051858152602081018590526001600160a01b03808416929085169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46101f954612309906001600160a01b031683866140c5565b600161012d55565b6111026126c9565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612a8b57611b4d83614128565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612ae5575060408051601f3d908101601f19168201909252612ae29181019061533e565b60015b612b485760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161134c565b60008051602061576c8339815191528114612bb75760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161134c565b50611b4d8383836141c4565b6101f9546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa158015612c0f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b6919061533e565b6001600160a01b0382166000908152610162602052604090206002015481811015612ca05760405162461bcd60e51b815260206004820152601d60248201527f4c6f73732069732067726561746572207468616e207468652064656274000000604482015260640161134c565b6101605415612d43576000612ced61015f548461016054612cc191906152dc565b612ccb91906152f3565b6001600160a01b03861660009081526101626020526040902060030154613aac565b90508015612d41576001600160a01b0384166000908152610162602052604081206003018054839290612d2190849061528f565b92505081905550806101606000828254612d3b919061528f565b90915550505b505b6001600160a01b0383166000908152610162602052604081206002018054849290612d6f90849061528f565b925050819055508161015f6000828254612d89919061528f565b9091555050505050565b6000612d9e85612486565b90506000612dab336123d0565b9050612db78582613aac565b94508415612e0b576001600160a01b0386166000908152610162602052604081206002018054879290612deb90849061528f565b925050819055508461015f6000828254612e05919061528f565b90915550505b8115612e5d576001600160a01b0386166000908152610162602052604081206002018054849290612e3d90849061532b565b925050819055508161015f6000828254612e57919061532b565b90915550505b6000612e69868661532b565b905060008084831015612e9157612e80838661528f565b9150612e8c89836141e9565b612eaf565b84831115612eaf57612ea3858461528f565b9050612eaf8982614201565b604080518981526020810189905290810183905260608101829052608081018790526001600160a01b038a16907f92a0cdbae2e10dc214d482504ecbf0461593fd2fbfbedad5a195f5ebb7dcee739060a00160405180910390a2505050505050505050565b6000612f1e61235b565b9050818111612f2e576000612f38565b612f38828261528f565b610293555050565b6101f9546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612f8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f65919061533e565b6000610f6561421a565b61019580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008060005b845481101561310057836001600160a01b031685828154811061303657613036615315565b6000918252602090912001546001600160a01b03160361305557600191505b81801561306e5750845461306b9060019061528f565b81105b156130ee578461307f82600161532b565b8154811061308f5761308f615315565b9060005260206000200160009054906101000a90046001600160a01b03168582815481106130bf576130bf615315565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b806130f881615357565b915050613011565b50801561109057838054806131175761311761552e565b600082815260209020810160001990810180546001600160a01b03191690550190559392505050565b6001600160a01b038116600090815261016260205260409020600301541561317b5760405163c69bfc5f60e01b815260040160405180910390fd5b6001600160a01b0316600090815261016260205260408120818155600181018290556002810182905560030155565b600054610100900460ff166131d15760405162461bcd60e51b815260040161134c90615544565b6131d9614228565b6116d2614257565b600054610100900460ff166132085760405162461bcd60e51b815260040161134c90615544565b600061321d610195546001600160a01b031690565b6001600160a01b0316036132735760405162461bcd60e51b815260206004820181905260248201527f537472617465676965734c656e646572206d757374206265206f776e61626c65604482015260640161134c565b6116d2614286565b600054610100900460ff166132a25760405162461bcd60e51b815260040161134c90615544565b612309848484846142c5565b815481516060919081146132d5576040516336c2ff5d60e01b815260040160405180910390fd5b60005b818110156133975760008582815481106132f4576132f4615315565b60009182526020822001546001600160a01b031691505b838110156133825785818151811061332557613325615315565b60200260200101516001600160a01b0316826001600160a01b031603156133825761335160018561528f565b8103613370576040516336c2ff5d60e01b815260040160405180910390fd5b8061337a81615357565b91505061330b565b5050808061338f90615357565b9150506132d8565b50919392505050565b6101f9546133b9906001600160a01b0316333086614308565b6133e381836040518060200160405280600081525060405180602001604052806000815250614340565b60408051848152602081018490526001600160a01b0383169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3505050565b61343661166f565b156116d25760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161134c565b600061348061293b565b61348982612066565b9050806000036134db5760405162461bcd60e51b815260206004820181905260248201527f476976656e2061737365747320726573756c7420696e2030207368617265732e604482015260640161134c565b6111cf8282336133a0565b6001600160a01b0382166000908152610162602052604090205461351d576040516332ffc55b60e11b815260040160405180910390fd5b6001600160a01b0382166000908152610162602052604081206003015461016080549192909161354e90849061528f565b90915550506001600160a01b038216600090815261016260205260408120600301829055610160805483929061358590849061532b565b90915550506101605461271010156115b85780610160546135a6919061528f565b6135b29061271061528f565b604051639eb4cd0560e01b815260040161134c91815260200190565b806001600160a01b031663bcead63e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561360c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613630919061558f565b6001600160a01b0316306001600160a01b03161415806136c15750806001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136ad919061558f565b6101f9546001600160a01b03908116911614155b1561110257604051631120dc3360e21b815260040160405180910390fd5b6001600160a01b0382166000908152610162602052604090205415613717576040516312635b0b60e21b815260040160405180910390fd5b6127108161016054613729919061532b565b111561373f57610160546135b29061271061528f565b604080516080810182524280825260208083019182526000838501818152606085018781526001600160a01b0389168352610162909352948120935184559151600184015592516002830155915160039091015561016080548392906137a690849061532b565b90915550505050565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b03909216919091179055565b60008061271061029254846137f891906152dc565b61380291906152f3565b905080156110b657610291546110b6906001600160a01b031661382483611ca4565b6040518060200160405280600081525060405180602001604052806000815250600061434a565b808261385561235b565b61385f919061532b565b612f38919061528f565b6000805b83548110156138c857826001600160a01b031684828154811061389257613892615315565b6000918252602090912001546001600160a01b0316036138b65760019150506110b6565b806138c081615357565b91505061386d565b5060009392505050565b6001600160a01b0384166139335760405162461bcd60e51b815260206004820152602260248201527f4552433737373a206275726e2066726f6d20746865207a65726f206164647265604482015261737360f01b606482015260840161134c565b3361394381866000878787613b0d565b6001600160a01b038516600090815260c96020526040902054848110156139b85760405162461bcd60e51b815260206004820152602360248201527f4552433737373a206275726e20616d6f756e7420657863656564732062616c616044820152626e636560e81b606482015260840161134c565b6001600160a01b038616600090815260c960205260408120868303905560ca80548792906139e790849061528f565b92505081905550856001600160a01b0316826001600160a01b03167fa78a9be3a7b862d26933ad85fb11d80ef66b8f972d7cbba06621d583943a4098878787604051613a35939291906155ac565b60405180910390a36040518581526000906001600160a01b038816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a3505050505050565b6000612710613a946114c9565b61016054613aa291906152dc565b610f6591906152f3565b6000818310613abb5781611090565b5090919050565b613aca61166f565b6116d25760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161134c565b60405163555ddc6560e11b81526001600160a01b03861660048201527f29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe8956024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015613b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bb2919061558f565b90506001600160a01b0381161561293257604051633ad5cbc160e11b81526001600160a01b038216906375ab978290613bf9908a908a908a908a908a908a906004016155d7565b600060405180830381600087803b158015613c1357600080fd5b505af1158015613c27573d6000803e3d6000fd5b5050505050505050505050565b6001600160a01b038516600090815260c9602052604090205483811015613cad5760405162461bcd60e51b815260206004820152602760248201527f4552433737373a207472616e7366657220616d6f756e7420657863656564732060448201526662616c616e636560c81b606482015260840161134c565b6001600160a01b03808716600090815260c96020526040808220878503905591871681529081208054869290613ce490849061532b565b92505081905550846001600160a01b0316866001600160a01b0316886001600160a01b03167f06b541ddaa720db2b10a4d0cdac39b8d360425fc073085fac19bc82614677987878787604051613d3c939291906155ac565b60405180910390a4846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051613d8991815260200190565b60405180910390a350505050505050565b60405163555ddc6560e11b81526001600160a01b03861660048201527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b6024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015613e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e3f919061558f565b90506001600160a01b03811615613ebb576040516223de2960e01b81526001600160a01b038216906223de2990613e84908b908b908b908b908b908b906004016155d7565b600060405180830381600087803b158015613e9e57600080fd5b505af1158015613eb2573d6000803e3d6000fd5b505050506119c5565b81156119c5576001600160a01b0386163b156119c55760405162461bcd60e51b815260206004820152604d60248201527f4552433737373a20746f6b656e20726563697069656e7420636f6e747261637460448201527f20686173206e6f20696d706c656d656e74657220666f7220455243373737546f60648201526c1ad95b9cd49958da5c1a595b9d609a1b608482015260a40161134c565b81613f5e612f40565b10613f67575050565b60005b61025e54811015614092576000613f7f612f40565b9050808411613f8e5750614092565b600061025e8381548110613fa457613fa4615315565b60009182526020822001546001600160a01b03169150613fe9613fc7848861528f565b6001600160a01b03841660009081526101626020526040902060020154613aac565b905080600003613ffb57505050614080565b604051632e1a7d4d60e01b8152600481018290526000906001600160a01b03841690632e1a7d4d906024016020604051808303816000875af1158015614045573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614069919061533e565b9050801561407b5761407b8382612c33565b505050505b8061408a81615357565b915050613f6a565b508161409c612f40565b10156115b85760405163bce5067160e01b8152600481018390526024810182905260440161134c565b6040516001600160a01b038316602482015260448101829052611b4d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614487565b6001600160a01b0381163b6141955760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161134c565b60008051602061576c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6141cd8361455c565b6000825111806141da5750805b15611b4d57612309838361459c565b6101f9546115b8906001600160a01b031683836140c5565b6101f9546115b8906001600160a01b0316833084614308565b6000610f6560fb5460ff1690565b600054610100900460ff1661424f5760405162461bcd60e51b815260040161134c90615544565b6116d26145c1565b600054610100900460ff1661427e5760405162461bcd60e51b815260040161134c90615544565b6116d26145e8565b600054610100900460ff166142ad5760405162461bcd60e51b815260040161134c90615544565b6142b5614618565b6142bd614647565b6116d2614676565b600054610100900460ff166142ec5760405162461bcd60e51b815260040161134c90615544565b6142f78383836146a4565b6142ff614647565b612309846146d6565b6040516001600160a01b03808516602483015283166044820152606481018290526123099085906323b872dd60e01b906084016140f1565b6123098484848460015b6001600160a01b0385166143a05760405162461bcd60e51b815260206004820181905260248201527f4552433737373a206d696e7420746f20746865207a65726f2061646472657373604482015260640161134c565b60003390508460ca60008282546143b7919061532b565b90915550506001600160a01b038616600090815260c96020526040812080548792906143e490849061532b565b909155506143fa90508160008888888888613d9a565b856001600160a01b0316816001600160a01b03167f2fe5be0146f74c5bce36c0b80911af6c7d86ff27e89d5cfa61fc681327954e5d878787604051614441939291906155ac565b60405180910390a36040518581526001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001613a77565b60006144dc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147209092919063ffffffff16565b90508051600014806144fd5750808060200190518101906144fd9190615624565b611b4d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161134c565b61456581614128565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060611090838360405180606001604052806027815260200161578c6027913961472f565b600054610100900460ff166116d25760405162461bcd60e51b815260040161134c90615544565b600054610100900460ff1661460f5760405162461bcd60e51b815260040161134c90615544565b6116d233612fb8565b600054610100900460ff1661463f5760405162461bcd60e51b815260040161134c90615544565b6116d26147a7565b600054610100900460ff1661466e5760405162461bcd60e51b815260040161134c90615544565b6116d26147da565b600054610100900460ff1661469d5760405162461bcd60e51b815260040161134c90615544565b4261016155565b600054610100900460ff166146cb5760405162461bcd60e51b815260040161134c90615544565b611b4d838383614801565b600054610100900460ff166146fd5760405162461bcd60e51b815260040161134c90615544565b6101f980546001600160a01b0319166001600160a01b0392909216919091179055565b606061116084846000856149dd565b6060600080856001600160a01b03168560405161474c9190615641565b600060405180830381855af49150503d8060008114614787576040519150601f19603f3d011682016040523d82523d6000602084013e61478c565b606091505b509150915061479d86838387614ab8565b9695505050505050565b600054610100900460ff166147ce5760405162461bcd60e51b815260040161134c90615544565b60fb805460ff19169055565b600054610100900460ff16612a485760405162461bcd60e51b815260040161134c90615544565b600054610100900460ff166148285760405162461bcd60e51b815260040161134c90615544565b60cb61483484826156ab565b5060cc61484183826156ab565b5080516148559060cd906020840190614b56565b5060005b81518110156148be57600160ce600084848151811061487a5761487a615315565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806148b681615357565b915050614859565b506040516329965a1d60e01b815230600482018190527fac7fbab5f54a3ca8194167523c6753bfeb96a445279294b6125b68cce217705460248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad24906329965a1d90606401600060405180830381600087803b15801561493857600080fd5b505af115801561494c573d6000803e3d6000fd5b50506040516329965a1d60e01b815230600482018190527faea199e31a596269b42cdafd93407f14436db6e4cad65417994c2eb37381e05a60248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad2492506329965a1d9150606401600060405180830381600087803b1580156149c957600080fd5b505af1158015612932573d6000803e3d6000fd5b606082471015614a3e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161134c565b600080866001600160a01b03168587604051614a5a9190615641565b60006040518083038185875af1925050503d8060008114614a97576040519150601f19603f3d011682016040523d82523d6000602084013e614a9c565b606091505b5091509150614aad87838387614ab8565b979650505050505050565b60608315614b27578251600003614b20576001600160a01b0385163b614b205760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161134c565b5081611160565b6111608383815115614b3c5781518083602001fd5b8060405162461bcd60e51b815260040161134c9190614c6d565b828054828255906000526020600020908101928215614bab579160200282015b82811115614bab57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614b76565b50614bb7929150614bbb565b5090565b5b80821115614bb75760008155600101614bbc565b6020808252825182820181905260009190848201906040850190845b81811015614c115783516001600160a01b031683529284019291840191600101614bec565b50909695505050505050565b60005b83811015614c38578181015183820152602001614c20565b50506000910152565b60008151808452614c59816020860160208601614c1d565b601f01601f19169290920160200192915050565b6020815260006110906020830184614c41565b600060208284031215614c9257600080fd5b5035919050565b6001600160a01b038116811461110257600080fd5b60008060408385031215614cc157600080fd5b8235614ccc81614c99565b946020939093013593505050565b801515811461110257600080fd5b600060208284031215614cfa57600080fd5b813561109081614cda565b600060208284031215614d1757600080fd5b813561109081614c99565b600080600060608486031215614d3757600080fd5b8335614d4281614c99565b92506020840135614d5281614c99565b929592945050506040919091013590565b60008060408385031215614d7657600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715614dc457614dc4614d85565b604052919050565b600067ffffffffffffffff821115614de657614de6614d85565b50601f01601f191660200190565b600082601f830112614e0557600080fd5b8135614e18614e1382614dcc565b614d9b565b818152846020838601011115614e2d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215614e5d57600080fd5b8235614e6881614c99565b9150602083013567ffffffffffffffff811115614e8457600080fd5b614e9085828601614df4565b9150509250929050565b600080600080600060a08688031215614eb257600080fd5b8535614ebd81614c99565b94506020860135614ecd81614c99565b935060408601359250606086013567ffffffffffffffff80821115614ef157600080fd5b614efd89838a01614df4565b93506080880135915080821115614f1357600080fd5b50614f2088828901614df4565b9150509295509295909350565b60008060408385031215614f4057600080fd5b823591506020830135614f5281614c99565b809150509250929050565b60008060408385031215614f7057600080fd5b8235614f7b81614c99565b91506020830135614f5281614cda565b600082601f830112614f9c57600080fd5b8135602067ffffffffffffffff821115614fb857614fb8614d85565b8160051b614fc7828201614d9b565b9283528481018201928281019087851115614fe157600080fd5b83870192505b84831015614aad578235614ffa81614c99565b82529183019190830190614fe7565b600080600080600080600060e0888a03121561502457600080fd5b873561502f81614c99565b9650602088013561503f81614c99565b95506040880135945060608801359350608088013567ffffffffffffffff8082111561506a57600080fd5b6150768b838c01614df4565b945060a08a013591508082111561508c57600080fd5b6150988b838c01614df4565b935060c08a01359150808211156150ae57600080fd5b506150bb8a828b01614f8b565b91505092959891949750929550565b6000602082840312156150dc57600080fd5b813567ffffffffffffffff8111156150f357600080fd5b61116084828501614f8b565b60008060006060848603121561511457600080fd5b833561511f81614c99565b925060208401359150604084013567ffffffffffffffff81111561514257600080fd5b61514e86828701614df4565b9150509250925092565b60008060006060848603121561516d57600080fd5b83359250602084013561517f81614c99565b9150604084013561518f81614c99565b809150509250925092565b600080604083850312156151ad57600080fd5b82356151b881614c99565b91506020830135614f5281614c99565b600080600080608085870312156151de57600080fd5b84356151e981614c99565b935060208501359250604085013567ffffffffffffffff8082111561520d57600080fd5b61521988838901614df4565b9350606087013591508082111561522f57600080fd5b5061523c87828801614df4565b91505092959194509250565b6000806040838503121561525b57600080fd5b82359150602083013567ffffffffffffffff811115614e8457600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156110b6576110b6615279565b600181811c908216806152b657607f821691505b6020821081036152d657634e487b7160e01b600052602260045260246000fd5b50919050565b80820281158282048414176110b6576110b6615279565b60008261531057634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b808201808211156110b6576110b6615279565b60006020828403121561535057600080fd5b5051919050565b60006001820161536957615369615279565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252602c908201527f4552433737373a2063616c6c6572206973206e6f7420616e206f70657261746f60408201526b39103337b9103437b63232b960a11b606082015260800190565b60006020828403121561546657600080fd5b815167ffffffffffffffff81111561547d57600080fd5b8201601f8101841361548e57600080fd5b805161549c614e1382614dcc565b8181528560208385010111156154b157600080fd5b6154c2826020830160208601614c1d565b95945050505050565b600082516154dd818460208701614c1d565b7320456f6e69616e205661756c742053686172657360601b920191825250601401919050565b6232b7b760e91b815260008251615521816003850160208701614c1d565b9190910160030192915050565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156155a157600080fd5b815161109081614c99565b8381526060602082015260006155c56060830185614c41565b828103604084015261479d8185614c41565b6001600160a01b0387811682528681166020830152851660408201526060810184905260c06080820181905260009061561290830185614c41565b82810360a08401526125678185614c41565b60006020828403121561563657600080fd5b815161109081614cda565b60008251615653818460208701614c1d565b9190910192915050565b601f821115611b4d57600081815260208120601f850160051c810160208610156156845750805b601f850160051c820191505b818110156156a357828155600101615690565b505050505050565b815167ffffffffffffffff8111156156c5576156c5614d85565b6156d9816156d384546152a2565b8461565d565b602080601f83116001811461570e57600084156156f65750858301515b600019600386901b1c1916600185901b1785556156a3565b600085815260208120601f198616915b8281101561573d5788860151825594840194600190910190840161571e565b508582101561575b5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220102ce681bd44537b67cb2adaa36ffb050a3471463e5df0b4b69d8ca11643d05a64736f6c63430008130033", - "deployedBytecode": "0x60806040526004361061049f5760003560e01c80638dfa4f0711610260578063c9faa7c511610144578063ec38a862116100c1578063fad8b32a11610085578063fad8b32a14610e9c578063fc673c4f14610ebc578063fc7b9c1814610edc578063fd967f4714610ef3578063fe56e23214610f09578063fe9d930314610f2957600080fd5b8063ec38a86214610db9578063ef8b30f714610dd9578063f2fde38b14610df9578063f5a3bfad14610e19578063f76e4caa14610e7c57600080fd5b8063d905777e11610108578063d905777e14610cf3578063d95b637114610d13578063db006a7514610d33578063dd62ed3e14610d53578063dd723c1b14610d9957600080fd5b8063c9faa7c514610c4d578063ce348c6f14610c86578063ce96cb7714610c9c578063cea55f5714610cbc578063cfbde32614610cd357600080fd5b8063b3d7f6b9116101dd578063c17047ed116101a1578063c17047ed14610b8d578063c3535b5214610bc7578063c63d75b6146107a8578063c6e6f59214610bed578063c822adda14610c0d578063c9411e2214610c2d57600080fd5b8063b3d7f6b914610aed578063b460af9414610b0d578063b6b55f2514610b2d578063ba08765214610b4d578063bb994d4814610b6d57600080fd5b80639bd9bbc6116102245780639bd9bbc614610a555780639ec5a89414610a75578063a0712d6814610a96578063a6f7f5d614610ab6578063a9059cbb14610acd57600080fd5b80638dfa4f07146109c957806394bf804d146109e0578063959b8c3f14610a0057806395d89b4114610a2057806399089a4e14610a3557600080fd5b806339d97c53116103875780635c975abb11610304578063759076e5116102c8578063759076e5146105aa57806380d5785514610930578063861d68d91461096a578063861fe6cb1461098a578063884719f2146109305780638da5cb5b146109aa57600080fd5b80635c975abb1461089057806362ad1b83146108a55780636e553f65146108c557806370a08231146108e5578063715018a61461091b57600080fd5b80634f1ef2861161034b5780634f1ef2861461080f57806352d1902d1461082257806354fd4d5014610837578063556f0dc71461086557806357db845a1461087957600080fd5b806339d97c53146107735780633c93b9f214610793578063402d267d146107a85780634a8c1fb4146107ca5780634cdad506146107ef57600080fd5b806314c64402116104205780632e1a7d4d116103e45780632e1a7d4d1461067a5780632ff7709e1461069a578063313ce567146106c45780633306bc5b146106e05780633659cfe61461071a57806338d52e0f1461073a57600080fd5b806314c64402146105e757806318160ddd14610609578063207b27df1461061e57806323b872dd1461063e578063267c14081461065e57600080fd5b806307cc692f1161046757806307cc692f14610545578063095ea7b31461055a5780630a28a4771461058a5780630baabd7a146105aa57806312531729146105d057600080fd5b806301e1d114146104a457806306e48538146104cc57806306f94a0d146104ee57806306fdde031461050357806307a2d13a14610525575b600080fd5b3480156104b057600080fd5b506104b9610f49565b6040519081526020015b60405180910390f35b3480156104d857600080fd5b506104e1610f6a565b6040516104c39190614bd0565b3480156104fa57600080fd5b506104b9610fcc565b34801561050f57600080fd5b50610518610fd7565b6040516104c39190614c6d565b34801561053157600080fd5b506104b9610540366004614c80565b611060565b34801561055157600080fd5b506104b9611097565b34801561056657600080fd5b5061057a610575366004614cae565b6110a2565b60405190151581526020016104c3565b34801561059657600080fd5b506104b96105a5366004614c80565b6110bc565b3480156105b657600080fd5b5033600090815261016260205260409020600201546104b9565b3480156105dc57600080fd5b506104b96102935481565b3480156105f357600080fd5b50610607610602366004614ce8565b6110ed565b005b34801561061557600080fd5b5060ca546104b9565b34801561062a57600080fd5b506104b9610639366004614d05565b61110d565b34801561064a57600080fd5b5061057a610659366004614d22565b611168565b34801561066a57600080fd5b506104b9670de0b6b3a764000081565b34801561068657600080fd5b506104b9610695366004614c80565b6111ae565b3480156106a657600080fd5b506106af6111df565b604080519283526020830191909152016104c3565b3480156106d057600080fd5b50604051601281526020016104c3565b3480156106ec57600080fd5b506104b96106fb366004614d05565b6001600160a01b03166000908152610162602052604090206001015490565b34801561072657600080fd5b50610607610735366004614d05565b611304565b34801561074657600080fd5b506101f95461075b906001600160a01b031681565b6040516001600160a01b0390911681526020016104c3565b34801561077f57600080fd5b5061060761078e366004614d63565b6113e9565b34801561079f57600080fd5b506104b96114c9565b3480156107b457600080fd5b506104b96107c3366004614d05565b5060001990565b3480156107d657600080fd5b503360009081526101626020526040902054151561057a565b3480156107fb57600080fd5b506104b961080a366004614c80565b6114e1565b61060761081d366004614e4a565b6114ec565b34801561082e57600080fd5b506104b96115bc565b34801561084357600080fd5b506040805180820190915260058152640302e322e360dc1b6020820152610518565b34801561087157600080fd5b5060016104b9565b34801561088557600080fd5b506104b96101615481565b34801561089c57600080fd5b5061057a61166f565b3480156108b157600080fd5b506106076108c0366004614e9a565b611679565b3480156108d157600080fd5b506104b96108e0366004614f2d565b6116b5565b3480156108f157600080fd5b506104b9610900366004614d05565b6001600160a01b0316600090815260c9602052604090205490565b34801561092757600080fd5b506106076116c0565b34801561093c57600080fd5b506104b961094b366004614d05565b6001600160a01b03166000908152610162602052604090206002015490565b34801561097657600080fd5b50610607610985366004614f5d565b6116d4565b34801561099657600080fd5b506106076109a5366004615009565b611762565b3480156109b657600080fd5b50610195546001600160a01b031661075b565b3480156109d557600080fd5b506104b96102945481565b3480156109ec57600080fd5b506104b96109fb366004614f2d565b6119cf565b348015610a0c57600080fd5b50610607610a1b366004614d05565b6119da565b348015610a2c57600080fd5b50610518611af7565b348015610a4157600080fd5b50610607610a503660046150ca565b611b06565b348015610a6157600080fd5b50610607610a703660046150ff565b611b2f565b348015610a8157600080fd5b506102915461075b906001600160a01b031681565b348015610aa257600080fd5b506104b9610ab1366004614c80565b611b52565b348015610ac257600080fd5b506104b96102925481565b348015610ad957600080fd5b5061057a610ae8366004614cae565b611b72565b348015610af957600080fd5b506104b9610b08366004614c80565b611baa565b348015610b1957600080fd5b506104b9610b28366004615158565b611bda565b348015610b3957600080fd5b506104b9610b48366004614c80565b611be5565b348015610b5957600080fd5b506104b9610b68366004615158565b611bf8565b348015610b7957600080fd5b50610607610b88366004614d05565b611c03565b348015610b9957600080fd5b506104b9610ba8366004614d05565b6001600160a01b03166000908152610162602052604090206003015490565b348015610bd357600080fd5b5033600090815261016260205260409020600101546104b9565b348015610bf957600080fd5b506104b9610c08366004614c80565b611ca4565b348015610c1957600080fd5b5061075b610c28366004614c80565b611cd5565b348015610c3957600080fd5b50610607610c48366004614cae565b611d00565b348015610c5957600080fd5b5061057a610c68366004614d05565b6001600160a01b031660009081526101626020526040902054151590565b348015610c9257600080fd5b5061025e546104b9565b348015610ca857600080fd5b506104b9610cb7366004614d05565b611d9d565b348015610cc857600080fd5b506104b96101605481565b348015610cdf57600080fd5b50610607610cee366004614c80565b611dbf565b348015610cff57600080fd5b506104b9610d0e366004614d05565b611e2f565b348015610d1f57600080fd5b5061057a610d2e36600461519a565b611e4d565b348015610d3f57600080fd5b506104b9610d4e366004614c80565b611eee565b348015610d5f57600080fd5b506104b9610d6e36600461519a565b6001600160a01b03918216600090815260d16020908152604080832093909416825291909152205490565b348015610da557600080fd5b50610607610db4366004614d63565b611f5f565b348015610dc557600080fd5b50610607610dd4366004614d05565b61203b565b348015610de557600080fd5b506104b9610df4366004614c80565b612066565b348015610e0557600080fd5b50610607610e14366004614d05565b612071565b348015610e2557600080fd5b50610e5c610e34366004614d05565b6101626020526000908152604090208054600182015460028301546003909301549192909184565b6040805194855260208501939093529183015260608201526080016104c3565b348015610e8857600080fd5b50610607610e97366004614d05565b6120e7565b348015610ea857600080fd5b50610607610eb7366004614d05565b6121bc565b348015610ec857600080fd5b50610607610ed73660046151c8565b6122d7565b348015610ee857600080fd5b506104b961015f5481565b348015610eff57600080fd5b506104b961271081565b348015610f1557600080fd5b50610607610f24366004614c80565b61230f565b348015610f3557600080fd5b50610607610f44366004615248565b612340565b6000610f5361235b565b610f5b6114c9565b610f65919061528f565b905090565b606060cd805480602002602001604051908101604052809291908181526020018280548015610fc257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610fa4575b5050505050905090565b6000610f65336123d0565b606060cb8054610fe6906152a2565b80601f0160208091040260200160405190810160405280929190818152602001828054611012906152a2565b8015610fc25780601f1061103457610100808354040283529160200191610fc2565b820191906000526020600020905b81548152906001019060200180831161104257509395945050505050565b60008061106c60ca5490565b90508060000361107d575090919050565b611090611088610f49565b849083612467565b9392505050565b6000610f6533612486565b6000336110b0818585612574565b60019150505b92915050565b6000806110c860ca5490565b9050806000036110d9575090919050565b611090816110e5610f49565b85919061269b565b6110f56126c9565b8061110557611102612724565b50565b611102612776565b6000806111186114c9565b6001600160a01b03841660009081526101626020526040812060020154919250829003611149575060009392505050565b81611156612710836152dc565b61116091906152f3565b949350505050565b6000336111768582856127b3565b6111a38585856040518060200160405280600081525060405180602001604052806000815250600061283f565b506001949350505050565b60006111b861293b565b6111c1826110bc565b90506111cf82823333612996565b6111da600161012d55565b919050565b60008060008061015f546000036111fc5750600093849350915050565b60005b61025e548110156112e757600061025e828154811061122057611220615315565b60009182526020822001546001600160a01b0316915061123f8261110d565b905061124b818661532b565b9450612710826001600160a01b0316632ff7709e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561128e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b2919061533e565b6112bc90836152dc565b6112c691906152f3565b6112d0908561532b565b9350505080806112df90615357565b9150506111ff565b50816000036112fc5750600093849350915050565b939092509050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036113555760405162461bcd60e51b815260040161134c90615370565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661139e60008051602061576c833981519152546001600160a01b031690565b6001600160a01b0316146113c45760405162461bcd60e51b815260040161134c906153bc565b6113cd81612a50565b6040805160008082526020820190925261110291839190612a58565b3360009081526101626020526040812054900361141957604051630160ef0b60e51b815260040160405180910390fd5b61142161293b565b8061142b33612bc3565b10156114795760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f7567682061737365747320666f72207061796d656e74000000604482015260640161134c565b8115611489576114893383612c33565b6114963382600085612d93565b61149f82612f14565b6114aa600161012d55565b5050426101618190553360009081526101626020526040902060010155565b600061015f546114d7612f40565b610f65919061532b565b60006110b682611060565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115345760405162461bcd60e51b815260040161134c90615370565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661157d60008051602061576c833981519152546001600160a01b031690565b6001600160a01b0316146115a35760405162461bcd60e51b815260040161134c906153bc565b6115ac82612a50565b6115b882826001612a58565b5050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461165c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161134c565b5060008051602061576c83398151915290565b6000610f65612fae565b6116833386611e4d565b61169f5760405162461bcd60e51b815260040161134c90615408565b6116ae8585858585600161283f565b5050505050565b600061109083611be5565b6116c86126c9565b6116d26000612fb8565b565b6116dc6126c9565b60006116ea61025e8461300b565b90508061170a57604051632df15a4160e11b815260040160405180910390fd5b816117185761171883613140565b826001600160a01b03167fb6a4d3fee462ca7c56e3e87f5942581b478433cf0003d49e1750c1ad1539ee3083604051611755911515815260200190565b60405180910390a2505050565b600054610100900460ff16158080156117825750600054600160ff909116105b8061179c5750303b15801561179c575060005460ff166001145b6117ff5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161134c565b6000805460ff191660011790558015611822576000805461ff0019166101001790555b61182a6131aa565b6118326131e1565b61196488855160001461184557856118cb565b896001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015611883573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ab9190810190615454565b6040516020016118bb91906154cb565b6040516020818303038152906040525b8551156118d8578561195e565b8a6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015611916573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261193e9190810190615454565b60405160200161194e9190615503565b6040516020818303038152906040525b8561327b565b61196d8761203b565b6119768661230f565b61197f85611dbf565b80156119c5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600061109083611b52565b6001600160a01b0381163303611a3e5760405162461bcd60e51b8152602060048201526024808201527f4552433737373a20617574686f72697a696e672073656c66206173206f70657260448201526330ba37b960e11b606482015260840161134c565b6001600160a01b038116600090815260ce602052604090205460ff1615611a8f5733600090815260d0602090815260408083206001600160a01b03851684529091529020805460ff19169055611abe565b33600090815260cf602090815260408083206001600160a01b03851684529091529020805460ff191660011790555b60405133906001600160a01b038316907ff4caeb2d6ca8932a215a353d0703c326ec2d81fc68170f320eb2ab49e9df61f990600090a350565b606060cc8054610fe6906152a2565b611b0e6126c9565b611b1a61025e826132ae565b80516115b89161025e91602090910190614b56565b611b4d3384848460405180602001604052806000815250600161283f565b505050565b6000611b5c61293b565b611b6582611baa565b90506111cf8183336133a0565b6000611ba13384846040518060200160405280600081525060405180602001604052806000815250600061283f565b50600192915050565b600080611bb660ca5490565b905080600003611bc7575090919050565b611090611bd2610f49565b84908361269b565b6000611160846111ae565b6000611bef61342e565b6110b682613476565b600061116084611eee565b80611c17610195546001600160a01b031690565b6001600160a01b0316336001600160a01b031614158015611c415750336001600160a01b03821614155b15611c6157604051630869704160e41b815233600482015260240161134c565b611c6c8260006134e6565b6040516001600160a01b038316907f4201c688d84c01154d321afa0c72f1bffe9eef53005c9de9d035074e71e9b32a90600090a25050565b600080611cb060ca5490565b905080600003611cc1575090919050565b61109081611ccd610f49565b859190612467565b61025e8181548110611ce657600080fd5b6000918252602090912001546001600160a01b0316905081565b611d086126c9565b611d1061342e565b6001600160a01b038216611d375760405163f5bf603960e01b815260040160405180910390fd5b611d40826135ce565b611d4a82826136df565b611d5661025e836137af565b816001600160a01b03167f2f564a83158ad1831793ad3e69257b52f39ece5d49cb0d8746708ecb9ef964da82604051611d9191815260200190565b60405180910390a25050565b6001600160a01b038116600090815260c960205260408120546110b690611060565b611dc76126c9565b670de0b6b3a7640000811115611df357604051639058c3f760e01b81526004810182905260240161134c565b6102948190556040518181527f6619a135102d0d043ca15a77ad3878b0c97fb8ead5829208b0f79c00711fa7c79060200160405180910390a150565b6001600160a01b038116600090815260c960205260408120546110b6565b6000816001600160a01b0316836001600160a01b03161480611eb857506001600160a01b038316600090815260ce602052604090205460ff168015611eb857506001600160a01b03808316600090815260d0602090815260408083209387168352929052205460ff16155b806110905750506001600160a01b03908116600090815260cf602090815260408083209490931682529290925290205460ff1690565b6000611ef861293b565b611f01826114e1565b905080600003611f535760405162461bcd60e51b815260206004820181905260248201527f476976656e2073686172657320726573756c7420696e2030206173736574732e604482015260640161134c565b6111cf81833333612996565b33600090815261016260205260408120549003611f8f57604051630160ef0b60e51b815260040160405180910390fd5b611f9761293b565b611fa1818361532b565b611faa33612bc3565b1015611fc95760405163112093df60e31b815260040160405180910390fd5b60008083118015611fec5750336000908152610162602052604090206001015442115b80156120075750336000908152610162602052604090205442115b1561201857612015836137e3565b90505b6120253383856000612d93565b61202f838261384b565b506114aa600161012d55565b6120436126c9565b61029180546001600160a01b0319166001600160a01b0392909216919091179055565b60006110b682611ca4565b6120796126c9565b6001600160a01b0381166120de5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161134c565b61110281612fb8565b6120ef6126c9565b6001600160a01b0381166121165760405163f5bf603960e01b815260040160405180910390fd5b61212261025e82613869565b156121405760405163c45546f760e01b815260040160405180910390fd5b6001600160a01b038116600090815261016260205260408120549003612179576040516332ffc55b60e11b815260040160405180910390fd5b61218561025e826137af565b6040516001600160a01b038216907f0bd7504c563a4658373bef3dbb51f91f63b8c6d5ba60806c678e75df33b4569890600090a250565b336001600160a01b0382160361221e5760405162461bcd60e51b815260206004820152602160248201527f4552433737373a207265766f6b696e672073656c66206173206f70657261746f6044820152603960f91b606482015260840161134c565b6001600160a01b038116600090815260ce602052604090205460ff16156122725733600090815260d0602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561229e565b33600090815260cf602090815260408083206001600160a01b03851684529091529020805460ff191690555b60405133906001600160a01b038316907f50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa190600090a350565b6122e13385611e4d565b6122fd5760405162461bcd60e51b815260040161134c90615408565b612309848484846138d2565b50505050565b6123176126c9565b61271081111561233a57604051630bc4369360e21b815260040160405180910390fd5b61029255565b6115b8338383604051806020016040528060008152506138d2565b600080610294546101615442612371919061528f565b61237b91906152dc565b9050670de0b6b3a7640000811061239457600091505090565b6000670de0b6b3a764000061029354836123ae91906152dc565b6123b891906152f3565b905080610293546123c9919061528f565b9250505090565b6001600160a01b038116600090815261016260205260408120600201546123f561166f565b80612401575061016054155b1561240c5792915050565b60006127106124196114c9565b6001600160a01b0386166000908152610162602052604090206003015461244091906152dc565b61244a91906152f3565b905080821161245d575060009392505050565b611160818361528f565b82820281151584158583048514171661247f57600080fd5b0492915050565b600061249061166f565b1561249d57506000919050565b60006124a7613a87565b61015f5490915060006127106124bb6114c9565b6001600160a01b038716600090815261016260205260409020600301546124e291906152dc565b6124ec91906152f3565b6001600160a01b03861660009081526101626020526040902060020154909150828411158061251b5750808211155b1561252c5750600095945050505050565b6000612538848661528f565b90506000612546838561528f565b905060006125548383613aac565b905061256781612562612f40565b613aac565b9998505050505050505050565b6001600160a01b0383166125d85760405162461bcd60e51b815260206004820152602560248201527f4552433737373a20617070726f76652066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161134c565b6001600160a01b03821661263a5760405162461bcd60e51b815260206004820152602360248201527f4552433737373a20617070726f766520746f20746865207a65726f206164647260448201526265737360e81b606482015260840161134c565b6001600160a01b03838116600081815260d1602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b8282028115158415858304851417166126b357600080fd5b6001826001830304018115150290509392505050565b610195546001600160a01b031633146116d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161134c565b61272c613ac2565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61277e61342e565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586127593390565b6001600160a01b03838116600090815260d16020908152604080832093861683529290522054600019811461230957818110156128325760405162461bcd60e51b815260206004820152601e60248201527f4552433737373a20696e73756666696369656e7420616c6c6f77616e63650000604482015260640161134c565b6123098484848403612574565b6001600160a01b0386166128a45760405162461bcd60e51b815260206004820152602660248201527f4552433737373a207472616e736665722066726f6d20746865207a65726f206160448201526564647265737360d01b606482015260840161134c565b6001600160a01b0385166129065760405162461bcd60e51b8152602060048201526024808201527f4552433737373a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161134c565b33612915818888888888613b0d565b612923818888888888613c34565b61293281888888888888613d9a565b50505050505050565b600261012d540361298e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161134c565b600261012d55565b336001600160a01b038216146129b1576129b18133856127b3565b6129bb8484613f55565b6129e5818460405180602001604052806000815250604051806020016040528060008152506138d2565b60408051858152602081018590526001600160a01b03808416929085169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46101f954612309906001600160a01b031683866140c5565b600161012d55565b6111026126c9565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612a8b57611b4d83614128565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612ae5575060408051601f3d908101601f19168201909252612ae29181019061533e565b60015b612b485760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161134c565b60008051602061576c8339815191528114612bb75760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161134c565b50611b4d8383836141c4565b6101f9546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa158015612c0f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b6919061533e565b6001600160a01b0382166000908152610162602052604090206002015481811015612ca05760405162461bcd60e51b815260206004820152601d60248201527f4c6f73732069732067726561746572207468616e207468652064656274000000604482015260640161134c565b6101605415612d43576000612ced61015f548461016054612cc191906152dc565b612ccb91906152f3565b6001600160a01b03861660009081526101626020526040902060030154613aac565b90508015612d41576001600160a01b0384166000908152610162602052604081206003018054839290612d2190849061528f565b92505081905550806101606000828254612d3b919061528f565b90915550505b505b6001600160a01b0383166000908152610162602052604081206002018054849290612d6f90849061528f565b925050819055508161015f6000828254612d89919061528f565b9091555050505050565b6000612d9e85612486565b90506000612dab336123d0565b9050612db78582613aac565b94508415612e0b576001600160a01b0386166000908152610162602052604081206002018054879290612deb90849061528f565b925050819055508461015f6000828254612e05919061528f565b90915550505b8115612e5d576001600160a01b0386166000908152610162602052604081206002018054849290612e3d90849061532b565b925050819055508161015f6000828254612e57919061532b565b90915550505b6000612e69868661532b565b905060008084831015612e9157612e80838661528f565b9150612e8c89836141e9565b612eaf565b84831115612eaf57612ea3858461528f565b9050612eaf8982614201565b604080518981526020810189905290810183905260608101829052608081018790526001600160a01b038a16907f92a0cdbae2e10dc214d482504ecbf0461593fd2fbfbedad5a195f5ebb7dcee739060a00160405180910390a2505050505050505050565b6000612f1e61235b565b9050818111612f2e576000612f38565b612f38828261528f565b610293555050565b6101f9546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612f8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f65919061533e565b6000610f6561421a565b61019580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008060005b845481101561310057836001600160a01b031685828154811061303657613036615315565b6000918252602090912001546001600160a01b03160361305557600191505b81801561306e5750845461306b9060019061528f565b81105b156130ee578461307f82600161532b565b8154811061308f5761308f615315565b9060005260206000200160009054906101000a90046001600160a01b03168582815481106130bf576130bf615315565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b806130f881615357565b915050613011565b50801561109057838054806131175761311761552e565b600082815260209020810160001990810180546001600160a01b03191690550190559392505050565b6001600160a01b038116600090815261016260205260409020600301541561317b5760405163c69bfc5f60e01b815260040160405180910390fd5b6001600160a01b0316600090815261016260205260408120818155600181018290556002810182905560030155565b600054610100900460ff166131d15760405162461bcd60e51b815260040161134c90615544565b6131d9614228565b6116d2614257565b600054610100900460ff166132085760405162461bcd60e51b815260040161134c90615544565b600061321d610195546001600160a01b031690565b6001600160a01b0316036132735760405162461bcd60e51b815260206004820181905260248201527f537472617465676965734c656e646572206d757374206265206f776e61626c65604482015260640161134c565b6116d2614286565b600054610100900460ff166132a25760405162461bcd60e51b815260040161134c90615544565b612309848484846142c5565b815481516060919081146132d5576040516336c2ff5d60e01b815260040160405180910390fd5b60005b818110156133975760008582815481106132f4576132f4615315565b60009182526020822001546001600160a01b031691505b838110156133825785818151811061332557613325615315565b60200260200101516001600160a01b0316826001600160a01b031603156133825761335160018561528f565b8103613370576040516336c2ff5d60e01b815260040160405180910390fd5b8061337a81615357565b91505061330b565b5050808061338f90615357565b9150506132d8565b50919392505050565b6101f9546133b9906001600160a01b0316333086614308565b6133e381836040518060200160405280600081525060405180602001604052806000815250614340565b60408051848152602081018490526001600160a01b0383169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3505050565b61343661166f565b156116d25760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161134c565b600061348061293b565b61348982612066565b9050806000036134db5760405162461bcd60e51b815260206004820181905260248201527f476976656e2061737365747320726573756c7420696e2030207368617265732e604482015260640161134c565b6111cf8282336133a0565b6001600160a01b0382166000908152610162602052604090205461351d576040516332ffc55b60e11b815260040160405180910390fd5b6001600160a01b0382166000908152610162602052604081206003015461016080549192909161354e90849061528f565b90915550506001600160a01b038216600090815261016260205260408120600301829055610160805483929061358590849061532b565b90915550506101605461271010156115b85780610160546135a6919061528f565b6135b29061271061528f565b604051639eb4cd0560e01b815260040161134c91815260200190565b806001600160a01b031663bcead63e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561360c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613630919061558f565b6001600160a01b0316306001600160a01b03161415806136c15750806001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136ad919061558f565b6101f9546001600160a01b03908116911614155b1561110257604051631120dc3360e21b815260040160405180910390fd5b6001600160a01b0382166000908152610162602052604090205415613717576040516312635b0b60e21b815260040160405180910390fd5b6127108161016054613729919061532b565b111561373f57610160546135b29061271061528f565b604080516080810182524280825260208083019182526000838501818152606085018781526001600160a01b0389168352610162909352948120935184559151600184015592516002830155915160039091015561016080548392906137a690849061532b565b90915550505050565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b03909216919091179055565b60008061271061029254846137f891906152dc565b61380291906152f3565b905080156110b657610291546110b6906001600160a01b031661382483611ca4565b6040518060200160405280600081525060405180602001604052806000815250600061434a565b808261385561235b565b61385f919061532b565b612f38919061528f565b6000805b83548110156138c857826001600160a01b031684828154811061389257613892615315565b6000918252602090912001546001600160a01b0316036138b65760019150506110b6565b806138c081615357565b91505061386d565b5060009392505050565b6001600160a01b0384166139335760405162461bcd60e51b815260206004820152602260248201527f4552433737373a206275726e2066726f6d20746865207a65726f206164647265604482015261737360f01b606482015260840161134c565b3361394381866000878787613b0d565b6001600160a01b038516600090815260c96020526040902054848110156139b85760405162461bcd60e51b815260206004820152602360248201527f4552433737373a206275726e20616d6f756e7420657863656564732062616c616044820152626e636560e81b606482015260840161134c565b6001600160a01b038616600090815260c960205260408120868303905560ca80548792906139e790849061528f565b92505081905550856001600160a01b0316826001600160a01b03167fa78a9be3a7b862d26933ad85fb11d80ef66b8f972d7cbba06621d583943a4098878787604051613a35939291906155ac565b60405180910390a36040518581526000906001600160a01b038816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a3505050505050565b6000612710613a946114c9565b61016054613aa291906152dc565b610f6591906152f3565b6000818310613abb5781611090565b5090919050565b613aca61166f565b6116d25760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161134c565b60405163555ddc6560e11b81526001600160a01b03861660048201527f29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe8956024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015613b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bb2919061558f565b90506001600160a01b0381161561293257604051633ad5cbc160e11b81526001600160a01b038216906375ab978290613bf9908a908a908a908a908a908a906004016155d7565b600060405180830381600087803b158015613c1357600080fd5b505af1158015613c27573d6000803e3d6000fd5b5050505050505050505050565b6001600160a01b038516600090815260c9602052604090205483811015613cad5760405162461bcd60e51b815260206004820152602760248201527f4552433737373a207472616e7366657220616d6f756e7420657863656564732060448201526662616c616e636560c81b606482015260840161134c565b6001600160a01b03808716600090815260c96020526040808220878503905591871681529081208054869290613ce490849061532b565b92505081905550846001600160a01b0316866001600160a01b0316886001600160a01b03167f06b541ddaa720db2b10a4d0cdac39b8d360425fc073085fac19bc82614677987878787604051613d3c939291906155ac565b60405180910390a4846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051613d8991815260200190565b60405180910390a350505050505050565b60405163555ddc6560e11b81526001600160a01b03861660048201527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b6024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015613e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e3f919061558f565b90506001600160a01b03811615613ebb576040516223de2960e01b81526001600160a01b038216906223de2990613e84908b908b908b908b908b908b906004016155d7565b600060405180830381600087803b158015613e9e57600080fd5b505af1158015613eb2573d6000803e3d6000fd5b505050506119c5565b81156119c5576001600160a01b0386163b156119c55760405162461bcd60e51b815260206004820152604d60248201527f4552433737373a20746f6b656e20726563697069656e7420636f6e747261637460448201527f20686173206e6f20696d706c656d656e74657220666f7220455243373737546f60648201526c1ad95b9cd49958da5c1a595b9d609a1b608482015260a40161134c565b81613f5e612f40565b10613f67575050565b60005b61025e54811015614092576000613f7f612f40565b9050808411613f8e5750614092565b600061025e8381548110613fa457613fa4615315565b60009182526020822001546001600160a01b03169150613fe9613fc7848861528f565b6001600160a01b03841660009081526101626020526040902060020154613aac565b905080600003613ffb57505050614080565b604051632e1a7d4d60e01b8152600481018290526000906001600160a01b03841690632e1a7d4d906024016020604051808303816000875af1158015614045573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614069919061533e565b9050801561407b5761407b8382612c33565b505050505b8061408a81615357565b915050613f6a565b508161409c612f40565b10156115b85760405163bce5067160e01b8152600481018390526024810182905260440161134c565b6040516001600160a01b038316602482015260448101829052611b4d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614487565b6001600160a01b0381163b6141955760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161134c565b60008051602061576c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6141cd8361455c565b6000825111806141da5750805b15611b4d57612309838361459c565b6101f9546115b8906001600160a01b031683836140c5565b6101f9546115b8906001600160a01b0316833084614308565b6000610f6560fb5460ff1690565b600054610100900460ff1661424f5760405162461bcd60e51b815260040161134c90615544565b6116d26145c1565b600054610100900460ff1661427e5760405162461bcd60e51b815260040161134c90615544565b6116d26145e8565b600054610100900460ff166142ad5760405162461bcd60e51b815260040161134c90615544565b6142b5614618565b6142bd614647565b6116d2614676565b600054610100900460ff166142ec5760405162461bcd60e51b815260040161134c90615544565b6142f78383836146a4565b6142ff614647565b612309846146d6565b6040516001600160a01b03808516602483015283166044820152606481018290526123099085906323b872dd60e01b906084016140f1565b6123098484848460015b6001600160a01b0385166143a05760405162461bcd60e51b815260206004820181905260248201527f4552433737373a206d696e7420746f20746865207a65726f2061646472657373604482015260640161134c565b60003390508460ca60008282546143b7919061532b565b90915550506001600160a01b038616600090815260c96020526040812080548792906143e490849061532b565b909155506143fa90508160008888888888613d9a565b856001600160a01b0316816001600160a01b03167f2fe5be0146f74c5bce36c0b80911af6c7d86ff27e89d5cfa61fc681327954e5d878787604051614441939291906155ac565b60405180910390a36040518581526001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001613a77565b60006144dc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147209092919063ffffffff16565b90508051600014806144fd5750808060200190518101906144fd9190615624565b611b4d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161134c565b61456581614128565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060611090838360405180606001604052806027815260200161578c6027913961472f565b600054610100900460ff166116d25760405162461bcd60e51b815260040161134c90615544565b600054610100900460ff1661460f5760405162461bcd60e51b815260040161134c90615544565b6116d233612fb8565b600054610100900460ff1661463f5760405162461bcd60e51b815260040161134c90615544565b6116d26147a7565b600054610100900460ff1661466e5760405162461bcd60e51b815260040161134c90615544565b6116d26147da565b600054610100900460ff1661469d5760405162461bcd60e51b815260040161134c90615544565b4261016155565b600054610100900460ff166146cb5760405162461bcd60e51b815260040161134c90615544565b611b4d838383614801565b600054610100900460ff166146fd5760405162461bcd60e51b815260040161134c90615544565b6101f980546001600160a01b0319166001600160a01b0392909216919091179055565b606061116084846000856149dd565b6060600080856001600160a01b03168560405161474c9190615641565b600060405180830381855af49150503d8060008114614787576040519150601f19603f3d011682016040523d82523d6000602084013e61478c565b606091505b509150915061479d86838387614ab8565b9695505050505050565b600054610100900460ff166147ce5760405162461bcd60e51b815260040161134c90615544565b60fb805460ff19169055565b600054610100900460ff16612a485760405162461bcd60e51b815260040161134c90615544565b600054610100900460ff166148285760405162461bcd60e51b815260040161134c90615544565b60cb61483484826156ab565b5060cc61484183826156ab565b5080516148559060cd906020840190614b56565b5060005b81518110156148be57600160ce600084848151811061487a5761487a615315565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806148b681615357565b915050614859565b506040516329965a1d60e01b815230600482018190527fac7fbab5f54a3ca8194167523c6753bfeb96a445279294b6125b68cce217705460248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad24906329965a1d90606401600060405180830381600087803b15801561493857600080fd5b505af115801561494c573d6000803e3d6000fd5b50506040516329965a1d60e01b815230600482018190527faea199e31a596269b42cdafd93407f14436db6e4cad65417994c2eb37381e05a60248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad2492506329965a1d9150606401600060405180830381600087803b1580156149c957600080fd5b505af1158015612932573d6000803e3d6000fd5b606082471015614a3e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161134c565b600080866001600160a01b03168587604051614a5a9190615641565b60006040518083038185875af1925050503d8060008114614a97576040519150601f19603f3d011682016040523d82523d6000602084013e614a9c565b606091505b5091509150614aad87838387614ab8565b979650505050505050565b60608315614b27578251600003614b20576001600160a01b0385163b614b205760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161134c565b5081611160565b6111608383815115614b3c5781518083602001fd5b8060405162461bcd60e51b815260040161134c9190614c6d565b828054828255906000526020600020908101928215614bab579160200282015b82811115614bab57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614b76565b50614bb7929150614bbb565b5090565b5b80821115614bb75760008155600101614bbc565b6020808252825182820181905260009190848201906040850190845b81811015614c115783516001600160a01b031683529284019291840191600101614bec565b50909695505050505050565b60005b83811015614c38578181015183820152602001614c20565b50506000910152565b60008151808452614c59816020860160208601614c1d565b601f01601f19169290920160200192915050565b6020815260006110906020830184614c41565b600060208284031215614c9257600080fd5b5035919050565b6001600160a01b038116811461110257600080fd5b60008060408385031215614cc157600080fd5b8235614ccc81614c99565b946020939093013593505050565b801515811461110257600080fd5b600060208284031215614cfa57600080fd5b813561109081614cda565b600060208284031215614d1757600080fd5b813561109081614c99565b600080600060608486031215614d3757600080fd5b8335614d4281614c99565b92506020840135614d5281614c99565b929592945050506040919091013590565b60008060408385031215614d7657600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715614dc457614dc4614d85565b604052919050565b600067ffffffffffffffff821115614de657614de6614d85565b50601f01601f191660200190565b600082601f830112614e0557600080fd5b8135614e18614e1382614dcc565b614d9b565b818152846020838601011115614e2d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215614e5d57600080fd5b8235614e6881614c99565b9150602083013567ffffffffffffffff811115614e8457600080fd5b614e9085828601614df4565b9150509250929050565b600080600080600060a08688031215614eb257600080fd5b8535614ebd81614c99565b94506020860135614ecd81614c99565b935060408601359250606086013567ffffffffffffffff80821115614ef157600080fd5b614efd89838a01614df4565b93506080880135915080821115614f1357600080fd5b50614f2088828901614df4565b9150509295509295909350565b60008060408385031215614f4057600080fd5b823591506020830135614f5281614c99565b809150509250929050565b60008060408385031215614f7057600080fd5b8235614f7b81614c99565b91506020830135614f5281614cda565b600082601f830112614f9c57600080fd5b8135602067ffffffffffffffff821115614fb857614fb8614d85565b8160051b614fc7828201614d9b565b9283528481018201928281019087851115614fe157600080fd5b83870192505b84831015614aad578235614ffa81614c99565b82529183019190830190614fe7565b600080600080600080600060e0888a03121561502457600080fd5b873561502f81614c99565b9650602088013561503f81614c99565b95506040880135945060608801359350608088013567ffffffffffffffff8082111561506a57600080fd5b6150768b838c01614df4565b945060a08a013591508082111561508c57600080fd5b6150988b838c01614df4565b935060c08a01359150808211156150ae57600080fd5b506150bb8a828b01614f8b565b91505092959891949750929550565b6000602082840312156150dc57600080fd5b813567ffffffffffffffff8111156150f357600080fd5b61116084828501614f8b565b60008060006060848603121561511457600080fd5b833561511f81614c99565b925060208401359150604084013567ffffffffffffffff81111561514257600080fd5b61514e86828701614df4565b9150509250925092565b60008060006060848603121561516d57600080fd5b83359250602084013561517f81614c99565b9150604084013561518f81614c99565b809150509250925092565b600080604083850312156151ad57600080fd5b82356151b881614c99565b91506020830135614f5281614c99565b600080600080608085870312156151de57600080fd5b84356151e981614c99565b935060208501359250604085013567ffffffffffffffff8082111561520d57600080fd5b61521988838901614df4565b9350606087013591508082111561522f57600080fd5b5061523c87828801614df4565b91505092959194509250565b6000806040838503121561525b57600080fd5b82359150602083013567ffffffffffffffff811115614e8457600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156110b6576110b6615279565b600181811c908216806152b657607f821691505b6020821081036152d657634e487b7160e01b600052602260045260246000fd5b50919050565b80820281158282048414176110b6576110b6615279565b60008261531057634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b808201808211156110b6576110b6615279565b60006020828403121561535057600080fd5b5051919050565b60006001820161536957615369615279565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252602c908201527f4552433737373a2063616c6c6572206973206e6f7420616e206f70657261746f60408201526b39103337b9103437b63232b960a11b606082015260800190565b60006020828403121561546657600080fd5b815167ffffffffffffffff81111561547d57600080fd5b8201601f8101841361548e57600080fd5b805161549c614e1382614dcc565b8181528560208385010111156154b157600080fd5b6154c2826020830160208601614c1d565b95945050505050565b600082516154dd818460208701614c1d565b7320456f6e69616e205661756c742053686172657360601b920191825250601401919050565b6232b7b760e91b815260008251615521816003850160208701614c1d565b9190910160030192915050565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156155a157600080fd5b815161109081614c99565b8381526060602082015260006155c56060830185614c41565b828103604084015261479d8185614c41565b6001600160a01b0387811682528681166020830152851660408201526060810184905260c06080820181905260009061561290830185614c41565b82810360a08401526125678185614c41565b60006020828403121561563657600080fd5b815161109081614cda565b60008251615653818460208701614c1d565b9190910192915050565b601f821115611b4d57600081815260208120601f850160051c810160208610156156845750805b601f850160051c820191505b818110156156a357828155600101615690565b505050505050565b815167ffffffffffffffff8111156156c5576156c5614d85565b6156d9816156d384546152a2565b8461565d565b602080601f83116001811461570e57600084156156f65750858301515b600019600386901b1c1916600185901b1785556156a3565b600085815260208120601f198616915b8281101561573d5788860151825594840194600190910190840161571e565b508582101561575b5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220102ce681bd44537b67cb2adaa36ffb050a3471463e5df0b4b69d8ca11643d05a64736f6c63430008130033", + "numDeployments": 3, + "solcInputHash": "c49e2950159d0667a0032186292b7773", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"needDisableInitializers\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"AccessDeniedForCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BorrowerAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BorrowerDoesNotExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BorrowerHasDebt\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerIsNotABorrower\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExceededMaximumFeeValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FalsePositiveReport\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InappropriateStrategy\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"InsufficientVaultBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"durationInSeconds\",\"type\":\"uint256\"}],\"name\":\"InvalidLockedProfitReleaseRate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"freeRatio\",\"type\":\"uint256\"}],\"name\":\"LenderRatioExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ListsDoNotMatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StrategyAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StrategyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnexpectedZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenHolder\",\"type\":\"address\"}],\"name\":\"AuthorizedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtPayment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"freeFunds\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fundsGiven\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fundsTaken\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"loss\",\"type\":\"uint256\"}],\"name\":\"BorrowerDebtManagementReported\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"Burned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"LockedProfitReleaseRateChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"Minted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenHolder\",\"type\":\"address\"}],\"name\":\"RevokedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"Sent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtRatio\",\"type\":\"uint256\"}],\"name\":\"StrategyAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"fromQueueOnly\",\"type\":\"bool\"}],\"name\":\"StrategyRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"StrategyReturnedToQueue\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"StrategyRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"LOCKED_PROFIT_RELEASE_SCALE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_BPS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"debtRatio\",\"type\":\"uint256\"}],\"name\":\"addStrategy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"addStrategyToQueue\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"holder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"asset\",\"outputs\":[{\"internalType\":\"contract IERC20Upgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"authorizeOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"availableCredit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenHolder\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowersData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"activationTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastReportTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debtRatio\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"convertToAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"convertToShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"currentDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentDebtRatio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debtRatio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultOperators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"depositHooks\",\"outputs\":[{\"internalType\":\"contract IVaultHook\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"founders\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"foundersFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fundAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"granularity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_rewards\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_managementFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_lockedProfitReleaseRate\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_defaultOperators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_foundersFee\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"isActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenHolder\",\"type\":\"address\"}],\"name\":\"isOperatorFor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"lastReport\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastReport\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastReportTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lockedProfitBaseline\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lockedProfitReleaseRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"managementFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"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\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"maxWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"operatorBurn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"operatorData\",\"type\":\"bytes\"}],\"name\":\"operatorSend\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outstandingDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"previewDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"previewMint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"previewRedeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"previewWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"fromQueueOnly\",\"type\":\"bool\"}],\"name\":\"removeStrategy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"queue\",\"type\":\"address[]\"}],\"name\":\"reorderWithdrawalQueue\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"loss\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debtPayment\",\"type\":\"uint256\"}],\"name\":\"reportNegativeDebtManagement\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"extraFreeFunds\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debtPayment\",\"type\":\"uint256\"}],\"name\":\"reportPositiveDebtManagement\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"revokeOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"revokeStrategy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"send\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"shutdown\",\"type\":\"bool\"}],\"name\":\"setEmergencyShutdown\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_founders\",\"type\":\"address\"}],\"name\":\"setFounders\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_foundersFee\",\"type\":\"uint256\"}],\"name\":\"setFoundersFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"setLockedProfitReleaseRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_managementFee\",\"type\":\"uint256\"}],\"name\":\"setManagementFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_rewards\",\"type\":\"address\"}],\"name\":\"setRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"strategyDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"strategy\",\"type\":\"address\"}],\"name\":\"strategyRatio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"holder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"utilizationRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"withdrawHooks\",\"outputs\":[{\"internalType\":\"contract IVaultHook\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"withdrawalQueue\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"},\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"AuthorizedOperator(address,address)\":{\"details\":\"Emitted when `operator` is made operator for `tokenHolder`.\"},\"BeaconUpgraded(address)\":{\"details\":\"Emitted when the beacon is changed.\"},\"BorrowerDebtManagementReported(address,uint256,uint256,uint256,uint256,uint256)\":{\"params\":{\"borrower\":\"Borrower's contract address\",\"debtPayment\":\"Amount of outstanding debt repaid by the borrower\",\"freeFunds\":\"Free funds on the borrower's contract that remain after the debt is paid\",\"fundsGiven\":\"Funds issued to the borrower by this lender\",\"fundsTaken\":\"Funds that have been taken from the borrower by the lender\",\"loss\":\"Amount of funds that the borrower realised as loss\"}},\"Burned(address,address,uint256,bytes,bytes)\":{\"details\":\"Emitted when `operator` destroys `amount` tokens from `account`. Note that some additional user `data` and `operatorData` can be logged in the event.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Minted(address,address,uint256,bytes,bytes)\":{\"details\":\"Emitted when `amount` tokens are created by `operator` and assigned to `to`. Note that some additional user `data` and `operatorData` can be logged in the event.\"},\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"RevokedOperator(address,address)\":{\"details\":\"Emitted when `operator` is revoked its operator status for `tokenHolder`.\"},\"StrategyAdded(address,uint256)\":{\"params\":{\"debtRatio\":\"Maximum portion of the loan that the strategy can take (in BPS).\",\"strategy\":\"Address of the strategy contract.\"}},\"StrategyRemoved(address,bool)\":{\"params\":{\"fromQueueOnly\":\"If \\\"true\\\", then the strategy has only been removed from the withdrawal queue.\",\"strategy\":\"Address of the strategy contract.\"}},\"StrategyReturnedToQueue(address)\":{\"params\":{\"strategy\":\"Address of the strategy contract.\"}},\"StrategyRevoked(address)\":{\"params\":{\"strategy\":\"Address of the strategy contract.\"}},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"addStrategy(address,uint256)\":{\"params\":{\"debtRatio\":\"a ratio that shows how much of the new strategy can take, relative to other strategies.\",\"strategy\":\"a new strategy address.\"}},\"addStrategyToQueue(address)\":{\"params\":{\"strategy\":\"a strategy address.\"}},\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}. Note that operator and allowance concepts are orthogonal: operators may not have allowance, and accounts with allowance may not be operators themselves.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Note that accounts cannot have allowance issued by their operators.\"},\"authorizeOperator(address)\":{\"details\":\"See {IERC777-authorizeOperator}.\"},\"availableCredit()\":{\"returns\":{\"_0\":\"Available credit as amount of tokens\"}},\"balanceOf(address)\":{\"details\":\"Returns the amount of tokens owned by an account (`tokenHolder`).\"},\"burn(uint256,bytes)\":{\"details\":\"See {IERC777-burn}. Also emits a {IERC20-Transfer} event for ERC20 compatibility.\"},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"currentDebt()\":{\"returns\":{\"_0\":\"Debt as amount of tokens\"}},\"decimals()\":{\"details\":\"See {ERC20-decimals}. Always returns 18, as per the [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\"},\"defaultOperators()\":{\"details\":\"See {IERC777-defaultOperators}.\"},\"deposit(uint256)\":{\"details\":\"Override to add the \\\"whenNotPaused\\\" modifier\"},\"granularity()\":{\"details\":\"See {IERC777-granularity}. This implementation always returns `1`.\"},\"interestRatePerBlock()\":{\"returns\":{\"_0\":\"- The interest rate per block, scaled by 1e18\",\"_1\":\"- The utilisation rate of the lender, in BPS (scaled by 1e4)\"}},\"isActivated()\":{\"returns\":{\"_0\":\"\\\"true\\\" if the borrower is active\"}},\"isOperatorFor(address,address)\":{\"details\":\"See {IERC777-isOperatorFor}.\"},\"name()\":{\"details\":\"See {IERC777-name}.\"},\"operatorBurn(address,uint256,bytes,bytes)\":{\"details\":\"See {IERC777-operatorBurn}. Emits {Burned} and {IERC20-Transfer} events.\"},\"operatorSend(address,address,uint256,bytes,bytes)\":{\"details\":\"See {IERC777-operatorSend}. Emits {Sent} and {IERC20-Transfer} events.\"},\"outstandingDebt()\":{\"returns\":{\"_0\":\"Outstanding debt as amount of tokens\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\",\"returns\":{\"_0\":\"\\\"true\\\" if the contract is paused, and \\\"false\\\" otherwise.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"removeStrategy(address,bool)\":{\"params\":{\"fromQueueOnly\":\"if \\\"true\\\", then the strategy will only be removed from the withdrawal queue.\",\"strategy\":\"a strategy to remove.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"reorderWithdrawalQueue(address[])\":{\"params\":{\"queue\":\"a new queue that will replace the existing one. Should contain only those elements that already present in the existing queue.\"}},\"reportNegativeDebtManagement(uint256,uint256)\":{\"params\":{\"debtPayment\":\"is the funds that the borrower must release in order to pay off his outstanding debt (if any).\",\"loss\":\"a number of tokens by which the borrower's balance has decreased since the last report. May include a portion of the outstanding debt that the borrower was unable to repay.\"}},\"reportPositiveDebtManagement(uint256,uint256)\":{\"params\":{\"debtPayment\":\"is the funds that the borrower must release in order to pay off his outstanding debt (if any).\",\"extraFreeFunds\":\"an extra amount of free funds borrower's contract has. This reporting amount must be greater than the borrower's outstanding debt.\"}},\"revokeOperator(address)\":{\"details\":\"See {IERC777-revokeOperator}.\"},\"revokeStrategy(address)\":{\"params\":{\"strategy\":\"a strategy to revoke.\"}},\"send(address,uint256,bytes)\":{\"details\":\"See {IERC777-send}. Also emits a {IERC20-Transfer} event for ERC20 compatibility.\"},\"setEmergencyShutdown(bool)\":{\"params\":{\"shutdown\":\"a new vault pause state. If \\\"true\\\" is passed, the vault will be paused.\"}},\"setFounders(address)\":{\"params\":{\"_founders\":\"a new founder token contract address.\"}},\"setFoundersFee(uint256)\":{\"params\":{\"_foundersFee\":\"a new founder token reward fee (in BPS).\"}},\"setLockedProfitReleaseRate(uint256)\":{\"params\":{\"rate\":\"the rate of release of locked profit (percent per second scaled to 1e18). The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\"}},\"setManagementFee(uint256)\":{\"params\":{\"_managementFee\":\"a new management fee value (in BPS).\"}},\"setRewards(address)\":{\"params\":{\"_rewards\":\"a new rewards address.\"}},\"strategyDebt(address)\":{\"params\":{\"strategy\":\"the strategy address.\"}},\"strategyRatio(address)\":{\"params\":{\"strategy\":\"the strategy address.\"}},\"symbol()\":{\"details\":\"See {IERC777-symbol}.\"},\"totalAssets()\":{\"details\":\"Must be implemented by child contract.\"},\"totalSupply()\":{\"details\":\"See {IERC777-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient} interface if it is a contract. Also emits a {Sent} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Note that operator and allowance concepts are orthogonal: operators cannot call `transferFrom` (unless they have allowance), and accounts with allowance cannot call `operatorSend` (unless they are operators). Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"upgradeTo(address)\":{\"custom:oz-upgrades-unsafe-allow-reachable\":\"delegatecall\",\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"custom:oz-upgrades-unsafe-allow-reachable\":\"delegatecall\",\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"utilizationRate(address)\":{\"returns\":{\"_0\":\"percent of total assets taken by strategy in BPS\"}},\"version()\":{\"returns\":{\"_0\":\"a version in semantic versioning format\"}}},\"stateVariables\":{\"__gap\":{\"details\":\"This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\"}},\"version\":1},\"userdoc\":{\"events\":{\"BorrowerDebtManagementReported(address,uint256,uint256,uint256,uint256,uint256)\":{\"notice\":\"Event that must occur when the borrower reported the results of his debt management\"},\"Deposit(address,address,uint256,uint256)\":{\"notice\":\"`sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`. emitted when tokens are deposited into the Vault via the mint and deposit methods.\"},\"LockedProfitReleaseRateChanged(uint256)\":{\"notice\":\"Event that should happen when the locked-in profit release rate changed.\"},\"StrategyAdded(address,uint256)\":{\"notice\":\"Event that should happen when the strategy connects to the vault.\"},\"StrategyRemoved(address,bool)\":{\"notice\":\"Event that should happen when the strategy has been removed from the vault.\"},\"StrategyReturnedToQueue(address)\":{\"notice\":\"Event that should happen when the strategy has been returned to the withdrawal queue.\"},\"StrategyRevoked(address)\":{\"notice\":\"Event that should happen when the strategy has been revoked from the vault.\"},\"Withdraw(address,address,address,uint256,uint256)\":{\"notice\":\"`sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`. emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\"}},\"kind\":\"user\",\"methods\":{\"LOCKED_PROFIT_RELEASE_SCALE()\":{\"notice\":\"Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\"},\"addStrategy(address,uint256)\":{\"notice\":\"Adds a new strategy to the vault.\"},\"addStrategyToQueue(address)\":{\"notice\":\"Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\"},\"asset()\":{\"notice\":\"The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract. Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\"},\"availableCredit()\":{\"notice\":\"Returns the number of tokens the borrower (caller of this function) can take from the lender\"},\"borrowersData(address)\":{\"notice\":\"Records with information on each borrower using the lender's services\"},\"convertToAssets(uint256)\":{\"notice\":\"The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met. - is NOT inclusive of any fees that are charged against assets in the Vault. - do NOT show any variations depending on the caller. - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange. - do NOT revert unless due to integer overflow caused by an unreasonably large input. - round down towards 0. This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and from.\"},\"convertToShares(uint256)\":{\"notice\":\"The amount of shares that the Vault would exchange for the amount of assets provided, in an ideal scenario where all the conditions are met. - is NOT inclusive of any fees that are charged against assets in the Vault. - do NOT show any variations depending on the caller. - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange. - do NOT revert unless due to integer overflow caused by an unreasonably large input. - round down towards 0. This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and from.\"},\"currentDebt()\":{\"notice\":\"Returns the amount of funds taken by the borrower (caller of this function).\"},\"currentDebt(address)\":{\"notice\":\"Returns the current debt that the strategy has.\"},\"currentDebtRatio()\":{\"notice\":\"Returns the debt ratio of the borrower (caller of this function).\"},\"debtRatio()\":{\"notice\":\"Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\"},\"deposit(uint256)\":{\"notice\":\"Mints the Vault shares for msg.sender, according to the number of deposited base tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\"},\"deposit(uint256,address)\":{\"notice\":\"Mints Vault shares to receiver by depositing exactly amount of underlying tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\"},\"founders()\":{\"notice\":\"Vault Founders Token contract where rewards for founders are sent to.\"},\"foundersFee()\":{\"notice\":\"Vault founders reward (in BPS).\"},\"fundAssets()\":{\"notice\":\"Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\"},\"getQueueSize()\":{\"notice\":\"Returns the size of the withdrawal queue.\"},\"interestRatePerBlock()\":{\"notice\":\"Returns average interst rate of lender per block. Based on last report utilization rate and possibly cached interest rate of each strategy. Can be outadated, but close enough to real state for on chain calculations. Calculate average by combining utilisation rate of each strategy with its interest rate. Returns additional total utilisation rate of lender, as additional product of calculation, usefull to safe gas.\"},\"isActivated()\":{\"notice\":\"Returns the activation status of the borrower (caller of this function).\"},\"isActivated(address)\":{\"notice\":\"Returns the activation status of the specified borrower.\"},\"lastReport()\":{\"notice\":\"Returns the last report timestamp of the borrower (caller of this function).\"},\"lastReport(address)\":{\"notice\":\"Returns the last report timestamp of the specified borrower.\"},\"lastReportTimestamp()\":{\"notice\":\"Last time a report occurred by any borrower\"},\"lockedProfitBaseline()\":{\"notice\":\"The amount of funds that cannot be withdrawn by users. Decreases with time at the rate of \\\"lockedProfitReleaseRate\\\".\"},\"lockedProfitReleaseRate()\":{\"notice\":\"The rate of \\\"lockedProfitBaseline\\\" decline on the locked-in profit scale (scaled to 1e18). Represents the amount of funds that will be unlocked when one second passes.\"},\"managementFee()\":{\"notice\":\"Vault management fee (in BPS).\"},\"maxDeposit(address)\":{\"notice\":\"Maximum amount of the underlying asset that can be deposited into the Vault for the receiver, through a deposit call. - returns the maximum amount of assets deposit would allow to be deposited for receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset. - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0. - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\"},\"maxMint(address)\":{\"notice\":\"Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call. - return the maximum amount of shares mint would allow to be deposited to receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset. - factor in both global and user-specific limits, like if mints are entirely disabled (even temporarily) it MUST return 0. - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\"},\"maxRedeem(address)\":{\"notice\":\"Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, through a redeem call. - return the maximum amount of shares that could be transferred from owner through redeem and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). - factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.\"},\"maxWithdraw(address)\":{\"notice\":\"Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault, through a withdraw call. - return the maximum amount of assets that could be transferred from owner through withdraw and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). - factor in both global and user-specific limits, like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\"},\"mint(uint256)\":{\"notice\":\"Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\"},\"mint(uint256,address)\":{\"notice\":\"Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\"},\"outstandingDebt()\":{\"notice\":\"Returns the outstanding debt that the borrower (caller of this function) must repay\"},\"paused()\":{\"notice\":\"Indicates if the vault was shutted down or not.\"},\"previewDeposit(uint256)\":{\"notice\":\"Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given current on-chain conditions. - return as close to and no more than the exact amount of Vault shares that would be minted in a deposit call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction. - NOT account for deposit limits like those returned from maxDeposit and should always act as though the deposit would be accepted, regardless if the user has enough tokens approved, etc. - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert. Note that any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing.\"},\"previewMint(uint256)\":{\"notice\":\"Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given current on-chain conditions. - return as close to and no fewer than the exact amount of assets that would be deposited in a mint call in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the same transaction. - NOT account for mint limits like those returned from maxMint and should always act as though the mint would be accepted, regardless if the user has enough tokens approved, etc. - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause mint to revert. Note that any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by minting.\"},\"previewRedeem(uint256)\":{\"notice\":\"Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, given current on-chain conditions. - return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the same transaction. - NOT account for redemption limits like those returned from maxRedeem and should always act as though the redemption would be accepted, regardless if the user has enough shares, etc. - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause redeem to revert. Note that any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by redeeming.\"},\"previewWithdraw(uint256)\":{\"notice\":\"Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, given current on-chain conditions. - return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if called in the same transaction. - NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though the withdrawal would be accepted, regardless if the user has enough shares, etc. - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause withdraw to revert. Note that any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing.\"},\"redeem(uint256)\":{\"notice\":\"Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender. - emit the Withdraw event. - support a redeem flow where the shares are burned from owner directly where owner is msg.sender. - MAY support an additional flow in which the shares are transferred to the Vault contract before the redeem execution, and are accounted for during redeem. - revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.\"},\"redeem(uint256,address,address)\":{\"notice\":\"Burns exactly shares from owner and sends assets of underlying tokens to receiver. - emit the Withdraw event. - support a redeem flow where the shares are burned from owner directly where owner is msg.sender. - support a redeem flow where the shares are burned from owner directly where msg.sender has ERC-20 approval over the shares of owner. - MAY support an additional flow in which the shares are transferred to the Vault contract before the redeem execution, and are accounted for during redeem. - revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.\"},\"removeStrategy(address,bool)\":{\"notice\":\"Removes a strategy from the vault.\"},\"reorderWithdrawalQueue(address[])\":{\"notice\":\"Sets the withdrawal queue.\"},\"reportNegativeDebtManagement(uint256,uint256)\":{\"notice\":\"Reports a negative result of the borrower's debt management. The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\"},\"reportPositiveDebtManagement(uint256,uint256)\":{\"notice\":\"Reports a positive result of the borrower's debt management. Borrower must call this function if he has made any profit or/and has a free funds available to repay the outstanding debt (if any).\"},\"revokeStrategy(address)\":{\"notice\":\"Revokes a strategy from the vault. Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\"},\"rewards()\":{\"notice\":\"Rewards contract where management fees are sent to.\"},\"setEmergencyShutdown(bool)\":{\"notice\":\"Switches the vault pause state.\"},\"setFounders(address)\":{\"notice\":\"Sets the vault founder token contract;\"},\"setFoundersFee(uint256)\":{\"notice\":\"Sets the vault founder token reward rate. Both management and foundersReward fee can't exceed 100%\"},\"setLockedProfitReleaseRate(uint256)\":{\"notice\":\"Changes the rate of release of locked-in profit.\"},\"setManagementFee(uint256)\":{\"notice\":\"Sets the vault management fee. Both management and foundersReward fee can't exceed 100%\"},\"setRewards(address)\":{\"notice\":\"Sets the vault rewards address.\"},\"strategyDebt(address)\":{\"notice\":\"Returns the current debt of the strategy.\"},\"strategyRatio(address)\":{\"notice\":\"Returns the debt ratio of the strategy.\"},\"totalAssets()\":{\"notice\":\"Total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault. - include any compounding that occurs from yield. - inclusive of any fees that are charged against assets in the Vault. - is NOT revert\"},\"totalDebt()\":{\"notice\":\"Amount of tokens that all borrowers have taken\"},\"utilizationRate(address)\":{\"notice\":\"Calculate utilisation rate for specific borrowerBased on last report data, can be outdated, but close to latest state of fund\"},\"version()\":{\"notice\":\"Returns the current version of this contract\"},\"withdraw(uint256)\":{\"notice\":\"Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender. - emit the Withdraw event. - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender. - MAY support an additional flow in which the shares are transferred to the Vault contract before the withdraw execution, and are accounted for during withdraw. - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.\"},\"withdraw(uint256,address,address)\":{\"notice\":\"Burns shares from owner and sends exactly assets of underlying tokens to receiver. - emit the Withdraw event. - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender. - support a withdraw flow where the shares are burned from owner directly where msg.sender has ERC-20 approval over the shares of owner. - MAY support an additional flow in which the shares are transferred to the Vault contract before the withdraw execution, and are accounted for during withdraw. - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.\"},\"withdrawalQueue(uint256)\":{\"notice\":\"Arranged list of addresses of strategies, which defines the order for withdrawal.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/Vault.sol\":\"Vault\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":contracts/=src/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":solmate/=lib/solmate/src/\"]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => 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 a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).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 override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\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 override 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 override 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 override 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 `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\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 Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\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 signaling this.\\n *\\n * _Available since v3.1._\\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, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\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 `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165Upgradeable.sol\\\";\\n\",\"keccak256\":\"0x121966b3220d263a6669dcf59c1254bd48ed237adf4d8a595add70a7927eada1\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967Upgradeable {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x47d6e06872b12e72c79d1b5eb55842f860b5fb1207b2317c2358d2766b950a7b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC4906Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4906.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"./IERC721Upgradeable.sol\\\";\\n\\n/// @title EIP-721 Metadata Update Extension\\ninterface IERC4906Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\\n /// @dev This event emits when the metadata of a token is changed.\\n /// So that the third-party platforms such as NFT market could\\n /// timely update the images and related attributes of the NFT.\\n event MetadataUpdate(uint256 _tokenId);\\n\\n /// @dev This event emits when the metadata of a range of tokens is changed.\\n /// So that the third-party platforms such as NFT market could\\n /// timely update the images and related attributes of the NFTs.\\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\\n}\\n\",\"keccak256\":\"0x869de080935f0a9f8ae29134bc7bd33176d2912ab13f080ff678a5a26ea542b7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC721/IERC721Upgradeable.sol\\\";\\n\",\"keccak256\":\"0x9256117dac3a66dbce2e7245c6ceb7361f8ae7425e3d896ac26ecece3e3d12e3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1967Upgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x584ebdf9c1118a7c773f98788e3f3ede01982bdf8932aa06f5acc7d54876e161\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeTo(address newImplementation) public virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xb607cb94c27e89750f5ae2ccebcb94e654e926f6125f4fd4c6262c89875118ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {\\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 bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal onlyInitializing {\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal onlyInitializing {\\n _paused = false;\\n }\\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 require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\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 /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x40c636b4572ff5f1dc50cf22097e93c0723ee14eff87e99ac2b02636eeca1250\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\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 function __ReentrancyGuard_init() internal onlyInitializing {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb82ef33f43b6b96109687d91b39c94573fdccaaa423fe28e8ba0977b31c023e0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1f0f5f62f67a881cd1a9597acbc0a5e4071f3c2c10449a183b922ae7272e3f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20PermitUpgradeable {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xd60f939a3ca0199014d079b4dd66aa757954334947d81eb5c1d35d7a83061ab3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\nimport \\\"../extensions/IERC20PermitUpgradeable.sol\\\";\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\\n * 0 before setting it to a non-zero value.\\n */\\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20PermitUpgradeable token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x4dae161227d332808312ee2caf6384929321b83c16cc89b5642985fbec6b814c\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721ReceiverUpgradeable {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721EnumerableUpgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\\n * enumerability of all the token ids in the contract as well as all token ids owned by each\\n * account.\\n */\\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\\n function __ERC721Enumerable_init() internal onlyInitializing {\\n }\\n\\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\\n }\\n // Mapping from owner to list of owned token IDs\\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\\n\\n // Mapping from token ID to index of the owner tokens list\\n mapping(uint256 => uint256) private _ownedTokensIndex;\\n\\n // Array with all token ids, used for enumeration\\n uint256[] private _allTokens;\\n\\n // Mapping from token id to position in the allTokens array\\n mapping(uint256 => uint256) private _allTokensIndex;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\\n */\\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\\n require(index < ERC721Upgradeable.balanceOf(owner), \\\"ERC721Enumerable: owner index out of bounds\\\");\\n return _ownedTokens[owner][index];\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _allTokens.length;\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-tokenByIndex}.\\n */\\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \\\"ERC721Enumerable: global index out of bounds\\\");\\n return _allTokens[index];\\n }\\n\\n /**\\n * @dev See {ERC721-_beforeTokenTransfer}.\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual override {\\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\\n\\n if (batchSize > 1) {\\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\\n revert(\\\"ERC721Enumerable: consecutive transfers not supported\\\");\\n }\\n\\n uint256 tokenId = firstTokenId;\\n\\n if (from == address(0)) {\\n _addTokenToAllTokensEnumeration(tokenId);\\n } else if (from != to) {\\n _removeTokenFromOwnerEnumeration(from, tokenId);\\n }\\n if (to == address(0)) {\\n _removeTokenFromAllTokensEnumeration(tokenId);\\n } else if (to != from) {\\n _addTokenToOwnerEnumeration(to, tokenId);\\n }\\n }\\n\\n /**\\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\\n * @param to address representing the new owner of the given token ID\\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\\n */\\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\\n uint256 length = ERC721Upgradeable.balanceOf(to);\\n _ownedTokens[to][length] = tokenId;\\n _ownedTokensIndex[tokenId] = length;\\n }\\n\\n /**\\n * @dev Private function to add a token to this extension's token tracking data structures.\\n * @param tokenId uint256 ID of the token to be added to the tokens list\\n */\\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\\n _allTokensIndex[tokenId] = _allTokens.length;\\n _allTokens.push(tokenId);\\n }\\n\\n /**\\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\\n * @param from address representing the previous owner of the given token ID\\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\\n */\\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary\\n if (tokenIndex != lastTokenIndex) {\\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\\n\\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n }\\n\\n // This also deletes the contents at the last position of the array\\n delete _ownedTokensIndex[tokenId];\\n delete _ownedTokens[from][lastTokenIndex];\\n }\\n\\n /**\\n * @dev Private function to remove a token from this extension's token tracking data structures.\\n * This has O(1) time complexity, but alters the order of the _allTokens array.\\n * @param tokenId uint256 ID of the token to be removed from the tokens list\\n */\\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = _allTokens.length - 1;\\n uint256 tokenIndex = _allTokensIndex[tokenId];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\\n uint256 lastTokenId = _allTokens[lastTokenIndex];\\n\\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n\\n // This also deletes the contents at the last position of the array\\n delete _allTokensIndex[tokenId];\\n _allTokens.pop();\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[46] private __gap;\\n}\\n\",\"keccak256\":\"0x2c98457c4171d86094adf9a4fd8cd2402b7e3e309e961f07910a60a576dd100f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/extensions/ERC721URIStorage.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC721Upgradeable.sol\\\";\\nimport \\\"../../../interfaces/IERC4906Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev ERC721 token with storage based token URI management.\\n */\\nabstract contract ERC721URIStorageUpgradeable is Initializable, IERC4906Upgradeable, ERC721Upgradeable {\\n function __ERC721URIStorage_init() internal onlyInitializing {\\n }\\n\\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\\n }\\n using StringsUpgradeable for uint256;\\n\\n // Optional mapping for token URIs\\n mapping(uint256 => string) private _tokenURIs;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) {\\n return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory _tokenURI = _tokenURIs[tokenId];\\n string memory base = _baseURI();\\n\\n // If there is no base URI, return the token URI.\\n if (bytes(base).length == 0) {\\n return _tokenURI;\\n }\\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\\n if (bytes(_tokenURI).length > 0) {\\n return string(abi.encodePacked(base, _tokenURI));\\n }\\n\\n return super.tokenURI(tokenId);\\n }\\n\\n /**\\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\\n *\\n * Emits {MetadataUpdate}.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\\n require(_exists(tokenId), \\\"ERC721URIStorage: URI set of nonexistent token\\\");\\n _tokenURIs[tokenId] = _tokenURI;\\n\\n emit MetadataUpdate(tokenId);\\n }\\n\\n /**\\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\\n * token-specific URI was set for the token, and if so, it deletes the token URI from\\n * the storage mapping.\\n */\\n function _burn(uint256 tokenId) internal virtual override {\\n super._burn(tokenId);\\n\\n if (bytes(_tokenURIs[tokenId]).length != 0) {\\n delete _tokenURIs[tokenId];\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x486985bf5203d0ee4568f8f89ae35b8accf6a95ecee280435102eedb807c2764\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\\n /**\\n * @dev Returns the total amount of tokens stored by the contract.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\\n */\\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\\n\\n /**\\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\\n * Use along with {totalSupply} to enumerate all tokens.\\n */\\n function tokenByIndex(uint256 index) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xf1870306db8391db9cf14b41be0da76857a88df0e5c623d2b2338fb30a3bd5ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/ERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC777Upgradeable.sol\\\";\\nimport \\\"./IERC777RecipientUpgradeable.sol\\\";\\nimport \\\"./IERC777SenderUpgradeable.sol\\\";\\nimport \\\"../ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/IERC1820RegistryUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC777} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n *\\n * Support for ERC20 is included in this contract, as specified by the EIP: both\\n * the ERC777 and ERC20 interfaces can be safely used when interacting with it.\\n * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token\\n * movements.\\n *\\n * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there\\n * are no special restrictions in the amount of tokens that created, moved, or\\n * destroyed. This makes integration with ERC20 applications seamless.\\n *\\n * CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.\\n */\\ncontract ERC777Upgradeable is Initializable, ContextUpgradeable, IERC777Upgradeable, IERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n IERC1820RegistryUpgradeable internal constant _ERC1820_REGISTRY = IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\\n\\n mapping(address => uint256) private _balances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256(\\\"ERC777TokensSender\\\");\\n bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\\\"ERC777TokensRecipient\\\");\\n\\n // This isn't ever read from - it's only used to respond to the defaultOperators query.\\n address[] private _defaultOperatorsArray;\\n\\n // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).\\n mapping(address => bool) private _defaultOperators;\\n\\n // For each account, a mapping of its operators and revoked default operators.\\n mapping(address => mapping(address => bool)) private _operators;\\n mapping(address => mapping(address => bool)) private _revokedDefaultOperators;\\n\\n // ERC20-allowances\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n /**\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __ERC777_init(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\\n __ERC777_init_unchained(name_, symbol_, defaultOperators_);\\n }\\n\\n function __ERC777_init_unchained(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n\\n _defaultOperatorsArray = defaultOperators_;\\n for (uint256 i = 0; i < defaultOperators_.length; i++) {\\n _defaultOperators[defaultOperators_[i]] = true;\\n }\\n\\n // register interfaces\\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\\\"ERC777Token\\\"), address(this));\\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\\\"ERC20Token\\\"), address(this));\\n }\\n\\n /**\\n * @dev See {IERC777-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC777-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {ERC20-decimals}.\\n *\\n * Always returns 18, as per the\\n * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\\n */\\n function decimals() public pure virtual returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC777-granularity}.\\n *\\n * This implementation always returns `1`.\\n */\\n function granularity() public view virtual override returns (uint256) {\\n return 1;\\n }\\n\\n /**\\n * @dev See {IERC777-totalSupply}.\\n */\\n function totalSupply() public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`tokenHolder`).\\n */\\n function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\\n return _balances[tokenHolder];\\n }\\n\\n /**\\n * @dev See {IERC777-send}.\\n *\\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\\n */\\n function send(address recipient, uint256 amount, bytes memory data) public virtual override {\\n _send(_msgSender(), recipient, amount, data, \\\"\\\", true);\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}\\n * interface if it is a contract.\\n *\\n * Also emits a {Sent} event.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _send(_msgSender(), recipient, amount, \\\"\\\", \\\"\\\", false);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC777-burn}.\\n *\\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\\n */\\n function burn(uint256 amount, bytes memory data) public virtual override {\\n _burn(_msgSender(), amount, data, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC777-isOperatorFor}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) {\\n return\\n operator == tokenHolder ||\\n (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||\\n _operators[tokenHolder][operator];\\n }\\n\\n /**\\n * @dev See {IERC777-authorizeOperator}.\\n */\\n function authorizeOperator(address operator) public virtual override {\\n require(_msgSender() != operator, \\\"ERC777: authorizing self as operator\\\");\\n\\n if (_defaultOperators[operator]) {\\n delete _revokedDefaultOperators[_msgSender()][operator];\\n } else {\\n _operators[_msgSender()][operator] = true;\\n }\\n\\n emit AuthorizedOperator(operator, _msgSender());\\n }\\n\\n /**\\n * @dev See {IERC777-revokeOperator}.\\n */\\n function revokeOperator(address operator) public virtual override {\\n require(operator != _msgSender(), \\\"ERC777: revoking self as operator\\\");\\n\\n if (_defaultOperators[operator]) {\\n _revokedDefaultOperators[_msgSender()][operator] = true;\\n } else {\\n delete _operators[_msgSender()][operator];\\n }\\n\\n emit RevokedOperator(operator, _msgSender());\\n }\\n\\n /**\\n * @dev See {IERC777-defaultOperators}.\\n */\\n function defaultOperators() public view virtual override returns (address[] memory) {\\n return _defaultOperatorsArray;\\n }\\n\\n /**\\n * @dev See {IERC777-operatorSend}.\\n *\\n * Emits {Sent} and {IERC20-Transfer} events.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes memory data,\\n bytes memory operatorData\\n ) public virtual override {\\n require(isOperatorFor(_msgSender(), sender), \\\"ERC777: caller is not an operator for holder\\\");\\n _send(sender, recipient, amount, data, operatorData, true);\\n }\\n\\n /**\\n * @dev See {IERC777-operatorBurn}.\\n *\\n * Emits {Burned} and {IERC20-Transfer} events.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes memory data,\\n bytes memory operatorData\\n ) public virtual override {\\n require(isOperatorFor(_msgSender(), account), \\\"ERC777: caller is not an operator for holder\\\");\\n _burn(account, amount, data, operatorData);\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n *\\n * Note that operator and allowance concepts are orthogonal: operators may\\n * not have allowance, and accounts with allowance may not be operators\\n * themselves.\\n */\\n function allowance(address holder, address spender) public view virtual override returns (uint256) {\\n return _allowances[holder][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Note that accounts cannot have allowance issued by their operators.\\n */\\n function approve(address spender, uint256 value) public virtual override returns (bool) {\\n address holder = _msgSender();\\n _approve(holder, spender, value);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Note that operator and allowance concepts are orthogonal: operators cannot\\n * call `transferFrom` (unless they have allowance), and accounts with\\n * allowance cannot call `operatorSend` (unless they are operators).\\n *\\n * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\\n */\\n function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(holder, spender, amount);\\n _send(holder, recipient, amount, \\\"\\\", \\\"\\\", false);\\n return true;\\n }\\n\\n /**\\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with the caller address as the `operator` and with\\n * `userData` and `operatorData`.\\n *\\n * See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits {Minted} and {IERC20-Transfer} events.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - if `account` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual {\\n _mint(account, amount, userData, operatorData, true);\\n }\\n\\n /**\\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * If `requireReceptionAck` is set to true, and if a send hook is\\n * registered for `account`, the corresponding function will be called with\\n * `operator`, `data` and `operatorData`.\\n *\\n * See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits {Minted} and {IERC20-Transfer} events.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - if `account` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function _mint(\\n address account,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) internal virtual {\\n require(account != address(0), \\\"ERC777: mint to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, address(0), account, amount);\\n\\n // Update state variables\\n _totalSupply += amount;\\n _balances[account] += amount;\\n\\n _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck);\\n\\n emit Minted(operator, account, amount, userData, operatorData);\\n emit Transfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Send tokens\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\\n */\\n function _send(\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) internal virtual {\\n require(from != address(0), \\\"ERC777: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC777: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _callTokensToSend(operator, from, to, amount, userData, operatorData);\\n\\n _move(operator, from, to, amount, userData, operatorData);\\n\\n _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);\\n }\\n\\n /**\\n * @dev Burn tokens\\n * @param from address token holder address\\n * @param amount uint256 amount of tokens to burn\\n * @param data bytes extra information provided by the token holder\\n * @param operatorData bytes extra information provided by the operator (if any)\\n */\\n function _burn(address from, uint256 amount, bytes memory data, bytes memory operatorData) internal virtual {\\n require(from != address(0), \\\"ERC777: burn from the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _callTokensToSend(operator, from, address(0), amount, data, operatorData);\\n\\n _beforeTokenTransfer(operator, from, address(0), amount);\\n\\n // Update state variables\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC777: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Burned(operator, from, amount, data, operatorData);\\n emit Transfer(from, address(0), amount);\\n }\\n\\n function _move(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData\\n ) private {\\n _beforeTokenTransfer(operator, from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC777: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _balances[to] += amount;\\n\\n emit Sent(operator, from, to, amount, userData, operatorData);\\n emit Transfer(from, to, amount);\\n }\\n\\n /**\\n * @dev See {ERC20-_approve}.\\n *\\n * Note that accounts cannot have allowance issued by their operators.\\n */\\n function _approve(address holder, address spender, uint256 value) internal virtual {\\n require(holder != address(0), \\\"ERC777: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC777: approve to the zero address\\\");\\n\\n _allowances[holder][spender] = value;\\n emit Approval(holder, spender, value);\\n }\\n\\n /**\\n * @dev Call from.tokensToSend() if the interface is registered\\n * @param operator address operator requesting the transfer\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n */\\n function _callTokensToSend(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData\\n ) private {\\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);\\n if (implementer != address(0)) {\\n IERC777SenderUpgradeable(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);\\n }\\n }\\n\\n /**\\n * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but\\n * tokensReceived() was not registered for the recipient\\n * @param operator address operator requesting the transfer\\n * @param from address token holder address\\n * @param to address recipient address\\n * @param amount uint256 amount of tokens to transfer\\n * @param userData bytes extra information provided by the token holder (if any)\\n * @param operatorData bytes extra information provided by the operator (if any)\\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\\n */\\n function _callTokensReceived(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes memory userData,\\n bytes memory operatorData,\\n bool requireReceptionAck\\n ) private {\\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);\\n if (implementer != address(0)) {\\n IERC777RecipientUpgradeable(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);\\n } else if (requireReceptionAck) {\\n require(!to.isContract(), \\\"ERC777: token recipient contract has no implementer for ERC777TokensRecipient\\\");\\n }\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {IERC20-Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC777: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes\\n * calls to {send}, {transfer}, {operatorSend}, {transferFrom}, minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be to transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address operator, address from, address to, uint256 amount) internal virtual {}\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[41] private __gap;\\n}\\n\",\"keccak256\":\"0x828f2bcdf4a940221fffc84f904d1ae56f25cf90039b73572e3ec71c995abee2\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\\n *\\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\\n * contract implement this interface (contract holders can be their own\\n * implementer) and registering it on the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\\n *\\n * See {IERC1820Registry} and {ERC1820Implementer}.\\n */\\ninterface IERC777RecipientUpgradeable {\\n /**\\n * @dev Called by an {IERC777} token contract whenever tokens are being\\n * moved or created into a registered account (`to`). The type of operation\\n * is conveyed by `from` being the zero address or not.\\n *\\n * This call occurs _after_ the token contract's state is updated, so\\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\\n *\\n * This function may revert to prevent the operation from being executed.\\n */\\n function tokensReceived(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes calldata userData,\\n bytes calldata operatorData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1fbcfef49c67aea4ca9417b337a363e933127047e73194011b78c1741602615b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777TokensSender standard as defined in the EIP.\\n *\\n * {IERC777} Token holders can be notified of operations performed on their\\n * tokens by having a contract implement this interface (contract holders can be\\n * their own implementer) and registering it on the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\\n *\\n * See {IERC1820Registry} and {ERC1820Implementer}.\\n */\\ninterface IERC777SenderUpgradeable {\\n /**\\n * @dev Called by an {IERC777} token contract whenever a registered holder's\\n * (`from`) tokens are about to be moved or destroyed. The type of operation\\n * is conveyed by `to` being the zero address or not.\\n *\\n * This call occurs _before_ the token contract's state is updated, so\\n * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.\\n *\\n * This function may revert to prevent the operation from being executed.\\n */\\n function tokensToSend(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes calldata userData,\\n bytes calldata operatorData\\n ) external;\\n}\\n\",\"keccak256\":\"0x79fc5ced00b0715d84b75e016754292e434cf2cbbc58c1f275ef0754653a6d78\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777Upgradeable {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0xfcc6168646fb2829c61565249e12d02ea4bd2831faebe1ca096412ceca37bd02\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Counters\\n * @author Matt Condon (@shrugs)\\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\\n *\\n * Include with `using Counters for Counters.Counter;`\\n */\\nlibrary CountersUpgradeable {\\n struct Counter {\\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\\n // this feature: see https://github.com/ethereum/solidity/issues/4637\\n uint256 _value; // default: 0\\n }\\n\\n function current(Counter storage counter) internal view returns (uint256) {\\n return counter._value;\\n }\\n\\n function increment(Counter storage counter) internal {\\n unchecked {\\n counter._value += 1;\\n }\\n }\\n\\n function decrement(Counter storage counter) internal {\\n uint256 value = counter._value;\\n require(value > 0, \\\"Counter: decrement overflow\\\");\\n unchecked {\\n counter._value = value - 1;\\n }\\n }\\n\\n function reset(Counter storage counter) internal {\\n counter._value = 0;\\n }\\n}\\n\",\"keccak256\":\"0x798741e231b22b81e2dd2eddaaf8832dee4baf5cd8e2dbaa5c1dd12a1c053c4d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x07ac95acad040f1fb1f6120dd0aa5f702db69446e95f82613721879d30de0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC1820RegistryUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/IERC1820Registry.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the global ERC1820 Registry, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register\\n * implementers for interfaces in this registry, as well as query support.\\n *\\n * Implementers may be shared by multiple accounts, and can also implement more\\n * than a single interface for each account. Contracts can implement interfaces\\n * for themselves, but externally-owned accounts (EOA) must delegate this to a\\n * contract.\\n *\\n * {IERC165} interfaces can also be queried via the registry.\\n *\\n * For an in-depth explanation and source code analysis, see the EIP text.\\n */\\ninterface IERC1820RegistryUpgradeable {\\n event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);\\n\\n event ManagerChanged(address indexed account, address indexed newManager);\\n\\n /**\\n * @dev Sets `newManager` as the manager for `account`. A manager of an\\n * account is able to set interface implementers for it.\\n *\\n * By default, each account is its own manager. Passing a value of `0x0` in\\n * `newManager` will reset the manager to this initial state.\\n *\\n * Emits a {ManagerChanged} event.\\n *\\n * Requirements:\\n *\\n * - the caller must be the current manager for `account`.\\n */\\n function setManager(address account, address newManager) external;\\n\\n /**\\n * @dev Returns the manager for `account`.\\n *\\n * See {setManager}.\\n */\\n function getManager(address account) external view returns (address);\\n\\n /**\\n * @dev Sets the `implementer` contract as ``account``'s implementer for\\n * `interfaceHash`.\\n *\\n * `account` being the zero address is an alias for the caller's address.\\n * The zero address can also be used in `implementer` to remove an old one.\\n *\\n * See {interfaceHash} to learn how these are created.\\n *\\n * Emits an {InterfaceImplementerSet} event.\\n *\\n * Requirements:\\n *\\n * - the caller must be the current manager for `account`.\\n * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not\\n * end in 28 zeroes).\\n * - `implementer` must implement {IERC1820Implementer} and return true when\\n * queried for support, unless `implementer` is the caller. See\\n * {IERC1820Implementer-canImplementInterfaceForAddress}.\\n */\\n function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;\\n\\n /**\\n * @dev Returns the implementer of `interfaceHash` for `account`. If no such\\n * implementer is registered, returns the zero address.\\n *\\n * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28\\n * zeroes), `account` will be queried for support of it.\\n *\\n * `account` being the zero address is an alias for the caller's address.\\n */\\n function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);\\n\\n /**\\n * @dev Returns the interface hash for an `interfaceName`, as defined in the\\n * corresponding\\n * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].\\n */\\n function interfaceHash(string calldata interfaceName) external pure returns (bytes32);\\n\\n /**\\n * @notice Updates the cache with whether the contract implements an ERC165 interface or not.\\n * @param account Address of the contract for which to update the cache.\\n * @param interfaceId ERC165 interface for which to update the cache.\\n */\\n function updateERC165Cache(address account, bytes4 interfaceId) external;\\n\\n /**\\n * @notice Checks whether a contract implements an ERC165 interface or not.\\n * If the result is not cached a direct lookup on the contract address is performed.\\n * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\\n * {updateERC165Cache} with the contract address.\\n * @param account Address of the contract to check.\\n * @param interfaceId ERC165 interface to check.\\n * @return True if `account` implements `interfaceId`, false otherwise.\\n */\\n function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);\\n\\n /**\\n * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.\\n * @param account Address of the contract to check.\\n * @param interfaceId ERC165 interface to check.\\n * @return True if `account` implements `interfaceId`, false otherwise.\\n */\\n function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x02761f489482c11d04fda6e9e21592e819d4c349c20d133162445b46854b4660\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\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 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 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 up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 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 prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / 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 prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\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 works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\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^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice 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 uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"lib/solmate/src/utils/FixedPointMathLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.0;\\n\\n/// @notice Arithmetic library with operations for fixed-point numbers.\\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)\\nlibrary FixedPointMathLib {\\n /*//////////////////////////////////////////////////////////////\\n SIMPLIFIED FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\\n\\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\\n }\\n\\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\\n }\\n\\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\\n }\\n\\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\\n }\\n\\n function powWad(int256 x, int256 y) internal pure returns (int256) {\\n // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)\\n return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.\\n }\\n\\n function expWad(int256 x) internal pure returns (int256 r) {\\n unchecked {\\n // When the result is < 0.5 we return zero. This happens when\\n // x <= floor(log(0.5e18) * 1e18) ~ -42e18\\n if (x <= -42139678854452767551) return 0;\\n\\n // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\\n // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\\n if (x >= 135305999368893231589) revert(\\\"EXP_OVERFLOW\\\");\\n\\n // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\\n // for more intermediate precision and a binary basis. This base conversion\\n // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\\n x = (x << 78) / 5**18;\\n\\n // Reduce range of x to (-\\u00bd ln 2, \\u00bd ln 2) * 2**96 by factoring out powers\\n // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\\n // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\\n int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\\n x = x - k * 54916777467707473351141471128;\\n\\n // k is in the range [-61, 195].\\n\\n // Evaluate using a (6, 7)-term rational approximation.\\n // p is made monic, we'll multiply by a scale factor later.\\n int256 y = x + 1346386616545796478920950773328;\\n y = ((y * x) >> 96) + 57155421227552351082224309758442;\\n int256 p = y + x - 94201549194550492254356042504812;\\n p = ((p * y) >> 96) + 28719021644029726153956944680412240;\\n p = p * x + (4385272521454847904659076985693276 << 96);\\n\\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\\n int256 q = x - 2855989394907223263936484059900;\\n q = ((q * x) >> 96) + 50020603652535783019961831881945;\\n q = ((q * x) >> 96) - 533845033583426703283633433725380;\\n q = ((q * x) >> 96) + 3604857256930695427073651918091429;\\n q = ((q * x) >> 96) - 14423608567350463180887372962807573;\\n q = ((q * x) >> 96) + 26449188498355588339934803723976023;\\n\\n assembly {\\n // Div in assembly because solidity adds a zero check despite the unchecked.\\n // The q polynomial won't have zeros in the domain as all its roots are complex.\\n // No scaling is necessary because p is already 2**96 too large.\\n r := sdiv(p, q)\\n }\\n\\n // r should be in the range (0.09, 0.25) * 2**96.\\n\\n // We now need to multiply r by:\\n // * the scale factor s = ~6.031367120.\\n // * the 2**k factor from the range reduction.\\n // * the 1e18 / 2**96 factor for base conversion.\\n // We do this all at once, with an intermediate result in 2**213\\n // basis, so the final right shift is always by a positive amount.\\n r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\\n }\\n }\\n\\n function lnWad(int256 x) internal pure returns (int256 r) {\\n unchecked {\\n require(x > 0, \\\"UNDEFINED\\\");\\n\\n // We want to convert x from 10**18 fixed point to 2**96 fixed point.\\n // We do this by multiplying by 2**96 / 10**18. But since\\n // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\\n // and add ln(2**96 / 10**18) at the end.\\n\\n // Reduce range of x to (1, 2) * 2**96\\n // ln(2^k * x) = k * ln(2) + ln(x)\\n int256 k = int256(log2(uint256(x))) - 96;\\n x <<= uint256(159 - k);\\n x = int256(uint256(x) >> 159);\\n\\n // Evaluate using a (8, 8)-term rational approximation.\\n // p is made monic, we will multiply by a scale factor later.\\n int256 p = x + 3273285459638523848632254066296;\\n p = ((p * x) >> 96) + 24828157081833163892658089445524;\\n p = ((p * x) >> 96) + 43456485725739037958740375743393;\\n p = ((p * x) >> 96) - 11111509109440967052023855526967;\\n p = ((p * x) >> 96) - 45023709667254063763336534515857;\\n p = ((p * x) >> 96) - 14706773417378608786704636184526;\\n p = p * x - (795164235651350426258249787498 << 96);\\n\\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\\n // q is monic by convention.\\n int256 q = x + 5573035233440673466300451813936;\\n q = ((q * x) >> 96) + 71694874799317883764090561454958;\\n q = ((q * x) >> 96) + 283447036172924575727196451306956;\\n q = ((q * x) >> 96) + 401686690394027663651624208769553;\\n q = ((q * x) >> 96) + 204048457590392012362485061816622;\\n q = ((q * x) >> 96) + 31853899698501571402653359427138;\\n q = ((q * x) >> 96) + 909429971244387300277376558375;\\n assembly {\\n // Div in assembly because solidity adds a zero check despite the unchecked.\\n // The q polynomial is known not to have zeros in the domain.\\n // No scaling required because p is already 2**96 too large.\\n r := sdiv(p, q)\\n }\\n\\n // r is in the range (0, 0.125) * 2**96\\n\\n // Finalization, we need to:\\n // * multiply by the scale factor s = 5.549\\u2026\\n // * add ln(2**96 / 10**18)\\n // * add k * ln(2)\\n // * multiply by 10**18 / 2**96 = 5**18 >> 78\\n\\n // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\\n r *= 1677202110996718588342820967067443963516166;\\n // add ln(2) * k * 5e18 * 2**192\\n r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\\n // add ln(2**96 / 10**18) * 5e18 * 2**192\\n r += 600920179829731861736702779321621459595472258049074101567377883020018308;\\n // base conversion: mul 2**18 / 2**192\\n r >>= 174;\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n LOW LEVEL FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function mulDivDown(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n assembly {\\n // Store x * y in z for now.\\n z := mul(x, y)\\n\\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\\n revert(0, 0)\\n }\\n\\n // Divide z by the denominator.\\n z := div(z, denominator)\\n }\\n }\\n\\n function mulDivUp(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n assembly {\\n // Store x * y in z for now.\\n z := mul(x, y)\\n\\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\\n revert(0, 0)\\n }\\n\\n // First, divide z - 1 by the denominator and add 1.\\n // We allow z - 1 to underflow if z is 0, because we multiply the\\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\\n }\\n }\\n\\n function rpow(\\n uint256 x,\\n uint256 n,\\n uint256 scalar\\n ) internal pure returns (uint256 z) {\\n assembly {\\n switch x\\n case 0 {\\n switch n\\n case 0 {\\n // 0 ** 0 = 1\\n z := scalar\\n }\\n default {\\n // 0 ** n = 0\\n z := 0\\n }\\n }\\n default {\\n switch mod(n, 2)\\n case 0 {\\n // If n is even, store scalar in z for now.\\n z := scalar\\n }\\n default {\\n // If n is odd, store x in z for now.\\n z := x\\n }\\n\\n // Shifting right by 1 is like dividing by 2.\\n let half := shr(1, scalar)\\n\\n for {\\n // Shift n right by 1 before looping to halve it.\\n n := shr(1, n)\\n } n {\\n // Shift n right by 1 each iteration to halve it.\\n n := shr(1, n)\\n } {\\n // Revert immediately if x ** 2 would overflow.\\n // Equivalent to iszero(eq(div(xx, x), x)) here.\\n if shr(128, x) {\\n revert(0, 0)\\n }\\n\\n // Store x squared.\\n let xx := mul(x, x)\\n\\n // Round to the nearest number.\\n let xxRound := add(xx, half)\\n\\n // Revert if xx + half overflowed.\\n if lt(xxRound, xx) {\\n revert(0, 0)\\n }\\n\\n // Set x to scaled xxRound.\\n x := div(xxRound, scalar)\\n\\n // If n is even:\\n if mod(n, 2) {\\n // Compute z * x.\\n let zx := mul(z, x)\\n\\n // If z * x overflowed:\\n if iszero(eq(div(zx, x), z)) {\\n // Revert if x is non-zero.\\n if iszero(iszero(x)) {\\n revert(0, 0)\\n }\\n }\\n\\n // Round to the nearest number.\\n let zxRound := add(zx, half)\\n\\n // Revert if zx + half overflowed.\\n if lt(zxRound, zx) {\\n revert(0, 0)\\n }\\n\\n // Return properly scaled zxRound.\\n z := div(zxRound, scalar)\\n }\\n }\\n }\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n GENERAL NUMBER UTILITIES\\n //////////////////////////////////////////////////////////////*/\\n\\n function sqrt(uint256 x) internal pure returns (uint256 z) {\\n assembly {\\n let y := x // We start y at x, which will help us make our initial estimate.\\n\\n z := 181 // The \\\"correct\\\" value is 1, but this saves a multiplication later.\\n\\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\\n\\n // We check y >= 2^(k + 8) but shift right by k bits\\n // each branch to ensure that if x >= 256, then y >= 256.\\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\\n y := shr(128, y)\\n z := shl(64, z)\\n }\\n if iszero(lt(y, 0x1000000000000000000)) {\\n y := shr(64, y)\\n z := shl(32, z)\\n }\\n if iszero(lt(y, 0x10000000000)) {\\n y := shr(32, y)\\n z := shl(16, z)\\n }\\n if iszero(lt(y, 0x1000000)) {\\n y := shr(16, y)\\n z := shl(8, z)\\n }\\n\\n // Goal was to get z*z*y within a small factor of x. More iterations could\\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\\n\\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\\n\\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\\n\\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\\n\\n // There is no overflow risk here since y < 2^136 after the first branch above.\\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\\n\\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n\\n // If x+1 is a perfect square, the Babylonian method cycles between\\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\\n z := sub(z, lt(div(x, z), z))\\n }\\n }\\n\\n function log2(uint256 x) internal pure returns (uint256 r) {\\n require(x > 0, \\\"UNDEFINED\\\");\\n\\n assembly {\\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\\n r := or(r, shl(3, lt(0xff, shr(r, x))))\\n r := or(r, shl(2, lt(0xf, shr(r, x))))\\n r := or(r, shl(1, lt(0x3, shr(r, x))))\\n r := or(r, lt(0x1, shr(r, x)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x622fcd8a49e132df5ec7651cc6ae3aaf0cf59bdcd67a9a804a1b9e2485113b7d\",\"license\":\"MIT\"},\"src/IVault.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IStrategiesLender} from \\\"./lending/IStrategiesLender.sol\\\";\\nimport {IERC4626} from \\\"./tokens/IERC4626.sol\\\";\\n\\ninterface IVault is IStrategiesLender, IERC4626 { // solhint-disable-line no-empty-blocks\\n\\n}\\n\",\"keccak256\":\"0xff813ad44bf332ed444da13c7df42b2e3e325056c16665f4a9edd1c361e7912f\",\"license\":\"AGPL-3.0\"},\"src/Vault.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {MathUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\\\";\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {IERC20Metadata} from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport {PausableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\n\\nimport {IVault} from \\\"./IVault.sol\\\";\\nimport {ILender} from \\\"./lending/ILender.sol\\\";\\nimport {Lender, BorrowerDoesNotExist} from \\\"./lending/Lender.sol\\\";\\nimport {StrategiesLender} from \\\"./lending/StrategiesLender.sol\\\";\\nimport {SafeERC4626Upgradeable, ERC4626Upgradeable} from \\\"./tokens/SafeERC4626Upgradeable.sol\\\";\\nimport {IERC4626} from \\\"./tokens/IERC4626.sol\\\";\\nimport {IStrategy} from \\\"./strategies/IStrategy.sol\\\";\\nimport {AddressList} from \\\"./structures/AddressList.sol\\\";\\nimport {SafeInitializable} from \\\"./upgradeable/SafeInitializable.sol\\\";\\nimport {SafeUUPSUpgradeable} from \\\"./upgradeable/SafeUUPSUpgradeable.sol\\\";\\nimport {IVersionable} from \\\"./upgradeable/IVersionable.sol\\\";\\nimport {SafeERC4626Lifecycle} from \\\"./tokens/SafeERC4626Lifecycle.sol\\\";\\nimport {IVaultHook} from \\\"./tokens/IVaultHook.sol\\\";\\nimport {VaultFounderToken} from \\\"./tokens/VaultFounderToken.sol\\\";\\n\\n\\nerror ExceededMaximumFeeValue();\\n\\nerror InsufficientVaultBalance(uint256 assets, uint256 shares);\\nerror InvalidLockedProfitReleaseRate(uint256 durationInSeconds);\\nerror InappropriateStrategy();\\n\\ncontract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, StrategiesLender, SafeERC4626Lifecycle {\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n\\n /// @notice Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\\n uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;\\n\\n /// @notice Rewards contract where management fees are sent to.\\n address public rewards;\\n\\n /// @notice Vault Founders Token contract where rewards for founders are sent to.\\n address public founders;\\n\\n /// @notice Vault management fee (in BPS).\\n uint256 public managementFee;\\n\\n /// @notice Vault founders reward (in BPS).\\n uint256 public foundersFee;\\n\\n /// @notice The amount of funds that cannot be withdrawn by users.\\n /// Decreases with time at the rate of \\\"lockedProfitReleaseRate\\\".\\n uint256 public lockedProfitBaseline;\\n\\n /// @notice The rate of \\\"lockedProfitBaseline\\\" decline on the locked-in profit scale (scaled to 1e18).\\n /// Represents the amount of funds that will be unlocked when one second passes.\\n uint256 public lockedProfitReleaseRate;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[50] private __gap;\\n\\n /// @notice Event that should happen when the locked-in profit release rate changed.\\n event LockedProfitReleaseRateChanged(uint256 rate);\\n\\n /// @inheritdoc IVersionable\\n function version() external pure override returns (string memory) {\\n return \\\"0.2.0\\\";\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\\n\\n function initialize(\\n address _asset,\\n address _rewards,\\n uint256 _managementFee,\\n uint256 _lockedProfitReleaseRate,\\n string memory _name,\\n string memory _symbol,\\n address[] memory _defaultOperators,\\n uint256 _foundersFee\\n ) public initializer {\\n __SafeUUPSUpgradeable_init(); // Ownable under the hood\\n __StrategiesLender_init_lenderSpecific(); // require Ownable\\n __SafeERC4626_init(\\n IERC20Upgradeable(_asset),\\n bytes(_name).length == 0\\n ? string.concat(\\n IERC20Metadata(_asset).symbol(),\\n \\\" Eonian Vault Shares\\\"\\n )\\n : _name,\\n bytes(_symbol).length == 0\\n ? string.concat(\\\"eon\\\", IERC20Metadata(_asset).symbol())\\n : _symbol,\\n _defaultOperators\\n );\\n\\n setRewards(_rewards);\\n setManagementFee(_managementFee);\\n setLockedProfitReleaseRate(_lockedProfitReleaseRate);\\n setFoundersFee(_foundersFee);\\n }\\n\\n /// @dev Override to add the \\\"whenNotPaused\\\" modifier\\n /// @inheritdoc SafeERC4626Upgradeable\\n function deposit(uint256 assets)\\n public\\n override\\n whenNotPaused\\n returns (uint256 shares)\\n {\\n return super.deposit(assets);\\n }\\n\\n /// @notice Hook that is used before withdrawals to release assets from strategies if necessary.\\n /// @inheritdoc ERC4626Upgradeable\\n function beforeWithdraw(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\\n // There is no need to withdraw assets from strategies, the vault has sufficient funds\\n if (_freeAssets() >= assets) {\\n return;\\n }\\n\\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\\n // If the vault already has the required amount of funds, we need to finish the withdrawal\\n uint256 vaultBalance = _freeAssets();\\n if (assets <= vaultBalance) {\\n break;\\n }\\n\\n address strategy = withdrawalQueue[i];\\n\\n // We can only withdraw the amount that the strategy has as debt,\\n // so that the strategy can work on the unreported (yet) funds it has earned\\n uint256 requiredAmount = MathUpgradeable.min(\\n assets - vaultBalance,\\n borrowersData[strategy].debt\\n );\\n\\n // Skip this strategy is there is nothing to withdraw\\n if (requiredAmount == 0) {\\n continue;\\n }\\n\\n // Withdraw the required amount of funds from the strategy\\n uint256 loss = IStrategy(strategy).withdraw(requiredAmount);\\n\\n // If the strategy failed to return all of the requested funds, we need to reduce the strategy's debt ratio\\n if (loss > 0) {\\n _decreaseBorrowerCredibility(strategy, loss);\\n }\\n }\\n\\n // Revert if insufficient assets remain in the vault after withdrawal from all strategies\\n if (_freeAssets() < assets) {\\n revert InsufficientVaultBalance(assets, shares);\\n }\\n\\n // apply the hook\\n SafeERC4626Lifecycle.beforeWithdraw(assets, shares);\\n }\\n\\n /// Check that all new strategies refer to this vault and has the same underlying asset\\n function _beforeStrategyRegistered(IStrategy strategy) internal view override {\\n if (this != strategy.lender() || asset != strategy.asset()) {\\n revert InappropriateStrategy();\\n }\\n }\\n\\n /// @notice Sets the vault rewards address.\\n /// @param _rewards a new rewards address.\\n function setRewards(address _rewards) public onlyOwner {\\n rewards = _rewards;\\n }\\n\\n /// @notice Sets the vault management fee. Both management and foundersReward fee can't exceed 100%\\n /// @param _managementFee a new management fee value (in BPS).\\n function setManagementFee(uint256 _managementFee) public onlyOwner {\\n if (_managementFee + foundersFee > MAX_BPS) {\\n revert ExceededMaximumFeeValue();\\n }\\n\\n managementFee = _managementFee;\\n }\\n\\n /// @notice Sets the vault founder token contract;\\n /// @param _founders a new founder token contract address.\\n function setFounders(address _founders) external onlyOwner {\\n founders = _founders;\\n addDepositHook(IVaultHook(founders));\\n }\\n\\n /// @notice Sets the vault founder token reward rate. Both management and foundersReward fee can't exceed 100%\\n /// @param _foundersFee a new founder token reward fee (in BPS).\\n function setFoundersFee(uint256 _foundersFee) public onlyOwner {\\n if (_foundersFee + managementFee > MAX_BPS) {\\n revert ExceededMaximumFeeValue();\\n }\\n foundersFee = _foundersFee;\\n }\\n\\n /// @notice Changes the rate of release of locked-in profit.\\n /// @param rate the rate of release of locked profit (percent per second scaled to 1e18).\\n /// The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\\n function setLockedProfitReleaseRate(uint256 rate) public onlyOwner {\\n if (rate > LOCKED_PROFIT_RELEASE_SCALE) {\\n revert InvalidLockedProfitReleaseRate(rate);\\n }\\n\\n lockedProfitReleaseRate = rate;\\n emit LockedProfitReleaseRateChanged(rate);\\n }\\n\\n /// @notice Calculates the locked profit, takes into account the change since the last report.\\n function _lockedProfit() internal view returns (uint256) {\\n // Release rate should be small, since the timestamp can be manipulated by the node operator,\\n // not expected to have much impact, since the changes will be applied to all users and cannot be abused directly.\\n uint256 ratio = (block.timestamp - lastReportTimestamp) * lockedProfitReleaseRate; // solhint-disable-line not-rely-on-time\\n\\n // In case the ratio >= scale, the calculation anyway leads to zero.\\n if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) {\\n return 0;\\n }\\n\\n uint256 lockedProfitChange = (ratio * lockedProfitBaseline) / LOCKED_PROFIT_RELEASE_SCALE;\\n\\n // Reducing locked profits over time frees up profits for users\\n return lockedProfitBaseline - lockedProfitChange;\\n }\\n\\n /// @inheritdoc Lender\\n function _chargeFees(uint256 extraFreeFunds)\\n internal\\n override\\n returns (uint256)\\n {\\n uint256 fee = (extraFreeFunds * managementFee) / MAX_BPS;\\n if (fee > 0) {\\n _mint(rewards, convertToShares(fee), \\\"\\\", \\\"\\\", false);\\n }\\n if(founders == address(0)) {\\n return fee;\\n }\\n uint256 vaultFoundersReward = (extraFreeFunds * foundersFee) / MAX_BPS;\\n if (vaultFoundersReward > 0) {\\n _mint(founders, convertToShares(vaultFoundersReward), \\\"\\\", \\\"\\\", false);\\n }\\n return fee + vaultFoundersReward;\\n }\\n\\n /// @notice Updates the locked-in profit value according to the positive debt management report of the strategy\\n /// @inheritdoc Lender\\n function _afterPositiveDebtManagementReport(\\n uint256 extraFreeFunds,\\n uint256 chargedFees\\n ) internal override {\\n // Locking every reported strategy profit, taking into account the charged fees.\\n lockedProfitBaseline = _lockedProfit() + extraFreeFunds - chargedFees;\\n }\\n\\n /// @notice Updates the locked-in profit value according to the negative debt management report of the strategy\\n /// @inheritdoc Lender\\n function _afterNegativeDebtManagementReport(uint256 loss)\\n internal\\n override\\n {\\n uint256 currentLockedProfit = _lockedProfit();\\n\\n // If a loss occurs, it is necessary to release the appropriate amount of funds that users were able to withdraw it.\\n lockedProfitBaseline = currentLockedProfit > loss\\n ? currentLockedProfit - loss\\n : 0;\\n }\\n\\n /// @inheritdoc Lender\\n function _freeAssets() internal view override returns (uint256) {\\n return asset.balanceOf(address(this));\\n }\\n\\n /// @inheritdoc Lender\\n function _borrowerFreeAssets(address borrower)\\n internal\\n view\\n override\\n returns (uint256)\\n {\\n return asset.balanceOf(borrower);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function totalAssets() public view override(ERC4626Upgradeable, IERC4626) returns (uint256) {\\n return super.fundAssets() - _lockedProfit();\\n }\\n\\n /// @inheritdoc ILender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, StrategiesLender)\\n returns (bool)\\n {\\n return super.paused();\\n }\\n\\n /// @inheritdoc Lender\\n function _transferFundsToBorrower(address borrower, uint256 amount)\\n internal\\n override\\n {\\n asset.safeTransfer(borrower, amount);\\n }\\n\\n /// @inheritdoc Lender\\n function _takeFundsFromBorrower(address borrower, uint256 amount)\\n internal\\n override\\n {\\n asset.safeTransferFrom(borrower, address(this), amount);\\n }\\n\\n function afterDeposit(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\\n SafeERC4626Lifecycle.afterDeposit(assets, shares);\\n }\\n}\\n\",\"keccak256\":\"0xeb730bdd8c21a7eb7c8e213588b4d5ec364bb3a5e48adbbe909eaf99c1ef01c2\",\"license\":\"AGPL-3.0\"},\"src/lending/ILender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\n/// Base contract for lending protocols, can be used for colletaralized and not colletaralized lending.\\ninterface ILender {\\n\\n /// @notice Returns the number of tokens the borrower (caller of this function) can take from the lender\\n /// @return Available credit as amount of tokens\\n function availableCredit() external view returns (uint256);\\n\\n /// @notice Returns the outstanding debt that the borrower (caller of this function) must repay\\n /// @return Outstanding debt as amount of tokens\\n function outstandingDebt() external view returns (uint256);\\n\\n /// @notice Returns the amount of funds taken by the borrower (caller of this function).\\n /// @return Debt as amount of tokens\\n function currentDebt() external view returns (uint256);\\n\\n /// @notice Returns the debt ratio of the borrower (caller of this function).\\n function currentDebtRatio() external view returns (uint256);\\n\\n /// @notice Returns the last report timestamp of the borrower (caller of this function).\\n function lastReport() external view returns (uint256);\\n\\n /// @notice Returns the activation status of the borrower (caller of this function).\\n /// @return \\\"true\\\" if the borrower is active\\n function isActivated() external view returns (bool);\\n\\n /// @notice Indicates if the vault was shutted down or not.\\n /// @return \\\"true\\\" if the contract is paused, and \\\"false\\\" otherwise.\\n function paused() external view returns (bool);\\n\\n /// @notice Reports a positive result of the borrower's debt management.\\n /// Borrower must call this function if he has made any profit\\n /// or/and has a free funds available to repay the outstanding debt (if any).\\n /// @param extraFreeFunds an extra amount of free funds borrower's contract has.\\n /// This reporting amount must be greater than the borrower's outstanding debt.\\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\\n function reportPositiveDebtManagement(\\n uint256 extraFreeFunds,\\n uint256 debtPayment\\n ) external;\\n\\n /// @notice Reports a negative result of the borrower's debt management.\\n /// The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\\n /// May include a portion of the outstanding debt that the borrower was unable to repay.\\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\\n external;\\n}\\n\",\"keccak256\":\"0x5d79dc98497b5172dab5fb9184b1eb6531f4949e3435d273c1327fe4e14fb752\",\"license\":\"AGPL-3.0\"},\"src/lending/IStrategiesLender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {ILender} from \\\"./ILender.sol\\\";\\n\\n/// Lender contract which targeted to lend specifically for investments strategies.\\n/// Basically represent specific case of implementation of whitelist not colletaraized lending contract.\\ninterface IStrategiesLender is ILender {\\n\\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\\n function withdrawalQueue(uint256 index) external view returns (address);\\n\\n /// @notice Revokes a strategy from the vault.\\n /// Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\\n /// @param strategy a strategy to revoke.\\n function revokeStrategy(address strategy) external;\\n\\n /// @notice Returns average interst rate of lender per block. \\n /// Based on last report utilization rate and possibly cached interest rate of each strategy.\\n /// Can be outadated, but close enough to real state for on chain calculations.\\n /// Calculate average by combining utilisation rate of each strategy with its interest rate.\\n /// Returns additional total utilisation rate of lender, as additional product of calculation, usefull to safe gas.\\n /// @return interstRate - The interest rate per block, scaled by 1e18\\n /// @return utilisationRate - The utilisation rate of the lender, in BPS (scaled by 1e4)\\n function interestRatePerBlock() external view returns (uint256 interstRate, uint256 utilisationRate);\\n}\\n\",\"keccak256\":\"0xa70a854391820bf8c7314c9fffefd3e07cca320acd72bf4a539ea5fcd6637139\",\"license\":\"AGPL-3.0\"},\"src/lending/Lender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {MathUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\\\";\\nimport {PausableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport {ReentrancyGuardUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\n\\nimport {ILender} from \\\"./ILender.sol\\\";\\nimport {SafeInitializable} from \\\"../upgradeable/SafeInitializable.sol\\\";\\n\\nerror BorrowerAlreadyExists();\\nerror BorrowerDoesNotExist();\\nerror BorrowerHasDebt();\\nerror CallerIsNotABorrower();\\nerror LenderRatioExceeded(uint256 freeRatio);\\nerror FalsePositiveReport();\\n\\nabstract contract Lender is\\n ILender,\\n SafeInitializable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n struct BorrowerData {\\n /// Timestamp of the block in which the borrower was activated\\n uint256 activationTimestamp;\\n /// Last time a borrower made a report\\n uint256 lastReportTimestamp;\\n /// Amount of tokens taken by the borrower\\n uint256 debt;\\n /// Maximum portion of the loan that the borrower can take (in BPS)\\n /// Represents credibility of the borrower\\n uint256 debtRatio;\\n }\\n\\n uint256 public constant MAX_BPS = 10_000;\\n\\n /// @notice Amount of tokens that all borrowers have taken\\n uint256 public totalDebt;\\n\\n /// @notice Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\\n uint256 public debtRatio;\\n\\n /// @notice Last time a report occurred by any borrower\\n uint256 public lastReportTimestamp;\\n\\n /// @notice Records with information on each borrower using the lender's services\\n mapping(address => BorrowerData) public borrowersData;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /// @notice Event that must occur when the borrower reported the results of his debt management\\n /// @param borrower Borrower's contract address\\n /// @param debtPayment Amount of outstanding debt repaid by the borrower\\n /// @param freeFunds Free funds on the borrower's contract that remain after the debt is paid\\n /// @param fundsGiven Funds issued to the borrower by this lender\\n /// @param fundsTaken Funds that have been taken from the borrower by the lender\\n /// @param loss Amount of funds that the borrower realised as loss\\n event BorrowerDebtManagementReported(\\n address indexed borrower,\\n uint256 debtPayment,\\n uint256 freeFunds,\\n uint256 fundsGiven,\\n uint256 fundsTaken,\\n uint256 loss\\n );\\n\\n modifier onlyBorrowers() {\\n if (borrowersData[msg.sender].activationTimestamp == 0) {\\n revert CallerIsNotABorrower();\\n }\\n _;\\n }\\n\\n /// @notice Updates the last report timestamp for the specified borrower and this lender.\\n modifier updateLastReportTime() {\\n _;\\n borrowersData[msg.sender].lastReportTimestamp = lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n function __Lender_init() internal onlyInitializing {\\n __Pausable_init();\\n __ReentrancyGuard_init();\\n\\n __Lender_init_unchained();\\n }\\n\\n function __Lender_init_unchained() internal onlyInitializing {\\n lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /// @inheritdoc ILender\\n function availableCredit() external view override returns (uint256) {\\n return _availableCredit(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function outstandingDebt() external view override returns (uint256) {\\n return _outstandingDebt(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function currentDebt() external view override returns (uint256) {\\n return currentDebt(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function currentDebtRatio() external view override returns (uint256) {\\n return borrowersData[msg.sender].debt;\\n }\\n\\n /// @inheritdoc ILender\\n function isActivated() external view override returns (bool) {\\n return isActivated(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function lastReport() external view override returns (uint256) {\\n return lastReport(msg.sender);\\n }\\n\\n /// @inheritdoc ILender\\n function reportPositiveDebtManagement(\\n uint256 extraFreeFunds,\\n uint256 debtPayment\\n ) external override onlyBorrowers updateLastReportTime nonReentrant {\\n // Checking whether the borrower is telling the truth about his available funds\\n if (_borrowerFreeAssets(msg.sender) < extraFreeFunds + debtPayment) {\\n revert FalsePositiveReport();\\n }\\n\\n uint256 chargedFees = 0;\\n // We can only charge a fees if the borrower has reported extra free funds,\\n // if it's the first report at this block and only if the borrower was registered some time ago\\n if (\\n extraFreeFunds > 0 &&\\n borrowersData[msg.sender].lastReportTimestamp < block.timestamp && // solhint-disable-line not-rely-on-time\\n borrowersData[msg.sender].activationTimestamp < block.timestamp // solhint-disable-line not-rely-on-time\\n ) {\\n chargedFees = _chargeFees(extraFreeFunds);\\n }\\n\\n _rebalanceBorrowerFunds(msg.sender, debtPayment, extraFreeFunds, 0);\\n\\n _afterPositiveDebtManagementReport(extraFreeFunds, chargedFees);\\n }\\n\\n /// @inheritdoc ILender\\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\\n external\\n override\\n onlyBorrowers\\n updateLastReportTime\\n nonReentrant\\n {\\n // Checking whether the borrower has available funds for debt payment\\n require(_borrowerFreeAssets(msg.sender) >= debtPayment, \\\"Not enough assets for payment\\\");\\n\\n // Debt wasn't repaid, we need to decrease the ratio of this borrower\\n if (loss > 0) {\\n _decreaseBorrowerCredibility(msg.sender, loss);\\n }\\n\\n _rebalanceBorrowerFunds(msg.sender, debtPayment, 0, loss);\\n\\n _afterNegativeDebtManagementReport(loss);\\n }\\n\\n /// @notice Balances the borrower's account and adjusts the current amount of funds the borrower can take.\\n /// @param borrower a borrower's contract address.\\n /// @param debtPayment an amount of outstanding debt since the previous report, that the borrower managed to cover. Can be zero.\\n /// @param borrowerFreeFunds a funds that the borrower has earned since the previous report. Can be zero.\\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\\n function _rebalanceBorrowerFunds(\\n address borrower,\\n uint256 debtPayment,\\n uint256 borrowerFreeFunds,\\n uint256 loss\\n ) private {\\n // Calculate the amount of credit the lender can provide to the borrower (if any)\\n uint256 borrowerAvailableCredit = _availableCredit(borrower);\\n\\n // Make sure that the borrower's debt payment doesn't exceed his actual outstanding debt\\n uint256 borrowerOutstandingDebt = _outstandingDebt(msg.sender);\\n debtPayment = MathUpgradeable.min(debtPayment, borrowerOutstandingDebt);\\n\\n // Take into account repaid debt, if any\\n if (debtPayment > 0) {\\n borrowersData[borrower].debt -= debtPayment;\\n totalDebt -= debtPayment;\\n }\\n\\n // Allocate some funds to the borrower if possible\\n if (borrowerAvailableCredit > 0) {\\n borrowersData[borrower].debt += borrowerAvailableCredit;\\n totalDebt += borrowerAvailableCredit;\\n }\\n\\n // Now we need to compare the allocated funds to the borrower and his current free balance.\\n // If the number of unrealized tokens on the borrower's contract is less than the available credit, \\n // the lender must give that difference to the borrower.\\n // Otherwise (if the amount of the borrower's available funds is greater than \\n // he should have according to his share), the lender must take that portion of the funds for himself.\\n uint256 freeBorrowerBalance = borrowerFreeFunds + debtPayment;\\n uint256 fundsGiven = 0;\\n uint256 fundsTaken = 0;\\n if (freeBorrowerBalance < borrowerAvailableCredit) {\\n fundsGiven = borrowerAvailableCredit - freeBorrowerBalance;\\n _transferFundsToBorrower(borrower, fundsGiven);\\n } else if (freeBorrowerBalance > borrowerAvailableCredit) {\\n fundsTaken = freeBorrowerBalance - borrowerAvailableCredit;\\n _takeFundsFromBorrower(borrower, fundsTaken);\\n }\\n\\n emit BorrowerDebtManagementReported(\\n borrower,\\n debtPayment,\\n borrowerFreeFunds,\\n fundsGiven,\\n fundsTaken,\\n loss\\n );\\n }\\n\\n /// @notice Returns the unrealized amount of the lender's tokens (lender's contract balance)\\n function _freeAssets() internal view virtual returns (uint256);\\n\\n /// @notice Returns the unrealized amount of the borrower's tokens (contract balance of the specified borrower)\\n function _borrowerFreeAssets(address borrower)\\n internal\\n view\\n virtual\\n returns (uint256);\\n\\n /// @notice Transfers a specified amount of tokens to the borrower\\n function _transferFundsToBorrower(address borrower, uint256 amount)\\n internal\\n virtual;\\n\\n /// @notice Takes a specified amount of tokens from the borrower\\n function _takeFundsFromBorrower(address borrower, uint256 amount)\\n internal\\n virtual;\\n\\n /// @notice Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\\n function fundAssets() public view virtual returns (uint256) {\\n return _freeAssets() + totalDebt;\\n }\\n\\n /// @notice Returns the current debt that the strategy has.\\n function currentDebt(address borrower) public view returns (uint256) {\\n return borrowersData[borrower].debt;\\n }\\n\\n /// @notice Returns the activation status of the specified borrower.\\n function isActivated(address borrower) public view returns (bool) {\\n return borrowersData[borrower].activationTimestamp > 0;\\n }\\n\\n /// @notice Returns the last report timestamp of the specified borrower.\\n function lastReport(address borrower) public view returns (uint256) {\\n return borrowersData[borrower].lastReportTimestamp;\\n }\\n\\n /// @notice Returns the total number of tokens borrowers can take.\\n function _debtLimit() private view returns (uint256) {\\n return (debtRatio * fundAssets()) / MAX_BPS;\\n }\\n\\n /// @notice Lowers the borrower's debt he can take by specified loss and decreases his credibility.\\n /// @dev This function has \\\"internal\\\" visibility because it's used in tests.\\n function _decreaseBorrowerCredibility(address borrower, uint256 loss)\\n internal\\n {\\n uint256 debt = borrowersData[borrower].debt;\\n\\n // Make sure the borrower's loss is less than his entire debt\\n require(debt >= loss, \\\"Loss is greater than the debt\\\");\\n\\n // To decrease credibility of the borrower we should lower his \\\"debtRatio\\\"\\n if (debtRatio > 0) {\\n uint256 debtRatioChange = MathUpgradeable.min(\\n (debtRatio * loss) / totalDebt,\\n borrowersData[borrower].debtRatio\\n );\\n if (debtRatioChange != 0) {\\n borrowersData[borrower].debtRatio -= debtRatioChange;\\n debtRatio -= debtRatioChange;\\n }\\n }\\n\\n // Also, need to reduce the max amount of funds that can be taken by the borrower\\n borrowersData[borrower].debt -= loss;\\n totalDebt -= loss;\\n }\\n\\n /// @notice See external implementation\\n function _availableCredit(address borrower)\\n internal\\n view\\n returns (uint256)\\n {\\n // Lender is paused, no funds available for the borrower\\n if (paused()) {\\n return 0;\\n }\\n\\n uint256 lenderDebtLimit = _debtLimit();\\n uint256 lenderDebt = totalDebt;\\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\\n fundAssets()) / MAX_BPS;\\n uint256 borrowerDebt = borrowersData[borrower].debt;\\n\\n // There're no more funds for the borrower because he has outstanding debt or the lender's available funds have been exhausted\\n if (\\n lenderDebtLimit <= lenderDebt || borrowerDebtLimit <= borrowerDebt\\n ) {\\n return 0;\\n }\\n\\n uint256 lenderAvailableFunds = lenderDebtLimit - lenderDebt;\\n uint256 borrowerIntendedCredit = borrowerDebtLimit - borrowerDebt;\\n\\n // Borrower may not take more funds than the lender's limit\\n uint256 borrowerAvailableCredit = MathUpgradeable.min(\\n lenderAvailableFunds,\\n borrowerIntendedCredit\\n );\\n\\n // Available credit is limited by the existing number of tokens on the lender's contract\\n borrowerAvailableCredit = MathUpgradeable.min(\\n borrowerAvailableCredit,\\n _freeAssets()\\n );\\n\\n return borrowerAvailableCredit;\\n }\\n\\n /// @notice See external implementation\\n function _outstandingDebt(address borrower)\\n internal\\n view\\n returns (uint256)\\n {\\n uint256 borrowerDebt = borrowersData[borrower].debt;\\n if (paused() || debtRatio == 0) {\\n return borrowerDebt;\\n }\\n\\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\\n fundAssets()) / MAX_BPS;\\n if (borrowerDebt <= borrowerDebtLimit) {\\n return 0;\\n }\\n\\n return borrowerDebt - borrowerDebtLimit;\\n }\\n\\n /// @notice Registers a new borrower and sets for him a certain debt ratio\\n function _registerBorrower(address borrower, uint256 borrowerDebtRatio)\\n internal\\n {\\n // Check if specified borrower has already registered\\n if (isActivated(borrower)) {\\n revert BorrowerAlreadyExists();\\n }\\n\\n if (debtRatio + borrowerDebtRatio > MAX_BPS) {\\n revert LenderRatioExceeded(MAX_BPS - debtRatio);\\n }\\n\\n borrowersData[borrower] = BorrowerData(\\n // Activation timestamp \\n block.timestamp, // solhint-disable-line not-rely-on-time\\n // Last report timestamp\\n block.timestamp, // solhint-disable-line not-rely-on-time\\n // Initial debt\\n 0, \\n // Debt ratio\\n borrowerDebtRatio \\n );\\n\\n debtRatio += borrowerDebtRatio;\\n }\\n\\n /// @notice Sets the borrower's debt ratio. Will be reverted if the borrower doesn't exist or the total debt ratio is exceeded.\\n /// @dev In the case where you want to disable the borrower, you need to set its ratio to 0.\\n /// Thus, the borrower's current debt becomes an outstanding debt, which he must repay to the lender.\\n function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)\\n internal\\n {\\n if (!isActivated(borrower)) {\\n revert BorrowerDoesNotExist();\\n }\\n\\n debtRatio -= borrowersData[borrower].debtRatio;\\n borrowersData[borrower].debtRatio = borrowerDebtRatio;\\n debtRatio += borrowerDebtRatio;\\n\\n if (debtRatio > MAX_BPS) {\\n revert LenderRatioExceeded(\\n MAX_BPS - (debtRatio - borrowerDebtRatio)\\n );\\n }\\n }\\n\\n /// @notice Deletes the borrower from the list\\n /// @dev Should be called after the borrower's debt ratio is changed to 0, because the lender must take back all the released funds.\\n function _unregisterBorrower(address borrower) internal {\\n if (borrowersData[borrower].debtRatio > 0) {\\n revert BorrowerHasDebt();\\n }\\n delete borrowersData[borrower];\\n }\\n\\n /// Calculate utilisation rate for specific borrower\\n /// @notice Based on last report data, can be outdated, but close to latest state of fund\\n /// @return percent of total assets taken by strategy in BPS\\n function utilizationRate(address borrower) public virtual view returns (uint256) {\\n // assets in vault + amount lent to strategies\\n uint256 _fundAssets = fundAssets(); \\n // to decrease amount of calls to borrower contract,\\n // assume that borrower have same amount like in last update\\n uint256 borrowerAssets = borrowersData[borrower].debt; \\n\\n if (_fundAssets == 0) {\\n return 0;\\n }\\n\\n return borrowerAssets * MAX_BPS / _fundAssets;\\n }\\n\\n /// @notice Charges a fee on the borrower's income.\\n /// @param extraFreeFunds an income from which the fees will be calculated.\\n /// @return The total amount of fees charged.\\n function _chargeFees(uint256 extraFreeFunds)\\n internal\\n virtual\\n returns (uint256);\\n\\n /// @notice Callback that is called at the end of the positive report function.\\n /// @param extraFreeFunds the reported extra amount of borrower's funds.\\n /// @param chargedFees the total amount of charged fees.\\n function _afterPositiveDebtManagementReport(\\n uint256 extraFreeFunds,\\n uint256 chargedFees\\n ) internal virtual;\\n\\n /// @notice Callback that is called at the end of the negative report function.\\n /// @param loss the number of tokens by which the borrower's balance has decreased since the last report.\\n function _afterNegativeDebtManagementReport(uint256 loss) internal virtual;\\n\\n /// @inheritdoc ILender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, PausableUpgradeable)\\n virtual\\n returns (bool)\\n {\\n return super.paused();\\n }\\n}\\n\",\"keccak256\":\"0x0d7afe11c9c01322013f677cdd5934f2086d90dcd2344748440a74746800f903\",\"license\":\"AGPL-3.0\"},\"src/lending/StrategiesLender.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\nimport {Lender, BorrowerDoesNotExist} from \\\"./Lender.sol\\\";\\nimport {ILender} from \\\"./ILender.sol\\\";\\nimport {IStrategiesLender} from \\\"./IStrategiesLender.sol\\\";\\nimport {IStrategy} from \\\"../strategies/IStrategy.sol\\\";\\nimport {AddressList} from \\\"../structures/AddressList.sol\\\";\\n\\nerror UnexpectedZeroAddress();\\nerror StrategyNotFound();\\nerror StrategyAlreadyExists();\\nerror AccessDeniedForCaller(address caller);\\n\\n/// Lender contract which targeted to lend specifically for investments strategies.\\n/// Basically represent specific case of implementation of whitelist not colletaraized lending contract.\\nabstract contract StrategiesLender is IStrategiesLender, Lender, OwnableUpgradeable {\\n\\n using AddressList for address[];\\n\\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\\n address[] public withdrawalQueue;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[50] private __gap;\\n\\n /// @notice Event that should happen when the strategy connects to the vault.\\n /// @param strategy Address of the strategy contract.\\n /// @param debtRatio Maximum portion of the loan that the strategy can take (in BPS).\\n event StrategyAdded(address indexed strategy, uint256 debtRatio);\\n\\n /// @notice Event that should happen when the strategy has been revoked from the vault.\\n /// @param strategy Address of the strategy contract.\\n event StrategyRevoked(address indexed strategy);\\n\\n /// @notice Event that should happen when the strategy has been removed from the vault.\\n /// @param strategy Address of the strategy contract.\\n /// @param fromQueueOnly If \\\"true\\\", then the strategy has only been removed from the withdrawal queue.\\n event StrategyRemoved(address indexed strategy, bool fromQueueOnly);\\n\\n /// @notice Event that should happen when the strategy has been returned to the withdrawal queue.\\n /// @param strategy Address of the strategy contract.\\n event StrategyReturnedToQueue(address indexed strategy);\\n\\n modifier onlyOwnerOrStrategy(address strategy) {\\n if (msg.sender != owner() && msg.sender != strategy) {\\n revert AccessDeniedForCaller(msg.sender);\\n }\\n _;\\n }\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n function __StrategiesLender_init() internal onlyInitializing {\\n __Ownable_init();\\n\\n __StrategiesLender_init_lenderSpecific();\\n }\\n\\n /// Init only direct constructors of business logic, ignore Ownable and simular common contracts\\n function __StrategiesLender_init_lenderSpecific() internal onlyInitializing {\\n require(owner() != address(0), \\\"StrategiesLender must be ownable\\\");\\n\\n __Lender_init();\\n }\\n\\n /// @notice Switches the vault pause state.\\n /// @param shutdown a new vault pause state. If \\\"true\\\" is passed, the vault will be paused.\\n function setEmergencyShutdown(bool shutdown) external onlyOwner {\\n shutdown ? _pause() : _unpause();\\n }\\n\\n /// @notice Returns the current debt of the strategy.\\n /// @param strategy the strategy address.\\n function strategyDebt(address strategy) external view returns (uint256) {\\n return borrowersData[strategy].debt;\\n }\\n\\n /// @notice Returns the debt ratio of the strategy.\\n /// @param strategy the strategy address.\\n function strategyRatio(address strategy) external view returns (uint256) {\\n return borrowersData[strategy].debtRatio;\\n }\\n\\n /// @notice Adds a new strategy to the vault.\\n /// @param strategy a new strategy address.\\n /// @param debtRatio a ratio that shows how much of the new strategy can take, relative to other strategies.\\n function addStrategy(address strategy, uint256 debtRatio)\\n external\\n onlyOwner\\n whenNotPaused\\n {\\n if (strategy == address(0)) {\\n revert UnexpectedZeroAddress();\\n }\\n \\n _beforeStrategyRegistered(IStrategy(strategy));\\n\\n _registerBorrower(strategy, debtRatio);\\n withdrawalQueue.add(strategy);\\n\\n emit StrategyAdded(strategy, debtRatio);\\n }\\n\\n /// Allow check strategy complience before it added\\n function _beforeStrategyRegistered(IStrategy strategy) internal virtual;\\n\\n /// @notice Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\\n /// @param strategy a strategy address.\\n function addStrategyToQueue(address strategy) external onlyOwner {\\n if (strategy == address(0)) {\\n revert UnexpectedZeroAddress();\\n }\\n\\n if (withdrawalQueue.contains(strategy)) {\\n revert StrategyAlreadyExists();\\n }\\n\\n if (borrowersData[strategy].activationTimestamp == 0) {\\n revert BorrowerDoesNotExist();\\n }\\n\\n withdrawalQueue.add(strategy);\\n\\n emit StrategyReturnedToQueue(strategy);\\n }\\n\\n /// @inheritdoc IStrategiesLender\\n function revokeStrategy(address strategy)\\n external\\n onlyOwnerOrStrategy(strategy)\\n {\\n _setBorrowerDebtRatio(strategy, 0);\\n emit StrategyRevoked(strategy);\\n }\\n\\n /// @notice Removes a strategy from the vault.\\n /// @param strategy a strategy to remove.\\n /// @param fromQueueOnly if \\\"true\\\", then the strategy will only be removed from the withdrawal queue.\\n function removeStrategy(address strategy, bool fromQueueOnly)\\n external\\n onlyOwner\\n {\\n bool removedFromQueue = withdrawalQueue.remove(strategy);\\n if (!removedFromQueue) {\\n revert StrategyNotFound();\\n }\\n\\n if (!fromQueueOnly) {\\n _unregisterBorrower(strategy);\\n }\\n\\n emit StrategyRemoved(strategy, fromQueueOnly);\\n }\\n\\n /// @notice Sets the withdrawal queue.\\n /// @param queue a new queue that will replace the existing one.\\n /// Should contain only those elements that already present in the existing queue.\\n function reorderWithdrawalQueue(address[] memory queue) external onlyOwner {\\n withdrawalQueue = withdrawalQueue.reorder(queue);\\n }\\n\\n /// @notice Returns the size of the withdrawal queue.\\n function getQueueSize() external view returns (uint256) {\\n return withdrawalQueue.length;\\n }\\n \\n /// @inheritdoc IStrategiesLender\\n function interestRatePerBlock() public view returns (uint256, uint256) {\\n uint256 totalUtilisationRate;\\n uint256 totalInterestRate;\\n\\n if(totalDebt == 0) {\\n return (0, 0);\\n }\\n\\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\\n IStrategy strategy = IStrategy(withdrawalQueue[i]);\\n\\n uint256 utilisationRate = utilizationRate(address(strategy)); // in BPS\\n totalUtilisationRate += utilisationRate;\\n \\n // interest rate scaled by 1e18\\n // utilisation rate in BPS * interest rate scaled by 1e18 / BPS = total interest rate scaled by 1e18\\n totalInterestRate += utilisationRate * strategy.interestRatePerBlock() / MAX_BPS; \\n }\\n\\n // sanity check\\n if (totalUtilisationRate == 0) {\\n return (0, 0);\\n }\\n\\n return (totalInterestRate, totalUtilisationRate);\\n }\\n\\n /// @inheritdoc Lender\\n /// @dev Explicitly overridden here to keep this function exposed via \\\"ILender\\\" interface.\\n function paused()\\n public\\n view\\n override(ILender, Lender)\\n virtual\\n returns (bool)\\n {\\n return super.paused();\\n }\\n\\n}\",\"keccak256\":\"0x610e7cb1848bc5c1808a2444e825ce280e645321c9b4aea2032b0b1ea305b7ce\",\"license\":\"AGPL-3.0\"},\"src/strategies/IStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {IStrategiesLender} from \\\"../lending/IStrategiesLender.sol\\\";\\n\\ninterface IStrategy {\\n /// @notice Returns the name of this strategy.\\n function name() external view returns (string memory);\\n\\n /// @notice Returns the contract address of the underlying asset of this strategy.\\n function asset() external view returns (IERC20Upgradeable);\\n\\n /// @notice Returns the contract address of the Lender to which this strategy is connected.\\n function lender() external view returns (IStrategiesLender);\\n\\n /// @notice Transfers a specified amount of tokens to the vault.\\n /// @param assets A amount of tokens to withdraw.\\n /// @return loss A number of tokens that the strategy could not return.\\n function withdraw(uint256 assets) external returns (uint256 loss);\\n\\n /// @notice Returns interst rate of strategy per block, for current block or block prior to this one.\\n /// @dev Can be calculated not for all strategies and usally not such accurate as sliding window averages,\\n /// but still can be usafull for on chain calculations and as fallback method.\\n /// @return The interest rate per block, scaled by 1e18\\n function interestRatePerBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xc22f6bf472cc43d96347263eeb615d0b57ef02395bbe303ccd2981d4beadcbfd\",\"license\":\"AGPL-3.0\"},\"src/structures/AddressList.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nerror ListsDoNotMatch();\\n\\nlibrary AddressList {\\n /// @notice Adds an address to the list.\\n /// @param list the list of addresses.\\n /// @param addr the address to add.\\n function add(address[] storage list, address addr) internal {\\n list.push(addr);\\n }\\n\\n /// @notice Checks if the list contains the specified item.\\n /// @param list the list of addresses.\\n /// @param addr the address to find.\\n function contains(address[] storage list, address addr)\\n internal\\n view\\n returns (bool)\\n {\\n for (uint256 i = 0; i < list.length; i++) {\\n if (list[i] == addr) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /// @notice Removes an address from the list and fills the gap with the following items by moving them up.\\n /// @param list the list of addresses.\\n /// @param addr the address to remove.\\n /// @return A boolean value that indicates if the address was found and removed from the list.\\n function remove(address[] storage list, address addr)\\n internal\\n returns (bool)\\n {\\n bool addressFound;\\n for (uint256 i = 0; i < list.length; i++) {\\n if (list[i] == addr) {\\n addressFound = true;\\n }\\n if (addressFound && i < list.length - 1) {\\n list[i] = list[i + 1];\\n }\\n }\\n if (addressFound) {\\n list.pop();\\n }\\n return addressFound;\\n }\\n\\n /// @notice Checks if the list can be reordered in the specified way.\\n /// @param list the list of addresses.\\n /// @param reoderedList the desired reordered list, which must have the same content as the existing list.\\n /// @return A reordered list\\n function reorder(address[] storage list, address[] memory reoderedList)\\n internal\\n view\\n returns (address[] memory)\\n {\\n uint256 length = list.length;\\n if (length != reoderedList.length) {\\n revert ListsDoNotMatch();\\n }\\n for (uint256 i = 0; i < length; i++) {\\n address existingAddress = list[i];\\n for (uint256 j = 0; j < length; j++) {\\n // Address is found, move to the next item\\n if (existingAddress == reoderedList[j]) {\\n break;\\n }\\n // If this is the last iteration, then the address is not found\\n if (j == length - 1) {\\n revert ListsDoNotMatch();\\n }\\n }\\n }\\n return reoderedList;\\n }\\n}\\n\",\"keccak256\":\"0x6d1ba8d87163661acbb468bcfdd3339d7b23f20866e6bd62546a69b81d3c16df\",\"license\":\"AGPL-3.0\"},\"src/tokens/ERC4626Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {ERC777Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\\\";\\nimport {ReentrancyGuardUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\nimport {FixedPointMathLib} from \\\"solmate/utils/FixedPointMathLib.sol\\\";\\n\\nimport {IERC4626} from \\\"./IERC4626.sol\\\";\\nimport {SafeInitializable} from \\\"../upgradeable/SafeInitializable.sol\\\";\\n\\n/// @title ERC4626 upgradable tokenized Vault implementation based on ERC-777.\\n/// More info in [EIP](https://eips.ethereum.org/EIPS/eip-4626)\\n/// Based on Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/mixins/ERC4626.sol)\\n///\\n/// ERC-777 and ERC-20 tokens represent \\\"shares\\\"\\n/// Vault \\u201cshares\\u201d which represent a claim to ownership on a fraction of the Vault\\u2019s underlying holdings.\\n/// -\\n/// @notice Rationale\\n/// The mint method was included for symmetry and feature completeness.\\n/// Most current use cases of share-based Vaults do not ascribe special meaning to the shares\\n/// such that a user would optimize for a specific number of shares (mint)\\n/// rather than specific amount of underlying (deposit).\\n/// However, it is easy to imagine future Vault strategies which would have unique\\n/// and independently useful share representations.\\n/// The convertTo functions serve as rough estimates that do not account for operation specific details\\n/// like withdrawal fees, etc. They were included for frontends and applications that need an average\\n/// value of shares or assets, not an exact value possibly including slippage or other fees.\\n/// For applications that need an exact value that attempts to account for fees and slippage we have\\n/// included a corresponding preview function to match each mutable function.\\n/// These functions must not account for deposit or withdrawal limits, to ensure they are easily composable,\\n/// the max functions are provided for that purpose.\\nabstract contract ERC4626Upgradeable is\\n SafeInitializable,\\n ERC777Upgradeable,\\n ReentrancyGuardUpgradeable,\\n IERC4626\\n{\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n using FixedPointMathLib for uint256;\\n\\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n IERC20Upgradeable public asset;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n /**\\n * Constructor for the ERC4626Upgradeable contract\\n * @param _asset which will be stored in this Vault\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __ERC4626_init(\\n IERC20Upgradeable _asset,\\n string memory name_,\\n string memory symbol_,\\n address[] memory defaultOperators_\\n ) internal onlyInitializing {\\n __ERC777_init(name_, symbol_, defaultOperators_);\\n __ReentrancyGuard_init();\\n\\n __ERC4626_init_unchained(_asset);\\n }\\n\\n /**\\n * Unchained constructor for the ERC4626Upgradeable contract, without parents contracts init\\n * @param _asset which will be stored in this Vault\\n */\\n function __ERC4626_init_unchained(IERC20Upgradeable _asset)\\n internal\\n onlyInitializing\\n {\\n asset = _asset;\\n }\\n\\n /* ///////////////////////////// DEPOSIT / WITHDRAWAL ///////////////////////////// */\\n\\n /// @notice Mints Vault shares to receiver by depositing exactly amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage,\\n /// the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function deposit(uint256 assets, address receiver)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n shares = previewDeposit(assets);\\n // Check for rounding error since we round down in previewDeposit.\\n require(shares != 0, \\\"Given assets result in 0 shares.\\\");\\n\\n _receiveAndDeposit(assets, shares, receiver);\\n }\\n\\n /// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function mint(uint256 shares, address receiver)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n // No need to check for rounding error, previewMint rounds up.\\n assets = previewMint(shares);\\n\\n _receiveAndDeposit(assets, shares, receiver);\\n }\\n\\n /// @notice Base deposit logic which common for public deposit and mint function\\n /// Trasfer assets from sender and mint shares for receiver\\n function _receiveAndDeposit(\\n uint256 assets,\\n uint256 shares,\\n address receiver\\n ) internal {\\n // cases when msg.sender != receiver are error prone\\n // but they are allowed by the standard... we need take care of it ourselves\\n\\n // Need to transfer before minting or ERC777s could reenter.\\n asset.safeTransferFrom(msg.sender, address(this), assets);\\n\\n _mint(receiver, shares, \\\"\\\", \\\"\\\");\\n\\n emit Deposit(msg.sender, receiver, assets, shares);\\n\\n afterDeposit(assets, shares);\\n }\\n\\n /// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n /// - emit the Withdraw event.\\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - support a withdraw flow where the shares are burned from owner directly where msg.sender\\n /// has ERC-20 approval over the shares of owner.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the withdraw execution, and are accounted for during withdraw.\\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) public virtual nonReentrant returns (uint256 shares) {\\n // No need to check for rounding error, previewWithdraw rounds up.\\n shares = previewWithdraw(assets);\\n\\n _withdrawAndSend(assets, shares, receiver, owner);\\n }\\n\\n /// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n /// - emit the Withdraw event.\\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - support a redeem flow where the shares are burned from owner directly where msg.sender\\n /// has ERC-20 approval over the shares of owner.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the redeem execution, and are accounted for during redeem.\\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) public virtual nonReentrant returns (uint256 assets) {\\n assets = previewRedeem(shares);\\n // Check for rounding error since we round down in previewRedeem.\\n require(assets != 0, \\\"Given shares result in 0 assets.\\\");\\n\\n _withdrawAndSend(assets, shares, receiver, owner);\\n }\\n\\n /// @notice Burn owner shares and send tokens to receiver.\\n function _withdrawAndSend(\\n uint256 assets,\\n uint256 shares,\\n address receiver,\\n address owner\\n ) internal {\\n // cases when msg.sender != receiver != owner is error prune\\n // but they allowed by standard... take care of it by self\\n if (msg.sender != owner) {\\n _spendAllowance(owner, msg.sender, shares);\\n }\\n\\n beforeWithdraw(assets, shares);\\n\\n _burn(owner, shares, \\\"\\\", \\\"\\\");\\n\\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\\n\\n asset.safeTransfer(receiver, assets);\\n }\\n\\n /* ///////////////////////////// ACCOUNTING ///////////////////////////// */\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block,\\n /// given current on-chain conditions.\\n /// - return as close to and no more than the exact amount of Vault shares that would be minted\\n /// in a deposit call in the same transaction.\\n /// I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction.\\n /// - NOT account for deposit limits like those returned from maxDeposit\\n /// and should always act as though the deposit would be accepted,\\n /// regardless if the user has enough tokens approved, etc.\\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n /// - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert.\\n /// Note that any unfavorable discrepancy between convertToShares and previewDeposit\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by depositing.\\n function previewDeposit(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n return convertToShares(assets);\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block,\\n /// given current on-chain conditions.\\n /// - return as close to and no fewer than the exact amount of assets that would be deposited\\n /// in a mint call in the same transaction.\\n /// I.e. mint should return the same or fewer assets as previewMint if called in the same transaction.\\n /// - NOT account for mint limits like those returned from maxMint\\n /// and should always act as though the mint would be accepted,\\n /// regardless if the user has enough tokens approved, etc.\\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause mint to revert.\\n /// Note that any unfavorable discrepancy between convertToAssets and previewMint\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by minting.\\n function previewMint(uint256 shares) public view virtual returns (uint256) {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return shares;\\n }\\n\\n return shares.mulDivUp(totalAssets(), supply);\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal\\n /// at the current block, given current on-chain conditions.\\n /// - return as close to and no fewer than the exact amount of Vault shares\\n /// that would be burned in a withdraw call in the same transaction.\\n /// I.e. withdraw should return the same or fewer shares as previewWithdraw\\n /// if called in the same transaction.\\n /// - NOT account for withdrawal limits like those returned from maxWithdraw\\n /// and should always act as though the withdrawal would be accepted,\\n /// regardless if the user has enough shares, etc.\\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause withdraw to revert.\\n /// Note that any unfavorable discrepancy between convertToShares and previewWithdraw\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by depositing.\\n function previewWithdraw(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return assets;\\n }\\n return assets.mulDivUp(supply, totalAssets());\\n }\\n\\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their\\n /// redeemption at the current block, given current on-chain conditions.\\n /// - return as close to and no more than the exact amount of assets that would be withdrawn\\n /// in a redeem call in the same transaction.\\n /// I.e. redeem should return the same or more assets as previewRedeem\\n /// if called in the same transaction.\\n /// - NOT account for redemption limits like those returned from maxRedeem\\n /// and should always act as though the redemption would be accepted,\\n /// regardless if the user has enough shares, etc.\\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n /// - NOT revert due to vault specific user/global limits.\\n /// MAY revert due to other conditions that would also cause redeem to revert.\\n /// Note that any unfavorable discrepancy between convertToAssets and previewRedeem\\n /// SHOULD be considered slippage in share price or some other type of condition,\\n /// meaning the depositor will lose assets by redeeming.\\n function previewRedeem(uint256 shares)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n return convertToAssets(shares);\\n }\\n\\n /// @notice The amount of shares that the Vault would exchange for the amount of assets provided,\\n /// in an ideal scenario where all the conditions are met.\\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\\n /// - do NOT show any variations depending on the caller.\\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\\n /// - round down towards 0.\\n /// This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share,\\n /// and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share,\\n /// meaning what the average user should expect to see when exchanging to and from.\\n function convertToShares(uint256 assets)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return assets;\\n }\\n\\n return assets.mulDivDown(supply, totalAssets());\\n }\\n\\n /// @notice The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.\\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\\n /// - do NOT show any variations depending on the caller.\\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\\n /// - round down towards 0.\\n /// This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share,\\n /// and instead should reflect the \\u201caverage-user\\u2019s\\u201d price-per-share,\\n /// meaning what the average user should expect to see when exchanging to and from.\\n function convertToAssets(uint256 shares)\\n public\\n view\\n virtual\\n returns (uint256)\\n {\\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\\n if (supply == 0) {\\n return shares;\\n }\\n\\n return shares.mulDivDown(totalAssets(), supply);\\n }\\n\\n /// @notice Total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n /// - include any compounding that occurs from yield.\\n /// - inclusive of any fees that are charged against assets in the Vault.\\n /// - is NOT revert\\n /// @dev Must be implemented by child contract.\\n function totalAssets() public view virtual returns (uint256);\\n\\n /* //////////////////////////////// DEPOSIT / WITHDRAWAL LIMIT //////////////////////////////// */\\n\\n /// @notice Maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n /// through a deposit call.\\n /// - returns the maximum amount of assets deposit would allow to be deposited\\n /// for receiver and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\\n /// - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.\\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n function maxDeposit(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n /// @notice Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call.\\n /// - return the maximum amount of shares mint would allow to be deposited to receiver\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\\n /// - factor in both global and user-specific limits,\\n /// like if mints are entirely disabled (even temporarily) it MUST return 0.\\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n function maxMint(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n /// @notice Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault,\\n /// through a withdraw call.\\n /// - return the maximum amount of assets that could be transferred from owner through withdraw\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// - factor in both global and user-specific limits,\\n /// like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\\n function maxWithdraw(address owner) public view virtual returns (uint256) {\\n return convertToAssets(balanceOf(owner));\\n }\\n\\n /// @notice Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n /// through a redeem call.\\n /// - return the maximum amount of shares that could be transferred from owner through redeem\\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\\n /// that would be accepted (it should underestimate if necessary).\\n /// - factor in both global and user-specific limits,\\n /// like if redemption is entirely disabled (even temporarily) it MUST return 0.\\n function maxRedeem(address owner) public view virtual returns (uint256) {\\n return balanceOf(owner);\\n }\\n\\n /* //////////////////////////////// INTERNAL HOOKS //////////////////////////////// */\\n\\n /// @notice Called before withdraw will be made the Vault.\\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\\n\\n /// @notice Called when a deposit is made to the Vault.\\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\\n}\\n\",\"keccak256\":\"0x48f7146146afdf654bcc6b1208c7855e45f6c45b0cd4f93dd4700894432a455e\",\"license\":\"AGPL-3.0\"},\"src/tokens/ERC5484Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {ERC721EnumerableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\\\";\\nimport {ERC721URIStorageUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\\\";\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {IAccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {CountersUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\\\";\\nimport {IERC5484} from \\\"./IERC5484.sol\\\";\\n\\ncontract ERC5484Upgradeable is\\n IERC5484,\\n Initializable,\\n ERC721Upgradeable,\\n ERC721EnumerableUpgradeable,\\n ERC721URIStorageUpgradeable,\\n AccessControlUpgradeable\\n{\\n using CountersUpgradeable for CountersUpgradeable.Counter;\\n\\n // @dev utility object for counting tokens\\n CountersUpgradeable.Counter private _tokenIdCounter;\\n\\n /// @dev burn mode with different behavior\\n BurnAuth private _burnAuth;\\n\\n /// @dev Token can me minted only once per user\\n bool private _mintOnce;\\n\\n /// @dev Role for minting tokens\\n /// value is 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6\\n bytes32 public constant MINTER_ROLE = keccak256(\\\"MINTER_ROLE\\\");\\n /// @dev Role for burning tokens which can be used only if _burnAuth isn't BurnAuth.None\\n /// value is 0x3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848\\n bytes32 public constant BURNER_ROLE = keccak256(\\\"BURNER_ROLE\\\");\\n\\n /// @dev Modifier to protect a burn a token without permission\\n modifier allowedTransfer(address to, address from, uint256 tokenId) {\\n bool isMint = from == address(0);\\n bool isBurner = hasRole(BURNER_ROLE, msg.sender);\\n bool isBurn = !isMint && to == address(0);\\n if(_burnAuth == BurnAuth.Neither) {\\n // nobody can burn token\\n require(isMint, \\\"ERC5484: can't be transferred\\\");\\n } else if(_burnAuth == BurnAuth.IssuerOnly) {\\n // only issuer can burn token\\n // so we are checking if token is generation with condition from == address(0)\\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\\n bool isBurnOperation = isBurner && isBurn;\\n require(isMint || isBurnOperation, \\\"ERC5484: can't be transferred\\\");\\n } else if (_burnAuth == BurnAuth.OwnerOnly){\\n // only owner can burn token\\n // so we are checking if token is generation with condition from == ownerOf(tokenId) and it is burn operation\\n bool isOwner = _ownerOf(tokenId) == msg.sender && hasRole(BURNER_ROLE, msg.sender);\\n require(isMint || (isOwner && isBurn), \\\"ERC5484: can't be transferred\\\");\\n } else if (_burnAuth == BurnAuth.Both) {\\n // both owner and issuer can burn token\\n // so we are checking if token is minting with condition from == address(0)\\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\\n require(isMint || (isBurn && isBurner), \\\"ERC5484: can't be transferred\\\");\\n }\\n _;\\n }\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n function __ERC5484Upgradeable_init(\\n string memory name_,\\n string memory symbol_,\\n BurnAuth burnAuth_,\\n bool mintOnce_\\n ) internal onlyInitializing {\\n __ERC721_init(name_, symbol_);\\n __ERC721Enumerable_init();\\n __ERC721URIStorage_init();\\n __AccessControl_init();\\n _burnAuth = burnAuth_;\\n _mintOnce = mintOnce_;\\n\\n // setup roles depend on mode for SoulBound token\\n _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\\n }\\n\\n /// @dev function for mint new SBT token\\n /// @param to address of user who will receive token\\n /// @param uri token metadata uri\\n /// @return true if token was minted\\n function safeMint(address to, string memory uri)\\n public\\n virtual\\n onlyRole(MINTER_ROLE)\\n returns(bool)\\n {\\n // allow to mint only once per user if _mintOnce is true\\n if(_mintOnce && balanceOf(to) != 0) {\\n return false;\\n }\\n\\n // mint token\\n uint256 tokenId = _tokenIdCounter.current();\\n _tokenIdCounter.increment();\\n _safeMint(to, tokenId);\\n _setTokenURI(tokenId, uri);\\n\\n // set permission to burn token\\n if(_burnAuth == BurnAuth.OwnerOnly || _burnAuth == BurnAuth.Both) {\\n _setupRole(BURNER_ROLE, to);\\n }\\n\\n // emit event\\n emit Issued(address(0), to, tokenId, _burnAuth);\\n return true;\\n }\\n\\n /// @dev Token is SOUL BOUND and it is not allowed to move token between users\\n function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)\\n internal\\n virtual\\n allowedTransfer(to, from, tokenId)\\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\\n {\\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\\n }\\n\\n /// @dev Burns `tokenId`. See {ERC721-_burn}.\\n function burn(uint256 tokenId) external\\n onlyRole(BURNER_ROLE)\\n virtual\\n {\\n _burn(tokenId);\\n }\\n\\n /// @dev See {ERC721-_burn}\\n function _burn(uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable){\\n super._burn(tokenId);\\n }\\n\\n /// @dev See {IERC721Metadata-tokenURI}.\\n function tokenURI(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable)\\n returns (string memory)\\n {\\n return super.tokenURI(tokenId);\\n }\\n\\n /// @dev See {IERC165-supportsInterface}.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable, AccessControlUpgradeable)\\n virtual\\n returns (bool)\\n {\\n return interfaceId == type(IERC5484).interfaceId\\n || interfaceId == type(IAccessControlUpgradeable).interfaceId\\n || super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice provides burn authorization of the token id.\\n /// @dev unassigned tokenIds are invalid, and queries do throw\\n /// @param tokenId The identifier for a token.\\n function burnAuth(uint256 tokenId) external view virtual returns (BurnAuth){\\n require(_exists(tokenId), \\\"ERC5484: token doesn't exists\\\");\\n return _burnAuth;\\n }\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[48] private __gap;\\n}\",\"keccak256\":\"0x4678458e960596e4a85fdfddaa45741a4563e7ecad5b0d42de2f4f7ac02ea3db\",\"license\":\"AGPL-3.0\"},\"src/tokens/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n */\\ninterface IERC4626 {\\n\\n /* ///////////////////////////// EVENTS ///////////////////////////// */\\n\\n /// `sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`.\\n /// emitted when tokens are deposited into the Vault via the mint and deposit methods.\\n event Deposit(\\n address indexed caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /// `sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`.\\n /// emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\\n * Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\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 (IERC20Upgradeable);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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\\u2019s 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\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0xe0b1a2e19aa78ee17783644981a5b1f1b725b4b031fbb8214ed3f02da3cdd516\",\"license\":\"AGPL-3.0\"},\"src/tokens/IERC5484.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\ninterface IERC5484 {\\n /// A guideline to standardlize burn-authorization's number coding\\n enum BurnAuth {\\n IssuerOnly,\\n OwnerOnly,\\n Both,\\n Neither\\n }\\n\\n /// @notice Emitted when a soulbound token is issued.\\n /// @dev This emit is an add-on to nft's transfer emit in order to distinguish sbt\\n /// from vanilla nft while providing backward compatibility.\\n /// @param from The issuer\\n /// @param to The receiver\\n /// @param tokenId The id of the issued token\\n event Issued (\\n address indexed from,\\n address indexed to,\\n uint256 indexed tokenId,\\n BurnAuth burnAuth\\n );\\n\\n /// @notice provides burn authorization of the token id.\\n /// @dev unassigned tokenIds are invalid, and queries do throw\\n /// @param tokenId The identifier for a token.\\n function burnAuth(uint256 tokenId) external view returns (BurnAuth);\\n}\",\"keccak256\":\"0xc96f708b45ebb1010db2b0b829360f12ec67dc83ec67e2a95df06f6afc467b3a\",\"license\":\"AGPL-3.0\"},\"src/tokens/IVaultFounderToken.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\\\";\\nimport {IERC721MetadataUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport {IERC721EnumerableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\\\";\\nimport {IERC5484} from \\\"./IERC5484.sol\\\";\\n\\n/// @title ERC721 complient Token interface\\ninterface IVaultFounderToken is\\n IERC5484,\\n IERC721Upgradeable,\\n IERC721MetadataUpgradeable,\\n IERC721EnumerableUpgradeable\\n{\\n /// @dev implementation for calculate price for the next token based on\\n /// the current sequential token id\\n function priceOf(uint256 tokenId) external view returns (uint256);\\n /// @dev calculate price for the next token\\n function nextTokenPrice() external view returns (uint256);\\n /// @dev set token metadata uri\\n /// can be used as utility method and custom logic on front-end\\n function setTokenURI(string memory _tokenURI) external;\\n /// @dev set token metadata uri\\n /// can be used as utility method and custom logic on front-end by owner of the contract\\n /// in case of end user has a wrong uri or somebody corrupted it\\n function setTokenURI(string memory _tokenURI, uint256 tokenId) external;\\n}\",\"keccak256\":\"0x8be89639be429f4cff7da513344ff8f685c3a44a8c4c32d98d7552b71daf62a8\",\"license\":\"AGPL-3.0\"},\"src/tokens/IVaultHook.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\n\\n/// @title ERC4626 Vault Token lifecycle hook interface\\ninterface IVaultHook {\\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request) external;\\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external;\\n}\\n\\nstruct ERC4626UpgradeableRequest {\\n /// @dev The amount of assets to be deposited.\\n uint256 assets;\\n\\n /// @dev The amount of shares to be minted.\\n uint256 shares;\\n\\n /// @dev The address that initiated the request.\\n address requestSender;\\n\\n /// @dev The amount of assets the sender is allowed to withdraw.\\n uint256 senderMaxWithdraw;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[46] gap;\\n}\",\"keccak256\":\"0x971fc6a2686ac8f6433b5544b31a4f25bec320698dc4aab4065f5bad3824ee6c\",\"license\":\"AGPL-3.0\"},\"src/tokens/RewardHolder.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ReentrancyGuardUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\n\\nimport {FixedPointMathLib} from \\\"solmate/utils/FixedPointMathLib.sol\\\";\\nimport {Vault} from \\\"../Vault.sol\\\";\\n\\ncontract RewardHolder is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable {\\n using FixedPointMathLib for uint256;\\n\\n /// @notice Emitted reward is claimed by a token owner\\n event RewardClaimed(uint256 reward, address receiver);\\n /// @notice Emitted when new rewards are deposited\\n event RewardDeposited(address sender, uint value);\\n\\n /// @notice Accumulator of the total earned interest rate since the opening of the token\\n uint public rewardIndex = 1e8;\\n\\n /// @notice The owners' reward indexes for eachas of the last time they accrued\\n mapping(address => uint) public rewardOwnerIndex;\\n\\n /// @notice\\n uint16 public numberCoins;\\n\\n Vault public vault;\\n\\n // 0xbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb7716\\n bytes32 public constant BALANCE_UPDATER_ROLE = keccak256(\\\"BALANCE_UPDATE_ROLE\\\");\\n // 0x350f4eb58665205037e4a10647f66a623dc93281f72575646a8f0c90d88b72ae\\n bytes32 public constant REWARD_CLAIMER_ROLE = keccak256(\\\"REWARD_CLAIMER_ROLE\\\");\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n function __RewardHolder_init() internal onlyInitializing {\\n __AccessControl_init();\\n _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\\n __ReentrancyGuard_init();\\n }\\n\\n /// @dev set vault\\n /// @notice that is mandatory to be set before reward can be claimed\\n function setVault(Vault vault_) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n vault = vault_;\\n }\\n\\n /// @dev deposit reward to the contract to be claimed by token owners\\n /// @notice only role with BALANCE_UPDATER_ROLE can call this function\\n /// @param plusReward amount of reward to be deposited\\n function depositReward(uint256 plusReward) public onlyRole(BALANCE_UPDATER_ROLE) nonReentrant {\\n // update reward index for claim reward logic\\n rewardIndex += plusReward;\\n emit RewardDeposited(_msgSender(), plusReward);\\n }\\n\\n /// @dev claim reward for token owner\\n function claimReward() external nonReentrant {\\n require(vault != Vault(address(0)), \\\"Vault not set.\\\");\\n\\n require(rewardOwnerIndex[msg.sender] != 0, \\\"Caller doesn't have reward.\\\");\\n\\n uint deltaIndex = rewardIndex - rewardOwnerIndex[msg.sender];\\n\\n // calculate reward for token owner\\n //todo discuss the proper calculation mechanism\\n uint256 tokenOwnerReward = deltaIndex.mulDivDown(1, numberCoins);\\n rewardOwnerIndex[msg.sender] = rewardIndex;\\n\\n // transfer reward to token owner\\n vault.transfer(msg.sender, tokenOwnerReward);\\n emit RewardClaimed(tokenOwnerReward, address(msg.sender));\\n }\\n\\n /// @dev setup new owner for reward usually called when minting new token\\n function setupNewOwner(address rewardOwner) internal virtual onlyRole(BALANCE_UPDATER_ROLE) {\\n rewardOwnerIndex[rewardOwner] = rewardIndex;\\n numberCoins++;\\n }\\n}\",\"keccak256\":\"0xddee10afce7b6f2aa5437d763ed3f3bb094acaef8ea93aa20be1feffc2565692\",\"license\":\"AGPL-3.0\"},\"src/tokens/SafeERC4626Lifecycle.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {SafeERC4626Upgradeable} from \\\"./SafeERC4626Upgradeable.sol\\\";\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\nimport {IVaultHook, ERC4626UpgradeableRequest} from \\\"./IVaultHook.sol\\\";\\n\\nabstract contract SafeERC4626Lifecycle is SafeERC4626Upgradeable {\\n // list of hooks\\n IVaultHook[] public withdrawHooks;\\n IVaultHook[] public depositHooks;\\n\\n /// @dev Adds hook to the list of deposit hooks\\n function addDepositHook(IVaultHook hook) internal {\\n depositHooks.push(hook);\\n }\\n\\n /// @dev Adds hook to the list of withdraw hooks\\n function addWithdrawHook(IVaultHook hook) internal {\\n withdrawHooks.push(hook);\\n }\\n\\n /// @dev Removes hook from the list of deposit hooks\\n function removeDepositHook(IVaultHook hook) internal {\\n // find hook\\n for (uint256 i = 0; i < depositHooks.length; i++)\\n {\\n if (depositHooks[i] == hook)\\n {\\n // remove hook\\n depositHooks[i] = depositHooks[depositHooks.length - 1];\\n depositHooks.pop();\\n return;\\n }\\n }\\n }\\n\\n /// @dev Removes hook from the list of withdraw hooks\\n function removeWithdrawHook(IVaultHook hook) internal {\\n // find hook\\n for (uint256 i = 0; i < withdrawHooks.length; i++)\\n {\\n if (withdrawHooks[i] == hook)\\n {\\n // remove hook\\n withdrawHooks[i] = withdrawHooks[withdrawHooks.length - 1];\\n withdrawHooks.pop();\\n return;\\n }\\n }\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function beforeWithdraw(uint256 assets, uint256 shares)\\n internal virtual override(ERC4626Upgradeable)\\n {\\n // if there are no hooks, then return to save gas\\n if(withdrawHooks.length == 0) {\\n return;\\n }\\n uint256[46] memory gap_; // this is needed for future upgrades\\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\\n assets: assets,\\n shares: shares,\\n requestSender: msg.sender,\\n senderMaxWithdraw: maxWithdraw(msg.sender),\\n gap: gap_\\n });\\n // iterate over hooks and call it\\n for (uint256 i = 0; i < withdrawHooks.length; i++)\\n {\\n IVaultHook hook = withdrawHooks[i];\\n hook.beforeWithdrawTrigger(request);\\n }\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function afterDeposit(uint256 assets, uint256 shares)\\n internal virtual override(ERC4626Upgradeable)\\n {\\n // if there are no depositHooks, then return to save gas\\n if(depositHooks.length == 0) {\\n return;\\n }\\n uint256[46] memory gap_; // this is needed for future upgrades\\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\\n assets: assets,\\n shares: shares,\\n requestSender: msg.sender,\\n senderMaxWithdraw: maxWithdraw(msg.sender),\\n gap: gap_\\n });\\n // iterate over depositHooks and call it\\n for (uint256 i = 0; i < depositHooks.length; i++)\\n {\\n IVaultHook hook = depositHooks[i];\\n hook.afterDepositTrigger(request);\\n }\\n }\\n}\",\"keccak256\":\"0x4bcb991d6c94589ef649777adbb21f5b1bbf7ca36ace8aeddf506bd3fdcef06c\",\"license\":\"AGPL-3.0\"},\"src/tokens/SafeERC4626Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {SafeERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport {FixedPointMathLib} from \\\"solmate/utils/FixedPointMathLib.sol\\\";\\n\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\n\\n/// @title Safier and limited implementation of ERC-4626\\n/// @notice ERC-4626 standard allow deposit and withdraw not for message sender.\\n/// It commonly known issue, which hardly to test and much error prune.\\n/// Such interfaces caused vulnarabilities, which resulted in million dollars hacks.\\n/// On anther hand, this interfaces not have any use cases which cannot be implemented without `transferFrom` method.\\n/// This implementation prevent spends and allowances from any methods except transferFrom/send\\n/// Also main business logic simplified to reduce gas consumption.\\nabstract contract SafeERC4626Upgradeable is ERC4626Upgradeable {\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n using FixedPointMathLib for uint256;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n // ------------------------------------------ Constructors ------------------------------------------\\n\\n /**\\n * Constructor for the SafeERC4626Upgradeable contract\\n * @param _asset which will be stored in this Vault\\n * @dev `defaultOperators` may be an empty array.\\n */\\n function __SafeERC4626_init(\\n IERC20Upgradeable _asset,\\n string memory name_,\\n string memory symbol_,\\n address[] memory defaultOperators_\\n ) internal onlyInitializing {\\n __ERC4626_init(_asset, name_, symbol_, defaultOperators_);\\n }\\n\\n /**\\n * Unchained constructor for the SafeERC4626Upgradeable contract, without parents contracts init\\n * @param _asset which will be stored in this Vault\\n */\\n function __SafeERC4626Upgradeable_init_unchained(IERC20Upgradeable _asset)\\n internal\\n onlyInitializing\\n {\\n __ERC4626_init_unchained(_asset);\\n }\\n\\n /// @notice Mints the Vault shares for msg.sender, according to the number of deposited base tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function deposit(uint256 assets)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n shares = previewDeposit(assets);\\n // Check for rounding error since we round down in previewDeposit.\\n require(shares != 0, \\\"Given assets result in 0 shares.\\\");\\n\\n _receiveAndDeposit(assets, shares, msg.sender);\\n }\\n\\n /// @notice Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens.\\n /// - emits the Deposit event.\\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\\n /// before the deposit execution, and are accounted for during deposit.\\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\\n /// Note that most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n function mint(uint256 shares)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n // No need to check for rounding error, previewMint rounds up.\\n assets = previewMint(shares);\\n\\n _receiveAndDeposit(assets, shares, msg.sender);\\n }\\n\\n /// @notice Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender.\\n /// - emit the Withdraw event.\\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the withdraw execution, and are accounted for during withdraw.\\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function withdraw(uint256 assets)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 shares)\\n {\\n // No need to check for rounding error, previewWithdraw rounds up.\\n shares = previewWithdraw(assets);\\n\\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\\n }\\n\\n /// @notice Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender.\\n /// - emit the Withdraw event.\\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\\n /// before the redeem execution, and are accounted for during redeem.\\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\\n /// slippage, the owner not having enough shares, etc).\\n /// Note that some implementations will require pre-requesting to the Vault\\n /// before a withdrawal may be performed. Those methods should be performed separately.\\n function redeem(uint256 shares)\\n public\\n virtual\\n nonReentrant\\n returns (uint256 assets)\\n {\\n assets = previewRedeem(shares);\\n // Check for rounding error since we round down in previewRedeem.\\n require(assets != 0, \\\"Given shares result in 0 assets.\\\");\\n\\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\\n }\\n\\n /* //////////////////// Backwards compatible methods ////////////////////////// */\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function deposit(\\n uint256 assets,\\n address /* receiver */\\n ) public virtual override returns (uint256 shares) {\\n // nonReentrant under the hood\\n return deposit(assets);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function mint(\\n uint256 shares,\\n address /* receiver */\\n ) public virtual override returns (uint256 assets) {\\n // nonReentrant under the hood\\n return mint(shares);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function withdraw(\\n uint256 assets,\\n address, /* receiver */\\n address /* owner */\\n ) public virtual override returns (uint256 shares) {\\n // nonReentrant under the hood\\n return withdraw(assets);\\n }\\n\\n /// @inheritdoc ERC4626Upgradeable\\n function redeem(\\n uint256 shares,\\n address, /* receiver */\\n address /* owner */\\n ) public virtual override returns (uint256 assets) {\\n // nonReentrant under the hood\\n return redeem(shares);\\n }\\n}\\n\",\"keccak256\":\"0x8c3eaf2ed84e1ebff549cf33feb30788baec1f352a0a98a723621094535cf89e\",\"license\":\"AGPL-3.0\"},\"src/tokens/VaultFounderToken.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {IERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {ERC721URIStorageUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\\\";\\n\\nimport {SafeInitializable} from \\\"../upgradeable/SafeInitializable.sol\\\";\\nimport {SafeUUPSUpgradeable} from \\\"../upgradeable/SafeUUPSUpgradeable.sol\\\";\\nimport {IVersionable} from \\\"../upgradeable/IVersionable.sol\\\";\\nimport {ERC5484Upgradeable} from \\\"./ERC5484Upgradeable.sol\\\";\\nimport {ERC4626Upgradeable} from \\\"./ERC4626Upgradeable.sol\\\";\\nimport {IVaultFounderToken} from \\\"./IVaultFounderToken.sol\\\";\\nimport {IVaultHook, ERC4626UpgradeableRequest} from \\\"./IVaultHook.sol\\\";\\nimport {RewardHolder} from \\\"./RewardHolder.sol\\\";\\n\\ncontract VaultFounderToken is IVaultFounderToken, SafeUUPSUpgradeable, ERC5484Upgradeable, IVaultHook, RewardHolder {\\n\\n // Max number of tokens that can be minted\\n uint256 private _maxCountTokens;\\n\\n // Next token price multiplier in percents\\n uint256 private _nextTokenPriceMultiplier;\\n\\n // Initial token price\\n uint256 private _initialTokenPrice;\\n\\n /// @dev This empty reserved space is put in place to allow future versions to add new\\n /// variables without shifting down storage in the inheritance chain.\\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[46] private __gap;\\n\\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\\n\\n function initialize(\\n uint256 maxCountTokens_,\\n uint256 nextTokenPriceMultiplier_,\\n uint256 initialTokenPrice_\\n ) public initializer {\\n __SafeUUPSUpgradeable_init_direct();\\n __ERC5484Upgradeable_init(\\\"Eonian Vault Founder Token\\\", \\\"EVFT\\\", BurnAuth.Neither, true);\\n __RewardHolder_init();\\n _maxCountTokens = maxCountTokens_;\\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\\n _initialTokenPrice = initialTokenPrice_;\\n }\\n\\n /// @inheritdoc IVersionable\\n function version() external pure returns (string memory) {\\n return \\\"0.1.0\\\";\\n }\\n\\n /// @dev function for mint new SBT token\\n /// @param to address of user who will receive token\\n /// @param uri token metadata uri\\n /// @return true if token was minted\\n function safeMint(address to, string memory uri) public virtual override(ERC5484Upgradeable) returns(bool){\\n if(totalSupply() < _maxCountTokens) {\\n bool tokenCreated = super.safeMint(to, uri);\\n if(tokenCreated) {\\n setupNewOwner(to);\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /// @inheritdoc ERC721Upgradeable\\n function _safeMint(address to, uint256 tokenId) internal override {\\n require(totalSupply() < _maxCountTokens, \\\"EVFT: max number of tokens\\\");\\n super._safeMint(to, tokenId);\\n }\\n\\n /// @inheritdoc IVaultFounderToken\\n function priceOf(uint256 tokenId) external view returns (uint256) {\\n require(tokenId < totalSupply(), \\\"EVFT: Token does not exist\\\");\\n return _priceOf(tokenId);\\n }\\n\\n /// @dev internal implementation for calculate price for the next token based on\\n /// the current sequential token id\\n function _priceOf(uint256 tokenId) internal view returns (uint256) {\\n uint256 price = _initialTokenPrice;\\n for (uint256 i = 0; i < tokenId; i++) {\\n price = (price * _nextTokenPriceMultiplier) / 10_000;\\n }\\n return price;\\n }\\n\\n /// @dev set multiplicator for the next token in percents\\n /// in case nextTokenPriceMultiplier_ = 13_000 the next price of the token will be: curPrice * 130%\\n /// @param nextTokenPriceMultiplier_ persent multiplicator\\n function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\\n }\\n\\n /// @inheritdoc IVaultFounderToken\\n function nextTokenPrice() external view returns (uint256){\\n return _nextTokenPrice();\\n }\\n\\n /// @dev calculate price for the next token\\n function _nextTokenPrice() internal view returns (uint256){\\n return _priceOf(totalSupply());\\n }\\n\\n /// @inheritdoc IVaultFounderToken\\n function setTokenURI(string memory _tokenURI) external override {\\n address tokenOwner = msg.sender;\\n uint256 tokenId = tokenOfOwnerByIndex(tokenOwner, 0);\\n _setTokenURI(tokenId, _tokenURI);\\n }\\n\\n /// @inheritdoc IVaultFounderToken\\n function setTokenURI(string memory _tokenURI, uint256 tokenId) external override onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setTokenURI(tokenId, _tokenURI);\\n }\\n\\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request)\\n external override\\n {\\n if(request.senderMaxWithdraw >= _nextTokenPrice()) {\\n safeMint(request.requestSender, \\\"\\\");\\n }\\n }\\n\\n /* solhint-disable no-empty-blocks */\\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external override\\n {\\n //empty code\\n }\\n /* solhint-disable no-empty-blocks */\\n\\n /// @dev See {IERC165-supportsInterface}.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n override(ERC5484Upgradeable, AccessControlUpgradeable, IERC165Upgradeable)\\n virtual\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceId);\\n }\\n}\",\"keccak256\":\"0x162dc48f0a3e74451be5371f6666ef6c9aa435055e925d8c46bd6e9a4b6ff99d\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/IVersionable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\n/** \\n * Allow properly identify different versions of the same contract \\n * and track upgrades results \\n * */\\ninterface IVersionable {\\n /// @notice Returns the current version of this contract\\n /// @return a version in semantic versioning format\\n function version() external pure returns (string memory);\\n}\\n\",\"keccak256\":\"0x13e08376fa8013858c0031556eaae03e4c8d517597cb5f0524040ef36a7c9006\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/SafeInitializable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IVersionable} from \\\"./IVersionable.sol\\\";\\n\\n/** Implement best practices for initializable contracts */\\nabstract contract SafeInitializable is IVersionable, Initializable {\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /**\\n * This constructor prevents UUPS Uninitialized Proxies Vulnerability in all contracts which inherit from it.\\n * More info about vulnerability: https://medium.com/immunefi/wormhole-uninitialized-proxy-bugfix-review-90250c41a43a\\n * \\n * @dev Initial fix for this vulnerability was suggested as using `_disableInitializers()` function in constructor,\\n * but later, in version 4.3.2, OpenZeppelin implemented `onlyProxy` modifier for UUPS upgradable contracts,\\n * which fixed this vulnerability. Still, `_disableInitializers()` is a best practice which prevents unintended access \\n * to implementation contracts that can be used maliciously.\\n * \\n * More info: https://forum.openzeppelin.com/t/how-to-test-upgradeability-for-proxies/33436/7 \\n * and https://forum.openzeppelin.com/t/uupsupgradeable-vulnerability-post-mortem/15680\\n * \\n * To prevent code duplication of constructor, this contract can be used. On the other hand, \\n * it can be used as a marker for contracts that are safe from this vulnerability.\\n * Additionally, `needDisableInitializers` parameter can be used to enable initializers in mocks and unit tests.\\n *\\n * @param needDisableInitializers - if true, initializers will be disabled\\n */\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(bool needDisableInitializers) {\\n if(needDisableInitializers) {\\n _disableInitializers();\\n }\\n }\\n}\",\"keccak256\":\"0xece22d8416967bebd1c1008f135e19224ed4afe81e30204fbf3b2d97c73db8b6\",\"license\":\"AGPL-3.0\"},\"src/upgradeable/SafeUUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity ^0.8.19;\\n\\nimport {UUPSUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {SafeInitializable} from \\\"./SafeInitializable.sol\\\";\\n\\n/** \\n * Implement basic safety mechanism for UUPS proxy\\n * based on owner authorization for upgrades\\n * */\\nabstract contract SafeUUPSUpgradeable is UUPSUpgradeable, SafeInitializable, OwnableUpgradeable {\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n\\n /** Init all required constructors, including ownable */\\n function __SafeUUPSUpgradeable_init() internal onlyInitializing {\\n __SafeUUPSUpgradeable_init_direct();\\n\\n __Ownable_init();\\n }\\n\\n /** Init only direct constructors, UUPS only */\\n function __SafeUUPSUpgradeable_init_direct() internal onlyInitializing {\\n __UUPSUpgradeable_init();\\n }\\n\\n /** Authorise that upgrades can do only owner */\\n function _authorizeUpgrade(address newImplementation) internal onlyOwner override {} // solhint-disable-line no-empty-blocks\\n}\\n\",\"keccak256\":\"0xaf322f5c5eeb718b7834b2eac8bfee7ce8062383840acc1d28b27351a759304e\",\"license\":\"AGPL-3.0\"}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b5060405162005e5138038062005e51833981016040819052620000389162000113565b8080156200004a576200004a62000052565b50506200013e565b600054610100900460ff1615620000bf5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161462000111576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200012657600080fd5b815180151581146200013757600080fd5b9392505050565b608051615cdb62000176600039600081816114da01528181611523015281816116c20152818161170201526117950152615cdb6000f3fe6080604052600436106104e15760003560e01c80638da5cb5b11610281578063c9faa7c51161015a578063ed8384f8116100cc578063fc673c4f11610085578063fc673c4f14610f97578063fc7b9c1814610fb7578063fd967f4714610fce578063fe41401514610fe4578063fe56e23214611004578063fe9d93031461102457600080fd5b8063ed8384f814610e94578063ef8b30f714610eb4578063f2fde38b14610ed4578063f5a3bfad14610ef4578063f76e4caa14610f57578063fad8b32a14610f7757600080fd5b8063d905777e1161011e578063d905777e14610dad578063d95b637114610dcd578063db006a7514610ded578063dd62ed3e14610e0d578063dd723c1b14610e54578063ec38a86214610e7457600080fd5b8063c9faa7c514610d07578063ce348c6f14610d40578063ce96cb7714610d56578063cea55f5714610d76578063cfbde32614610d8d57600080fd5b8063b3d7f6b9116101f3578063c17047ed116101b7578063c17047ed14610c47578063c3535b5214610c81578063c63d75b61461084a578063c6e6f59214610ca7578063c822adda14610cc7578063c9411e2214610ce757600080fd5b8063b3d7f6b914610ba7578063b460af9414610bc7578063b6b55f2514610be7578063ba08765214610c07578063bb994d4814610c2757600080fd5b806399089a4e1161024557806399089a4e14610aef5780639bd9bbc614610b0f5780639ec5a89414610b2f578063a0712d6814610b50578063a6f7f5d614610b70578063a9059cbb14610b8757600080fd5b80638da5cb5b14610a645780638dfa4f0714610a8357806394bf804d14610a9a578063959b8c3f14610aba57806395d89b4114610ada57600080fd5b80633659cfe6116103be57806354fd4d501161033057806370a08231116102e957806370a08231146109bf578063715018a6146109f5578063759076e51461062457806380d5785514610a0a578063861d68d914610a44578063884719f214610a0a57600080fd5b806354fd4d5014610911578063556f0dc71461093f57806357db845a146109535780635c975abb1461096a57806362ad1b831461097f5780636e553f651461099f57600080fd5b8063411b007e11610382578063411b007e1461086c5780634a8c1fb41461088d5780634cdad506146108b25780634f1ef286146108d257806352d1902d146108e5578063547ccc91146108fa57600080fd5b80633659cfe6146107d457806338d52e0f146107f457806339d97c53146108155780633c93b9f214610835578063402d267d1461084a57600080fd5b80631415fa481161045757806323b872dd1161041b57806323b872dd146106f8578063267c1408146107185780632e1a7d4d146107345780632ff7709e14610754578063313ce5671461077e5780633306bc5b1461079a57600080fd5b80631415fa481461066157806314c644021461068357806318160ddd146106a3578063201afd83146106b8578063207b27df146106d857600080fd5b806307cc692f116104a957806307cc692f14610587578063095ea7b31461059c5780630a28a477146105cc5780630a96bb53146105ec5780630baabd7a14610624578063125317291461064a57600080fd5b806301e1d114146104e657806306e485381461050e57806306f94a0d1461053057806306fdde031461054557806307a2d13a14610567575b600080fd5b3480156104f257600080fd5b506104fb611044565b6040519081526020015b60405180910390f35b34801561051a57600080fd5b50610523611065565b604051610505919061504e565b34801561053c57600080fd5b506104fb6110c7565b34801561055157600080fd5b5061055a6110d2565b60405161050591906150eb565b34801561057357600080fd5b506104fb6105823660046150fe565b61115b565b34801561059357600080fd5b506104fb611192565b3480156105a857600080fd5b506105bc6105b7366004615137565b61119d565b6040519015158152602001610505565b3480156105d857600080fd5b506104fb6105e73660046150fe565b6111b7565b3480156105f857600080fd5b5061060c6106073660046150fe565b6111e8565b6040516001600160a01b039091168152602001610505565b34801561063057600080fd5b5033600090815261016260205260409020600201546104fb565b34801561065657600080fd5b506104fb6102975481565b34801561066d57600080fd5b5061068161067c3660046150fe565b611213565b005b34801561068f57600080fd5b5061068161069e366004615171565b611252565b3480156106af57600080fd5b5060fc546104fb565b3480156106c457600080fd5b506106816106d336600461518e565b611272565b3480156106e457600080fd5b506104fb6106f336600461518e565b6112d9565b34801561070457600080fd5b506105bc6107133660046151ab565b611334565b34801561072457600080fd5b506104fb670de0b6b3a764000081565b34801561074057600080fd5b506104fb61074f3660046150fe565b61137a565b34801561076057600080fd5b506107696113ab565b60408051928352602083019190915201610505565b34801561078a57600080fd5b5060405160128152602001610505565b3480156107a657600080fd5b506104fb6107b536600461518e565b6001600160a01b03166000908152610162602052604090206001015490565b3480156107e057600080fd5b506106816107ef36600461518e565b6114d0565b34801561080057600080fd5b506101f95461060c906001600160a01b031681565b34801561082157600080fd5b506106816108303660046151ec565b6115b5565b34801561084157600080fd5b506104fb611695565b34801561085657600080fd5b506104fb61086536600461518e565b5060001990565b34801561087857600080fd5b506102945461060c906001600160a01b031681565b34801561089957600080fd5b50336000908152610162602052604090205415156105bc565b3480156108be57600080fd5b506104fb6108cd3660046150fe565b6116ad565b6106816108e03660046152d3565b6116b8565b3480156108f157600080fd5b506104fb611788565b34801561090657600080fd5b506104fb6102965481565b34801561091d57600080fd5b506040805180820190915260058152640302e322e360dc1b602082015261055a565b34801561094b57600080fd5b5060016104fb565b34801561095f57600080fd5b506104fb6101615481565b34801561097657600080fd5b506105bc61183b565b34801561098b57600080fd5b5061068161099a366004615323565b611845565b3480156109ab57600080fd5b506104fb6109ba3660046153b6565b611881565b3480156109cb57600080fd5b506104fb6109da36600461518e565b6001600160a01b0316600090815260fb602052604090205490565b348015610a0157600080fd5b5061068161188c565b348015610a1657600080fd5b506104fb610a2536600461518e565b6001600160a01b03166000908152610162602052604090206002015490565b348015610a5057600080fd5b50610681610a5f3660046153e6565b6118a0565b348015610a7057600080fd5b50610195546001600160a01b031661060c565b348015610a8f57600080fd5b506104fb6102985481565b348015610aa657600080fd5b506104fb610ab53660046153b6565b61192e565b348015610ac657600080fd5b50610681610ad536600461518e565b611939565b348015610ae657600080fd5b5061055a611a59565b348015610afb57600080fd5b50610681610b0a366004615492565b611a68565b348015610b1b57600080fd5b50610681610b2a3660046154c7565b611a91565b348015610b3b57600080fd5b506102935461060c906001600160a01b031681565b348015610b5c57600080fd5b506104fb610b6b3660046150fe565b611ab4565b348015610b7c57600080fd5b506104fb6102955481565b348015610b9357600080fd5b506105bc610ba2366004615137565b611ad4565b348015610bb357600080fd5b506104fb610bc23660046150fe565b611b0c565b348015610bd357600080fd5b506104fb610be2366004615520565b611b3c565b348015610bf357600080fd5b506104fb610c023660046150fe565b611b47565b348015610c1357600080fd5b506104fb610c22366004615520565b611b5a565b348015610c3357600080fd5b50610681610c4236600461518e565b611b65565b348015610c5357600080fd5b506104fb610c6236600461518e565b6001600160a01b03166000908152610162602052604090206003015490565b348015610c8d57600080fd5b5033600090815261016260205260409020600101546104fb565b348015610cb357600080fd5b506104fb610cc23660046150fe565b611c06565b348015610cd357600080fd5b5061060c610ce23660046150fe565b611c37565b348015610cf357600080fd5b50610681610d02366004615137565b611c48565b348015610d1357600080fd5b506105bc610d2236600461518e565b6001600160a01b031660009081526101626020526040902054151590565b348015610d4c57600080fd5b5061025e546104fb565b348015610d6257600080fd5b506104fb610d7136600461518e565b611ce5565b348015610d8257600080fd5b506104fb6101605481565b348015610d9957600080fd5b50610681610da83660046150fe565b611d07565b348015610db957600080fd5b506104fb610dc836600461518e565b611d77565b348015610dd957600080fd5b506105bc610de8366004615562565b611d95565b348015610df957600080fd5b506104fb610e083660046150fe565b611e39565b348015610e1957600080fd5b506104fb610e28366004615562565b6001600160a01b0391821660009081526101036020908152604080832093909416825291909152205490565b348015610e6057600080fd5b50610681610e6f3660046151ec565b611eaa565b348015610e8057600080fd5b50610681610e8f36600461518e565b611f86565b348015610ea057600080fd5b5061060c610eaf3660046150fe565b611fb1565b348015610ec057600080fd5b506104fb610ecf3660046150fe565b611fc2565b348015610ee057600080fd5b50610681610eef36600461518e565b611fcd565b348015610f0057600080fd5b50610f37610f0f36600461518e565b6101626020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610505565b348015610f6357600080fd5b50610681610f7236600461518e565b612043565b348015610f8357600080fd5b50610681610f9236600461518e565b612118565b348015610fa357600080fd5b50610681610fb2366004615590565b612236565b348015610fc357600080fd5b506104fb61015f5481565b348015610fda57600080fd5b506104fb61271081565b348015610ff057600080fd5b50610681610fff366004615610565b61226e565b34801561101057600080fd5b5061068161101f3660046150fe565b6124e5565b34801561103057600080fd5b5061068161103f3660046156d7565b612524565b600061104e61253f565b611056611695565b611060919061571e565b905090565b606060ff8054806020026020016040519081016040528092919081815260200182805480156110bd57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161109f575b5050505050905090565b6000611060336125b4565b606060fd80546110e190615731565b80601f016020809104026020016040519081016040528092919081815260200182805461110d90615731565b80156110bd5780601f1061112f576101008083540402835291602001916110bd565b820191906000526020600020905b81548152906001019060200180831161113d57509395945050505050565b60008061116760fc5490565b905080600003611178575090919050565b61118b611183611044565b84908361264b565b9392505050565b60006110603361266a565b6000336111ab818585612758565b60019150505b92915050565b6000806111c360fc5490565b9050806000036111d4575090919050565b61118b816111e0611044565b859190612880565b61029181815481106111f957600080fd5b6000918252602090912001546001600160a01b0316905081565b61121b6128ae565b612710610295548261122d919061576b565b111561124c57604051630bc4369360e21b815260040160405180910390fd5b61029655565b61125a6128ae565b8061126a57611267612909565b50565b61126761295b565b61127a6128ae565b61029480546001600160a01b03929092166001600160a01b0319928316811790915561029280546001810182556000919091527f47dc9219577b597b6eada661683162be71a26f1593fe5b77c8b669bbbc7a8b1b018054909216179055565b6000806112e4611695565b6001600160a01b03841660009081526101626020526040812060020154919250829003611315575060009392505050565b816113226127108361577e565b61132c9190615795565b949350505050565b600033611342858285612998565b61136f85858560405180602001604052806000815250604051806020016040528060008152506000612a25565b506001949350505050565b6000611384612b21565b61138d826111b7565b905061139b82823333612b7c565b6113a6600161012d55565b919050565b60008060008061015f546000036113c85750600093849350915050565b60005b61025e548110156114b357600061025e82815481106113ec576113ec6157b7565b60009182526020822001546001600160a01b0316915061140b826112d9565b9050611417818661576b565b9450612710826001600160a01b0316632ff7709e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561145a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147e91906157cd565b611488908361577e565b6114929190615795565b61149c908561576b565b9350505080806114ab906157e6565b9150506113cb565b50816000036114c85750600093849350915050565b939092509050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115215760405162461bcd60e51b8152600401611518906157ff565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661156a600080516020615c5f833981519152546001600160a01b031690565b6001600160a01b0316146115905760405162461bcd60e51b81526004016115189061584b565b61159981612c36565b6040805160008082526020820190925261126791839190612c3e565b336000908152610162602052604081205490036115e557604051630160ef0b60e51b815260040160405180910390fd5b6115ed612b21565b806115f733612da9565b10156116455760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f7567682061737365747320666f72207061796d656e740000006044820152606401611518565b8115611655576116553383612e19565b6116623382600085612f79565b61166b826130fa565b611676600161012d55565b5050426101618190553360009081526101626020526040902060010155565b600061015f546116a3613126565b611060919061576b565b60006111b18261115b565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036117005760405162461bcd60e51b8152600401611518906157ff565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611749600080516020615c5f833981519152546001600160a01b031690565b6001600160a01b03161461176f5760405162461bcd60e51b81526004016115189061584b565b61177882612c36565b61178482826001612c3e565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118285760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611518565b50600080516020615c5f83398151915290565b6000611060613194565b61184f3386611d95565b61186b5760405162461bcd60e51b815260040161151890615897565b61187a85858585856001612a25565b5050505050565b600061118b83611b47565b6118946128ae565b61189e600061319e565b565b6118a86128ae565b60006118b661025e846131f1565b9050806118d657604051632df15a4160e11b815260040160405180910390fd5b816118e4576118e483613326565b826001600160a01b03167fb6a4d3fee462ca7c56e3e87f5942581b478433cf0003d49e1750c1ad1539ee3083604051611921911515815260200190565b60405180910390a2505050565b600061118b83611ab4565b6001600160a01b038116330361199d5760405162461bcd60e51b8152602060048201526024808201527f4552433737373a20617574686f72697a696e672073656c66206173206f70657260448201526330ba37b960e11b6064820152608401611518565b6001600160a01b0381166000908152610100602052604090205460ff16156119f057336000908152610102602090815260408083206001600160a01b03851684529091529020805460ff19169055611a20565b336000908152610101602090815260408083206001600160a01b03851684529091529020805460ff191660011790555b60405133906001600160a01b038316907ff4caeb2d6ca8932a215a353d0703c326ec2d81fc68170f320eb2ab49e9df61f990600090a350565b606060fe80546110e190615731565b611a706128ae565b611a7c61025e82613390565b80516117849161025e91602090910190614fb5565b611aaf33848484604051806020016040528060008152506001612a25565b505050565b6000611abe612b21565b611ac782611b0c565b905061139b818333613482565b6000611b0333848460405180602001604052806000815250604051806020016040528060008152506000612a25565b50600192915050565b600080611b1860fc5490565b905080600003611b29575090919050565b61118b611b34611044565b849083612880565b600061132c8461137a565b6000611b51613515565b6111b18261355d565b600061132c84611e39565b80611b79610195546001600160a01b031690565b6001600160a01b0316336001600160a01b031614158015611ba35750336001600160a01b03821614155b15611bc357604051630869704160e41b8152336004820152602401611518565b611bce8260006135cd565b6040516001600160a01b038316907f4201c688d84c01154d321afa0c72f1bffe9eef53005c9de9d035074e71e9b32a90600090a25050565b600080611c1260fc5490565b905080600003611c23575090919050565b61118b81611c2f611044565b85919061264b565b61025e81815481106111f957600080fd5b611c506128ae565b611c58613515565b6001600160a01b038216611c7f5760405163f5bf603960e01b815260040160405180910390fd5b611c88826136b5565b611c9282826137c6565b611c9e61025e83613896565b816001600160a01b03167f2f564a83158ad1831793ad3e69257b52f39ece5d49cb0d8746708ecb9ef964da82604051611cd991815260200190565b60405180910390a25050565b6001600160a01b038116600090815260fb60205260408120546111b19061115b565b611d0f6128ae565b670de0b6b3a7640000811115611d3b57604051639058c3f760e01b815260048101829052602401611518565b6102988190556040518181527f6619a135102d0d043ca15a77ad3878b0c97fb8ead5829208b0f79c00711fa7c79060200160405180910390a150565b6001600160a01b038116600090815260fb60205260408120546111b1565b6000816001600160a01b0316836001600160a01b03161480611e0257506001600160a01b0383166000908152610100602052604090205460ff168015611e0257506001600160a01b038083166000908152610102602090815260408083209387168352929052205460ff16155b8061118b5750506001600160a01b039081166000908152610101602090815260408083209490931682529290925290205460ff1690565b6000611e43612b21565b611e4c826116ad565b905080600003611e9e5760405162461bcd60e51b815260206004820181905260248201527f476976656e2073686172657320726573756c7420696e2030206173736574732e6044820152606401611518565b61139b81833333612b7c565b33600090815261016260205260408120549003611eda57604051630160ef0b60e51b815260040160405180910390fd5b611ee2612b21565b611eec818361576b565b611ef533612da9565b1015611f145760405163112093df60e31b815260040160405180910390fd5b60008083118015611f375750336000908152610162602052604090206001015442115b8015611f525750336000908152610162602052604090205442115b15611f6357611f60836138ca565b90505b611f703383856000612f79565b611f7a8382613993565b50611676600161012d55565b611f8e6128ae565b61029380546001600160a01b0319166001600160a01b0392909216919091179055565b61029281815481106111f957600080fd5b60006111b182611c06565b611fd56128ae565b6001600160a01b03811661203a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611518565b6112678161319e565b61204b6128ae565b6001600160a01b0381166120725760405163f5bf603960e01b815260040160405180910390fd5b61207e61025e826139b1565b1561209c5760405163c45546f760e01b815260040160405180910390fd5b6001600160a01b0381166000908152610162602052604081205490036120d5576040516332ffc55b60e11b815260040160405180910390fd5b6120e161025e82613896565b6040516001600160a01b038216907f0bd7504c563a4658373bef3dbb51f91f63b8c6d5ba60806c678e75df33b4569890600090a250565b336001600160a01b0382160361217a5760405162461bcd60e51b815260206004820152602160248201527f4552433737373a207265766f6b696e672073656c66206173206f70657261746f6044820152603960f91b6064820152608401611518565b6001600160a01b0381166000908152610100602052604090205460ff16156121d057336000908152610102602090815260408083206001600160a01b03851684529091529020805460ff191660011790556121fd565b336000908152610101602090815260408083206001600160a01b03851684529091529020805460ff191690555b60405133906001600160a01b038316907f50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa190600090a350565b6122403385611d95565b61225c5760405162461bcd60e51b815260040161151890615897565b61226884848484613a1a565b50505050565b600054610100900460ff161580801561228e5750600054600160ff909116105b806122a85750303b1580156122a8575060005460ff166001145b61230b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611518565b6000805460ff19166001179055801561232e576000805461ff0019166101001790555b612336613bcf565b61233e613c06565b61247089865160001461235157866123d7565b8a6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561238f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123b791908101906158e3565b6040516020016123c7919061595a565b6040516020818303038152906040525b8651156123e4578661246a565b8b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015612422573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261244a91908101906158e3565b60405160200161245a9190615992565b6040516020818303038152906040525b86613ca0565b61247988611f86565b612482876124e5565b61248b86611d07565b61249482611213565b80156124da576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b6124ed6128ae565b61271061029654826124ff919061576b565b111561251e57604051630bc4369360e21b815260040160405180910390fd5b61029555565b61178433838360405180602001604052806000815250613a1a565b600080610298546101615442612555919061571e565b61255f919061577e565b9050670de0b6b3a7640000811061257857600091505090565b6000670de0b6b3a76400006102975483612592919061577e565b61259c9190615795565b905080610297546125ad919061571e565b9250505090565b6001600160a01b038116600090815261016260205260408120600201546125d961183b565b806125e5575061016054155b156125f05792915050565b60006127106125fd611695565b6001600160a01b03861660009081526101626020526040902060030154612624919061577e565b61262e9190615795565b9050808211612641575060009392505050565b61132c818361571e565b82820281151584158583048514171661266357600080fd5b0492915050565b600061267461183b565b1561268157506000919050565b600061268b613cd3565b61015f54909150600061271061269f611695565b6001600160a01b038716600090815261016260205260409020600301546126c6919061577e565b6126d09190615795565b6001600160a01b0386166000908152610162602052604090206002015490915082841115806126ff5750808211155b156127105750600095945050505050565b600061271c848661571e565b9050600061272a838561571e565b905060006127388383613cf8565b905061274b81612746613126565b613cf8565b9998505050505050505050565b6001600160a01b0383166127bc5760405162461bcd60e51b815260206004820152602560248201527f4552433737373a20617070726f76652066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611518565b6001600160a01b03821661281e5760405162461bcd60e51b815260206004820152602360248201527f4552433737373a20617070726f766520746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611518565b6001600160a01b038381166000818152610103602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b82820281151584158583048514171661289857600080fd5b6001826001830304018115150290509392505050565b610195546001600160a01b0316331461189e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611518565b612911613d0e565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b612963613515565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861293e3390565b6001600160a01b038381166000908152610103602090815260408083209386168352929052205460001981146122685781811015612a185760405162461bcd60e51b815260206004820152601e60248201527f4552433737373a20696e73756666696369656e7420616c6c6f77616e636500006044820152606401611518565b6122688484848403612758565b6001600160a01b038616612a8a5760405162461bcd60e51b815260206004820152602660248201527f4552433737373a207472616e736665722066726f6d20746865207a65726f206160448201526564647265737360d01b6064820152608401611518565b6001600160a01b038516612aec5760405162461bcd60e51b8152602060048201526024808201527f4552433737373a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401611518565b33612afb818888888888613d59565b612b09818888888888613e80565b612b1881888888888888613fe6565b50505050505050565b600261012d5403612b745760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611518565b600261012d55565b336001600160a01b03821614612b9757612b97813385612998565b612ba184846141ab565b612bcb81846040518060200160405280600081525060405180602001604052806000815250613a1a565b60408051858152602081018590526001600160a01b03808416929085169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46101f954612268906001600160a01b03168386614325565b600161012d55565b6112676128ae565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612c7157611aaf83614388565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612ccb575060408051601f3d908101601f19168201909252612cc8918101906157cd565b60015b612d2e5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611518565b600080516020615c5f8339815191528114612d9d5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611518565b50611aaf838383614424565b6101f9546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa158015612df5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b191906157cd565b6001600160a01b0382166000908152610162602052604090206002015481811015612e865760405162461bcd60e51b815260206004820152601d60248201527f4c6f73732069732067726561746572207468616e2074686520646562740000006044820152606401611518565b6101605415612f29576000612ed361015f548461016054612ea7919061577e565b612eb19190615795565b6001600160a01b03861660009081526101626020526040902060030154613cf8565b90508015612f27576001600160a01b0384166000908152610162602052604081206003018054839290612f0790849061571e565b92505081905550806101606000828254612f21919061571e565b90915550505b505b6001600160a01b0383166000908152610162602052604081206002018054849290612f5590849061571e565b925050819055508161015f6000828254612f6f919061571e565b9091555050505050565b6000612f848561266a565b90506000612f91336125b4565b9050612f9d8582613cf8565b94508415612ff1576001600160a01b0386166000908152610162602052604081206002018054879290612fd190849061571e565b925050819055508461015f6000828254612feb919061571e565b90915550505b8115613043576001600160a01b038616600090815261016260205260408120600201805484929061302390849061576b565b925050819055508161015f600082825461303d919061576b565b90915550505b600061304f868661576b565b90506000808483101561307757613066838661571e565b91506130728983614449565b613095565b8483111561309557613089858461571e565b90506130958982614461565b604080518981526020810189905290810183905260608101829052608081018790526001600160a01b038a16907f92a0cdbae2e10dc214d482504ecbf0461593fd2fbfbedad5a195f5ebb7dcee739060a00160405180910390a2505050505050505050565b600061310461253f565b905081811161311457600061311e565b61311e828261571e565b610297555050565b6101f9546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015613170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106091906157cd565b600061106061447a565b61019580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008060005b84548110156132e657836001600160a01b031685828154811061321c5761321c6157b7565b6000918252602090912001546001600160a01b03160361323b57600191505b818015613254575084546132519060019061571e565b81105b156132d4578461326582600161576b565b81548110613275576132756157b7565b9060005260206000200160009054906101000a90046001600160a01b03168582815481106132a5576132a56157b7565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b806132de816157e6565b9150506131f7565b50801561118b57838054806132fd576132fd6159bd565b600082815260209020810160001990810180546001600160a01b03191690550190559392505050565b6001600160a01b03811660009081526101626020526040902060030154156133615760405163c69bfc5f60e01b815260040160405180910390fd5b6001600160a01b0316600090815261016260205260408120818155600181018290556002810182905560030155565b815481516060919081146133b7576040516336c2ff5d60e01b815260040160405180910390fd5b60005b818110156134795760008582815481106133d6576133d66157b7565b60009182526020822001546001600160a01b031691505b8381101561346457858181518110613407576134076157b7565b60200260200101516001600160a01b0316826001600160a01b031603156134645761343360018561571e565b8103613452576040516336c2ff5d60e01b815260040160405180910390fd5b8061345c816157e6565b9150506133ed565b50508080613471906157e6565b9150506133ba565b50919392505050565b6101f95461349b906001600160a01b0316333086614488565b6134c5818360405180602001604052806000815250604051806020016040528060008152506144c0565b60408051848152602081018490526001600160a01b0383169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3611aaf83836144ce565b61351d61183b565b1561189e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611518565b6000613567612b21565b61357082611fc2565b9050806000036135c25760405162461bcd60e51b815260206004820181905260248201527f476976656e2061737365747320726573756c7420696e2030207368617265732e6044820152606401611518565b61139b828233613482565b6001600160a01b03821660009081526101626020526040902054613604576040516332ffc55b60e11b815260040160405180910390fd5b6001600160a01b0382166000908152610162602052604081206003015461016080549192909161363590849061571e565b90915550506001600160a01b038216600090815261016260205260408120600301829055610160805483929061366c90849061576b565b909155505061016054612710101561178457806101605461368d919061571e565b6136999061271061571e565b604051639eb4cd0560e01b815260040161151891815260200190565b806001600160a01b031663bcead63e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156136f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061371791906159d3565b6001600160a01b0316306001600160a01b03161415806137a85750806001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613770573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379491906159d3565b6101f9546001600160a01b03908116911614155b1561126757604051631120dc3360e21b815260040160405180910390fd5b6001600160a01b03821660009081526101626020526040902054156137fe576040516312635b0b60e21b815260040160405180910390fd5b6127108161016054613810919061576b565b111561382657610160546136999061271061571e565b604080516080810182524280825260208083019182526000838501818152606085018781526001600160a01b03891683526101629093529481209351845591516001840155925160028301559151600390910155610160805483929061388d90849061576b565b90915550505050565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b03909216919091179055565b60008061271061029554846138df919061577e565b6138e99190615795565b905080156139325761029354613932906001600160a01b031661390b83611c06565b604051806020016040528060008152506040518060200160405280600081525060006144d8565b610294546001600160a01b03166139495792915050565b6000612710610296548561395d919061577e565b6139679190615795565b905080156139895761029454613989906001600160a01b031661390b83611c06565b61132c818361576b565b808261399d61253f565b6139a7919061576b565b61311e919061571e565b6000805b8354811015613a1057826001600160a01b03168482815481106139da576139da6157b7565b6000918252602090912001546001600160a01b0316036139fe5760019150506111b1565b80613a08816157e6565b9150506139b5565b5060009392505050565b6001600160a01b038416613a7b5760405162461bcd60e51b815260206004820152602260248201527f4552433737373a206275726e2066726f6d20746865207a65726f206164647265604482015261737360f01b6064820152608401611518565b33613a8b81866000878787613d59565b6001600160a01b038516600090815260fb602052604090205484811015613b005760405162461bcd60e51b815260206004820152602360248201527f4552433737373a206275726e20616d6f756e7420657863656564732062616c616044820152626e636560e81b6064820152608401611518565b6001600160a01b038616600090815260fb60205260408120868303905560fc8054879290613b2f90849061571e565b92505081905550856001600160a01b0316826001600160a01b03167fa78a9be3a7b862d26933ad85fb11d80ef66b8f972d7cbba06621d583943a4098878787604051613b7d939291906159f0565b60405180910390a36040518581526000906001600160a01b038816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a3505050505050565b600054610100900460ff16613bf65760405162461bcd60e51b815260040161151890615a1b565b613bfe614615565b61189e614644565b600054610100900460ff16613c2d5760405162461bcd60e51b815260040161151890615a1b565b6000613c42610195546001600160a01b031690565b6001600160a01b031603613c985760405162461bcd60e51b815260206004820181905260248201527f537472617465676965734c656e646572206d757374206265206f776e61626c656044820152606401611518565b61189e614673565b600054610100900460ff16613cc75760405162461bcd60e51b815260040161151890615a1b565b612268848484846146b2565b6000612710613ce0611695565b61016054613cee919061577e565b6110609190615795565b6000818310613d07578161118b565b5090919050565b613d1661183b565b61189e5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611518565b60405163555ddc6560e11b81526001600160a01b03861660048201527f29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe8956024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015613dda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dfe91906159d3565b90506001600160a01b03811615612b1857604051633ad5cbc160e11b81526001600160a01b038216906375ab978290613e45908a908a908a908a908a908a90600401615a66565b600060405180830381600087803b158015613e5f57600080fd5b505af1158015613e73573d6000803e3d6000fd5b5050505050505050505050565b6001600160a01b038516600090815260fb602052604090205483811015613ef95760405162461bcd60e51b815260206004820152602760248201527f4552433737373a207472616e7366657220616d6f756e7420657863656564732060448201526662616c616e636560c81b6064820152608401611518565b6001600160a01b03808716600090815260fb6020526040808220878503905591871681529081208054869290613f3090849061576b565b92505081905550846001600160a01b0316866001600160a01b0316886001600160a01b03167f06b541ddaa720db2b10a4d0cdac39b8d360425fc073085fac19bc82614677987878787604051613f88939291906159f0565b60405180910390a4846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051613fd591815260200190565b60405180910390a350505050505050565b60405163555ddc6560e11b81526001600160a01b03861660048201527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b6024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015614067573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061408b91906159d3565b90506001600160a01b03811615614107576040516223de2960e01b81526001600160a01b038216906223de29906140d0908b908b908b908b908b908b90600401615a66565b600060405180830381600087803b1580156140ea57600080fd5b505af11580156140fe573d6000803e3d6000fd5b505050506141a1565b81156141a1576001600160a01b0386163b156141a15760405162461bcd60e51b815260206004820152604d60248201527f4552433737373a20746f6b656e20726563697069656e7420636f6e747261637460448201527f20686173206e6f20696d706c656d656e74657220666f7220455243373737546f60648201526c1ad95b9cd49958da5c1a595b9d609a1b608482015260a401611518565b5050505050505050565b816141b4613126565b106141bd575050565b60005b61025e548110156142e85760006141d5613126565b90508084116141e457506142e8565b600061025e83815481106141fa576141fa6157b7565b60009182526020822001546001600160a01b0316915061423f61421d848861571e565b6001600160a01b03841660009081526101626020526040902060020154613cf8565b905080600003614251575050506142d6565b604051632e1a7d4d60e01b8152600481018290526000906001600160a01b03841690632e1a7d4d906024016020604051808303816000875af115801561429b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142bf91906157cd565b905080156142d1576142d18382612e19565b505050505b806142e0816157e6565b9150506141c0565b50816142f2613126565b101561431b5760405163bce5067160e01b81526004810183905260248101829052604401611518565b61178482826146f5565b6040516001600160a01b038316602482015260448101829052611aaf90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526147ed565b6001600160a01b0381163b6143f55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611518565b600080516020615c5f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61442d836148c2565b60008251118061443a5750805b15611aaf576122688383614902565b6101f954611784906001600160a01b03168383614325565b6101f954611784906001600160a01b0316833084614488565b600061106060c95460ff1690565b6040516001600160a01b03808516602483015283166044820152606481018290526122689085906323b872dd60e01b90608401614351565b6122688484848460016144d8565b6117848282614927565b6001600160a01b03851661452e5760405162461bcd60e51b815260206004820181905260248201527f4552433737373a206d696e7420746f20746865207a65726f20616464726573736044820152606401611518565b60003390508460fc6000828254614545919061576b565b90915550506001600160a01b038616600090815260fb60205260408120805487929061457290849061576b565b9091555061458890508160008888888888613fe6565b856001600160a01b0316816001600160a01b03167f2fe5be0146f74c5bce36c0b80911af6c7d86ff27e89d5cfa61fc681327954e5d8787876040516145cf939291906159f0565b60405180910390a36040518581526001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001613bbf565b600054610100900460ff1661463c5760405162461bcd60e51b815260040161151890615a1b565b61189e614a1f565b600054610100900460ff1661466b5760405162461bcd60e51b815260040161151890615a1b565b61189e614a46565b600054610100900460ff1661469a5760405162461bcd60e51b815260040161151890615a1b565b6146a2614a76565b6146aa614aa5565b61189e614ad4565b600054610100900460ff166146d95760405162461bcd60e51b815260040161151890615a1b565b6146e4838383614b02565b6146ec614aa5565b61226884614b34565b61029154600003614704575050565b61470c61501a565b60006040518060a00160405280858152602001848152602001336001600160a01b0316815260200161473d33611ce5565b8152602001839052905060005b6102915481101561187a576000610291828154811061476b5761476b6157b7565b60009182526020909120015460405163894a16f560e01b81526001600160a01b039091169150819063894a16f5906147a7908690600401615ab3565b600060405180830381600087803b1580156147c157600080fd5b505af11580156147d5573d6000803e3d6000fd5b505050505080806147e5906157e6565b91505061474a565b6000614842826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614b7e9092919063ffffffff16565b90508051600014806148635750808060200190518101906148639190615b17565b611aaf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611518565b6148cb81614388565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061118b8383604051806060016040528060278152602001615c7f60279139614b8d565b61029254600003614936575050565b61493e61501a565b60006040518060a00160405280858152602001848152602001336001600160a01b0316815260200161496f33611ce5565b8152602001839052905060005b6102925481101561187a576000610292828154811061499d5761499d6157b7565b600091825260209091200154604051631a7e999b60e31b81526001600160a01b039091169150819063d3f4ccd8906149d9908690600401615ab3565b600060405180830381600087803b1580156149f357600080fd5b505af1158015614a07573d6000803e3d6000fd5b50505050508080614a17906157e6565b91505061497c565b600054610100900460ff1661189e5760405162461bcd60e51b815260040161151890615a1b565b600054610100900460ff16614a6d5760405162461bcd60e51b815260040161151890615a1b565b61189e3361319e565b600054610100900460ff16614a9d5760405162461bcd60e51b815260040161151890615a1b565b61189e614c05565b600054610100900460ff16614acc5760405162461bcd60e51b815260040161151890615a1b565b61189e614c38565b600054610100900460ff16614afb5760405162461bcd60e51b815260040161151890615a1b565b4261016155565b600054610100900460ff16614b295760405162461bcd60e51b815260040161151890615a1b565b611aaf838383614c5f565b600054610100900460ff16614b5b5760405162461bcd60e51b815260040161151890615a1b565b6101f980546001600160a01b0319166001600160a01b0392909216919091179055565b606061132c8484600085614e3c565b6060600080856001600160a01b031685604051614baa9190615b34565b600060405180830381855af49150503d8060008114614be5576040519150601f19603f3d011682016040523d82523d6000602084013e614bea565b606091505b5091509150614bfb86838387614f17565b9695505050505050565b600054610100900460ff16614c2c5760405162461bcd60e51b815260040161151890615a1b565b60c9805460ff19169055565b600054610100900460ff16612c2e5760405162461bcd60e51b815260040161151890615a1b565b600054610100900460ff16614c865760405162461bcd60e51b815260040161151890615a1b565b60fd614c928482615b9e565b5060fe614c9f8382615b9e565b508051614cb39060ff906020840190614fb5565b5060005b8151811015614d1d5760016101006000848481518110614cd957614cd96157b7565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580614d15816157e6565b915050614cb7565b506040516329965a1d60e01b815230600482018190527fac7fbab5f54a3ca8194167523c6753bfeb96a445279294b6125b68cce217705460248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad24906329965a1d90606401600060405180830381600087803b158015614d9757600080fd5b505af1158015614dab573d6000803e3d6000fd5b50506040516329965a1d60e01b815230600482018190527faea199e31a596269b42cdafd93407f14436db6e4cad65417994c2eb37381e05a60248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad2492506329965a1d9150606401600060405180830381600087803b158015614e2857600080fd5b505af1158015612b18573d6000803e3d6000fd5b606082471015614e9d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611518565b600080866001600160a01b03168587604051614eb99190615b34565b60006040518083038185875af1925050503d8060008114614ef6576040519150601f19603f3d011682016040523d82523d6000602084013e614efb565b606091505b5091509150614f0c87838387614f17565b979650505050505050565b60608315614f86578251600003614f7f576001600160a01b0385163b614f7f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611518565b508161132c565b61132c8383815115614f9b5781518083602001fd5b8060405162461bcd60e51b815260040161151891906150eb565b82805482825590600052602060002090810192821561500a579160200282015b8281111561500a57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614fd5565b50615016929150615039565b5090565b604051806105c00160405280602e906020820280368337509192915050565b5b80821115615016576000815560010161503a565b6020808252825182820181905260009190848201906040850190845b8181101561508f5783516001600160a01b03168352928401929184019160010161506a565b50909695505050505050565b60005b838110156150b657818101518382015260200161509e565b50506000910152565b600081518084526150d781602086016020860161509b565b601f01601f19169290920160200192915050565b60208152600061118b60208301846150bf565b60006020828403121561511057600080fd5b5035919050565b6001600160a01b038116811461126757600080fd5b80356113a681615117565b6000806040838503121561514a57600080fd5b823561515581615117565b946020939093013593505050565b801515811461126757600080fd5b60006020828403121561518357600080fd5b813561118b81615163565b6000602082840312156151a057600080fd5b813561118b81615117565b6000806000606084860312156151c057600080fd5b83356151cb81615117565b925060208401356151db81615117565b929592945050506040919091013590565b600080604083850312156151ff57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561524d5761524d61520e565b604052919050565b600067ffffffffffffffff82111561526f5761526f61520e565b50601f01601f191660200190565b600082601f83011261528e57600080fd5b81356152a161529c82615255565b615224565b8181528460208386010111156152b657600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156152e657600080fd5b82356152f181615117565b9150602083013567ffffffffffffffff81111561530d57600080fd5b6153198582860161527d565b9150509250929050565b600080600080600060a0868803121561533b57600080fd5b853561534681615117565b9450602086013561535681615117565b935060408601359250606086013567ffffffffffffffff8082111561537a57600080fd5b61538689838a0161527d565b9350608088013591508082111561539c57600080fd5b506153a98882890161527d565b9150509295509295909350565b600080604083850312156153c957600080fd5b8235915060208301356153db81615117565b809150509250929050565b600080604083850312156153f957600080fd5b823561540481615117565b915060208301356153db81615163565b600082601f83011261542557600080fd5b8135602067ffffffffffffffff8211156154415761544161520e565b8160051b615450828201615224565b928352848101820192828101908785111561546a57600080fd5b83870192505b84831015614f0c57823561548381615117565b82529183019190830190615470565b6000602082840312156154a457600080fd5b813567ffffffffffffffff8111156154bb57600080fd5b61132c84828501615414565b6000806000606084860312156154dc57600080fd5b83356154e781615117565b925060208401359150604084013567ffffffffffffffff81111561550a57600080fd5b6155168682870161527d565b9150509250925092565b60008060006060848603121561553557600080fd5b83359250602084013561554781615117565b9150604084013561555781615117565b809150509250925092565b6000806040838503121561557557600080fd5b823561558081615117565b915060208301356153db81615117565b600080600080608085870312156155a657600080fd5b84356155b181615117565b935060208501359250604085013567ffffffffffffffff808211156155d557600080fd5b6155e18883890161527d565b935060608701359150808211156155f757600080fd5b506156048782880161527d565b91505092959194509250565b600080600080600080600080610100898b03121561562d57600080fd5b6156368961512c565b975061564460208a0161512c565b96506040890135955060608901359450608089013567ffffffffffffffff8082111561566f57600080fd5b61567b8c838d0161527d565b955060a08b013591508082111561569157600080fd5b61569d8c838d0161527d565b945060c08b01359150808211156156b357600080fd5b506156c08b828c01615414565b92505060e089013590509295985092959890939650565b600080604083850312156156ea57600080fd5b82359150602083013567ffffffffffffffff81111561530d57600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156111b1576111b1615708565b600181811c9082168061574557607f821691505b60208210810361576557634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156111b1576111b1615708565b80820281158282048414176111b1576111b1615708565b6000826157b257634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156157df57600080fd5b5051919050565b6000600182016157f8576157f8615708565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252602c908201527f4552433737373a2063616c6c6572206973206e6f7420616e206f70657261746f60408201526b39103337b9103437b63232b960a11b606082015260800190565b6000602082840312156158f557600080fd5b815167ffffffffffffffff81111561590c57600080fd5b8201601f8101841361591d57600080fd5b805161592b61529c82615255565b81815285602083850101111561594057600080fd5b61595182602083016020860161509b565b95945050505050565b6000825161596c81846020870161509b565b7320456f6e69616e205661756c742053686172657360601b920191825250601401919050565b6232b7b760e91b8152600082516159b081600385016020870161509b565b9190910160030192915050565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156159e557600080fd5b815161118b81615117565b838152606060208201526000615a0960608301856150bf565b8281036040840152614bfb81856150bf565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160a01b0387811682528681166020830152851660408201526060810184905260c060808201819052600090615aa1908301856150bf565b82810360a084015261274b81856150bf565b81518152602080830151818301526040808401516001600160a01b0316908301526060808401519083015260808084015161064084019291840160005b602e811015615b0d57825182529183019190830190600101615af0565b5050505092915050565b600060208284031215615b2957600080fd5b815161118b81615163565b60008251615b4681846020870161509b565b9190910192915050565b601f821115611aaf57600081815260208120601f850160051c81016020861015615b775750805b601f850160051c820191505b81811015615b9657828155600101615b83565b505050505050565b815167ffffffffffffffff811115615bb857615bb861520e565b615bcc81615bc68454615731565b84615b50565b602080601f831160018114615c015760008415615be95750858301515b600019600386901b1c1916600185901b178555615b96565b600085815260208120601f198616915b82811015615c3057888601518255948401946001909101908401615c11565b5085821015615c4e5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122031ca5a41603093558b3a52b7b3a64d18f18750f97dd820a3a0f618526985247064736f6c63430008130033", + "deployedBytecode": "0x6080604052600436106104e15760003560e01c80638da5cb5b11610281578063c9faa7c51161015a578063ed8384f8116100cc578063fc673c4f11610085578063fc673c4f14610f97578063fc7b9c1814610fb7578063fd967f4714610fce578063fe41401514610fe4578063fe56e23214611004578063fe9d93031461102457600080fd5b8063ed8384f814610e94578063ef8b30f714610eb4578063f2fde38b14610ed4578063f5a3bfad14610ef4578063f76e4caa14610f57578063fad8b32a14610f7757600080fd5b8063d905777e1161011e578063d905777e14610dad578063d95b637114610dcd578063db006a7514610ded578063dd62ed3e14610e0d578063dd723c1b14610e54578063ec38a86214610e7457600080fd5b8063c9faa7c514610d07578063ce348c6f14610d40578063ce96cb7714610d56578063cea55f5714610d76578063cfbde32614610d8d57600080fd5b8063b3d7f6b9116101f3578063c17047ed116101b7578063c17047ed14610c47578063c3535b5214610c81578063c63d75b61461084a578063c6e6f59214610ca7578063c822adda14610cc7578063c9411e2214610ce757600080fd5b8063b3d7f6b914610ba7578063b460af9414610bc7578063b6b55f2514610be7578063ba08765214610c07578063bb994d4814610c2757600080fd5b806399089a4e1161024557806399089a4e14610aef5780639bd9bbc614610b0f5780639ec5a89414610b2f578063a0712d6814610b50578063a6f7f5d614610b70578063a9059cbb14610b8757600080fd5b80638da5cb5b14610a645780638dfa4f0714610a8357806394bf804d14610a9a578063959b8c3f14610aba57806395d89b4114610ada57600080fd5b80633659cfe6116103be57806354fd4d501161033057806370a08231116102e957806370a08231146109bf578063715018a6146109f5578063759076e51461062457806380d5785514610a0a578063861d68d914610a44578063884719f214610a0a57600080fd5b806354fd4d5014610911578063556f0dc71461093f57806357db845a146109535780635c975abb1461096a57806362ad1b831461097f5780636e553f651461099f57600080fd5b8063411b007e11610382578063411b007e1461086c5780634a8c1fb41461088d5780634cdad506146108b25780634f1ef286146108d257806352d1902d146108e5578063547ccc91146108fa57600080fd5b80633659cfe6146107d457806338d52e0f146107f457806339d97c53146108155780633c93b9f214610835578063402d267d1461084a57600080fd5b80631415fa481161045757806323b872dd1161041b57806323b872dd146106f8578063267c1408146107185780632e1a7d4d146107345780632ff7709e14610754578063313ce5671461077e5780633306bc5b1461079a57600080fd5b80631415fa481461066157806314c644021461068357806318160ddd146106a3578063201afd83146106b8578063207b27df146106d857600080fd5b806307cc692f116104a957806307cc692f14610587578063095ea7b31461059c5780630a28a477146105cc5780630a96bb53146105ec5780630baabd7a14610624578063125317291461064a57600080fd5b806301e1d114146104e657806306e485381461050e57806306f94a0d1461053057806306fdde031461054557806307a2d13a14610567575b600080fd5b3480156104f257600080fd5b506104fb611044565b6040519081526020015b60405180910390f35b34801561051a57600080fd5b50610523611065565b604051610505919061504e565b34801561053c57600080fd5b506104fb6110c7565b34801561055157600080fd5b5061055a6110d2565b60405161050591906150eb565b34801561057357600080fd5b506104fb6105823660046150fe565b61115b565b34801561059357600080fd5b506104fb611192565b3480156105a857600080fd5b506105bc6105b7366004615137565b61119d565b6040519015158152602001610505565b3480156105d857600080fd5b506104fb6105e73660046150fe565b6111b7565b3480156105f857600080fd5b5061060c6106073660046150fe565b6111e8565b6040516001600160a01b039091168152602001610505565b34801561063057600080fd5b5033600090815261016260205260409020600201546104fb565b34801561065657600080fd5b506104fb6102975481565b34801561066d57600080fd5b5061068161067c3660046150fe565b611213565b005b34801561068f57600080fd5b5061068161069e366004615171565b611252565b3480156106af57600080fd5b5060fc546104fb565b3480156106c457600080fd5b506106816106d336600461518e565b611272565b3480156106e457600080fd5b506104fb6106f336600461518e565b6112d9565b34801561070457600080fd5b506105bc6107133660046151ab565b611334565b34801561072457600080fd5b506104fb670de0b6b3a764000081565b34801561074057600080fd5b506104fb61074f3660046150fe565b61137a565b34801561076057600080fd5b506107696113ab565b60408051928352602083019190915201610505565b34801561078a57600080fd5b5060405160128152602001610505565b3480156107a657600080fd5b506104fb6107b536600461518e565b6001600160a01b03166000908152610162602052604090206001015490565b3480156107e057600080fd5b506106816107ef36600461518e565b6114d0565b34801561080057600080fd5b506101f95461060c906001600160a01b031681565b34801561082157600080fd5b506106816108303660046151ec565b6115b5565b34801561084157600080fd5b506104fb611695565b34801561085657600080fd5b506104fb61086536600461518e565b5060001990565b34801561087857600080fd5b506102945461060c906001600160a01b031681565b34801561089957600080fd5b50336000908152610162602052604090205415156105bc565b3480156108be57600080fd5b506104fb6108cd3660046150fe565b6116ad565b6106816108e03660046152d3565b6116b8565b3480156108f157600080fd5b506104fb611788565b34801561090657600080fd5b506104fb6102965481565b34801561091d57600080fd5b506040805180820190915260058152640302e322e360dc1b602082015261055a565b34801561094b57600080fd5b5060016104fb565b34801561095f57600080fd5b506104fb6101615481565b34801561097657600080fd5b506105bc61183b565b34801561098b57600080fd5b5061068161099a366004615323565b611845565b3480156109ab57600080fd5b506104fb6109ba3660046153b6565b611881565b3480156109cb57600080fd5b506104fb6109da36600461518e565b6001600160a01b0316600090815260fb602052604090205490565b348015610a0157600080fd5b5061068161188c565b348015610a1657600080fd5b506104fb610a2536600461518e565b6001600160a01b03166000908152610162602052604090206002015490565b348015610a5057600080fd5b50610681610a5f3660046153e6565b6118a0565b348015610a7057600080fd5b50610195546001600160a01b031661060c565b348015610a8f57600080fd5b506104fb6102985481565b348015610aa657600080fd5b506104fb610ab53660046153b6565b61192e565b348015610ac657600080fd5b50610681610ad536600461518e565b611939565b348015610ae657600080fd5b5061055a611a59565b348015610afb57600080fd5b50610681610b0a366004615492565b611a68565b348015610b1b57600080fd5b50610681610b2a3660046154c7565b611a91565b348015610b3b57600080fd5b506102935461060c906001600160a01b031681565b348015610b5c57600080fd5b506104fb610b6b3660046150fe565b611ab4565b348015610b7c57600080fd5b506104fb6102955481565b348015610b9357600080fd5b506105bc610ba2366004615137565b611ad4565b348015610bb357600080fd5b506104fb610bc23660046150fe565b611b0c565b348015610bd357600080fd5b506104fb610be2366004615520565b611b3c565b348015610bf357600080fd5b506104fb610c023660046150fe565b611b47565b348015610c1357600080fd5b506104fb610c22366004615520565b611b5a565b348015610c3357600080fd5b50610681610c4236600461518e565b611b65565b348015610c5357600080fd5b506104fb610c6236600461518e565b6001600160a01b03166000908152610162602052604090206003015490565b348015610c8d57600080fd5b5033600090815261016260205260409020600101546104fb565b348015610cb357600080fd5b506104fb610cc23660046150fe565b611c06565b348015610cd357600080fd5b5061060c610ce23660046150fe565b611c37565b348015610cf357600080fd5b50610681610d02366004615137565b611c48565b348015610d1357600080fd5b506105bc610d2236600461518e565b6001600160a01b031660009081526101626020526040902054151590565b348015610d4c57600080fd5b5061025e546104fb565b348015610d6257600080fd5b506104fb610d7136600461518e565b611ce5565b348015610d8257600080fd5b506104fb6101605481565b348015610d9957600080fd5b50610681610da83660046150fe565b611d07565b348015610db957600080fd5b506104fb610dc836600461518e565b611d77565b348015610dd957600080fd5b506105bc610de8366004615562565b611d95565b348015610df957600080fd5b506104fb610e083660046150fe565b611e39565b348015610e1957600080fd5b506104fb610e28366004615562565b6001600160a01b0391821660009081526101036020908152604080832093909416825291909152205490565b348015610e6057600080fd5b50610681610e6f3660046151ec565b611eaa565b348015610e8057600080fd5b50610681610e8f36600461518e565b611f86565b348015610ea057600080fd5b5061060c610eaf3660046150fe565b611fb1565b348015610ec057600080fd5b506104fb610ecf3660046150fe565b611fc2565b348015610ee057600080fd5b50610681610eef36600461518e565b611fcd565b348015610f0057600080fd5b50610f37610f0f36600461518e565b6101626020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610505565b348015610f6357600080fd5b50610681610f7236600461518e565b612043565b348015610f8357600080fd5b50610681610f9236600461518e565b612118565b348015610fa357600080fd5b50610681610fb2366004615590565b612236565b348015610fc357600080fd5b506104fb61015f5481565b348015610fda57600080fd5b506104fb61271081565b348015610ff057600080fd5b50610681610fff366004615610565b61226e565b34801561101057600080fd5b5061068161101f3660046150fe565b6124e5565b34801561103057600080fd5b5061068161103f3660046156d7565b612524565b600061104e61253f565b611056611695565b611060919061571e565b905090565b606060ff8054806020026020016040519081016040528092919081815260200182805480156110bd57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161109f575b5050505050905090565b6000611060336125b4565b606060fd80546110e190615731565b80601f016020809104026020016040519081016040528092919081815260200182805461110d90615731565b80156110bd5780601f1061112f576101008083540402835291602001916110bd565b820191906000526020600020905b81548152906001019060200180831161113d57509395945050505050565b60008061116760fc5490565b905080600003611178575090919050565b61118b611183611044565b84908361264b565b9392505050565b60006110603361266a565b6000336111ab818585612758565b60019150505b92915050565b6000806111c360fc5490565b9050806000036111d4575090919050565b61118b816111e0611044565b859190612880565b61029181815481106111f957600080fd5b6000918252602090912001546001600160a01b0316905081565b61121b6128ae565b612710610295548261122d919061576b565b111561124c57604051630bc4369360e21b815260040160405180910390fd5b61029655565b61125a6128ae565b8061126a57611267612909565b50565b61126761295b565b61127a6128ae565b61029480546001600160a01b03929092166001600160a01b0319928316811790915561029280546001810182556000919091527f47dc9219577b597b6eada661683162be71a26f1593fe5b77c8b669bbbc7a8b1b018054909216179055565b6000806112e4611695565b6001600160a01b03841660009081526101626020526040812060020154919250829003611315575060009392505050565b816113226127108361577e565b61132c9190615795565b949350505050565b600033611342858285612998565b61136f85858560405180602001604052806000815250604051806020016040528060008152506000612a25565b506001949350505050565b6000611384612b21565b61138d826111b7565b905061139b82823333612b7c565b6113a6600161012d55565b919050565b60008060008061015f546000036113c85750600093849350915050565b60005b61025e548110156114b357600061025e82815481106113ec576113ec6157b7565b60009182526020822001546001600160a01b0316915061140b826112d9565b9050611417818661576b565b9450612710826001600160a01b0316632ff7709e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561145a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147e91906157cd565b611488908361577e565b6114929190615795565b61149c908561576b565b9350505080806114ab906157e6565b9150506113cb565b50816000036114c85750600093849350915050565b939092509050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115215760405162461bcd60e51b8152600401611518906157ff565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661156a600080516020615c5f833981519152546001600160a01b031690565b6001600160a01b0316146115905760405162461bcd60e51b81526004016115189061584b565b61159981612c36565b6040805160008082526020820190925261126791839190612c3e565b336000908152610162602052604081205490036115e557604051630160ef0b60e51b815260040160405180910390fd5b6115ed612b21565b806115f733612da9565b10156116455760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f7567682061737365747320666f72207061796d656e740000006044820152606401611518565b8115611655576116553383612e19565b6116623382600085612f79565b61166b826130fa565b611676600161012d55565b5050426101618190553360009081526101626020526040902060010155565b600061015f546116a3613126565b611060919061576b565b60006111b18261115b565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036117005760405162461bcd60e51b8152600401611518906157ff565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611749600080516020615c5f833981519152546001600160a01b031690565b6001600160a01b03161461176f5760405162461bcd60e51b81526004016115189061584b565b61177882612c36565b61178482826001612c3e565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118285760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611518565b50600080516020615c5f83398151915290565b6000611060613194565b61184f3386611d95565b61186b5760405162461bcd60e51b815260040161151890615897565b61187a85858585856001612a25565b5050505050565b600061118b83611b47565b6118946128ae565b61189e600061319e565b565b6118a86128ae565b60006118b661025e846131f1565b9050806118d657604051632df15a4160e11b815260040160405180910390fd5b816118e4576118e483613326565b826001600160a01b03167fb6a4d3fee462ca7c56e3e87f5942581b478433cf0003d49e1750c1ad1539ee3083604051611921911515815260200190565b60405180910390a2505050565b600061118b83611ab4565b6001600160a01b038116330361199d5760405162461bcd60e51b8152602060048201526024808201527f4552433737373a20617574686f72697a696e672073656c66206173206f70657260448201526330ba37b960e11b6064820152608401611518565b6001600160a01b0381166000908152610100602052604090205460ff16156119f057336000908152610102602090815260408083206001600160a01b03851684529091529020805460ff19169055611a20565b336000908152610101602090815260408083206001600160a01b03851684529091529020805460ff191660011790555b60405133906001600160a01b038316907ff4caeb2d6ca8932a215a353d0703c326ec2d81fc68170f320eb2ab49e9df61f990600090a350565b606060fe80546110e190615731565b611a706128ae565b611a7c61025e82613390565b80516117849161025e91602090910190614fb5565b611aaf33848484604051806020016040528060008152506001612a25565b505050565b6000611abe612b21565b611ac782611b0c565b905061139b818333613482565b6000611b0333848460405180602001604052806000815250604051806020016040528060008152506000612a25565b50600192915050565b600080611b1860fc5490565b905080600003611b29575090919050565b61118b611b34611044565b849083612880565b600061132c8461137a565b6000611b51613515565b6111b18261355d565b600061132c84611e39565b80611b79610195546001600160a01b031690565b6001600160a01b0316336001600160a01b031614158015611ba35750336001600160a01b03821614155b15611bc357604051630869704160e41b8152336004820152602401611518565b611bce8260006135cd565b6040516001600160a01b038316907f4201c688d84c01154d321afa0c72f1bffe9eef53005c9de9d035074e71e9b32a90600090a25050565b600080611c1260fc5490565b905080600003611c23575090919050565b61118b81611c2f611044565b85919061264b565b61025e81815481106111f957600080fd5b611c506128ae565b611c58613515565b6001600160a01b038216611c7f5760405163f5bf603960e01b815260040160405180910390fd5b611c88826136b5565b611c9282826137c6565b611c9e61025e83613896565b816001600160a01b03167f2f564a83158ad1831793ad3e69257b52f39ece5d49cb0d8746708ecb9ef964da82604051611cd991815260200190565b60405180910390a25050565b6001600160a01b038116600090815260fb60205260408120546111b19061115b565b611d0f6128ae565b670de0b6b3a7640000811115611d3b57604051639058c3f760e01b815260048101829052602401611518565b6102988190556040518181527f6619a135102d0d043ca15a77ad3878b0c97fb8ead5829208b0f79c00711fa7c79060200160405180910390a150565b6001600160a01b038116600090815260fb60205260408120546111b1565b6000816001600160a01b0316836001600160a01b03161480611e0257506001600160a01b0383166000908152610100602052604090205460ff168015611e0257506001600160a01b038083166000908152610102602090815260408083209387168352929052205460ff16155b8061118b5750506001600160a01b039081166000908152610101602090815260408083209490931682529290925290205460ff1690565b6000611e43612b21565b611e4c826116ad565b905080600003611e9e5760405162461bcd60e51b815260206004820181905260248201527f476976656e2073686172657320726573756c7420696e2030206173736574732e6044820152606401611518565b61139b81833333612b7c565b33600090815261016260205260408120549003611eda57604051630160ef0b60e51b815260040160405180910390fd5b611ee2612b21565b611eec818361576b565b611ef533612da9565b1015611f145760405163112093df60e31b815260040160405180910390fd5b60008083118015611f375750336000908152610162602052604090206001015442115b8015611f525750336000908152610162602052604090205442115b15611f6357611f60836138ca565b90505b611f703383856000612f79565b611f7a8382613993565b50611676600161012d55565b611f8e6128ae565b61029380546001600160a01b0319166001600160a01b0392909216919091179055565b61029281815481106111f957600080fd5b60006111b182611c06565b611fd56128ae565b6001600160a01b03811661203a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611518565b6112678161319e565b61204b6128ae565b6001600160a01b0381166120725760405163f5bf603960e01b815260040160405180910390fd5b61207e61025e826139b1565b1561209c5760405163c45546f760e01b815260040160405180910390fd5b6001600160a01b0381166000908152610162602052604081205490036120d5576040516332ffc55b60e11b815260040160405180910390fd5b6120e161025e82613896565b6040516001600160a01b038216907f0bd7504c563a4658373bef3dbb51f91f63b8c6d5ba60806c678e75df33b4569890600090a250565b336001600160a01b0382160361217a5760405162461bcd60e51b815260206004820152602160248201527f4552433737373a207265766f6b696e672073656c66206173206f70657261746f6044820152603960f91b6064820152608401611518565b6001600160a01b0381166000908152610100602052604090205460ff16156121d057336000908152610102602090815260408083206001600160a01b03851684529091529020805460ff191660011790556121fd565b336000908152610101602090815260408083206001600160a01b03851684529091529020805460ff191690555b60405133906001600160a01b038316907f50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa190600090a350565b6122403385611d95565b61225c5760405162461bcd60e51b815260040161151890615897565b61226884848484613a1a565b50505050565b600054610100900460ff161580801561228e5750600054600160ff909116105b806122a85750303b1580156122a8575060005460ff166001145b61230b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611518565b6000805460ff19166001179055801561232e576000805461ff0019166101001790555b612336613bcf565b61233e613c06565b61247089865160001461235157866123d7565b8a6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561238f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123b791908101906158e3565b6040516020016123c7919061595a565b6040516020818303038152906040525b8651156123e4578661246a565b8b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015612422573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261244a91908101906158e3565b60405160200161245a9190615992565b6040516020818303038152906040525b86613ca0565b61247988611f86565b612482876124e5565b61248b86611d07565b61249482611213565b80156124da576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b6124ed6128ae565b61271061029654826124ff919061576b565b111561251e57604051630bc4369360e21b815260040160405180910390fd5b61029555565b61178433838360405180602001604052806000815250613a1a565b600080610298546101615442612555919061571e565b61255f919061577e565b9050670de0b6b3a7640000811061257857600091505090565b6000670de0b6b3a76400006102975483612592919061577e565b61259c9190615795565b905080610297546125ad919061571e565b9250505090565b6001600160a01b038116600090815261016260205260408120600201546125d961183b565b806125e5575061016054155b156125f05792915050565b60006127106125fd611695565b6001600160a01b03861660009081526101626020526040902060030154612624919061577e565b61262e9190615795565b9050808211612641575060009392505050565b61132c818361571e565b82820281151584158583048514171661266357600080fd5b0492915050565b600061267461183b565b1561268157506000919050565b600061268b613cd3565b61015f54909150600061271061269f611695565b6001600160a01b038716600090815261016260205260409020600301546126c6919061577e565b6126d09190615795565b6001600160a01b0386166000908152610162602052604090206002015490915082841115806126ff5750808211155b156127105750600095945050505050565b600061271c848661571e565b9050600061272a838561571e565b905060006127388383613cf8565b905061274b81612746613126565b613cf8565b9998505050505050505050565b6001600160a01b0383166127bc5760405162461bcd60e51b815260206004820152602560248201527f4552433737373a20617070726f76652066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611518565b6001600160a01b03821661281e5760405162461bcd60e51b815260206004820152602360248201527f4552433737373a20617070726f766520746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611518565b6001600160a01b038381166000818152610103602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b82820281151584158583048514171661289857600080fd5b6001826001830304018115150290509392505050565b610195546001600160a01b0316331461189e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611518565b612911613d0e565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b612963613515565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861293e3390565b6001600160a01b038381166000908152610103602090815260408083209386168352929052205460001981146122685781811015612a185760405162461bcd60e51b815260206004820152601e60248201527f4552433737373a20696e73756666696369656e7420616c6c6f77616e636500006044820152606401611518565b6122688484848403612758565b6001600160a01b038616612a8a5760405162461bcd60e51b815260206004820152602660248201527f4552433737373a207472616e736665722066726f6d20746865207a65726f206160448201526564647265737360d01b6064820152608401611518565b6001600160a01b038516612aec5760405162461bcd60e51b8152602060048201526024808201527f4552433737373a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401611518565b33612afb818888888888613d59565b612b09818888888888613e80565b612b1881888888888888613fe6565b50505050505050565b600261012d5403612b745760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611518565b600261012d55565b336001600160a01b03821614612b9757612b97813385612998565b612ba184846141ab565b612bcb81846040518060200160405280600081525060405180602001604052806000815250613a1a565b60408051858152602081018590526001600160a01b03808416929085169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46101f954612268906001600160a01b03168386614325565b600161012d55565b6112676128ae565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612c7157611aaf83614388565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612ccb575060408051601f3d908101601f19168201909252612cc8918101906157cd565b60015b612d2e5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611518565b600080516020615c5f8339815191528114612d9d5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611518565b50611aaf838383614424565b6101f9546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa158015612df5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b191906157cd565b6001600160a01b0382166000908152610162602052604090206002015481811015612e865760405162461bcd60e51b815260206004820152601d60248201527f4c6f73732069732067726561746572207468616e2074686520646562740000006044820152606401611518565b6101605415612f29576000612ed361015f548461016054612ea7919061577e565b612eb19190615795565b6001600160a01b03861660009081526101626020526040902060030154613cf8565b90508015612f27576001600160a01b0384166000908152610162602052604081206003018054839290612f0790849061571e565b92505081905550806101606000828254612f21919061571e565b90915550505b505b6001600160a01b0383166000908152610162602052604081206002018054849290612f5590849061571e565b925050819055508161015f6000828254612f6f919061571e565b9091555050505050565b6000612f848561266a565b90506000612f91336125b4565b9050612f9d8582613cf8565b94508415612ff1576001600160a01b0386166000908152610162602052604081206002018054879290612fd190849061571e565b925050819055508461015f6000828254612feb919061571e565b90915550505b8115613043576001600160a01b038616600090815261016260205260408120600201805484929061302390849061576b565b925050819055508161015f600082825461303d919061576b565b90915550505b600061304f868661576b565b90506000808483101561307757613066838661571e565b91506130728983614449565b613095565b8483111561309557613089858461571e565b90506130958982614461565b604080518981526020810189905290810183905260608101829052608081018790526001600160a01b038a16907f92a0cdbae2e10dc214d482504ecbf0461593fd2fbfbedad5a195f5ebb7dcee739060a00160405180910390a2505050505050505050565b600061310461253f565b905081811161311457600061311e565b61311e828261571e565b610297555050565b6101f9546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015613170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106091906157cd565b600061106061447a565b61019580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008060005b84548110156132e657836001600160a01b031685828154811061321c5761321c6157b7565b6000918252602090912001546001600160a01b03160361323b57600191505b818015613254575084546132519060019061571e565b81105b156132d4578461326582600161576b565b81548110613275576132756157b7565b9060005260206000200160009054906101000a90046001600160a01b03168582815481106132a5576132a56157b7565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b806132de816157e6565b9150506131f7565b50801561118b57838054806132fd576132fd6159bd565b600082815260209020810160001990810180546001600160a01b03191690550190559392505050565b6001600160a01b03811660009081526101626020526040902060030154156133615760405163c69bfc5f60e01b815260040160405180910390fd5b6001600160a01b0316600090815261016260205260408120818155600181018290556002810182905560030155565b815481516060919081146133b7576040516336c2ff5d60e01b815260040160405180910390fd5b60005b818110156134795760008582815481106133d6576133d66157b7565b60009182526020822001546001600160a01b031691505b8381101561346457858181518110613407576134076157b7565b60200260200101516001600160a01b0316826001600160a01b031603156134645761343360018561571e565b8103613452576040516336c2ff5d60e01b815260040160405180910390fd5b8061345c816157e6565b9150506133ed565b50508080613471906157e6565b9150506133ba565b50919392505050565b6101f95461349b906001600160a01b0316333086614488565b6134c5818360405180602001604052806000815250604051806020016040528060008152506144c0565b60408051848152602081018490526001600160a01b0383169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3611aaf83836144ce565b61351d61183b565b1561189e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611518565b6000613567612b21565b61357082611fc2565b9050806000036135c25760405162461bcd60e51b815260206004820181905260248201527f476976656e2061737365747320726573756c7420696e2030207368617265732e6044820152606401611518565b61139b828233613482565b6001600160a01b03821660009081526101626020526040902054613604576040516332ffc55b60e11b815260040160405180910390fd5b6001600160a01b0382166000908152610162602052604081206003015461016080549192909161363590849061571e565b90915550506001600160a01b038216600090815261016260205260408120600301829055610160805483929061366c90849061576b565b909155505061016054612710101561178457806101605461368d919061571e565b6136999061271061571e565b604051639eb4cd0560e01b815260040161151891815260200190565b806001600160a01b031663bcead63e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156136f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061371791906159d3565b6001600160a01b0316306001600160a01b03161415806137a85750806001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613770573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379491906159d3565b6101f9546001600160a01b03908116911614155b1561126757604051631120dc3360e21b815260040160405180910390fd5b6001600160a01b03821660009081526101626020526040902054156137fe576040516312635b0b60e21b815260040160405180910390fd5b6127108161016054613810919061576b565b111561382657610160546136999061271061571e565b604080516080810182524280825260208083019182526000838501818152606085018781526001600160a01b03891683526101629093529481209351845591516001840155925160028301559151600390910155610160805483929061388d90849061576b565b90915550505050565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b03909216919091179055565b60008061271061029554846138df919061577e565b6138e99190615795565b905080156139325761029354613932906001600160a01b031661390b83611c06565b604051806020016040528060008152506040518060200160405280600081525060006144d8565b610294546001600160a01b03166139495792915050565b6000612710610296548561395d919061577e565b6139679190615795565b905080156139895761029454613989906001600160a01b031661390b83611c06565b61132c818361576b565b808261399d61253f565b6139a7919061576b565b61311e919061571e565b6000805b8354811015613a1057826001600160a01b03168482815481106139da576139da6157b7565b6000918252602090912001546001600160a01b0316036139fe5760019150506111b1565b80613a08816157e6565b9150506139b5565b5060009392505050565b6001600160a01b038416613a7b5760405162461bcd60e51b815260206004820152602260248201527f4552433737373a206275726e2066726f6d20746865207a65726f206164647265604482015261737360f01b6064820152608401611518565b33613a8b81866000878787613d59565b6001600160a01b038516600090815260fb602052604090205484811015613b005760405162461bcd60e51b815260206004820152602360248201527f4552433737373a206275726e20616d6f756e7420657863656564732062616c616044820152626e636560e81b6064820152608401611518565b6001600160a01b038616600090815260fb60205260408120868303905560fc8054879290613b2f90849061571e565b92505081905550856001600160a01b0316826001600160a01b03167fa78a9be3a7b862d26933ad85fb11d80ef66b8f972d7cbba06621d583943a4098878787604051613b7d939291906159f0565b60405180910390a36040518581526000906001600160a01b038816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a3505050505050565b600054610100900460ff16613bf65760405162461bcd60e51b815260040161151890615a1b565b613bfe614615565b61189e614644565b600054610100900460ff16613c2d5760405162461bcd60e51b815260040161151890615a1b565b6000613c42610195546001600160a01b031690565b6001600160a01b031603613c985760405162461bcd60e51b815260206004820181905260248201527f537472617465676965734c656e646572206d757374206265206f776e61626c656044820152606401611518565b61189e614673565b600054610100900460ff16613cc75760405162461bcd60e51b815260040161151890615a1b565b612268848484846146b2565b6000612710613ce0611695565b61016054613cee919061577e565b6110609190615795565b6000818310613d07578161118b565b5090919050565b613d1661183b565b61189e5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611518565b60405163555ddc6560e11b81526001600160a01b03861660048201527f29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe8956024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015613dda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dfe91906159d3565b90506001600160a01b03811615612b1857604051633ad5cbc160e11b81526001600160a01b038216906375ab978290613e45908a908a908a908a908a908a90600401615a66565b600060405180830381600087803b158015613e5f57600080fd5b505af1158015613e73573d6000803e3d6000fd5b5050505050505050505050565b6001600160a01b038516600090815260fb602052604090205483811015613ef95760405162461bcd60e51b815260206004820152602760248201527f4552433737373a207472616e7366657220616d6f756e7420657863656564732060448201526662616c616e636560c81b6064820152608401611518565b6001600160a01b03808716600090815260fb6020526040808220878503905591871681529081208054869290613f3090849061576b565b92505081905550846001600160a01b0316866001600160a01b0316886001600160a01b03167f06b541ddaa720db2b10a4d0cdac39b8d360425fc073085fac19bc82614677987878787604051613f88939291906159f0565b60405180910390a4846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051613fd591815260200190565b60405180910390a350505050505050565b60405163555ddc6560e11b81526001600160a01b03861660048201527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b6024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015614067573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061408b91906159d3565b90506001600160a01b03811615614107576040516223de2960e01b81526001600160a01b038216906223de29906140d0908b908b908b908b908b908b90600401615a66565b600060405180830381600087803b1580156140ea57600080fd5b505af11580156140fe573d6000803e3d6000fd5b505050506141a1565b81156141a1576001600160a01b0386163b156141a15760405162461bcd60e51b815260206004820152604d60248201527f4552433737373a20746f6b656e20726563697069656e7420636f6e747261637460448201527f20686173206e6f20696d706c656d656e74657220666f7220455243373737546f60648201526c1ad95b9cd49958da5c1a595b9d609a1b608482015260a401611518565b5050505050505050565b816141b4613126565b106141bd575050565b60005b61025e548110156142e85760006141d5613126565b90508084116141e457506142e8565b600061025e83815481106141fa576141fa6157b7565b60009182526020822001546001600160a01b0316915061423f61421d848861571e565b6001600160a01b03841660009081526101626020526040902060020154613cf8565b905080600003614251575050506142d6565b604051632e1a7d4d60e01b8152600481018290526000906001600160a01b03841690632e1a7d4d906024016020604051808303816000875af115801561429b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142bf91906157cd565b905080156142d1576142d18382612e19565b505050505b806142e0816157e6565b9150506141c0565b50816142f2613126565b101561431b5760405163bce5067160e01b81526004810183905260248101829052604401611518565b61178482826146f5565b6040516001600160a01b038316602482015260448101829052611aaf90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526147ed565b6001600160a01b0381163b6143f55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611518565b600080516020615c5f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61442d836148c2565b60008251118061443a5750805b15611aaf576122688383614902565b6101f954611784906001600160a01b03168383614325565b6101f954611784906001600160a01b0316833084614488565b600061106060c95460ff1690565b6040516001600160a01b03808516602483015283166044820152606481018290526122689085906323b872dd60e01b90608401614351565b6122688484848460016144d8565b6117848282614927565b6001600160a01b03851661452e5760405162461bcd60e51b815260206004820181905260248201527f4552433737373a206d696e7420746f20746865207a65726f20616464726573736044820152606401611518565b60003390508460fc6000828254614545919061576b565b90915550506001600160a01b038616600090815260fb60205260408120805487929061457290849061576b565b9091555061458890508160008888888888613fe6565b856001600160a01b0316816001600160a01b03167f2fe5be0146f74c5bce36c0b80911af6c7d86ff27e89d5cfa61fc681327954e5d8787876040516145cf939291906159f0565b60405180910390a36040518581526001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001613bbf565b600054610100900460ff1661463c5760405162461bcd60e51b815260040161151890615a1b565b61189e614a1f565b600054610100900460ff1661466b5760405162461bcd60e51b815260040161151890615a1b565b61189e614a46565b600054610100900460ff1661469a5760405162461bcd60e51b815260040161151890615a1b565b6146a2614a76565b6146aa614aa5565b61189e614ad4565b600054610100900460ff166146d95760405162461bcd60e51b815260040161151890615a1b565b6146e4838383614b02565b6146ec614aa5565b61226884614b34565b61029154600003614704575050565b61470c61501a565b60006040518060a00160405280858152602001848152602001336001600160a01b0316815260200161473d33611ce5565b8152602001839052905060005b6102915481101561187a576000610291828154811061476b5761476b6157b7565b60009182526020909120015460405163894a16f560e01b81526001600160a01b039091169150819063894a16f5906147a7908690600401615ab3565b600060405180830381600087803b1580156147c157600080fd5b505af11580156147d5573d6000803e3d6000fd5b505050505080806147e5906157e6565b91505061474a565b6000614842826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614b7e9092919063ffffffff16565b90508051600014806148635750808060200190518101906148639190615b17565b611aaf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611518565b6148cb81614388565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061118b8383604051806060016040528060278152602001615c7f60279139614b8d565b61029254600003614936575050565b61493e61501a565b60006040518060a00160405280858152602001848152602001336001600160a01b0316815260200161496f33611ce5565b8152602001839052905060005b6102925481101561187a576000610292828154811061499d5761499d6157b7565b600091825260209091200154604051631a7e999b60e31b81526001600160a01b039091169150819063d3f4ccd8906149d9908690600401615ab3565b600060405180830381600087803b1580156149f357600080fd5b505af1158015614a07573d6000803e3d6000fd5b50505050508080614a17906157e6565b91505061497c565b600054610100900460ff1661189e5760405162461bcd60e51b815260040161151890615a1b565b600054610100900460ff16614a6d5760405162461bcd60e51b815260040161151890615a1b565b61189e3361319e565b600054610100900460ff16614a9d5760405162461bcd60e51b815260040161151890615a1b565b61189e614c05565b600054610100900460ff16614acc5760405162461bcd60e51b815260040161151890615a1b565b61189e614c38565b600054610100900460ff16614afb5760405162461bcd60e51b815260040161151890615a1b565b4261016155565b600054610100900460ff16614b295760405162461bcd60e51b815260040161151890615a1b565b611aaf838383614c5f565b600054610100900460ff16614b5b5760405162461bcd60e51b815260040161151890615a1b565b6101f980546001600160a01b0319166001600160a01b0392909216919091179055565b606061132c8484600085614e3c565b6060600080856001600160a01b031685604051614baa9190615b34565b600060405180830381855af49150503d8060008114614be5576040519150601f19603f3d011682016040523d82523d6000602084013e614bea565b606091505b5091509150614bfb86838387614f17565b9695505050505050565b600054610100900460ff16614c2c5760405162461bcd60e51b815260040161151890615a1b565b60c9805460ff19169055565b600054610100900460ff16612c2e5760405162461bcd60e51b815260040161151890615a1b565b600054610100900460ff16614c865760405162461bcd60e51b815260040161151890615a1b565b60fd614c928482615b9e565b5060fe614c9f8382615b9e565b508051614cb39060ff906020840190614fb5565b5060005b8151811015614d1d5760016101006000848481518110614cd957614cd96157b7565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580614d15816157e6565b915050614cb7565b506040516329965a1d60e01b815230600482018190527fac7fbab5f54a3ca8194167523c6753bfeb96a445279294b6125b68cce217705460248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad24906329965a1d90606401600060405180830381600087803b158015614d9757600080fd5b505af1158015614dab573d6000803e3d6000fd5b50506040516329965a1d60e01b815230600482018190527faea199e31a596269b42cdafd93407f14436db6e4cad65417994c2eb37381e05a60248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad2492506329965a1d9150606401600060405180830381600087803b158015614e2857600080fd5b505af1158015612b18573d6000803e3d6000fd5b606082471015614e9d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611518565b600080866001600160a01b03168587604051614eb99190615b34565b60006040518083038185875af1925050503d8060008114614ef6576040519150601f19603f3d011682016040523d82523d6000602084013e614efb565b606091505b5091509150614f0c87838387614f17565b979650505050505050565b60608315614f86578251600003614f7f576001600160a01b0385163b614f7f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611518565b508161132c565b61132c8383815115614f9b5781518083602001fd5b8060405162461bcd60e51b815260040161151891906150eb565b82805482825590600052602060002090810192821561500a579160200282015b8281111561500a57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614fd5565b50615016929150615039565b5090565b604051806105c00160405280602e906020820280368337509192915050565b5b80821115615016576000815560010161503a565b6020808252825182820181905260009190848201906040850190845b8181101561508f5783516001600160a01b03168352928401929184019160010161506a565b50909695505050505050565b60005b838110156150b657818101518382015260200161509e565b50506000910152565b600081518084526150d781602086016020860161509b565b601f01601f19169290920160200192915050565b60208152600061118b60208301846150bf565b60006020828403121561511057600080fd5b5035919050565b6001600160a01b038116811461126757600080fd5b80356113a681615117565b6000806040838503121561514a57600080fd5b823561515581615117565b946020939093013593505050565b801515811461126757600080fd5b60006020828403121561518357600080fd5b813561118b81615163565b6000602082840312156151a057600080fd5b813561118b81615117565b6000806000606084860312156151c057600080fd5b83356151cb81615117565b925060208401356151db81615117565b929592945050506040919091013590565b600080604083850312156151ff57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561524d5761524d61520e565b604052919050565b600067ffffffffffffffff82111561526f5761526f61520e565b50601f01601f191660200190565b600082601f83011261528e57600080fd5b81356152a161529c82615255565b615224565b8181528460208386010111156152b657600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156152e657600080fd5b82356152f181615117565b9150602083013567ffffffffffffffff81111561530d57600080fd5b6153198582860161527d565b9150509250929050565b600080600080600060a0868803121561533b57600080fd5b853561534681615117565b9450602086013561535681615117565b935060408601359250606086013567ffffffffffffffff8082111561537a57600080fd5b61538689838a0161527d565b9350608088013591508082111561539c57600080fd5b506153a98882890161527d565b9150509295509295909350565b600080604083850312156153c957600080fd5b8235915060208301356153db81615117565b809150509250929050565b600080604083850312156153f957600080fd5b823561540481615117565b915060208301356153db81615163565b600082601f83011261542557600080fd5b8135602067ffffffffffffffff8211156154415761544161520e565b8160051b615450828201615224565b928352848101820192828101908785111561546a57600080fd5b83870192505b84831015614f0c57823561548381615117565b82529183019190830190615470565b6000602082840312156154a457600080fd5b813567ffffffffffffffff8111156154bb57600080fd5b61132c84828501615414565b6000806000606084860312156154dc57600080fd5b83356154e781615117565b925060208401359150604084013567ffffffffffffffff81111561550a57600080fd5b6155168682870161527d565b9150509250925092565b60008060006060848603121561553557600080fd5b83359250602084013561554781615117565b9150604084013561555781615117565b809150509250925092565b6000806040838503121561557557600080fd5b823561558081615117565b915060208301356153db81615117565b600080600080608085870312156155a657600080fd5b84356155b181615117565b935060208501359250604085013567ffffffffffffffff808211156155d557600080fd5b6155e18883890161527d565b935060608701359150808211156155f757600080fd5b506156048782880161527d565b91505092959194509250565b600080600080600080600080610100898b03121561562d57600080fd5b6156368961512c565b975061564460208a0161512c565b96506040890135955060608901359450608089013567ffffffffffffffff8082111561566f57600080fd5b61567b8c838d0161527d565b955060a08b013591508082111561569157600080fd5b61569d8c838d0161527d565b945060c08b01359150808211156156b357600080fd5b506156c08b828c01615414565b92505060e089013590509295985092959890939650565b600080604083850312156156ea57600080fd5b82359150602083013567ffffffffffffffff81111561530d57600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156111b1576111b1615708565b600181811c9082168061574557607f821691505b60208210810361576557634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156111b1576111b1615708565b80820281158282048414176111b1576111b1615708565b6000826157b257634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156157df57600080fd5b5051919050565b6000600182016157f8576157f8615708565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252602c908201527f4552433737373a2063616c6c6572206973206e6f7420616e206f70657261746f60408201526b39103337b9103437b63232b960a11b606082015260800190565b6000602082840312156158f557600080fd5b815167ffffffffffffffff81111561590c57600080fd5b8201601f8101841361591d57600080fd5b805161592b61529c82615255565b81815285602083850101111561594057600080fd5b61595182602083016020860161509b565b95945050505050565b6000825161596c81846020870161509b565b7320456f6e69616e205661756c742053686172657360601b920191825250601401919050565b6232b7b760e91b8152600082516159b081600385016020870161509b565b9190910160030192915050565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156159e557600080fd5b815161118b81615117565b838152606060208201526000615a0960608301856150bf565b8281036040840152614bfb81856150bf565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160a01b0387811682528681166020830152851660408201526060810184905260c060808201819052600090615aa1908301856150bf565b82810360a084015261274b81856150bf565b81518152602080830151818301526040808401516001600160a01b0316908301526060808401519083015260808084015161064084019291840160005b602e811015615b0d57825182529183019190830190600101615af0565b5050505092915050565b600060208284031215615b2957600080fd5b815161118b81615163565b60008251615b4681846020870161509b565b9190910192915050565b601f821115611aaf57600081815260208120601f850160051c81016020861015615b775750805b601f850160051c820191505b81811015615b9657828155600101615b83565b505050505050565b815167ffffffffffffffff811115615bb857615bb861520e565b615bcc81615bc68454615731565b84615b50565b602080601f831160018114615c015760008415615be95750858301515b600019600386901b1c1916600185901b178555615b96565b600085815260208120601f198616915b82811015615c3057888601518255948401946001909101908401615c11565b5085821015615c4e5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122031ca5a41603093558b3a52b7b3a64d18f18750f97dd820a3a0f618526985247064736f6c63430008130033", "devdoc": { "events": { "AdminChanged(address,address)": { @@ -2319,6 +2414,16 @@ "shutdown": "a new vault pause state. If \"true\" is passed, the vault will be paused." } }, + "setFounders(address)": { + "params": { + "_founders": "a new founder token contract address." + } + }, + "setFoundersFee(uint256)": { + "params": { + "_foundersFee": "a new founder token reward fee (in BPS)." + } + }, "setLockedProfitReleaseRate(uint256)": { "params": { "rate": "the rate of release of locked profit (percent per second scaled to 1e18). The desire value of this parameter can be calculated as 1e18 / DurationInSeconds." @@ -2459,6 +2564,12 @@ "deposit(uint256,address)": { "notice": "Mints Vault shares to receiver by depositing exactly amount of underlying tokens. - emits the Deposit event. - support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token." }, + "founders()": { + "notice": "Vault Founders Token contract where rewards for founders are sent to." + }, + "foundersFee()": { + "notice": "Vault founders reward (in BPS)." + }, "fundAssets()": { "notice": "Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)" }, @@ -2555,11 +2666,17 @@ "setEmergencyShutdown(bool)": { "notice": "Switches the vault pause state." }, + "setFounders(address)": { + "notice": "Sets the vault founder token contract;" + }, + "setFoundersFee(uint256)": { + "notice": "Sets the vault founder token reward rate. Both management and foundersReward fee can't exceed 100%" + }, "setLockedProfitReleaseRate(uint256)": { "notice": "Changes the rate of release of locked-in profit." }, "setManagementFee(uint256)": { - "notice": "Sets the vault management fee." + "notice": "Sets the vault management fee. Both management and foundersReward fee can't exceed 100%" }, "setRewards(address)": { "notice": "Sets the vault rewards address." @@ -2597,7 +2714,7 @@ "storageLayout": { "storage": [ { - "astId": 549, + "astId": 986, "contract": "src/Vault.sol:Vault", "label": "_initialized", "offset": 0, @@ -2605,7 +2722,7 @@ "type": "t_uint8" }, { - "astId": 552, + "astId": 989, "contract": "src/Vault.sol:Vault", "label": "_initializing", "offset": 1, @@ -2613,7 +2730,7 @@ "type": "t_bool" }, { - "astId": 531, + "astId": 968, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2621,7 +2738,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 846, + "astId": 1283, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2629,7 +2746,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 13039, + "astId": 17126, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2637,7 +2754,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 3267, + "astId": 5398, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2645,103 +2762,103 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 1605, + "astId": 1305, "contract": "src/Vault.sol:Vault", - "label": "_balances", + "label": "_paused", "offset": 0, "slot": "201", + "type": "t_bool" + }, + { + "astId": 1410, + "contract": "src/Vault.sol:Vault", + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 3736, + "contract": "src/Vault.sol:Vault", + "label": "_balances", + "offset": 0, + "slot": "251", "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 1607, + "astId": 3738, "contract": "src/Vault.sol:Vault", "label": "_totalSupply", "offset": 0, - "slot": "202", + "slot": "252", "type": "t_uint256" }, { - "astId": 1609, + "astId": 3740, "contract": "src/Vault.sol:Vault", "label": "_name", "offset": 0, - "slot": "203", + "slot": "253", "type": "t_string_storage" }, { - "astId": 1611, + "astId": 3742, "contract": "src/Vault.sol:Vault", "label": "_symbol", "offset": 0, - "slot": "204", + "slot": "254", "type": "t_string_storage" }, { - "astId": 1624, + "astId": 3755, "contract": "src/Vault.sol:Vault", "label": "_defaultOperatorsArray", "offset": 0, - "slot": "205", + "slot": "255", "type": "t_array(t_address)dyn_storage" }, { - "astId": 1628, + "astId": 3759, "contract": "src/Vault.sol:Vault", "label": "_defaultOperators", "offset": 0, - "slot": "206", + "slot": "256", "type": "t_mapping(t_address,t_bool)" }, { - "astId": 1634, + "astId": 3765, "contract": "src/Vault.sol:Vault", "label": "_operators", "offset": 0, - "slot": "207", + "slot": "257", "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { - "astId": 1640, + "astId": 3771, "contract": "src/Vault.sol:Vault", "label": "_revokedDefaultOperators", "offset": 0, - "slot": "208", + "slot": "258", "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { - "astId": 1646, + "astId": 3777, "contract": "src/Vault.sol:Vault", "label": "_allowances", "offset": 0, - "slot": "209", + "slot": "259", "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" }, { - "astId": 2692, + "astId": 4823, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, - "slot": "210", + "slot": "260", "type": "t_array(t_uint256)41_storage" }, { - "astId": 868, - "contract": "src/Vault.sol:Vault", - "label": "_paused", - "offset": 0, - "slot": "251", - "type": "t_bool" - }, - { - "astId": 973, - "contract": "src/Vault.sol:Vault", - "label": "__gap", - "offset": 0, - "slot": "252", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 988, + "astId": 1425, "contract": "src/Vault.sol:Vault", "label": "_status", "offset": 0, @@ -2749,7 +2866,7 @@ "type": "t_uint256" }, { - "astId": 1057, + "astId": 1494, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2757,7 +2874,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 8189, + "astId": 10911, "contract": "src/Vault.sol:Vault", "label": "totalDebt", "offset": 0, @@ -2765,7 +2882,7 @@ "type": "t_uint256" }, { - "astId": 8192, + "astId": 10914, "contract": "src/Vault.sol:Vault", "label": "debtRatio", "offset": 0, @@ -2773,7 +2890,7 @@ "type": "t_uint256" }, { - "astId": 8195, + "astId": 10917, "contract": "src/Vault.sol:Vault", "label": "lastReportTimestamp", "offset": 0, @@ -2781,15 +2898,15 @@ "type": "t_uint256" }, { - "astId": 8201, + "astId": 10923, "contract": "src/Vault.sol:Vault", "label": "borrowersData", "offset": 0, "slot": "354", - "type": "t_mapping(t_address,t_struct(BorrowerData)8183_storage)" + "type": "t_mapping(t_address,t_struct(BorrowerData)10905_storage)" }, { - "astId": 8206, + "astId": 10928, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2797,7 +2914,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 56, + "astId": 465, "contract": "src/Vault.sol:Vault", "label": "_owner", "offset": 0, @@ -2805,7 +2922,7 @@ "type": "t_address" }, { - "astId": 176, + "astId": 585, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2813,7 +2930,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 13073, + "astId": 17160, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2821,15 +2938,15 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 12109, + "astId": 14831, "contract": "src/Vault.sol:Vault", "label": "asset", "offset": 0, "slot": "505", - "type": "t_contract(IERC20Upgradeable)1136" + "type": "t_contract(IERC20Upgradeable)1573" }, { - "astId": 12114, + "astId": 14836, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2837,7 +2954,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 12788, + "astId": 16523, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2845,7 +2962,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 9142, + "astId": 11864, "contract": "src/Vault.sol:Vault", "label": "withdrawalQueue", "offset": 0, @@ -2853,7 +2970,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 9147, + "astId": 11869, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, @@ -2861,43 +2978,75 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 6696, + "astId": 16243, "contract": "src/Vault.sol:Vault", - "label": "rewards", + "label": "withdrawHooks", "offset": 0, "slot": "657", + "type": "t_array(t_contract(IVaultHook)16005)dyn_storage" + }, + { + "astId": 16247, + "contract": "src/Vault.sol:Vault", + "label": "depositHooks", + "offset": 0, + "slot": "658", + "type": "t_array(t_contract(IVaultHook)16005)dyn_storage" + }, + { + "astId": 9299, + "contract": "src/Vault.sol:Vault", + "label": "rewards", + "offset": 0, + "slot": "659", + "type": "t_address" + }, + { + "astId": 9302, + "contract": "src/Vault.sol:Vault", + "label": "founders", + "offset": 0, + "slot": "660", "type": "t_address" }, { - "astId": 6699, + "astId": 9305, "contract": "src/Vault.sol:Vault", "label": "managementFee", "offset": 0, - "slot": "658", + "slot": "661", + "type": "t_uint256" + }, + { + "astId": 9308, + "contract": "src/Vault.sol:Vault", + "label": "foundersFee", + "offset": 0, + "slot": "662", "type": "t_uint256" }, { - "astId": 6702, + "astId": 9311, "contract": "src/Vault.sol:Vault", "label": "lockedProfitBaseline", "offset": 0, - "slot": "659", + "slot": "663", "type": "t_uint256" }, { - "astId": 6705, + "astId": 9314, "contract": "src/Vault.sol:Vault", "label": "lockedProfitReleaseRate", "offset": 0, - "slot": "660", + "slot": "664", "type": "t_uint256" }, { - "astId": 6710, + "astId": 9319, "contract": "src/Vault.sol:Vault", "label": "__gap", "offset": 0, - "slot": "661", + "slot": "665", "type": "t_array(t_uint256)50_storage" } ], @@ -2913,6 +3062,12 @@ "label": "address[]", "numberOfBytes": "32" }, + "t_array(t_contract(IVaultHook)16005)dyn_storage": { + "base": "t_contract(IVaultHook)16005", + "encoding": "dynamic_array", + "label": "contract IVaultHook[]", + "numberOfBytes": "32" + }, "t_array(t_uint256)41_storage": { "base": "t_uint256", "encoding": "inplace", @@ -2936,11 +3091,16 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IERC20Upgradeable)1136": { + "t_contract(IERC20Upgradeable)1573": { "encoding": "inplace", "label": "contract IERC20Upgradeable", "numberOfBytes": "20" }, + "t_contract(IVaultHook)16005": { + "encoding": "inplace", + "label": "contract IVaultHook", + "numberOfBytes": "20" + }, "t_mapping(t_address,t_bool)": { "encoding": "mapping", "key": "t_address", @@ -2962,12 +3122,12 @@ "numberOfBytes": "32", "value": "t_mapping(t_address,t_uint256)" }, - "t_mapping(t_address,t_struct(BorrowerData)8183_storage)": { + "t_mapping(t_address,t_struct(BorrowerData)10905_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct Lender.BorrowerData)", "numberOfBytes": "32", - "value": "t_struct(BorrowerData)8183_storage" + "value": "t_struct(BorrowerData)10905_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -2981,12 +3141,12 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(BorrowerData)8183_storage": { + "t_struct(BorrowerData)10905_storage": { "encoding": "inplace", "label": "struct Lender.BorrowerData", "members": [ { - "astId": 8173, + "astId": 10895, "contract": "src/Vault.sol:Vault", "label": "activationTimestamp", "offset": 0, @@ -2994,7 +3154,7 @@ "type": "t_uint256" }, { - "astId": 8176, + "astId": 10898, "contract": "src/Vault.sol:Vault", "label": "lastReportTimestamp", "offset": 0, @@ -3002,7 +3162,7 @@ "type": "t_uint256" }, { - "astId": 8179, + "astId": 10901, "contract": "src/Vault.sol:Vault", "label": "debt", "offset": 0, @@ -3010,7 +3170,7 @@ "type": "t_uint256" }, { - "astId": 8182, + "astId": 10904, "contract": "src/Vault.sol:Vault", "label": "debtRatio", "offset": 0, diff --git a/packages/contracts/deployments/sepolia/solcInputs/16371333a59035158e38b30b8ae1f386.json b/packages/contracts/deployments/sepolia/solcInputs/16371333a59035158e38b30b8ae1f386.json new file mode 100644 index 00000000..6db18d8d --- /dev/null +++ b/packages/contracts/deployments/sepolia/solcInputs/16371333a59035158e38b30b8ae1f386.json @@ -0,0 +1,307 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => 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 a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).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 override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\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 override 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 override 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 override 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 `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\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 Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\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 signaling this.\n *\n * _Available since v3.1._\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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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 `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967Upgradeable {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC4906Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4906.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"./IERC721Upgradeable.sol\";\n\n/// @title EIP-721 Metadata Update Extension\ninterface IERC4906Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\n /// @dev This event emits when the metadata of a token is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFT.\n event MetadataUpdate(uint256 _tokenId);\n\n /// @dev This event emits when the metadata of a range of tokens is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFTs.\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/IERC721Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/IERC1967Upgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeTo(address newImplementation) public virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {\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 bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\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 require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\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 function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/extensions/ERC721URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../interfaces/IERC4906Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC721 token with storage based token URI management.\n */\nabstract contract ERC721URIStorageUpgradeable is Initializable, IERC4906Upgradeable, ERC721Upgradeable {\n function __ERC721URIStorage_init() internal onlyInitializing {\n }\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\n }\n using StringsUpgradeable for uint256;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC165-supportsInterface}\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n string memory base = _baseURI();\n\n // If there is no base URI, return the token URI.\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n /**\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\n *\n * Emits {MetadataUpdate}.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\n require(_exists(tokenId), \"ERC721URIStorage: URI set of nonexistent token\");\n _tokenURIs[tokenId] = _tokenURI;\n\n emit MetadataUpdate(tokenId);\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\n * token-specific URI was set for the token, and if so, it deletes the token URI from\n * the storage mapping.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/ERC777.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC777Upgradeable.sol\";\nimport \"./IERC777RecipientUpgradeable.sol\";\nimport \"./IERC777SenderUpgradeable.sol\";\nimport \"../ERC20/IERC20Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/IERC1820RegistryUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC777} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * Support for ERC20 is included in this contract, as specified by the EIP: both\n * the ERC777 and ERC20 interfaces can be safely used when interacting with it.\n * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token\n * movements.\n *\n * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there\n * are no special restrictions in the amount of tokens that created, moved, or\n * destroyed. This makes integration with ERC20 applications seamless.\n *\n * CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.\n */\ncontract ERC777Upgradeable is Initializable, ContextUpgradeable, IERC777Upgradeable, IERC20Upgradeable {\n using AddressUpgradeable for address;\n\n IERC1820RegistryUpgradeable internal constant _ERC1820_REGISTRY = IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n\n mapping(address => uint256) private _balances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256(\"ERC777TokensSender\");\n bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\"ERC777TokensRecipient\");\n\n // This isn't ever read from - it's only used to respond to the defaultOperators query.\n address[] private _defaultOperatorsArray;\n\n // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).\n mapping(address => bool) private _defaultOperators;\n\n // For each account, a mapping of its operators and revoked default operators.\n mapping(address => mapping(address => bool)) private _operators;\n mapping(address => mapping(address => bool)) private _revokedDefaultOperators;\n\n // ERC20-allowances\n mapping(address => mapping(address => uint256)) private _allowances;\n\n /**\n * @dev `defaultOperators` may be an empty array.\n */\n function __ERC777_init(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\n __ERC777_init_unchained(name_, symbol_, defaultOperators_);\n }\n\n function __ERC777_init_unchained(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n\n _defaultOperatorsArray = defaultOperators_;\n for (uint256 i = 0; i < defaultOperators_.length; i++) {\n _defaultOperators[defaultOperators_[i]] = true;\n }\n\n // register interfaces\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC777Token\"), address(this));\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC20Token\"), address(this));\n }\n\n /**\n * @dev See {IERC777-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC777-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n *\n * Always returns 18, as per the\n * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\n */\n function decimals() public pure virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC777-granularity}.\n *\n * This implementation always returns `1`.\n */\n function granularity() public view virtual override returns (uint256) {\n return 1;\n }\n\n /**\n * @dev See {IERC777-totalSupply}.\n */\n function totalSupply() public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev Returns the amount of tokens owned by an account (`tokenHolder`).\n */\n function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\n return _balances[tokenHolder];\n }\n\n /**\n * @dev See {IERC777-send}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function send(address recipient, uint256 amount, bytes memory data) public virtual override {\n _send(_msgSender(), recipient, amount, data, \"\", true);\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}\n * interface if it is a contract.\n *\n * Also emits a {Sent} event.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _send(_msgSender(), recipient, amount, \"\", \"\", false);\n return true;\n }\n\n /**\n * @dev See {IERC777-burn}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function burn(uint256 amount, bytes memory data) public virtual override {\n _burn(_msgSender(), amount, data, \"\");\n }\n\n /**\n * @dev See {IERC777-isOperatorFor}.\n */\n function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) {\n return\n operator == tokenHolder ||\n (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||\n _operators[tokenHolder][operator];\n }\n\n /**\n * @dev See {IERC777-authorizeOperator}.\n */\n function authorizeOperator(address operator) public virtual override {\n require(_msgSender() != operator, \"ERC777: authorizing self as operator\");\n\n if (_defaultOperators[operator]) {\n delete _revokedDefaultOperators[_msgSender()][operator];\n } else {\n _operators[_msgSender()][operator] = true;\n }\n\n emit AuthorizedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-revokeOperator}.\n */\n function revokeOperator(address operator) public virtual override {\n require(operator != _msgSender(), \"ERC777: revoking self as operator\");\n\n if (_defaultOperators[operator]) {\n _revokedDefaultOperators[_msgSender()][operator] = true;\n } else {\n delete _operators[_msgSender()][operator];\n }\n\n emit RevokedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-defaultOperators}.\n */\n function defaultOperators() public view virtual override returns (address[] memory) {\n return _defaultOperatorsArray;\n }\n\n /**\n * @dev See {IERC777-operatorSend}.\n *\n * Emits {Sent} and {IERC20-Transfer} events.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public virtual override {\n require(isOperatorFor(_msgSender(), sender), \"ERC777: caller is not an operator for holder\");\n _send(sender, recipient, amount, data, operatorData, true);\n }\n\n /**\n * @dev See {IERC777-operatorBurn}.\n *\n * Emits {Burned} and {IERC20-Transfer} events.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public virtual override {\n require(isOperatorFor(_msgSender(), account), \"ERC777: caller is not an operator for holder\");\n _burn(account, amount, data, operatorData);\n }\n\n /**\n * @dev See {IERC20-allowance}.\n *\n * Note that operator and allowance concepts are orthogonal: operators may\n * not have allowance, and accounts with allowance may not be operators\n * themselves.\n */\n function allowance(address holder, address spender) public view virtual override returns (uint256) {\n return _allowances[holder][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function approve(address spender, uint256 value) public virtual override returns (bool) {\n address holder = _msgSender();\n _approve(holder, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Note that operator and allowance concepts are orthogonal: operators cannot\n * call `transferFrom` (unless they have allowance), and accounts with\n * allowance cannot call `operatorSend` (unless they are operators).\n *\n * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\n */\n function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(holder, spender, amount);\n _send(holder, recipient, amount, \"\", \"\", false);\n return true;\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with the caller address as the `operator` and with\n * `userData` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual {\n _mint(account, amount, userData, operatorData, true);\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If `requireReceptionAck` is set to true, and if a send hook is\n * registered for `account`, the corresponding function will be called with\n * `operator`, `data` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(\n address account,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) internal virtual {\n require(account != address(0), \"ERC777: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), account, amount);\n\n // Update state variables\n _totalSupply += amount;\n _balances[account] += amount;\n\n _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck);\n\n emit Minted(operator, account, amount, userData, operatorData);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Send tokens\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _send(\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) internal virtual {\n require(from != address(0), \"ERC777: transfer from the zero address\");\n require(to != address(0), \"ERC777: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, to, amount, userData, operatorData);\n\n _move(operator, from, to, amount, userData, operatorData);\n\n _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);\n }\n\n /**\n * @dev Burn tokens\n * @param from address token holder address\n * @param amount uint256 amount of tokens to burn\n * @param data bytes extra information provided by the token holder\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _burn(address from, uint256 amount, bytes memory data, bytes memory operatorData) internal virtual {\n require(from != address(0), \"ERC777: burn from the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, address(0), amount, data, operatorData);\n\n _beforeTokenTransfer(operator, from, address(0), amount);\n\n // Update state variables\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC777: burn amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Burned(operator, from, amount, data, operatorData);\n emit Transfer(from, address(0), amount);\n }\n\n function _move(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n ) private {\n _beforeTokenTransfer(operator, from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC777: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Sent(operator, from, to, amount, userData, operatorData);\n emit Transfer(from, to, amount);\n }\n\n /**\n * @dev See {ERC20-_approve}.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function _approve(address holder, address spender, uint256 value) internal virtual {\n require(holder != address(0), \"ERC777: approve from the zero address\");\n require(spender != address(0), \"ERC777: approve to the zero address\");\n\n _allowances[holder][spender] = value;\n emit Approval(holder, spender, value);\n }\n\n /**\n * @dev Call from.tokensToSend() if the interface is registered\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _callTokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n ) private {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777SenderUpgradeable(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);\n }\n }\n\n /**\n * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but\n * tokensReceived() was not registered for the recipient\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _callTokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) private {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777RecipientUpgradeable(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);\n } else if (requireReceptionAck) {\n require(!to.isContract(), \"ERC777: token recipient contract has no implementer for ERC777TokensRecipient\");\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {IERC20-Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC777: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes\n * calls to {send}, {transfer}, {operatorSend}, {transferFrom}, minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address operator, address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[41] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\n *\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\n * contract implement this interface (contract holders can be their own\n * implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777RecipientUpgradeable {\n /**\n * @dev Called by an {IERC777} token contract whenever tokens are being\n * moved or created into a registered account (`to`). The type of operation\n * is conveyed by `from` being the zero address or not.\n *\n * This call occurs _after_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensSender standard as defined in the EIP.\n *\n * {IERC777} Token holders can be notified of operations performed on their\n * tokens by having a contract implement this interface (contract holders can be\n * their own implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777SenderUpgradeable {\n /**\n * @dev Called by an {IERC777} token contract whenever a registered holder's\n * (`from`) tokens are about to be moved or destroyed. The type of operation\n * is conveyed by `to` being the zero address or not.\n *\n * This call occurs _before_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777Upgradeable {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC1820RegistryUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/IERC1820Registry.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the global ERC1820 Registry, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register\n * implementers for interfaces in this registry, as well as query support.\n *\n * Implementers may be shared by multiple accounts, and can also implement more\n * than a single interface for each account. Contracts can implement interfaces\n * for themselves, but externally-owned accounts (EOA) must delegate this to a\n * contract.\n *\n * {IERC165} interfaces can also be queried via the registry.\n *\n * For an in-depth explanation and source code analysis, see the EIP text.\n */\ninterface IERC1820RegistryUpgradeable {\n event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);\n\n event ManagerChanged(address indexed account, address indexed newManager);\n\n /**\n * @dev Sets `newManager` as the manager for `account`. A manager of an\n * account is able to set interface implementers for it.\n *\n * By default, each account is its own manager. Passing a value of `0x0` in\n * `newManager` will reset the manager to this initial state.\n *\n * Emits a {ManagerChanged} event.\n *\n * Requirements:\n *\n * - the caller must be the current manager for `account`.\n */\n function setManager(address account, address newManager) external;\n\n /**\n * @dev Returns the manager for `account`.\n *\n * See {setManager}.\n */\n function getManager(address account) external view returns (address);\n\n /**\n * @dev Sets the `implementer` contract as ``account``'s implementer for\n * `interfaceHash`.\n *\n * `account` being the zero address is an alias for the caller's address.\n * The zero address can also be used in `implementer` to remove an old one.\n *\n * See {interfaceHash} to learn how these are created.\n *\n * Emits an {InterfaceImplementerSet} event.\n *\n * Requirements:\n *\n * - the caller must be the current manager for `account`.\n * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not\n * end in 28 zeroes).\n * - `implementer` must implement {IERC1820Implementer} and return true when\n * queried for support, unless `implementer` is the caller. See\n * {IERC1820Implementer-canImplementInterfaceForAddress}.\n */\n function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;\n\n /**\n * @dev Returns the implementer of `interfaceHash` for `account`. If no such\n * implementer is registered, returns the zero address.\n *\n * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28\n * zeroes), `account` will be queried for support of it.\n *\n * `account` being the zero address is an alias for the caller's address.\n */\n function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);\n\n /**\n * @dev Returns the interface hash for an `interfaceName`, as defined in the\n * corresponding\n * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].\n */\n function interfaceHash(string calldata interfaceName) external pure returns (bytes32);\n\n /**\n * @notice Updates the cache with whether the contract implements an ERC165 interface or not.\n * @param account Address of the contract for which to update the cache.\n * @param interfaceId ERC165 interface for which to update the cache.\n */\n function updateERC165Cache(address account, bytes4 interfaceId) external;\n\n /**\n * @notice Checks whether a contract implements an ERC165 interface or not.\n * If the result is not cached a direct lookup on the contract address is performed.\n * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\n * {updateERC165Cache} with the contract address.\n * @param account Address of the contract to check.\n * @param interfaceId ERC165 interface to check.\n * @return True if `account` implements `interfaceId`, false otherwise.\n */\n function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);\n\n /**\n * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.\n * @param account Address of the contract to check.\n * @param interfaceId ERC165 interface to check.\n * @return True if `account` implements `interfaceId`, false otherwise.\n */\n function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 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 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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 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 prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / 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 prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\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 works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\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^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice 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 uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\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 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMathUpgradeable {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1967.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/IERC1967.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "lib/solmate/src/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n function powWad(int256 x, int256 y) internal pure returns (int256) {\n // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)\n return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.\n }\n\n function expWad(int256 x) internal pure returns (int256 r) {\n unchecked {\n // When the result is < 0.5 we return zero. This happens when\n // x <= floor(log(0.5e18) * 1e18) ~ -42e18\n if (x <= -42139678854452767551) return 0;\n\n // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\n // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\n if (x >= 135305999368893231589) revert(\"EXP_OVERFLOW\");\n\n // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\n // for more intermediate precision and a binary basis. This base conversion\n // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\n x = (x << 78) / 5**18;\n\n // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers\n // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\n // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\n int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\n x = x - k * 54916777467707473351141471128;\n\n // k is in the range [-61, 195].\n\n // Evaluate using a (6, 7)-term rational approximation.\n // p is made monic, we'll multiply by a scale factor later.\n int256 y = x + 1346386616545796478920950773328;\n y = ((y * x) >> 96) + 57155421227552351082224309758442;\n int256 p = y + x - 94201549194550492254356042504812;\n p = ((p * y) >> 96) + 28719021644029726153956944680412240;\n p = p * x + (4385272521454847904659076985693276 << 96);\n\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n int256 q = x - 2855989394907223263936484059900;\n q = ((q * x) >> 96) + 50020603652535783019961831881945;\n q = ((q * x) >> 96) - 533845033583426703283633433725380;\n q = ((q * x) >> 96) + 3604857256930695427073651918091429;\n q = ((q * x) >> 96) - 14423608567350463180887372962807573;\n q = ((q * x) >> 96) + 26449188498355588339934803723976023;\n\n assembly {\n // Div in assembly because solidity adds a zero check despite the unchecked.\n // The q polynomial won't have zeros in the domain as all its roots are complex.\n // No scaling is necessary because p is already 2**96 too large.\n r := sdiv(p, q)\n }\n\n // r should be in the range (0.09, 0.25) * 2**96.\n\n // We now need to multiply r by:\n // * the scale factor s = ~6.031367120.\n // * the 2**k factor from the range reduction.\n // * the 1e18 / 2**96 factor for base conversion.\n // We do this all at once, with an intermediate result in 2**213\n // basis, so the final right shift is always by a positive amount.\n r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\n }\n }\n\n function lnWad(int256 x) internal pure returns (int256 r) {\n unchecked {\n require(x > 0, \"UNDEFINED\");\n\n // We want to convert x from 10**18 fixed point to 2**96 fixed point.\n // We do this by multiplying by 2**96 / 10**18. But since\n // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\n // and add ln(2**96 / 10**18) at the end.\n\n // Reduce range of x to (1, 2) * 2**96\n // ln(2^k * x) = k * ln(2) + ln(x)\n int256 k = int256(log2(uint256(x))) - 96;\n x <<= uint256(159 - k);\n x = int256(uint256(x) >> 159);\n\n // Evaluate using a (8, 8)-term rational approximation.\n // p is made monic, we will multiply by a scale factor later.\n int256 p = x + 3273285459638523848632254066296;\n p = ((p * x) >> 96) + 24828157081833163892658089445524;\n p = ((p * x) >> 96) + 43456485725739037958740375743393;\n p = ((p * x) >> 96) - 11111509109440967052023855526967;\n p = ((p * x) >> 96) - 45023709667254063763336534515857;\n p = ((p * x) >> 96) - 14706773417378608786704636184526;\n p = p * x - (795164235651350426258249787498 << 96);\n\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n // q is monic by convention.\n int256 q = x + 5573035233440673466300451813936;\n q = ((q * x) >> 96) + 71694874799317883764090561454958;\n q = ((q * x) >> 96) + 283447036172924575727196451306956;\n q = ((q * x) >> 96) + 401686690394027663651624208769553;\n q = ((q * x) >> 96) + 204048457590392012362485061816622;\n q = ((q * x) >> 96) + 31853899698501571402653359427138;\n q = ((q * x) >> 96) + 909429971244387300277376558375;\n assembly {\n // Div in assembly because solidity adds a zero check despite the unchecked.\n // The q polynomial is known not to have zeros in the domain.\n // No scaling required because p is already 2**96 too large.\n r := sdiv(p, q)\n }\n\n // r is in the range (0, 0.125) * 2**96\n\n // Finalization, we need to:\n // * multiply by the scale factor s = 5.549…\n // * add ln(2**96 / 10**18)\n // * add k * ln(2)\n // * multiply by 10**18 / 2**96 = 5**18 >> 78\n\n // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\n r *= 1677202110996718588342820967067443963516166;\n // add ln(2) * k * 5e18 * 2**192\n r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\n // add ln(2**96 / 10**18) * 5e18 * 2**192\n r += 600920179829731861736702779321621459595472258049074101567377883020018308;\n // base conversion: mul 2**18 / 2**192\n r >>= 174;\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // Divide z by the denominator.\n z := div(z, denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // First, divide z - 1 by the denominator and add 1.\n // We allow z - 1 to underflow if z is 0, because we multiply the\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function log2(uint256 x) internal pure returns (uint256 r) {\n require(x > 0, \"UNDEFINED\");\n\n assembly {\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\n r := or(r, shl(3, lt(0xff, shr(r, x))))\n r := or(r, shl(2, lt(0xf, shr(r, x))))\n r := or(r, shl(1, lt(0x3, shr(r, x))))\n r := or(r, lt(0x1, shr(r, x)))\n }\n }\n}\n" + }, + "src/automation/example/SimpleGelatoJob.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {GelatoJobAdapter} from \"../GelatoJobAdapter.sol\";\n\nimport {SafeUUPSUpgradeable} from \"../../upgradeable/SafeUUPSUpgradeable.sol\";\nimport {SafeInitializable} from \"../../upgradeable/SafeInitializable.sol\";\nimport {IVersionable} from \"../../upgradeable/IVersionable.sol\";\n\ncontract SimpleGelatoJob is GelatoJobAdapter, SafeUUPSUpgradeable {\n uint256 public workMethodCalledCounter;\n bool public canWorkResult = false;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.1\";\n }\n\n // allow sending eth to the test contract\n receive() external payable {} // solhint-disable-line no-empty-blocks\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _ops,\n uint256 _minimumBetweenExecutions,\n bool _isPrepaid\n ) public initializer {\n __GelatoJobAdapter_init(_ops, _minimumBetweenExecutions, _isPrepaid);\n\n __SafeUUPSUpgradeable_init(); // ownable under the hood\n }\n\n function _work() internal override {\n workMethodCalledCounter++;\n }\n\n function _canWork() internal view override returns (bool) {\n return canWorkResult;\n }\n\n function setCanWorkResult(bool _canWorkResult) public onlyOwner {\n canWorkResult = _canWorkResult;\n }\n\n function setMinimumBetweenExecutions(uint256 _time) public onlyOwner {\n _setMinimumBetweenExecutions(_time);\n }\n\n function setIsPrepaid(bool _isPrepaid) public onlyOwner {\n isPrepaid = _isPrepaid;\n }\n\n function allowWorkNow() public onlyOwner {\n lastWorkTime = 0;\n }\n\n function refreshLastWorkTime() public onlyOwner {\n _refreshLastWorkTime();\n }\n}\n" + }, + "src/automation/gelato/BackCombatibleTransfer.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @notice Library that adding support for ERC20 and native tokens transfers.\n/// @dev Based of https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/vendor/gelato/FGelato.sol\nlibrary BackCombatibleTransfer {\n address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Backcombatible transfer to given address, will use ERC20 transfer if given token is ERC20.\n function backCombatibleTransfer(\n address payable to,\n address paymentToken,\n uint256 amount\n ) internal {\n if (paymentToken == ETH) {\n safeNativeTransfer(to, amount);\n return;\n }\n\n SafeERC20.safeTransfer(IERC20(paymentToken), to, amount);\n }\n\n /// @notice Native token transfer that checks `call` result.\n function safeNativeTransfer(address payable to, uint256 amount) internal {\n // We don't use `transfer` or `send`, as they are considered bad practices after the Istanbul hardfork.\n (bool success, ) = to.call{value: amount}(\"\");\n require(success, \"Native transfer failed\");\n }\n}\n" + }, + "src/automation/gelato/IOps.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @dev Based on https://github.com/gelatodigital/ops\ninterface IOps {\n function gelato() external view returns (address payable);\n\n function getFeeDetails() external view returns (uint256, address);\n}\n" + }, + "src/automation/gelato/IResolver.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @dev Copy of https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/interfaces/IResolver.sol\ninterface IResolver {\n function checker()\n external\n view\n returns (bool canExec, bytes memory execPayload);\n}\n" + }, + "src/automation/gelato/OpsReady.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport {IOps} from \"./IOps.sol\";\nimport {BackCombatibleTransfer} from \"./BackCombatibleTransfer.sol\";\n\nimport {SafeInitializable} from \"../../upgradeable/SafeInitializable.sol\";\n\n/// Based on https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/vendor/gelato/OpsReady.sol\n/// @notice Give basic methods to pay for Gelato operations.\nabstract contract OpsReady is SafeInitializable {\n IOps public ops;\n address payable public gelato;\n\n using BackCombatibleTransfer for address payable;\n using SafeERC20 for IERC20;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n modifier onlyOps() {\n require(msg.sender == address(ops), \"OpsReady: onlyOps\");\n _;\n }\n \n /**\n * Contructor of contract which will be able to communicate with Gelato protocol\n * @param _ops - address of the Ops contract.\n * @dev addresses can be found at https://docs.gelato.network/developer-products/gelato-ops-smart-contract-automation-hub/contract-addresses\n */\n function __OpsReady_init(address _ops) internal onlyInitializing {\n ops = IOps(_ops);\n gelato = ops.gelato();\n }\n\n /// @notice Will pay bot for executed task through galato\n function _payGalatoFee() internal {\n (uint256 fee, address feeToken) = ops.getFeeDetails();\n\n gelato.backCombatibleTransfer(feeToken, fee);\n }\n}\n" + }, + "src/automation/GelatoJobAdapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {Job} from \"./Job.sol\";\nimport {IResolver} from \"./gelato/IResolver.sol\";\nimport {OpsReady} from \"./gelato/OpsReady.sol\";\n\n/// @notice Contract expect work will be prepayd, so it cannot pay for work\nerror PayableWorkNotAllowed();\n\n/// @title Implementation of the mixin that adds support for Gelato (keepers operator)\nabstract contract GelatoJobAdapter is Job, IResolver, OpsReady {\n /// @notice If job is prepaid, then it not will try to pay on executed work.\n bool public isPrepaid;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * @notice Constructor of Job adapter contract.\n * @param _ops - address of the Ops contract.\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * @param _isPrepaid - If job is prepaid, then it not will try to pay on executed work\n */\n function __GelatoJobAdapter_init(\n address _ops,\n uint256 _minimumBetweenExecutions,\n bool _isPrepaid\n ) internal onlyInitializing {\n __OpsReady_init(_ops);\n __Job_init(_minimumBetweenExecutions);\n\n __GelatoJobAdapter_init_unchained(_isPrepaid);\n }\n\n /**\n * @notice Unchained constructor of Job adapter contract without rest of the contracts init\n * @param _isPrepaid - If job is prepaid, then it not will try to pay on executed work\n */\n function __GelatoJobAdapter_init_unchained(bool _isPrepaid)\n internal\n onlyInitializing\n {\n isPrepaid = _isPrepaid;\n }\n\n /// @notice Resolver checker that says if the work can be performed and with what params.\n function checker()\n public\n view\n returns (bool canExec, bytes memory execPayload)\n {\n canExec = canWork();\n\n execPayload = abi.encodeWithSelector(\n isPrepaid ? this.work.selector : this.payableWork.selector\n );\n }\n\n /// @notice Bot will call this method when `checker` returns `true`.\n /// Will pay caller\n /// `_doWork` method stay as it is, to allow a call off-chain\n function payableWork() public nonReentrant onlyOps {\n if (isPrepaid) {\n revert PayableWorkNotAllowed();\n }\n\n _doWork();\n\n // Check -> Effect -> Interaction\n // To prevent exploits pay only at the end of operations\n _payGalatoFee();\n }\n}\n" + }, + "src/automation/Job.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\n/// Someone tried to execute work function while `canWork` is `false`\nerror CannotWorkNow();\n\n/// Given time minimum between execution must be greater then 1000\nerror TimeMinimumBetweenExecutionsIncorrect(uint256 _givenTime);\n\n/// @title Abstract contract by implementation of which\n/// possible to make child contract support of one of keeper providers.\n/// @notice This contract is only define interface,\n/// for add support of specific provider need add specific mixin contract.\nabstract contract Job is\n SafeInitializable,\n ContextUpgradeable,\n ReentrancyGuardUpgradeable\n{\n /// Job work function was executed by worker bot\n event Worked(address indexed worker);\n\n /// @notice Timestamp of last work execution block in seconds.\n /// @dev Logic of checking and manupulating execution must be only in this contract (not in child)\n /// to control timestamp dependce vularability.\n /// Important: Expect all timestamp can be adgasted by miners.\n /// More info at: https://www.getsecureworld.com/blog/what-is-timestamp-dependence-vulnerability/\n uint256 public lastWorkTime;\n\n /// @notice Mininmal time which must pass between executions of the job in seconds.\n /// Better set hours, but at least set to greater then 900 seconds,\n /// node opperators able to manipulate timestamp in 900 seconds range, on some blockchains maybe bigger.\n uint256 public minimumBetweenExecutions;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * @notice Constructor of Job contract.\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * Set in hours to prevent block timestamp vularability\n */\n function __Job_init(uint256 _minimumBetweenExecutions)\n internal\n onlyInitializing\n {\n __Context_init();\n __ReentrancyGuard_init();\n\n __Job_init_unchained(_minimumBetweenExecutions);\n }\n\n /**\n * @notice Unchained constructor of Job contract without rest of the contracts init\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * Set in hours to prevent block timestamp vularability\n */\n function __Job_init_unchained(uint256 _minimumBetweenExecutions)\n internal\n onlyInitializing\n {\n _setMinimumBetweenExecutions(_minimumBetweenExecutions);\n // Not will set lastWorkTime to allow first work immediately after contract deploy\n }\n\n // ------------------------------------------ Public methods ------------------------------------------\n\n /// @notice If work can be executed by keeper at this moment returns true\n /// @dev Will be executed by keeper and before `work` method execution.\n function canWork() public view returns (bool) {\n // TODO: Check the maximum delay between job executions (?)\n return\n isTimePassFromLastExecution(minimumBetweenExecutions) && _canWork();\n }\n\n /// @notice allow execution only if `canWork` return true\n modifier onlyWhenCanWork() {\n if (!canWork()) {\n revert CannotWorkNow();\n }\n _;\n }\n\n /// @notice A handle that allows the `_doWork` function to be invoked externally by everyone.\n /// Perform a `canWork` check to avoid unnecessary and (maybe) malicious calls.\n /// @dev `nonReentrant` modifier might be excess there, since we have `isTimePassFromLastExecution` check\n /// and `refreshLastWorkTime` at start (see `onlyWhenCanWork` modifier). Let's keep it, as `canWork` can be overridden.\n function work() public nonReentrant onlyWhenCanWork {\n _doWork();\n }\n\n /// @notice Performs `_work` call and refreshes the last execution time.\n function _doWork() internal {\n // Refresh execution works like `nonReentrant` modifier if we have a `isTimePassFromLastExecution` check inside `canWork`.\n _refreshLastWorkTime();\n\n // An important work that is meant to be executed by the keeper.\n _work();\n\n emit Worked(msg.sender);\n }\n\n // ------------------------------------------ Time check logic ------------------------------------------\n\n /// @notice Set minimum time between executions.\n /// @param time - required time which must pass between executions of the job in seconds.\n /// Set in hours to prevent block timestamp vulnerability\n function _setMinimumBetweenExecutions(uint256 time) internal {\n if (time <= 1000) {\n revert TimeMinimumBetweenExecutionsIncorrect(time);\n }\n\n minimumBetweenExecutions = time;\n }\n\n /// @notice Time that passed since the last exection\n /// @return seconds from last execution in a range of 900 seconds\n function timeFromLastExecution() public view returns (uint256) {\n // lastWorkTime will be zero before first execution\n return block.timestamp - lastWorkTime; // solhint-disable-line not-rely-on-time\n }\n\n /// @notice Set time of last execution to current block\n function _refreshLastWorkTime() internal {\n lastWorkTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /// @notice Check if given time from last execution is passed\n /// @param second - amount of time which mast pass from last execution\n /// @return true if enough time pass\n function isTimePassFromLastExecution(uint256 second)\n internal\n view\n returns (bool)\n {\n return timeFromLastExecution() > second;\n }\n\n // ------------------------------------------ Busines methods to override ------------------------------\n\n /// @notice Method which will be executed by keeper\n function _work() internal virtual;\n\n /// @notice Method which identify if work can be executed at this moment.\n /// @dev Will be executed by keeper and before `work` method execution.\n /// @return true if `work` method can be called.\n function _canWork() internal view virtual returns (bool);\n}\n" + }, + "src/healthcheck/HealthChecker.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nimport {IHealthCheck} from \"./IHealthCheck.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror HealthCheckFailed();\n\nabstract contract HealthChecker is SafeInitializable, OwnableUpgradeable {\n event HealthCheckChanged(address);\n event HealthCheckEnabledChanged(bool);\n\n IHealthCheck public healthCheck;\n bool public healthCheckEnabled;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __HealthChecker_init(address _healthCheck)\n internal\n onlyInitializing\n {\n __Ownable_init();\n\n __HealthChecker_init_unchained(_healthCheck);\n }\n\n function __HealthChecker_init_unchained(address _healthCheck)\n internal\n onlyInitializing\n {\n setHealthCheck(_healthCheck);\n setHealthCheckEnabled(true);\n }\n\n /// @notice Sets the health check implementation contract.\n /// @param _healthCheck A new health check contract address.\n /// @dev Emits the \"HealthCheckChanged\" event.\n function setHealthCheck(address _healthCheck) public onlyOwner {\n healthCheck = IHealthCheck(_healthCheck);\n emit HealthCheckChanged(_healthCheck);\n }\n\n /// @notice Enables or disables the health check.\n /// @param _healthCheckEnabled If \"true\" - health check will be disabled.\n /// @dev Emits the \"HealthCheckEnabledChanged\" event.\n /// Do not disable the health check, unless you need to perform \"report\" in an emergency.\n function setHealthCheckEnabled(bool _healthCheckEnabled) public onlyOwner {\n healthCheckEnabled = _healthCheckEnabled;\n emit HealthCheckEnabledChanged(_healthCheckEnabled);\n }\n\n /// @notice Performs the health check by calling external contract.\n /// @param strategy Address of the strategy to be checked.\n /// @param profit The amount of funds that the strategy realised as profit.\n /// @param loss The amount of funds that the strategy realised as loss.\n /// @param debtPayment The amount of funds that the strategy spent to pay the debt.\n /// @param debtOutstanding Outstanding strategy debt.\n /// @param totalDebt The total amount of funds borrowed by the strategy from the vault.\n function performHealthCheck(\n address strategy,\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 debtOutstanding,\n uint256 totalDebt\n ) internal virtual {\n // No health check implementation provided, skip the execution.\n if (address(healthCheck) == address(0)) {\n return;\n }\n\n // There is usually no reason to turn off health checks.\n // But sometimes it may be necessary if we need to call a \"report\" manually.\n // If this happens, we should turn it on again.\n if (!healthCheckEnabled) {\n setHealthCheckEnabled(true);\n return;\n }\n\n // Perform the health check, revert the transaction if unsuccessful.\n bool success = healthCheck.check(\n strategy,\n profit,\n loss,\n debtPayment,\n debtOutstanding,\n totalDebt\n );\n if (!success) {\n revert HealthCheckFailed();\n }\n }\n}\n" + }, + "src/healthcheck/IHealthCheck.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface IHealthCheck {\n /// @notice Checks the overall state of the strategy\n /// @param strategy Address of the strategy to be checked.\n /// @param profit The amount of funds that the strategy realised as profit.\n /// @param loss The amount of funds that the strategy realised as loss.\n /// @param debtPayment The amount of funds that the strategy spent to pay the debt.\n /// @param debtOutstanding Outstanding strategy debt.\n /// @param totalDebt The total amount of funds borrowed by the strategy from the vault.\n /// @return The status of a completed health check.\n function check(\n address strategy,\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 debtOutstanding,\n uint256 totalDebt\n ) external view returns (bool);\n}\n" + }, + "src/IVault.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ILender} from \"./lending/ILender.sol\";\nimport {IERC4626} from \"./tokens/IERC4626.sol\";\n\ninterface IVault is ILender, IERC4626 {\n /// @notice Revokes a strategy from the vault.\n /// Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\n /// @param strategy a strategy to revoke.\n function revokeStrategy(address strategy) external;\n\n /// @notice Indicates if the vault was shutted down or not.\n /// @return \"true\" if the contract is paused, and \"false\" otherwise.\n function paused() external view returns (bool);\n}\n" + }, + "src/lending/ILender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface ILender {\n /// @notice Returns the number of tokens the borrower (caller of this function) can take from the lender\n /// @return Available credit as amount of tokens\n function availableCredit() external view returns (uint256);\n\n /// @notice Returns the outstanding debt that the borrower (caller of this function) must repay\n /// @return Outstanding debt as amount of tokens\n function outstandingDebt() external view returns (uint256);\n\n /// @notice Returns the amount of funds taken by the borrower (caller of this function).\n /// @return Debt as amount of tokens\n function currentDebt() external view returns (uint256);\n\n /// @notice Returns the debt ratio of the borrower (caller of this function).\n function currentDebtRatio() external view returns (uint256);\n\n /// @notice Returns the last report timestamp of the borrower (caller of this function).\n function lastReport() external view returns (uint256);\n\n /// @notice Returns the activation status of the borrower (caller of this function).\n /// @return \"true\" if the borrower is active\n function isActivated() external view returns (bool);\n\n /// @notice Reports a positive result of the borrower's debt management.\n /// Borrower must call this function if he has made any profit\n /// or/and has a free funds available to repay the outstanding debt (if any).\n /// @param extraFreeFunds an extra amount of free funds borrower's contract has.\n /// This reporting amount must be greater than the borrower's outstanding debt.\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\n function reportPositiveDebtManagement(\n uint256 extraFreeFunds,\n uint256 debtPayment\n ) external;\n\n /// @notice Reports a negative result of the borrower's debt management.\n /// The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\n /// May include a portion of the outstanding debt that the borrower was unable to repay.\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\n external;\n}\n" + }, + "src/lending/Lender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {ILender} from \"./ILender.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror BorrowerAlreadyExists();\nerror BorrowerDoesNotExist();\nerror BorrowerHasDebt();\nerror CallerIsNotABorrower();\nerror LenderRatioExceeded(uint256 freeRatio);\nerror FalsePositiveReport();\n\nabstract contract Lender is\n ILender,\n SafeInitializable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n struct BorrowerData {\n /// Timestamp of the block in which the borrower was activated\n uint256 activationTimestamp;\n /// Last time a borrower made a report\n uint256 lastReportTimestamp;\n /// Amount of tokens taken by the borrower\n uint256 debt;\n /// Maximum portion of the loan that the borrower can take (in BPS)\n /// Represents credibility of the borrower\n uint256 debtRatio;\n }\n\n uint256 public constant MAX_BPS = 10_000;\n\n /// @notice Amount of tokens that all borrowers have taken\n uint256 public totalDebt;\n\n /// @notice Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\n uint256 public debtRatio;\n\n /// @notice Last time a report occurred by any borrower\n uint256 public lastReportTimestamp;\n\n /// @notice Records with information on each borrower using the lender's services\n mapping(address => BorrowerData) public borrowersData;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @notice Event that must occur when the borrower reported the results of his debt management\n /// @param borrower Borrower's contract address\n /// @param debtPayment Amount of outstanding debt repaid by the borrower\n /// @param freeFunds Free funds on the borrower's contract that remain after the debt is paid\n /// @param fundsGiven Funds issued to the borrower by this lender\n /// @param fundsTaken Funds that have been taken from the borrower by the lender\n /// @param loss Amount of funds that the borrower realised as loss\n event BorrowerDebtManagementReported(\n address indexed borrower,\n uint256 debtPayment,\n uint256 freeFunds,\n uint256 fundsGiven,\n uint256 fundsTaken,\n uint256 loss\n );\n\n modifier onlyBorrowers() {\n if (borrowersData[msg.sender].activationTimestamp == 0) {\n revert CallerIsNotABorrower();\n }\n _;\n }\n\n /// @notice Updates the last report timestamp for the specified borrower and this lender.\n modifier updateLastReportTime() {\n _;\n borrowersData[msg.sender].lastReportTimestamp = lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __Lender_init() internal onlyInitializing {\n __Pausable_init();\n __ReentrancyGuard_init();\n\n __Lender_init_unchained();\n }\n\n function __Lender_init_unchained() internal onlyInitializing {\n lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /// @inheritdoc ILender\n function availableCredit() external view override returns (uint256) {\n return _availableCredit(msg.sender);\n }\n\n /// @inheritdoc ILender\n function outstandingDebt() external view override returns (uint256) {\n return _outstandingDebt(msg.sender);\n }\n\n /// @inheritdoc ILender\n function currentDebt() external view override returns (uint256) {\n return currentDebt(msg.sender);\n }\n\n /// @inheritdoc ILender\n function currentDebtRatio() external view override returns (uint256) {\n return borrowersData[msg.sender].debt;\n }\n\n /// @inheritdoc ILender\n function isActivated() external view override returns (bool) {\n return isActivated(msg.sender);\n }\n\n /// @inheritdoc ILender\n function lastReport() external view override returns (uint256) {\n return lastReport(msg.sender);\n }\n\n /// @inheritdoc ILender\n function reportPositiveDebtManagement(\n uint256 extraFreeFunds,\n uint256 debtPayment\n ) external override onlyBorrowers updateLastReportTime nonReentrant {\n // Checking whether the borrower is telling the truth about his available funds\n if (_borrowerFreeAssets(msg.sender) < extraFreeFunds + debtPayment) {\n revert FalsePositiveReport();\n }\n\n uint256 chargedFees = 0;\n // We can only charge a fees if the borrower has reported extra free funds,\n // if it's the first report at this block and only if the borrower was registered some time ago\n if (\n extraFreeFunds > 0 &&\n borrowersData[msg.sender].lastReportTimestamp < block.timestamp && // solhint-disable-line not-rely-on-time\n borrowersData[msg.sender].activationTimestamp < block.timestamp // solhint-disable-line not-rely-on-time\n ) {\n chargedFees = _chargeFees(extraFreeFunds);\n }\n\n _rebalanceBorrowerFunds(msg.sender, debtPayment, extraFreeFunds, 0);\n\n _afterPositiveDebtManagementReport(extraFreeFunds, chargedFees);\n }\n\n /// @inheritdoc ILender\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\n external\n override\n onlyBorrowers\n updateLastReportTime\n nonReentrant\n {\n // Checking whether the borrower has available funds for debt payment\n require(_borrowerFreeAssets(msg.sender) >= debtPayment, \"Not enough assets for payment\");\n\n // Debt wasn't repaid, we need to decrease the ratio of this borrower\n if (loss > 0) {\n _decreaseBorrowerCredibility(msg.sender, loss);\n }\n\n _rebalanceBorrowerFunds(msg.sender, debtPayment, 0, loss);\n\n _afterNegativeDebtManagementReport(loss);\n }\n\n /// @notice Balances the borrower's account and adjusts the current amount of funds the borrower can take.\n /// @param borrower a borrower's contract address.\n /// @param debtPayment an amount of outstanding debt since the previous report, that the borrower managed to cover. Can be zero.\n /// @param borrowerFreeFunds a funds that the borrower has earned since the previous report. Can be zero.\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\n function _rebalanceBorrowerFunds(\n address borrower,\n uint256 debtPayment,\n uint256 borrowerFreeFunds,\n uint256 loss\n ) private {\n // Calculate the amount of credit the lender can provide to the borrower (if any)\n uint256 borrowerAvailableCredit = _availableCredit(borrower);\n\n // Make sure that the borrower's debt payment doesn't exceed his actual outstanding debt\n uint256 borrowerOutstandingDebt = _outstandingDebt(msg.sender);\n debtPayment = MathUpgradeable.min(debtPayment, borrowerOutstandingDebt);\n\n // Take into account repaid debt, if any\n if (debtPayment > 0) {\n borrowersData[borrower].debt -= debtPayment;\n totalDebt -= debtPayment;\n }\n\n // Allocate some funds to the borrower if possible\n if (borrowerAvailableCredit > 0) {\n borrowersData[borrower].debt += borrowerAvailableCredit;\n totalDebt += borrowerAvailableCredit;\n }\n\n // Now we need to compare the allocated funds to the borrower and his current free balance.\n // If the number of unrealized tokens on the borrower's contract is less than the available credit, \n // the lender must give that difference to the borrower.\n // Otherwise (if the amount of the borrower's available funds is greater than \n // he should have according to his share), the lender must take that portion of the funds for himself.\n uint256 freeBorrowerBalance = borrowerFreeFunds + debtPayment;\n uint256 fundsGiven = 0;\n uint256 fundsTaken = 0;\n if (freeBorrowerBalance < borrowerAvailableCredit) {\n fundsGiven = borrowerAvailableCredit - freeBorrowerBalance;\n _transferFundsToBorrower(borrower, fundsGiven);\n } else if (freeBorrowerBalance > borrowerAvailableCredit) {\n fundsTaken = freeBorrowerBalance - borrowerAvailableCredit;\n _takeFundsFromBorrower(borrower, fundsTaken);\n }\n\n emit BorrowerDebtManagementReported(\n borrower,\n debtPayment,\n borrowerFreeFunds,\n fundsGiven,\n fundsTaken,\n loss\n );\n }\n\n /// @notice Returns the unrealized amount of the lender's tokens (lender's contract balance)\n function _freeAssets() internal view virtual returns (uint256);\n\n /// @notice Returns the unrealized amount of the borrower's tokens (contract balance of the specified borrower)\n function _borrowerFreeAssets(address borrower)\n internal\n view\n virtual\n returns (uint256);\n\n /// @notice Transfers a specified amount of tokens to the borrower\n function _transferFundsToBorrower(address borrower, uint256 amount)\n internal\n virtual;\n\n /// @notice Takes a specified amount of tokens from the borrower\n function _takeFundsFromBorrower(address borrower, uint256 amount)\n internal\n virtual;\n\n /// @notice Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\n function lendingAssets() public view virtual returns (uint256) {\n return _freeAssets() + totalDebt;\n }\n\n /// @notice Returns the current debt that the strategy has.\n function currentDebt(address borrower) public view returns (uint256) {\n return borrowersData[borrower].debt;\n }\n\n /// @notice Returns the activation status of the specified borrower.\n function isActivated(address borrower) public view returns (bool) {\n return borrowersData[borrower].activationTimestamp > 0;\n }\n\n /// @notice Returns the last report timestamp of the specified borrower.\n function lastReport(address borrower) public view returns (uint256) {\n return borrowersData[borrower].lastReportTimestamp;\n }\n\n /// @notice Returns the total number of tokens borrowers can take.\n function _debtLimit() private view returns (uint256) {\n return (debtRatio * lendingAssets()) / MAX_BPS;\n }\n\n /// @notice Lowers the borrower's debt he can take by specified loss and decreases his credibility.\n /// @dev This function has \"internal\" visibility because it's used in tests.\n function _decreaseBorrowerCredibility(address borrower, uint256 loss)\n internal\n {\n uint256 debt = borrowersData[borrower].debt;\n\n // Make sure the borrower's loss is less than his entire debt\n require(debt >= loss, \"Loss is greater than the debt\");\n\n // To decrease credibility of the borrower we should lower his \"debtRatio\"\n if (debtRatio > 0) {\n uint256 debtRatioChange = MathUpgradeable.min(\n (debtRatio * loss) / totalDebt,\n borrowersData[borrower].debtRatio\n );\n if (debtRatioChange != 0) {\n borrowersData[borrower].debtRatio -= debtRatioChange;\n debtRatio -= debtRatioChange;\n }\n }\n\n // Also, need to reduce the max amount of funds that can be taken by the borrower\n borrowersData[borrower].debt -= loss;\n totalDebt -= loss;\n }\n\n /// @notice See external implementation\n function _availableCredit(address borrower)\n internal\n view\n returns (uint256)\n {\n // Lender is paused, no funds available for the borrower\n if (paused()) {\n return 0;\n }\n\n uint256 lenderDebtLimit = _debtLimit();\n uint256 lenderDebt = totalDebt;\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\n lendingAssets()) / MAX_BPS;\n uint256 borrowerDebt = borrowersData[borrower].debt;\n\n // There're no more funds for the borrower because he has outstanding debt or the lender's available funds have been exhausted\n if (\n lenderDebtLimit <= lenderDebt || borrowerDebtLimit <= borrowerDebt\n ) {\n return 0;\n }\n\n uint256 lenderAvailableFunds = lenderDebtLimit - lenderDebt;\n uint256 borrowerIntendedCredit = borrowerDebtLimit - borrowerDebt;\n\n // Borrower may not take more funds than the lender's limit\n uint256 borrowerAvailableCredit = MathUpgradeable.min(\n lenderAvailableFunds,\n borrowerIntendedCredit\n );\n\n // Available credit is limited by the existing number of tokens on the lender's contract\n borrowerAvailableCredit = MathUpgradeable.min(\n borrowerAvailableCredit,\n _freeAssets()\n );\n\n return borrowerAvailableCredit;\n }\n\n /// @notice See external implementation\n function _outstandingDebt(address borrower)\n internal\n view\n returns (uint256)\n {\n uint256 borrowerDebt = borrowersData[borrower].debt;\n if (paused() || debtRatio == 0) {\n return borrowerDebt;\n }\n\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\n lendingAssets()) / MAX_BPS;\n if (borrowerDebt <= borrowerDebtLimit) {\n return 0;\n }\n\n return borrowerDebt - borrowerDebtLimit;\n }\n\n /// @notice Registers a new borrower and sets for him a certain debt ratio\n function _registerBorrower(address borrower, uint256 borrowerDebtRatio)\n internal\n {\n // Check if specified borrower has already registered\n if (isActivated(borrower)) {\n revert BorrowerAlreadyExists();\n }\n\n if (debtRatio + borrowerDebtRatio > MAX_BPS) {\n revert LenderRatioExceeded(MAX_BPS - debtRatio);\n }\n\n borrowersData[borrower] = BorrowerData(\n // Activation timestamp \n block.timestamp, // solhint-disable-line not-rely-on-time\n // Last report timestamp\n block.timestamp, // solhint-disable-line not-rely-on-time\n // Initial debt\n 0, \n // Debt ratio\n borrowerDebtRatio \n );\n\n debtRatio += borrowerDebtRatio;\n }\n\n /// @notice Sets the borrower's debt ratio. Will be reverted if the borrower doesn't exist or the total debt ratio is exceeded.\n /// @dev In the case where you want to disable the borrower, you need to set its ratio to 0.\n /// Thus, the borrower's current debt becomes an outstanding debt, which he must repay to the lender.\n function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)\n internal\n {\n if (!isActivated(borrower)) {\n revert BorrowerDoesNotExist();\n }\n\n debtRatio -= borrowersData[borrower].debtRatio;\n borrowersData[borrower].debtRatio = borrowerDebtRatio;\n debtRatio += borrowerDebtRatio;\n\n if (debtRatio > MAX_BPS) {\n revert LenderRatioExceeded(\n MAX_BPS - (debtRatio - borrowerDebtRatio)\n );\n }\n }\n\n /// @notice Deletes the borrower from the list\n /// @dev Should be called after the borrower's debt ratio is changed to 0, because the lender must take back all the released funds.\n function _unregisterBorrower(address borrower) internal {\n if (borrowersData[borrower].debtRatio > 0) {\n revert BorrowerHasDebt();\n }\n delete borrowersData[borrower];\n }\n\n /// @notice Charges a fee on the borrower's income.\n /// @param extraFreeFunds an income from which the fees will be calculated.\n /// @return The total amount of fees charged.\n function _chargeFees(uint256 extraFreeFunds)\n internal\n virtual\n returns (uint256);\n\n /// @notice Callback that is called at the end of the positive report function.\n /// @param extraFreeFunds the reported extra amount of borrower's funds.\n /// @param chargedFees the total amount of charged fees.\n function _afterPositiveDebtManagementReport(\n uint256 extraFreeFunds,\n uint256 chargedFees\n ) internal virtual;\n\n /// @notice Callback that is called at the end of the negative report function.\n /// @param loss the number of tokens by which the borrower's balance has decreased since the last report.\n function _afterNegativeDebtManagementReport(uint256 loss) internal virtual;\n}\n" + }, + "src/strategies/ApeLendingStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\nimport {BaseStrategy} from \"./BaseStrategy.sol\";\nimport {ICToken} from \"./protocols/ICToken.sol\";\nimport {IPancakeRouter} from \"./protocols/IPancakeRouter.sol\";\nimport {IRainMaker} from \"./protocols/IRainMaker.sol\";\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IVault} from \"../IVault.sol\";\n\nimport {IVersionable} from \"../upgradeable/IVersionable.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"../upgradeable/SafeUUPSUpgradeable.sol\";\n\nerror IncompatibleCTokenContract();\nerror UnsupportedDecimals();\nerror MintError(uint256 code);\nerror RedeemError(uint256 code);\n\ncontract ApeLendingStrategy is SafeUUPSUpgradeable, BaseStrategy {\n uint256 private constant SECONDS_PER_BLOCK = 3;\n uint256 private constant REWARD_ESTIMATION_ACCURACY = 90;\n\n address public constant BANANA = 0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95;\n address public constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address public constant RAIN_MAKER = 0x5CB93C0AdE6B7F2760Ec4389833B0cCcb5e4efDa;\n address public constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\n /// @notice Minimum BANANA token amount to sell.\n uint256 public minBananaToSell;\n\n ICToken public cToken;\n IPancakeRouter public pancakeRouter;\n IRainMaker public rainMaker;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.3\";\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _vault,\n address _cToken,\n address _ops,\n address _nativeTokenPriceFeed,\n address _assetPriceFeed,\n uint256 _minReportInterval,\n bool _isPrepaid\n ) public initializer {\n __SafeUUPSUpgradeable_init_direct();\n __BaseStrategy_init(\n IVault(_vault),\n _ops,\n _minReportInterval,\n _isPrepaid,\n _nativeTokenPriceFeed,\n _assetPriceFeed,\n address(0)\n ); // ownable under the hood\n\n __ApeLendingStrategy_init_unchained(_cToken);\n }\n\n function __ApeLendingStrategy_init_unchained(address _cToken) internal onlyInitializing {\n cToken = ICToken(_cToken);\n pancakeRouter = IPancakeRouter(PANCAKE_ROUTER);\n rainMaker = IRainMaker(RAIN_MAKER);\n\n if (cToken.decimals() != 8 || _assetDecimals != 18) {\n revert UnsupportedDecimals();\n }\n\n if (cToken.underlying() != address(asset)) {\n revert IncompatibleCTokenContract();\n }\n\n minBananaToSell = 0.1 ether;\n\n approveTokenMax(BANANA, PANCAKE_ROUTER);\n approveTokenMax(address(asset), _cToken);\n }\n\n /// @notice Sets the minimum number of BANANA tokens that must be on the contract to sell.\n function setMinBananaToSell(uint256 _minBananaToSell) external onlyOwner {\n minBananaToSell = _minBananaToSell;\n }\n\n /// @inheritdoc IStrategy\n function name() external view returns (string memory) {\n return\n string.concat(\n IERC20MetadataUpgradeable(address(asset)).symbol(),\n \" ApeLending Strategy\"\n );\n }\n\n /// @inheritdoc BaseStrategy\n function estimatedTotalAssets() public view override returns (uint256) {\n return\n asset.balanceOf(address(this)) +\n depositedBalanceSnapshot() +\n _totalBananaBalanceInAsset();\n }\n\n /// @notice Returns current deposited balance (in asset).\n /// @dev The exchange rate is recalculated at the last time someone touched the cToken contract.\n /// Transactions are not performed too often on this contract, perhaps we should consider recalculating the rate ourselves.\n function depositedBalanceSnapshot() public view returns (uint256) {\n (, uint256 cTokenBalance, , uint256 exchangeRate) = cToken\n .getAccountSnapshot(address(this));\n\n // Since every ApeSwap's cToken has 8 decimals, we can leave 1e18 as constant here.\n return (cTokenBalance * exchangeRate) / 1e18;\n }\n\n /// @notice Returns current deposited balance (in asset).\n /// @dev Unlike the snapshot function, this function recalculates the value of the deposit.\n function depositedBalance() public returns (uint256) {\n return cToken.balanceOfUnderlying(address(this));\n }\n\n /// @notice This function makes a prediction on how much BANANA is accrued per block.\n /// @dev It is not completely accurate because it uses the current protocol balance to predict into the past.\n function _estimatedAccruedBananaPerBlock() internal view returns (uint256) {\n uint256 _depositedBalance = depositedBalanceSnapshot();\n if (_depositedBalance == 0) {\n return 0; // should be impossible to have 0 balance and positive comp accrued\n }\n uint256 distributionPerBlock = rainMaker.compSupplySpeeds(\n address(cToken)\n );\n uint256 totalSupply = (cToken.totalSupply() *\n cToken.exchangeRateStored()) / 1e18;\n return\n totalSupply > 0\n ? (_depositedBalance * distributionPerBlock) / totalSupply\n : 0;\n }\n\n /// @notice This function makes a prediction on how much BANANA is accrued.\n /// @dev It is not completely accurate because it uses the current protocol balance to predict into the past.\n function _estimatedAccruedBanana() internal view returns (uint256) {\n uint256 bananaPerBlock = _estimatedAccruedBananaPerBlock();\n if (bananaPerBlock == 0) {\n return 0;\n }\n uint256 blocksSinceLastHarvest = (block.timestamp - vault.lastReport()) / SECONDS_PER_BLOCK; // solhint-disable-line not-rely-on-time\n return blocksSinceLastHarvest * bananaPerBlock;\n }\n\n /// @notice Returns the current banana balance of the strategy contract.\n function _currentBananaBalance() internal view returns (uint256) {\n return IERC20Upgradeable(BANANA).balanceOf(address(this));\n }\n\n /// @notice Returns the current (and estimated accrued) banana balance of the strategy contract (in asset).\n /// @dev Constant REWARD_ESTIMATION_ACCURACY is used to match accuracy expectations.\n function _totalBananaBalanceInAsset() internal view returns (uint256) {\n uint256 balance = _currentBananaBalance() + _estimatedAccruedBanana();\n if (balance == 0) {\n return 0;\n }\n uint256[] memory amounts = pancakeRouter.getAmountsOut(\n balance,\n _tokenSwapPath(BANANA, address(asset))\n );\n uint256 amount = amounts[amounts.length - 1];\n return (amount * REWARD_ESTIMATION_ACCURACY) / 100;\n }\n\n /// @notice Prepares a chain of tokens (pair or triplet) to pass it into the router contract.\n function _tokenSwapPath(address tokenIn, address tokenOut)\n internal\n pure\n returns (address[] memory path)\n {\n bool isWBNB = tokenIn == address(WBNB) || tokenOut == address(WBNB);\n path = new address[](isWBNB ? 2 : 3);\n path[0] = tokenIn;\n\n if (isWBNB) {\n path[1] = tokenOut;\n } else {\n path[1] = address(WBNB);\n path[2] = tokenOut;\n }\n }\n\n /// @notice Retrieves accrued BANANA from the protocol.\n function _claimBanana() internal {\n ICToken[] memory tokens = new ICToken[](1);\n tokens[0] = cToken;\n rainMaker.claimComp(address(this), tokens);\n }\n\n /// @notice Changes the existing BANANA on the contract to an asset token.\n function _swapBananaToAsset() internal {\n uint256 bananaBalance = IERC20Upgradeable(BANANA).balanceOf(\n address(this)\n );\n if (bananaBalance < minBananaToSell) {\n return;\n }\n\n pancakeRouter.swapExactTokensForTokens(\n bananaBalance,\n 0,\n _tokenSwapPath(BANANA, address(asset)),\n address(this),\n block.timestamp // solhint-disable-line not-rely-on-time\n );\n }\n\n /// @inheritdoc BaseStrategy\n function _harvest(uint256 outstandingDebt)\n internal\n override\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n )\n {\n profit = 0;\n loss = 0;\n\n // No positions to harvest, allocate available funds to pay the debt (if any)\n if (cToken.balanceOf(address(this)) == 0) {\n debtPayment = MathUpgradeable.min(\n asset.balanceOf(address(this)),\n outstandingDebt\n );\n return (profit, loss, debtPayment);\n }\n\n uint256 deposits = depositedBalance();\n\n _claimBanana();\n _swapBananaToAsset();\n\n uint256 assetBalance = asset.balanceOf(address(this));\n uint256 balance = deposits + assetBalance;\n\n uint256 debt = vault.currentDebt();\n\n if (balance > debt) {\n profit = balance - debt;\n if (assetBalance < profit) {\n debtPayment = MathUpgradeable.min(\n assetBalance,\n outstandingDebt\n );\n profit = assetBalance - debtPayment;\n } else if (assetBalance > profit + outstandingDebt) {\n debtPayment = outstandingDebt;\n } else {\n debtPayment = assetBalance - profit;\n }\n } else {\n loss = debt - balance;\n debtPayment = MathUpgradeable.min(assetBalance, outstandingDebt);\n }\n }\n\n /// @inheritdoc BaseStrategy\n function _adjustPosition(uint256 outstandingDebt) internal override {\n if (paused()) {\n return;\n }\n\n uint256 assetBalance = asset.balanceOf(address(this));\n if (assetBalance < outstandingDebt) {\n // We compare the balance with 1 because of rounding error\n if (cToken.balanceOf(address(this)) > 1) {\n _liquidatePosition(outstandingDebt - assetBalance);\n }\n return;\n }\n\n uint256 freeBalance = assetBalance - outstandingDebt;\n if (freeBalance > 0) {\n uint256 result = cToken.mint(freeBalance);\n if (result > 0) {\n revert MintError(result);\n }\n }\n }\n\n /// @inheritdoc BaseStrategy\n /// @dev Tagged with the keyword \"virtual\" for testing purposes.\n function _liquidatePosition(uint256 assets)\n internal\n virtual\n override\n returns (uint256 liquidatedAmount, uint256 loss)\n {\n uint256 assetBalance = asset.balanceOf(address(this));\n if (assetBalance < assets) {\n uint256 deposits = depositedBalance();\n uint256 amountToRedeem = MathUpgradeable.min(deposits, assets);\n uint256 result = cToken.redeemUnderlying(amountToRedeem);\n if (result > 0) {\n revert RedeemError(result);\n }\n liquidatedAmount = amountToRedeem;\n loss = assets - liquidatedAmount;\n } else {\n liquidatedAmount = assets;\n }\n }\n\n /// @inheritdoc BaseStrategy\n function _liquidateAllPositions()\n internal\n override\n returns (uint256 amountFreed)\n {\n uint256 amountToRedeem = depositedBalance();\n uint256 result = cToken.redeemUnderlying(amountToRedeem);\n if (result > 0) {\n revert RedeemError(result);\n }\n amountFreed = amountToRedeem;\n }\n}\n" + }, + "src/strategies/BaseStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IVault} from \"../IVault.sol\";\nimport {GelatoJobAdapter} from \"../automation/GelatoJobAdapter.sol\";\nimport {Job} from \"../automation/Job.sol\";\nimport {HealthChecker} from \"../healthcheck/HealthChecker.sol\";\nimport {PriceConverter} from \"../structures/PriceConverter.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror CallerIsNotAVault();\nerror IncompatiblePriceFeeds();\n\nabstract contract BaseStrategy is\n IStrategy,\n SafeInitializable,\n GelatoJobAdapter,\n HealthChecker,\n PausableUpgradeable\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using PriceConverter for AggregatorV3Interface;\n\n IVault public vault;\n IERC20Upgradeable public asset;\n\n /// @notice Use this to adjust the threshold at which running a debt causes a work trigger.\n uint256 public debtThreshold;\n\n /// @notice The estimated amount of gas required for the \"work\" execution.\n uint256 public estimatedWorkGas;\n\n /// @notice Shows how many times the gas price spent for the \"work\" function should be lower than the profit to trigger.\n uint256 public profitFactor;\n\n /// @notice The USD price feed for the native token of the network on which this strategy works.\n AggregatorV3Interface internal _nativeTokenPriceFeed;\n\n /// @notice The USD price feed for the strategy asset.\n AggregatorV3Interface internal _assetPriceFeed;\n\n /// @notice The underlying asset's decimals.\n uint256 internal _assetDecimals;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n event Harvested(\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 outstandingDebt\n );\n\n event DebtThresholdUpdated(uint256 debtThreshold);\n\n event EstimatedWorkGasUpdated(uint256 estimatedWorkGas);\n\n event UpdatedProfitFactor(uint256 profitFactor);\n\n modifier onlyVault() {\n if (msg.sender != address(vault)) {\n revert CallerIsNotAVault();\n }\n _;\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __BaseStrategy_init(\n IVault _vault,\n address _ops,\n uint256 _minReportInterval,\n bool _isPrepaid,\n address __nativeTokenPriceFeed,\n address __assetPriceFeed,\n address _healthCheck\n ) internal onlyInitializing {\n __HealthChecker_init(_healthCheck); // ownable under the hood\n __Pausable_init();\n __GelatoJobAdapter_init(_ops, _minReportInterval, _isPrepaid);\n\n __BaseStrategy_init_unchained(\n _vault,\n __nativeTokenPriceFeed,\n __assetPriceFeed\n );\n }\n\n function __BaseStrategy_init_unchained(\n IVault _vault,\n address __nativeTokenPriceFeed,\n address __assetPriceFeed\n ) internal onlyInitializing {\n vault = _vault;\n asset = IVault(vault).asset();\n\n debtThreshold = 0;\n estimatedWorkGas = 0;\n profitFactor = 100;\n\n _nativeTokenPriceFeed = AggregatorV3Interface(__nativeTokenPriceFeed);\n _assetPriceFeed = AggregatorV3Interface(__assetPriceFeed);\n if (_nativeTokenPriceFeed.decimals() != _assetPriceFeed.decimals()) {\n revert IncompatiblePriceFeeds();\n }\n\n _assetDecimals = IERC20MetadataUpgradeable(address(asset)).decimals();\n\n approveTokenMax(address(asset), address(_vault));\n }\n\n /// @notice Harvests the strategy, recognizing any profits or losses and adjusting the strategy's investments.\n /// @inheritdoc Job\n function _work() internal override {\n uint256 profit = 0;\n uint256 loss = 0;\n uint256 debtPayment = 0;\n\n uint256 outstandingDebt = vault.outstandingDebt();\n if (paused()) {\n (profit, loss, debtPayment) = _harvestAfterShutdown(\n outstandingDebt\n );\n } else {\n (profit, loss, debtPayment) = _harvest(outstandingDebt);\n }\n\n if (profit > 0) {\n vault.reportPositiveDebtManagement(profit, debtPayment);\n } else {\n vault.reportNegativeDebtManagement(loss, debtPayment);\n }\n\n // If the strategy needs to repay the entire debt, we need to take all available funds.\n // We will take the current debt in the report above, but we still need to free up whatever is left.\n // This can happen, if the ratio is reduced to 0 or if the vault has been shutted down.\n outstandingDebt = vault.outstandingDebt();\n outstandingDebt = vault.currentDebtRatio() == 0 || vault.paused()\n ? estimatedTotalAssets()\n : outstandingDebt;\n\n _adjustPosition(outstandingDebt);\n\n uint256 totalDebt = vault.currentDebt();\n performHealthCheck(\n address(this),\n profit,\n loss,\n debtPayment,\n outstandingDebt,\n totalDebt\n );\n\n emit Harvested(profit, loss, debtPayment, outstandingDebt);\n }\n\n /// @inheritdoc Job\n function _canWork() internal view override returns (bool) {\n if (!vault.isActivated()) {\n return false;\n }\n\n // Trigger this job if the strategy has the outstanding debt to repay\n uint256 outstanding = vault.outstandingDebt();\n if (outstanding > debtThreshold) {\n return true;\n }\n\n // Trigger this job if the strategy has some loss to report\n uint256 total = estimatedTotalAssets();\n uint256 debt = vault.currentDebt();\n if (total + debtThreshold < debt) {\n return true;\n }\n\n // Estimate accumulated profit\n uint256 profit = 0;\n if (total > debt) {\n profit = total - debt;\n }\n\n // Check the gas cost againts the profit and available credit.\n // There is no sense to call the \"work\" function, if we don't have decent amount of funds to move.\n return _checkGasPriceAgainstProfit(profit);\n }\n\n /// @notice Calculates the gas price of this transaction and compares it againts the specified profit.\n /// @param profit Profit to be compared to the cost of gas.\n /// @return \"true\" if the gas price (mult. to \"profitFactor\" is lower than the strategy profit, in USD).\n function _checkGasPriceAgainstProfit(uint256 profit) internal view returns (bool) {\n uint256 credit = vault.availableCredit();\n uint256 gasCost = _gasPriceUSD() * estimatedWorkGas;\n return profitFactor * gasCost < _convertAmountToUSD(credit + profit);\n }\n\n /// @inheritdoc IStrategy\n function withdraw(uint256 assets) external override onlyVault returns (uint256 loss) { // Vault already have nonReentrant modifier check\n // Liquidate the requested amount of tokens\n uint256 amountFreed;\n (amountFreed, loss) = _liquidatePosition(assets);\n\n // Send it directly back to the vault\n IERC20Upgradeable(asset).safeTransfer(msg.sender, amountFreed);\n }\n\n /// @notice Shutdown the strategy and revoke it form the vault.\n function shutdown() external nonReentrant onlyOwner { // need check nonReentrant to avoid cyclic call\n _pause();\n IVault(vault).revokeStrategy(address(this));\n }\n\n /// @notice Sets the debt threshold.\n /// @param _debtThreshold The new debt threshold value.\n function setDebtThreshold(uint256 _debtThreshold) external onlyOwner {\n debtThreshold = _debtThreshold;\n emit DebtThresholdUpdated(_debtThreshold);\n }\n\n /// @notice Sets the estimated gas that will be required for \"work\" function.\n /// @param _estimatedWorkGas The estimated \"work\" gas value.\n function setEstimatedWorkGas(uint256 _estimatedWorkGas) external onlyOwner {\n estimatedWorkGas = _estimatedWorkGas;\n emit EstimatedWorkGasUpdated(_estimatedWorkGas);\n }\n\n /// @notice Sets the profit factor.\n /// @param _profitFactor The new profit factor value.\n function setProfitFactor(uint256 _profitFactor) external onlyOwner {\n profitFactor = _profitFactor;\n emit UpdatedProfitFactor(_profitFactor);\n }\n\n /// @notice Frees up as much funds of the base protocol as possible.\n /// @dev This function is called on harvest if the strategy was shutted down.\n /// @param outstandingDebt The outstanding debt of the strategy.\n function _harvestAfterShutdown(uint256 outstandingDebt)\n internal\n virtual\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n )\n {\n uint256 amountFreed = _liquidateAllPositions();\n if (amountFreed < outstandingDebt) {\n loss = outstandingDebt - amountFreed;\n } else if (amountFreed > outstandingDebt) {\n profit = amountFreed - outstandingDebt;\n }\n debtPayment = outstandingDebt - loss;\n }\n\n /// @notice Calculates the gas price of the current transaction (in USD).\n function _gasPriceUSD() internal view returns (uint256) {\n return _nativeTokenPriceFeed.convertAmount(tx.gasprice, 18);\n }\n\n /// @notice Calculates the pice of the specified amount of \"asset\" (in USD).\n function _convertAmountToUSD(uint256 amount)\n internal\n view\n returns (uint256)\n {\n return _assetPriceFeed.convertAmount(amount, _assetDecimals);\n }\n\n /// @notice Sets the max token allowance for the specified spender.\n function approveTokenMax(address token, address spender) internal {\n IERC20Upgradeable(token).safeApprove(spender, type(uint256).max);\n }\n\n /// @notice Estimates the total amount of strategy funds (including those invested in the base protocol).\n function estimatedTotalAssets() public view virtual returns (uint256);\n\n /// @notice The main function of the strategy.\n /// By calling this function, the strategy must realize (take out) the possible profits from the underlying protocol.\n function _harvest(uint256 outstandingDebt)\n internal\n virtual\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n );\n\n /// @notice Performs the deposit of the free funds to the underlying protocol.\n function _adjustPosition(uint256 outstandingDebt) internal virtual;\n\n /// @notice Withdraws the specific amount of \"asset\" from the underlying protocol.\n /// @param assets The amount of token to withdraw.\n /// @return liquidatedAmount Withdrawn amount\n /// @return loss The amount that could not be withdrawn\n function _liquidatePosition(uint256 assets)\n internal\n virtual\n returns (uint256 liquidatedAmount, uint256 loss);\n\n /// @notice Withdraws the entire invested amount from the underlying protocol.\n function _liquidateAllPositions()\n internal\n virtual\n returns (uint256 amountFreed);\n}\n" + }, + "src/strategies/IStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IVault} from \"../IVault.sol\";\n\ninterface IStrategy {\n /// @notice Returns the name of this strategy.\n function name() external view returns (string memory);\n\n /// @notice Returns the contract address of the underlying asset of this strategy.\n function asset() external view returns (IERC20Upgradeable);\n\n /// @notice Returns the contract address of the Vault to which this strategy is connected.\n function vault() external view returns (IVault);\n\n /// @notice Transfers a specified amount of tokens to the vault.\n /// @param assets A amount of tokens to withdraw.\n /// @return loss A number of tokens that the strategy could not return.\n function withdraw(uint256 assets) external returns (uint256 loss);\n}\n" + }, + "src/strategies/protocols/ICToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @notice Interface for Compound-like market (or vault in common terms), that allows to deposit and borrow tokens.\ninterface ICToken {\n function decimals() external returns (uint8);\n\n function underlying() external returns (address);\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external returns (uint256);\n\n function getAccountSnapshot(address account)\n external\n view\n returns (\n uint256,\n uint256,\n uint256,\n uint256\n );\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function totalBorrowsCurrent() external returns (uint256);\n\n function borrowBalanceCurrent(address account) external returns (uint256);\n\n function borrowBalanceStored(address account)\n external\n view\n returns (uint256);\n\n function exchangeRateCurrent() external returns (uint256);\n\n function exchangeRateStored() external view returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount)\n external\n returns (uint256);\n\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n ICToken cTokenCollateral\n ) external returns (uint256);\n}\n" + }, + "src/strategies/protocols/IPancakeRouter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @notice Interface for Uniswap-like exchange router.\ninterface IPancakeRouter {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n}\n" + }, + "src/strategies/protocols/IRainMaker.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ICToken} from \"./ICToken.sol\";\n\n/// @notice Interface for a compound-like controller used to control incentivized tokens received during interaction with the protocol.\ninterface IRainMaker {\n struct CompMarketState {\n /// @notice The market's last updated compBorrowIndex or compSupplyIndex\n uint224 index;\n /// @notice The block number the index was last updated at\n uint32 block;\n }\n\n function compSupplierIndex(address, address)\n external\n view\n returns (uint256);\n\n function compSpeeds(address cToken) external view returns (uint256);\n\n function compSupplySpeeds(address cToken) external view returns (uint256);\n\n function compBorrowSpeeds(address cToken) external view returns (uint256);\n\n function claimComp(address holder, ICToken[] memory cTokens) external;\n\n function claimComp(address holder) external;\n\n function compAccrued(address holder) external view returns (uint256);\n\n function compSupplyState(address cToken)\n external\n view\n returns (CompMarketState memory);\n}\n" + }, + "src/structures/AddressList.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nerror ListsDoNotMatch();\n\nlibrary AddressList {\n /// @notice Adds an address to the list.\n /// @param list the list of addresses.\n /// @param addr the address to add.\n function add(address[] storage list, address addr) internal {\n list.push(addr);\n }\n\n /// @notice Checks if the list contains the specified item.\n /// @param list the list of addresses.\n /// @param addr the address to find.\n function contains(address[] storage list, address addr)\n internal\n view\n returns (bool)\n {\n for (uint256 i = 0; i < list.length; i++) {\n if (list[i] == addr) {\n return true;\n }\n }\n return false;\n }\n\n /// @notice Removes an address from the list and fills the gap with the following items by moving them up.\n /// @param list the list of addresses.\n /// @param addr the address to remove.\n /// @return A boolean value that indicates if the address was found and removed from the list.\n function remove(address[] storage list, address addr)\n internal\n returns (bool)\n {\n bool addressFound;\n for (uint256 i = 0; i < list.length; i++) {\n if (list[i] == addr) {\n addressFound = true;\n }\n if (addressFound && i < list.length - 1) {\n list[i] = list[i + 1];\n }\n }\n if (addressFound) {\n list.pop();\n }\n return addressFound;\n }\n\n /// @notice Checks if the list can be reordered in the specified way.\n /// @param list the list of addresses.\n /// @param reoderedList the desired reordered list, which must have the same content as the existing list.\n /// @return A reordered list\n function reorder(address[] storage list, address[] memory reoderedList)\n internal\n view\n returns (address[] memory)\n {\n uint256 length = list.length;\n if (length != reoderedList.length) {\n revert ListsDoNotMatch();\n }\n for (uint256 i = 0; i < length; i++) {\n address existingAddress = list[i];\n for (uint256 j = 0; j < length; j++) {\n // Address is found, move to the next item\n if (existingAddress == reoderedList[j]) {\n break;\n }\n // If this is the last iteration, then the address is not found\n if (j == length - 1) {\n revert ListsDoNotMatch();\n }\n }\n }\n return reoderedList;\n }\n}\n" + }, + "src/structures/PriceConverter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\nimport {SafeMathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\";\n\nerror NegativePrice();\n\nlibrary PriceConverter {\n using SafeMathUpgradeable for uint256;\n\n uint256 public constant UP_TO_DECIMALS = 18;\n\n /// @notice Calculates the price of the specified number of tokens.\n /// @dev This function converts the specified number of tokens to their price (scaled to 18 decimal places).\n /// @param priceFeed The Chainlink's price feed aggregator.\n /// @param amount Number of tokens, the value of which needs to be calculated.\n /// @param decimals Decimals of the specified token.\n /// @return The calculated price of the tokens.\n function convertAmount(\n AggregatorV3Interface priceFeed,\n uint256 amount,\n uint256 decimals\n ) internal view returns (uint256) {\n (, int256 price, , , ) = priceFeed.latestRoundData();\n if (price < 0) {\n revert NegativePrice();\n }\n\n // Scaling decimals up to 18 places to increase accuracy.\n // For example, the \"USD\" price feed has 8 decimal places, so the calculation may result in zeros if a small [amount] is passed.\n uint256 priceDecimals = priceFeed.decimals();\n (, uint256 priceScaledDecimals) = UP_TO_DECIMALS.trySub(priceDecimals);\n uint256 scaledPrice = uint256(price) * 10**priceScaledDecimals;\n\n return amount * scaledPrice / 10**decimals;\n }\n}\n" + }, + "src/tokens/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {ERC777Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport {IERC4626} from \"./IERC4626.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\n/// @title ERC4626 upgradable tokenized Vault implementation based on ERC-777.\n/// More info in [EIP](https://eips.ethereum.org/EIPS/eip-4626)\n/// Based on Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/mixins/ERC4626.sol)\n///\n/// ERC-777 and ERC-20 tokens represent \"shares\"\n/// Vault “shares” which represent a claim to ownership on a fraction of the Vault’s underlying holdings.\n/// -\n/// @notice Rationale\n/// The mint method was included for symmetry and feature completeness.\n/// Most current use cases of share-based Vaults do not ascribe special meaning to the shares\n/// such that a user would optimize for a specific number of shares (mint)\n/// rather than specific amount of underlying (deposit).\n/// However, it is easy to imagine future Vault strategies which would have unique\n/// and independently useful share representations.\n/// The convertTo functions serve as rough estimates that do not account for operation specific details\n/// like withdrawal fees, etc. They were included for frontends and applications that need an average\n/// value of shares or assets, not an exact value possibly including slippage or other fees.\n/// For applications that need an exact value that attempts to account for fees and slippage we have\n/// included a corresponding preview function to match each mutable function.\n/// These functions must not account for deposit or withdrawal limits, to ensure they are easily composable,\n/// the max functions are provided for that purpose.\nabstract contract ERC4626Upgradeable is\n SafeInitializable,\n ERC777Upgradeable,\n ReentrancyGuardUpgradeable,\n IERC4626\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using FixedPointMathLib for uint256;\n\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n IERC20Upgradeable public asset;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /* ///////////////////////////// EVENTS ///////////////////////////// */\n\n /// `sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`.\n /// emitted when tokens are deposited into the Vault via the mint and deposit methods.\n event Deposit(\n address indexed caller,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /// `sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`.\n /// emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n /**\n * Constructor for the ERC4626Upgradeable contract\n * @param _asset which will be stored in this Vault\n * @dev `defaultOperators` may be an empty array.\n */\n function __ERC4626_init(\n IERC20Upgradeable _asset,\n string memory name_,\n string memory symbol_,\n address[] memory defaultOperators_\n ) internal onlyInitializing {\n __ERC777_init(name_, symbol_, defaultOperators_);\n __ReentrancyGuard_init();\n\n __ERC4626_init_unchained(_asset);\n }\n\n /**\n * Unchained constructor for the ERC4626Upgradeable contract, without parents contracts init\n * @param _asset which will be stored in this Vault\n */\n function __ERC4626_init_unchained(IERC20Upgradeable _asset)\n internal\n onlyInitializing\n {\n asset = _asset;\n }\n\n /* ///////////////////////////// DEPOSIT / WITHDRAWAL ///////////////////////////// */\n\n /// @notice Mints Vault shares to receiver by depositing exactly amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage,\n /// the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function deposit(uint256 assets, address receiver)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n shares = previewDeposit(assets);\n // Check for rounding error since we round down in previewDeposit.\n require(shares != 0, \"Given assets result in 0 shares.\");\n\n _receiveAndDeposit(assets, shares, receiver);\n }\n\n /// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function mint(uint256 shares, address receiver)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n // No need to check for rounding error, previewMint rounds up.\n assets = previewMint(shares);\n\n _receiveAndDeposit(assets, shares, receiver);\n }\n\n /// @notice Base deposit logic which common for public deposit and mint function\n /// Trasfer assets from sender and mint shares for receiver\n function _receiveAndDeposit(\n uint256 assets,\n uint256 shares,\n address receiver\n ) internal {\n // cases when msg.sender != receiver are error prone\n // but they are allowed by the standard... we need take care of it ourselves\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares, \"\", \"\");\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n /// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n /// - emit the Withdraw event.\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\n /// - support a withdraw flow where the shares are burned from owner directly where msg.sender\n /// has ERC-20 approval over the shares of owner.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the withdraw execution, and are accounted for during withdraw.\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual nonReentrant returns (uint256 shares) {\n // No need to check for rounding error, previewWithdraw rounds up.\n shares = previewWithdraw(assets);\n\n _withdrawAndSend(assets, shares, receiver, owner);\n }\n\n /// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n /// - emit the Withdraw event.\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\n /// - support a redeem flow where the shares are burned from owner directly where msg.sender\n /// has ERC-20 approval over the shares of owner.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the redeem execution, and are accounted for during redeem.\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual nonReentrant returns (uint256 assets) {\n assets = previewRedeem(shares);\n // Check for rounding error since we round down in previewRedeem.\n require(assets != 0, \"Given shares result in 0 assets.\");\n\n _withdrawAndSend(assets, shares, receiver, owner);\n }\n\n /// @notice Burn owner shares and send tokens to receiver.\n function _withdrawAndSend(\n uint256 assets,\n uint256 shares,\n address receiver,\n address owner\n ) internal {\n // cases when msg.sender != receiver != owner is error prune\n // but they allowed by standard... take care of it by self\n if (msg.sender != owner) {\n _spendAllowance(owner, msg.sender, shares);\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares, \"\", \"\");\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /* ///////////////////////////// ACCOUNTING ///////////////////////////// */\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block,\n /// given current on-chain conditions.\n /// - return as close to and no more than the exact amount of Vault shares that would be minted\n /// in a deposit call in the same transaction.\n /// I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction.\n /// - NOT account for deposit limits like those returned from maxDeposit\n /// and should always act as though the deposit would be accepted,\n /// regardless if the user has enough tokens approved, etc.\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n /// - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert.\n /// Note that any unfavorable discrepancy between convertToShares and previewDeposit\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by depositing.\n function previewDeposit(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n return convertToShares(assets);\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block,\n /// given current on-chain conditions.\n /// - return as close to and no fewer than the exact amount of assets that would be deposited\n /// in a mint call in the same transaction.\n /// I.e. mint should return the same or fewer assets as previewMint if called in the same transaction.\n /// - NOT account for mint limits like those returned from maxMint\n /// and should always act as though the mint would be accepted,\n /// regardless if the user has enough tokens approved, etc.\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause mint to revert.\n /// Note that any unfavorable discrepancy between convertToAssets and previewMint\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by minting.\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return shares;\n }\n\n return shares.mulDivUp(totalAssets(), supply);\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal\n /// at the current block, given current on-chain conditions.\n /// - return as close to and no fewer than the exact amount of Vault shares\n /// that would be burned in a withdraw call in the same transaction.\n /// I.e. withdraw should return the same or fewer shares as previewWithdraw\n /// if called in the same transaction.\n /// - NOT account for withdrawal limits like those returned from maxWithdraw\n /// and should always act as though the withdrawal would be accepted,\n /// regardless if the user has enough shares, etc.\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause withdraw to revert.\n /// Note that any unfavorable discrepancy between convertToShares and previewWithdraw\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by depositing.\n function previewWithdraw(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return assets;\n }\n return assets.mulDivUp(supply, totalAssets());\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their\n /// redeemption at the current block, given current on-chain conditions.\n /// - return as close to and no more than the exact amount of assets that would be withdrawn\n /// in a redeem call in the same transaction.\n /// I.e. redeem should return the same or more assets as previewRedeem\n /// if called in the same transaction.\n /// - NOT account for redemption limits like those returned from maxRedeem\n /// and should always act as though the redemption would be accepted,\n /// regardless if the user has enough shares, etc.\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause redeem to revert.\n /// Note that any unfavorable discrepancy between convertToAssets and previewRedeem\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by redeeming.\n function previewRedeem(uint256 shares)\n public\n view\n virtual\n returns (uint256)\n {\n return convertToAssets(shares);\n }\n\n /// @notice The amount of shares that the Vault would exchange for the amount of assets provided,\n /// in an ideal scenario where all the conditions are met.\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\n /// - do NOT show any variations depending on the caller.\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\n /// - round down towards 0.\n /// This calculation MAY NOT reflect the “per-user” price-per-share,\n /// and instead should reflect the “average-user’s” price-per-share,\n /// meaning what the average user should expect to see when exchanging to and from.\n function convertToShares(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return assets;\n }\n\n return assets.mulDivDown(supply, totalAssets());\n }\n\n /// @notice The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\n /// - do NOT show any variations depending on the caller.\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\n /// - round down towards 0.\n /// This calculation MAY NOT reflect the “per-user” price-per-share,\n /// and instead should reflect the “average-user’s” price-per-share,\n /// meaning what the average user should expect to see when exchanging to and from.\n function convertToAssets(uint256 shares)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return shares;\n }\n\n return shares.mulDivDown(totalAssets(), supply);\n }\n\n /// @notice Total amount of the underlying asset that is “managed” by Vault.\n /// - include any compounding that occurs from yield.\n /// - inclusive of any fees that are charged against assets in the Vault.\n /// - is NOT revert\n /// @dev Must be implemented by child contract.\n function totalAssets() public view virtual returns (uint256);\n\n /* //////////////////////////////// DEPOSIT / WITHDRAWAL LIMIT //////////////////////////////// */\n\n /// @notice Maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n /// through a deposit call.\n /// - returns the maximum amount of assets deposit would allow to be deposited\n /// for receiver and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\n /// - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /// @notice Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call.\n /// - return the maximum amount of shares mint would allow to be deposited to receiver\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\n /// - factor in both global and user-specific limits,\n /// like if mints are entirely disabled (even temporarily) it MUST return 0.\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /// @notice Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault,\n /// through a withdraw call.\n /// - return the maximum amount of assets that could be transferred from owner through withdraw\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// - factor in both global and user-specific limits,\n /// like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf(owner));\n }\n\n /// @notice Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n /// through a redeem call.\n /// - return the maximum amount of shares that could be transferred from owner through redeem\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// - factor in both global and user-specific limits,\n /// like if redemption is entirely disabled (even temporarily) it MUST return 0.\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf(owner);\n }\n\n /* //////////////////////////////// INTERNAL HOOKS //////////////////////////////// */\n\n /// @notice Called before withdraw will be made the Vault.\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\n\n /// @notice Called when a deposit is made to the Vault.\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\n}\n" + }, + "src/tokens/ERC5484Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {ERC721EnumerableUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\nimport {ERC721URIStorageUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {IAccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {CountersUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport {IERC5484} from \"./IERC5484.sol\";\n\ncontract ERC5484Upgradeable is\n IERC5484,\n Initializable,\n ERC721Upgradeable,\n ERC721EnumerableUpgradeable,\n ERC721URIStorageUpgradeable,\n AccessControlUpgradeable\n{\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n CountersUpgradeable.Counter private _tokenIdCounter;\n\n /// @dev burn mode with different behavior\n BurnAuth private _burnAuth;\n\n /// @dev Token can me minted only once per user\n bool private _mintOnce;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n /// @dev Modifier to protect a burn a token without permission\n modifier allowedTransfer(address to, address from, uint256 tokenId) {\n bool isMint = from == address(0);\n bool isBurner = hasRole(BURNER_ROLE, msg.sender);\n bool isBurn = !isMint && to == address(0);\n if(_burnAuth == BurnAuth.Neither) {\n // nobody can burn token\n require(isMint, \"ERC5484: can't be transferred\");\n } else if(_burnAuth == BurnAuth.IssuerOnly) {\n // only issuer can burn token\n // so we are checking if token is generation with condition from == address(0)\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\n bool isBurnOperation = isBurner && isBurn;\n require(isMint || isBurnOperation, \"ERC5484: can't be transferred\");\n } else if (_burnAuth == BurnAuth.OwnerOnly){\n // only owner can burn token\n // so we are checking if token is generation with condition from == ownerOf(tokenId) and it is burn operation\n bool isOwner = _ownerOf(tokenId) == msg.sender && hasRole(BURNER_ROLE, msg.sender);\n require(isMint || (isOwner && isBurn), \"ERC5484: can't be transferred\");\n } else if (_burnAuth == BurnAuth.Both) {\n // both owner and issuer can burn token\n // so we are checking if token is minting with condition from == address(0)\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\n require(isMint || (isBurn && isBurner), \"ERC5484: can't be transferred\");\n }\n _;\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n// constructor()\n// {\n// _disableInitializers(); //todo discuss what proper way to initialize in scope uip proxy migation\n// }\n\n function __ERC5484Upgradeable_init(\n string memory name_,\n string memory symbol_,\n BurnAuth burnAuth_,\n bool mintOnce_,\n address admin_\n ) internal onlyInitializing {\n __ERC721_init(name_, symbol_);\n __ERC721Enumerable_init();\n __ERC721URIStorage_init();\n __AccessControl_init();\n _burnAuth = burnAuth_;\n _mintOnce = mintOnce_;\n\n // setup roles depend on mode for SoulBound token\n _setupRole(DEFAULT_ADMIN_ROLE, admin_);\n _setupRole(MINTER_ROLE, admin_);\n if(burnAuth_ == BurnAuth.IssuerOnly || burnAuth_ == BurnAuth.Both) {\n _setupRole(BURNER_ROLE, admin_);\n }\n }\n\n /// @dev function for mint new SBT token\n function safeMint(address to, string memory uri) public onlyRole(MINTER_ROLE) {\n // allow to mint only once per user if _mintOnce is true\n require(!_mintOnce || balanceOf(to) == 0,\"ERC5484: User already has token\");\n\n // mint token\n uint256 tokenId = _tokenIdCounter.current();\n _tokenIdCounter.increment();\n _safeMint(to, tokenId);\n _setTokenURI(tokenId, uri);\n\n // set permission to burn token\n if(_burnAuth == BurnAuth.OwnerOnly || _burnAuth == BurnAuth.Both) {\n _setupRole(BURNER_ROLE, to);\n }\n\n // emit event\n emit Issued(address(0), to, tokenId, _burnAuth);\n }\n\n /// @dev Token is SOUL BOUND and it is not allowed to move token between users\n function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)\n internal\n allowedTransfer(to, from, tokenId)\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\n {\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\n }\n\n /// @dev Burns `tokenId`. See {ERC721-_burn}.\n function burn(uint256 tokenId) external\n onlyRole(BURNER_ROLE)\n virtual\n {\n _burn(tokenId);\n }\n\n /// @dev See {ERC721-_burn}\n function _burn(uint256 tokenId) internal override(ERC721Upgradeable, ERC721URIStorageUpgradeable){\n super._burn(tokenId);\n }\n\n /// @dev See {IERC721Metadata-tokenURI}.\n function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable, ERC721URIStorageUpgradeable)\n returns (string memory)\n {\n return super.tokenURI(tokenId);\n }\n\n /// @dev See {IERC165-supportsInterface}.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable, AccessControlUpgradeable)\n virtual\n returns (bool)\n {\n return interfaceId == type(IERC5484).interfaceId\n || interfaceId == type(IAccessControlUpgradeable).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /// @notice provides burn authorization of the token id.\n /// @dev unassigned tokenIds are invalid, and queries do throw\n /// @param tokenId The identifier for a token.\n function burnAuth(uint256 tokenId) external view returns (BurnAuth){\n require(_exists(tokenId), \"ERC5484: token doesn't exists\");\n return _burnAuth;\n }\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[48] private __gap;\n}" + }, + "src/tokens/IERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title ERC4626 complient Vault interface\ninterface IERC4626 {\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n function asset() external view returns (IERC20Upgradeable);\n}\n" + }, + "src/tokens/IERC5484.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface IERC5484 {\n /// A guideline to standardlize burn-authorization's number coding\n enum BurnAuth {\n IssuerOnly,\n OwnerOnly,\n Both,\n Neither\n }\n\n /// @notice Emitted when a soulbound token is issued.\n /// @dev This emit is an add-on to nft's transfer emit in order to distinguish sbt\n /// from vanilla nft while providing backward compatibility.\n /// @param from The issuer\n /// @param to The receiver\n /// @param tokenId The id of the issued token\n event Issued (\n address indexed from,\n address indexed to,\n uint256 indexed tokenId,\n BurnAuth burnAuth\n );\n\n /// @notice provides burn authorization of the token id.\n /// @dev unassigned tokenIds are invalid, and queries do throw\n /// @param tokenId The identifier for a token.\n function burnAuth(uint256 tokenId) external view returns (BurnAuth);\n}" + }, + "src/tokens/IVaultFounderToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport {IERC721MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\nimport {IERC721EnumerableUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\";\nimport {IERC5484} from \"./IERC5484.sol\";\n\n/// @title ERC721 complient Token interface\ninterface IVaultFounderToken is\n IERC5484,\n IERC721Upgradeable,\n IERC721MetadataUpgradeable,\n IERC721EnumerableUpgradeable\n{\n function priceOf(uint256 tokenId) external view returns (uint256);\n function nextTokenPrice() external view returns (uint256);\n function setTokenURI(string memory _tokenURI) external;\n}" + }, + "src/tokens/IVaultHook.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\n\n/// @title ERC4626 Vault Token lifecycle hook interface\ninterface IVaultHook {\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request) external;\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external;\n}\n\nstruct ERC4626UpgradeableRequest {\n /// @dev The amount of assets to be deposited.\n uint256 assets;\n\n /// @dev The amount of shares to be minted.\n uint256 shares;\n\n /// @dev The address that initiated the request.\n address requestSender;\n\n /// @dev The amount of assets the sender is allowed to withdraw.\n uint256 senderMaxWithdraw;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[46] gap;\n}" + }, + "src/tokens/RewardHolder.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\nimport {Vault} from \"../Vault.sol\";\n\ncontract RewardHolder is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable {\n using FixedPointMathLib for uint256;\n\n /// @notice Emitted reward is claimed by a token owner\n event RewardClaimed(uint256 reward, address receiver);\n /// @notice Emitted when new rewards are deposited\n event RewardDeposited(address sender, uint value);\n\n /// @notice Accumulator of the total earned interest rate since the opening of the token\n uint public rewardIndex = 1e8;\n\n /// @notice The owners' reward indexes for eachas of the last time they accrued\n mapping(address => uint) public rewardOwnerIndex;\n\n /// @notice\n uint public numberCoins;\n\n Vault public vault;\n\n bytes32 public constant BALANCE_UPDATER_ROLE = keccak256(\"BALANCE_UPDATE_ROLE\");\n bytes32 public constant REWARD_CLAIMER_ROLE = keccak256(\"BALANCE_UPDATE_ROLE\");\n\n// /// @custom:oz-upgrades-unsafe-allow constructor\n// constructor()\n// {\n// _disableInitializers(); //todo discuss what proper way to initialize in scope uip proxy migation\n// }\n\n function __RewardHolder_init(\n address admin_\n ) internal onlyInitializing {\n __AccessControl_init();\n _setupRole(BALANCE_UPDATER_ROLE, admin_);\n _setupRole(DEFAULT_ADMIN_ROLE, admin_);\n __ReentrancyGuard_init();\n }\n\n /// @dev set vault\n /// @notice that is mandatory to be set before reward can be claimed\n function setVault(Vault vault_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n vault = vault_;\n }\n\n /// @dev deposit reward to the contract to be claimed by token owners\n /// @notice only role with BALANCE_UPDATER_ROLE can call this function\n /// @param plusReward amount of reward to be deposited\n function depositReward(uint256 plusReward) public onlyRole(BALANCE_UPDATER_ROLE) nonReentrant {\n // update reward index for claim reward logic\n rewardIndex += plusReward;\n emit RewardDeposited(_msgSender(), plusReward);\n }\n\n /// @dev claim reward for token owner\n /// @notice only role with REWARD_CLAIMER_ROLE can call this function\n function claimReward() external onlyRole(REWARD_CLAIMER_ROLE) nonReentrant {\n require(vault != Vault(address(0)), \"Vault not set.\");\n\n require(rewardOwnerIndex[msg.sender] != 0, \"Caller doesn't have reward.\");\n\n uint deltaIndex = rewardIndex - rewardOwnerIndex[msg.sender];\n\n // calculate reward for token owner\n //todo discuss the proper calculation mechanism\n uint256 tokenOwnerReward = deltaIndex.mulDivDown(1, numberCoins);\n rewardOwnerIndex[msg.sender] = rewardIndex;\n\n // transfer reward to token owner\n vault.transfer(msg.sender, tokenOwnerReward);\n emit RewardClaimed(tokenOwnerReward, address(msg.sender));\n }\n\n /// @dev setup new owner for reward usually called when minting new token\n function setupNewOwner(address rewardOwner) external onlyRole(BALANCE_UPDATER_ROLE) {\n rewardOwnerIndex[rewardOwner] = rewardIndex;\n _setupRole(REWARD_CLAIMER_ROLE, rewardOwner);\n numberCoins++;\n }\n}" + }, + "src/tokens/SafeERC4626Lifecycle.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC4626Upgradeable} from \"./SafeERC4626Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\nimport {IVaultHook, ERC4626UpgradeableRequest} from \"./IVaultHook.sol\";\n\nabstract contract SafeERC4626Lifecycle is SafeERC4626Upgradeable {\n // list of hooks\n IVaultHook[] public withdrawHooks;\n IVaultHook[] public depositHooks;\n\n /// @dev Adds hook to the list of deposit hooks\n function addDepositHook(IVaultHook hook) internal {\n depositHooks.push(hook);\n }\n\n /// @dev Adds hook to the list of withdraw hooks\n function addWithdrawHook(IVaultHook hook) internal {\n withdrawHooks.push(hook);\n }\n\n /// @dev Removes hook from the list of deposit hooks\n function removeDepositHook(IVaultHook hook) internal {\n // find hook\n for (uint256 i = 0; i < depositHooks.length; i++)\n {\n if (depositHooks[i] == hook)\n {\n // remove hook\n depositHooks[i] = depositHooks[depositHooks.length - 1];\n depositHooks.pop();\n return;\n }\n }\n }\n\n /// @dev Removes hook from the list of withdraw hooks\n function removeWithdrawHook(IVaultHook hook) internal {\n // find hook\n for (uint256 i = 0; i < withdrawHooks.length; i++)\n {\n if (withdrawHooks[i] == hook)\n {\n // remove hook\n withdrawHooks[i] = withdrawHooks[withdrawHooks.length - 1];\n withdrawHooks.pop();\n return;\n }\n }\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function beforeWithdraw(uint256 assets, uint256 shares)\n internal virtual override(ERC4626Upgradeable)\n {\n // if there are no hooks, then return to save gas\n if(withdrawHooks.length == 0) {\n return;\n }\n uint256[46] memory gap_; // this is needed for future upgrades\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\n assets: assets,\n shares: shares,\n requestSender: msg.sender,\n senderMaxWithdraw: maxWithdraw(msg.sender),\n gap: gap_\n });\n // iterate over hooks and call it\n for (uint256 i = 0; i < withdrawHooks.length; i++)\n {\n IVaultHook hook = withdrawHooks[i];\n hook.beforeWithdrawTrigger(request);\n }\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function afterDeposit(uint256 assets, uint256 shares)\n internal virtual override(ERC4626Upgradeable)\n {\n // if there are no depositHooks, then return to save gas\n if(depositHooks.length == 0) {\n return;\n }\n uint256[46] memory gap_; // this is needed for future upgrades\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\n assets: assets,\n shares: shares,\n requestSender: msg.sender,\n senderMaxWithdraw: maxWithdraw(msg.sender),\n gap: gap_\n });\n // iterate over depositHooks and call it\n for (uint256 i = 0; i < depositHooks.length; i++)\n {\n IVaultHook hook = depositHooks[i];\n hook.afterDepositTrigger(request);\n }\n }\n}" + }, + "src/tokens/SafeERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\n\n/// @title Safier and limited implementation of ERC-4626\n/// @notice ERC-4626 standard allow deposit and withdraw not for message sender.\n/// It commonly known issue, which hardly to test and much error prune.\n/// Such interfaces caused vulnarabilities, which resulted in million dollars hacks.\n/// On anther hand, this interfaces not have any use cases which cannot be implemented without `transferFrom` method.\n/// This implementation prevent spends and allowances from any methods except transferFrom/send\n/// Also main business logic simplified to reduce gas consumption.\nabstract contract SafeERC4626Upgradeable is ERC4626Upgradeable {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using FixedPointMathLib for uint256;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * Constructor for the SafeERC4626Upgradeable contract\n * @param _asset which will be stored in this Vault\n * @dev `defaultOperators` may be an empty array.\n */\n function __SafeERC4626_init(\n IERC20Upgradeable _asset,\n string memory name_,\n string memory symbol_,\n address[] memory defaultOperators_\n ) internal onlyInitializing {\n __ERC4626_init(_asset, name_, symbol_, defaultOperators_);\n }\n\n /**\n * Unchained constructor for the SafeERC4626Upgradeable contract, without parents contracts init\n * @param _asset which will be stored in this Vault\n */\n function __SafeERC4626Upgradeable_init_unchained(IERC20Upgradeable _asset)\n internal\n onlyInitializing\n {\n __ERC4626_init_unchained(_asset);\n }\n\n /// @notice Mints the Vault shares for msg.sender, according to the number of deposited base tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function deposit(uint256 assets)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n shares = previewDeposit(assets);\n // Check for rounding error since we round down in previewDeposit.\n require(shares != 0, \"Given assets result in 0 shares.\");\n\n _receiveAndDeposit(assets, shares, msg.sender);\n }\n\n /// @notice Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function mint(uint256 shares)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n // No need to check for rounding error, previewMint rounds up.\n assets = previewMint(shares);\n\n _receiveAndDeposit(assets, shares, msg.sender);\n }\n\n /// @notice Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender.\n /// - emit the Withdraw event.\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the withdraw execution, and are accounted for during withdraw.\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function withdraw(uint256 assets)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n // No need to check for rounding error, previewWithdraw rounds up.\n shares = previewWithdraw(assets);\n\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\n }\n\n /// @notice Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender.\n /// - emit the Withdraw event.\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the redeem execution, and are accounted for during redeem.\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function redeem(uint256 shares)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n assets = previewRedeem(shares);\n // Check for rounding error since we round down in previewRedeem.\n require(assets != 0, \"Given shares result in 0 assets.\");\n\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\n }\n\n /* //////////////////// Backwards compatible methods ////////////////////////// */\n\n /// @inheritdoc ERC4626Upgradeable\n function deposit(\n uint256 assets,\n address /* receiver */\n ) public virtual override returns (uint256 shares) {\n // nonReentrant under the hood\n return deposit(assets);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function mint(\n uint256 shares,\n address /* receiver */\n ) public virtual override returns (uint256 assets) {\n // nonReentrant under the hood\n return mint(shares);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function withdraw(\n uint256 assets,\n address, /* receiver */\n address /* owner */\n ) public virtual override returns (uint256 shares) {\n // nonReentrant under the hood\n return withdraw(assets);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function redeem(\n uint256 shares,\n address, /* receiver */\n address /* owner */\n ) public virtual override returns (uint256 assets) {\n // nonReentrant under the hood\n return redeem(shares);\n }\n}\n" + }, + "src/tokens/VaultFounderToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {IERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\nimport {ERC5484Upgradeable} from \"./ERC5484Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\nimport {IVaultFounderToken} from \"./IVaultFounderToken.sol\";\nimport {IVaultHook, ERC4626UpgradeableRequest} from \"./IVaultHook.sol\";\nimport {RewardHolder} from \"./RewardHolder.sol\";\n\ncontract VaultFounderToken is IVaultFounderToken, ERC5484Upgradeable, IVaultHook, RewardHolder {\n\n // Max number of tokens that can be minted\n uint256 private _maxCountTokens;\n\n // Next token price multiplier in percents\n uint256 private _nextTokenPriceMultiplier;\n\n // Initial token price\n uint256 private _initialTokenPrice;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[46] private __gap;\n\n function __VaultFounderToken_init(\n uint256 maxCountTokens_,\n uint256 nextTokenPriceMultiplier_,\n uint256 initialTokenPrice_,\n address admin_\n ) internal onlyInitializing {\n __ERC5484Upgradeable_init(\"Eonian Vault Founder Token\", \"EVFT\", BurnAuth.Neither, true, admin_);\n __RewardHolder_init(admin_);\n _maxCountTokens = maxCountTokens_;\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\n _initialTokenPrice = initialTokenPrice_;\n }\n\n function _safeMint(address to, uint256 tokenId) internal override {\n require(totalSupply() < _maxCountTokens, \"EVFT: max number of tokens\");\n super._safeMint(to, tokenId);\n }\n\n function priceOf(uint256 tokenId) external view returns (uint256) {\n require(tokenId < totalSupply(), \"EVFT: Token does not exist\");\n return _priceOf(tokenId);\n }\n\n function _priceOf(uint256 tokenId) internal view returns (uint256) {\n uint256 price = _initialTokenPrice;\n for (uint256 i = 0; i < tokenId; i++) {\n price = (price * _nextTokenPriceMultiplier) / 100;\n }\n return price;\n }\n\n function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\n }\n\n function nextTokenPrice() external view returns (uint256){\n return _nextTokenPrice();\n }\n\n function _nextTokenPrice() internal view returns (uint256){\n return _priceOf(totalSupply());\n }\n\n function setTokenURI(string memory _tokenURI) external override {\n address tokenOwner = msg.sender;\n uint256 tokenId = tokenOfOwnerByIndex(tokenOwner, 0);\n _setTokenURI(tokenId, _tokenURI);\n }\n\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request)\n external override\n {\n if(request.senderMaxWithdraw >= _nextTokenPrice()) {\n safeMint(request.requestSender, \"\");\n }\n }\n\n /* solhint-disable no-empty-blocks */\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external override\n {\n //empty code\n }\n /* solhint-disable no-empty-blocks */\n\n /// @dev See {IERC165-supportsInterface}.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC5484Upgradeable, AccessControlUpgradeable, IERC165Upgradeable)\n virtual\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n}" + }, + "src/upgradeable/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n// Import to compile and make ERC1967Proxy available for deploy\nimport {ERC1967Proxy} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";" + }, + "src/upgradeable/IVersionable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/** \n * Allow properly identify different versions of the same contract \n * and track upgrades results \n * */\ninterface IVersionable {\n /// @notice Returns the current version of this contract\n /// @return a version in semantic versioning format\n function version() external pure returns (string memory);\n}\n" + }, + "src/upgradeable/SafeInitializable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IVersionable} from \"./IVersionable.sol\";\n\n/** Implement best practices for initializable contracts */\nabstract contract SafeInitializable is IVersionable, Initializable {\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /**\n * This constructor prevents UUPS Uninitialized Proxies Vulnerability in all contracts which inherit from it.\n * More info about vulnerability: https://medium.com/immunefi/wormhole-uninitialized-proxy-bugfix-review-90250c41a43a\n * \n * @dev Initial fix for this vulnerability was suggested as using `_disableInitializers()` function in constructor,\n * but later, in version 4.3.2, OpenZeppelin implemented `onlyProxy` modifier for UUPS upgradable contracts,\n * which fixed this vulnerability. Still, `_disableInitializers()` is a best practice which prevents unintended access \n * to implementation contracts that can be used maliciously.\n * \n * More info: https://forum.openzeppelin.com/t/how-to-test-upgradeability-for-proxies/33436/7 \n * and https://forum.openzeppelin.com/t/uupsupgradeable-vulnerability-post-mortem/15680\n * \n * To prevent code duplication of constructor, this contract can be used. On the other hand, \n * it can be used as a marker for contracts that are safe from this vulnerability.\n * Additionally, `needDisableInitializers` parameter can be used to enable initializers in mocks and unit tests.\n *\n * @param needDisableInitializers - if true, initializers will be disabled\n */\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) {\n if(needDisableInitializers) {\n _disableInitializers();\n }\n }\n}" + }, + "src/upgradeable/SafeUUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {SafeInitializable} from \"./SafeInitializable.sol\";\n\n/** \n * Implement basic safety mechanism for UUPS proxy\n * based on owner authorization for upgrades\n * */\nabstract contract SafeUUPSUpgradeable is UUPSUpgradeable, SafeInitializable, OwnableUpgradeable {\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /** Init all required constructors, including ownable */\n function __SafeUUPSUpgradeable_init() internal onlyInitializing {\n __SafeUUPSUpgradeable_init_direct();\n\n __Ownable_init();\n }\n\n /** Init only direct constructors, UUPS only */\n function __SafeUUPSUpgradeable_init_direct() internal onlyInitializing {\n __UUPSUpgradeable_init();\n }\n\n /** Authorise that upgrades can do only owner */\n function _authorizeUpgrade(address newImplementation) internal onlyOwner override {} // solhint-disable-line no-empty-blocks\n}\n" + }, + "src/Vault.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {SafeERC20Upgradeable, IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\nimport {IVault} from \"./IVault.sol\";\nimport {Lender, BorrowerDoesNotExist} from \"./lending/Lender.sol\";\nimport {SafeERC4626Upgradeable} from \"./tokens/SafeERC4626Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./tokens/ERC4626Upgradeable.sol\";\nimport {IStrategy} from \"./strategies/IStrategy.sol\";\nimport {AddressList} from \"./structures/AddressList.sol\";\nimport {SafeInitializable} from \"./upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"./upgradeable/SafeUUPSUpgradeable.sol\";\nimport {IVersionable} from \"./upgradeable/IVersionable.sol\";\nimport {SafeERC4626Lifecycle} from \"./tokens/SafeERC4626Lifecycle.sol\";\nimport {IVaultHook} from \"./tokens/IVaultHook.sol\";\nimport {VaultFounderToken} from \"./tokens/VaultFounderToken.sol\";\n\n\nerror ExceededMaximumFeeValue();\nerror UnexpectedZeroAddress();\nerror InappropriateStrategy();\nerror StrategyNotFound();\nerror StrategyAlreadyExists();\nerror InsufficientVaultBalance(uint256 assets, uint256 shares);\nerror WrongQueueSize(uint256 size);\nerror InvalidLockedProfitReleaseRate(uint256 durationInSeconds);\nerror AccessDeniedForCaller(address caller);\n\ncontract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Lender, SafeERC4626Lifecycle {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using AddressList for address[];\n\n /// @notice Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\n uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;\n\n /// @notice Rewards contract where management fees are sent to.\n address public rewards;\n\n /// @notice Vault Founders Token contract where rewards for founders are sent to.\n address public founders;\n\n /// @notice Vault management fee (in BPS).\n uint256 public managementFee;\n\n /// @notice Vault founders reward (in BPS).\n uint256 public vaultFoundersRewardFee;\n\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\n address[] public withdrawalQueue;\n\n /// @notice The amount of funds that cannot be withdrawn by users.\n /// Decreases with time at the rate of \"lockedProfitReleaseRate\".\n uint256 public lockedProfitBaseline;\n\n /// @notice The rate of \"lockedProfitBaseline\" decline on the locked-in profit scale (scaled to 1e18).\n /// Represents the amount of funds that will be unlocked when one second passes.\n uint256 public lockedProfitReleaseRate;\n\n /// @notice Event that should happen when the strategy connects to the vault.\n /// @param strategy Address of the strategy contract.\n /// @param debtRatio Maximum portion of the loan that the strategy can take (in BPS).\n event StrategyAdded(address indexed strategy, uint256 debtRatio);\n\n /// @notice Event that should happen when the strategy has been revoked from the vault.\n /// @param strategy Address of the strategy contract.\n event StrategyRevoked(address indexed strategy);\n\n /// @notice Event that should happen when the strategy has been removed from the vault.\n /// @param strategy Address of the strategy contract.\n /// @param fromQueueOnly If \"true\", then the strategy has only been removed from the withdrawal queue.\n event StrategyRemoved(address indexed strategy, bool fromQueueOnly);\n\n /// @notice Event that should happen when the strategy has been returned to the withdrawal queue.\n /// @param strategy Address of the strategy contract.\n event StrategyReturnedToQueue(address indexed strategy);\n\n /// @notice Event that should happen when the locked-in profit release rate changed.\n event LockedProfitReleaseRateChanged(uint256 rate);\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[50] private __gap;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.9\";\n }\n\n modifier onlyOwnerOrStrategy(address strategy) {\n if (msg.sender != owner() && msg.sender != strategy) {\n revert AccessDeniedForCaller(msg.sender);\n }\n _;\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _asset,\n address _rewards,\n uint256 _managementFee,\n uint256 _lockedProfitReleaseRate,\n string memory _name,\n string memory _symbol,\n address[] memory _defaultOperators,\n address _founders,\n uint256 _foundersRewardRate\n ) public initializer {\n __SafeUUPSUpgradeable_init(); // Ownable under the hood\n __Lender_init();\n __SafeERC4626_init(\n IERC20Upgradeable(_asset),\n bytes(_name).length == 0\n ? string.concat(\n IERC20Metadata(_asset).symbol(),\n \" Eonian Vault Shares\"\n )\n : _name,\n bytes(_symbol).length == 0\n ? string.concat(\"eon\", IERC20Metadata(_asset).symbol())\n : _symbol,\n _defaultOperators\n );\n\n setRewards(_rewards);\n setManagementFee(_managementFee);\n setLockedProfitReleaseRate(_lockedProfitReleaseRate);\n setFounders(_founders);\n setFoundersRewardFee(_foundersRewardRate);\n }\n\n /// @dev Override to add the \"whenNotPaused\" modifier\n /// @inheritdoc SafeERC4626Upgradeable\n function deposit(uint256 assets)\n public\n override\n whenNotPaused\n returns (uint256 shares)\n {\n return super.deposit(assets);\n }\n\n /// @notice Hook that is used before withdrawals to release assets from strategies if necessary.\n /// @inheritdoc ERC4626Upgradeable\n function beforeWithdraw(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\n // There is no need to withdraw assets from strategies, the vault has sufficient funds\n if (_freeAssets() >= assets) {\n return;\n }\n\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\n // If the vault already has the required amount of funds, we need to finish the withdrawal\n uint256 vaultBalance = _freeAssets();\n if (assets <= vaultBalance) {\n break;\n }\n\n address strategy = withdrawalQueue[i];\n\n // We can only withdraw the amount that the strategy has as debt,\n // so that the strategy can work on the unreported (yet) funds it has earned\n uint256 requiredAmount = MathUpgradeable.min(\n assets - vaultBalance,\n borrowersData[strategy].debt\n );\n\n // Skip this strategy is there is nothing to withdraw\n if (requiredAmount == 0) {\n continue;\n }\n\n // Withdraw the required amount of funds from the strategy\n uint256 loss = IStrategy(strategy).withdraw(requiredAmount);\n\n // If the strategy failed to return all of the requested funds, we need to reduce the strategy's debt ratio\n if (loss > 0) {\n _decreaseBorrowerCredibility(strategy, loss);\n }\n }\n\n // Revert if insufficient assets remain in the vault after withdrawal from all strategies\n if (_freeAssets() < assets) {\n revert InsufficientVaultBalance(assets, shares);\n }\n\n // apply the hook\n SafeERC4626Lifecycle.beforeWithdraw(assets, shares);\n }\n\n /// @notice Adds a new strategy to the vault.\n /// @param strategy a new strategy address.\n /// @param debtRatio a ratio that shows how much of the new strategy can take, relative to other strategies.\n function addStrategy(address strategy, uint256 debtRatio)\n external\n onlyOwner\n whenNotPaused\n {\n if (strategy == address(0)) {\n revert UnexpectedZeroAddress();\n }\n\n // Strategy should refer to this vault and has the same underlying asset\n if (\n this != IStrategy(strategy).vault() ||\n asset != IStrategy(strategy).asset()\n ) {\n revert InappropriateStrategy();\n }\n\n _registerBorrower(strategy, debtRatio);\n withdrawalQueue.add(strategy);\n\n emit StrategyAdded(strategy, debtRatio);\n }\n\n /// @notice Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\n /// @param strategy a strategy address.\n function addStrategyToQueue(address strategy) external onlyOwner {\n if (strategy == address(0)) {\n revert UnexpectedZeroAddress();\n }\n\n if (withdrawalQueue.contains(strategy)) {\n revert StrategyAlreadyExists();\n }\n\n if (borrowersData[strategy].activationTimestamp == 0) {\n revert BorrowerDoesNotExist();\n }\n\n withdrawalQueue.add(strategy);\n\n emit StrategyReturnedToQueue(strategy);\n }\n\n /// @inheritdoc IVault\n function revokeStrategy(address strategy)\n external\n onlyOwnerOrStrategy(strategy)\n {\n _setBorrowerDebtRatio(strategy, 0);\n emit StrategyRevoked(strategy);\n }\n\n /// @notice Removes a strategy from the vault.\n /// @param strategy a strategy to remove.\n /// @param fromQueueOnly if \"true\", then the strategy will only be removed from the withdrawal queue.\n function removeStrategy(address strategy, bool fromQueueOnly)\n external\n onlyOwner\n {\n bool removedFromQueue = withdrawalQueue.remove(strategy);\n if (!removedFromQueue) {\n revert StrategyNotFound();\n }\n\n if (!fromQueueOnly) {\n _unregisterBorrower(strategy);\n }\n\n emit StrategyRemoved(strategy, fromQueueOnly);\n }\n\n /// @notice Sets the withdrawal queue.\n /// @param queue a new queue that will replace the existing one.\n /// Should contain only those elements that already present in the existing queue.\n function reorderWithdrawalQueue(address[] memory queue) external onlyOwner {\n withdrawalQueue = withdrawalQueue.reorder(queue);\n }\n\n /// @notice Sets the vault rewards address.\n /// @param _rewards a new rewards address.\n function setRewards(address _rewards) public onlyOwner {\n rewards = _rewards;\n }\n\n /// @notice Sets the vault management fee. Both management and foundersReward fee can't exceed 100%\n /// @param _managementFee a new management fee value (in BPS).\n function setManagementFee(uint256 _managementFee) public onlyOwner {\n if (_managementFee + vaultFoundersRewardFee > MAX_BPS) {\n revert ExceededMaximumFeeValue();\n }\n\n managementFee = _managementFee;\n }\n\n /// @notice Sets the vault founder token contract;\n /// @param _founders a new founder token contract address.\n function setFounders(address _founders) public onlyOwner {\n founders = _founders;\n addDepositHook(IVaultHook(founders));\n }\n\n /// @notice Sets the vault founder token reward rate. Both management and foundersReward fee can't exceed 100%\n /// @param _foundersRewardFee a new founder token reward fee (in BPS).\n function setFoundersRewardFee(uint256 _foundersRewardFee) public onlyOwner {\n if (_foundersRewardFee + managementFee > MAX_BPS) {\n revert ExceededMaximumFeeValue();\n }\n vaultFoundersRewardFee = _foundersRewardFee;\n }\n\n /// @notice Switches the vault pause state.\n /// @param shutdown a new vault pause state. If \"true\" is passed, the vault will be paused.\n function setEmergencyShutdown(bool shutdown) external onlyOwner {\n shutdown ? _pause() : _unpause();\n }\n\n /// @notice Changes the rate of release of locked-in profit.\n /// @param rate the rate of release of locked profit (percent per second scaled to 1e18).\n /// The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\n function setLockedProfitReleaseRate(uint256 rate) public onlyOwner {\n if (rate > LOCKED_PROFIT_RELEASE_SCALE) {\n revert InvalidLockedProfitReleaseRate(rate);\n }\n\n lockedProfitReleaseRate = rate;\n emit LockedProfitReleaseRateChanged(rate);\n }\n\n /// @notice Calculates the locked profit, takes into account the change since the last report.\n function _lockedProfit() internal view returns (uint256) {\n // Release rate should be small, since the timestamp can be manipulated by the node operator,\n // not expected to have much impact, since the changes will be applied to all users and cannot be abused directly.\n uint256 ratio = (block.timestamp - lastReportTimestamp) * lockedProfitReleaseRate; // solhint-disable-line not-rely-on-time\n\n // In case the ratio >= scale, the calculation anyway leads to zero.\n if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) {\n return 0;\n }\n\n uint256 lockedProfitChange = (ratio * lockedProfitBaseline) / LOCKED_PROFIT_RELEASE_SCALE;\n\n // Reducing locked profits over time frees up profits for users\n return lockedProfitBaseline - lockedProfitChange;\n }\n\n /// @inheritdoc Lender\n function _chargeFees(uint256 extraFreeFunds)\n internal\n override\n returns (uint256)\n {\n uint256 fee = (extraFreeFunds * managementFee) / MAX_BPS;\n if (fee > 0) {\n _mint(rewards, convertToShares(fee), \"\", \"\", false);\n }\n uint256 vaultFoundersReward = (extraFreeFunds * vaultFoundersRewardFee) / MAX_BPS;\n if (vaultFoundersReward > 0) {\n _mint(founders, convertToShares(vaultFoundersReward), \"\", \"\", false);\n }\n return fee + vaultFoundersReward;\n }\n\n /// @notice Updates the locked-in profit value according to the positive debt management report of the strategy\n /// @inheritdoc Lender\n function _afterPositiveDebtManagementReport(\n uint256 extraFreeFunds,\n uint256 chargedFees\n ) internal override {\n // Locking every reported strategy profit, taking into account the charged fees.\n lockedProfitBaseline = _lockedProfit() + extraFreeFunds - chargedFees;\n }\n\n /// @notice Updates the locked-in profit value according to the negative debt management report of the strategy\n /// @inheritdoc Lender\n function _afterNegativeDebtManagementReport(uint256 loss)\n internal\n override\n {\n uint256 currentLockedProfit = _lockedProfit();\n\n // If a loss occurs, it is necessary to release the appropriate amount of funds that users were able to withdraw it.\n lockedProfitBaseline = currentLockedProfit > loss\n ? currentLockedProfit - loss\n : 0;\n }\n\n /// @notice Returns the current debt of the strategy.\n /// @param strategy the strategy address.\n function strategyDebt(address strategy) external view returns (uint256) {\n return borrowersData[strategy].debt;\n }\n\n /// @notice Returns the debt ratio of the strategy.\n /// @param strategy the strategy address.\n function strategyRatio(address strategy) external view returns (uint256) {\n return borrowersData[strategy].debtRatio;\n }\n\n /// @notice Returns the size of the withdrawal queue.\n function getQueueSize() external view returns (uint256) {\n return withdrawalQueue.length;\n }\n\n /// @inheritdoc Lender\n function _freeAssets() internal view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @inheritdoc Lender\n function _borrowerFreeAssets(address borrower)\n internal\n view\n override\n returns (uint256)\n {\n return asset.balanceOf(borrower);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function totalAssets() public view override returns (uint256) {\n return super.lendingAssets() - _lockedProfit();\n }\n\n /// @inheritdoc IVault\n /// @dev Explicitly overridden here to keep this function exposed via \"IVault\" interface.\n function paused()\n public\n view\n override(IVault, PausableUpgradeable)\n returns (bool)\n {\n return super.paused();\n }\n\n /// @inheritdoc Lender\n function _transferFundsToBorrower(address borrower, uint256 amount)\n internal\n override\n {\n asset.safeTransfer(borrower, amount);\n }\n\n /// @inheritdoc Lender\n function _takeFundsFromBorrower(address borrower, uint256 amount)\n internal\n override\n {\n asset.safeTransferFrom(borrower, address(this), amount);\n }\n\n function afterDeposit(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\n SafeERC4626Lifecycle.afterDeposit(assets, shares);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "storageLayout", + "devdoc", + "userdoc", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "contracts/=src/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "solmate/=lib/solmate/src/" + ] + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/sepolia/solcInputs/623112c82423cb006af1fba362bc240e.json b/packages/contracts/deployments/sepolia/solcInputs/623112c82423cb006af1fba362bc240e.json new file mode 100644 index 00000000..2c2de1af --- /dev/null +++ b/packages/contracts/deployments/sepolia/solcInputs/623112c82423cb006af1fba362bc240e.json @@ -0,0 +1,307 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => 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 a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).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 override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\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 override 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 override 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 override 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 `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\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 Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\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 signaling this.\n *\n * _Available since v3.1._\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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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 `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967Upgradeable {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC4906Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4906.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"./IERC721Upgradeable.sol\";\n\n/// @title EIP-721 Metadata Update Extension\ninterface IERC4906Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\n /// @dev This event emits when the metadata of a token is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFT.\n event MetadataUpdate(uint256 _tokenId);\n\n /// @dev This event emits when the metadata of a range of tokens is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFTs.\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/IERC721Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/IERC1967Upgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeTo(address newImplementation) public virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {\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 bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\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 require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\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 function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/extensions/ERC721URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../interfaces/IERC4906Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC721 token with storage based token URI management.\n */\nabstract contract ERC721URIStorageUpgradeable is Initializable, IERC4906Upgradeable, ERC721Upgradeable {\n function __ERC721URIStorage_init() internal onlyInitializing {\n }\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\n }\n using StringsUpgradeable for uint256;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC165-supportsInterface}\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n string memory base = _baseURI();\n\n // If there is no base URI, return the token URI.\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n /**\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\n *\n * Emits {MetadataUpdate}.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\n require(_exists(tokenId), \"ERC721URIStorage: URI set of nonexistent token\");\n _tokenURIs[tokenId] = _tokenURI;\n\n emit MetadataUpdate(tokenId);\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\n * token-specific URI was set for the token, and if so, it deletes the token URI from\n * the storage mapping.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/ERC777.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC777Upgradeable.sol\";\nimport \"./IERC777RecipientUpgradeable.sol\";\nimport \"./IERC777SenderUpgradeable.sol\";\nimport \"../ERC20/IERC20Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/IERC1820RegistryUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC777} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * Support for ERC20 is included in this contract, as specified by the EIP: both\n * the ERC777 and ERC20 interfaces can be safely used when interacting with it.\n * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token\n * movements.\n *\n * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there\n * are no special restrictions in the amount of tokens that created, moved, or\n * destroyed. This makes integration with ERC20 applications seamless.\n *\n * CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.\n */\ncontract ERC777Upgradeable is Initializable, ContextUpgradeable, IERC777Upgradeable, IERC20Upgradeable {\n using AddressUpgradeable for address;\n\n IERC1820RegistryUpgradeable internal constant _ERC1820_REGISTRY = IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n\n mapping(address => uint256) private _balances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256(\"ERC777TokensSender\");\n bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\"ERC777TokensRecipient\");\n\n // This isn't ever read from - it's only used to respond to the defaultOperators query.\n address[] private _defaultOperatorsArray;\n\n // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).\n mapping(address => bool) private _defaultOperators;\n\n // For each account, a mapping of its operators and revoked default operators.\n mapping(address => mapping(address => bool)) private _operators;\n mapping(address => mapping(address => bool)) private _revokedDefaultOperators;\n\n // ERC20-allowances\n mapping(address => mapping(address => uint256)) private _allowances;\n\n /**\n * @dev `defaultOperators` may be an empty array.\n */\n function __ERC777_init(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\n __ERC777_init_unchained(name_, symbol_, defaultOperators_);\n }\n\n function __ERC777_init_unchained(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n\n _defaultOperatorsArray = defaultOperators_;\n for (uint256 i = 0; i < defaultOperators_.length; i++) {\n _defaultOperators[defaultOperators_[i]] = true;\n }\n\n // register interfaces\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC777Token\"), address(this));\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC20Token\"), address(this));\n }\n\n /**\n * @dev See {IERC777-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC777-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n *\n * Always returns 18, as per the\n * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\n */\n function decimals() public pure virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC777-granularity}.\n *\n * This implementation always returns `1`.\n */\n function granularity() public view virtual override returns (uint256) {\n return 1;\n }\n\n /**\n * @dev See {IERC777-totalSupply}.\n */\n function totalSupply() public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev Returns the amount of tokens owned by an account (`tokenHolder`).\n */\n function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\n return _balances[tokenHolder];\n }\n\n /**\n * @dev See {IERC777-send}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function send(address recipient, uint256 amount, bytes memory data) public virtual override {\n _send(_msgSender(), recipient, amount, data, \"\", true);\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}\n * interface if it is a contract.\n *\n * Also emits a {Sent} event.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _send(_msgSender(), recipient, amount, \"\", \"\", false);\n return true;\n }\n\n /**\n * @dev See {IERC777-burn}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function burn(uint256 amount, bytes memory data) public virtual override {\n _burn(_msgSender(), amount, data, \"\");\n }\n\n /**\n * @dev See {IERC777-isOperatorFor}.\n */\n function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) {\n return\n operator == tokenHolder ||\n (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||\n _operators[tokenHolder][operator];\n }\n\n /**\n * @dev See {IERC777-authorizeOperator}.\n */\n function authorizeOperator(address operator) public virtual override {\n require(_msgSender() != operator, \"ERC777: authorizing self as operator\");\n\n if (_defaultOperators[operator]) {\n delete _revokedDefaultOperators[_msgSender()][operator];\n } else {\n _operators[_msgSender()][operator] = true;\n }\n\n emit AuthorizedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-revokeOperator}.\n */\n function revokeOperator(address operator) public virtual override {\n require(operator != _msgSender(), \"ERC777: revoking self as operator\");\n\n if (_defaultOperators[operator]) {\n _revokedDefaultOperators[_msgSender()][operator] = true;\n } else {\n delete _operators[_msgSender()][operator];\n }\n\n emit RevokedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-defaultOperators}.\n */\n function defaultOperators() public view virtual override returns (address[] memory) {\n return _defaultOperatorsArray;\n }\n\n /**\n * @dev See {IERC777-operatorSend}.\n *\n * Emits {Sent} and {IERC20-Transfer} events.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public virtual override {\n require(isOperatorFor(_msgSender(), sender), \"ERC777: caller is not an operator for holder\");\n _send(sender, recipient, amount, data, operatorData, true);\n }\n\n /**\n * @dev See {IERC777-operatorBurn}.\n *\n * Emits {Burned} and {IERC20-Transfer} events.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public virtual override {\n require(isOperatorFor(_msgSender(), account), \"ERC777: caller is not an operator for holder\");\n _burn(account, amount, data, operatorData);\n }\n\n /**\n * @dev See {IERC20-allowance}.\n *\n * Note that operator and allowance concepts are orthogonal: operators may\n * not have allowance, and accounts with allowance may not be operators\n * themselves.\n */\n function allowance(address holder, address spender) public view virtual override returns (uint256) {\n return _allowances[holder][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function approve(address spender, uint256 value) public virtual override returns (bool) {\n address holder = _msgSender();\n _approve(holder, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Note that operator and allowance concepts are orthogonal: operators cannot\n * call `transferFrom` (unless they have allowance), and accounts with\n * allowance cannot call `operatorSend` (unless they are operators).\n *\n * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\n */\n function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(holder, spender, amount);\n _send(holder, recipient, amount, \"\", \"\", false);\n return true;\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with the caller address as the `operator` and with\n * `userData` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual {\n _mint(account, amount, userData, operatorData, true);\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If `requireReceptionAck` is set to true, and if a send hook is\n * registered for `account`, the corresponding function will be called with\n * `operator`, `data` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(\n address account,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) internal virtual {\n require(account != address(0), \"ERC777: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), account, amount);\n\n // Update state variables\n _totalSupply += amount;\n _balances[account] += amount;\n\n _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck);\n\n emit Minted(operator, account, amount, userData, operatorData);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Send tokens\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _send(\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) internal virtual {\n require(from != address(0), \"ERC777: transfer from the zero address\");\n require(to != address(0), \"ERC777: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, to, amount, userData, operatorData);\n\n _move(operator, from, to, amount, userData, operatorData);\n\n _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);\n }\n\n /**\n * @dev Burn tokens\n * @param from address token holder address\n * @param amount uint256 amount of tokens to burn\n * @param data bytes extra information provided by the token holder\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _burn(address from, uint256 amount, bytes memory data, bytes memory operatorData) internal virtual {\n require(from != address(0), \"ERC777: burn from the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, address(0), amount, data, operatorData);\n\n _beforeTokenTransfer(operator, from, address(0), amount);\n\n // Update state variables\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC777: burn amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Burned(operator, from, amount, data, operatorData);\n emit Transfer(from, address(0), amount);\n }\n\n function _move(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n ) private {\n _beforeTokenTransfer(operator, from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC777: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Sent(operator, from, to, amount, userData, operatorData);\n emit Transfer(from, to, amount);\n }\n\n /**\n * @dev See {ERC20-_approve}.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function _approve(address holder, address spender, uint256 value) internal virtual {\n require(holder != address(0), \"ERC777: approve from the zero address\");\n require(spender != address(0), \"ERC777: approve to the zero address\");\n\n _allowances[holder][spender] = value;\n emit Approval(holder, spender, value);\n }\n\n /**\n * @dev Call from.tokensToSend() if the interface is registered\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _callTokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n ) private {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777SenderUpgradeable(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);\n }\n }\n\n /**\n * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but\n * tokensReceived() was not registered for the recipient\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _callTokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) private {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777RecipientUpgradeable(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);\n } else if (requireReceptionAck) {\n require(!to.isContract(), \"ERC777: token recipient contract has no implementer for ERC777TokensRecipient\");\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {IERC20-Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC777: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes\n * calls to {send}, {transfer}, {operatorSend}, {transferFrom}, minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address operator, address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[41] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\n *\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\n * contract implement this interface (contract holders can be their own\n * implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777RecipientUpgradeable {\n /**\n * @dev Called by an {IERC777} token contract whenever tokens are being\n * moved or created into a registered account (`to`). The type of operation\n * is conveyed by `from` being the zero address or not.\n *\n * This call occurs _after_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensSender standard as defined in the EIP.\n *\n * {IERC777} Token holders can be notified of operations performed on their\n * tokens by having a contract implement this interface (contract holders can be\n * their own implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777SenderUpgradeable {\n /**\n * @dev Called by an {IERC777} token contract whenever a registered holder's\n * (`from`) tokens are about to be moved or destroyed. The type of operation\n * is conveyed by `to` being the zero address or not.\n *\n * This call occurs _before_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777Upgradeable {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC1820RegistryUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/IERC1820Registry.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the global ERC1820 Registry, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register\n * implementers for interfaces in this registry, as well as query support.\n *\n * Implementers may be shared by multiple accounts, and can also implement more\n * than a single interface for each account. Contracts can implement interfaces\n * for themselves, but externally-owned accounts (EOA) must delegate this to a\n * contract.\n *\n * {IERC165} interfaces can also be queried via the registry.\n *\n * For an in-depth explanation and source code analysis, see the EIP text.\n */\ninterface IERC1820RegistryUpgradeable {\n event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);\n\n event ManagerChanged(address indexed account, address indexed newManager);\n\n /**\n * @dev Sets `newManager` as the manager for `account`. A manager of an\n * account is able to set interface implementers for it.\n *\n * By default, each account is its own manager. Passing a value of `0x0` in\n * `newManager` will reset the manager to this initial state.\n *\n * Emits a {ManagerChanged} event.\n *\n * Requirements:\n *\n * - the caller must be the current manager for `account`.\n */\n function setManager(address account, address newManager) external;\n\n /**\n * @dev Returns the manager for `account`.\n *\n * See {setManager}.\n */\n function getManager(address account) external view returns (address);\n\n /**\n * @dev Sets the `implementer` contract as ``account``'s implementer for\n * `interfaceHash`.\n *\n * `account` being the zero address is an alias for the caller's address.\n * The zero address can also be used in `implementer` to remove an old one.\n *\n * See {interfaceHash} to learn how these are created.\n *\n * Emits an {InterfaceImplementerSet} event.\n *\n * Requirements:\n *\n * - the caller must be the current manager for `account`.\n * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not\n * end in 28 zeroes).\n * - `implementer` must implement {IERC1820Implementer} and return true when\n * queried for support, unless `implementer` is the caller. See\n * {IERC1820Implementer-canImplementInterfaceForAddress}.\n */\n function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;\n\n /**\n * @dev Returns the implementer of `interfaceHash` for `account`. If no such\n * implementer is registered, returns the zero address.\n *\n * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28\n * zeroes), `account` will be queried for support of it.\n *\n * `account` being the zero address is an alias for the caller's address.\n */\n function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);\n\n /**\n * @dev Returns the interface hash for an `interfaceName`, as defined in the\n * corresponding\n * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].\n */\n function interfaceHash(string calldata interfaceName) external pure returns (bytes32);\n\n /**\n * @notice Updates the cache with whether the contract implements an ERC165 interface or not.\n * @param account Address of the contract for which to update the cache.\n * @param interfaceId ERC165 interface for which to update the cache.\n */\n function updateERC165Cache(address account, bytes4 interfaceId) external;\n\n /**\n * @notice Checks whether a contract implements an ERC165 interface or not.\n * If the result is not cached a direct lookup on the contract address is performed.\n * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\n * {updateERC165Cache} with the contract address.\n * @param account Address of the contract to check.\n * @param interfaceId ERC165 interface to check.\n * @return True if `account` implements `interfaceId`, false otherwise.\n */\n function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);\n\n /**\n * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.\n * @param account Address of the contract to check.\n * @param interfaceId ERC165 interface to check.\n * @return True if `account` implements `interfaceId`, false otherwise.\n */\n function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 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 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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 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 prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / 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 prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\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 works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\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^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice 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 uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\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 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMathUpgradeable {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1967.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/IERC1967.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "lib/solmate/src/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n function powWad(int256 x, int256 y) internal pure returns (int256) {\n // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)\n return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.\n }\n\n function expWad(int256 x) internal pure returns (int256 r) {\n unchecked {\n // When the result is < 0.5 we return zero. This happens when\n // x <= floor(log(0.5e18) * 1e18) ~ -42e18\n if (x <= -42139678854452767551) return 0;\n\n // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\n // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\n if (x >= 135305999368893231589) revert(\"EXP_OVERFLOW\");\n\n // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\n // for more intermediate precision and a binary basis. This base conversion\n // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\n x = (x << 78) / 5**18;\n\n // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers\n // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\n // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\n int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\n x = x - k * 54916777467707473351141471128;\n\n // k is in the range [-61, 195].\n\n // Evaluate using a (6, 7)-term rational approximation.\n // p is made monic, we'll multiply by a scale factor later.\n int256 y = x + 1346386616545796478920950773328;\n y = ((y * x) >> 96) + 57155421227552351082224309758442;\n int256 p = y + x - 94201549194550492254356042504812;\n p = ((p * y) >> 96) + 28719021644029726153956944680412240;\n p = p * x + (4385272521454847904659076985693276 << 96);\n\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n int256 q = x - 2855989394907223263936484059900;\n q = ((q * x) >> 96) + 50020603652535783019961831881945;\n q = ((q * x) >> 96) - 533845033583426703283633433725380;\n q = ((q * x) >> 96) + 3604857256930695427073651918091429;\n q = ((q * x) >> 96) - 14423608567350463180887372962807573;\n q = ((q * x) >> 96) + 26449188498355588339934803723976023;\n\n assembly {\n // Div in assembly because solidity adds a zero check despite the unchecked.\n // The q polynomial won't have zeros in the domain as all its roots are complex.\n // No scaling is necessary because p is already 2**96 too large.\n r := sdiv(p, q)\n }\n\n // r should be in the range (0.09, 0.25) * 2**96.\n\n // We now need to multiply r by:\n // * the scale factor s = ~6.031367120.\n // * the 2**k factor from the range reduction.\n // * the 1e18 / 2**96 factor for base conversion.\n // We do this all at once, with an intermediate result in 2**213\n // basis, so the final right shift is always by a positive amount.\n r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\n }\n }\n\n function lnWad(int256 x) internal pure returns (int256 r) {\n unchecked {\n require(x > 0, \"UNDEFINED\");\n\n // We want to convert x from 10**18 fixed point to 2**96 fixed point.\n // We do this by multiplying by 2**96 / 10**18. But since\n // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\n // and add ln(2**96 / 10**18) at the end.\n\n // Reduce range of x to (1, 2) * 2**96\n // ln(2^k * x) = k * ln(2) + ln(x)\n int256 k = int256(log2(uint256(x))) - 96;\n x <<= uint256(159 - k);\n x = int256(uint256(x) >> 159);\n\n // Evaluate using a (8, 8)-term rational approximation.\n // p is made monic, we will multiply by a scale factor later.\n int256 p = x + 3273285459638523848632254066296;\n p = ((p * x) >> 96) + 24828157081833163892658089445524;\n p = ((p * x) >> 96) + 43456485725739037958740375743393;\n p = ((p * x) >> 96) - 11111509109440967052023855526967;\n p = ((p * x) >> 96) - 45023709667254063763336534515857;\n p = ((p * x) >> 96) - 14706773417378608786704636184526;\n p = p * x - (795164235651350426258249787498 << 96);\n\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n // q is monic by convention.\n int256 q = x + 5573035233440673466300451813936;\n q = ((q * x) >> 96) + 71694874799317883764090561454958;\n q = ((q * x) >> 96) + 283447036172924575727196451306956;\n q = ((q * x) >> 96) + 401686690394027663651624208769553;\n q = ((q * x) >> 96) + 204048457590392012362485061816622;\n q = ((q * x) >> 96) + 31853899698501571402653359427138;\n q = ((q * x) >> 96) + 909429971244387300277376558375;\n assembly {\n // Div in assembly because solidity adds a zero check despite the unchecked.\n // The q polynomial is known not to have zeros in the domain.\n // No scaling required because p is already 2**96 too large.\n r := sdiv(p, q)\n }\n\n // r is in the range (0, 0.125) * 2**96\n\n // Finalization, we need to:\n // * multiply by the scale factor s = 5.549…\n // * add ln(2**96 / 10**18)\n // * add k * ln(2)\n // * multiply by 10**18 / 2**96 = 5**18 >> 78\n\n // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\n r *= 1677202110996718588342820967067443963516166;\n // add ln(2) * k * 5e18 * 2**192\n r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\n // add ln(2**96 / 10**18) * 5e18 * 2**192\n r += 600920179829731861736702779321621459595472258049074101567377883020018308;\n // base conversion: mul 2**18 / 2**192\n r >>= 174;\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // Divide z by the denominator.\n z := div(z, denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // First, divide z - 1 by the denominator and add 1.\n // We allow z - 1 to underflow if z is 0, because we multiply the\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function log2(uint256 x) internal pure returns (uint256 r) {\n require(x > 0, \"UNDEFINED\");\n\n assembly {\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\n r := or(r, shl(3, lt(0xff, shr(r, x))))\n r := or(r, shl(2, lt(0xf, shr(r, x))))\n r := or(r, shl(1, lt(0x3, shr(r, x))))\n r := or(r, lt(0x1, shr(r, x)))\n }\n }\n}\n" + }, + "src/automation/example/SimpleGelatoJob.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {GelatoJobAdapter} from \"../GelatoJobAdapter.sol\";\n\nimport {SafeUUPSUpgradeable} from \"../../upgradeable/SafeUUPSUpgradeable.sol\";\nimport {SafeInitializable} from \"../../upgradeable/SafeInitializable.sol\";\nimport {IVersionable} from \"../../upgradeable/IVersionable.sol\";\n\ncontract SimpleGelatoJob is GelatoJobAdapter, SafeUUPSUpgradeable {\n uint256 public workMethodCalledCounter;\n bool public canWorkResult = false;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.1\";\n }\n\n // allow sending eth to the test contract\n receive() external payable {} // solhint-disable-line no-empty-blocks\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _ops,\n uint256 _minimumBetweenExecutions,\n bool _isPrepaid\n ) public initializer {\n __GelatoJobAdapter_init(_ops, _minimumBetweenExecutions, _isPrepaid);\n\n __SafeUUPSUpgradeable_init(); // ownable under the hood\n }\n\n function _work() internal override {\n workMethodCalledCounter++;\n }\n\n function _canWork() internal view override returns (bool) {\n return canWorkResult;\n }\n\n function setCanWorkResult(bool _canWorkResult) public onlyOwner {\n canWorkResult = _canWorkResult;\n }\n\n function setMinimumBetweenExecutions(uint256 _time) public onlyOwner {\n _setMinimumBetweenExecutions(_time);\n }\n\n function setIsPrepaid(bool _isPrepaid) public onlyOwner {\n isPrepaid = _isPrepaid;\n }\n\n function allowWorkNow() public onlyOwner {\n lastWorkTime = 0;\n }\n\n function refreshLastWorkTime() public onlyOwner {\n _refreshLastWorkTime();\n }\n}\n" + }, + "src/automation/gelato/BackCombatibleTransfer.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @notice Library that adding support for ERC20 and native tokens transfers.\n/// @dev Based of https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/vendor/gelato/FGelato.sol\nlibrary BackCombatibleTransfer {\n address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Backcombatible transfer to given address, will use ERC20 transfer if given token is ERC20.\n function backCombatibleTransfer(\n address payable to,\n address paymentToken,\n uint256 amount\n ) internal {\n if (paymentToken == ETH) {\n safeNativeTransfer(to, amount);\n return;\n }\n\n SafeERC20.safeTransfer(IERC20(paymentToken), to, amount);\n }\n\n /// @notice Native token transfer that checks `call` result.\n function safeNativeTransfer(address payable to, uint256 amount) internal {\n // We don't use `transfer` or `send`, as they are considered bad practices after the Istanbul hardfork.\n (bool success, ) = to.call{value: amount}(\"\");\n require(success, \"Native transfer failed\");\n }\n}\n" + }, + "src/automation/gelato/IOps.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @dev Based on https://github.com/gelatodigital/ops\ninterface IOps {\n function gelato() external view returns (address payable);\n\n function getFeeDetails() external view returns (uint256, address);\n}\n" + }, + "src/automation/gelato/IResolver.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @dev Copy of https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/interfaces/IResolver.sol\ninterface IResolver {\n function checker()\n external\n view\n returns (bool canExec, bytes memory execPayload);\n}\n" + }, + "src/automation/gelato/OpsReady.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport {IOps} from \"./IOps.sol\";\nimport {BackCombatibleTransfer} from \"./BackCombatibleTransfer.sol\";\n\nimport {SafeInitializable} from \"../../upgradeable/SafeInitializable.sol\";\n\n/// Based on https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/vendor/gelato/OpsReady.sol\n/// @notice Give basic methods to pay for Gelato operations.\nabstract contract OpsReady is SafeInitializable {\n IOps public ops;\n address payable public gelato;\n\n using BackCombatibleTransfer for address payable;\n using SafeERC20 for IERC20;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n modifier onlyOps() {\n require(msg.sender == address(ops), \"OpsReady: onlyOps\");\n _;\n }\n \n /**\n * Contructor of contract which will be able to communicate with Gelato protocol\n * @param _ops - address of the Ops contract.\n * @dev addresses can be found at https://docs.gelato.network/developer-products/gelato-ops-smart-contract-automation-hub/contract-addresses\n */\n function __OpsReady_init(address _ops) internal onlyInitializing {\n ops = IOps(_ops);\n gelato = ops.gelato();\n }\n\n /// @notice Will pay bot for executed task through galato\n function _payGalatoFee() internal {\n (uint256 fee, address feeToken) = ops.getFeeDetails();\n\n gelato.backCombatibleTransfer(feeToken, fee);\n }\n}\n" + }, + "src/automation/GelatoJobAdapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {Job} from \"./Job.sol\";\nimport {IResolver} from \"./gelato/IResolver.sol\";\nimport {OpsReady} from \"./gelato/OpsReady.sol\";\n\n/// @notice Contract expect work will be prepayd, so it cannot pay for work\nerror PayableWorkNotAllowed();\n\n/// @title Implementation of the mixin that adds support for Gelato (keepers operator)\nabstract contract GelatoJobAdapter is Job, IResolver, OpsReady {\n /// @notice If job is prepaid, then it not will try to pay on executed work.\n bool public isPrepaid;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * @notice Constructor of Job adapter contract.\n * @param _ops - address of the Ops contract.\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * @param _isPrepaid - If job is prepaid, then it not will try to pay on executed work\n */\n function __GelatoJobAdapter_init(\n address _ops,\n uint256 _minimumBetweenExecutions,\n bool _isPrepaid\n ) internal onlyInitializing {\n __OpsReady_init(_ops);\n __Job_init(_minimumBetweenExecutions);\n\n __GelatoJobAdapter_init_unchained(_isPrepaid);\n }\n\n /**\n * @notice Unchained constructor of Job adapter contract without rest of the contracts init\n * @param _isPrepaid - If job is prepaid, then it not will try to pay on executed work\n */\n function __GelatoJobAdapter_init_unchained(bool _isPrepaid)\n internal\n onlyInitializing\n {\n isPrepaid = _isPrepaid;\n }\n\n /// @notice Resolver checker that says if the work can be performed and with what params.\n function checker()\n public\n view\n returns (bool canExec, bytes memory execPayload)\n {\n canExec = canWork();\n\n execPayload = abi.encodeWithSelector(\n isPrepaid ? this.work.selector : this.payableWork.selector\n );\n }\n\n /// @notice Bot will call this method when `checker` returns `true`.\n /// Will pay caller\n /// `_doWork` method stay as it is, to allow a call off-chain\n function payableWork() public nonReentrant onlyOps {\n if (isPrepaid) {\n revert PayableWorkNotAllowed();\n }\n\n _doWork();\n\n // Check -> Effect -> Interaction\n // To prevent exploits pay only at the end of operations\n _payGalatoFee();\n }\n}\n" + }, + "src/automation/Job.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\n/// Someone tried to execute work function while `canWork` is `false`\nerror CannotWorkNow();\n\n/// Given time minimum between execution must be greater then 1000\nerror TimeMinimumBetweenExecutionsIncorrect(uint256 _givenTime);\n\n/// @title Abstract contract by implementation of which\n/// possible to make child contract support of one of keeper providers.\n/// @notice This contract is only define interface,\n/// for add support of specific provider need add specific mixin contract.\nabstract contract Job is\n SafeInitializable,\n ContextUpgradeable,\n ReentrancyGuardUpgradeable\n{\n /// Job work function was executed by worker bot\n event Worked(address indexed worker);\n\n /// @notice Timestamp of last work execution block in seconds.\n /// @dev Logic of checking and manupulating execution must be only in this contract (not in child)\n /// to control timestamp dependce vularability.\n /// Important: Expect all timestamp can be adgasted by miners.\n /// More info at: https://www.getsecureworld.com/blog/what-is-timestamp-dependence-vulnerability/\n uint256 public lastWorkTime;\n\n /// @notice Mininmal time which must pass between executions of the job in seconds.\n /// Better set hours, but at least set to greater then 900 seconds,\n /// node opperators able to manipulate timestamp in 900 seconds range, on some blockchains maybe bigger.\n uint256 public minimumBetweenExecutions;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * @notice Constructor of Job contract.\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * Set in hours to prevent block timestamp vularability\n */\n function __Job_init(uint256 _minimumBetweenExecutions)\n internal\n onlyInitializing\n {\n __Context_init();\n __ReentrancyGuard_init();\n\n __Job_init_unchained(_minimumBetweenExecutions);\n }\n\n /**\n * @notice Unchained constructor of Job contract without rest of the contracts init\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * Set in hours to prevent block timestamp vularability\n */\n function __Job_init_unchained(uint256 _minimumBetweenExecutions)\n internal\n onlyInitializing\n {\n _setMinimumBetweenExecutions(_minimumBetweenExecutions);\n // Not will set lastWorkTime to allow first work immediately after contract deploy\n }\n\n // ------------------------------------------ Public methods ------------------------------------------\n\n /// @notice If work can be executed by keeper at this moment returns true\n /// @dev Will be executed by keeper and before `work` method execution.\n function canWork() public view returns (bool) {\n // TODO: Check the maximum delay between job executions (?)\n return\n isTimePassFromLastExecution(minimumBetweenExecutions) && _canWork();\n }\n\n /// @notice allow execution only if `canWork` return true\n modifier onlyWhenCanWork() {\n if (!canWork()) {\n revert CannotWorkNow();\n }\n _;\n }\n\n /// @notice A handle that allows the `_doWork` function to be invoked externally by everyone.\n /// Perform a `canWork` check to avoid unnecessary and (maybe) malicious calls.\n /// @dev `nonReentrant` modifier might be excess there, since we have `isTimePassFromLastExecution` check\n /// and `refreshLastWorkTime` at start (see `onlyWhenCanWork` modifier). Let's keep it, as `canWork` can be overridden.\n function work() public nonReentrant onlyWhenCanWork {\n _doWork();\n }\n\n /// @notice Performs `_work` call and refreshes the last execution time.\n function _doWork() internal {\n // Refresh execution works like `nonReentrant` modifier if we have a `isTimePassFromLastExecution` check inside `canWork`.\n _refreshLastWorkTime();\n\n // An important work that is meant to be executed by the keeper.\n _work();\n\n emit Worked(msg.sender);\n }\n\n // ------------------------------------------ Time check logic ------------------------------------------\n\n /// @notice Set minimum time between executions.\n /// @param time - required time which must pass between executions of the job in seconds.\n /// Set in hours to prevent block timestamp vulnerability\n function _setMinimumBetweenExecutions(uint256 time) internal {\n if (time <= 1000) {\n revert TimeMinimumBetweenExecutionsIncorrect(time);\n }\n\n minimumBetweenExecutions = time;\n }\n\n /// @notice Time that passed since the last exection\n /// @return seconds from last execution in a range of 900 seconds\n function timeFromLastExecution() public view returns (uint256) {\n // lastWorkTime will be zero before first execution\n return block.timestamp - lastWorkTime; // solhint-disable-line not-rely-on-time\n }\n\n /// @notice Set time of last execution to current block\n function _refreshLastWorkTime() internal {\n lastWorkTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /// @notice Check if given time from last execution is passed\n /// @param second - amount of time which mast pass from last execution\n /// @return true if enough time pass\n function isTimePassFromLastExecution(uint256 second)\n internal\n view\n returns (bool)\n {\n return timeFromLastExecution() > second;\n }\n\n // ------------------------------------------ Busines methods to override ------------------------------\n\n /// @notice Method which will be executed by keeper\n function _work() internal virtual;\n\n /// @notice Method which identify if work can be executed at this moment.\n /// @dev Will be executed by keeper and before `work` method execution.\n /// @return true if `work` method can be called.\n function _canWork() internal view virtual returns (bool);\n}\n" + }, + "src/healthcheck/HealthChecker.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nimport {IHealthCheck} from \"./IHealthCheck.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror HealthCheckFailed();\n\nabstract contract HealthChecker is SafeInitializable, OwnableUpgradeable {\n event HealthCheckChanged(address);\n event HealthCheckEnabledChanged(bool);\n\n IHealthCheck public healthCheck;\n bool public healthCheckEnabled;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __HealthChecker_init(address _healthCheck)\n internal\n onlyInitializing\n {\n __Ownable_init();\n\n __HealthChecker_init_unchained(_healthCheck);\n }\n\n function __HealthChecker_init_unchained(address _healthCheck)\n internal\n onlyInitializing\n {\n setHealthCheck(_healthCheck);\n setHealthCheckEnabled(true);\n }\n\n /// @notice Sets the health check implementation contract.\n /// @param _healthCheck A new health check contract address.\n /// @dev Emits the \"HealthCheckChanged\" event.\n function setHealthCheck(address _healthCheck) public onlyOwner {\n healthCheck = IHealthCheck(_healthCheck);\n emit HealthCheckChanged(_healthCheck);\n }\n\n /// @notice Enables or disables the health check.\n /// @param _healthCheckEnabled If \"true\" - health check will be disabled.\n /// @dev Emits the \"HealthCheckEnabledChanged\" event.\n /// Do not disable the health check, unless you need to perform \"report\" in an emergency.\n function setHealthCheckEnabled(bool _healthCheckEnabled) public onlyOwner {\n healthCheckEnabled = _healthCheckEnabled;\n emit HealthCheckEnabledChanged(_healthCheckEnabled);\n }\n\n /// @notice Performs the health check by calling external contract.\n /// @param strategy Address of the strategy to be checked.\n /// @param profit The amount of funds that the strategy realised as profit.\n /// @param loss The amount of funds that the strategy realised as loss.\n /// @param debtPayment The amount of funds that the strategy spent to pay the debt.\n /// @param debtOutstanding Outstanding strategy debt.\n /// @param totalDebt The total amount of funds borrowed by the strategy from the vault.\n function performHealthCheck(\n address strategy,\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 debtOutstanding,\n uint256 totalDebt\n ) internal virtual {\n // No health check implementation provided, skip the execution.\n if (address(healthCheck) == address(0)) {\n return;\n }\n\n // There is usually no reason to turn off health checks.\n // But sometimes it may be necessary if we need to call a \"report\" manually.\n // If this happens, we should turn it on again.\n if (!healthCheckEnabled) {\n setHealthCheckEnabled(true);\n return;\n }\n\n // Perform the health check, revert the transaction if unsuccessful.\n bool success = healthCheck.check(\n strategy,\n profit,\n loss,\n debtPayment,\n debtOutstanding,\n totalDebt\n );\n if (!success) {\n revert HealthCheckFailed();\n }\n }\n}\n" + }, + "src/healthcheck/IHealthCheck.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface IHealthCheck {\n /// @notice Checks the overall state of the strategy\n /// @param strategy Address of the strategy to be checked.\n /// @param profit The amount of funds that the strategy realised as profit.\n /// @param loss The amount of funds that the strategy realised as loss.\n /// @param debtPayment The amount of funds that the strategy spent to pay the debt.\n /// @param debtOutstanding Outstanding strategy debt.\n /// @param totalDebt The total amount of funds borrowed by the strategy from the vault.\n /// @return The status of a completed health check.\n function check(\n address strategy,\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 debtOutstanding,\n uint256 totalDebt\n ) external view returns (bool);\n}\n" + }, + "src/IVault.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ILender} from \"./lending/ILender.sol\";\nimport {IERC4626} from \"./tokens/IERC4626.sol\";\n\ninterface IVault is ILender, IERC4626 {\n /// @notice Revokes a strategy from the vault.\n /// Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\n /// @param strategy a strategy to revoke.\n function revokeStrategy(address strategy) external;\n\n /// @notice Indicates if the vault was shutted down or not.\n /// @return \"true\" if the contract is paused, and \"false\" otherwise.\n function paused() external view returns (bool);\n}\n" + }, + "src/lending/ILender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface ILender {\n /// @notice Returns the number of tokens the borrower (caller of this function) can take from the lender\n /// @return Available credit as amount of tokens\n function availableCredit() external view returns (uint256);\n\n /// @notice Returns the outstanding debt that the borrower (caller of this function) must repay\n /// @return Outstanding debt as amount of tokens\n function outstandingDebt() external view returns (uint256);\n\n /// @notice Returns the amount of funds taken by the borrower (caller of this function).\n /// @return Debt as amount of tokens\n function currentDebt() external view returns (uint256);\n\n /// @notice Returns the debt ratio of the borrower (caller of this function).\n function currentDebtRatio() external view returns (uint256);\n\n /// @notice Returns the last report timestamp of the borrower (caller of this function).\n function lastReport() external view returns (uint256);\n\n /// @notice Returns the activation status of the borrower (caller of this function).\n /// @return \"true\" if the borrower is active\n function isActivated() external view returns (bool);\n\n /// @notice Reports a positive result of the borrower's debt management.\n /// Borrower must call this function if he has made any profit\n /// or/and has a free funds available to repay the outstanding debt (if any).\n /// @param extraFreeFunds an extra amount of free funds borrower's contract has.\n /// This reporting amount must be greater than the borrower's outstanding debt.\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\n function reportPositiveDebtManagement(\n uint256 extraFreeFunds,\n uint256 debtPayment\n ) external;\n\n /// @notice Reports a negative result of the borrower's debt management.\n /// The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\n /// May include a portion of the outstanding debt that the borrower was unable to repay.\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\n external;\n}\n" + }, + "src/lending/Lender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {ILender} from \"./ILender.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror BorrowerAlreadyExists();\nerror BorrowerDoesNotExist();\nerror BorrowerHasDebt();\nerror CallerIsNotABorrower();\nerror LenderRatioExceeded(uint256 freeRatio);\nerror FalsePositiveReport();\n\nabstract contract Lender is\n ILender,\n SafeInitializable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n struct BorrowerData {\n /// Timestamp of the block in which the borrower was activated\n uint256 activationTimestamp;\n /// Last time a borrower made a report\n uint256 lastReportTimestamp;\n /// Amount of tokens taken by the borrower\n uint256 debt;\n /// Maximum portion of the loan that the borrower can take (in BPS)\n /// Represents credibility of the borrower\n uint256 debtRatio;\n }\n\n uint256 public constant MAX_BPS = 10_000;\n\n /// @notice Amount of tokens that all borrowers have taken\n uint256 public totalDebt;\n\n /// @notice Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\n uint256 public debtRatio;\n\n /// @notice Last time a report occurred by any borrower\n uint256 public lastReportTimestamp;\n\n /// @notice Records with information on each borrower using the lender's services\n mapping(address => BorrowerData) public borrowersData;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @notice Event that must occur when the borrower reported the results of his debt management\n /// @param borrower Borrower's contract address\n /// @param debtPayment Amount of outstanding debt repaid by the borrower\n /// @param freeFunds Free funds on the borrower's contract that remain after the debt is paid\n /// @param fundsGiven Funds issued to the borrower by this lender\n /// @param fundsTaken Funds that have been taken from the borrower by the lender\n /// @param loss Amount of funds that the borrower realised as loss\n event BorrowerDebtManagementReported(\n address indexed borrower,\n uint256 debtPayment,\n uint256 freeFunds,\n uint256 fundsGiven,\n uint256 fundsTaken,\n uint256 loss\n );\n\n modifier onlyBorrowers() {\n if (borrowersData[msg.sender].activationTimestamp == 0) {\n revert CallerIsNotABorrower();\n }\n _;\n }\n\n /// @notice Updates the last report timestamp for the specified borrower and this lender.\n modifier updateLastReportTime() {\n _;\n borrowersData[msg.sender].lastReportTimestamp = lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __Lender_init() internal onlyInitializing {\n __Pausable_init();\n __ReentrancyGuard_init();\n\n __Lender_init_unchained();\n }\n\n function __Lender_init_unchained() internal onlyInitializing {\n lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /// @inheritdoc ILender\n function availableCredit() external view override returns (uint256) {\n return _availableCredit(msg.sender);\n }\n\n /// @inheritdoc ILender\n function outstandingDebt() external view override returns (uint256) {\n return _outstandingDebt(msg.sender);\n }\n\n /// @inheritdoc ILender\n function currentDebt() external view override returns (uint256) {\n return currentDebt(msg.sender);\n }\n\n /// @inheritdoc ILender\n function currentDebtRatio() external view override returns (uint256) {\n return borrowersData[msg.sender].debt;\n }\n\n /// @inheritdoc ILender\n function isActivated() external view override returns (bool) {\n return isActivated(msg.sender);\n }\n\n /// @inheritdoc ILender\n function lastReport() external view override returns (uint256) {\n return lastReport(msg.sender);\n }\n\n /// @inheritdoc ILender\n function reportPositiveDebtManagement(\n uint256 extraFreeFunds,\n uint256 debtPayment\n ) external override onlyBorrowers updateLastReportTime nonReentrant {\n // Checking whether the borrower is telling the truth about his available funds\n if (_borrowerFreeAssets(msg.sender) < extraFreeFunds + debtPayment) {\n revert FalsePositiveReport();\n }\n\n uint256 chargedFees = 0;\n // We can only charge a fees if the borrower has reported extra free funds,\n // if it's the first report at this block and only if the borrower was registered some time ago\n if (\n extraFreeFunds > 0 &&\n borrowersData[msg.sender].lastReportTimestamp < block.timestamp && // solhint-disable-line not-rely-on-time\n borrowersData[msg.sender].activationTimestamp < block.timestamp // solhint-disable-line not-rely-on-time\n ) {\n chargedFees = _chargeFees(extraFreeFunds);\n }\n\n _rebalanceBorrowerFunds(msg.sender, debtPayment, extraFreeFunds, 0);\n\n _afterPositiveDebtManagementReport(extraFreeFunds, chargedFees);\n }\n\n /// @inheritdoc ILender\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\n external\n override\n onlyBorrowers\n updateLastReportTime\n nonReentrant\n {\n // Checking whether the borrower has available funds for debt payment\n require(_borrowerFreeAssets(msg.sender) >= debtPayment, \"Not enough assets for payment\");\n\n // Debt wasn't repaid, we need to decrease the ratio of this borrower\n if (loss > 0) {\n _decreaseBorrowerCredibility(msg.sender, loss);\n }\n\n _rebalanceBorrowerFunds(msg.sender, debtPayment, 0, loss);\n\n _afterNegativeDebtManagementReport(loss);\n }\n\n /// @notice Balances the borrower's account and adjusts the current amount of funds the borrower can take.\n /// @param borrower a borrower's contract address.\n /// @param debtPayment an amount of outstanding debt since the previous report, that the borrower managed to cover. Can be zero.\n /// @param borrowerFreeFunds a funds that the borrower has earned since the previous report. Can be zero.\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\n function _rebalanceBorrowerFunds(\n address borrower,\n uint256 debtPayment,\n uint256 borrowerFreeFunds,\n uint256 loss\n ) private {\n // Calculate the amount of credit the lender can provide to the borrower (if any)\n uint256 borrowerAvailableCredit = _availableCredit(borrower);\n\n // Make sure that the borrower's debt payment doesn't exceed his actual outstanding debt\n uint256 borrowerOutstandingDebt = _outstandingDebt(msg.sender);\n debtPayment = MathUpgradeable.min(debtPayment, borrowerOutstandingDebt);\n\n // Take into account repaid debt, if any\n if (debtPayment > 0) {\n borrowersData[borrower].debt -= debtPayment;\n totalDebt -= debtPayment;\n }\n\n // Allocate some funds to the borrower if possible\n if (borrowerAvailableCredit > 0) {\n borrowersData[borrower].debt += borrowerAvailableCredit;\n totalDebt += borrowerAvailableCredit;\n }\n\n // Now we need to compare the allocated funds to the borrower and his current free balance.\n // If the number of unrealized tokens on the borrower's contract is less than the available credit, \n // the lender must give that difference to the borrower.\n // Otherwise (if the amount of the borrower's available funds is greater than \n // he should have according to his share), the lender must take that portion of the funds for himself.\n uint256 freeBorrowerBalance = borrowerFreeFunds + debtPayment;\n uint256 fundsGiven = 0;\n uint256 fundsTaken = 0;\n if (freeBorrowerBalance < borrowerAvailableCredit) {\n fundsGiven = borrowerAvailableCredit - freeBorrowerBalance;\n _transferFundsToBorrower(borrower, fundsGiven);\n } else if (freeBorrowerBalance > borrowerAvailableCredit) {\n fundsTaken = freeBorrowerBalance - borrowerAvailableCredit;\n _takeFundsFromBorrower(borrower, fundsTaken);\n }\n\n emit BorrowerDebtManagementReported(\n borrower,\n debtPayment,\n borrowerFreeFunds,\n fundsGiven,\n fundsTaken,\n loss\n );\n }\n\n /// @notice Returns the unrealized amount of the lender's tokens (lender's contract balance)\n function _freeAssets() internal view virtual returns (uint256);\n\n /// @notice Returns the unrealized amount of the borrower's tokens (contract balance of the specified borrower)\n function _borrowerFreeAssets(address borrower)\n internal\n view\n virtual\n returns (uint256);\n\n /// @notice Transfers a specified amount of tokens to the borrower\n function _transferFundsToBorrower(address borrower, uint256 amount)\n internal\n virtual;\n\n /// @notice Takes a specified amount of tokens from the borrower\n function _takeFundsFromBorrower(address borrower, uint256 amount)\n internal\n virtual;\n\n /// @notice Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\n function lendingAssets() public view virtual returns (uint256) {\n return _freeAssets() + totalDebt;\n }\n\n /// @notice Returns the current debt that the strategy has.\n function currentDebt(address borrower) public view returns (uint256) {\n return borrowersData[borrower].debt;\n }\n\n /// @notice Returns the activation status of the specified borrower.\n function isActivated(address borrower) public view returns (bool) {\n return borrowersData[borrower].activationTimestamp > 0;\n }\n\n /// @notice Returns the last report timestamp of the specified borrower.\n function lastReport(address borrower) public view returns (uint256) {\n return borrowersData[borrower].lastReportTimestamp;\n }\n\n /// @notice Returns the total number of tokens borrowers can take.\n function _debtLimit() private view returns (uint256) {\n return (debtRatio * lendingAssets()) / MAX_BPS;\n }\n\n /// @notice Lowers the borrower's debt he can take by specified loss and decreases his credibility.\n /// @dev This function has \"internal\" visibility because it's used in tests.\n function _decreaseBorrowerCredibility(address borrower, uint256 loss)\n internal\n {\n uint256 debt = borrowersData[borrower].debt;\n\n // Make sure the borrower's loss is less than his entire debt\n require(debt >= loss, \"Loss is greater than the debt\");\n\n // To decrease credibility of the borrower we should lower his \"debtRatio\"\n if (debtRatio > 0) {\n uint256 debtRatioChange = MathUpgradeable.min(\n (debtRatio * loss) / totalDebt,\n borrowersData[borrower].debtRatio\n );\n if (debtRatioChange != 0) {\n borrowersData[borrower].debtRatio -= debtRatioChange;\n debtRatio -= debtRatioChange;\n }\n }\n\n // Also, need to reduce the max amount of funds that can be taken by the borrower\n borrowersData[borrower].debt -= loss;\n totalDebt -= loss;\n }\n\n /// @notice See external implementation\n function _availableCredit(address borrower)\n internal\n view\n returns (uint256)\n {\n // Lender is paused, no funds available for the borrower\n if (paused()) {\n return 0;\n }\n\n uint256 lenderDebtLimit = _debtLimit();\n uint256 lenderDebt = totalDebt;\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\n lendingAssets()) / MAX_BPS;\n uint256 borrowerDebt = borrowersData[borrower].debt;\n\n // There're no more funds for the borrower because he has outstanding debt or the lender's available funds have been exhausted\n if (\n lenderDebtLimit <= lenderDebt || borrowerDebtLimit <= borrowerDebt\n ) {\n return 0;\n }\n\n uint256 lenderAvailableFunds = lenderDebtLimit - lenderDebt;\n uint256 borrowerIntendedCredit = borrowerDebtLimit - borrowerDebt;\n\n // Borrower may not take more funds than the lender's limit\n uint256 borrowerAvailableCredit = MathUpgradeable.min(\n lenderAvailableFunds,\n borrowerIntendedCredit\n );\n\n // Available credit is limited by the existing number of tokens on the lender's contract\n borrowerAvailableCredit = MathUpgradeable.min(\n borrowerAvailableCredit,\n _freeAssets()\n );\n\n return borrowerAvailableCredit;\n }\n\n /// @notice See external implementation\n function _outstandingDebt(address borrower)\n internal\n view\n returns (uint256)\n {\n uint256 borrowerDebt = borrowersData[borrower].debt;\n if (paused() || debtRatio == 0) {\n return borrowerDebt;\n }\n\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\n lendingAssets()) / MAX_BPS;\n if (borrowerDebt <= borrowerDebtLimit) {\n return 0;\n }\n\n return borrowerDebt - borrowerDebtLimit;\n }\n\n /// @notice Registers a new borrower and sets for him a certain debt ratio\n function _registerBorrower(address borrower, uint256 borrowerDebtRatio)\n internal\n {\n // Check if specified borrower has already registered\n if (isActivated(borrower)) {\n revert BorrowerAlreadyExists();\n }\n\n if (debtRatio + borrowerDebtRatio > MAX_BPS) {\n revert LenderRatioExceeded(MAX_BPS - debtRatio);\n }\n\n borrowersData[borrower] = BorrowerData(\n // Activation timestamp \n block.timestamp, // solhint-disable-line not-rely-on-time\n // Last report timestamp\n block.timestamp, // solhint-disable-line not-rely-on-time\n // Initial debt\n 0, \n // Debt ratio\n borrowerDebtRatio \n );\n\n debtRatio += borrowerDebtRatio;\n }\n\n /// @notice Sets the borrower's debt ratio. Will be reverted if the borrower doesn't exist or the total debt ratio is exceeded.\n /// @dev In the case where you want to disable the borrower, you need to set its ratio to 0.\n /// Thus, the borrower's current debt becomes an outstanding debt, which he must repay to the lender.\n function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)\n internal\n {\n if (!isActivated(borrower)) {\n revert BorrowerDoesNotExist();\n }\n\n debtRatio -= borrowersData[borrower].debtRatio;\n borrowersData[borrower].debtRatio = borrowerDebtRatio;\n debtRatio += borrowerDebtRatio;\n\n if (debtRatio > MAX_BPS) {\n revert LenderRatioExceeded(\n MAX_BPS - (debtRatio - borrowerDebtRatio)\n );\n }\n }\n\n /// @notice Deletes the borrower from the list\n /// @dev Should be called after the borrower's debt ratio is changed to 0, because the lender must take back all the released funds.\n function _unregisterBorrower(address borrower) internal {\n if (borrowersData[borrower].debtRatio > 0) {\n revert BorrowerHasDebt();\n }\n delete borrowersData[borrower];\n }\n\n /// @notice Charges a fee on the borrower's income.\n /// @param extraFreeFunds an income from which the fees will be calculated.\n /// @return The total amount of fees charged.\n function _chargeFees(uint256 extraFreeFunds)\n internal\n virtual\n returns (uint256);\n\n /// @notice Callback that is called at the end of the positive report function.\n /// @param extraFreeFunds the reported extra amount of borrower's funds.\n /// @param chargedFees the total amount of charged fees.\n function _afterPositiveDebtManagementReport(\n uint256 extraFreeFunds,\n uint256 chargedFees\n ) internal virtual;\n\n /// @notice Callback that is called at the end of the negative report function.\n /// @param loss the number of tokens by which the borrower's balance has decreased since the last report.\n function _afterNegativeDebtManagementReport(uint256 loss) internal virtual;\n}\n" + }, + "src/strategies/ApeLendingStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\nimport {BaseStrategy} from \"./BaseStrategy.sol\";\nimport {ICToken} from \"./protocols/ICToken.sol\";\nimport {IPancakeRouter} from \"./protocols/IPancakeRouter.sol\";\nimport {IRainMaker} from \"./protocols/IRainMaker.sol\";\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IVault} from \"../IVault.sol\";\n\nimport {IVersionable} from \"../upgradeable/IVersionable.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"../upgradeable/SafeUUPSUpgradeable.sol\";\n\nerror IncompatibleCTokenContract();\nerror UnsupportedDecimals();\nerror MintError(uint256 code);\nerror RedeemError(uint256 code);\n\ncontract ApeLendingStrategy is SafeUUPSUpgradeable, BaseStrategy {\n uint256 private constant SECONDS_PER_BLOCK = 3;\n uint256 private constant REWARD_ESTIMATION_ACCURACY = 90;\n\n address public constant BANANA = 0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95;\n address public constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address public constant RAIN_MAKER = 0x5CB93C0AdE6B7F2760Ec4389833B0cCcb5e4efDa;\n address public constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\n /// @notice Minimum BANANA token amount to sell.\n uint256 public minBananaToSell;\n\n ICToken public cToken;\n IPancakeRouter public pancakeRouter;\n IRainMaker public rainMaker;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.3\";\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _vault,\n address _cToken,\n address _ops,\n address _nativeTokenPriceFeed,\n address _assetPriceFeed,\n uint256 _minReportInterval,\n bool _isPrepaid\n ) public initializer {\n __SafeUUPSUpgradeable_init_direct();\n __BaseStrategy_init(\n IVault(_vault),\n _ops,\n _minReportInterval,\n _isPrepaid,\n _nativeTokenPriceFeed,\n _assetPriceFeed,\n address(0)\n ); // ownable under the hood\n\n __ApeLendingStrategy_init_unchained(_cToken);\n }\n\n function __ApeLendingStrategy_init_unchained(address _cToken) internal onlyInitializing {\n cToken = ICToken(_cToken);\n pancakeRouter = IPancakeRouter(PANCAKE_ROUTER);\n rainMaker = IRainMaker(RAIN_MAKER);\n\n if (cToken.decimals() != 8 || _assetDecimals != 18) {\n revert UnsupportedDecimals();\n }\n\n if (cToken.underlying() != address(asset)) {\n revert IncompatibleCTokenContract();\n }\n\n minBananaToSell = 0.1 ether;\n\n approveTokenMax(BANANA, PANCAKE_ROUTER);\n approveTokenMax(address(asset), _cToken);\n }\n\n /// @notice Sets the minimum number of BANANA tokens that must be on the contract to sell.\n function setMinBananaToSell(uint256 _minBananaToSell) external onlyOwner {\n minBananaToSell = _minBananaToSell;\n }\n\n /// @inheritdoc IStrategy\n function name() external view returns (string memory) {\n return\n string.concat(\n IERC20MetadataUpgradeable(address(asset)).symbol(),\n \" ApeLending Strategy\"\n );\n }\n\n /// @inheritdoc BaseStrategy\n function estimatedTotalAssets() public view override returns (uint256) {\n return\n asset.balanceOf(address(this)) +\n depositedBalanceSnapshot() +\n _totalBananaBalanceInAsset();\n }\n\n /// @notice Returns current deposited balance (in asset).\n /// @dev The exchange rate is recalculated at the last time someone touched the cToken contract.\n /// Transactions are not performed too often on this contract, perhaps we should consider recalculating the rate ourselves.\n function depositedBalanceSnapshot() public view returns (uint256) {\n (, uint256 cTokenBalance, , uint256 exchangeRate) = cToken\n .getAccountSnapshot(address(this));\n\n // Since every ApeSwap's cToken has 8 decimals, we can leave 1e18 as constant here.\n return (cTokenBalance * exchangeRate) / 1e18;\n }\n\n /// @notice Returns current deposited balance (in asset).\n /// @dev Unlike the snapshot function, this function recalculates the value of the deposit.\n function depositedBalance() public returns (uint256) {\n return cToken.balanceOfUnderlying(address(this));\n }\n\n /// @notice This function makes a prediction on how much BANANA is accrued per block.\n /// @dev It is not completely accurate because it uses the current protocol balance to predict into the past.\n function _estimatedAccruedBananaPerBlock() internal view returns (uint256) {\n uint256 _depositedBalance = depositedBalanceSnapshot();\n if (_depositedBalance == 0) {\n return 0; // should be impossible to have 0 balance and positive comp accrued\n }\n uint256 distributionPerBlock = rainMaker.compSupplySpeeds(\n address(cToken)\n );\n uint256 totalSupply = (cToken.totalSupply() *\n cToken.exchangeRateStored()) / 1e18;\n return\n totalSupply > 0\n ? (_depositedBalance * distributionPerBlock) / totalSupply\n : 0;\n }\n\n /// @notice This function makes a prediction on how much BANANA is accrued.\n /// @dev It is not completely accurate because it uses the current protocol balance to predict into the past.\n function _estimatedAccruedBanana() internal view returns (uint256) {\n uint256 bananaPerBlock = _estimatedAccruedBananaPerBlock();\n if (bananaPerBlock == 0) {\n return 0;\n }\n uint256 blocksSinceLastHarvest = (block.timestamp - vault.lastReport()) / SECONDS_PER_BLOCK; // solhint-disable-line not-rely-on-time\n return blocksSinceLastHarvest * bananaPerBlock;\n }\n\n /// @notice Returns the current banana balance of the strategy contract.\n function _currentBananaBalance() internal view returns (uint256) {\n return IERC20Upgradeable(BANANA).balanceOf(address(this));\n }\n\n /// @notice Returns the current (and estimated accrued) banana balance of the strategy contract (in asset).\n /// @dev Constant REWARD_ESTIMATION_ACCURACY is used to match accuracy expectations.\n function _totalBananaBalanceInAsset() internal view returns (uint256) {\n uint256 balance = _currentBananaBalance() + _estimatedAccruedBanana();\n if (balance == 0) {\n return 0;\n }\n uint256[] memory amounts = pancakeRouter.getAmountsOut(\n balance,\n _tokenSwapPath(BANANA, address(asset))\n );\n uint256 amount = amounts[amounts.length - 1];\n return (amount * REWARD_ESTIMATION_ACCURACY) / 100;\n }\n\n /// @notice Prepares a chain of tokens (pair or triplet) to pass it into the router contract.\n function _tokenSwapPath(address tokenIn, address tokenOut)\n internal\n pure\n returns (address[] memory path)\n {\n bool isWBNB = tokenIn == address(WBNB) || tokenOut == address(WBNB);\n path = new address[](isWBNB ? 2 : 3);\n path[0] = tokenIn;\n\n if (isWBNB) {\n path[1] = tokenOut;\n } else {\n path[1] = address(WBNB);\n path[2] = tokenOut;\n }\n }\n\n /// @notice Retrieves accrued BANANA from the protocol.\n function _claimBanana() internal {\n ICToken[] memory tokens = new ICToken[](1);\n tokens[0] = cToken;\n rainMaker.claimComp(address(this), tokens);\n }\n\n /// @notice Changes the existing BANANA on the contract to an asset token.\n function _swapBananaToAsset() internal {\n uint256 bananaBalance = IERC20Upgradeable(BANANA).balanceOf(\n address(this)\n );\n if (bananaBalance < minBananaToSell) {\n return;\n }\n\n pancakeRouter.swapExactTokensForTokens(\n bananaBalance,\n 0,\n _tokenSwapPath(BANANA, address(asset)),\n address(this),\n block.timestamp // solhint-disable-line not-rely-on-time\n );\n }\n\n /// @inheritdoc BaseStrategy\n function _harvest(uint256 outstandingDebt)\n internal\n override\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n )\n {\n profit = 0;\n loss = 0;\n\n // No positions to harvest, allocate available funds to pay the debt (if any)\n if (cToken.balanceOf(address(this)) == 0) {\n debtPayment = MathUpgradeable.min(\n asset.balanceOf(address(this)),\n outstandingDebt\n );\n return (profit, loss, debtPayment);\n }\n\n uint256 deposits = depositedBalance();\n\n _claimBanana();\n _swapBananaToAsset();\n\n uint256 assetBalance = asset.balanceOf(address(this));\n uint256 balance = deposits + assetBalance;\n\n uint256 debt = vault.currentDebt();\n\n if (balance > debt) {\n profit = balance - debt;\n if (assetBalance < profit) {\n debtPayment = MathUpgradeable.min(\n assetBalance,\n outstandingDebt\n );\n profit = assetBalance - debtPayment;\n } else if (assetBalance > profit + outstandingDebt) {\n debtPayment = outstandingDebt;\n } else {\n debtPayment = assetBalance - profit;\n }\n } else {\n loss = debt - balance;\n debtPayment = MathUpgradeable.min(assetBalance, outstandingDebt);\n }\n }\n\n /// @inheritdoc BaseStrategy\n function _adjustPosition(uint256 outstandingDebt) internal override {\n if (paused()) {\n return;\n }\n\n uint256 assetBalance = asset.balanceOf(address(this));\n if (assetBalance < outstandingDebt) {\n // We compare the balance with 1 because of rounding error\n if (cToken.balanceOf(address(this)) > 1) {\n _liquidatePosition(outstandingDebt - assetBalance);\n }\n return;\n }\n\n uint256 freeBalance = assetBalance - outstandingDebt;\n if (freeBalance > 0) {\n uint256 result = cToken.mint(freeBalance);\n if (result > 0) {\n revert MintError(result);\n }\n }\n }\n\n /// @inheritdoc BaseStrategy\n /// @dev Tagged with the keyword \"virtual\" for testing purposes.\n function _liquidatePosition(uint256 assets)\n internal\n virtual\n override\n returns (uint256 liquidatedAmount, uint256 loss)\n {\n uint256 assetBalance = asset.balanceOf(address(this));\n if (assetBalance < assets) {\n uint256 deposits = depositedBalance();\n uint256 amountToRedeem = MathUpgradeable.min(deposits, assets);\n uint256 result = cToken.redeemUnderlying(amountToRedeem);\n if (result > 0) {\n revert RedeemError(result);\n }\n liquidatedAmount = amountToRedeem;\n loss = assets - liquidatedAmount;\n } else {\n liquidatedAmount = assets;\n }\n }\n\n /// @inheritdoc BaseStrategy\n function _liquidateAllPositions()\n internal\n override\n returns (uint256 amountFreed)\n {\n uint256 amountToRedeem = depositedBalance();\n uint256 result = cToken.redeemUnderlying(amountToRedeem);\n if (result > 0) {\n revert RedeemError(result);\n }\n amountFreed = amountToRedeem;\n }\n}\n" + }, + "src/strategies/BaseStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IVault} from \"../IVault.sol\";\nimport {GelatoJobAdapter} from \"../automation/GelatoJobAdapter.sol\";\nimport {Job} from \"../automation/Job.sol\";\nimport {HealthChecker} from \"../healthcheck/HealthChecker.sol\";\nimport {PriceConverter} from \"../structures/PriceConverter.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror CallerIsNotAVault();\nerror IncompatiblePriceFeeds();\n\nabstract contract BaseStrategy is\n IStrategy,\n SafeInitializable,\n GelatoJobAdapter,\n HealthChecker,\n PausableUpgradeable\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using PriceConverter for AggregatorV3Interface;\n\n IVault public vault;\n IERC20Upgradeable public asset;\n\n /// @notice Use this to adjust the threshold at which running a debt causes a work trigger.\n uint256 public debtThreshold;\n\n /// @notice The estimated amount of gas required for the \"work\" execution.\n uint256 public estimatedWorkGas;\n\n /// @notice Shows how many times the gas price spent for the \"work\" function should be lower than the profit to trigger.\n uint256 public profitFactor;\n\n /// @notice The USD price feed for the native token of the network on which this strategy works.\n AggregatorV3Interface internal _nativeTokenPriceFeed;\n\n /// @notice The USD price feed for the strategy asset.\n AggregatorV3Interface internal _assetPriceFeed;\n\n /// @notice The underlying asset's decimals.\n uint256 internal _assetDecimals;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n event Harvested(\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 outstandingDebt\n );\n\n event DebtThresholdUpdated(uint256 debtThreshold);\n\n event EstimatedWorkGasUpdated(uint256 estimatedWorkGas);\n\n event UpdatedProfitFactor(uint256 profitFactor);\n\n modifier onlyVault() {\n if (msg.sender != address(vault)) {\n revert CallerIsNotAVault();\n }\n _;\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __BaseStrategy_init(\n IVault _vault,\n address _ops,\n uint256 _minReportInterval,\n bool _isPrepaid,\n address __nativeTokenPriceFeed,\n address __assetPriceFeed,\n address _healthCheck\n ) internal onlyInitializing {\n __HealthChecker_init(_healthCheck); // ownable under the hood\n __Pausable_init();\n __GelatoJobAdapter_init(_ops, _minReportInterval, _isPrepaid);\n\n __BaseStrategy_init_unchained(\n _vault,\n __nativeTokenPriceFeed,\n __assetPriceFeed\n );\n }\n\n function __BaseStrategy_init_unchained(\n IVault _vault,\n address __nativeTokenPriceFeed,\n address __assetPriceFeed\n ) internal onlyInitializing {\n vault = _vault;\n asset = IVault(vault).asset();\n\n debtThreshold = 0;\n estimatedWorkGas = 0;\n profitFactor = 100;\n\n _nativeTokenPriceFeed = AggregatorV3Interface(__nativeTokenPriceFeed);\n _assetPriceFeed = AggregatorV3Interface(__assetPriceFeed);\n if (_nativeTokenPriceFeed.decimals() != _assetPriceFeed.decimals()) {\n revert IncompatiblePriceFeeds();\n }\n\n _assetDecimals = IERC20MetadataUpgradeable(address(asset)).decimals();\n\n approveTokenMax(address(asset), address(_vault));\n }\n\n /// @notice Harvests the strategy, recognizing any profits or losses and adjusting the strategy's investments.\n /// @inheritdoc Job\n function _work() internal override {\n uint256 profit = 0;\n uint256 loss = 0;\n uint256 debtPayment = 0;\n\n uint256 outstandingDebt = vault.outstandingDebt();\n if (paused()) {\n (profit, loss, debtPayment) = _harvestAfterShutdown(\n outstandingDebt\n );\n } else {\n (profit, loss, debtPayment) = _harvest(outstandingDebt);\n }\n\n if (profit > 0) {\n vault.reportPositiveDebtManagement(profit, debtPayment);\n } else {\n vault.reportNegativeDebtManagement(loss, debtPayment);\n }\n\n // If the strategy needs to repay the entire debt, we need to take all available funds.\n // We will take the current debt in the report above, but we still need to free up whatever is left.\n // This can happen, if the ratio is reduced to 0 or if the vault has been shutted down.\n outstandingDebt = vault.outstandingDebt();\n outstandingDebt = vault.currentDebtRatio() == 0 || vault.paused()\n ? estimatedTotalAssets()\n : outstandingDebt;\n\n _adjustPosition(outstandingDebt);\n\n uint256 totalDebt = vault.currentDebt();\n performHealthCheck(\n address(this),\n profit,\n loss,\n debtPayment,\n outstandingDebt,\n totalDebt\n );\n\n emit Harvested(profit, loss, debtPayment, outstandingDebt);\n }\n\n /// @inheritdoc Job\n function _canWork() internal view override returns (bool) {\n if (!vault.isActivated()) {\n return false;\n }\n\n // Trigger this job if the strategy has the outstanding debt to repay\n uint256 outstanding = vault.outstandingDebt();\n if (outstanding > debtThreshold) {\n return true;\n }\n\n // Trigger this job if the strategy has some loss to report\n uint256 total = estimatedTotalAssets();\n uint256 debt = vault.currentDebt();\n if (total + debtThreshold < debt) {\n return true;\n }\n\n // Estimate accumulated profit\n uint256 profit = 0;\n if (total > debt) {\n profit = total - debt;\n }\n\n // Check the gas cost againts the profit and available credit.\n // There is no sense to call the \"work\" function, if we don't have decent amount of funds to move.\n return _checkGasPriceAgainstProfit(profit);\n }\n\n /// @notice Calculates the gas price of this transaction and compares it againts the specified profit.\n /// @param profit Profit to be compared to the cost of gas.\n /// @return \"true\" if the gas price (mult. to \"profitFactor\" is lower than the strategy profit, in USD).\n function _checkGasPriceAgainstProfit(uint256 profit) internal view returns (bool) {\n uint256 credit = vault.availableCredit();\n uint256 gasCost = _gasPriceUSD() * estimatedWorkGas;\n return profitFactor * gasCost < _convertAmountToUSD(credit + profit);\n }\n\n /// @inheritdoc IStrategy\n function withdraw(uint256 assets) external override onlyVault returns (uint256 loss) { // Vault already have nonReentrant modifier check\n // Liquidate the requested amount of tokens\n uint256 amountFreed;\n (amountFreed, loss) = _liquidatePosition(assets);\n\n // Send it directly back to the vault\n IERC20Upgradeable(asset).safeTransfer(msg.sender, amountFreed);\n }\n\n /// @notice Shutdown the strategy and revoke it form the vault.\n function shutdown() external nonReentrant onlyOwner { // need check nonReentrant to avoid cyclic call\n _pause();\n IVault(vault).revokeStrategy(address(this));\n }\n\n /// @notice Sets the debt threshold.\n /// @param _debtThreshold The new debt threshold value.\n function setDebtThreshold(uint256 _debtThreshold) external onlyOwner {\n debtThreshold = _debtThreshold;\n emit DebtThresholdUpdated(_debtThreshold);\n }\n\n /// @notice Sets the estimated gas that will be required for \"work\" function.\n /// @param _estimatedWorkGas The estimated \"work\" gas value.\n function setEstimatedWorkGas(uint256 _estimatedWorkGas) external onlyOwner {\n estimatedWorkGas = _estimatedWorkGas;\n emit EstimatedWorkGasUpdated(_estimatedWorkGas);\n }\n\n /// @notice Sets the profit factor.\n /// @param _profitFactor The new profit factor value.\n function setProfitFactor(uint256 _profitFactor) external onlyOwner {\n profitFactor = _profitFactor;\n emit UpdatedProfitFactor(_profitFactor);\n }\n\n /// @notice Frees up as much funds of the base protocol as possible.\n /// @dev This function is called on harvest if the strategy was shutted down.\n /// @param outstandingDebt The outstanding debt of the strategy.\n function _harvestAfterShutdown(uint256 outstandingDebt)\n internal\n virtual\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n )\n {\n uint256 amountFreed = _liquidateAllPositions();\n if (amountFreed < outstandingDebt) {\n loss = outstandingDebt - amountFreed;\n } else if (amountFreed > outstandingDebt) {\n profit = amountFreed - outstandingDebt;\n }\n debtPayment = outstandingDebt - loss;\n }\n\n /// @notice Calculates the gas price of the current transaction (in USD).\n function _gasPriceUSD() internal view returns (uint256) {\n return _nativeTokenPriceFeed.convertAmount(tx.gasprice, 18);\n }\n\n /// @notice Calculates the pice of the specified amount of \"asset\" (in USD).\n function _convertAmountToUSD(uint256 amount)\n internal\n view\n returns (uint256)\n {\n return _assetPriceFeed.convertAmount(amount, _assetDecimals);\n }\n\n /// @notice Sets the max token allowance for the specified spender.\n function approveTokenMax(address token, address spender) internal {\n IERC20Upgradeable(token).safeApprove(spender, type(uint256).max);\n }\n\n /// @notice Estimates the total amount of strategy funds (including those invested in the base protocol).\n function estimatedTotalAssets() public view virtual returns (uint256);\n\n /// @notice The main function of the strategy.\n /// By calling this function, the strategy must realize (take out) the possible profits from the underlying protocol.\n function _harvest(uint256 outstandingDebt)\n internal\n virtual\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n );\n\n /// @notice Performs the deposit of the free funds to the underlying protocol.\n function _adjustPosition(uint256 outstandingDebt) internal virtual;\n\n /// @notice Withdraws the specific amount of \"asset\" from the underlying protocol.\n /// @param assets The amount of token to withdraw.\n /// @return liquidatedAmount Withdrawn amount\n /// @return loss The amount that could not be withdrawn\n function _liquidatePosition(uint256 assets)\n internal\n virtual\n returns (uint256 liquidatedAmount, uint256 loss);\n\n /// @notice Withdraws the entire invested amount from the underlying protocol.\n function _liquidateAllPositions()\n internal\n virtual\n returns (uint256 amountFreed);\n}\n" + }, + "src/strategies/IStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IVault} from \"../IVault.sol\";\n\ninterface IStrategy {\n /// @notice Returns the name of this strategy.\n function name() external view returns (string memory);\n\n /// @notice Returns the contract address of the underlying asset of this strategy.\n function asset() external view returns (IERC20Upgradeable);\n\n /// @notice Returns the contract address of the Vault to which this strategy is connected.\n function vault() external view returns (IVault);\n\n /// @notice Transfers a specified amount of tokens to the vault.\n /// @param assets A amount of tokens to withdraw.\n /// @return loss A number of tokens that the strategy could not return.\n function withdraw(uint256 assets) external returns (uint256 loss);\n}\n" + }, + "src/strategies/protocols/ICToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @notice Interface for Compound-like market (or vault in common terms), that allows to deposit and borrow tokens.\ninterface ICToken {\n function decimals() external returns (uint8);\n\n function underlying() external returns (address);\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external returns (uint256);\n\n function getAccountSnapshot(address account)\n external\n view\n returns (\n uint256,\n uint256,\n uint256,\n uint256\n );\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function totalBorrowsCurrent() external returns (uint256);\n\n function borrowBalanceCurrent(address account) external returns (uint256);\n\n function borrowBalanceStored(address account)\n external\n view\n returns (uint256);\n\n function exchangeRateCurrent() external returns (uint256);\n\n function exchangeRateStored() external view returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount)\n external\n returns (uint256);\n\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n ICToken cTokenCollateral\n ) external returns (uint256);\n}\n" + }, + "src/strategies/protocols/IPancakeRouter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @notice Interface for Uniswap-like exchange router.\ninterface IPancakeRouter {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n}\n" + }, + "src/strategies/protocols/IRainMaker.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ICToken} from \"./ICToken.sol\";\n\n/// @notice Interface for a compound-like controller used to control incentivized tokens received during interaction with the protocol.\ninterface IRainMaker {\n struct CompMarketState {\n /// @notice The market's last updated compBorrowIndex or compSupplyIndex\n uint224 index;\n /// @notice The block number the index was last updated at\n uint32 block;\n }\n\n function compSupplierIndex(address, address)\n external\n view\n returns (uint256);\n\n function compSpeeds(address cToken) external view returns (uint256);\n\n function compSupplySpeeds(address cToken) external view returns (uint256);\n\n function compBorrowSpeeds(address cToken) external view returns (uint256);\n\n function claimComp(address holder, ICToken[] memory cTokens) external;\n\n function claimComp(address holder) external;\n\n function compAccrued(address holder) external view returns (uint256);\n\n function compSupplyState(address cToken)\n external\n view\n returns (CompMarketState memory);\n}\n" + }, + "src/structures/AddressList.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nerror ListsDoNotMatch();\n\nlibrary AddressList {\n /// @notice Adds an address to the list.\n /// @param list the list of addresses.\n /// @param addr the address to add.\n function add(address[] storage list, address addr) internal {\n list.push(addr);\n }\n\n /// @notice Checks if the list contains the specified item.\n /// @param list the list of addresses.\n /// @param addr the address to find.\n function contains(address[] storage list, address addr)\n internal\n view\n returns (bool)\n {\n for (uint256 i = 0; i < list.length; i++) {\n if (list[i] == addr) {\n return true;\n }\n }\n return false;\n }\n\n /// @notice Removes an address from the list and fills the gap with the following items by moving them up.\n /// @param list the list of addresses.\n /// @param addr the address to remove.\n /// @return A boolean value that indicates if the address was found and removed from the list.\n function remove(address[] storage list, address addr)\n internal\n returns (bool)\n {\n bool addressFound;\n for (uint256 i = 0; i < list.length; i++) {\n if (list[i] == addr) {\n addressFound = true;\n }\n if (addressFound && i < list.length - 1) {\n list[i] = list[i + 1];\n }\n }\n if (addressFound) {\n list.pop();\n }\n return addressFound;\n }\n\n /// @notice Checks if the list can be reordered in the specified way.\n /// @param list the list of addresses.\n /// @param reoderedList the desired reordered list, which must have the same content as the existing list.\n /// @return A reordered list\n function reorder(address[] storage list, address[] memory reoderedList)\n internal\n view\n returns (address[] memory)\n {\n uint256 length = list.length;\n if (length != reoderedList.length) {\n revert ListsDoNotMatch();\n }\n for (uint256 i = 0; i < length; i++) {\n address existingAddress = list[i];\n for (uint256 j = 0; j < length; j++) {\n // Address is found, move to the next item\n if (existingAddress == reoderedList[j]) {\n break;\n }\n // If this is the last iteration, then the address is not found\n if (j == length - 1) {\n revert ListsDoNotMatch();\n }\n }\n }\n return reoderedList;\n }\n}\n" + }, + "src/structures/PriceConverter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\nimport {SafeMathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\";\n\nerror NegativePrice();\n\nlibrary PriceConverter {\n using SafeMathUpgradeable for uint256;\n\n uint256 public constant UP_TO_DECIMALS = 18;\n\n /// @notice Calculates the price of the specified number of tokens.\n /// @dev This function converts the specified number of tokens to their price (scaled to 18 decimal places).\n /// @param priceFeed The Chainlink's price feed aggregator.\n /// @param amount Number of tokens, the value of which needs to be calculated.\n /// @param decimals Decimals of the specified token.\n /// @return The calculated price of the tokens.\n function convertAmount(\n AggregatorV3Interface priceFeed,\n uint256 amount,\n uint256 decimals\n ) internal view returns (uint256) {\n (, int256 price, , , ) = priceFeed.latestRoundData();\n if (price < 0) {\n revert NegativePrice();\n }\n\n // Scaling decimals up to 18 places to increase accuracy.\n // For example, the \"USD\" price feed has 8 decimal places, so the calculation may result in zeros if a small [amount] is passed.\n uint256 priceDecimals = priceFeed.decimals();\n (, uint256 priceScaledDecimals) = UP_TO_DECIMALS.trySub(priceDecimals);\n uint256 scaledPrice = uint256(price) * 10**priceScaledDecimals;\n\n return amount * scaledPrice / 10**decimals;\n }\n}\n" + }, + "src/tokens/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {ERC777Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport {IERC4626} from \"./IERC4626.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\n/// @title ERC4626 upgradable tokenized Vault implementation based on ERC-777.\n/// More info in [EIP](https://eips.ethereum.org/EIPS/eip-4626)\n/// Based on Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/mixins/ERC4626.sol)\n///\n/// ERC-777 and ERC-20 tokens represent \"shares\"\n/// Vault “shares” which represent a claim to ownership on a fraction of the Vault’s underlying holdings.\n/// -\n/// @notice Rationale\n/// The mint method was included for symmetry and feature completeness.\n/// Most current use cases of share-based Vaults do not ascribe special meaning to the shares\n/// such that a user would optimize for a specific number of shares (mint)\n/// rather than specific amount of underlying (deposit).\n/// However, it is easy to imagine future Vault strategies which would have unique\n/// and independently useful share representations.\n/// The convertTo functions serve as rough estimates that do not account for operation specific details\n/// like withdrawal fees, etc. They were included for frontends and applications that need an average\n/// value of shares or assets, not an exact value possibly including slippage or other fees.\n/// For applications that need an exact value that attempts to account for fees and slippage we have\n/// included a corresponding preview function to match each mutable function.\n/// These functions must not account for deposit or withdrawal limits, to ensure they are easily composable,\n/// the max functions are provided for that purpose.\nabstract contract ERC4626Upgradeable is\n SafeInitializable,\n ERC777Upgradeable,\n ReentrancyGuardUpgradeable,\n IERC4626\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using FixedPointMathLib for uint256;\n\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n IERC20Upgradeable public asset;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /* ///////////////////////////// EVENTS ///////////////////////////// */\n\n /// `sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`.\n /// emitted when tokens are deposited into the Vault via the mint and deposit methods.\n event Deposit(\n address indexed caller,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /// `sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`.\n /// emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n /**\n * Constructor for the ERC4626Upgradeable contract\n * @param _asset which will be stored in this Vault\n * @dev `defaultOperators` may be an empty array.\n */\n function __ERC4626_init(\n IERC20Upgradeable _asset,\n string memory name_,\n string memory symbol_,\n address[] memory defaultOperators_\n ) internal onlyInitializing {\n __ERC777_init(name_, symbol_, defaultOperators_);\n __ReentrancyGuard_init();\n\n __ERC4626_init_unchained(_asset);\n }\n\n /**\n * Unchained constructor for the ERC4626Upgradeable contract, without parents contracts init\n * @param _asset which will be stored in this Vault\n */\n function __ERC4626_init_unchained(IERC20Upgradeable _asset)\n internal\n onlyInitializing\n {\n asset = _asset;\n }\n\n /* ///////////////////////////// DEPOSIT / WITHDRAWAL ///////////////////////////// */\n\n /// @notice Mints Vault shares to receiver by depositing exactly amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage,\n /// the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function deposit(uint256 assets, address receiver)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n shares = previewDeposit(assets);\n // Check for rounding error since we round down in previewDeposit.\n require(shares != 0, \"Given assets result in 0 shares.\");\n\n _receiveAndDeposit(assets, shares, receiver);\n }\n\n /// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function mint(uint256 shares, address receiver)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n // No need to check for rounding error, previewMint rounds up.\n assets = previewMint(shares);\n\n _receiveAndDeposit(assets, shares, receiver);\n }\n\n /// @notice Base deposit logic which common for public deposit and mint function\n /// Trasfer assets from sender and mint shares for receiver\n function _receiveAndDeposit(\n uint256 assets,\n uint256 shares,\n address receiver\n ) internal {\n // cases when msg.sender != receiver are error prone\n // but they are allowed by the standard... we need take care of it ourselves\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares, \"\", \"\");\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n /// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n /// - emit the Withdraw event.\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\n /// - support a withdraw flow where the shares are burned from owner directly where msg.sender\n /// has ERC-20 approval over the shares of owner.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the withdraw execution, and are accounted for during withdraw.\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual nonReentrant returns (uint256 shares) {\n // No need to check for rounding error, previewWithdraw rounds up.\n shares = previewWithdraw(assets);\n\n _withdrawAndSend(assets, shares, receiver, owner);\n }\n\n /// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n /// - emit the Withdraw event.\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\n /// - support a redeem flow where the shares are burned from owner directly where msg.sender\n /// has ERC-20 approval over the shares of owner.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the redeem execution, and are accounted for during redeem.\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual nonReentrant returns (uint256 assets) {\n assets = previewRedeem(shares);\n // Check for rounding error since we round down in previewRedeem.\n require(assets != 0, \"Given shares result in 0 assets.\");\n\n _withdrawAndSend(assets, shares, receiver, owner);\n }\n\n /// @notice Burn owner shares and send tokens to receiver.\n function _withdrawAndSend(\n uint256 assets,\n uint256 shares,\n address receiver,\n address owner\n ) internal {\n // cases when msg.sender != receiver != owner is error prune\n // but they allowed by standard... take care of it by self\n if (msg.sender != owner) {\n _spendAllowance(owner, msg.sender, shares);\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares, \"\", \"\");\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /* ///////////////////////////// ACCOUNTING ///////////////////////////// */\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block,\n /// given current on-chain conditions.\n /// - return as close to and no more than the exact amount of Vault shares that would be minted\n /// in a deposit call in the same transaction.\n /// I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction.\n /// - NOT account for deposit limits like those returned from maxDeposit\n /// and should always act as though the deposit would be accepted,\n /// regardless if the user has enough tokens approved, etc.\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n /// - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert.\n /// Note that any unfavorable discrepancy between convertToShares and previewDeposit\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by depositing.\n function previewDeposit(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n return convertToShares(assets);\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block,\n /// given current on-chain conditions.\n /// - return as close to and no fewer than the exact amount of assets that would be deposited\n /// in a mint call in the same transaction.\n /// I.e. mint should return the same or fewer assets as previewMint if called in the same transaction.\n /// - NOT account for mint limits like those returned from maxMint\n /// and should always act as though the mint would be accepted,\n /// regardless if the user has enough tokens approved, etc.\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause mint to revert.\n /// Note that any unfavorable discrepancy between convertToAssets and previewMint\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by minting.\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return shares;\n }\n\n return shares.mulDivUp(totalAssets(), supply);\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal\n /// at the current block, given current on-chain conditions.\n /// - return as close to and no fewer than the exact amount of Vault shares\n /// that would be burned in a withdraw call in the same transaction.\n /// I.e. withdraw should return the same or fewer shares as previewWithdraw\n /// if called in the same transaction.\n /// - NOT account for withdrawal limits like those returned from maxWithdraw\n /// and should always act as though the withdrawal would be accepted,\n /// regardless if the user has enough shares, etc.\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause withdraw to revert.\n /// Note that any unfavorable discrepancy between convertToShares and previewWithdraw\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by depositing.\n function previewWithdraw(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return assets;\n }\n return assets.mulDivUp(supply, totalAssets());\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their\n /// redeemption at the current block, given current on-chain conditions.\n /// - return as close to and no more than the exact amount of assets that would be withdrawn\n /// in a redeem call in the same transaction.\n /// I.e. redeem should return the same or more assets as previewRedeem\n /// if called in the same transaction.\n /// - NOT account for redemption limits like those returned from maxRedeem\n /// and should always act as though the redemption would be accepted,\n /// regardless if the user has enough shares, etc.\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause redeem to revert.\n /// Note that any unfavorable discrepancy between convertToAssets and previewRedeem\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by redeeming.\n function previewRedeem(uint256 shares)\n public\n view\n virtual\n returns (uint256)\n {\n return convertToAssets(shares);\n }\n\n /// @notice The amount of shares that the Vault would exchange for the amount of assets provided,\n /// in an ideal scenario where all the conditions are met.\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\n /// - do NOT show any variations depending on the caller.\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\n /// - round down towards 0.\n /// This calculation MAY NOT reflect the “per-user” price-per-share,\n /// and instead should reflect the “average-user’s” price-per-share,\n /// meaning what the average user should expect to see when exchanging to and from.\n function convertToShares(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return assets;\n }\n\n return assets.mulDivDown(supply, totalAssets());\n }\n\n /// @notice The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\n /// - do NOT show any variations depending on the caller.\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\n /// - round down towards 0.\n /// This calculation MAY NOT reflect the “per-user” price-per-share,\n /// and instead should reflect the “average-user’s” price-per-share,\n /// meaning what the average user should expect to see when exchanging to and from.\n function convertToAssets(uint256 shares)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return shares;\n }\n\n return shares.mulDivDown(totalAssets(), supply);\n }\n\n /// @notice Total amount of the underlying asset that is “managed” by Vault.\n /// - include any compounding that occurs from yield.\n /// - inclusive of any fees that are charged against assets in the Vault.\n /// - is NOT revert\n /// @dev Must be implemented by child contract.\n function totalAssets() public view virtual returns (uint256);\n\n /* //////////////////////////////// DEPOSIT / WITHDRAWAL LIMIT //////////////////////////////// */\n\n /// @notice Maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n /// through a deposit call.\n /// - returns the maximum amount of assets deposit would allow to be deposited\n /// for receiver and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\n /// - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /// @notice Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call.\n /// - return the maximum amount of shares mint would allow to be deposited to receiver\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\n /// - factor in both global and user-specific limits,\n /// like if mints are entirely disabled (even temporarily) it MUST return 0.\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /// @notice Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault,\n /// through a withdraw call.\n /// - return the maximum amount of assets that could be transferred from owner through withdraw\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// - factor in both global and user-specific limits,\n /// like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf(owner));\n }\n\n /// @notice Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n /// through a redeem call.\n /// - return the maximum amount of shares that could be transferred from owner through redeem\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// - factor in both global and user-specific limits,\n /// like if redemption is entirely disabled (even temporarily) it MUST return 0.\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf(owner);\n }\n\n /* //////////////////////////////// INTERNAL HOOKS //////////////////////////////// */\n\n /// @notice Called before withdraw will be made the Vault.\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\n\n /// @notice Called when a deposit is made to the Vault.\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\n}\n" + }, + "src/tokens/ERC5484Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {ERC721EnumerableUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\nimport {ERC721URIStorageUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {CountersUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport {IERC5484} from \"./IERC5484.sol\";\n\ncontract ERC5484Upgradeable is\n IERC5484,\n Initializable,\n ERC721Upgradeable,\n ERC721EnumerableUpgradeable,\n ERC721URIStorageUpgradeable,\n AccessControlUpgradeable\n{\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n CountersUpgradeable.Counter private _tokenIdCounter;\n\n /// @dev burn mode with different behavior\n BurnAuth private _burnAuth;\n\n /// @dev Token can me minted only once per user\n bool private _mintOnce;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n /// @dev Modifier to protect a burn a token without permission\n modifier allowedTransfer(address to, address from, uint256 tokenId) {\n bool isMint = from == address(0);\n bool isBurner = hasRole(BURNER_ROLE, msg.sender);\n bool isBurn = !isMint && to == address(0);\n if(_burnAuth == BurnAuth.Neither) {\n // nobody can burn token\n require(isMint, \"ERC5484: can't be transferred\");\n } else if(_burnAuth == BurnAuth.IssuerOnly) {\n // only issuer can burn token\n // so we are checking if token is generation with condition from == address(0)\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\n bool isBurnOperation = isBurner && isBurn;\n require(isMint || isBurnOperation, \"ERC5484: can't be transferred\");\n } else if (_burnAuth == BurnAuth.OwnerOnly){\n // only owner can burn token\n // so we are checking if token is generation with condition from == ownerOf(tokenId) and it is burn operation\n bool isOwner = _ownerOf(tokenId) == msg.sender && hasRole(BURNER_ROLE, msg.sender);\n require(isMint || (isOwner && isBurn), \"ERC5484: can't be transferred\");\n } else if (_burnAuth == BurnAuth.Both) {\n // both owner and issuer can burn token\n // so we are checking if token is minting with condition from == address(0)\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\n require(isMint || (isBurn && isBurner), \"ERC5484: can't be transferred\");\n }\n _;\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n// constructor()\n// {\n// _disableInitializers(); //todo discuss what proper way to initialize in scope uip proxy migation\n// }\n\n function __ERC5484Upgradeable_init(\n string memory name_,\n string memory symbol_,\n BurnAuth burnAuth_,\n bool mintOnce_,\n address admin_\n ) internal onlyInitializing {\n __ERC721_init(name_, symbol_);\n __ERC721Enumerable_init();\n __ERC721URIStorage_init();\n __AccessControl_init();\n _burnAuth = burnAuth_;\n _mintOnce = mintOnce_;\n\n // setup roles depend on mode for SoulBound token\n _setupRole(DEFAULT_ADMIN_ROLE, admin_);\n _setupRole(MINTER_ROLE, admin_);\n if(burnAuth_ == BurnAuth.IssuerOnly || burnAuth_ == BurnAuth.Both) {\n _setupRole(BURNER_ROLE, admin_);\n }\n }\n\n /// @dev function for mint new SBT token\n function safeMint(address to, string memory uri) public onlyRole(MINTER_ROLE) {\n // allow to mint only once per user if _mintOnce is true\n require(!_mintOnce || balanceOf(to) == 0,\"ERC5484: User already has token\");\n\n // mint token\n uint256 tokenId = _tokenIdCounter.current();\n _tokenIdCounter.increment();\n _safeMint(to, tokenId);\n _setTokenURI(tokenId, uri);\n\n // set permission to burn token\n if(_burnAuth == BurnAuth.OwnerOnly || _burnAuth == BurnAuth.Both) {\n _setupRole(BURNER_ROLE, to);\n }\n\n // emit event\n emit Issued(address(0), to, tokenId, _burnAuth);\n }\n\n /// @dev Token is SOUL BOUND and it is not allowed to move token between users\n function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)\n internal\n allowedTransfer(to, from, tokenId)\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\n {\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\n }\n\n /// @dev Burns `tokenId`. See {ERC721-_burn}.\n function burn(uint256 tokenId) external\n onlyRole(BURNER_ROLE)\n virtual\n {\n _burn(tokenId);\n }\n\n /// @dev See {ERC721-_burn}\n function _burn(uint256 tokenId) internal override(ERC721Upgradeable, ERC721URIStorageUpgradeable){\n super._burn(tokenId);\n }\n\n /// @dev See {IERC721Metadata-tokenURI}.\n function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable, ERC721URIStorageUpgradeable)\n returns (string memory)\n {\n return super.tokenURI(tokenId);\n }\n\n /// @dev See {IERC165-supportsInterface}.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable, AccessControlUpgradeable, ERC721URIStorageUpgradeable)\n virtual\n returns (bool)\n {\n return interfaceId == type(IERC5484).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /// @notice provides burn authorization of the token id.\n /// @dev unassigned tokenIds are invalid, and queries do throw\n /// @param tokenId The identifier for a token.\n function burnAuth(uint256 tokenId) external view returns (BurnAuth){\n require(_exists(tokenId), \"ERC5484: token doesn't exists\");\n return _burnAuth;\n }\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[48] private __gap;\n}" + }, + "src/tokens/IERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title ERC4626 complient Vault interface\ninterface IERC4626 {\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n function asset() external view returns (IERC20Upgradeable);\n}\n" + }, + "src/tokens/IERC5484.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface IERC5484 {\n /// A guideline to standardlize burn-authorization's number coding\n enum BurnAuth {\n IssuerOnly,\n OwnerOnly,\n Both,\n Neither\n }\n\n /// @notice Emitted when a soulbound token is issued.\n /// @dev This emit is an add-on to nft's transfer emit in order to distinguish sbt\n /// from vanilla nft while providing backward compatibility.\n /// @param from The issuer\n /// @param to The receiver\n /// @param tokenId The id of the issued token\n event Issued (\n address indexed from,\n address indexed to,\n uint256 indexed tokenId,\n BurnAuth burnAuth\n );\n\n /// @notice provides burn authorization of the token id.\n /// @dev unassigned tokenIds are invalid, and queries do throw\n /// @param tokenId The identifier for a token.\n function burnAuth(uint256 tokenId) external view returns (BurnAuth);\n}" + }, + "src/tokens/IVaultFounderToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport {IERC721MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\nimport {IERC721EnumerableUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\";\nimport {IERC5484} from \"./IERC5484.sol\";\n\n/// @title ERC721 complient Token interface\ninterface IVaultFounderToken is\n IERC5484,\n IERC721Upgradeable,\n IERC721MetadataUpgradeable,\n IERC721EnumerableUpgradeable\n{\n function priceOf(uint256 tokenId) external view returns (uint256);\n function nextTokenPrice() external view returns (uint256);\n function setTokenURI(string memory _tokenURI) external;\n}" + }, + "src/tokens/IVaultHook.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\n\n/// @title ERC4626 Vault Token lifecycle hook interface\ninterface IVaultHook {\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request) external;\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external;\n}\n\nstruct ERC4626UpgradeableRequest {\n /// @dev The amount of assets to be deposited.\n uint256 assets;\n\n /// @dev The amount of shares to be minted.\n uint256 shares;\n\n /// @dev The address that initiated the request.\n address requestSender;\n\n /// @dev The amount of assets the sender is allowed to withdraw.\n uint256 senderMaxWithdraw;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[46] gap;\n}" + }, + "src/tokens/RewardHolder.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\nimport {Vault} from \"../Vault.sol\";\n\ncontract RewardHolder is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable {\n using FixedPointMathLib for uint256;\n\n /// @notice Emitted reward is claimed by a token owner\n event RewardClaimed(uint256 reward, address receiver);\n /// @notice Emitted when new rewards are deposited\n event RewardDeposited(address sender, uint value);\n\n /// @notice Accumulator of the total earned interest rate since the opening of the token\n uint public rewardIndex = 1e8;\n\n /// @notice The owners' reward indexes for eachas of the last time they accrued\n mapping(address => uint) public rewardOwnerIndex;\n\n /// @notice\n uint public numberCoins;\n\n Vault public vault;\n\n bytes32 public constant BALANCE_UPDATER_ROLE = keccak256(\"BALANCE_UPDATE_ROLE\");\n bytes32 public constant REWARD_CLAIMER_ROLE = keccak256(\"BALANCE_UPDATE_ROLE\");\n\n// /// @custom:oz-upgrades-unsafe-allow constructor\n// constructor()\n// {\n// _disableInitializers(); //todo discuss what proper way to initialize in scope uip proxy migation\n// }\n\n function __RewardHolder_init(\n address admin_,\n Vault vault_\n ) internal onlyInitializing {\n __AccessControl_init();\n _setupRole(BALANCE_UPDATER_ROLE, admin_);\n __ReentrancyGuard_init();\n vault = vault_;\n }\n\n /// @dev deposit reward to the contract to be claimed by token owners\n /// @notice only role with BALANCE_UPDATER_ROLE can call this function\n /// @param plusReward amount of reward to be deposited\n function depositReward(uint256 plusReward) public onlyRole(BALANCE_UPDATER_ROLE) nonReentrant {\n // update reward index for claim reward logic\n rewardIndex += plusReward;\n emit RewardDeposited(_msgSender(), plusReward);\n }\n\n /// @dev claim reward for token owner\n /// @notice only role with REWARD_CLAIMER_ROLE can call this function\n function claimReward() external onlyRole(REWARD_CLAIMER_ROLE) nonReentrant {\n require(rewardOwnerIndex[msg.sender] != 0, \"Caller doesn't have reward.\");\n\n uint deltaIndex = rewardIndex - rewardOwnerIndex[msg.sender];\n\n // calculate reward for token owner\n uint256 tokenOwnerReward = deltaIndex.mulDivDown(1, numberCoins);\n rewardOwnerIndex[msg.sender] = rewardIndex;\n\n // transfer reward to token owner\n vault.transfer(msg.sender, tokenOwnerReward);\n emit RewardClaimed(tokenOwnerReward, address(msg.sender));\n }\n\n /// @dev setup new owner for reward usually called when minting new token\n function setupNewOwner(address rewardOwner) external onlyRole(BALANCE_UPDATER_ROLE) {\n rewardOwnerIndex[rewardOwner] = rewardIndex;\n _setupRole(REWARD_CLAIMER_ROLE, rewardOwner);\n numberCoins++;\n }\n}" + }, + "src/tokens/SafeERC4626Lifecycle.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC4626Upgradeable} from \"./SafeERC4626Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\nimport {IVaultHook, ERC4626UpgradeableRequest} from \"./IVaultHook.sol\";\n\nabstract contract SafeERC4626Lifecycle is SafeERC4626Upgradeable {\n // list of hooks\n IVaultHook[] public withdrawHooks;\n IVaultHook[] public depositHooks;\n\n /// @dev Adds hook to the list of deposit hooks\n function addDepositHook(IVaultHook hook) internal {\n depositHooks.push(hook);\n }\n\n /// @dev Adds hook to the list of withdraw hooks\n function addWithdrawHook(IVaultHook hook) internal {\n withdrawHooks.push(hook);\n }\n\n /// @dev Removes hook from the list of deposit hooks\n function removeDepositHook(IVaultHook hook) internal {\n // find hook\n for (uint256 i = 0; i < depositHooks.length; i++)\n {\n if (depositHooks[i] == hook)\n {\n // remove hook\n depositHooks[i] = depositHooks[depositHooks.length - 1];\n depositHooks.pop();\n return;\n }\n }\n }\n\n /// @dev Removes hook from the list of withdraw hooks\n function removeWithdrawHook(IVaultHook hook) internal {\n // find hook\n for (uint256 i = 0; i < withdrawHooks.length; i++)\n {\n if (withdrawHooks[i] == hook)\n {\n // remove hook\n withdrawHooks[i] = withdrawHooks[withdrawHooks.length - 1];\n withdrawHooks.pop();\n return;\n }\n }\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function beforeWithdraw(uint256 assets, uint256 shares)\n internal virtual override(ERC4626Upgradeable)\n {\n // if there are no hooks, then return to save gas\n if(withdrawHooks.length == 0) {\n return;\n }\n uint256[46] memory gap_; // this is needed for future upgrades\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\n assets: assets,\n shares: shares,\n requestSender: msg.sender,\n senderMaxWithdraw: maxWithdraw(msg.sender),\n gap: gap_\n });\n // iterate over hooks and call it\n for (uint256 i = 0; i < withdrawHooks.length; i++)\n {\n IVaultHook hook = withdrawHooks[i];\n hook.beforeWithdrawTrigger(request);\n }\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function afterDeposit(uint256 assets, uint256 shares)\n internal virtual override(ERC4626Upgradeable)\n {\n // if there are no depositHooks, then return to save gas\n if(depositHooks.length == 0) {\n return;\n }\n uint256[46] memory gap_; // this is needed for future upgrades\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\n assets: assets,\n shares: shares,\n requestSender: msg.sender,\n senderMaxWithdraw: maxWithdraw(msg.sender),\n gap: gap_\n });\n // iterate over depositHooks and call it\n for (uint256 i = 0; i < depositHooks.length; i++)\n {\n IVaultHook hook = depositHooks[i];\n hook.afterDepositTrigger(request);\n }\n }\n}" + }, + "src/tokens/SafeERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\n\n/// @title Safier and limited implementation of ERC-4626\n/// @notice ERC-4626 standard allow deposit and withdraw not for message sender.\n/// It commonly known issue, which hardly to test and much error prune.\n/// Such interfaces caused vulnarabilities, which resulted in million dollars hacks.\n/// On anther hand, this interfaces not have any use cases which cannot be implemented without `transferFrom` method.\n/// This implementation prevent spends and allowances from any methods except transferFrom/send\n/// Also main business logic simplified to reduce gas consumption.\nabstract contract SafeERC4626Upgradeable is ERC4626Upgradeable {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using FixedPointMathLib for uint256;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * Constructor for the SafeERC4626Upgradeable contract\n * @param _asset which will be stored in this Vault\n * @dev `defaultOperators` may be an empty array.\n */\n function __SafeERC4626_init(\n IERC20Upgradeable _asset,\n string memory name_,\n string memory symbol_,\n address[] memory defaultOperators_\n ) internal onlyInitializing {\n __ERC4626_init(_asset, name_, symbol_, defaultOperators_);\n }\n\n /**\n * Unchained constructor for the SafeERC4626Upgradeable contract, without parents contracts init\n * @param _asset which will be stored in this Vault\n */\n function __SafeERC4626Upgradeable_init_unchained(IERC20Upgradeable _asset)\n internal\n onlyInitializing\n {\n __ERC4626_init_unchained(_asset);\n }\n\n /// @notice Mints the Vault shares for msg.sender, according to the number of deposited base tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function deposit(uint256 assets)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n shares = previewDeposit(assets);\n // Check for rounding error since we round down in previewDeposit.\n require(shares != 0, \"Given assets result in 0 shares.\");\n\n _receiveAndDeposit(assets, shares, msg.sender);\n }\n\n /// @notice Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function mint(uint256 shares)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n // No need to check for rounding error, previewMint rounds up.\n assets = previewMint(shares);\n\n _receiveAndDeposit(assets, shares, msg.sender);\n }\n\n /// @notice Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender.\n /// - emit the Withdraw event.\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the withdraw execution, and are accounted for during withdraw.\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function withdraw(uint256 assets)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n // No need to check for rounding error, previewWithdraw rounds up.\n shares = previewWithdraw(assets);\n\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\n }\n\n /// @notice Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender.\n /// - emit the Withdraw event.\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the redeem execution, and are accounted for during redeem.\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function redeem(uint256 shares)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n assets = previewRedeem(shares);\n // Check for rounding error since we round down in previewRedeem.\n require(assets != 0, \"Given shares result in 0 assets.\");\n\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\n }\n\n /* //////////////////// Backwards compatible methods ////////////////////////// */\n\n /// @inheritdoc ERC4626Upgradeable\n function deposit(\n uint256 assets,\n address /* receiver */\n ) public virtual override returns (uint256 shares) {\n // nonReentrant under the hood\n return deposit(assets);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function mint(\n uint256 shares,\n address /* receiver */\n ) public virtual override returns (uint256 assets) {\n // nonReentrant under the hood\n return mint(shares);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function withdraw(\n uint256 assets,\n address, /* receiver */\n address /* owner */\n ) public virtual override returns (uint256 shares) {\n // nonReentrant under the hood\n return withdraw(assets);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function redeem(\n uint256 shares,\n address, /* receiver */\n address /* owner */\n ) public virtual override returns (uint256 assets) {\n // nonReentrant under the hood\n return redeem(shares);\n }\n}\n" + }, + "src/tokens/VaultFounderToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC5484Upgradeable} from \"./ERC5484Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\nimport {IVaultFounderToken} from \"./IVaultFounderToken.sol\";\nimport {IVaultHook, ERC4626UpgradeableRequest} from \"./IVaultHook.sol\";\n\ncontract VaultFounderToken is IVaultFounderToken, ERC5484Upgradeable, IVaultHook {\n\n // Max number of tokens that can be minted\n uint256 private _maxCountTokens;\n\n // Next token price multiplier in percents\n uint256 private _nextTokenPriceMultiplier;\n\n // Initial token price\n uint256 private _initialTokenPrice;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[46] private __gap;\n\n function __VaultFounderToken_init(\n uint256 maxCountTokens_,\n uint256 nextTokenPriceMultiplier_,\n uint256 initialTokenPrice_,\n address admin_\n ) internal onlyInitializing {\n __ERC5484Upgradeable_init(\"Eonian Vault Founder Token\", \"EVFT\", BurnAuth.Neither, true, admin_);\n _maxCountTokens = maxCountTokens_;\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\n _initialTokenPrice = initialTokenPrice_;\n }\n\n function _safeMint(address to, uint256 tokenId) internal override {\n require(totalSupply() < _maxCountTokens, \"EVFT: max number of tokens\");\n super._safeMint(to, tokenId);\n }\n\n function priceOf(uint256 tokenId) external view returns (uint256) {\n require(tokenId < totalSupply(), \"EVFT: Token does not exist\");\n return _priceOf(tokenId);\n }\n\n function _priceOf(uint256 tokenId) internal view returns (uint256) {\n uint256 price = _initialTokenPrice;\n for (uint256 i = 0; i < tokenId; i++) {\n price = (price * _nextTokenPriceMultiplier) / 100;\n }\n return price;\n }\n\n function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\n }\n\n function nextTokenPrice() external view returns (uint256){\n return _nextTokenPrice();\n }\n\n function _nextTokenPrice() internal view returns (uint256){\n return _priceOf(totalSupply());\n }\n\n function setTokenURI(string memory _tokenURI) external override {\n address tokenOwner = msg.sender;\n uint256 tokenId = tokenOfOwnerByIndex(tokenOwner, 0);\n _setTokenURI(tokenId, _tokenURI);\n }\n\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request)\n external override\n {\n if(request.senderMaxWithdraw >= _nextTokenPrice()) {\n safeMint(request.requestSender, \"\");\n }\n }\n\n /* solhint-disable no-empty-blocks */\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external override\n {\n //empty code\n }\n /* solhint-disable no-empty-blocks */\n}" + }, + "src/upgradeable/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n// Import to compile and make ERC1967Proxy available for deploy\nimport {ERC1967Proxy} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";" + }, + "src/upgradeable/IVersionable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/** \n * Allow properly identify different versions of the same contract \n * and track upgrades results \n * */\ninterface IVersionable {\n /// @notice Returns the current version of this contract\n /// @return a version in semantic versioning format\n function version() external pure returns (string memory);\n}\n" + }, + "src/upgradeable/SafeInitializable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IVersionable} from \"./IVersionable.sol\";\n\n/** Implement best practices for initializable contracts */\nabstract contract SafeInitializable is IVersionable, Initializable {\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /**\n * This constructor prevents UUPS Uninitialized Proxies Vulnerability in all contracts which inherit from it.\n * More info about vulnerability: https://medium.com/immunefi/wormhole-uninitialized-proxy-bugfix-review-90250c41a43a\n * \n * @dev Initial fix for this vulnerability was suggested as using `_disableInitializers()` function in constructor,\n * but later, in version 4.3.2, OpenZeppelin implemented `onlyProxy` modifier for UUPS upgradable contracts,\n * which fixed this vulnerability. Still, `_disableInitializers()` is a best practice which prevents unintended access \n * to implementation contracts that can be used maliciously.\n * \n * More info: https://forum.openzeppelin.com/t/how-to-test-upgradeability-for-proxies/33436/7 \n * and https://forum.openzeppelin.com/t/uupsupgradeable-vulnerability-post-mortem/15680\n * \n * To prevent code duplication of constructor, this contract can be used. On the other hand, \n * it can be used as a marker for contracts that are safe from this vulnerability.\n * Additionally, `needDisableInitializers` parameter can be used to enable initializers in mocks and unit tests.\n *\n * @param needDisableInitializers - if true, initializers will be disabled\n */\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) {\n if(needDisableInitializers) {\n _disableInitializers();\n }\n }\n}" + }, + "src/upgradeable/SafeUUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {SafeInitializable} from \"./SafeInitializable.sol\";\n\n/** \n * Implement basic safety mechanism for UUPS proxy\n * based on owner authorization for upgrades\n * */\nabstract contract SafeUUPSUpgradeable is UUPSUpgradeable, SafeInitializable, OwnableUpgradeable {\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /** Init all required constructors, including ownable */\n function __SafeUUPSUpgradeable_init() internal onlyInitializing {\n __SafeUUPSUpgradeable_init_direct();\n\n __Ownable_init();\n }\n\n /** Init only direct constructors, UUPS only */\n function __SafeUUPSUpgradeable_init_direct() internal onlyInitializing {\n __UUPSUpgradeable_init();\n }\n\n /** Authorise that upgrades can do only owner */\n function _authorizeUpgrade(address newImplementation) internal onlyOwner override {} // solhint-disable-line no-empty-blocks\n}\n" + }, + "src/Vault.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {SafeERC20Upgradeable, IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\nimport {IVault} from \"./IVault.sol\";\nimport {Lender, BorrowerDoesNotExist} from \"./lending/Lender.sol\";\nimport {SafeERC4626Upgradeable} from \"./tokens/SafeERC4626Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./tokens/ERC4626Upgradeable.sol\";\nimport {IStrategy} from \"./strategies/IStrategy.sol\";\nimport {AddressList} from \"./structures/AddressList.sol\";\nimport {SafeInitializable} from \"./upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"./upgradeable/SafeUUPSUpgradeable.sol\";\nimport {IVersionable} from \"./upgradeable/IVersionable.sol\";\nimport {SafeERC4626Lifecycle} from \"./tokens/SafeERC4626Lifecycle.sol\";\nimport {IVaultHook} from \"./tokens/IVaultHook.sol\";\nimport {VaultFounderToken} from \"./tokens/VaultFounderToken.sol\";\n\n\nerror ExceededMaximumFeeValue();\nerror UnexpectedZeroAddress();\nerror InappropriateStrategy();\nerror StrategyNotFound();\nerror StrategyAlreadyExists();\nerror InsufficientVaultBalance(uint256 assets, uint256 shares);\nerror WrongQueueSize(uint256 size);\nerror InvalidLockedProfitReleaseRate(uint256 durationInSeconds);\nerror AccessDeniedForCaller(address caller);\n\ncontract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Lender, SafeERC4626Lifecycle {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using AddressList for address[];\n\n /// @notice Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\n uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;\n\n /// @notice Rewards contract where management fees are sent to.\n address public rewards;\n\n /// @notice Vault management fee (in BPS).\n uint256 public managementFee;\n\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\n address[] public withdrawalQueue;\n\n /// @notice The amount of funds that cannot be withdrawn by users.\n /// Decreases with time at the rate of \"lockedProfitReleaseRate\".\n uint256 public lockedProfitBaseline;\n\n /// @notice The rate of \"lockedProfitBaseline\" decline on the locked-in profit scale (scaled to 1e18).\n /// Represents the amount of funds that will be unlocked when one second passes.\n uint256 public lockedProfitReleaseRate;\n\n /// @notice Event that should happen when the strategy connects to the vault.\n /// @param strategy Address of the strategy contract.\n /// @param debtRatio Maximum portion of the loan that the strategy can take (in BPS).\n event StrategyAdded(address indexed strategy, uint256 debtRatio);\n\n /// @notice Event that should happen when the strategy has been revoked from the vault.\n /// @param strategy Address of the strategy contract.\n event StrategyRevoked(address indexed strategy);\n\n /// @notice Event that should happen when the strategy has been removed from the vault.\n /// @param strategy Address of the strategy contract.\n /// @param fromQueueOnly If \"true\", then the strategy has only been removed from the withdrawal queue.\n event StrategyRemoved(address indexed strategy, bool fromQueueOnly);\n\n /// @notice Event that should happen when the strategy has been returned to the withdrawal queue.\n /// @param strategy Address of the strategy contract.\n event StrategyReturnedToQueue(address indexed strategy);\n\n /// @notice Event that should happen when the locked-in profit release rate changed.\n event LockedProfitReleaseRateChanged(uint256 rate);\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[50] private __gap;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.9\";\n }\n\n modifier onlyOwnerOrStrategy(address strategy) {\n if (msg.sender != owner() && msg.sender != strategy) {\n revert AccessDeniedForCaller(msg.sender);\n }\n _;\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _asset,\n address _rewards,\n uint256 _managementFee,\n uint256 _lockedProfitReleaseRate,\n string memory _name,\n string memory _symbol,\n address[] memory _defaultOperators,\n address _founders\n ) public initializer {\n __SafeUUPSUpgradeable_init(); // Ownable under the hood\n __Lender_init();\n __SafeERC4626_init(\n IERC20Upgradeable(_asset),\n bytes(_name).length == 0\n ? string.concat(\n IERC20Metadata(_asset).symbol(),\n \" Eonian Vault Shares\"\n )\n : _name,\n bytes(_symbol).length == 0\n ? string.concat(\"eon\", IERC20Metadata(_asset).symbol())\n : _symbol,\n _defaultOperators\n );\n\n setRewards(_rewards);\n setManagementFee(_managementFee);\n setLockedProfitReleaseRate(_lockedProfitReleaseRate);\n addDepositHook(IVaultHook(_founders));\n }\n\n /// @dev Override to add the \"whenNotPaused\" modifier\n /// @inheritdoc SafeERC4626Upgradeable\n function deposit(uint256 assets)\n public\n override\n whenNotPaused\n returns (uint256 shares)\n {\n return super.deposit(assets);\n }\n\n /// @notice Hook that is used before withdrawals to release assets from strategies if necessary.\n /// @inheritdoc ERC4626Upgradeable\n function beforeWithdraw(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\n // There is no need to withdraw assets from strategies, the vault has sufficient funds\n if (_freeAssets() >= assets) {\n return;\n }\n\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\n // If the vault already has the required amount of funds, we need to finish the withdrawal\n uint256 vaultBalance = _freeAssets();\n if (assets <= vaultBalance) {\n break;\n }\n\n address strategy = withdrawalQueue[i];\n\n // We can only withdraw the amount that the strategy has as debt,\n // so that the strategy can work on the unreported (yet) funds it has earned\n uint256 requiredAmount = MathUpgradeable.min(\n assets - vaultBalance,\n borrowersData[strategy].debt\n );\n\n // Skip this strategy is there is nothing to withdraw\n if (requiredAmount == 0) {\n continue;\n }\n\n // Withdraw the required amount of funds from the strategy\n uint256 loss = IStrategy(strategy).withdraw(requiredAmount);\n\n // If the strategy failed to return all of the requested funds, we need to reduce the strategy's debt ratio\n if (loss > 0) {\n _decreaseBorrowerCredibility(strategy, loss);\n }\n }\n\n // Revert if insufficient assets remain in the vault after withdrawal from all strategies\n if (_freeAssets() < assets) {\n revert InsufficientVaultBalance(assets, shares);\n }\n\n // apply the hook\n SafeERC4626Lifecycle.beforeWithdraw(assets, shares);\n }\n\n /// @notice Adds a new strategy to the vault.\n /// @param strategy a new strategy address.\n /// @param debtRatio a ratio that shows how much of the new strategy can take, relative to other strategies.\n function addStrategy(address strategy, uint256 debtRatio)\n external\n onlyOwner\n whenNotPaused\n {\n if (strategy == address(0)) {\n revert UnexpectedZeroAddress();\n }\n\n // Strategy should refer to this vault and has the same underlying asset\n if (\n this != IStrategy(strategy).vault() ||\n asset != IStrategy(strategy).asset()\n ) {\n revert InappropriateStrategy();\n }\n\n _registerBorrower(strategy, debtRatio);\n withdrawalQueue.add(strategy);\n\n emit StrategyAdded(strategy, debtRatio);\n }\n\n /// @notice Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\n /// @param strategy a strategy address.\n function addStrategyToQueue(address strategy) external onlyOwner {\n if (strategy == address(0)) {\n revert UnexpectedZeroAddress();\n }\n\n if (withdrawalQueue.contains(strategy)) {\n revert StrategyAlreadyExists();\n }\n\n if (borrowersData[strategy].activationTimestamp == 0) {\n revert BorrowerDoesNotExist();\n }\n\n withdrawalQueue.add(strategy);\n\n emit StrategyReturnedToQueue(strategy);\n }\n\n /// @inheritdoc IVault\n function revokeStrategy(address strategy)\n external\n onlyOwnerOrStrategy(strategy)\n {\n _setBorrowerDebtRatio(strategy, 0);\n emit StrategyRevoked(strategy);\n }\n\n /// @notice Removes a strategy from the vault.\n /// @param strategy a strategy to remove.\n /// @param fromQueueOnly if \"true\", then the strategy will only be removed from the withdrawal queue.\n function removeStrategy(address strategy, bool fromQueueOnly)\n external\n onlyOwner\n {\n bool removedFromQueue = withdrawalQueue.remove(strategy);\n if (!removedFromQueue) {\n revert StrategyNotFound();\n }\n\n if (!fromQueueOnly) {\n _unregisterBorrower(strategy);\n }\n\n emit StrategyRemoved(strategy, fromQueueOnly);\n }\n\n /// @notice Sets the withdrawal queue.\n /// @param queue a new queue that will replace the existing one.\n /// Should contain only those elements that already present in the existing queue.\n function reorderWithdrawalQueue(address[] memory queue) external onlyOwner {\n withdrawalQueue = withdrawalQueue.reorder(queue);\n }\n\n /// @notice Sets the vault rewards address.\n /// @param _rewards a new rewards address.\n function setRewards(address _rewards) public onlyOwner {\n rewards = _rewards;\n }\n\n /// @notice Sets the vault management fee.\n /// @param _managementFee a new management fee value (in BPS).\n function setManagementFee(uint256 _managementFee) public onlyOwner {\n if (_managementFee > MAX_BPS) {\n revert ExceededMaximumFeeValue();\n }\n\n managementFee = _managementFee;\n }\n\n /// @notice Switches the vault pause state.\n /// @param shutdown a new vault pause state. If \"true\" is passed, the vault will be paused.\n function setEmergencyShutdown(bool shutdown) external onlyOwner {\n shutdown ? _pause() : _unpause();\n }\n\n /// @notice Changes the rate of release of locked-in profit.\n /// @param rate the rate of release of locked profit (percent per second scaled to 1e18).\n /// The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\n function setLockedProfitReleaseRate(uint256 rate) public onlyOwner {\n if (rate > LOCKED_PROFIT_RELEASE_SCALE) {\n revert InvalidLockedProfitReleaseRate(rate);\n }\n\n lockedProfitReleaseRate = rate;\n emit LockedProfitReleaseRateChanged(rate);\n }\n\n /// @notice Calculates the locked profit, takes into account the change since the last report.\n function _lockedProfit() internal view returns (uint256) {\n // Release rate should be small, since the timestamp can be manipulated by the node operator,\n // not expected to have much impact, since the changes will be applied to all users and cannot be abused directly.\n uint256 ratio = (block.timestamp - lastReportTimestamp) * lockedProfitReleaseRate; // solhint-disable-line not-rely-on-time\n\n // In case the ratio >= scale, the calculation anyway leads to zero.\n if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) {\n return 0;\n }\n\n uint256 lockedProfitChange = (ratio * lockedProfitBaseline) / LOCKED_PROFIT_RELEASE_SCALE;\n\n // Reducing locked profits over time frees up profits for users\n return lockedProfitBaseline - lockedProfitChange;\n }\n\n /// @inheritdoc Lender\n function _chargeFees(uint256 extraFreeFunds)\n internal\n override\n returns (uint256)\n {\n uint256 fee = (extraFreeFunds * managementFee) / MAX_BPS;\n if (fee > 0) {\n _mint(rewards, convertToShares(fee), \"\", \"\", false);\n }\n\n return fee;\n }\n\n /// @notice Updates the locked-in profit value according to the positive debt management report of the strategy\n /// @inheritdoc Lender\n function _afterPositiveDebtManagementReport(\n uint256 extraFreeFunds,\n uint256 chargedFees\n ) internal override {\n // Locking every reported strategy profit, taking into account the charged fees.\n lockedProfitBaseline = _lockedProfit() + extraFreeFunds - chargedFees;\n }\n\n /// @notice Updates the locked-in profit value according to the negative debt management report of the strategy\n /// @inheritdoc Lender\n function _afterNegativeDebtManagementReport(uint256 loss)\n internal\n override\n {\n uint256 currentLockedProfit = _lockedProfit();\n\n // If a loss occurs, it is necessary to release the appropriate amount of funds that users were able to withdraw it.\n lockedProfitBaseline = currentLockedProfit > loss\n ? currentLockedProfit - loss\n : 0;\n }\n\n /// @notice Returns the current debt of the strategy.\n /// @param strategy the strategy address.\n function strategyDebt(address strategy) external view returns (uint256) {\n return borrowersData[strategy].debt;\n }\n\n /// @notice Returns the debt ratio of the strategy.\n /// @param strategy the strategy address.\n function strategyRatio(address strategy) external view returns (uint256) {\n return borrowersData[strategy].debtRatio;\n }\n\n /// @notice Returns the size of the withdrawal queue.\n function getQueueSize() external view returns (uint256) {\n return withdrawalQueue.length;\n }\n\n /// @inheritdoc Lender\n function _freeAssets() internal view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @inheritdoc Lender\n function _borrowerFreeAssets(address borrower)\n internal\n view\n override\n returns (uint256)\n {\n return asset.balanceOf(borrower);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function totalAssets() public view override returns (uint256) {\n return super.lendingAssets() - _lockedProfit();\n }\n\n /// @inheritdoc IVault\n /// @dev Explicitly overridden here to keep this function exposed via \"IVault\" interface.\n function paused()\n public\n view\n override(IVault, PausableUpgradeable)\n returns (bool)\n {\n return super.paused();\n }\n\n /// @inheritdoc Lender\n function _transferFundsToBorrower(address borrower, uint256 amount)\n internal\n override\n {\n asset.safeTransfer(borrower, amount);\n }\n\n /// @inheritdoc Lender\n function _takeFundsFromBorrower(address borrower, uint256 amount)\n internal\n override\n {\n asset.safeTransferFrom(borrower, address(this), amount);\n }\n\n function afterDeposit(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\n SafeERC4626Lifecycle.afterDeposit(assets, shares);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "storageLayout", + "devdoc", + "userdoc", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "contracts/=src/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "solmate/=lib/solmate/src/" + ] + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/sepolia/solcInputs/c49e2950159d0667a0032186292b7773.json b/packages/contracts/deployments/sepolia/solcInputs/c49e2950159d0667a0032186292b7773.json new file mode 100644 index 00000000..dcb8871c --- /dev/null +++ b/packages/contracts/deployments/sepolia/solcInputs/c49e2950159d0667a0032186292b7773.json @@ -0,0 +1,319 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => 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 a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).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 override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\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 override 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 override 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 override 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 `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\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 Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\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 signaling this.\n *\n * _Available since v3.1._\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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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 `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967Upgradeable {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC4906Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4906.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"./IERC721Upgradeable.sol\";\n\n/// @title EIP-721 Metadata Update Extension\ninterface IERC4906Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\n /// @dev This event emits when the metadata of a token is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFT.\n event MetadataUpdate(uint256 _tokenId);\n\n /// @dev This event emits when the metadata of a range of tokens is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFTs.\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/IERC721Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/IERC1967Upgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeTo(address newImplementation) public virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {\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 bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\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 require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\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 function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/extensions/ERC721URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../interfaces/IERC4906Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC721 token with storage based token URI management.\n */\nabstract contract ERC721URIStorageUpgradeable is Initializable, IERC4906Upgradeable, ERC721Upgradeable {\n function __ERC721URIStorage_init() internal onlyInitializing {\n }\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\n }\n using StringsUpgradeable for uint256;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC165-supportsInterface}\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n string memory base = _baseURI();\n\n // If there is no base URI, return the token URI.\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n /**\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\n *\n * Emits {MetadataUpdate}.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\n require(_exists(tokenId), \"ERC721URIStorage: URI set of nonexistent token\");\n _tokenURIs[tokenId] = _tokenURI;\n\n emit MetadataUpdate(tokenId);\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\n * token-specific URI was set for the token, and if so, it deletes the token URI from\n * the storage mapping.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/ERC777.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC777Upgradeable.sol\";\nimport \"./IERC777RecipientUpgradeable.sol\";\nimport \"./IERC777SenderUpgradeable.sol\";\nimport \"../ERC20/IERC20Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/IERC1820RegistryUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC777} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * Support for ERC20 is included in this contract, as specified by the EIP: both\n * the ERC777 and ERC20 interfaces can be safely used when interacting with it.\n * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token\n * movements.\n *\n * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there\n * are no special restrictions in the amount of tokens that created, moved, or\n * destroyed. This makes integration with ERC20 applications seamless.\n *\n * CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.\n */\ncontract ERC777Upgradeable is Initializable, ContextUpgradeable, IERC777Upgradeable, IERC20Upgradeable {\n using AddressUpgradeable for address;\n\n IERC1820RegistryUpgradeable internal constant _ERC1820_REGISTRY = IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n\n mapping(address => uint256) private _balances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256(\"ERC777TokensSender\");\n bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\"ERC777TokensRecipient\");\n\n // This isn't ever read from - it's only used to respond to the defaultOperators query.\n address[] private _defaultOperatorsArray;\n\n // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).\n mapping(address => bool) private _defaultOperators;\n\n // For each account, a mapping of its operators and revoked default operators.\n mapping(address => mapping(address => bool)) private _operators;\n mapping(address => mapping(address => bool)) private _revokedDefaultOperators;\n\n // ERC20-allowances\n mapping(address => mapping(address => uint256)) private _allowances;\n\n /**\n * @dev `defaultOperators` may be an empty array.\n */\n function __ERC777_init(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\n __ERC777_init_unchained(name_, symbol_, defaultOperators_);\n }\n\n function __ERC777_init_unchained(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n\n _defaultOperatorsArray = defaultOperators_;\n for (uint256 i = 0; i < defaultOperators_.length; i++) {\n _defaultOperators[defaultOperators_[i]] = true;\n }\n\n // register interfaces\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC777Token\"), address(this));\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC20Token\"), address(this));\n }\n\n /**\n * @dev See {IERC777-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC777-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n *\n * Always returns 18, as per the\n * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\n */\n function decimals() public pure virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC777-granularity}.\n *\n * This implementation always returns `1`.\n */\n function granularity() public view virtual override returns (uint256) {\n return 1;\n }\n\n /**\n * @dev See {IERC777-totalSupply}.\n */\n function totalSupply() public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev Returns the amount of tokens owned by an account (`tokenHolder`).\n */\n function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\n return _balances[tokenHolder];\n }\n\n /**\n * @dev See {IERC777-send}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function send(address recipient, uint256 amount, bytes memory data) public virtual override {\n _send(_msgSender(), recipient, amount, data, \"\", true);\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}\n * interface if it is a contract.\n *\n * Also emits a {Sent} event.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _send(_msgSender(), recipient, amount, \"\", \"\", false);\n return true;\n }\n\n /**\n * @dev See {IERC777-burn}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function burn(uint256 amount, bytes memory data) public virtual override {\n _burn(_msgSender(), amount, data, \"\");\n }\n\n /**\n * @dev See {IERC777-isOperatorFor}.\n */\n function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) {\n return\n operator == tokenHolder ||\n (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||\n _operators[tokenHolder][operator];\n }\n\n /**\n * @dev See {IERC777-authorizeOperator}.\n */\n function authorizeOperator(address operator) public virtual override {\n require(_msgSender() != operator, \"ERC777: authorizing self as operator\");\n\n if (_defaultOperators[operator]) {\n delete _revokedDefaultOperators[_msgSender()][operator];\n } else {\n _operators[_msgSender()][operator] = true;\n }\n\n emit AuthorizedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-revokeOperator}.\n */\n function revokeOperator(address operator) public virtual override {\n require(operator != _msgSender(), \"ERC777: revoking self as operator\");\n\n if (_defaultOperators[operator]) {\n _revokedDefaultOperators[_msgSender()][operator] = true;\n } else {\n delete _operators[_msgSender()][operator];\n }\n\n emit RevokedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-defaultOperators}.\n */\n function defaultOperators() public view virtual override returns (address[] memory) {\n return _defaultOperatorsArray;\n }\n\n /**\n * @dev See {IERC777-operatorSend}.\n *\n * Emits {Sent} and {IERC20-Transfer} events.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public virtual override {\n require(isOperatorFor(_msgSender(), sender), \"ERC777: caller is not an operator for holder\");\n _send(sender, recipient, amount, data, operatorData, true);\n }\n\n /**\n * @dev See {IERC777-operatorBurn}.\n *\n * Emits {Burned} and {IERC20-Transfer} events.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public virtual override {\n require(isOperatorFor(_msgSender(), account), \"ERC777: caller is not an operator for holder\");\n _burn(account, amount, data, operatorData);\n }\n\n /**\n * @dev See {IERC20-allowance}.\n *\n * Note that operator and allowance concepts are orthogonal: operators may\n * not have allowance, and accounts with allowance may not be operators\n * themselves.\n */\n function allowance(address holder, address spender) public view virtual override returns (uint256) {\n return _allowances[holder][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function approve(address spender, uint256 value) public virtual override returns (bool) {\n address holder = _msgSender();\n _approve(holder, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Note that operator and allowance concepts are orthogonal: operators cannot\n * call `transferFrom` (unless they have allowance), and accounts with\n * allowance cannot call `operatorSend` (unless they are operators).\n *\n * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\n */\n function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(holder, spender, amount);\n _send(holder, recipient, amount, \"\", \"\", false);\n return true;\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with the caller address as the `operator` and with\n * `userData` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual {\n _mint(account, amount, userData, operatorData, true);\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If `requireReceptionAck` is set to true, and if a send hook is\n * registered for `account`, the corresponding function will be called with\n * `operator`, `data` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(\n address account,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) internal virtual {\n require(account != address(0), \"ERC777: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), account, amount);\n\n // Update state variables\n _totalSupply += amount;\n _balances[account] += amount;\n\n _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck);\n\n emit Minted(operator, account, amount, userData, operatorData);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Send tokens\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _send(\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) internal virtual {\n require(from != address(0), \"ERC777: transfer from the zero address\");\n require(to != address(0), \"ERC777: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, to, amount, userData, operatorData);\n\n _move(operator, from, to, amount, userData, operatorData);\n\n _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);\n }\n\n /**\n * @dev Burn tokens\n * @param from address token holder address\n * @param amount uint256 amount of tokens to burn\n * @param data bytes extra information provided by the token holder\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _burn(address from, uint256 amount, bytes memory data, bytes memory operatorData) internal virtual {\n require(from != address(0), \"ERC777: burn from the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, address(0), amount, data, operatorData);\n\n _beforeTokenTransfer(operator, from, address(0), amount);\n\n // Update state variables\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC777: burn amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Burned(operator, from, amount, data, operatorData);\n emit Transfer(from, address(0), amount);\n }\n\n function _move(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n ) private {\n _beforeTokenTransfer(operator, from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC777: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Sent(operator, from, to, amount, userData, operatorData);\n emit Transfer(from, to, amount);\n }\n\n /**\n * @dev See {ERC20-_approve}.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function _approve(address holder, address spender, uint256 value) internal virtual {\n require(holder != address(0), \"ERC777: approve from the zero address\");\n require(spender != address(0), \"ERC777: approve to the zero address\");\n\n _allowances[holder][spender] = value;\n emit Approval(holder, spender, value);\n }\n\n /**\n * @dev Call from.tokensToSend() if the interface is registered\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _callTokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n ) private {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777SenderUpgradeable(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);\n }\n }\n\n /**\n * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but\n * tokensReceived() was not registered for the recipient\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _callTokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) private {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777RecipientUpgradeable(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);\n } else if (requireReceptionAck) {\n require(!to.isContract(), \"ERC777: token recipient contract has no implementer for ERC777TokensRecipient\");\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {IERC20-Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC777: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes\n * calls to {send}, {transfer}, {operatorSend}, {transferFrom}, minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address operator, address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[41] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\n *\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\n * contract implement this interface (contract holders can be their own\n * implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777RecipientUpgradeable {\n /**\n * @dev Called by an {IERC777} token contract whenever tokens are being\n * moved or created into a registered account (`to`). The type of operation\n * is conveyed by `from` being the zero address or not.\n *\n * This call occurs _after_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensSender standard as defined in the EIP.\n *\n * {IERC777} Token holders can be notified of operations performed on their\n * tokens by having a contract implement this interface (contract holders can be\n * their own implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777SenderUpgradeable {\n /**\n * @dev Called by an {IERC777} token contract whenever a registered holder's\n * (`from`) tokens are about to be moved or destroyed. The type of operation\n * is conveyed by `to` being the zero address or not.\n *\n * This call occurs _before_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777Upgradeable {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC1820RegistryUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/IERC1820Registry.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the global ERC1820 Registry, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register\n * implementers for interfaces in this registry, as well as query support.\n *\n * Implementers may be shared by multiple accounts, and can also implement more\n * than a single interface for each account. Contracts can implement interfaces\n * for themselves, but externally-owned accounts (EOA) must delegate this to a\n * contract.\n *\n * {IERC165} interfaces can also be queried via the registry.\n *\n * For an in-depth explanation and source code analysis, see the EIP text.\n */\ninterface IERC1820RegistryUpgradeable {\n event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);\n\n event ManagerChanged(address indexed account, address indexed newManager);\n\n /**\n * @dev Sets `newManager` as the manager for `account`. A manager of an\n * account is able to set interface implementers for it.\n *\n * By default, each account is its own manager. Passing a value of `0x0` in\n * `newManager` will reset the manager to this initial state.\n *\n * Emits a {ManagerChanged} event.\n *\n * Requirements:\n *\n * - the caller must be the current manager for `account`.\n */\n function setManager(address account, address newManager) external;\n\n /**\n * @dev Returns the manager for `account`.\n *\n * See {setManager}.\n */\n function getManager(address account) external view returns (address);\n\n /**\n * @dev Sets the `implementer` contract as ``account``'s implementer for\n * `interfaceHash`.\n *\n * `account` being the zero address is an alias for the caller's address.\n * The zero address can also be used in `implementer` to remove an old one.\n *\n * See {interfaceHash} to learn how these are created.\n *\n * Emits an {InterfaceImplementerSet} event.\n *\n * Requirements:\n *\n * - the caller must be the current manager for `account`.\n * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not\n * end in 28 zeroes).\n * - `implementer` must implement {IERC1820Implementer} and return true when\n * queried for support, unless `implementer` is the caller. See\n * {IERC1820Implementer-canImplementInterfaceForAddress}.\n */\n function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;\n\n /**\n * @dev Returns the implementer of `interfaceHash` for `account`. If no such\n * implementer is registered, returns the zero address.\n *\n * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28\n * zeroes), `account` will be queried for support of it.\n *\n * `account` being the zero address is an alias for the caller's address.\n */\n function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);\n\n /**\n * @dev Returns the interface hash for an `interfaceName`, as defined in the\n * corresponding\n * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].\n */\n function interfaceHash(string calldata interfaceName) external pure returns (bytes32);\n\n /**\n * @notice Updates the cache with whether the contract implements an ERC165 interface or not.\n * @param account Address of the contract for which to update the cache.\n * @param interfaceId ERC165 interface for which to update the cache.\n */\n function updateERC165Cache(address account, bytes4 interfaceId) external;\n\n /**\n * @notice Checks whether a contract implements an ERC165 interface or not.\n * If the result is not cached a direct lookup on the contract address is performed.\n * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\n * {updateERC165Cache} with the contract address.\n * @param account Address of the contract to check.\n * @param interfaceId ERC165 interface to check.\n * @return True if `account` implements `interfaceId`, false otherwise.\n */\n function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);\n\n /**\n * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.\n * @param account Address of the contract to check.\n * @param interfaceId ERC165 interface to check.\n * @return True if `account` implements `interfaceId`, false otherwise.\n */\n function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 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 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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 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 prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / 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 prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\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 works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\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^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice 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 uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\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 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMathUpgradeable {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1967.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/IERC1967.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "lib/solmate/src/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n function powWad(int256 x, int256 y) internal pure returns (int256) {\n // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)\n return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.\n }\n\n function expWad(int256 x) internal pure returns (int256 r) {\n unchecked {\n // When the result is < 0.5 we return zero. This happens when\n // x <= floor(log(0.5e18) * 1e18) ~ -42e18\n if (x <= -42139678854452767551) return 0;\n\n // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\n // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\n if (x >= 135305999368893231589) revert(\"EXP_OVERFLOW\");\n\n // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\n // for more intermediate precision and a binary basis. This base conversion\n // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\n x = (x << 78) / 5**18;\n\n // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers\n // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\n // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\n int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\n x = x - k * 54916777467707473351141471128;\n\n // k is in the range [-61, 195].\n\n // Evaluate using a (6, 7)-term rational approximation.\n // p is made monic, we'll multiply by a scale factor later.\n int256 y = x + 1346386616545796478920950773328;\n y = ((y * x) >> 96) + 57155421227552351082224309758442;\n int256 p = y + x - 94201549194550492254356042504812;\n p = ((p * y) >> 96) + 28719021644029726153956944680412240;\n p = p * x + (4385272521454847904659076985693276 << 96);\n\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n int256 q = x - 2855989394907223263936484059900;\n q = ((q * x) >> 96) + 50020603652535783019961831881945;\n q = ((q * x) >> 96) - 533845033583426703283633433725380;\n q = ((q * x) >> 96) + 3604857256930695427073651918091429;\n q = ((q * x) >> 96) - 14423608567350463180887372962807573;\n q = ((q * x) >> 96) + 26449188498355588339934803723976023;\n\n assembly {\n // Div in assembly because solidity adds a zero check despite the unchecked.\n // The q polynomial won't have zeros in the domain as all its roots are complex.\n // No scaling is necessary because p is already 2**96 too large.\n r := sdiv(p, q)\n }\n\n // r should be in the range (0.09, 0.25) * 2**96.\n\n // We now need to multiply r by:\n // * the scale factor s = ~6.031367120.\n // * the 2**k factor from the range reduction.\n // * the 1e18 / 2**96 factor for base conversion.\n // We do this all at once, with an intermediate result in 2**213\n // basis, so the final right shift is always by a positive amount.\n r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\n }\n }\n\n function lnWad(int256 x) internal pure returns (int256 r) {\n unchecked {\n require(x > 0, \"UNDEFINED\");\n\n // We want to convert x from 10**18 fixed point to 2**96 fixed point.\n // We do this by multiplying by 2**96 / 10**18. But since\n // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\n // and add ln(2**96 / 10**18) at the end.\n\n // Reduce range of x to (1, 2) * 2**96\n // ln(2^k * x) = k * ln(2) + ln(x)\n int256 k = int256(log2(uint256(x))) - 96;\n x <<= uint256(159 - k);\n x = int256(uint256(x) >> 159);\n\n // Evaluate using a (8, 8)-term rational approximation.\n // p is made monic, we will multiply by a scale factor later.\n int256 p = x + 3273285459638523848632254066296;\n p = ((p * x) >> 96) + 24828157081833163892658089445524;\n p = ((p * x) >> 96) + 43456485725739037958740375743393;\n p = ((p * x) >> 96) - 11111509109440967052023855526967;\n p = ((p * x) >> 96) - 45023709667254063763336534515857;\n p = ((p * x) >> 96) - 14706773417378608786704636184526;\n p = p * x - (795164235651350426258249787498 << 96);\n\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n // q is monic by convention.\n int256 q = x + 5573035233440673466300451813936;\n q = ((q * x) >> 96) + 71694874799317883764090561454958;\n q = ((q * x) >> 96) + 283447036172924575727196451306956;\n q = ((q * x) >> 96) + 401686690394027663651624208769553;\n q = ((q * x) >> 96) + 204048457590392012362485061816622;\n q = ((q * x) >> 96) + 31853899698501571402653359427138;\n q = ((q * x) >> 96) + 909429971244387300277376558375;\n assembly {\n // Div in assembly because solidity adds a zero check despite the unchecked.\n // The q polynomial is known not to have zeros in the domain.\n // No scaling required because p is already 2**96 too large.\n r := sdiv(p, q)\n }\n\n // r is in the range (0, 0.125) * 2**96\n\n // Finalization, we need to:\n // * multiply by the scale factor s = 5.549…\n // * add ln(2**96 / 10**18)\n // * add k * ln(2)\n // * multiply by 10**18 / 2**96 = 5**18 >> 78\n\n // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\n r *= 1677202110996718588342820967067443963516166;\n // add ln(2) * k * 5e18 * 2**192\n r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\n // add ln(2**96 / 10**18) * 5e18 * 2**192\n r += 600920179829731861736702779321621459595472258049074101567377883020018308;\n // base conversion: mul 2**18 / 2**192\n r >>= 174;\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // Divide z by the denominator.\n z := div(z, denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // First, divide z - 1 by the denominator and add 1.\n // We allow z - 1 to underflow if z is 0, because we multiply the\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function log2(uint256 x) internal pure returns (uint256 r) {\n require(x > 0, \"UNDEFINED\");\n\n assembly {\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\n r := or(r, shl(3, lt(0xff, shr(r, x))))\n r := or(r, shl(2, lt(0xf, shr(r, x))))\n r := or(r, shl(1, lt(0x3, shr(r, x))))\n r := or(r, lt(0x1, shr(r, x)))\n }\n }\n}\n" + }, + "src/automation/example/SimpleGelatoJob.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {GelatoJobAdapter, IOps} from \"../GelatoJobAdapter.sol\";\n\nimport {SafeUUPSUpgradeable} from \"../../upgradeable/SafeUUPSUpgradeable.sol\";\nimport {SafeInitializable} from \"../../upgradeable/SafeInitializable.sol\";\nimport {IVersionable} from \"../../upgradeable/IVersionable.sol\";\n\ncontract SimpleGelatoJob is GelatoJobAdapter, SafeUUPSUpgradeable {\n uint256 public workMethodCalledCounter;\n bool public canWorkResult = false;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.1\";\n }\n\n // allow sending eth to the test contract\n receive() external payable {} // solhint-disable-line no-empty-blocks\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _ops,\n uint256 _minimumBetweenExecutions,\n bool _isPrepaid\n ) public initializer {\n __GelatoJobAdapter_init(IOps(_ops), _minimumBetweenExecutions, _isPrepaid);\n\n __SafeUUPSUpgradeable_init(); // ownable under the hood\n }\n\n function _work() internal override {\n workMethodCalledCounter++;\n }\n\n function _canWork() internal view override returns (bool) {\n return canWorkResult;\n }\n\n function setCanWorkResult(bool _canWorkResult) public onlyOwner {\n canWorkResult = _canWorkResult;\n }\n\n function setMinimumBetweenExecutions(uint256 _time) public onlyOwner {\n _setMinimumBetweenExecutions(_time);\n }\n\n function setIsPrepaid(bool _isPrepaid) public onlyOwner {\n isPrepaid = _isPrepaid;\n }\n\n function allowWorkNow() public onlyOwner {\n lastWorkTime = 0;\n }\n\n function refreshLastWorkTime() public onlyOwner {\n _refreshLastWorkTime();\n }\n}\n" + }, + "src/automation/gelato/BackCombatibleTransfer.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @notice Library that adding support for ERC20 and native tokens transfers.\n/// @dev Based of https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/vendor/gelato/FGelato.sol\nlibrary BackCombatibleTransfer {\n address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Backcombatible transfer to given address, will use ERC20 transfer if given token is ERC20.\n function backCombatibleTransfer(\n address payable to,\n address paymentToken,\n uint256 amount\n ) internal {\n if (paymentToken == ETH) {\n safeNativeTransfer(to, amount);\n return;\n }\n\n SafeERC20.safeTransfer(IERC20(paymentToken), to, amount);\n }\n\n /// @notice Native token transfer that checks `call` result.\n function safeNativeTransfer(address payable to, uint256 amount) internal {\n // We don't use `transfer` or `send`, as they are considered bad practices after the Istanbul hardfork.\n (bool success, ) = to.call{value: amount}(\"\");\n require(success, \"Native transfer failed\");\n }\n}\n" + }, + "src/automation/gelato/IOps.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @dev Based on https://github.com/gelatodigital/ops\ninterface IOps {\n function gelato() external view returns (address payable);\n\n function getFeeDetails() external view returns (uint256, address);\n}\n" + }, + "src/automation/gelato/IResolver.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @dev Copy of https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/interfaces/IResolver.sol\ninterface IResolver {\n function checker()\n external\n view\n returns (bool canExec, bytes memory execPayload);\n}\n" + }, + "src/automation/gelato/OpsReady.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport {IOps} from \"./IOps.sol\";\nimport {BackCombatibleTransfer} from \"./BackCombatibleTransfer.sol\";\n\nimport {SafeInitializable} from \"../../upgradeable/SafeInitializable.sol\";\n\n/// Based on https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/vendor/gelato/OpsReady.sol\n/// @notice Give basic methods to pay for Gelato operations.\nabstract contract OpsReady is SafeInitializable {\n IOps public ops;\n address payable public gelato;\n\n using BackCombatibleTransfer for address payable;\n using SafeERC20 for IERC20;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n modifier onlyOps() {\n require(msg.sender == address(ops), \"OpsReady: onlyOps\");\n _;\n }\n \n /**\n * Contructor of contract which will be able to communicate with Gelato protocol\n * @param _ops - address of the Ops contract.\n * @dev addresses can be found at https://docs.gelato.network/developer-products/gelato-ops-smart-contract-automation-hub/contract-addresses\n */\n function __OpsReady_init(IOps _ops) internal onlyInitializing {\n ops = _ops;\n gelato = ops.gelato();\n }\n\n /// @notice Will pay bot for executed task through galato\n function _payGalatoFee() internal {\n (uint256 fee, address feeToken) = ops.getFeeDetails();\n\n gelato.backCombatibleTransfer(feeToken, fee);\n }\n}\n" + }, + "src/automation/GelatoJobAdapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {Job} from \"./Job.sol\";\nimport {IResolver} from \"./gelato/IResolver.sol\";\nimport {OpsReady, IOps} from \"./gelato/OpsReady.sol\";\n\n/// @notice Contract expect work will be prepayd, so it cannot pay for work\nerror PayableWorkNotAllowed();\n\n/// @title Implementation of the mixin that adds support for Gelato (keepers operator)\nabstract contract GelatoJobAdapter is Job, IResolver, OpsReady {\n /// @notice If job is prepaid, then it not will try to pay on executed work.\n bool public isPrepaid;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * @notice Constructor of Job adapter contract.\n * @param _ops - address of the Ops contract.\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * @param _isPrepaid - If job is prepaid, then it not will try to pay on executed work\n */\n function __GelatoJobAdapter_init(\n IOps _ops,\n uint256 _minimumBetweenExecutions,\n bool _isPrepaid\n ) internal onlyInitializing {\n __OpsReady_init(_ops);\n __Job_init(_minimumBetweenExecutions);\n\n __GelatoJobAdapter_init_unchained(_isPrepaid);\n }\n\n /**\n * @notice Unchained constructor of Job adapter contract without rest of the contracts init\n * @param _isPrepaid - If job is prepaid, then it not will try to pay on executed work\n */\n function __GelatoJobAdapter_init_unchained(bool _isPrepaid)\n internal\n onlyInitializing\n {\n isPrepaid = _isPrepaid;\n }\n\n /// @notice Resolver checker that says if the work can be performed and with what params.\n function checker()\n public\n view\n returns (bool canExec, bytes memory execPayload)\n {\n canExec = canWork();\n\n execPayload = abi.encodeWithSelector(\n isPrepaid ? this.work.selector : this.payableWork.selector\n );\n }\n\n /// @notice Bot will call this method when `checker` returns `true`.\n /// Will pay caller\n /// `_doWork` method stay as it is, to allow a call off-chain\n function payableWork() public nonReentrant onlyOps {\n if (isPrepaid) {\n revert PayableWorkNotAllowed();\n }\n\n _doWork();\n\n // Check -> Effect -> Interaction\n // To prevent exploits pay only at the end of operations\n _payGalatoFee();\n }\n}\n" + }, + "src/automation/Job.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\n/// Someone tried to execute work function while `canWork` is `false`\nerror CannotWorkNow();\n\n/// Given time minimum between execution must be greater then 1000\nerror TimeMinimumBetweenExecutionsIncorrect(uint256 _givenTime);\n\n/// @title Abstract contract by implementation of which\n/// possible to make child contract support of one of keeper providers.\n/// @notice This contract is only define interface,\n/// for add support of specific provider need add specific mixin contract.\nabstract contract Job is\n SafeInitializable,\n ContextUpgradeable,\n ReentrancyGuardUpgradeable\n{\n /// Job work function was executed by worker bot\n event Worked(address indexed worker);\n\n /// @notice Timestamp of last work execution block in seconds.\n /// @dev Logic of checking and manupulating execution must be only in this contract (not in child)\n /// to control timestamp dependce vularability.\n /// Important: Expect all timestamp can be adgasted by miners.\n /// More info at: https://www.getsecureworld.com/blog/what-is-timestamp-dependence-vulnerability/\n uint256 public lastWorkTime;\n\n /// @notice Mininmal time which must pass between executions of the job in seconds.\n /// Better set hours, but at least set to greater then 900 seconds,\n /// node opperators able to manipulate timestamp in 900 seconds range, on some blockchains maybe bigger.\n uint256 public minimumBetweenExecutions;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * @notice Constructor of Job contract.\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * Set in hours to prevent block timestamp vularability\n */\n function __Job_init(uint256 _minimumBetweenExecutions)\n internal\n onlyInitializing\n {\n __Context_init();\n __ReentrancyGuard_init();\n\n __Job_init_unchained(_minimumBetweenExecutions);\n }\n\n /**\n * @notice Unchained constructor of Job contract without rest of the contracts init\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * Set in hours to prevent block timestamp vularability\n */\n function __Job_init_unchained(uint256 _minimumBetweenExecutions)\n internal\n onlyInitializing\n {\n _setMinimumBetweenExecutions(_minimumBetweenExecutions);\n // Not will set lastWorkTime to allow first work immediately after contract deploy\n }\n\n // ------------------------------------------ Public methods ------------------------------------------\n\n /// @notice If work can be executed by keeper at this moment returns true\n /// @dev Will be executed by keeper and before `work` method execution.\n function canWork() public view returns (bool) {\n // TODO: Check the maximum delay between job executions (?)\n return\n isTimePassFromLastExecution(minimumBetweenExecutions) && _canWork();\n }\n\n /// @notice allow execution only if `canWork` return true\n modifier onlyWhenCanWork() {\n if (!canWork()) {\n revert CannotWorkNow();\n }\n _;\n }\n\n /// @notice A handle that allows the `_doWork` function to be invoked externally by everyone.\n /// Perform a `canWork` check to avoid unnecessary and (maybe) malicious calls.\n /// @dev `nonReentrant` modifier might be excess there, since we have `isTimePassFromLastExecution` check\n /// and `refreshLastWorkTime` at start (see `onlyWhenCanWork` modifier). Let's keep it, as `canWork` can be overridden.\n function work() public nonReentrant onlyWhenCanWork {\n _doWork();\n }\n\n /// @notice Performs `_work` call and refreshes the last execution time.\n function _doWork() internal {\n // Refresh execution works like `nonReentrant` modifier if we have a `isTimePassFromLastExecution` check inside `canWork`.\n _refreshLastWorkTime();\n\n // An important work that is meant to be executed by the keeper.\n _work();\n\n emit Worked(msg.sender);\n }\n\n // ------------------------------------------ Time check logic ------------------------------------------\n\n /// @notice Set minimum time between executions.\n /// @param time - required time which must pass between executions of the job in seconds.\n /// Set in hours to prevent block timestamp vulnerability\n function _setMinimumBetweenExecutions(uint256 time) internal {\n if (time <= 1000) {\n revert TimeMinimumBetweenExecutionsIncorrect(time);\n }\n\n minimumBetweenExecutions = time;\n }\n\n /// @notice Time that passed since the last exection\n /// @return seconds from last execution in a range of 900 seconds\n function timeFromLastExecution() public view returns (uint256) {\n // lastWorkTime will be zero before first execution\n return block.timestamp - lastWorkTime; // solhint-disable-line not-rely-on-time\n }\n\n /// @notice Set time of last execution to current block\n function _refreshLastWorkTime() internal {\n lastWorkTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /// @notice Check if given time from last execution is passed\n /// @param second - amount of time which mast pass from last execution\n /// @return true if enough time pass\n function isTimePassFromLastExecution(uint256 second)\n internal\n view\n returns (bool)\n {\n return timeFromLastExecution() > second;\n }\n\n // ------------------------------------------ Busines methods to override ------------------------------\n\n /// @notice Method which will be executed by keeper\n function _work() internal virtual;\n\n /// @notice Method which identify if work can be executed at this moment.\n /// @dev Will be executed by keeper and before `work` method execution.\n /// @return true if `work` method can be called.\n function _canWork() internal view virtual returns (bool);\n}\n" + }, + "src/healthcheck/HealthChecker.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nimport {IHealthCheck} from \"./IHealthCheck.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror HealthCheckFailed();\n\nabstract contract HealthChecker is SafeInitializable, OwnableUpgradeable {\n event HealthCheckChanged(address);\n event HealthCheckEnabledChanged(bool);\n\n IHealthCheck public healthCheck;\n bool public healthCheckEnabled;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __HealthChecker_init(address _healthCheck)\n internal\n onlyInitializing\n {\n __Ownable_init();\n\n __HealthChecker_init_unchained(_healthCheck);\n }\n\n function __HealthChecker_init_unchained(address _healthCheck)\n internal\n onlyInitializing\n {\n setHealthCheck(_healthCheck);\n setHealthCheckEnabled(true);\n }\n\n /// @notice Sets the health check implementation contract.\n /// @param _healthCheck A new health check contract address.\n /// @dev Emits the \"HealthCheckChanged\" event.\n function setHealthCheck(address _healthCheck) public onlyOwner {\n healthCheck = IHealthCheck(_healthCheck);\n emit HealthCheckChanged(_healthCheck);\n }\n\n /// @notice Enables or disables the health check.\n /// @param _healthCheckEnabled If \"true\" - health check will be disabled.\n /// @dev Emits the \"HealthCheckEnabledChanged\" event.\n /// Do not disable the health check, unless you need to perform \"report\" in an emergency.\n function setHealthCheckEnabled(bool _healthCheckEnabled) public onlyOwner {\n healthCheckEnabled = _healthCheckEnabled;\n emit HealthCheckEnabledChanged(_healthCheckEnabled);\n }\n\n /// @notice Performs the health check by calling external contract.\n /// @param strategy Address of the strategy to be checked.\n /// @param profit The amount of funds that the strategy realised as profit.\n /// @param loss The amount of funds that the strategy realised as loss.\n /// @param debtPayment The amount of funds that the strategy spent to pay the debt.\n /// @param debtOutstanding Outstanding strategy debt.\n /// @param totalDebt The total amount of funds borrowed by the strategy from the vault.\n function performHealthCheck(\n address strategy,\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 debtOutstanding,\n uint256 totalDebt\n ) internal virtual {\n // No health check implementation provided, skip the execution.\n if (address(healthCheck) == address(0)) {\n return;\n }\n\n // There is usually no reason to turn off health checks.\n // But sometimes it may be necessary if we need to call a \"report\" manually.\n // If this happens, we should turn it on again.\n if (!healthCheckEnabled) {\n setHealthCheckEnabled(true);\n return;\n }\n\n // Perform the health check, revert the transaction if unsuccessful.\n bool success = healthCheck.check(\n strategy,\n profit,\n loss,\n debtPayment,\n debtOutstanding,\n totalDebt\n );\n if (!success) {\n revert HealthCheckFailed();\n }\n }\n}\n" + }, + "src/healthcheck/IHealthCheck.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface IHealthCheck {\n /// @notice Checks the overall state of the strategy\n /// @param strategy Address of the strategy to be checked.\n /// @param profit The amount of funds that the strategy realised as profit.\n /// @param loss The amount of funds that the strategy realised as loss.\n /// @param debtPayment The amount of funds that the strategy spent to pay the debt.\n /// @param debtOutstanding Outstanding strategy debt.\n /// @param totalDebt The total amount of funds borrowed by the strategy from the vault.\n /// @return The status of a completed health check.\n function check(\n address strategy,\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 debtOutstanding,\n uint256 totalDebt\n ) external view returns (bool);\n}\n" + }, + "src/IVault.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IStrategiesLender} from \"./lending/IStrategiesLender.sol\";\nimport {IERC4626} from \"./tokens/IERC4626.sol\";\n\ninterface IVault is IStrategiesLender, IERC4626 { // solhint-disable-line no-empty-blocks\n\n}\n" + }, + "src/lending/ILender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// Base contract for lending protocols, can be used for colletaralized and not colletaralized lending.\ninterface ILender {\n\n /// @notice Returns the number of tokens the borrower (caller of this function) can take from the lender\n /// @return Available credit as amount of tokens\n function availableCredit() external view returns (uint256);\n\n /// @notice Returns the outstanding debt that the borrower (caller of this function) must repay\n /// @return Outstanding debt as amount of tokens\n function outstandingDebt() external view returns (uint256);\n\n /// @notice Returns the amount of funds taken by the borrower (caller of this function).\n /// @return Debt as amount of tokens\n function currentDebt() external view returns (uint256);\n\n /// @notice Returns the debt ratio of the borrower (caller of this function).\n function currentDebtRatio() external view returns (uint256);\n\n /// @notice Returns the last report timestamp of the borrower (caller of this function).\n function lastReport() external view returns (uint256);\n\n /// @notice Returns the activation status of the borrower (caller of this function).\n /// @return \"true\" if the borrower is active\n function isActivated() external view returns (bool);\n\n /// @notice Indicates if the vault was shutted down or not.\n /// @return \"true\" if the contract is paused, and \"false\" otherwise.\n function paused() external view returns (bool);\n\n /// @notice Reports a positive result of the borrower's debt management.\n /// Borrower must call this function if he has made any profit\n /// or/and has a free funds available to repay the outstanding debt (if any).\n /// @param extraFreeFunds an extra amount of free funds borrower's contract has.\n /// This reporting amount must be greater than the borrower's outstanding debt.\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\n function reportPositiveDebtManagement(\n uint256 extraFreeFunds,\n uint256 debtPayment\n ) external;\n\n /// @notice Reports a negative result of the borrower's debt management.\n /// The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\n /// May include a portion of the outstanding debt that the borrower was unable to repay.\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\n external;\n}\n" + }, + "src/lending/IStrategiesLender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ILender} from \"./ILender.sol\";\n\n/// Lender contract which targeted to lend specifically for investments strategies.\n/// Basically represent specific case of implementation of whitelist not colletaraized lending contract.\ninterface IStrategiesLender is ILender {\n\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\n function withdrawalQueue(uint256 index) external view returns (address);\n\n /// @notice Revokes a strategy from the vault.\n /// Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\n /// @param strategy a strategy to revoke.\n function revokeStrategy(address strategy) external;\n\n /// @notice Returns average interst rate of lender per block. \n /// Based on last report utilization rate and possibly cached interest rate of each strategy.\n /// Can be outadated, but close enough to real state for on chain calculations.\n /// Calculate average by combining utilisation rate of each strategy with its interest rate.\n /// Returns additional total utilisation rate of lender, as additional product of calculation, usefull to safe gas.\n /// @return interstRate - The interest rate per block, scaled by 1e18\n /// @return utilisationRate - The utilisation rate of the lender, in BPS (scaled by 1e4)\n function interestRatePerBlock() external view returns (uint256 interstRate, uint256 utilisationRate);\n}\n" + }, + "src/lending/Lender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {ILender} from \"./ILender.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror BorrowerAlreadyExists();\nerror BorrowerDoesNotExist();\nerror BorrowerHasDebt();\nerror CallerIsNotABorrower();\nerror LenderRatioExceeded(uint256 freeRatio);\nerror FalsePositiveReport();\n\nabstract contract Lender is\n ILender,\n SafeInitializable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n struct BorrowerData {\n /// Timestamp of the block in which the borrower was activated\n uint256 activationTimestamp;\n /// Last time a borrower made a report\n uint256 lastReportTimestamp;\n /// Amount of tokens taken by the borrower\n uint256 debt;\n /// Maximum portion of the loan that the borrower can take (in BPS)\n /// Represents credibility of the borrower\n uint256 debtRatio;\n }\n\n uint256 public constant MAX_BPS = 10_000;\n\n /// @notice Amount of tokens that all borrowers have taken\n uint256 public totalDebt;\n\n /// @notice Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\n uint256 public debtRatio;\n\n /// @notice Last time a report occurred by any borrower\n uint256 public lastReportTimestamp;\n\n /// @notice Records with information on each borrower using the lender's services\n mapping(address => BorrowerData) public borrowersData;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @notice Event that must occur when the borrower reported the results of his debt management\n /// @param borrower Borrower's contract address\n /// @param debtPayment Amount of outstanding debt repaid by the borrower\n /// @param freeFunds Free funds on the borrower's contract that remain after the debt is paid\n /// @param fundsGiven Funds issued to the borrower by this lender\n /// @param fundsTaken Funds that have been taken from the borrower by the lender\n /// @param loss Amount of funds that the borrower realised as loss\n event BorrowerDebtManagementReported(\n address indexed borrower,\n uint256 debtPayment,\n uint256 freeFunds,\n uint256 fundsGiven,\n uint256 fundsTaken,\n uint256 loss\n );\n\n modifier onlyBorrowers() {\n if (borrowersData[msg.sender].activationTimestamp == 0) {\n revert CallerIsNotABorrower();\n }\n _;\n }\n\n /// @notice Updates the last report timestamp for the specified borrower and this lender.\n modifier updateLastReportTime() {\n _;\n borrowersData[msg.sender].lastReportTimestamp = lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __Lender_init() internal onlyInitializing {\n __Pausable_init();\n __ReentrancyGuard_init();\n\n __Lender_init_unchained();\n }\n\n function __Lender_init_unchained() internal onlyInitializing {\n lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /// @inheritdoc ILender\n function availableCredit() external view override returns (uint256) {\n return _availableCredit(msg.sender);\n }\n\n /// @inheritdoc ILender\n function outstandingDebt() external view override returns (uint256) {\n return _outstandingDebt(msg.sender);\n }\n\n /// @inheritdoc ILender\n function currentDebt() external view override returns (uint256) {\n return currentDebt(msg.sender);\n }\n\n /// @inheritdoc ILender\n function currentDebtRatio() external view override returns (uint256) {\n return borrowersData[msg.sender].debt;\n }\n\n /// @inheritdoc ILender\n function isActivated() external view override returns (bool) {\n return isActivated(msg.sender);\n }\n\n /// @inheritdoc ILender\n function lastReport() external view override returns (uint256) {\n return lastReport(msg.sender);\n }\n\n /// @inheritdoc ILender\n function reportPositiveDebtManagement(\n uint256 extraFreeFunds,\n uint256 debtPayment\n ) external override onlyBorrowers updateLastReportTime nonReentrant {\n // Checking whether the borrower is telling the truth about his available funds\n if (_borrowerFreeAssets(msg.sender) < extraFreeFunds + debtPayment) {\n revert FalsePositiveReport();\n }\n\n uint256 chargedFees = 0;\n // We can only charge a fees if the borrower has reported extra free funds,\n // if it's the first report at this block and only if the borrower was registered some time ago\n if (\n extraFreeFunds > 0 &&\n borrowersData[msg.sender].lastReportTimestamp < block.timestamp && // solhint-disable-line not-rely-on-time\n borrowersData[msg.sender].activationTimestamp < block.timestamp // solhint-disable-line not-rely-on-time\n ) {\n chargedFees = _chargeFees(extraFreeFunds);\n }\n\n _rebalanceBorrowerFunds(msg.sender, debtPayment, extraFreeFunds, 0);\n\n _afterPositiveDebtManagementReport(extraFreeFunds, chargedFees);\n }\n\n /// @inheritdoc ILender\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\n external\n override\n onlyBorrowers\n updateLastReportTime\n nonReentrant\n {\n // Checking whether the borrower has available funds for debt payment\n require(_borrowerFreeAssets(msg.sender) >= debtPayment, \"Not enough assets for payment\");\n\n // Debt wasn't repaid, we need to decrease the ratio of this borrower\n if (loss > 0) {\n _decreaseBorrowerCredibility(msg.sender, loss);\n }\n\n _rebalanceBorrowerFunds(msg.sender, debtPayment, 0, loss);\n\n _afterNegativeDebtManagementReport(loss);\n }\n\n /// @notice Balances the borrower's account and adjusts the current amount of funds the borrower can take.\n /// @param borrower a borrower's contract address.\n /// @param debtPayment an amount of outstanding debt since the previous report, that the borrower managed to cover. Can be zero.\n /// @param borrowerFreeFunds a funds that the borrower has earned since the previous report. Can be zero.\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\n function _rebalanceBorrowerFunds(\n address borrower,\n uint256 debtPayment,\n uint256 borrowerFreeFunds,\n uint256 loss\n ) private {\n // Calculate the amount of credit the lender can provide to the borrower (if any)\n uint256 borrowerAvailableCredit = _availableCredit(borrower);\n\n // Make sure that the borrower's debt payment doesn't exceed his actual outstanding debt\n uint256 borrowerOutstandingDebt = _outstandingDebt(msg.sender);\n debtPayment = MathUpgradeable.min(debtPayment, borrowerOutstandingDebt);\n\n // Take into account repaid debt, if any\n if (debtPayment > 0) {\n borrowersData[borrower].debt -= debtPayment;\n totalDebt -= debtPayment;\n }\n\n // Allocate some funds to the borrower if possible\n if (borrowerAvailableCredit > 0) {\n borrowersData[borrower].debt += borrowerAvailableCredit;\n totalDebt += borrowerAvailableCredit;\n }\n\n // Now we need to compare the allocated funds to the borrower and his current free balance.\n // If the number of unrealized tokens on the borrower's contract is less than the available credit, \n // the lender must give that difference to the borrower.\n // Otherwise (if the amount of the borrower's available funds is greater than \n // he should have according to his share), the lender must take that portion of the funds for himself.\n uint256 freeBorrowerBalance = borrowerFreeFunds + debtPayment;\n uint256 fundsGiven = 0;\n uint256 fundsTaken = 0;\n if (freeBorrowerBalance < borrowerAvailableCredit) {\n fundsGiven = borrowerAvailableCredit - freeBorrowerBalance;\n _transferFundsToBorrower(borrower, fundsGiven);\n } else if (freeBorrowerBalance > borrowerAvailableCredit) {\n fundsTaken = freeBorrowerBalance - borrowerAvailableCredit;\n _takeFundsFromBorrower(borrower, fundsTaken);\n }\n\n emit BorrowerDebtManagementReported(\n borrower,\n debtPayment,\n borrowerFreeFunds,\n fundsGiven,\n fundsTaken,\n loss\n );\n }\n\n /// @notice Returns the unrealized amount of the lender's tokens (lender's contract balance)\n function _freeAssets() internal view virtual returns (uint256);\n\n /// @notice Returns the unrealized amount of the borrower's tokens (contract balance of the specified borrower)\n function _borrowerFreeAssets(address borrower)\n internal\n view\n virtual\n returns (uint256);\n\n /// @notice Transfers a specified amount of tokens to the borrower\n function _transferFundsToBorrower(address borrower, uint256 amount)\n internal\n virtual;\n\n /// @notice Takes a specified amount of tokens from the borrower\n function _takeFundsFromBorrower(address borrower, uint256 amount)\n internal\n virtual;\n\n /// @notice Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\n function fundAssets() public view virtual returns (uint256) {\n return _freeAssets() + totalDebt;\n }\n\n /// @notice Returns the current debt that the strategy has.\n function currentDebt(address borrower) public view returns (uint256) {\n return borrowersData[borrower].debt;\n }\n\n /// @notice Returns the activation status of the specified borrower.\n function isActivated(address borrower) public view returns (bool) {\n return borrowersData[borrower].activationTimestamp > 0;\n }\n\n /// @notice Returns the last report timestamp of the specified borrower.\n function lastReport(address borrower) public view returns (uint256) {\n return borrowersData[borrower].lastReportTimestamp;\n }\n\n /// @notice Returns the total number of tokens borrowers can take.\n function _debtLimit() private view returns (uint256) {\n return (debtRatio * fundAssets()) / MAX_BPS;\n }\n\n /// @notice Lowers the borrower's debt he can take by specified loss and decreases his credibility.\n /// @dev This function has \"internal\" visibility because it's used in tests.\n function _decreaseBorrowerCredibility(address borrower, uint256 loss)\n internal\n {\n uint256 debt = borrowersData[borrower].debt;\n\n // Make sure the borrower's loss is less than his entire debt\n require(debt >= loss, \"Loss is greater than the debt\");\n\n // To decrease credibility of the borrower we should lower his \"debtRatio\"\n if (debtRatio > 0) {\n uint256 debtRatioChange = MathUpgradeable.min(\n (debtRatio * loss) / totalDebt,\n borrowersData[borrower].debtRatio\n );\n if (debtRatioChange != 0) {\n borrowersData[borrower].debtRatio -= debtRatioChange;\n debtRatio -= debtRatioChange;\n }\n }\n\n // Also, need to reduce the max amount of funds that can be taken by the borrower\n borrowersData[borrower].debt -= loss;\n totalDebt -= loss;\n }\n\n /// @notice See external implementation\n function _availableCredit(address borrower)\n internal\n view\n returns (uint256)\n {\n // Lender is paused, no funds available for the borrower\n if (paused()) {\n return 0;\n }\n\n uint256 lenderDebtLimit = _debtLimit();\n uint256 lenderDebt = totalDebt;\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\n fundAssets()) / MAX_BPS;\n uint256 borrowerDebt = borrowersData[borrower].debt;\n\n // There're no more funds for the borrower because he has outstanding debt or the lender's available funds have been exhausted\n if (\n lenderDebtLimit <= lenderDebt || borrowerDebtLimit <= borrowerDebt\n ) {\n return 0;\n }\n\n uint256 lenderAvailableFunds = lenderDebtLimit - lenderDebt;\n uint256 borrowerIntendedCredit = borrowerDebtLimit - borrowerDebt;\n\n // Borrower may not take more funds than the lender's limit\n uint256 borrowerAvailableCredit = MathUpgradeable.min(\n lenderAvailableFunds,\n borrowerIntendedCredit\n );\n\n // Available credit is limited by the existing number of tokens on the lender's contract\n borrowerAvailableCredit = MathUpgradeable.min(\n borrowerAvailableCredit,\n _freeAssets()\n );\n\n return borrowerAvailableCredit;\n }\n\n /// @notice See external implementation\n function _outstandingDebt(address borrower)\n internal\n view\n returns (uint256)\n {\n uint256 borrowerDebt = borrowersData[borrower].debt;\n if (paused() || debtRatio == 0) {\n return borrowerDebt;\n }\n\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\n fundAssets()) / MAX_BPS;\n if (borrowerDebt <= borrowerDebtLimit) {\n return 0;\n }\n\n return borrowerDebt - borrowerDebtLimit;\n }\n\n /// @notice Registers a new borrower and sets for him a certain debt ratio\n function _registerBorrower(address borrower, uint256 borrowerDebtRatio)\n internal\n {\n // Check if specified borrower has already registered\n if (isActivated(borrower)) {\n revert BorrowerAlreadyExists();\n }\n\n if (debtRatio + borrowerDebtRatio > MAX_BPS) {\n revert LenderRatioExceeded(MAX_BPS - debtRatio);\n }\n\n borrowersData[borrower] = BorrowerData(\n // Activation timestamp \n block.timestamp, // solhint-disable-line not-rely-on-time\n // Last report timestamp\n block.timestamp, // solhint-disable-line not-rely-on-time\n // Initial debt\n 0, \n // Debt ratio\n borrowerDebtRatio \n );\n\n debtRatio += borrowerDebtRatio;\n }\n\n /// @notice Sets the borrower's debt ratio. Will be reverted if the borrower doesn't exist or the total debt ratio is exceeded.\n /// @dev In the case where you want to disable the borrower, you need to set its ratio to 0.\n /// Thus, the borrower's current debt becomes an outstanding debt, which he must repay to the lender.\n function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)\n internal\n {\n if (!isActivated(borrower)) {\n revert BorrowerDoesNotExist();\n }\n\n debtRatio -= borrowersData[borrower].debtRatio;\n borrowersData[borrower].debtRatio = borrowerDebtRatio;\n debtRatio += borrowerDebtRatio;\n\n if (debtRatio > MAX_BPS) {\n revert LenderRatioExceeded(\n MAX_BPS - (debtRatio - borrowerDebtRatio)\n );\n }\n }\n\n /// @notice Deletes the borrower from the list\n /// @dev Should be called after the borrower's debt ratio is changed to 0, because the lender must take back all the released funds.\n function _unregisterBorrower(address borrower) internal {\n if (borrowersData[borrower].debtRatio > 0) {\n revert BorrowerHasDebt();\n }\n delete borrowersData[borrower];\n }\n\n /// Calculate utilisation rate for specific borrower\n /// @notice Based on last report data, can be outdated, but close to latest state of fund\n /// @return percent of total assets taken by strategy in BPS\n function utilizationRate(address borrower) public virtual view returns (uint256) {\n // assets in vault + amount lent to strategies\n uint256 _fundAssets = fundAssets(); \n // to decrease amount of calls to borrower contract,\n // assume that borrower have same amount like in last update\n uint256 borrowerAssets = borrowersData[borrower].debt; \n\n if (_fundAssets == 0) {\n return 0;\n }\n\n return borrowerAssets * MAX_BPS / _fundAssets;\n }\n\n /// @notice Charges a fee on the borrower's income.\n /// @param extraFreeFunds an income from which the fees will be calculated.\n /// @return The total amount of fees charged.\n function _chargeFees(uint256 extraFreeFunds)\n internal\n virtual\n returns (uint256);\n\n /// @notice Callback that is called at the end of the positive report function.\n /// @param extraFreeFunds the reported extra amount of borrower's funds.\n /// @param chargedFees the total amount of charged fees.\n function _afterPositiveDebtManagementReport(\n uint256 extraFreeFunds,\n uint256 chargedFees\n ) internal virtual;\n\n /// @notice Callback that is called at the end of the negative report function.\n /// @param loss the number of tokens by which the borrower's balance has decreased since the last report.\n function _afterNegativeDebtManagementReport(uint256 loss) internal virtual;\n\n /// @inheritdoc ILender\n /// @dev Explicitly overridden here to keep this function exposed via \"ILender\" interface.\n function paused()\n public\n view\n override(ILender, PausableUpgradeable)\n virtual\n returns (bool)\n {\n return super.paused();\n }\n}\n" + }, + "src/lending/StrategiesLender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nimport {Lender, BorrowerDoesNotExist} from \"./Lender.sol\";\nimport {ILender} from \"./ILender.sol\";\nimport {IStrategiesLender} from \"./IStrategiesLender.sol\";\nimport {IStrategy} from \"../strategies/IStrategy.sol\";\nimport {AddressList} from \"../structures/AddressList.sol\";\n\nerror UnexpectedZeroAddress();\nerror StrategyNotFound();\nerror StrategyAlreadyExists();\nerror AccessDeniedForCaller(address caller);\n\n/// Lender contract which targeted to lend specifically for investments strategies.\n/// Basically represent specific case of implementation of whitelist not colletaraized lending contract.\nabstract contract StrategiesLender is IStrategiesLender, Lender, OwnableUpgradeable {\n\n using AddressList for address[];\n\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\n address[] public withdrawalQueue;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[50] private __gap;\n\n /// @notice Event that should happen when the strategy connects to the vault.\n /// @param strategy Address of the strategy contract.\n /// @param debtRatio Maximum portion of the loan that the strategy can take (in BPS).\n event StrategyAdded(address indexed strategy, uint256 debtRatio);\n\n /// @notice Event that should happen when the strategy has been revoked from the vault.\n /// @param strategy Address of the strategy contract.\n event StrategyRevoked(address indexed strategy);\n\n /// @notice Event that should happen when the strategy has been removed from the vault.\n /// @param strategy Address of the strategy contract.\n /// @param fromQueueOnly If \"true\", then the strategy has only been removed from the withdrawal queue.\n event StrategyRemoved(address indexed strategy, bool fromQueueOnly);\n\n /// @notice Event that should happen when the strategy has been returned to the withdrawal queue.\n /// @param strategy Address of the strategy contract.\n event StrategyReturnedToQueue(address indexed strategy);\n\n modifier onlyOwnerOrStrategy(address strategy) {\n if (msg.sender != owner() && msg.sender != strategy) {\n revert AccessDeniedForCaller(msg.sender);\n }\n _;\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __StrategiesLender_init() internal onlyInitializing {\n __Ownable_init();\n\n __StrategiesLender_init_lenderSpecific();\n }\n\n /// Init only direct constructors of business logic, ignore Ownable and simular common contracts\n function __StrategiesLender_init_lenderSpecific() internal onlyInitializing {\n require(owner() != address(0), \"StrategiesLender must be ownable\");\n\n __Lender_init();\n }\n\n /// @notice Switches the vault pause state.\n /// @param shutdown a new vault pause state. If \"true\" is passed, the vault will be paused.\n function setEmergencyShutdown(bool shutdown) external onlyOwner {\n shutdown ? _pause() : _unpause();\n }\n\n /// @notice Returns the current debt of the strategy.\n /// @param strategy the strategy address.\n function strategyDebt(address strategy) external view returns (uint256) {\n return borrowersData[strategy].debt;\n }\n\n /// @notice Returns the debt ratio of the strategy.\n /// @param strategy the strategy address.\n function strategyRatio(address strategy) external view returns (uint256) {\n return borrowersData[strategy].debtRatio;\n }\n\n /// @notice Adds a new strategy to the vault.\n /// @param strategy a new strategy address.\n /// @param debtRatio a ratio that shows how much of the new strategy can take, relative to other strategies.\n function addStrategy(address strategy, uint256 debtRatio)\n external\n onlyOwner\n whenNotPaused\n {\n if (strategy == address(0)) {\n revert UnexpectedZeroAddress();\n }\n \n _beforeStrategyRegistered(IStrategy(strategy));\n\n _registerBorrower(strategy, debtRatio);\n withdrawalQueue.add(strategy);\n\n emit StrategyAdded(strategy, debtRatio);\n }\n\n /// Allow check strategy complience before it added\n function _beforeStrategyRegistered(IStrategy strategy) internal virtual;\n\n /// @notice Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\n /// @param strategy a strategy address.\n function addStrategyToQueue(address strategy) external onlyOwner {\n if (strategy == address(0)) {\n revert UnexpectedZeroAddress();\n }\n\n if (withdrawalQueue.contains(strategy)) {\n revert StrategyAlreadyExists();\n }\n\n if (borrowersData[strategy].activationTimestamp == 0) {\n revert BorrowerDoesNotExist();\n }\n\n withdrawalQueue.add(strategy);\n\n emit StrategyReturnedToQueue(strategy);\n }\n\n /// @inheritdoc IStrategiesLender\n function revokeStrategy(address strategy)\n external\n onlyOwnerOrStrategy(strategy)\n {\n _setBorrowerDebtRatio(strategy, 0);\n emit StrategyRevoked(strategy);\n }\n\n /// @notice Removes a strategy from the vault.\n /// @param strategy a strategy to remove.\n /// @param fromQueueOnly if \"true\", then the strategy will only be removed from the withdrawal queue.\n function removeStrategy(address strategy, bool fromQueueOnly)\n external\n onlyOwner\n {\n bool removedFromQueue = withdrawalQueue.remove(strategy);\n if (!removedFromQueue) {\n revert StrategyNotFound();\n }\n\n if (!fromQueueOnly) {\n _unregisterBorrower(strategy);\n }\n\n emit StrategyRemoved(strategy, fromQueueOnly);\n }\n\n /// @notice Sets the withdrawal queue.\n /// @param queue a new queue that will replace the existing one.\n /// Should contain only those elements that already present in the existing queue.\n function reorderWithdrawalQueue(address[] memory queue) external onlyOwner {\n withdrawalQueue = withdrawalQueue.reorder(queue);\n }\n\n /// @notice Returns the size of the withdrawal queue.\n function getQueueSize() external view returns (uint256) {\n return withdrawalQueue.length;\n }\n \n /// @inheritdoc IStrategiesLender\n function interestRatePerBlock() public view returns (uint256, uint256) {\n uint256 totalUtilisationRate;\n uint256 totalInterestRate;\n\n if(totalDebt == 0) {\n return (0, 0);\n }\n\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\n IStrategy strategy = IStrategy(withdrawalQueue[i]);\n\n uint256 utilisationRate = utilizationRate(address(strategy)); // in BPS\n totalUtilisationRate += utilisationRate;\n \n // interest rate scaled by 1e18\n // utilisation rate in BPS * interest rate scaled by 1e18 / BPS = total interest rate scaled by 1e18\n totalInterestRate += utilisationRate * strategy.interestRatePerBlock() / MAX_BPS; \n }\n\n // sanity check\n if (totalUtilisationRate == 0) {\n return (0, 0);\n }\n\n return (totalInterestRate, totalUtilisationRate);\n }\n\n /// @inheritdoc Lender\n /// @dev Explicitly overridden here to keep this function exposed via \"ILender\" interface.\n function paused()\n public\n view\n override(ILender, Lender)\n virtual\n returns (bool)\n {\n return super.paused();\n }\n\n}" + }, + "src/strategies/ApeLendingStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\n\nimport {BaseStrategy} from \"./BaseStrategy.sol\";\nimport {CTokenBaseStrategy, IOps} from \"./CTokenBaseStrategy.sol\";\nimport {ICToken} from \"./protocols/ICToken.sol\";\nimport {IPancakeRouter} from \"./protocols/IPancakeRouter.sol\";\nimport {IRainMaker} from \"./protocols/IRainMaker.sol\";\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IStrategiesLender} from \"../lending/IStrategiesLender.sol\";\n\nimport {IVersionable} from \"../upgradeable/IVersionable.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"../upgradeable/SafeUUPSUpgradeable.sol\";\n\n\nerror MintError(uint256 code);\nerror RedeemError(uint256 code);\n\ncontract ApeLendingStrategy is SafeUUPSUpgradeable, CTokenBaseStrategy {\n uint256 public constant SECONDS_PER_BLOCK = 3; // for BSC only\n uint256 public constant REWARD_ESTIMATION_ACCURACY = 90;\n\n address public constant BANANA = 0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95;\n address public constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address public constant RAIN_MAKER = 0x5CB93C0AdE6B7F2760Ec4389833B0cCcb5e4efDa;\n address public constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\n /// @notice Minimum BANANA token amount to sell.\n uint256 public minBananaToSell;\n\n IPancakeRouter public pancakeRouter;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.3.0\";\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _vault,\n address _asset,\n address _cToken,\n address _ops,\n address _nativeTokenPriceFeed,\n address _assetPriceFeed,\n uint256 _minReportInterval,\n bool _isPrepaid\n ) public initializer {\n __SafeUUPSUpgradeable_init_direct();\n __CTokenBaseStrategy_init(\n IStrategiesLender(_vault),\n IERC20Upgradeable(_asset),\n ICToken(_cToken),\n IRainMaker(RAIN_MAKER), \n IERC20Upgradeable(BANANA),\n IOps(_ops),\n AggregatorV3Interface(_nativeTokenPriceFeed),\n AggregatorV3Interface(_assetPriceFeed),\n _minReportInterval,\n _isPrepaid\n ); // ownable under the hood\n\n __ApeLendingStrategy_init_unchained(IERC20Upgradeable(BANANA), IPancakeRouter(PANCAKE_ROUTER));\n }\n\n function __ApeLendingStrategy_init_unchained(IERC20Upgradeable _bananaToken, IPancakeRouter _pancakeRouter) internal onlyInitializing {\n pancakeRouter = _pancakeRouter;\n\n minBananaToSell = 0.1 ether;\n\n approveTokenMax(address(_bananaToken), address(_pancakeRouter));\n }\n\n /// @notice Sets the minimum number of BANANA tokens that must be on the contract to sell.\n function setMinBananaToSell(uint256 _minBananaToSell) external onlyOwner {\n minBananaToSell = _minBananaToSell;\n }\n\n /// @inheritdoc IStrategy\n function name() external view returns (string memory) {\n return\n string.concat(\n IERC20MetadataUpgradeable(address(asset)).symbol(),\n \" ApeLending Strategy\"\n );\n }\n\n /// @inheritdoc BaseStrategy\n function estimatedTotalAssets() public view override returns (uint256) {\n return\n asset.balanceOf(address(this)) +\n depositedBalanceSnapshot() +\n _totalBananaBalanceInAsset();\n }\n\n /// @notice Returns current deposited balance (in asset).\n /// @dev The exchange rate is recalculated at the last time someone touched the cToken contract.\n /// Transactions are not performed too often on this contract, perhaps we should consider recalculating the rate ourselves.\n function depositedBalanceSnapshot() public view returns (uint256) {\n (, uint256 cTokenBalance, , uint256 exchangeRate) = cToken\n .getAccountSnapshot(address(this));\n\n // Since every ApeSwap's cToken has 8 decimals, we can leave 1e18 as constant here.\n return (cTokenBalance * exchangeRate) / 1e18;\n }\n\n /// @notice Returns current deposited balance (in asset).\n /// @dev Unlike the snapshot function, this function recalculates the value of the deposit.\n function depositedBalance() public returns (uint256) {\n return cToken.balanceOfUnderlying(address(this));\n }\n\n /// @notice This function makes a prediction on how much BANANA is accrued per block.\n /// @dev It is not completely accurate because it uses the current protocol balance to predict into the past.\n function _estimatedAccruedBananaPerBlock() internal view returns (uint256) {\n uint256 _depositedBalance = depositedBalanceSnapshot();\n if (_depositedBalance == 0) {\n return 0; // should be impossible to have 0 balance and positive comp accrued\n }\n uint256 distributionPerBlock = rainMaker.compSupplySpeeds(\n address(cToken)\n );\n uint256 totalSupply = (cToken.totalSupply() *\n cToken.exchangeRateStored()) / 1e18;\n return\n totalSupply > 0\n ? (_depositedBalance * distributionPerBlock) / totalSupply\n : 0;\n }\n\n /// @notice This function makes a prediction on how much BANANA is accrued.\n /// @dev It is not completely accurate because it uses the current protocol balance to predict into the past.\n function _estimatedAccruedBanana() internal view returns (uint256) {\n uint256 bananaPerBlock = _estimatedAccruedBananaPerBlock();\n if (bananaPerBlock == 0) {\n return 0;\n }\n // TODO: remove call to vault, need decrease gas usage\n // TODO: use block.number instead of block.timestamp\n // can use block dependent operation in this case\n // this logic is criticial only for cases when strategy need make harvest\n // but Job contract check minimum blocks interval between harvests\n // which decrease change of manipulation with block data by miners\n uint256 blocksSinceLastHarvest = (block.timestamp - lender.lastReport()) / SECONDS_PER_BLOCK; // solhint-disable-line not-rely-on-time\n return blocksSinceLastHarvest * bananaPerBlock;\n }\n\n /// @notice Returns the current (and estimated accrued) banana balance of the strategy contract (in asset).\n /// @dev Constant REWARD_ESTIMATION_ACCURACY is used to match accuracy expectations.\n function _totalBananaBalanceInAsset() internal view returns (uint256) {\n uint256 balance = _currentBananaBalance() + _estimatedAccruedBanana();\n if (balance == 0) {\n return 0;\n }\n uint256[] memory amounts = pancakeRouter.getAmountsOut(\n balance,\n _tokenSwapPath(BANANA, address(asset))\n );\n uint256 amount = amounts[amounts.length - 1];\n return (amount * REWARD_ESTIMATION_ACCURACY) / 100;\n }\n\n /// @notice Prepares a chain of tokens (pair or triplet) to pass it into the router contract.\n function _tokenSwapPath(address tokenIn, address tokenOut)\n internal\n pure\n returns (address[] memory path)\n {\n bool isWBNB = tokenIn == address(WBNB) || tokenOut == address(WBNB);\n path = new address[](isWBNB ? 2 : 3);\n path[0] = tokenIn;\n\n if (isWBNB) {\n path[1] = tokenOut;\n } else {\n path[1] = address(WBNB);\n path[2] = tokenOut;\n }\n }\n\n /// @notice Changes the existing BANANA on the contract to an asset token.\n function _swapBananaToAsset() internal {\n uint256 bananaBalance = compToken.balanceOf(\n address(this)\n );\n if (bananaBalance < minBananaToSell) {\n return;\n }\n\n pancakeRouter.swapExactTokensForTokens(\n bananaBalance,\n 0,\n _tokenSwapPath(address(compToken), address(asset)),\n address(this),\n block.timestamp // solhint-disable-line not-rely-on-time\n );\n }\n\n /// @inheritdoc BaseStrategy\n function _harvest(uint256 outstandingDebt)\n internal\n override\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n )\n {\n profit = 0;\n loss = 0;\n\n // No positions to harvest, allocate available funds to pay the debt (if any)\n if (cToken.balanceOf(address(this)) == 0) {\n debtPayment = MathUpgradeable.min(\n asset.balanceOf(address(this)),\n outstandingDebt\n );\n return (profit, loss, debtPayment);\n }\n\n uint256 deposits = depositedBalance();\n\n _claimBanana();\n _swapBananaToAsset();\n\n uint256 assetBalance = asset.balanceOf(address(this));\n uint256 balance = deposits + assetBalance;\n\n uint256 debt = lender.currentDebt();\n\n if (balance > debt) {\n profit = balance - debt;\n if (assetBalance < profit) {\n debtPayment = MathUpgradeable.min(\n assetBalance,\n outstandingDebt\n );\n profit = assetBalance - debtPayment;\n } else if (assetBalance > profit + outstandingDebt) {\n debtPayment = outstandingDebt;\n } else {\n debtPayment = assetBalance - profit;\n }\n } else {\n loss = debt - balance;\n debtPayment = MathUpgradeable.min(assetBalance, outstandingDebt);\n }\n }\n\n /// @inheritdoc BaseStrategy\n function _adjustPosition(uint256 outstandingDebt) internal override {\n if (paused()) {\n return;\n }\n\n uint256 assetBalance = asset.balanceOf(address(this));\n if (assetBalance < outstandingDebt) {\n // We compare the balance with 1 because of rounding error\n if (cToken.balanceOf(address(this)) > 1) {\n _liquidatePosition(outstandingDebt - assetBalance);\n }\n return;\n }\n\n uint256 freeBalance = assetBalance - outstandingDebt;\n if (freeBalance > 0) {\n uint256 result = cToken.mint(freeBalance);\n if (result > 0) {\n revert MintError(result);\n }\n }\n }\n\n /// @inheritdoc BaseStrategy\n /// @dev Tagged with the keyword \"virtual\" for testing purposes.\n function _liquidatePosition(uint256 assets)\n internal\n virtual\n override\n returns (uint256 liquidatedAmount, uint256 loss)\n {\n uint256 assetBalance = asset.balanceOf(address(this));\n if (assetBalance < assets) {\n uint256 deposits = depositedBalance();\n uint256 amountToRedeem = MathUpgradeable.min(deposits, assets);\n uint256 result = cToken.redeemUnderlying(amountToRedeem);\n if (result > 0) {\n revert RedeemError(result);\n }\n liquidatedAmount = amountToRedeem;\n loss = assets - liquidatedAmount;\n } else {\n liquidatedAmount = assets;\n }\n }\n\n /// @inheritdoc BaseStrategy\n function _liquidateAllPositions()\n internal\n override\n returns (uint256 amountFreed)\n {\n uint256 amountToRedeem = depositedBalance();\n uint256 result = cToken.redeemUnderlying(amountToRedeem);\n if (result > 0) {\n revert RedeemError(result);\n }\n amountFreed = amountToRedeem;\n }\n}\n" + }, + "src/strategies/BaseStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IStrategiesLender} from \"../lending/IStrategiesLender.sol\";\nimport {GelatoJobAdapter, IOps} from \"../automation/GelatoJobAdapter.sol\";\nimport {Job} from \"../automation/Job.sol\";\nimport {HealthChecker} from \"../healthcheck/HealthChecker.sol\";\nimport {PriceConverter} from \"../structures/PriceConverter.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror CallerIsNotALender();\nerror IncompatiblePriceFeeds();\n\nabstract contract BaseStrategy is\n IStrategy,\n SafeInitializable,\n GelatoJobAdapter,\n HealthChecker,\n PausableUpgradeable\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using PriceConverter for AggregatorV3Interface;\n\n IStrategiesLender public lender;\n IERC20Upgradeable public asset;\n\n /// @notice Use this to adjust the threshold at which running a debt causes a work trigger.\n uint256 public debtThreshold;\n\n /// @notice The estimated amount of gas required for the \"work\" execution.\n uint256 public estimatedWorkGas;\n\n /// @notice Shows how many times the gas price spent for the \"work\" function should be lower than the profit to trigger.\n uint256 public profitFactor;\n\n /// @notice The USD price feed for the native token of the network on which this strategy works.\n AggregatorV3Interface internal _nativeTokenPriceFeed;\n\n /// @notice The USD price feed for the strategy asset.\n AggregatorV3Interface internal _assetPriceFeed;\n\n /// @notice The underlying asset's decimals.\n uint256 internal _assetDecimals;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n event Harvested(\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 outstandingDebt\n );\n\n event DebtThresholdUpdated(uint256 debtThreshold);\n\n event EstimatedWorkGasUpdated(uint256 estimatedWorkGas);\n\n event UpdatedProfitFactor(uint256 profitFactor);\n\n modifier onlyLender() {\n if (msg.sender != address(lender)) {\n revert CallerIsNotALender();\n }\n _;\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __BaseStrategy_init(\n IStrategiesLender _lender,\n IERC20Upgradeable _asset,\n IOps _ops,\n uint256 _minReportInterval,\n bool _isPrepaid,\n AggregatorV3Interface __nativeTokenPriceFeed,\n AggregatorV3Interface __assetPriceFeed,\n address _healthCheck\n ) internal onlyInitializing {\n __HealthChecker_init(_healthCheck); // ownable under the hood\n __Pausable_init();\n __GelatoJobAdapter_init(_ops, _minReportInterval, _isPrepaid);\n\n __BaseStrategy_init_unchained(\n _lender,\n _asset,\n __nativeTokenPriceFeed,\n __assetPriceFeed\n );\n }\n\n function __BaseStrategy_init_unchained(\n IStrategiesLender _lender,\n IERC20Upgradeable _asset,\n AggregatorV3Interface __nativeTokenPriceFeed,\n AggregatorV3Interface __assetPriceFeed\n ) internal onlyInitializing {\n lender = _lender;\n asset = _asset;\n\n debtThreshold = 0;\n estimatedWorkGas = 0;\n profitFactor = 100;\n\n _nativeTokenPriceFeed = __nativeTokenPriceFeed;\n _assetPriceFeed = __assetPriceFeed;\n if (_nativeTokenPriceFeed.decimals() != _assetPriceFeed.decimals()) {\n revert IncompatiblePriceFeeds();\n }\n\n _assetDecimals = IERC20MetadataUpgradeable(address(asset)).decimals();\n\n approveTokenMax(address(asset), address(_lender));\n }\n\n /// @notice Harvests the strategy, recognizing any profits or losses and adjusting the strategy's investments.\n /// @inheritdoc Job\n function _work() internal override {\n uint256 profit = 0;\n uint256 loss = 0;\n uint256 debtPayment = 0;\n\n uint256 outstandingDebt = lender.outstandingDebt();\n if (paused()) {\n (profit, loss, debtPayment) = _harvestAfterShutdown(\n outstandingDebt\n );\n } else {\n (profit, loss, debtPayment) = _harvest(outstandingDebt);\n }\n\n if (profit > 0) {\n lender.reportPositiveDebtManagement(profit, debtPayment);\n } else {\n lender.reportNegativeDebtManagement(loss, debtPayment);\n }\n\n // If the strategy needs to repay the entire debt, we need to take all available funds.\n // We will take the current debt in the report above, but we still need to free up whatever is left.\n // This can happen, if the ratio is reduced to 0 or if the vault has been shutted down.\n outstandingDebt = lender.outstandingDebt();\n outstandingDebt = lender.currentDebtRatio() == 0 || lender.paused()\n ? estimatedTotalAssets()\n : outstandingDebt;\n\n _adjustPosition(outstandingDebt);\n\n uint256 totalDebt = lender.currentDebt();\n performHealthCheck(\n address(this),\n profit,\n loss,\n debtPayment,\n outstandingDebt,\n totalDebt\n );\n\n emit Harvested(profit, loss, debtPayment, outstandingDebt);\n }\n\n /// @inheritdoc Job\n function _canWork() internal view override returns (bool) {\n if (!lender.isActivated()) {\n return false;\n }\n\n // Trigger this job if the strategy has the outstanding debt to repay\n uint256 outstanding = lender.outstandingDebt();\n if (outstanding > debtThreshold) {\n return true;\n }\n\n // Trigger this job if the strategy has some loss to report\n uint256 total = estimatedTotalAssets();\n uint256 debt = lender.currentDebt();\n if (total + debtThreshold < debt) {\n return true;\n }\n\n // Estimate accumulated profit\n uint256 profit = 0;\n if (total > debt) {\n profit = total - debt;\n }\n\n // Check the gas cost againts the profit and available credit.\n // There is no sense to call the \"work\" function, if we don't have decent amount of funds to move.\n return _checkGasPriceAgainstProfit(profit);\n }\n\n /// @notice Calculates the gas price of this transaction and compares it againts the specified profit.\n /// @param profit Profit to be compared to the cost of gas.\n /// @return \"true\" if the gas price (mult. to \"profitFactor\" is lower than the strategy profit, in USD).\n function _checkGasPriceAgainstProfit(uint256 profit) internal view returns (bool) {\n uint256 credit = lender.availableCredit();\n uint256 gasCost = _gasPriceUSD() * estimatedWorkGas;\n return profitFactor * gasCost < _convertAmountToUSD(credit + profit);\n }\n\n /// @inheritdoc IStrategy\n function withdraw(uint256 assets) external override onlyLender returns (uint256 loss) { // Vault already have nonReentrant modifier check\n // Liquidate the requested amount of tokens\n uint256 amountFreed;\n (amountFreed, loss) = _liquidatePosition(assets);\n\n // Send it directly back to the vault\n IERC20Upgradeable(asset).safeTransfer(msg.sender, amountFreed);\n }\n\n /// @notice Shutdown the strategy and revoke it form the lender.\n function shutdown() external nonReentrant onlyOwner { // need check nonReentrant to avoid cyclic call\n _pause();\n lender.revokeStrategy(address(this));\n }\n\n /// @notice Sets the debt threshold.\n /// @param _debtThreshold The new debt threshold value.\n function setDebtThreshold(uint256 _debtThreshold) external onlyOwner {\n debtThreshold = _debtThreshold;\n emit DebtThresholdUpdated(_debtThreshold);\n }\n\n /// @notice Sets the estimated gas that will be required for \"work\" function.\n /// @param _estimatedWorkGas The estimated \"work\" gas value.\n function setEstimatedWorkGas(uint256 _estimatedWorkGas) external onlyOwner {\n estimatedWorkGas = _estimatedWorkGas;\n emit EstimatedWorkGasUpdated(_estimatedWorkGas);\n }\n\n /// @notice Sets the profit factor.\n /// @param _profitFactor The new profit factor value.\n function setProfitFactor(uint256 _profitFactor) external onlyOwner {\n profitFactor = _profitFactor;\n emit UpdatedProfitFactor(_profitFactor);\n }\n\n /// @notice Frees up as much funds of the base protocol as possible.\n /// @dev This function is called on harvest if the strategy was shutted down.\n /// @param outstandingDebt The outstanding debt of the strategy.\n function _harvestAfterShutdown(uint256 outstandingDebt)\n internal\n virtual\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n )\n {\n uint256 amountFreed = _liquidateAllPositions();\n if (amountFreed < outstandingDebt) {\n loss = outstandingDebt - amountFreed;\n } else if (amountFreed > outstandingDebt) {\n profit = amountFreed - outstandingDebt;\n }\n debtPayment = outstandingDebt - loss;\n }\n\n /// @notice Calculates the gas price of the current transaction (in USD).\n function _gasPriceUSD() internal view returns (uint256) {\n return _nativeTokenPriceFeed.convertAmount(tx.gasprice, 18);\n }\n\n /// @notice Calculates the pice of the specified amount of \"asset\" (in USD).\n function _convertAmountToUSD(uint256 amount)\n internal\n view\n returns (uint256)\n {\n return _assetPriceFeed.convertAmount(amount, _assetDecimals);\n }\n\n /// @notice Sets the max token allowance for the specified spender.\n function approveTokenMax(address token, address spender) internal {\n IERC20Upgradeable(token).safeApprove(spender, type(uint256).max);\n }\n\n /// @notice Estimates the total amount of strategy funds (including those invested in the base protocol).\n function estimatedTotalAssets() public view virtual returns (uint256);\n\n /// @notice The main function of the strategy.\n /// By calling this function, the strategy must realize (take out) the possible profits from the underlying protocol.\n function _harvest(uint256 outstandingDebt)\n internal\n virtual\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n );\n\n /// @notice Performs the deposit of the free funds to the underlying protocol.\n function _adjustPosition(uint256 outstandingDebt) internal virtual;\n\n /// @notice Withdraws the specific amount of \"asset\" from the underlying protocol.\n /// @param assets The amount of token to withdraw.\n /// @return liquidatedAmount Withdrawn amount\n /// @return loss The amount that could not be withdrawn\n function _liquidatePosition(uint256 assets)\n internal\n virtual\n returns (uint256 liquidatedAmount, uint256 loss);\n\n /// @notice Withdraws the entire invested amount from the underlying protocol.\n function _liquidateAllPositions()\n internal\n virtual\n returns (uint256 amountFreed);\n}\n" + }, + "src/strategies/CTokenBaseStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\n\nimport {ICInterestRate} from \"./protocols/ICInterestRate.sol\";\nimport {BaseStrategy, IOps} from \"./BaseStrategy.sol\";\nimport {ICToken} from \"./protocols/ICToken.sol\";\nimport {IRainMaker} from \"./protocols/IRainMaker.sol\";\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IStrategiesLender} from \"../lending/IStrategiesLender.sol\";\n\nerror IncompatibleCTokenContract();\nerror UnsupportedDecimals();\n\n/** Base for implementation of strategy on top of CToken (Compound-like market) */\nabstract contract CTokenBaseStrategy is ICInterestRate, BaseStrategy {\n\n /** Market on top of which strategy operates */\n ICToken public cToken;\n /** Contract which allow claim compToken reward */\n IRainMaker public rainMaker;\n /** Token which is used for reward, COMP for Compund */\n IERC20Upgradeable public compToken;\n\n /** Required for mapping of interest rate calculated per second to rate calculated per block */\n uint256 public secondPerBlock = 3;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __CTokenBaseStrategy_init(\n IStrategiesLender _lender,\n IERC20Upgradeable _asset,\n ICToken _cToken,\n IRainMaker _rainMaker,\n IERC20Upgradeable _compToken,\n IOps _ops,\n AggregatorV3Interface _nativeTokenPriceFeed,\n AggregatorV3Interface _assetPriceFeed,\n uint256 _minReportInterval,\n bool _isPrepaid\n ) public onlyInitializing {\n __BaseStrategy_init(\n _lender,\n _asset,\n _ops,\n _minReportInterval,\n _isPrepaid,\n _nativeTokenPriceFeed,\n _assetPriceFeed,\n address(0)\n ); // ownable under the hood\n\n __CTokenBaseStrategyinit_unchained(_cToken, _rainMaker, _compToken);\n }\n\n function __CTokenBaseStrategyinit_unchained(ICToken _cToken, IRainMaker _rainMaker, IERC20Upgradeable _compToken) internal onlyInitializing {\n cToken = _cToken;\n rainMaker = _rainMaker;\n compToken = _compToken;\n\n if (cToken.decimals() != 8 || _assetDecimals != 18) {\n revert UnsupportedDecimals();\n }\n\n if (cToken.underlying() != address(asset)) {\n revert IncompatibleCTokenContract();\n }\n\n approveTokenMax(address(asset), address(_cToken));\n }\n\n /// @notice Returns the current banana balance of the strategy contract.\n function _currentBananaBalance() internal view returns (uint256) {\n return compToken.balanceOf(address(this));\n }\n\n /// @notice Retrieves accrued BANANA from the protocol.\n function _claimBanana() internal {\n ICToken[] memory tokens = new ICToken[](1);\n tokens[0] = cToken;\n rainMaker.claimComp(address(this), tokens);\n }\n\n /// @inheritdoc IStrategy\n function interestRatePerBlock() public view returns (uint256) {\n return supplyRatePerBlock();\n }\n\n // ------------------------------------------ Pass interest related methods from cToken ------------------------------------------\n // Methods must be overridden by the strategy contract if they change interest rate model\n\n /// @inheritdoc ICInterestRate\n function borrowRatePerBlock() public view returns (uint256) {\n if (cToken.blocksBased()) {\n return cToken.borrowRatePerBlock();\n }\n\n // in this case \"PerBlock\" actually means \"PerSecond\"\n return cToken.borrowRatePerBlock() / secondPerBlock;\n }\n\n /// @inheritdoc ICInterestRate\n function supplyRatePerBlock() public view returns (uint256) {\n if (cToken.blocksBased()) {\n return cToken.supplyRatePerBlock();\n }\n\n // in this case \"PerBlock\" actually means \"PerSecond\"\n return cToken.supplyRatePerBlock() / secondPerBlock;\n }\n\n /// @inheritdoc ICInterestRate\n function exchangeRateCurrent() public returns (uint256) {\n return cToken.exchangeRateCurrent();\n }\n\n /// @inheritdoc ICInterestRate\n function exchangeRateStored() public view returns (uint256) {\n return cToken.exchangeRateStored();\n }\n\n /// @inheritdoc ICInterestRate\n function accrueInterest() public returns (uint256) {\n return cToken.accrueInterest();\n }\n}" + }, + "src/strategies/IStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IStrategiesLender} from \"../lending/IStrategiesLender.sol\";\n\ninterface IStrategy {\n /// @notice Returns the name of this strategy.\n function name() external view returns (string memory);\n\n /// @notice Returns the contract address of the underlying asset of this strategy.\n function asset() external view returns (IERC20Upgradeable);\n\n /// @notice Returns the contract address of the Lender to which this strategy is connected.\n function lender() external view returns (IStrategiesLender);\n\n /// @notice Transfers a specified amount of tokens to the vault.\n /// @param assets A amount of tokens to withdraw.\n /// @return loss A number of tokens that the strategy could not return.\n function withdraw(uint256 assets) external returns (uint256 loss);\n\n /// @notice Returns interst rate of strategy per block, for current block or block prior to this one.\n /// @dev Can be calculated not for all strategies and usally not such accurate as sliding window averages,\n /// but still can be usafull for on chain calculations and as fallback method.\n /// @return The interest rate per block, scaled by 1e18\n function interestRatePerBlock() external view returns (uint256);\n}\n" + }, + "src/strategies/protocols/ICInterestRate.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @notice Interest related CToken methods of Compound-like market (or vault in common terms), that allows current APY/APR related meth.\ninterface ICInterestRate {\n /**\n * @notice Returns the current per-block borrow interest rate for this cToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() external view returns (uint256);\n\n /**\n * @notice Returns the current per-block supply interest rate for this cToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() external view returns (uint256);\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() external returns (uint256);\n\n /**\n * @notice Calculates the exchange rate from the underlying to the CToken\n * @dev This function does not accrue interest before calculating the exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateStored() external view returns (uint256);\n\n /**\n * @notice Applies accrued interest to total borrows and reserves\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage.\n */\n function accrueInterest() external returns (uint256);\n}" + }, + "src/strategies/protocols/ICToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ICInterestRate} from \"./ICInterestRate.sol\";\n\n/// @notice Interface for Compound-like market (or vault in common terms), that allows to deposit and borrow tokens.\ninterface ICToken is ICInterestRate {\n\n /** \n * Indicates if the calculations should be blocks or time based\n * @notice Specific for Ola Finance\n */\n function blocksBased() external view returns (bool);\n\n function decimals() external view returns (uint8);\n\n function underlying() external view returns (address);\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external returns (uint256);\n\n function getAccountSnapshot(address account)\n external\n view\n returns (\n uint256,\n uint256,\n uint256,\n uint256\n );\n\n function totalBorrowsCurrent() external returns (uint256);\n\n function borrowBalanceCurrent(address account) external returns (uint256);\n\n function borrowBalanceStored(address account)\n external\n view\n returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount)\n external\n returns (uint256);\n\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n ICToken cTokenCollateral\n ) external returns (uint256);\n}\n" + }, + "src/strategies/protocols/IPancakeRouter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @notice Interface for Uniswap-like exchange router.\ninterface IPancakeRouter {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n}\n" + }, + "src/strategies/protocols/IRainMaker.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ICToken} from \"./ICToken.sol\";\n\n/// @notice Interface for a compound-like controller used to control incentivized tokens received during interaction with the protocol.\ninterface IRainMaker {\n struct CompMarketState {\n /// @notice The market's last updated compBorrowIndex or compSupplyIndex\n uint224 index;\n /// @notice The block number the index was last updated at\n uint32 block;\n }\n\n function compSupplierIndex(address, address)\n external\n view\n returns (uint256);\n\n function compSpeeds(address cToken) external view returns (uint256);\n\n function compSupplySpeeds(address cToken) external view returns (uint256);\n\n function compBorrowSpeeds(address cToken) external view returns (uint256);\n\n function claimComp(address holder, ICToken[] memory cTokens) external;\n\n function claimComp(address holder) external;\n\n function compAccrued(address holder) external view returns (uint256);\n\n function compSupplyState(address cToken)\n external\n view\n returns (CompMarketState memory);\n}\n" + }, + "src/structures/AddressList.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nerror ListsDoNotMatch();\n\nlibrary AddressList {\n /// @notice Adds an address to the list.\n /// @param list the list of addresses.\n /// @param addr the address to add.\n function add(address[] storage list, address addr) internal {\n list.push(addr);\n }\n\n /// @notice Checks if the list contains the specified item.\n /// @param list the list of addresses.\n /// @param addr the address to find.\n function contains(address[] storage list, address addr)\n internal\n view\n returns (bool)\n {\n for (uint256 i = 0; i < list.length; i++) {\n if (list[i] == addr) {\n return true;\n }\n }\n return false;\n }\n\n /// @notice Removes an address from the list and fills the gap with the following items by moving them up.\n /// @param list the list of addresses.\n /// @param addr the address to remove.\n /// @return A boolean value that indicates if the address was found and removed from the list.\n function remove(address[] storage list, address addr)\n internal\n returns (bool)\n {\n bool addressFound;\n for (uint256 i = 0; i < list.length; i++) {\n if (list[i] == addr) {\n addressFound = true;\n }\n if (addressFound && i < list.length - 1) {\n list[i] = list[i + 1];\n }\n }\n if (addressFound) {\n list.pop();\n }\n return addressFound;\n }\n\n /// @notice Checks if the list can be reordered in the specified way.\n /// @param list the list of addresses.\n /// @param reoderedList the desired reordered list, which must have the same content as the existing list.\n /// @return A reordered list\n function reorder(address[] storage list, address[] memory reoderedList)\n internal\n view\n returns (address[] memory)\n {\n uint256 length = list.length;\n if (length != reoderedList.length) {\n revert ListsDoNotMatch();\n }\n for (uint256 i = 0; i < length; i++) {\n address existingAddress = list[i];\n for (uint256 j = 0; j < length; j++) {\n // Address is found, move to the next item\n if (existingAddress == reoderedList[j]) {\n break;\n }\n // If this is the last iteration, then the address is not found\n if (j == length - 1) {\n revert ListsDoNotMatch();\n }\n }\n }\n return reoderedList;\n }\n}\n" + }, + "src/structures/PriceConverter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\nimport {SafeMathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\";\n\nerror NegativePrice();\n\nlibrary PriceConverter {\n using SafeMathUpgradeable for uint256;\n\n uint256 public constant UP_TO_DECIMALS = 18;\n\n /// @notice Calculates the price of the specified number of tokens.\n /// @dev This function converts the specified number of tokens to their price (scaled to 18 decimal places).\n /// @param priceFeed The Chainlink's price feed aggregator.\n /// @param amount Number of tokens, the value of which needs to be calculated.\n /// @param decimals Decimals of the specified token.\n /// @return The calculated price of the tokens.\n function convertAmount(\n AggregatorV3Interface priceFeed,\n uint256 amount,\n uint256 decimals\n ) internal view returns (uint256) {\n (, int256 price, , , ) = priceFeed.latestRoundData();\n if (price < 0) {\n revert NegativePrice();\n }\n\n // Scaling decimals up to 18 places to increase accuracy.\n // For example, the \"USD\" price feed has 8 decimal places, so the calculation may result in zeros if a small [amount] is passed.\n uint256 priceDecimals = priceFeed.decimals();\n (, uint256 priceScaledDecimals) = UP_TO_DECIMALS.trySub(priceDecimals);\n uint256 scaledPrice = uint256(price) * 10**priceScaledDecimals;\n\n return amount * scaledPrice / 10**decimals;\n }\n}\n" + }, + "src/tokens/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {ERC777Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport {IERC4626} from \"./IERC4626.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\n/// @title ERC4626 upgradable tokenized Vault implementation based on ERC-777.\n/// More info in [EIP](https://eips.ethereum.org/EIPS/eip-4626)\n/// Based on Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/mixins/ERC4626.sol)\n///\n/// ERC-777 and ERC-20 tokens represent \"shares\"\n/// Vault “shares” which represent a claim to ownership on a fraction of the Vault’s underlying holdings.\n/// -\n/// @notice Rationale\n/// The mint method was included for symmetry and feature completeness.\n/// Most current use cases of share-based Vaults do not ascribe special meaning to the shares\n/// such that a user would optimize for a specific number of shares (mint)\n/// rather than specific amount of underlying (deposit).\n/// However, it is easy to imagine future Vault strategies which would have unique\n/// and independently useful share representations.\n/// The convertTo functions serve as rough estimates that do not account for operation specific details\n/// like withdrawal fees, etc. They were included for frontends and applications that need an average\n/// value of shares or assets, not an exact value possibly including slippage or other fees.\n/// For applications that need an exact value that attempts to account for fees and slippage we have\n/// included a corresponding preview function to match each mutable function.\n/// These functions must not account for deposit or withdrawal limits, to ensure they are easily composable,\n/// the max functions are provided for that purpose.\nabstract contract ERC4626Upgradeable is\n SafeInitializable,\n ERC777Upgradeable,\n ReentrancyGuardUpgradeable,\n IERC4626\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using FixedPointMathLib for uint256;\n\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n IERC20Upgradeable public asset;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n /**\n * Constructor for the ERC4626Upgradeable contract\n * @param _asset which will be stored in this Vault\n * @dev `defaultOperators` may be an empty array.\n */\n function __ERC4626_init(\n IERC20Upgradeable _asset,\n string memory name_,\n string memory symbol_,\n address[] memory defaultOperators_\n ) internal onlyInitializing {\n __ERC777_init(name_, symbol_, defaultOperators_);\n __ReentrancyGuard_init();\n\n __ERC4626_init_unchained(_asset);\n }\n\n /**\n * Unchained constructor for the ERC4626Upgradeable contract, without parents contracts init\n * @param _asset which will be stored in this Vault\n */\n function __ERC4626_init_unchained(IERC20Upgradeable _asset)\n internal\n onlyInitializing\n {\n asset = _asset;\n }\n\n /* ///////////////////////////// DEPOSIT / WITHDRAWAL ///////////////////////////// */\n\n /// @notice Mints Vault shares to receiver by depositing exactly amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage,\n /// the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function deposit(uint256 assets, address receiver)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n shares = previewDeposit(assets);\n // Check for rounding error since we round down in previewDeposit.\n require(shares != 0, \"Given assets result in 0 shares.\");\n\n _receiveAndDeposit(assets, shares, receiver);\n }\n\n /// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function mint(uint256 shares, address receiver)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n // No need to check for rounding error, previewMint rounds up.\n assets = previewMint(shares);\n\n _receiveAndDeposit(assets, shares, receiver);\n }\n\n /// @notice Base deposit logic which common for public deposit and mint function\n /// Trasfer assets from sender and mint shares for receiver\n function _receiveAndDeposit(\n uint256 assets,\n uint256 shares,\n address receiver\n ) internal {\n // cases when msg.sender != receiver are error prone\n // but they are allowed by the standard... we need take care of it ourselves\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares, \"\", \"\");\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n /// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n /// - emit the Withdraw event.\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\n /// - support a withdraw flow where the shares are burned from owner directly where msg.sender\n /// has ERC-20 approval over the shares of owner.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the withdraw execution, and are accounted for during withdraw.\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual nonReentrant returns (uint256 shares) {\n // No need to check for rounding error, previewWithdraw rounds up.\n shares = previewWithdraw(assets);\n\n _withdrawAndSend(assets, shares, receiver, owner);\n }\n\n /// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n /// - emit the Withdraw event.\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\n /// - support a redeem flow where the shares are burned from owner directly where msg.sender\n /// has ERC-20 approval over the shares of owner.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the redeem execution, and are accounted for during redeem.\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual nonReentrant returns (uint256 assets) {\n assets = previewRedeem(shares);\n // Check for rounding error since we round down in previewRedeem.\n require(assets != 0, \"Given shares result in 0 assets.\");\n\n _withdrawAndSend(assets, shares, receiver, owner);\n }\n\n /// @notice Burn owner shares and send tokens to receiver.\n function _withdrawAndSend(\n uint256 assets,\n uint256 shares,\n address receiver,\n address owner\n ) internal {\n // cases when msg.sender != receiver != owner is error prune\n // but they allowed by standard... take care of it by self\n if (msg.sender != owner) {\n _spendAllowance(owner, msg.sender, shares);\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares, \"\", \"\");\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /* ///////////////////////////// ACCOUNTING ///////////////////////////// */\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block,\n /// given current on-chain conditions.\n /// - return as close to and no more than the exact amount of Vault shares that would be minted\n /// in a deposit call in the same transaction.\n /// I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction.\n /// - NOT account for deposit limits like those returned from maxDeposit\n /// and should always act as though the deposit would be accepted,\n /// regardless if the user has enough tokens approved, etc.\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n /// - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert.\n /// Note that any unfavorable discrepancy between convertToShares and previewDeposit\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by depositing.\n function previewDeposit(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n return convertToShares(assets);\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block,\n /// given current on-chain conditions.\n /// - return as close to and no fewer than the exact amount of assets that would be deposited\n /// in a mint call in the same transaction.\n /// I.e. mint should return the same or fewer assets as previewMint if called in the same transaction.\n /// - NOT account for mint limits like those returned from maxMint\n /// and should always act as though the mint would be accepted,\n /// regardless if the user has enough tokens approved, etc.\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause mint to revert.\n /// Note that any unfavorable discrepancy between convertToAssets and previewMint\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by minting.\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return shares;\n }\n\n return shares.mulDivUp(totalAssets(), supply);\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal\n /// at the current block, given current on-chain conditions.\n /// - return as close to and no fewer than the exact amount of Vault shares\n /// that would be burned in a withdraw call in the same transaction.\n /// I.e. withdraw should return the same or fewer shares as previewWithdraw\n /// if called in the same transaction.\n /// - NOT account for withdrawal limits like those returned from maxWithdraw\n /// and should always act as though the withdrawal would be accepted,\n /// regardless if the user has enough shares, etc.\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause withdraw to revert.\n /// Note that any unfavorable discrepancy between convertToShares and previewWithdraw\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by depositing.\n function previewWithdraw(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return assets;\n }\n return assets.mulDivUp(supply, totalAssets());\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their\n /// redeemption at the current block, given current on-chain conditions.\n /// - return as close to and no more than the exact amount of assets that would be withdrawn\n /// in a redeem call in the same transaction.\n /// I.e. redeem should return the same or more assets as previewRedeem\n /// if called in the same transaction.\n /// - NOT account for redemption limits like those returned from maxRedeem\n /// and should always act as though the redemption would be accepted,\n /// regardless if the user has enough shares, etc.\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause redeem to revert.\n /// Note that any unfavorable discrepancy between convertToAssets and previewRedeem\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by redeeming.\n function previewRedeem(uint256 shares)\n public\n view\n virtual\n returns (uint256)\n {\n return convertToAssets(shares);\n }\n\n /// @notice The amount of shares that the Vault would exchange for the amount of assets provided,\n /// in an ideal scenario where all the conditions are met.\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\n /// - do NOT show any variations depending on the caller.\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\n /// - round down towards 0.\n /// This calculation MAY NOT reflect the “per-user” price-per-share,\n /// and instead should reflect the “average-user’s” price-per-share,\n /// meaning what the average user should expect to see when exchanging to and from.\n function convertToShares(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return assets;\n }\n\n return assets.mulDivDown(supply, totalAssets());\n }\n\n /// @notice The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\n /// - do NOT show any variations depending on the caller.\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\n /// - round down towards 0.\n /// This calculation MAY NOT reflect the “per-user” price-per-share,\n /// and instead should reflect the “average-user’s” price-per-share,\n /// meaning what the average user should expect to see when exchanging to and from.\n function convertToAssets(uint256 shares)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return shares;\n }\n\n return shares.mulDivDown(totalAssets(), supply);\n }\n\n /// @notice Total amount of the underlying asset that is “managed” by Vault.\n /// - include any compounding that occurs from yield.\n /// - inclusive of any fees that are charged against assets in the Vault.\n /// - is NOT revert\n /// @dev Must be implemented by child contract.\n function totalAssets() public view virtual returns (uint256);\n\n /* //////////////////////////////// DEPOSIT / WITHDRAWAL LIMIT //////////////////////////////// */\n\n /// @notice Maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n /// through a deposit call.\n /// - returns the maximum amount of assets deposit would allow to be deposited\n /// for receiver and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\n /// - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /// @notice Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call.\n /// - return the maximum amount of shares mint would allow to be deposited to receiver\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\n /// - factor in both global and user-specific limits,\n /// like if mints are entirely disabled (even temporarily) it MUST return 0.\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /// @notice Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault,\n /// through a withdraw call.\n /// - return the maximum amount of assets that could be transferred from owner through withdraw\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// - factor in both global and user-specific limits,\n /// like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf(owner));\n }\n\n /// @notice Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n /// through a redeem call.\n /// - return the maximum amount of shares that could be transferred from owner through redeem\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// - factor in both global and user-specific limits,\n /// like if redemption is entirely disabled (even temporarily) it MUST return 0.\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf(owner);\n }\n\n /* //////////////////////////////// INTERNAL HOOKS //////////////////////////////// */\n\n /// @notice Called before withdraw will be made the Vault.\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\n\n /// @notice Called when a deposit is made to the Vault.\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\n}\n" + }, + "src/tokens/ERC5484Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {ERC721EnumerableUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\nimport {ERC721URIStorageUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {IAccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {CountersUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport {IERC5484} from \"./IERC5484.sol\";\n\ncontract ERC5484Upgradeable is\n IERC5484,\n Initializable,\n ERC721Upgradeable,\n ERC721EnumerableUpgradeable,\n ERC721URIStorageUpgradeable,\n AccessControlUpgradeable\n{\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n // @dev utility object for counting tokens\n CountersUpgradeable.Counter private _tokenIdCounter;\n\n /// @dev burn mode with different behavior\n BurnAuth private _burnAuth;\n\n /// @dev Token can me minted only once per user\n bool private _mintOnce;\n\n /// @dev Role for minting tokens\n /// value is 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n /// @dev Role for burning tokens which can be used only if _burnAuth isn't BurnAuth.None\n /// value is 0x3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n /// @dev Modifier to protect a burn a token without permission\n modifier allowedTransfer(address to, address from, uint256 tokenId) {\n bool isMint = from == address(0);\n bool isBurner = hasRole(BURNER_ROLE, msg.sender);\n bool isBurn = !isMint && to == address(0);\n if(_burnAuth == BurnAuth.Neither) {\n // nobody can burn token\n require(isMint, \"ERC5484: can't be transferred\");\n } else if(_burnAuth == BurnAuth.IssuerOnly) {\n // only issuer can burn token\n // so we are checking if token is generation with condition from == address(0)\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\n bool isBurnOperation = isBurner && isBurn;\n require(isMint || isBurnOperation, \"ERC5484: can't be transferred\");\n } else if (_burnAuth == BurnAuth.OwnerOnly){\n // only owner can burn token\n // so we are checking if token is generation with condition from == ownerOf(tokenId) and it is burn operation\n bool isOwner = _ownerOf(tokenId) == msg.sender && hasRole(BURNER_ROLE, msg.sender);\n require(isMint || (isOwner && isBurn), \"ERC5484: can't be transferred\");\n } else if (_burnAuth == BurnAuth.Both) {\n // both owner and issuer can burn token\n // so we are checking if token is minting with condition from == address(0)\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\n require(isMint || (isBurn && isBurner), \"ERC5484: can't be transferred\");\n }\n _;\n }\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n function __ERC5484Upgradeable_init(\n string memory name_,\n string memory symbol_,\n BurnAuth burnAuth_,\n bool mintOnce_\n ) internal onlyInitializing {\n __ERC721_init(name_, symbol_);\n __ERC721Enumerable_init();\n __ERC721URIStorage_init();\n __AccessControl_init();\n _burnAuth = burnAuth_;\n _mintOnce = mintOnce_;\n\n // setup roles depend on mode for SoulBound token\n _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\n }\n\n /// @dev function for mint new SBT token\n /// @param to address of user who will receive token\n /// @param uri token metadata uri\n /// @return true if token was minted\n function safeMint(address to, string memory uri)\n public\n virtual\n onlyRole(MINTER_ROLE)\n returns(bool)\n {\n // allow to mint only once per user if _mintOnce is true\n if(_mintOnce && balanceOf(to) != 0) {\n return false;\n }\n\n // mint token\n uint256 tokenId = _tokenIdCounter.current();\n _tokenIdCounter.increment();\n _safeMint(to, tokenId);\n _setTokenURI(tokenId, uri);\n\n // set permission to burn token\n if(_burnAuth == BurnAuth.OwnerOnly || _burnAuth == BurnAuth.Both) {\n _setupRole(BURNER_ROLE, to);\n }\n\n // emit event\n emit Issued(address(0), to, tokenId, _burnAuth);\n return true;\n }\n\n /// @dev Token is SOUL BOUND and it is not allowed to move token between users\n function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)\n internal\n virtual\n allowedTransfer(to, from, tokenId)\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\n {\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\n }\n\n /// @dev Burns `tokenId`. See {ERC721-_burn}.\n function burn(uint256 tokenId) external\n onlyRole(BURNER_ROLE)\n virtual\n {\n _burn(tokenId);\n }\n\n /// @dev See {ERC721-_burn}\n function _burn(uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable){\n super._burn(tokenId);\n }\n\n /// @dev See {IERC721Metadata-tokenURI}.\n function tokenURI(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable)\n returns (string memory)\n {\n return super.tokenURI(tokenId);\n }\n\n /// @dev See {IERC165-supportsInterface}.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable, AccessControlUpgradeable)\n virtual\n returns (bool)\n {\n return interfaceId == type(IERC5484).interfaceId\n || interfaceId == type(IAccessControlUpgradeable).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /// @notice provides burn authorization of the token id.\n /// @dev unassigned tokenIds are invalid, and queries do throw\n /// @param tokenId The identifier for a token.\n function burnAuth(uint256 tokenId) external view virtual returns (BurnAuth){\n require(_exists(tokenId), \"ERC5484: token doesn't exists\");\n return _burnAuth;\n }\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[48] private __gap;\n}" + }, + "src/tokens/IERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n */\ninterface IERC4626 {\n\n /* ///////////////////////////// EVENTS ///////////////////////////// */\n\n /// `sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`.\n /// emitted when tokens are deposited into the Vault via the mint and deposit methods.\n event Deposit(\n address indexed caller,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /// `sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`.\n /// emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\n * Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\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 (IERC20Upgradeable);\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 redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n" + }, + "src/tokens/IERC5484.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface IERC5484 {\n /// A guideline to standardlize burn-authorization's number coding\n enum BurnAuth {\n IssuerOnly,\n OwnerOnly,\n Both,\n Neither\n }\n\n /// @notice Emitted when a soulbound token is issued.\n /// @dev This emit is an add-on to nft's transfer emit in order to distinguish sbt\n /// from vanilla nft while providing backward compatibility.\n /// @param from The issuer\n /// @param to The receiver\n /// @param tokenId The id of the issued token\n event Issued (\n address indexed from,\n address indexed to,\n uint256 indexed tokenId,\n BurnAuth burnAuth\n );\n\n /// @notice provides burn authorization of the token id.\n /// @dev unassigned tokenIds are invalid, and queries do throw\n /// @param tokenId The identifier for a token.\n function burnAuth(uint256 tokenId) external view returns (BurnAuth);\n}" + }, + "src/tokens/IVaultFounderToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport {IERC721MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\nimport {IERC721EnumerableUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\";\nimport {IERC5484} from \"./IERC5484.sol\";\n\n/// @title ERC721 complient Token interface\ninterface IVaultFounderToken is\n IERC5484,\n IERC721Upgradeable,\n IERC721MetadataUpgradeable,\n IERC721EnumerableUpgradeable\n{\n /// @dev implementation for calculate price for the next token based on\n /// the current sequential token id\n function priceOf(uint256 tokenId) external view returns (uint256);\n /// @dev calculate price for the next token\n function nextTokenPrice() external view returns (uint256);\n /// @dev set token metadata uri\n /// can be used as utility method and custom logic on front-end\n function setTokenURI(string memory _tokenURI) external;\n /// @dev set token metadata uri\n /// can be used as utility method and custom logic on front-end by owner of the contract\n /// in case of end user has a wrong uri or somebody corrupted it\n function setTokenURI(string memory _tokenURI, uint256 tokenId) external;\n}" + }, + "src/tokens/IVaultHook.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\n\n/// @title ERC4626 Vault Token lifecycle hook interface\ninterface IVaultHook {\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request) external;\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external;\n}\n\nstruct ERC4626UpgradeableRequest {\n /// @dev The amount of assets to be deposited.\n uint256 assets;\n\n /// @dev The amount of shares to be minted.\n uint256 shares;\n\n /// @dev The address that initiated the request.\n address requestSender;\n\n /// @dev The amount of assets the sender is allowed to withdraw.\n uint256 senderMaxWithdraw;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[46] gap;\n}" + }, + "src/tokens/RewardHolder.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\nimport {Vault} from \"../Vault.sol\";\n\ncontract RewardHolder is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable {\n using FixedPointMathLib for uint256;\n\n /// @notice Emitted reward is claimed by a token owner\n event RewardClaimed(uint256 reward, address receiver);\n /// @notice Emitted when new rewards are deposited\n event RewardDeposited(address sender, uint value);\n\n /// @notice Accumulator of the total earned interest rate since the opening of the token\n uint public rewardIndex = 1e8;\n\n /// @notice The owners' reward indexes for eachas of the last time they accrued\n mapping(address => uint) public rewardOwnerIndex;\n\n /// @notice\n uint16 public numberCoins;\n\n Vault public vault;\n\n // 0xbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb7716\n bytes32 public constant BALANCE_UPDATER_ROLE = keccak256(\"BALANCE_UPDATE_ROLE\");\n // 0x350f4eb58665205037e4a10647f66a623dc93281f72575646a8f0c90d88b72ae\n bytes32 public constant REWARD_CLAIMER_ROLE = keccak256(\"REWARD_CLAIMER_ROLE\");\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n function __RewardHolder_init() internal onlyInitializing {\n __AccessControl_init();\n _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\n __ReentrancyGuard_init();\n }\n\n /// @dev set vault\n /// @notice that is mandatory to be set before reward can be claimed\n function setVault(Vault vault_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n vault = vault_;\n }\n\n /// @dev deposit reward to the contract to be claimed by token owners\n /// @notice only role with BALANCE_UPDATER_ROLE can call this function\n /// @param plusReward amount of reward to be deposited\n function depositReward(uint256 plusReward) public onlyRole(BALANCE_UPDATER_ROLE) nonReentrant {\n // update reward index for claim reward logic\n rewardIndex += plusReward;\n emit RewardDeposited(_msgSender(), plusReward);\n }\n\n /// @dev claim reward for token owner\n function claimReward() external nonReentrant {\n require(vault != Vault(address(0)), \"Vault not set.\");\n\n require(rewardOwnerIndex[msg.sender] != 0, \"Caller doesn't have reward.\");\n\n uint deltaIndex = rewardIndex - rewardOwnerIndex[msg.sender];\n\n // calculate reward for token owner\n //todo discuss the proper calculation mechanism\n uint256 tokenOwnerReward = deltaIndex.mulDivDown(1, numberCoins);\n rewardOwnerIndex[msg.sender] = rewardIndex;\n\n // transfer reward to token owner\n vault.transfer(msg.sender, tokenOwnerReward);\n emit RewardClaimed(tokenOwnerReward, address(msg.sender));\n }\n\n /// @dev setup new owner for reward usually called when minting new token\n function setupNewOwner(address rewardOwner) internal virtual onlyRole(BALANCE_UPDATER_ROLE) {\n rewardOwnerIndex[rewardOwner] = rewardIndex;\n numberCoins++;\n }\n}" + }, + "src/tokens/SafeERC4626Lifecycle.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC4626Upgradeable} from \"./SafeERC4626Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\nimport {IVaultHook, ERC4626UpgradeableRequest} from \"./IVaultHook.sol\";\n\nabstract contract SafeERC4626Lifecycle is SafeERC4626Upgradeable {\n // list of hooks\n IVaultHook[] public withdrawHooks;\n IVaultHook[] public depositHooks;\n\n /// @dev Adds hook to the list of deposit hooks\n function addDepositHook(IVaultHook hook) internal {\n depositHooks.push(hook);\n }\n\n /// @dev Adds hook to the list of withdraw hooks\n function addWithdrawHook(IVaultHook hook) internal {\n withdrawHooks.push(hook);\n }\n\n /// @dev Removes hook from the list of deposit hooks\n function removeDepositHook(IVaultHook hook) internal {\n // find hook\n for (uint256 i = 0; i < depositHooks.length; i++)\n {\n if (depositHooks[i] == hook)\n {\n // remove hook\n depositHooks[i] = depositHooks[depositHooks.length - 1];\n depositHooks.pop();\n return;\n }\n }\n }\n\n /// @dev Removes hook from the list of withdraw hooks\n function removeWithdrawHook(IVaultHook hook) internal {\n // find hook\n for (uint256 i = 0; i < withdrawHooks.length; i++)\n {\n if (withdrawHooks[i] == hook)\n {\n // remove hook\n withdrawHooks[i] = withdrawHooks[withdrawHooks.length - 1];\n withdrawHooks.pop();\n return;\n }\n }\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function beforeWithdraw(uint256 assets, uint256 shares)\n internal virtual override(ERC4626Upgradeable)\n {\n // if there are no hooks, then return to save gas\n if(withdrawHooks.length == 0) {\n return;\n }\n uint256[46] memory gap_; // this is needed for future upgrades\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\n assets: assets,\n shares: shares,\n requestSender: msg.sender,\n senderMaxWithdraw: maxWithdraw(msg.sender),\n gap: gap_\n });\n // iterate over hooks and call it\n for (uint256 i = 0; i < withdrawHooks.length; i++)\n {\n IVaultHook hook = withdrawHooks[i];\n hook.beforeWithdrawTrigger(request);\n }\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function afterDeposit(uint256 assets, uint256 shares)\n internal virtual override(ERC4626Upgradeable)\n {\n // if there are no depositHooks, then return to save gas\n if(depositHooks.length == 0) {\n return;\n }\n uint256[46] memory gap_; // this is needed for future upgrades\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\n assets: assets,\n shares: shares,\n requestSender: msg.sender,\n senderMaxWithdraw: maxWithdraw(msg.sender),\n gap: gap_\n });\n // iterate over depositHooks and call it\n for (uint256 i = 0; i < depositHooks.length; i++)\n {\n IVaultHook hook = depositHooks[i];\n hook.afterDepositTrigger(request);\n }\n }\n}" + }, + "src/tokens/SafeERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\n\n/// @title Safier and limited implementation of ERC-4626\n/// @notice ERC-4626 standard allow deposit and withdraw not for message sender.\n/// It commonly known issue, which hardly to test and much error prune.\n/// Such interfaces caused vulnarabilities, which resulted in million dollars hacks.\n/// On anther hand, this interfaces not have any use cases which cannot be implemented without `transferFrom` method.\n/// This implementation prevent spends and allowances from any methods except transferFrom/send\n/// Also main business logic simplified to reduce gas consumption.\nabstract contract SafeERC4626Upgradeable is ERC4626Upgradeable {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using FixedPointMathLib for uint256;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * Constructor for the SafeERC4626Upgradeable contract\n * @param _asset which will be stored in this Vault\n * @dev `defaultOperators` may be an empty array.\n */\n function __SafeERC4626_init(\n IERC20Upgradeable _asset,\n string memory name_,\n string memory symbol_,\n address[] memory defaultOperators_\n ) internal onlyInitializing {\n __ERC4626_init(_asset, name_, symbol_, defaultOperators_);\n }\n\n /**\n * Unchained constructor for the SafeERC4626Upgradeable contract, without parents contracts init\n * @param _asset which will be stored in this Vault\n */\n function __SafeERC4626Upgradeable_init_unchained(IERC20Upgradeable _asset)\n internal\n onlyInitializing\n {\n __ERC4626_init_unchained(_asset);\n }\n\n /// @notice Mints the Vault shares for msg.sender, according to the number of deposited base tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function deposit(uint256 assets)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n shares = previewDeposit(assets);\n // Check for rounding error since we round down in previewDeposit.\n require(shares != 0, \"Given assets result in 0 shares.\");\n\n _receiveAndDeposit(assets, shares, msg.sender);\n }\n\n /// @notice Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function mint(uint256 shares)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n // No need to check for rounding error, previewMint rounds up.\n assets = previewMint(shares);\n\n _receiveAndDeposit(assets, shares, msg.sender);\n }\n\n /// @notice Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender.\n /// - emit the Withdraw event.\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the withdraw execution, and are accounted for during withdraw.\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function withdraw(uint256 assets)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n // No need to check for rounding error, previewWithdraw rounds up.\n shares = previewWithdraw(assets);\n\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\n }\n\n /// @notice Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender.\n /// - emit the Withdraw event.\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the redeem execution, and are accounted for during redeem.\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function redeem(uint256 shares)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n assets = previewRedeem(shares);\n // Check for rounding error since we round down in previewRedeem.\n require(assets != 0, \"Given shares result in 0 assets.\");\n\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\n }\n\n /* //////////////////// Backwards compatible methods ////////////////////////// */\n\n /// @inheritdoc ERC4626Upgradeable\n function deposit(\n uint256 assets,\n address /* receiver */\n ) public virtual override returns (uint256 shares) {\n // nonReentrant under the hood\n return deposit(assets);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function mint(\n uint256 shares,\n address /* receiver */\n ) public virtual override returns (uint256 assets) {\n // nonReentrant under the hood\n return mint(shares);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function withdraw(\n uint256 assets,\n address, /* receiver */\n address /* owner */\n ) public virtual override returns (uint256 shares) {\n // nonReentrant under the hood\n return withdraw(assets);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function redeem(\n uint256 shares,\n address, /* receiver */\n address /* owner */\n ) public virtual override returns (uint256 assets) {\n // nonReentrant under the hood\n return redeem(shares);\n }\n}\n" + }, + "src/tokens/VaultFounderToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {IERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {ERC721URIStorageUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"../upgradeable/SafeUUPSUpgradeable.sol\";\nimport {IVersionable} from \"../upgradeable/IVersionable.sol\";\nimport {ERC5484Upgradeable} from \"./ERC5484Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\nimport {IVaultFounderToken} from \"./IVaultFounderToken.sol\";\nimport {IVaultHook, ERC4626UpgradeableRequest} from \"./IVaultHook.sol\";\nimport {RewardHolder} from \"./RewardHolder.sol\";\n\ncontract VaultFounderToken is IVaultFounderToken, SafeUUPSUpgradeable, ERC5484Upgradeable, IVaultHook, RewardHolder {\n\n // Max number of tokens that can be minted\n uint256 private _maxCountTokens;\n\n // Next token price multiplier in percents\n uint256 private _nextTokenPriceMultiplier;\n\n // Initial token price\n uint256 private _initialTokenPrice;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[46] private __gap;\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n uint256 maxCountTokens_,\n uint256 nextTokenPriceMultiplier_,\n uint256 initialTokenPrice_\n ) public initializer {\n __SafeUUPSUpgradeable_init_direct();\n __ERC5484Upgradeable_init(\"Eonian Vault Founder Token\", \"EVFT\", BurnAuth.Neither, true);\n __RewardHolder_init();\n _maxCountTokens = maxCountTokens_;\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\n _initialTokenPrice = initialTokenPrice_;\n }\n\n /// @inheritdoc IVersionable\n function version() external pure returns (string memory) {\n return \"0.1.0\";\n }\n\n /// @dev function for mint new SBT token\n /// @param to address of user who will receive token\n /// @param uri token metadata uri\n /// @return true if token was minted\n function safeMint(address to, string memory uri) public virtual override(ERC5484Upgradeable) returns(bool){\n if(totalSupply() < _maxCountTokens) {\n bool tokenCreated = super.safeMint(to, uri);\n if(tokenCreated) {\n setupNewOwner(to);\n return true;\n }\n }\n return false;\n }\n\n /// @inheritdoc ERC721Upgradeable\n function _safeMint(address to, uint256 tokenId) internal override {\n require(totalSupply() < _maxCountTokens, \"EVFT: max number of tokens\");\n super._safeMint(to, tokenId);\n }\n\n /// @inheritdoc IVaultFounderToken\n function priceOf(uint256 tokenId) external view returns (uint256) {\n require(tokenId < totalSupply(), \"EVFT: Token does not exist\");\n return _priceOf(tokenId);\n }\n\n /// @dev internal implementation for calculate price for the next token based on\n /// the current sequential token id\n function _priceOf(uint256 tokenId) internal view returns (uint256) {\n uint256 price = _initialTokenPrice;\n for (uint256 i = 0; i < tokenId; i++) {\n price = (price * _nextTokenPriceMultiplier) / 10_000;\n }\n return price;\n }\n\n /// @dev set multiplicator for the next token in percents\n /// in case nextTokenPriceMultiplier_ = 13_000 the next price of the token will be: curPrice * 130%\n /// @param nextTokenPriceMultiplier_ persent multiplicator\n function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\n }\n\n /// @inheritdoc IVaultFounderToken\n function nextTokenPrice() external view returns (uint256){\n return _nextTokenPrice();\n }\n\n /// @dev calculate price for the next token\n function _nextTokenPrice() internal view returns (uint256){\n return _priceOf(totalSupply());\n }\n\n /// @inheritdoc IVaultFounderToken\n function setTokenURI(string memory _tokenURI) external override {\n address tokenOwner = msg.sender;\n uint256 tokenId = tokenOfOwnerByIndex(tokenOwner, 0);\n _setTokenURI(tokenId, _tokenURI);\n }\n\n /// @inheritdoc IVaultFounderToken\n function setTokenURI(string memory _tokenURI, uint256 tokenId) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _setTokenURI(tokenId, _tokenURI);\n }\n\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request)\n external override\n {\n if(request.senderMaxWithdraw >= _nextTokenPrice()) {\n safeMint(request.requestSender, \"\");\n }\n }\n\n /* solhint-disable no-empty-blocks */\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external override\n {\n //empty code\n }\n /* solhint-disable no-empty-blocks */\n\n /// @dev See {IERC165-supportsInterface}.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC5484Upgradeable, AccessControlUpgradeable, IERC165Upgradeable)\n virtual\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n}" + }, + "src/upgradeable/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n// Import to compile and make ERC1967Proxy available for deploy\nimport {ERC1967Proxy} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";" + }, + "src/upgradeable/IVersionable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/** \n * Allow properly identify different versions of the same contract \n * and track upgrades results \n * */\ninterface IVersionable {\n /// @notice Returns the current version of this contract\n /// @return a version in semantic versioning format\n function version() external pure returns (string memory);\n}\n" + }, + "src/upgradeable/SafeInitializable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IVersionable} from \"./IVersionable.sol\";\n\n/** Implement best practices for initializable contracts */\nabstract contract SafeInitializable is IVersionable, Initializable {\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /**\n * This constructor prevents UUPS Uninitialized Proxies Vulnerability in all contracts which inherit from it.\n * More info about vulnerability: https://medium.com/immunefi/wormhole-uninitialized-proxy-bugfix-review-90250c41a43a\n * \n * @dev Initial fix for this vulnerability was suggested as using `_disableInitializers()` function in constructor,\n * but later, in version 4.3.2, OpenZeppelin implemented `onlyProxy` modifier for UUPS upgradable contracts,\n * which fixed this vulnerability. Still, `_disableInitializers()` is a best practice which prevents unintended access \n * to implementation contracts that can be used maliciously.\n * \n * More info: https://forum.openzeppelin.com/t/how-to-test-upgradeability-for-proxies/33436/7 \n * and https://forum.openzeppelin.com/t/uupsupgradeable-vulnerability-post-mortem/15680\n * \n * To prevent code duplication of constructor, this contract can be used. On the other hand, \n * it can be used as a marker for contracts that are safe from this vulnerability.\n * Additionally, `needDisableInitializers` parameter can be used to enable initializers in mocks and unit tests.\n *\n * @param needDisableInitializers - if true, initializers will be disabled\n */\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) {\n if(needDisableInitializers) {\n _disableInitializers();\n }\n }\n}" + }, + "src/upgradeable/SafeUUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {SafeInitializable} from \"./SafeInitializable.sol\";\n\n/** \n * Implement basic safety mechanism for UUPS proxy\n * based on owner authorization for upgrades\n * */\nabstract contract SafeUUPSUpgradeable is UUPSUpgradeable, SafeInitializable, OwnableUpgradeable {\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /** Init all required constructors, including ownable */\n function __SafeUUPSUpgradeable_init() internal onlyInitializing {\n __SafeUUPSUpgradeable_init_direct();\n\n __Ownable_init();\n }\n\n /** Init only direct constructors, UUPS only */\n function __SafeUUPSUpgradeable_init_direct() internal onlyInitializing {\n __UUPSUpgradeable_init();\n }\n\n /** Authorise that upgrades can do only owner */\n function _authorizeUpgrade(address newImplementation) internal onlyOwner override {} // solhint-disable-line no-empty-blocks\n}\n" + }, + "src/Vault.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\nimport {IVault} from \"./IVault.sol\";\nimport {ILender} from \"./lending/ILender.sol\";\nimport {Lender, BorrowerDoesNotExist} from \"./lending/Lender.sol\";\nimport {StrategiesLender} from \"./lending/StrategiesLender.sol\";\nimport {SafeERC4626Upgradeable, ERC4626Upgradeable} from \"./tokens/SafeERC4626Upgradeable.sol\";\nimport {IERC4626} from \"./tokens/IERC4626.sol\";\nimport {IStrategy} from \"./strategies/IStrategy.sol\";\nimport {AddressList} from \"./structures/AddressList.sol\";\nimport {SafeInitializable} from \"./upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"./upgradeable/SafeUUPSUpgradeable.sol\";\nimport {IVersionable} from \"./upgradeable/IVersionable.sol\";\nimport {SafeERC4626Lifecycle} from \"./tokens/SafeERC4626Lifecycle.sol\";\nimport {IVaultHook} from \"./tokens/IVaultHook.sol\";\nimport {VaultFounderToken} from \"./tokens/VaultFounderToken.sol\";\n\n\nerror ExceededMaximumFeeValue();\n\nerror InsufficientVaultBalance(uint256 assets, uint256 shares);\nerror InvalidLockedProfitReleaseRate(uint256 durationInSeconds);\nerror InappropriateStrategy();\n\ncontract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, StrategiesLender, SafeERC4626Lifecycle {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /// @notice Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\n uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;\n\n /// @notice Rewards contract where management fees are sent to.\n address public rewards;\n\n /// @notice Vault Founders Token contract where rewards for founders are sent to.\n address public founders;\n\n /// @notice Vault management fee (in BPS).\n uint256 public managementFee;\n\n /// @notice Vault founders reward (in BPS).\n uint256 public foundersFee;\n\n /// @notice The amount of funds that cannot be withdrawn by users.\n /// Decreases with time at the rate of \"lockedProfitReleaseRate\".\n uint256 public lockedProfitBaseline;\n\n /// @notice The rate of \"lockedProfitBaseline\" decline on the locked-in profit scale (scaled to 1e18).\n /// Represents the amount of funds that will be unlocked when one second passes.\n uint256 public lockedProfitReleaseRate;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[50] private __gap;\n\n /// @notice Event that should happen when the locked-in profit release rate changed.\n event LockedProfitReleaseRateChanged(uint256 rate);\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.2.0\";\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _asset,\n address _rewards,\n uint256 _managementFee,\n uint256 _lockedProfitReleaseRate,\n string memory _name,\n string memory _symbol,\n address[] memory _defaultOperators,\n uint256 _foundersFee\n ) public initializer {\n __SafeUUPSUpgradeable_init(); // Ownable under the hood\n __StrategiesLender_init_lenderSpecific(); // require Ownable\n __SafeERC4626_init(\n IERC20Upgradeable(_asset),\n bytes(_name).length == 0\n ? string.concat(\n IERC20Metadata(_asset).symbol(),\n \" Eonian Vault Shares\"\n )\n : _name,\n bytes(_symbol).length == 0\n ? string.concat(\"eon\", IERC20Metadata(_asset).symbol())\n : _symbol,\n _defaultOperators\n );\n\n setRewards(_rewards);\n setManagementFee(_managementFee);\n setLockedProfitReleaseRate(_lockedProfitReleaseRate);\n setFoundersFee(_foundersFee);\n }\n\n /// @dev Override to add the \"whenNotPaused\" modifier\n /// @inheritdoc SafeERC4626Upgradeable\n function deposit(uint256 assets)\n public\n override\n whenNotPaused\n returns (uint256 shares)\n {\n return super.deposit(assets);\n }\n\n /// @notice Hook that is used before withdrawals to release assets from strategies if necessary.\n /// @inheritdoc ERC4626Upgradeable\n function beforeWithdraw(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\n // There is no need to withdraw assets from strategies, the vault has sufficient funds\n if (_freeAssets() >= assets) {\n return;\n }\n\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\n // If the vault already has the required amount of funds, we need to finish the withdrawal\n uint256 vaultBalance = _freeAssets();\n if (assets <= vaultBalance) {\n break;\n }\n\n address strategy = withdrawalQueue[i];\n\n // We can only withdraw the amount that the strategy has as debt,\n // so that the strategy can work on the unreported (yet) funds it has earned\n uint256 requiredAmount = MathUpgradeable.min(\n assets - vaultBalance,\n borrowersData[strategy].debt\n );\n\n // Skip this strategy is there is nothing to withdraw\n if (requiredAmount == 0) {\n continue;\n }\n\n // Withdraw the required amount of funds from the strategy\n uint256 loss = IStrategy(strategy).withdraw(requiredAmount);\n\n // If the strategy failed to return all of the requested funds, we need to reduce the strategy's debt ratio\n if (loss > 0) {\n _decreaseBorrowerCredibility(strategy, loss);\n }\n }\n\n // Revert if insufficient assets remain in the vault after withdrawal from all strategies\n if (_freeAssets() < assets) {\n revert InsufficientVaultBalance(assets, shares);\n }\n\n // apply the hook\n SafeERC4626Lifecycle.beforeWithdraw(assets, shares);\n }\n\n /// Check that all new strategies refer to this vault and has the same underlying asset\n function _beforeStrategyRegistered(IStrategy strategy) internal view override {\n if (this != strategy.lender() || asset != strategy.asset()) {\n revert InappropriateStrategy();\n }\n }\n\n /// @notice Sets the vault rewards address.\n /// @param _rewards a new rewards address.\n function setRewards(address _rewards) public onlyOwner {\n rewards = _rewards;\n }\n\n /// @notice Sets the vault management fee. Both management and foundersReward fee can't exceed 100%\n /// @param _managementFee a new management fee value (in BPS).\n function setManagementFee(uint256 _managementFee) public onlyOwner {\n if (_managementFee + foundersFee > MAX_BPS) {\n revert ExceededMaximumFeeValue();\n }\n\n managementFee = _managementFee;\n }\n\n /// @notice Sets the vault founder token contract;\n /// @param _founders a new founder token contract address.\n function setFounders(address _founders) external onlyOwner {\n founders = _founders;\n addDepositHook(IVaultHook(founders));\n }\n\n /// @notice Sets the vault founder token reward rate. Both management and foundersReward fee can't exceed 100%\n /// @param _foundersFee a new founder token reward fee (in BPS).\n function setFoundersFee(uint256 _foundersFee) public onlyOwner {\n if (_foundersFee + managementFee > MAX_BPS) {\n revert ExceededMaximumFeeValue();\n }\n foundersFee = _foundersFee;\n }\n\n /// @notice Changes the rate of release of locked-in profit.\n /// @param rate the rate of release of locked profit (percent per second scaled to 1e18).\n /// The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\n function setLockedProfitReleaseRate(uint256 rate) public onlyOwner {\n if (rate > LOCKED_PROFIT_RELEASE_SCALE) {\n revert InvalidLockedProfitReleaseRate(rate);\n }\n\n lockedProfitReleaseRate = rate;\n emit LockedProfitReleaseRateChanged(rate);\n }\n\n /// @notice Calculates the locked profit, takes into account the change since the last report.\n function _lockedProfit() internal view returns (uint256) {\n // Release rate should be small, since the timestamp can be manipulated by the node operator,\n // not expected to have much impact, since the changes will be applied to all users and cannot be abused directly.\n uint256 ratio = (block.timestamp - lastReportTimestamp) * lockedProfitReleaseRate; // solhint-disable-line not-rely-on-time\n\n // In case the ratio >= scale, the calculation anyway leads to zero.\n if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) {\n return 0;\n }\n\n uint256 lockedProfitChange = (ratio * lockedProfitBaseline) / LOCKED_PROFIT_RELEASE_SCALE;\n\n // Reducing locked profits over time frees up profits for users\n return lockedProfitBaseline - lockedProfitChange;\n }\n\n /// @inheritdoc Lender\n function _chargeFees(uint256 extraFreeFunds)\n internal\n override\n returns (uint256)\n {\n uint256 fee = (extraFreeFunds * managementFee) / MAX_BPS;\n if (fee > 0) {\n _mint(rewards, convertToShares(fee), \"\", \"\", false);\n }\n if(founders == address(0)) {\n return fee;\n }\n uint256 vaultFoundersReward = (extraFreeFunds * foundersFee) / MAX_BPS;\n if (vaultFoundersReward > 0) {\n _mint(founders, convertToShares(vaultFoundersReward), \"\", \"\", false);\n }\n return fee + vaultFoundersReward;\n }\n\n /// @notice Updates the locked-in profit value according to the positive debt management report of the strategy\n /// @inheritdoc Lender\n function _afterPositiveDebtManagementReport(\n uint256 extraFreeFunds,\n uint256 chargedFees\n ) internal override {\n // Locking every reported strategy profit, taking into account the charged fees.\n lockedProfitBaseline = _lockedProfit() + extraFreeFunds - chargedFees;\n }\n\n /// @notice Updates the locked-in profit value according to the negative debt management report of the strategy\n /// @inheritdoc Lender\n function _afterNegativeDebtManagementReport(uint256 loss)\n internal\n override\n {\n uint256 currentLockedProfit = _lockedProfit();\n\n // If a loss occurs, it is necessary to release the appropriate amount of funds that users were able to withdraw it.\n lockedProfitBaseline = currentLockedProfit > loss\n ? currentLockedProfit - loss\n : 0;\n }\n\n /// @inheritdoc Lender\n function _freeAssets() internal view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @inheritdoc Lender\n function _borrowerFreeAssets(address borrower)\n internal\n view\n override\n returns (uint256)\n {\n return asset.balanceOf(borrower);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function totalAssets() public view override(ERC4626Upgradeable, IERC4626) returns (uint256) {\n return super.fundAssets() - _lockedProfit();\n }\n\n /// @inheritdoc ILender\n /// @dev Explicitly overridden here to keep this function exposed via \"ILender\" interface.\n function paused()\n public\n view\n override(ILender, StrategiesLender)\n returns (bool)\n {\n return super.paused();\n }\n\n /// @inheritdoc Lender\n function _transferFundsToBorrower(address borrower, uint256 amount)\n internal\n override\n {\n asset.safeTransfer(borrower, amount);\n }\n\n /// @inheritdoc Lender\n function _takeFundsFromBorrower(address borrower, uint256 amount)\n internal\n override\n {\n asset.safeTransferFrom(borrower, address(this), amount);\n }\n\n function afterDeposit(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\n SafeERC4626Lifecycle.afterDeposit(assets, shares);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "storageLayout", + "devdoc", + "userdoc", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "contracts/=src/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "solmate/=lib/solmate/src/" + ] + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/sepolia/solcInputs/d0406e24b3639a0908a9bc386b5365e9.json b/packages/contracts/deployments/sepolia/solcInputs/d0406e24b3639a0908a9bc386b5365e9.json new file mode 100644 index 00000000..d47ad5ea --- /dev/null +++ b/packages/contracts/deployments/sepolia/solcInputs/d0406e24b3639a0908a9bc386b5365e9.json @@ -0,0 +1,307 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => 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 a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).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 override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\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 override 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 override 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 override 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 `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\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 Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\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 signaling this.\n *\n * _Available since v3.1._\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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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 `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967Upgradeable {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC4906Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4906.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"./IERC721Upgradeable.sol\";\n\n/// @title EIP-721 Metadata Update Extension\ninterface IERC4906Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\n /// @dev This event emits when the metadata of a token is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFT.\n event MetadataUpdate(uint256 _tokenId);\n\n /// @dev This event emits when the metadata of a range of tokens is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFTs.\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/IERC721Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/IERC1967Upgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeTo(address newImplementation) public virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {\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 bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\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 require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\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 function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/extensions/ERC721URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../interfaces/IERC4906Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC721 token with storage based token URI management.\n */\nabstract contract ERC721URIStorageUpgradeable is Initializable, IERC4906Upgradeable, ERC721Upgradeable {\n function __ERC721URIStorage_init() internal onlyInitializing {\n }\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\n }\n using StringsUpgradeable for uint256;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC165-supportsInterface}\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n string memory base = _baseURI();\n\n // If there is no base URI, return the token URI.\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n /**\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\n *\n * Emits {MetadataUpdate}.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\n require(_exists(tokenId), \"ERC721URIStorage: URI set of nonexistent token\");\n _tokenURIs[tokenId] = _tokenURI;\n\n emit MetadataUpdate(tokenId);\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\n * token-specific URI was set for the token, and if so, it deletes the token URI from\n * the storage mapping.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/ERC777.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC777Upgradeable.sol\";\nimport \"./IERC777RecipientUpgradeable.sol\";\nimport \"./IERC777SenderUpgradeable.sol\";\nimport \"../ERC20/IERC20Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/IERC1820RegistryUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC777} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * Support for ERC20 is included in this contract, as specified by the EIP: both\n * the ERC777 and ERC20 interfaces can be safely used when interacting with it.\n * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token\n * movements.\n *\n * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there\n * are no special restrictions in the amount of tokens that created, moved, or\n * destroyed. This makes integration with ERC20 applications seamless.\n *\n * CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.\n */\ncontract ERC777Upgradeable is Initializable, ContextUpgradeable, IERC777Upgradeable, IERC20Upgradeable {\n using AddressUpgradeable for address;\n\n IERC1820RegistryUpgradeable internal constant _ERC1820_REGISTRY = IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n\n mapping(address => uint256) private _balances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256(\"ERC777TokensSender\");\n bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\"ERC777TokensRecipient\");\n\n // This isn't ever read from - it's only used to respond to the defaultOperators query.\n address[] private _defaultOperatorsArray;\n\n // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).\n mapping(address => bool) private _defaultOperators;\n\n // For each account, a mapping of its operators and revoked default operators.\n mapping(address => mapping(address => bool)) private _operators;\n mapping(address => mapping(address => bool)) private _revokedDefaultOperators;\n\n // ERC20-allowances\n mapping(address => mapping(address => uint256)) private _allowances;\n\n /**\n * @dev `defaultOperators` may be an empty array.\n */\n function __ERC777_init(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\n __ERC777_init_unchained(name_, symbol_, defaultOperators_);\n }\n\n function __ERC777_init_unchained(string memory name_, string memory symbol_, address[] memory defaultOperators_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n\n _defaultOperatorsArray = defaultOperators_;\n for (uint256 i = 0; i < defaultOperators_.length; i++) {\n _defaultOperators[defaultOperators_[i]] = true;\n }\n\n // register interfaces\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC777Token\"), address(this));\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC20Token\"), address(this));\n }\n\n /**\n * @dev See {IERC777-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC777-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n *\n * Always returns 18, as per the\n * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\n */\n function decimals() public pure virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC777-granularity}.\n *\n * This implementation always returns `1`.\n */\n function granularity() public view virtual override returns (uint256) {\n return 1;\n }\n\n /**\n * @dev See {IERC777-totalSupply}.\n */\n function totalSupply() public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev Returns the amount of tokens owned by an account (`tokenHolder`).\n */\n function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {\n return _balances[tokenHolder];\n }\n\n /**\n * @dev See {IERC777-send}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function send(address recipient, uint256 amount, bytes memory data) public virtual override {\n _send(_msgSender(), recipient, amount, data, \"\", true);\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}\n * interface if it is a contract.\n *\n * Also emits a {Sent} event.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _send(_msgSender(), recipient, amount, \"\", \"\", false);\n return true;\n }\n\n /**\n * @dev See {IERC777-burn}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function burn(uint256 amount, bytes memory data) public virtual override {\n _burn(_msgSender(), amount, data, \"\");\n }\n\n /**\n * @dev See {IERC777-isOperatorFor}.\n */\n function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) {\n return\n operator == tokenHolder ||\n (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||\n _operators[tokenHolder][operator];\n }\n\n /**\n * @dev See {IERC777-authorizeOperator}.\n */\n function authorizeOperator(address operator) public virtual override {\n require(_msgSender() != operator, \"ERC777: authorizing self as operator\");\n\n if (_defaultOperators[operator]) {\n delete _revokedDefaultOperators[_msgSender()][operator];\n } else {\n _operators[_msgSender()][operator] = true;\n }\n\n emit AuthorizedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-revokeOperator}.\n */\n function revokeOperator(address operator) public virtual override {\n require(operator != _msgSender(), \"ERC777: revoking self as operator\");\n\n if (_defaultOperators[operator]) {\n _revokedDefaultOperators[_msgSender()][operator] = true;\n } else {\n delete _operators[_msgSender()][operator];\n }\n\n emit RevokedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-defaultOperators}.\n */\n function defaultOperators() public view virtual override returns (address[] memory) {\n return _defaultOperatorsArray;\n }\n\n /**\n * @dev See {IERC777-operatorSend}.\n *\n * Emits {Sent} and {IERC20-Transfer} events.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public virtual override {\n require(isOperatorFor(_msgSender(), sender), \"ERC777: caller is not an operator for holder\");\n _send(sender, recipient, amount, data, operatorData, true);\n }\n\n /**\n * @dev See {IERC777-operatorBurn}.\n *\n * Emits {Burned} and {IERC20-Transfer} events.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public virtual override {\n require(isOperatorFor(_msgSender(), account), \"ERC777: caller is not an operator for holder\");\n _burn(account, amount, data, operatorData);\n }\n\n /**\n * @dev See {IERC20-allowance}.\n *\n * Note that operator and allowance concepts are orthogonal: operators may\n * not have allowance, and accounts with allowance may not be operators\n * themselves.\n */\n function allowance(address holder, address spender) public view virtual override returns (uint256) {\n return _allowances[holder][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function approve(address spender, uint256 value) public virtual override returns (bool) {\n address holder = _msgSender();\n _approve(holder, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Note that operator and allowance concepts are orthogonal: operators cannot\n * call `transferFrom` (unless they have allowance), and accounts with\n * allowance cannot call `operatorSend` (unless they are operators).\n *\n * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\n */\n function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(holder, spender, amount);\n _send(holder, recipient, amount, \"\", \"\", false);\n return true;\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with the caller address as the `operator` and with\n * `userData` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual {\n _mint(account, amount, userData, operatorData, true);\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If `requireReceptionAck` is set to true, and if a send hook is\n * registered for `account`, the corresponding function will be called with\n * `operator`, `data` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(\n address account,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) internal virtual {\n require(account != address(0), \"ERC777: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), account, amount);\n\n // Update state variables\n _totalSupply += amount;\n _balances[account] += amount;\n\n _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck);\n\n emit Minted(operator, account, amount, userData, operatorData);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Send tokens\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _send(\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) internal virtual {\n require(from != address(0), \"ERC777: transfer from the zero address\");\n require(to != address(0), \"ERC777: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, to, amount, userData, operatorData);\n\n _move(operator, from, to, amount, userData, operatorData);\n\n _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);\n }\n\n /**\n * @dev Burn tokens\n * @param from address token holder address\n * @param amount uint256 amount of tokens to burn\n * @param data bytes extra information provided by the token holder\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _burn(address from, uint256 amount, bytes memory data, bytes memory operatorData) internal virtual {\n require(from != address(0), \"ERC777: burn from the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, address(0), amount, data, operatorData);\n\n _beforeTokenTransfer(operator, from, address(0), amount);\n\n // Update state variables\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC777: burn amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Burned(operator, from, amount, data, operatorData);\n emit Transfer(from, address(0), amount);\n }\n\n function _move(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n ) private {\n _beforeTokenTransfer(operator, from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC777: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Sent(operator, from, to, amount, userData, operatorData);\n emit Transfer(from, to, amount);\n }\n\n /**\n * @dev See {ERC20-_approve}.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function _approve(address holder, address spender, uint256 value) internal virtual {\n require(holder != address(0), \"ERC777: approve from the zero address\");\n require(spender != address(0), \"ERC777: approve to the zero address\");\n\n _allowances[holder][spender] = value;\n emit Approval(holder, spender, value);\n }\n\n /**\n * @dev Call from.tokensToSend() if the interface is registered\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _callTokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n ) private {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777SenderUpgradeable(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);\n }\n }\n\n /**\n * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but\n * tokensReceived() was not registered for the recipient\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _callTokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n ) private {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777RecipientUpgradeable(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);\n } else if (requireReceptionAck) {\n require(!to.isContract(), \"ERC777: token recipient contract has no implementer for ERC777TokensRecipient\");\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {IERC20-Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC777: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes\n * calls to {send}, {transfer}, {operatorSend}, {transferFrom}, minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address operator, address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[41] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\n *\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\n * contract implement this interface (contract holders can be their own\n * implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777RecipientUpgradeable {\n /**\n * @dev Called by an {IERC777} token contract whenever tokens are being\n * moved or created into a registered account (`to`). The type of operation\n * is conveyed by `from` being the zero address or not.\n *\n * This call occurs _after_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensSender standard as defined in the EIP.\n *\n * {IERC777} Token holders can be notified of operations performed on their\n * tokens by having a contract implement this interface (contract holders can be\n * their own implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777SenderUpgradeable {\n /**\n * @dev Called by an {IERC777} token contract whenever a registered holder's\n * (`from`) tokens are about to be moved or destroyed. The type of operation\n * is conveyed by `to` being the zero address or not.\n *\n * This call occurs _before_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777Upgradeable {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC1820RegistryUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/IERC1820Registry.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the global ERC1820 Registry, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register\n * implementers for interfaces in this registry, as well as query support.\n *\n * Implementers may be shared by multiple accounts, and can also implement more\n * than a single interface for each account. Contracts can implement interfaces\n * for themselves, but externally-owned accounts (EOA) must delegate this to a\n * contract.\n *\n * {IERC165} interfaces can also be queried via the registry.\n *\n * For an in-depth explanation and source code analysis, see the EIP text.\n */\ninterface IERC1820RegistryUpgradeable {\n event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);\n\n event ManagerChanged(address indexed account, address indexed newManager);\n\n /**\n * @dev Sets `newManager` as the manager for `account`. A manager of an\n * account is able to set interface implementers for it.\n *\n * By default, each account is its own manager. Passing a value of `0x0` in\n * `newManager` will reset the manager to this initial state.\n *\n * Emits a {ManagerChanged} event.\n *\n * Requirements:\n *\n * - the caller must be the current manager for `account`.\n */\n function setManager(address account, address newManager) external;\n\n /**\n * @dev Returns the manager for `account`.\n *\n * See {setManager}.\n */\n function getManager(address account) external view returns (address);\n\n /**\n * @dev Sets the `implementer` contract as ``account``'s implementer for\n * `interfaceHash`.\n *\n * `account` being the zero address is an alias for the caller's address.\n * The zero address can also be used in `implementer` to remove an old one.\n *\n * See {interfaceHash} to learn how these are created.\n *\n * Emits an {InterfaceImplementerSet} event.\n *\n * Requirements:\n *\n * - the caller must be the current manager for `account`.\n * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not\n * end in 28 zeroes).\n * - `implementer` must implement {IERC1820Implementer} and return true when\n * queried for support, unless `implementer` is the caller. See\n * {IERC1820Implementer-canImplementInterfaceForAddress}.\n */\n function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;\n\n /**\n * @dev Returns the implementer of `interfaceHash` for `account`. If no such\n * implementer is registered, returns the zero address.\n *\n * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28\n * zeroes), `account` will be queried for support of it.\n *\n * `account` being the zero address is an alias for the caller's address.\n */\n function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);\n\n /**\n * @dev Returns the interface hash for an `interfaceName`, as defined in the\n * corresponding\n * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].\n */\n function interfaceHash(string calldata interfaceName) external pure returns (bytes32);\n\n /**\n * @notice Updates the cache with whether the contract implements an ERC165 interface or not.\n * @param account Address of the contract for which to update the cache.\n * @param interfaceId ERC165 interface for which to update the cache.\n */\n function updateERC165Cache(address account, bytes4 interfaceId) external;\n\n /**\n * @notice Checks whether a contract implements an ERC165 interface or not.\n * If the result is not cached a direct lookup on the contract address is performed.\n * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\n * {updateERC165Cache} with the contract address.\n * @param account Address of the contract to check.\n * @param interfaceId ERC165 interface to check.\n * @return True if `account` implements `interfaceId`, false otherwise.\n */\n function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);\n\n /**\n * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.\n * @param account Address of the contract to check.\n * @param interfaceId ERC165 interface to check.\n * @return True if `account` implements `interfaceId`, false otherwise.\n */\n function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 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 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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 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 prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / 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 prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\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 works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\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^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice 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 uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\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 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMathUpgradeable {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1967.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/IERC1967.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "lib/solmate/src/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n function powWad(int256 x, int256 y) internal pure returns (int256) {\n // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)\n return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.\n }\n\n function expWad(int256 x) internal pure returns (int256 r) {\n unchecked {\n // When the result is < 0.5 we return zero. This happens when\n // x <= floor(log(0.5e18) * 1e18) ~ -42e18\n if (x <= -42139678854452767551) return 0;\n\n // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\n // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\n if (x >= 135305999368893231589) revert(\"EXP_OVERFLOW\");\n\n // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\n // for more intermediate precision and a binary basis. This base conversion\n // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\n x = (x << 78) / 5**18;\n\n // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers\n // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\n // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\n int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\n x = x - k * 54916777467707473351141471128;\n\n // k is in the range [-61, 195].\n\n // Evaluate using a (6, 7)-term rational approximation.\n // p is made monic, we'll multiply by a scale factor later.\n int256 y = x + 1346386616545796478920950773328;\n y = ((y * x) >> 96) + 57155421227552351082224309758442;\n int256 p = y + x - 94201549194550492254356042504812;\n p = ((p * y) >> 96) + 28719021644029726153956944680412240;\n p = p * x + (4385272521454847904659076985693276 << 96);\n\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n int256 q = x - 2855989394907223263936484059900;\n q = ((q * x) >> 96) + 50020603652535783019961831881945;\n q = ((q * x) >> 96) - 533845033583426703283633433725380;\n q = ((q * x) >> 96) + 3604857256930695427073651918091429;\n q = ((q * x) >> 96) - 14423608567350463180887372962807573;\n q = ((q * x) >> 96) + 26449188498355588339934803723976023;\n\n assembly {\n // Div in assembly because solidity adds a zero check despite the unchecked.\n // The q polynomial won't have zeros in the domain as all its roots are complex.\n // No scaling is necessary because p is already 2**96 too large.\n r := sdiv(p, q)\n }\n\n // r should be in the range (0.09, 0.25) * 2**96.\n\n // We now need to multiply r by:\n // * the scale factor s = ~6.031367120.\n // * the 2**k factor from the range reduction.\n // * the 1e18 / 2**96 factor for base conversion.\n // We do this all at once, with an intermediate result in 2**213\n // basis, so the final right shift is always by a positive amount.\n r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\n }\n }\n\n function lnWad(int256 x) internal pure returns (int256 r) {\n unchecked {\n require(x > 0, \"UNDEFINED\");\n\n // We want to convert x from 10**18 fixed point to 2**96 fixed point.\n // We do this by multiplying by 2**96 / 10**18. But since\n // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\n // and add ln(2**96 / 10**18) at the end.\n\n // Reduce range of x to (1, 2) * 2**96\n // ln(2^k * x) = k * ln(2) + ln(x)\n int256 k = int256(log2(uint256(x))) - 96;\n x <<= uint256(159 - k);\n x = int256(uint256(x) >> 159);\n\n // Evaluate using a (8, 8)-term rational approximation.\n // p is made monic, we will multiply by a scale factor later.\n int256 p = x + 3273285459638523848632254066296;\n p = ((p * x) >> 96) + 24828157081833163892658089445524;\n p = ((p * x) >> 96) + 43456485725739037958740375743393;\n p = ((p * x) >> 96) - 11111509109440967052023855526967;\n p = ((p * x) >> 96) - 45023709667254063763336534515857;\n p = ((p * x) >> 96) - 14706773417378608786704636184526;\n p = p * x - (795164235651350426258249787498 << 96);\n\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n // q is monic by convention.\n int256 q = x + 5573035233440673466300451813936;\n q = ((q * x) >> 96) + 71694874799317883764090561454958;\n q = ((q * x) >> 96) + 283447036172924575727196451306956;\n q = ((q * x) >> 96) + 401686690394027663651624208769553;\n q = ((q * x) >> 96) + 204048457590392012362485061816622;\n q = ((q * x) >> 96) + 31853899698501571402653359427138;\n q = ((q * x) >> 96) + 909429971244387300277376558375;\n assembly {\n // Div in assembly because solidity adds a zero check despite the unchecked.\n // The q polynomial is known not to have zeros in the domain.\n // No scaling required because p is already 2**96 too large.\n r := sdiv(p, q)\n }\n\n // r is in the range (0, 0.125) * 2**96\n\n // Finalization, we need to:\n // * multiply by the scale factor s = 5.549…\n // * add ln(2**96 / 10**18)\n // * add k * ln(2)\n // * multiply by 10**18 / 2**96 = 5**18 >> 78\n\n // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\n r *= 1677202110996718588342820967067443963516166;\n // add ln(2) * k * 5e18 * 2**192\n r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\n // add ln(2**96 / 10**18) * 5e18 * 2**192\n r += 600920179829731861736702779321621459595472258049074101567377883020018308;\n // base conversion: mul 2**18 / 2**192\n r >>= 174;\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // Divide z by the denominator.\n z := div(z, denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // First, divide z - 1 by the denominator and add 1.\n // We allow z - 1 to underflow if z is 0, because we multiply the\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function log2(uint256 x) internal pure returns (uint256 r) {\n require(x > 0, \"UNDEFINED\");\n\n assembly {\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\n r := or(r, shl(3, lt(0xff, shr(r, x))))\n r := or(r, shl(2, lt(0xf, shr(r, x))))\n r := or(r, shl(1, lt(0x3, shr(r, x))))\n r := or(r, lt(0x1, shr(r, x)))\n }\n }\n}\n" + }, + "src/automation/example/SimpleGelatoJob.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {GelatoJobAdapter} from \"../GelatoJobAdapter.sol\";\n\nimport {SafeUUPSUpgradeable} from \"../../upgradeable/SafeUUPSUpgradeable.sol\";\nimport {SafeInitializable} from \"../../upgradeable/SafeInitializable.sol\";\nimport {IVersionable} from \"../../upgradeable/IVersionable.sol\";\n\ncontract SimpleGelatoJob is GelatoJobAdapter, SafeUUPSUpgradeable {\n uint256 public workMethodCalledCounter;\n bool public canWorkResult = false;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.1\";\n }\n\n // allow sending eth to the test contract\n receive() external payable {} // solhint-disable-line no-empty-blocks\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _ops,\n uint256 _minimumBetweenExecutions,\n bool _isPrepaid\n ) public initializer {\n __GelatoJobAdapter_init(_ops, _minimumBetweenExecutions, _isPrepaid);\n\n __SafeUUPSUpgradeable_init(); // ownable under the hood\n }\n\n function _work() internal override {\n workMethodCalledCounter++;\n }\n\n function _canWork() internal view override returns (bool) {\n return canWorkResult;\n }\n\n function setCanWorkResult(bool _canWorkResult) public onlyOwner {\n canWorkResult = _canWorkResult;\n }\n\n function setMinimumBetweenExecutions(uint256 _time) public onlyOwner {\n _setMinimumBetweenExecutions(_time);\n }\n\n function setIsPrepaid(bool _isPrepaid) public onlyOwner {\n isPrepaid = _isPrepaid;\n }\n\n function allowWorkNow() public onlyOwner {\n lastWorkTime = 0;\n }\n\n function refreshLastWorkTime() public onlyOwner {\n _refreshLastWorkTime();\n }\n}\n" + }, + "src/automation/gelato/BackCombatibleTransfer.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @notice Library that adding support for ERC20 and native tokens transfers.\n/// @dev Based of https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/vendor/gelato/FGelato.sol\nlibrary BackCombatibleTransfer {\n address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Backcombatible transfer to given address, will use ERC20 transfer if given token is ERC20.\n function backCombatibleTransfer(\n address payable to,\n address paymentToken,\n uint256 amount\n ) internal {\n if (paymentToken == ETH) {\n safeNativeTransfer(to, amount);\n return;\n }\n\n SafeERC20.safeTransfer(IERC20(paymentToken), to, amount);\n }\n\n /// @notice Native token transfer that checks `call` result.\n function safeNativeTransfer(address payable to, uint256 amount) internal {\n // We don't use `transfer` or `send`, as they are considered bad practices after the Istanbul hardfork.\n (bool success, ) = to.call{value: amount}(\"\");\n require(success, \"Native transfer failed\");\n }\n}\n" + }, + "src/automation/gelato/IOps.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @dev Based on https://github.com/gelatodigital/ops\ninterface IOps {\n function gelato() external view returns (address payable);\n\n function getFeeDetails() external view returns (uint256, address);\n}\n" + }, + "src/automation/gelato/IResolver.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @dev Copy of https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/interfaces/IResolver.sol\ninterface IResolver {\n function checker()\n external\n view\n returns (bool canExec, bytes memory execPayload);\n}\n" + }, + "src/automation/gelato/OpsReady.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport {IOps} from \"./IOps.sol\";\nimport {BackCombatibleTransfer} from \"./BackCombatibleTransfer.sol\";\n\nimport {SafeInitializable} from \"../../upgradeable/SafeInitializable.sol\";\n\n/// Based on https://github.com/gelatodigital/ops/blob/9a9cde6ab2f1b132b949f9244fd59a1de4da4123/contracts/vendor/gelato/OpsReady.sol\n/// @notice Give basic methods to pay for Gelato operations.\nabstract contract OpsReady is SafeInitializable {\n IOps public ops;\n address payable public gelato;\n\n using BackCombatibleTransfer for address payable;\n using SafeERC20 for IERC20;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n modifier onlyOps() {\n require(msg.sender == address(ops), \"OpsReady: onlyOps\");\n _;\n }\n \n /**\n * Contructor of contract which will be able to communicate with Gelato protocol\n * @param _ops - address of the Ops contract.\n * @dev addresses can be found at https://docs.gelato.network/developer-products/gelato-ops-smart-contract-automation-hub/contract-addresses\n */\n function __OpsReady_init(address _ops) internal onlyInitializing {\n ops = IOps(_ops);\n gelato = ops.gelato();\n }\n\n /// @notice Will pay bot for executed task through galato\n function _payGalatoFee() internal {\n (uint256 fee, address feeToken) = ops.getFeeDetails();\n\n gelato.backCombatibleTransfer(feeToken, fee);\n }\n}\n" + }, + "src/automation/GelatoJobAdapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {Job} from \"./Job.sol\";\nimport {IResolver} from \"./gelato/IResolver.sol\";\nimport {OpsReady} from \"./gelato/OpsReady.sol\";\n\n/// @notice Contract expect work will be prepayd, so it cannot pay for work\nerror PayableWorkNotAllowed();\n\n/// @title Implementation of the mixin that adds support for Gelato (keepers operator)\nabstract contract GelatoJobAdapter is Job, IResolver, OpsReady {\n /// @notice If job is prepaid, then it not will try to pay on executed work.\n bool public isPrepaid;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * @notice Constructor of Job adapter contract.\n * @param _ops - address of the Ops contract.\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * @param _isPrepaid - If job is prepaid, then it not will try to pay on executed work\n */\n function __GelatoJobAdapter_init(\n address _ops,\n uint256 _minimumBetweenExecutions,\n bool _isPrepaid\n ) internal onlyInitializing {\n __OpsReady_init(_ops);\n __Job_init(_minimumBetweenExecutions);\n\n __GelatoJobAdapter_init_unchained(_isPrepaid);\n }\n\n /**\n * @notice Unchained constructor of Job adapter contract without rest of the contracts init\n * @param _isPrepaid - If job is prepaid, then it not will try to pay on executed work\n */\n function __GelatoJobAdapter_init_unchained(bool _isPrepaid)\n internal\n onlyInitializing\n {\n isPrepaid = _isPrepaid;\n }\n\n /// @notice Resolver checker that says if the work can be performed and with what params.\n function checker()\n public\n view\n returns (bool canExec, bytes memory execPayload)\n {\n canExec = canWork();\n\n execPayload = abi.encodeWithSelector(\n isPrepaid ? this.work.selector : this.payableWork.selector\n );\n }\n\n /// @notice Bot will call this method when `checker` returns `true`.\n /// Will pay caller\n /// `_doWork` method stay as it is, to allow a call off-chain\n function payableWork() public nonReentrant onlyOps {\n if (isPrepaid) {\n revert PayableWorkNotAllowed();\n }\n\n _doWork();\n\n // Check -> Effect -> Interaction\n // To prevent exploits pay only at the end of operations\n _payGalatoFee();\n }\n}\n" + }, + "src/automation/Job.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\n/// Someone tried to execute work function while `canWork` is `false`\nerror CannotWorkNow();\n\n/// Given time minimum between execution must be greater then 1000\nerror TimeMinimumBetweenExecutionsIncorrect(uint256 _givenTime);\n\n/// @title Abstract contract by implementation of which\n/// possible to make child contract support of one of keeper providers.\n/// @notice This contract is only define interface,\n/// for add support of specific provider need add specific mixin contract.\nabstract contract Job is\n SafeInitializable,\n ContextUpgradeable,\n ReentrancyGuardUpgradeable\n{\n /// Job work function was executed by worker bot\n event Worked(address indexed worker);\n\n /// @notice Timestamp of last work execution block in seconds.\n /// @dev Logic of checking and manupulating execution must be only in this contract (not in child)\n /// to control timestamp dependce vularability.\n /// Important: Expect all timestamp can be adgasted by miners.\n /// More info at: https://www.getsecureworld.com/blog/what-is-timestamp-dependence-vulnerability/\n uint256 public lastWorkTime;\n\n /// @notice Mininmal time which must pass between executions of the job in seconds.\n /// Better set hours, but at least set to greater then 900 seconds,\n /// node opperators able to manipulate timestamp in 900 seconds range, on some blockchains maybe bigger.\n uint256 public minimumBetweenExecutions;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * @notice Constructor of Job contract.\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * Set in hours to prevent block timestamp vularability\n */\n function __Job_init(uint256 _minimumBetweenExecutions)\n internal\n onlyInitializing\n {\n __Context_init();\n __ReentrancyGuard_init();\n\n __Job_init_unchained(_minimumBetweenExecutions);\n }\n\n /**\n * @notice Unchained constructor of Job contract without rest of the contracts init\n * @param _minimumBetweenExecutions - required time which must pass between executions of the job in seconds.\n * Set in hours to prevent block timestamp vularability\n */\n function __Job_init_unchained(uint256 _minimumBetweenExecutions)\n internal\n onlyInitializing\n {\n _setMinimumBetweenExecutions(_minimumBetweenExecutions);\n // Not will set lastWorkTime to allow first work immediately after contract deploy\n }\n\n // ------------------------------------------ Public methods ------------------------------------------\n\n /// @notice If work can be executed by keeper at this moment returns true\n /// @dev Will be executed by keeper and before `work` method execution.\n function canWork() public view returns (bool) {\n // TODO: Check the maximum delay between job executions (?)\n return\n isTimePassFromLastExecution(minimumBetweenExecutions) && _canWork();\n }\n\n /// @notice allow execution only if `canWork` return true\n modifier onlyWhenCanWork() {\n if (!canWork()) {\n revert CannotWorkNow();\n }\n _;\n }\n\n /// @notice A handle that allows the `_doWork` function to be invoked externally by everyone.\n /// Perform a `canWork` check to avoid unnecessary and (maybe) malicious calls.\n /// @dev `nonReentrant` modifier might be excess there, since we have `isTimePassFromLastExecution` check\n /// and `refreshLastWorkTime` at start (see `onlyWhenCanWork` modifier). Let's keep it, as `canWork` can be overridden.\n function work() public nonReentrant onlyWhenCanWork {\n _doWork();\n }\n\n /// @notice Performs `_work` call and refreshes the last execution time.\n function _doWork() internal {\n // Refresh execution works like `nonReentrant` modifier if we have a `isTimePassFromLastExecution` check inside `canWork`.\n _refreshLastWorkTime();\n\n // An important work that is meant to be executed by the keeper.\n _work();\n\n emit Worked(msg.sender);\n }\n\n // ------------------------------------------ Time check logic ------------------------------------------\n\n /// @notice Set minimum time between executions.\n /// @param time - required time which must pass between executions of the job in seconds.\n /// Set in hours to prevent block timestamp vulnerability\n function _setMinimumBetweenExecutions(uint256 time) internal {\n if (time <= 1000) {\n revert TimeMinimumBetweenExecutionsIncorrect(time);\n }\n\n minimumBetweenExecutions = time;\n }\n\n /// @notice Time that passed since the last exection\n /// @return seconds from last execution in a range of 900 seconds\n function timeFromLastExecution() public view returns (uint256) {\n // lastWorkTime will be zero before first execution\n return block.timestamp - lastWorkTime; // solhint-disable-line not-rely-on-time\n }\n\n /// @notice Set time of last execution to current block\n function _refreshLastWorkTime() internal {\n lastWorkTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /// @notice Check if given time from last execution is passed\n /// @param second - amount of time which mast pass from last execution\n /// @return true if enough time pass\n function isTimePassFromLastExecution(uint256 second)\n internal\n view\n returns (bool)\n {\n return timeFromLastExecution() > second;\n }\n\n // ------------------------------------------ Busines methods to override ------------------------------\n\n /// @notice Method which will be executed by keeper\n function _work() internal virtual;\n\n /// @notice Method which identify if work can be executed at this moment.\n /// @dev Will be executed by keeper and before `work` method execution.\n /// @return true if `work` method can be called.\n function _canWork() internal view virtual returns (bool);\n}\n" + }, + "src/healthcheck/HealthChecker.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nimport {IHealthCheck} from \"./IHealthCheck.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror HealthCheckFailed();\n\nabstract contract HealthChecker is SafeInitializable, OwnableUpgradeable {\n event HealthCheckChanged(address);\n event HealthCheckEnabledChanged(bool);\n\n IHealthCheck public healthCheck;\n bool public healthCheckEnabled;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __HealthChecker_init(address _healthCheck)\n internal\n onlyInitializing\n {\n __Ownable_init();\n\n __HealthChecker_init_unchained(_healthCheck);\n }\n\n function __HealthChecker_init_unchained(address _healthCheck)\n internal\n onlyInitializing\n {\n setHealthCheck(_healthCheck);\n setHealthCheckEnabled(true);\n }\n\n /// @notice Sets the health check implementation contract.\n /// @param _healthCheck A new health check contract address.\n /// @dev Emits the \"HealthCheckChanged\" event.\n function setHealthCheck(address _healthCheck) public onlyOwner {\n healthCheck = IHealthCheck(_healthCheck);\n emit HealthCheckChanged(_healthCheck);\n }\n\n /// @notice Enables or disables the health check.\n /// @param _healthCheckEnabled If \"true\" - health check will be disabled.\n /// @dev Emits the \"HealthCheckEnabledChanged\" event.\n /// Do not disable the health check, unless you need to perform \"report\" in an emergency.\n function setHealthCheckEnabled(bool _healthCheckEnabled) public onlyOwner {\n healthCheckEnabled = _healthCheckEnabled;\n emit HealthCheckEnabledChanged(_healthCheckEnabled);\n }\n\n /// @notice Performs the health check by calling external contract.\n /// @param strategy Address of the strategy to be checked.\n /// @param profit The amount of funds that the strategy realised as profit.\n /// @param loss The amount of funds that the strategy realised as loss.\n /// @param debtPayment The amount of funds that the strategy spent to pay the debt.\n /// @param debtOutstanding Outstanding strategy debt.\n /// @param totalDebt The total amount of funds borrowed by the strategy from the vault.\n function performHealthCheck(\n address strategy,\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 debtOutstanding,\n uint256 totalDebt\n ) internal virtual {\n // No health check implementation provided, skip the execution.\n if (address(healthCheck) == address(0)) {\n return;\n }\n\n // There is usually no reason to turn off health checks.\n // But sometimes it may be necessary if we need to call a \"report\" manually.\n // If this happens, we should turn it on again.\n if (!healthCheckEnabled) {\n setHealthCheckEnabled(true);\n return;\n }\n\n // Perform the health check, revert the transaction if unsuccessful.\n bool success = healthCheck.check(\n strategy,\n profit,\n loss,\n debtPayment,\n debtOutstanding,\n totalDebt\n );\n if (!success) {\n revert HealthCheckFailed();\n }\n }\n}\n" + }, + "src/healthcheck/IHealthCheck.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface IHealthCheck {\n /// @notice Checks the overall state of the strategy\n /// @param strategy Address of the strategy to be checked.\n /// @param profit The amount of funds that the strategy realised as profit.\n /// @param loss The amount of funds that the strategy realised as loss.\n /// @param debtPayment The amount of funds that the strategy spent to pay the debt.\n /// @param debtOutstanding Outstanding strategy debt.\n /// @param totalDebt The total amount of funds borrowed by the strategy from the vault.\n /// @return The status of a completed health check.\n function check(\n address strategy,\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 debtOutstanding,\n uint256 totalDebt\n ) external view returns (bool);\n}\n" + }, + "src/IVault.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ILender} from \"./lending/ILender.sol\";\nimport {IERC4626} from \"./tokens/IERC4626.sol\";\n\ninterface IVault is ILender, IERC4626 {\n /// @notice Revokes a strategy from the vault.\n /// Sets strategy's dept ratio to zero, so that the strategy cannot take funds from the vault.\n /// @param strategy a strategy to revoke.\n function revokeStrategy(address strategy) external;\n\n /// @notice Indicates if the vault was shutted down or not.\n /// @return \"true\" if the contract is paused, and \"false\" otherwise.\n function paused() external view returns (bool);\n}\n" + }, + "src/lending/ILender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface ILender {\n /// @notice Returns the number of tokens the borrower (caller of this function) can take from the lender\n /// @return Available credit as amount of tokens\n function availableCredit() external view returns (uint256);\n\n /// @notice Returns the outstanding debt that the borrower (caller of this function) must repay\n /// @return Outstanding debt as amount of tokens\n function outstandingDebt() external view returns (uint256);\n\n /// @notice Returns the amount of funds taken by the borrower (caller of this function).\n /// @return Debt as amount of tokens\n function currentDebt() external view returns (uint256);\n\n /// @notice Returns the debt ratio of the borrower (caller of this function).\n function currentDebtRatio() external view returns (uint256);\n\n /// @notice Returns the last report timestamp of the borrower (caller of this function).\n function lastReport() external view returns (uint256);\n\n /// @notice Returns the activation status of the borrower (caller of this function).\n /// @return \"true\" if the borrower is active\n function isActivated() external view returns (bool);\n\n /// @notice Reports a positive result of the borrower's debt management.\n /// Borrower must call this function if he has made any profit\n /// or/and has a free funds available to repay the outstanding debt (if any).\n /// @param extraFreeFunds an extra amount of free funds borrower's contract has.\n /// This reporting amount must be greater than the borrower's outstanding debt.\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\n function reportPositiveDebtManagement(\n uint256 extraFreeFunds,\n uint256 debtPayment\n ) external;\n\n /// @notice Reports a negative result of the borrower's debt management.\n /// The borrower must call this function if he is unable to cover his outstanding debt or if he has incurred any losses.\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\n /// May include a portion of the outstanding debt that the borrower was unable to repay.\n /// @param debtPayment is the funds that the borrower must release in order to pay off his outstanding debt (if any).\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\n external;\n}\n" + }, + "src/lending/Lender.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {ILender} from \"./ILender.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror BorrowerAlreadyExists();\nerror BorrowerDoesNotExist();\nerror BorrowerHasDebt();\nerror CallerIsNotABorrower();\nerror LenderRatioExceeded(uint256 freeRatio);\nerror FalsePositiveReport();\n\nabstract contract Lender is\n ILender,\n SafeInitializable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n struct BorrowerData {\n /// Timestamp of the block in which the borrower was activated\n uint256 activationTimestamp;\n /// Last time a borrower made a report\n uint256 lastReportTimestamp;\n /// Amount of tokens taken by the borrower\n uint256 debt;\n /// Maximum portion of the loan that the borrower can take (in BPS)\n /// Represents credibility of the borrower\n uint256 debtRatio;\n }\n\n uint256 public constant MAX_BPS = 10_000;\n\n /// @notice Amount of tokens that all borrowers have taken\n uint256 public totalDebt;\n\n /// @notice Debt ratio for the Lender across all borrowers (in BPS, <= 10k)\n uint256 public debtRatio;\n\n /// @notice Last time a report occurred by any borrower\n uint256 public lastReportTimestamp;\n\n /// @notice Records with information on each borrower using the lender's services\n mapping(address => BorrowerData) public borrowersData;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @notice Event that must occur when the borrower reported the results of his debt management\n /// @param borrower Borrower's contract address\n /// @param debtPayment Amount of outstanding debt repaid by the borrower\n /// @param freeFunds Free funds on the borrower's contract that remain after the debt is paid\n /// @param fundsGiven Funds issued to the borrower by this lender\n /// @param fundsTaken Funds that have been taken from the borrower by the lender\n /// @param loss Amount of funds that the borrower realised as loss\n event BorrowerDebtManagementReported(\n address indexed borrower,\n uint256 debtPayment,\n uint256 freeFunds,\n uint256 fundsGiven,\n uint256 fundsTaken,\n uint256 loss\n );\n\n modifier onlyBorrowers() {\n if (borrowersData[msg.sender].activationTimestamp == 0) {\n revert CallerIsNotABorrower();\n }\n _;\n }\n\n /// @notice Updates the last report timestamp for the specified borrower and this lender.\n modifier updateLastReportTime() {\n _;\n borrowersData[msg.sender].lastReportTimestamp = lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __Lender_init() internal onlyInitializing {\n __Pausable_init();\n __ReentrancyGuard_init();\n\n __Lender_init_unchained();\n }\n\n function __Lender_init_unchained() internal onlyInitializing {\n lastReportTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /// @inheritdoc ILender\n function availableCredit() external view override returns (uint256) {\n return _availableCredit(msg.sender);\n }\n\n /// @inheritdoc ILender\n function outstandingDebt() external view override returns (uint256) {\n return _outstandingDebt(msg.sender);\n }\n\n /// @inheritdoc ILender\n function currentDebt() external view override returns (uint256) {\n return currentDebt(msg.sender);\n }\n\n /// @inheritdoc ILender\n function currentDebtRatio() external view override returns (uint256) {\n return borrowersData[msg.sender].debt;\n }\n\n /// @inheritdoc ILender\n function isActivated() external view override returns (bool) {\n return isActivated(msg.sender);\n }\n\n /// @inheritdoc ILender\n function lastReport() external view override returns (uint256) {\n return lastReport(msg.sender);\n }\n\n /// @inheritdoc ILender\n function reportPositiveDebtManagement(\n uint256 extraFreeFunds,\n uint256 debtPayment\n ) external override onlyBorrowers updateLastReportTime nonReentrant {\n // Checking whether the borrower is telling the truth about his available funds\n if (_borrowerFreeAssets(msg.sender) < extraFreeFunds + debtPayment) {\n revert FalsePositiveReport();\n }\n\n uint256 chargedFees = 0;\n // We can only charge a fees if the borrower has reported extra free funds,\n // if it's the first report at this block and only if the borrower was registered some time ago\n if (\n extraFreeFunds > 0 &&\n borrowersData[msg.sender].lastReportTimestamp < block.timestamp && // solhint-disable-line not-rely-on-time\n borrowersData[msg.sender].activationTimestamp < block.timestamp // solhint-disable-line not-rely-on-time\n ) {\n chargedFees = _chargeFees(extraFreeFunds);\n }\n\n _rebalanceBorrowerFunds(msg.sender, debtPayment, extraFreeFunds, 0);\n\n _afterPositiveDebtManagementReport(extraFreeFunds, chargedFees);\n }\n\n /// @inheritdoc ILender\n function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment)\n external\n override\n onlyBorrowers\n updateLastReportTime\n nonReentrant\n {\n // Checking whether the borrower has available funds for debt payment\n require(_borrowerFreeAssets(msg.sender) >= debtPayment, \"Not enough assets for payment\");\n\n // Debt wasn't repaid, we need to decrease the ratio of this borrower\n if (loss > 0) {\n _decreaseBorrowerCredibility(msg.sender, loss);\n }\n\n _rebalanceBorrowerFunds(msg.sender, debtPayment, 0, loss);\n\n _afterNegativeDebtManagementReport(loss);\n }\n\n /// @notice Balances the borrower's account and adjusts the current amount of funds the borrower can take.\n /// @param borrower a borrower's contract address.\n /// @param debtPayment an amount of outstanding debt since the previous report, that the borrower managed to cover. Can be zero.\n /// @param borrowerFreeFunds a funds that the borrower has earned since the previous report. Can be zero.\n /// @param loss a number of tokens by which the borrower's balance has decreased since the last report.\n function _rebalanceBorrowerFunds(\n address borrower,\n uint256 debtPayment,\n uint256 borrowerFreeFunds,\n uint256 loss\n ) private {\n // Calculate the amount of credit the lender can provide to the borrower (if any)\n uint256 borrowerAvailableCredit = _availableCredit(borrower);\n\n // Make sure that the borrower's debt payment doesn't exceed his actual outstanding debt\n uint256 borrowerOutstandingDebt = _outstandingDebt(msg.sender);\n debtPayment = MathUpgradeable.min(debtPayment, borrowerOutstandingDebt);\n\n // Take into account repaid debt, if any\n if (debtPayment > 0) {\n borrowersData[borrower].debt -= debtPayment;\n totalDebt -= debtPayment;\n }\n\n // Allocate some funds to the borrower if possible\n if (borrowerAvailableCredit > 0) {\n borrowersData[borrower].debt += borrowerAvailableCredit;\n totalDebt += borrowerAvailableCredit;\n }\n\n // Now we need to compare the allocated funds to the borrower and his current free balance.\n // If the number of unrealized tokens on the borrower's contract is less than the available credit, \n // the lender must give that difference to the borrower.\n // Otherwise (if the amount of the borrower's available funds is greater than \n // he should have according to his share), the lender must take that portion of the funds for himself.\n uint256 freeBorrowerBalance = borrowerFreeFunds + debtPayment;\n uint256 fundsGiven = 0;\n uint256 fundsTaken = 0;\n if (freeBorrowerBalance < borrowerAvailableCredit) {\n fundsGiven = borrowerAvailableCredit - freeBorrowerBalance;\n _transferFundsToBorrower(borrower, fundsGiven);\n } else if (freeBorrowerBalance > borrowerAvailableCredit) {\n fundsTaken = freeBorrowerBalance - borrowerAvailableCredit;\n _takeFundsFromBorrower(borrower, fundsTaken);\n }\n\n emit BorrowerDebtManagementReported(\n borrower,\n debtPayment,\n borrowerFreeFunds,\n fundsGiven,\n fundsTaken,\n loss\n );\n }\n\n /// @notice Returns the unrealized amount of the lender's tokens (lender's contract balance)\n function _freeAssets() internal view virtual returns (uint256);\n\n /// @notice Returns the unrealized amount of the borrower's tokens (contract balance of the specified borrower)\n function _borrowerFreeAssets(address borrower)\n internal\n view\n virtual\n returns (uint256);\n\n /// @notice Transfers a specified amount of tokens to the borrower\n function _transferFundsToBorrower(address borrower, uint256 amount)\n internal\n virtual;\n\n /// @notice Takes a specified amount of tokens from the borrower\n function _takeFundsFromBorrower(address borrower, uint256 amount)\n internal\n virtual;\n\n /// @notice Returns the total amount of all tokens (including those on the contract balance and taken by borrowers)\n function lendingAssets() public view virtual returns (uint256) {\n return _freeAssets() + totalDebt;\n }\n\n /// @notice Returns the current debt that the strategy has.\n function currentDebt(address borrower) public view returns (uint256) {\n return borrowersData[borrower].debt;\n }\n\n /// @notice Returns the activation status of the specified borrower.\n function isActivated(address borrower) public view returns (bool) {\n return borrowersData[borrower].activationTimestamp > 0;\n }\n\n /// @notice Returns the last report timestamp of the specified borrower.\n function lastReport(address borrower) public view returns (uint256) {\n return borrowersData[borrower].lastReportTimestamp;\n }\n\n /// @notice Returns the total number of tokens borrowers can take.\n function _debtLimit() private view returns (uint256) {\n return (debtRatio * lendingAssets()) / MAX_BPS;\n }\n\n /// @notice Lowers the borrower's debt he can take by specified loss and decreases his credibility.\n /// @dev This function has \"internal\" visibility because it's used in tests.\n function _decreaseBorrowerCredibility(address borrower, uint256 loss)\n internal\n {\n uint256 debt = borrowersData[borrower].debt;\n\n // Make sure the borrower's loss is less than his entire debt\n require(debt >= loss, \"Loss is greater than the debt\");\n\n // To decrease credibility of the borrower we should lower his \"debtRatio\"\n if (debtRatio > 0) {\n uint256 debtRatioChange = MathUpgradeable.min(\n (debtRatio * loss) / totalDebt,\n borrowersData[borrower].debtRatio\n );\n if (debtRatioChange != 0) {\n borrowersData[borrower].debtRatio -= debtRatioChange;\n debtRatio -= debtRatioChange;\n }\n }\n\n // Also, need to reduce the max amount of funds that can be taken by the borrower\n borrowersData[borrower].debt -= loss;\n totalDebt -= loss;\n }\n\n /// @notice See external implementation\n function _availableCredit(address borrower)\n internal\n view\n returns (uint256)\n {\n // Lender is paused, no funds available for the borrower\n if (paused()) {\n return 0;\n }\n\n uint256 lenderDebtLimit = _debtLimit();\n uint256 lenderDebt = totalDebt;\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\n lendingAssets()) / MAX_BPS;\n uint256 borrowerDebt = borrowersData[borrower].debt;\n\n // There're no more funds for the borrower because he has outstanding debt or the lender's available funds have been exhausted\n if (\n lenderDebtLimit <= lenderDebt || borrowerDebtLimit <= borrowerDebt\n ) {\n return 0;\n }\n\n uint256 lenderAvailableFunds = lenderDebtLimit - lenderDebt;\n uint256 borrowerIntendedCredit = borrowerDebtLimit - borrowerDebt;\n\n // Borrower may not take more funds than the lender's limit\n uint256 borrowerAvailableCredit = MathUpgradeable.min(\n lenderAvailableFunds,\n borrowerIntendedCredit\n );\n\n // Available credit is limited by the existing number of tokens on the lender's contract\n borrowerAvailableCredit = MathUpgradeable.min(\n borrowerAvailableCredit,\n _freeAssets()\n );\n\n return borrowerAvailableCredit;\n }\n\n /// @notice See external implementation\n function _outstandingDebt(address borrower)\n internal\n view\n returns (uint256)\n {\n uint256 borrowerDebt = borrowersData[borrower].debt;\n if (paused() || debtRatio == 0) {\n return borrowerDebt;\n }\n\n uint256 borrowerDebtLimit = (borrowersData[borrower].debtRatio *\n lendingAssets()) / MAX_BPS;\n if (borrowerDebt <= borrowerDebtLimit) {\n return 0;\n }\n\n return borrowerDebt - borrowerDebtLimit;\n }\n\n /// @notice Registers a new borrower and sets for him a certain debt ratio\n function _registerBorrower(address borrower, uint256 borrowerDebtRatio)\n internal\n {\n // Check if specified borrower has already registered\n if (isActivated(borrower)) {\n revert BorrowerAlreadyExists();\n }\n\n if (debtRatio + borrowerDebtRatio > MAX_BPS) {\n revert LenderRatioExceeded(MAX_BPS - debtRatio);\n }\n\n borrowersData[borrower] = BorrowerData(\n // Activation timestamp \n block.timestamp, // solhint-disable-line not-rely-on-time\n // Last report timestamp\n block.timestamp, // solhint-disable-line not-rely-on-time\n // Initial debt\n 0, \n // Debt ratio\n borrowerDebtRatio \n );\n\n debtRatio += borrowerDebtRatio;\n }\n\n /// @notice Sets the borrower's debt ratio. Will be reverted if the borrower doesn't exist or the total debt ratio is exceeded.\n /// @dev In the case where you want to disable the borrower, you need to set its ratio to 0.\n /// Thus, the borrower's current debt becomes an outstanding debt, which he must repay to the lender.\n function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)\n internal\n {\n if (!isActivated(borrower)) {\n revert BorrowerDoesNotExist();\n }\n\n debtRatio -= borrowersData[borrower].debtRatio;\n borrowersData[borrower].debtRatio = borrowerDebtRatio;\n debtRatio += borrowerDebtRatio;\n\n if (debtRatio > MAX_BPS) {\n revert LenderRatioExceeded(\n MAX_BPS - (debtRatio - borrowerDebtRatio)\n );\n }\n }\n\n /// @notice Deletes the borrower from the list\n /// @dev Should be called after the borrower's debt ratio is changed to 0, because the lender must take back all the released funds.\n function _unregisterBorrower(address borrower) internal {\n if (borrowersData[borrower].debtRatio > 0) {\n revert BorrowerHasDebt();\n }\n delete borrowersData[borrower];\n }\n\n /// @notice Charges a fee on the borrower's income.\n /// @param extraFreeFunds an income from which the fees will be calculated.\n /// @return The total amount of fees charged.\n function _chargeFees(uint256 extraFreeFunds)\n internal\n virtual\n returns (uint256);\n\n /// @notice Callback that is called at the end of the positive report function.\n /// @param extraFreeFunds the reported extra amount of borrower's funds.\n /// @param chargedFees the total amount of charged fees.\n function _afterPositiveDebtManagementReport(\n uint256 extraFreeFunds,\n uint256 chargedFees\n ) internal virtual;\n\n /// @notice Callback that is called at the end of the negative report function.\n /// @param loss the number of tokens by which the borrower's balance has decreased since the last report.\n function _afterNegativeDebtManagementReport(uint256 loss) internal virtual;\n}\n" + }, + "src/strategies/ApeLendingStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\nimport {BaseStrategy} from \"./BaseStrategy.sol\";\nimport {ICToken} from \"./protocols/ICToken.sol\";\nimport {IPancakeRouter} from \"./protocols/IPancakeRouter.sol\";\nimport {IRainMaker} from \"./protocols/IRainMaker.sol\";\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IVault} from \"../IVault.sol\";\n\nimport {IVersionable} from \"../upgradeable/IVersionable.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"../upgradeable/SafeUUPSUpgradeable.sol\";\n\nerror IncompatibleCTokenContract();\nerror UnsupportedDecimals();\nerror MintError(uint256 code);\nerror RedeemError(uint256 code);\n\ncontract ApeLendingStrategy is SafeUUPSUpgradeable, BaseStrategy {\n uint256 private constant SECONDS_PER_BLOCK = 3;\n uint256 private constant REWARD_ESTIMATION_ACCURACY = 90;\n\n address public constant BANANA = 0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95;\n address public constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address public constant RAIN_MAKER = 0x5CB93C0AdE6B7F2760Ec4389833B0cCcb5e4efDa;\n address public constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\n /// @notice Minimum BANANA token amount to sell.\n uint256 public minBananaToSell;\n\n ICToken public cToken;\n IPancakeRouter public pancakeRouter;\n IRainMaker public rainMaker;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.3\";\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _vault,\n address _cToken,\n address _ops,\n address _nativeTokenPriceFeed,\n address _assetPriceFeed,\n uint256 _minReportInterval,\n bool _isPrepaid\n ) public initializer {\n __SafeUUPSUpgradeable_init_direct();\n __BaseStrategy_init(\n IVault(_vault),\n _ops,\n _minReportInterval,\n _isPrepaid,\n _nativeTokenPriceFeed,\n _assetPriceFeed,\n address(0)\n ); // ownable under the hood\n\n __ApeLendingStrategy_init_unchained(_cToken);\n }\n\n function __ApeLendingStrategy_init_unchained(address _cToken) internal onlyInitializing {\n cToken = ICToken(_cToken);\n pancakeRouter = IPancakeRouter(PANCAKE_ROUTER);\n rainMaker = IRainMaker(RAIN_MAKER);\n\n if (cToken.decimals() != 8 || _assetDecimals != 18) {\n revert UnsupportedDecimals();\n }\n\n if (cToken.underlying() != address(asset)) {\n revert IncompatibleCTokenContract();\n }\n\n minBananaToSell = 0.1 ether;\n\n approveTokenMax(BANANA, PANCAKE_ROUTER);\n approveTokenMax(address(asset), _cToken);\n }\n\n /// @notice Sets the minimum number of BANANA tokens that must be on the contract to sell.\n function setMinBananaToSell(uint256 _minBananaToSell) external onlyOwner {\n minBananaToSell = _minBananaToSell;\n }\n\n /// @inheritdoc IStrategy\n function name() external view returns (string memory) {\n return\n string.concat(\n IERC20MetadataUpgradeable(address(asset)).symbol(),\n \" ApeLending Strategy\"\n );\n }\n\n /// @inheritdoc BaseStrategy\n function estimatedTotalAssets() public view override returns (uint256) {\n return\n asset.balanceOf(address(this)) +\n depositedBalanceSnapshot() +\n _totalBananaBalanceInAsset();\n }\n\n /// @notice Returns current deposited balance (in asset).\n /// @dev The exchange rate is recalculated at the last time someone touched the cToken contract.\n /// Transactions are not performed too often on this contract, perhaps we should consider recalculating the rate ourselves.\n function depositedBalanceSnapshot() public view returns (uint256) {\n (, uint256 cTokenBalance, , uint256 exchangeRate) = cToken\n .getAccountSnapshot(address(this));\n\n // Since every ApeSwap's cToken has 8 decimals, we can leave 1e18 as constant here.\n return (cTokenBalance * exchangeRate) / 1e18;\n }\n\n /// @notice Returns current deposited balance (in asset).\n /// @dev Unlike the snapshot function, this function recalculates the value of the deposit.\n function depositedBalance() public returns (uint256) {\n return cToken.balanceOfUnderlying(address(this));\n }\n\n /// @notice This function makes a prediction on how much BANANA is accrued per block.\n /// @dev It is not completely accurate because it uses the current protocol balance to predict into the past.\n function _estimatedAccruedBananaPerBlock() internal view returns (uint256) {\n uint256 _depositedBalance = depositedBalanceSnapshot();\n if (_depositedBalance == 0) {\n return 0; // should be impossible to have 0 balance and positive comp accrued\n }\n uint256 distributionPerBlock = rainMaker.compSupplySpeeds(\n address(cToken)\n );\n uint256 totalSupply = (cToken.totalSupply() *\n cToken.exchangeRateStored()) / 1e18;\n return\n totalSupply > 0\n ? (_depositedBalance * distributionPerBlock) / totalSupply\n : 0;\n }\n\n /// @notice This function makes a prediction on how much BANANA is accrued.\n /// @dev It is not completely accurate because it uses the current protocol balance to predict into the past.\n function _estimatedAccruedBanana() internal view returns (uint256) {\n uint256 bananaPerBlock = _estimatedAccruedBananaPerBlock();\n if (bananaPerBlock == 0) {\n return 0;\n }\n uint256 blocksSinceLastHarvest = (block.timestamp - vault.lastReport()) / SECONDS_PER_BLOCK; // solhint-disable-line not-rely-on-time\n return blocksSinceLastHarvest * bananaPerBlock;\n }\n\n /// @notice Returns the current banana balance of the strategy contract.\n function _currentBananaBalance() internal view returns (uint256) {\n return IERC20Upgradeable(BANANA).balanceOf(address(this));\n }\n\n /// @notice Returns the current (and estimated accrued) banana balance of the strategy contract (in asset).\n /// @dev Constant REWARD_ESTIMATION_ACCURACY is used to match accuracy expectations.\n function _totalBananaBalanceInAsset() internal view returns (uint256) {\n uint256 balance = _currentBananaBalance() + _estimatedAccruedBanana();\n if (balance == 0) {\n return 0;\n }\n uint256[] memory amounts = pancakeRouter.getAmountsOut(\n balance,\n _tokenSwapPath(BANANA, address(asset))\n );\n uint256 amount = amounts[amounts.length - 1];\n return (amount * REWARD_ESTIMATION_ACCURACY) / 100;\n }\n\n /// @notice Prepares a chain of tokens (pair or triplet) to pass it into the router contract.\n function _tokenSwapPath(address tokenIn, address tokenOut)\n internal\n pure\n returns (address[] memory path)\n {\n bool isWBNB = tokenIn == address(WBNB) || tokenOut == address(WBNB);\n path = new address[](isWBNB ? 2 : 3);\n path[0] = tokenIn;\n\n if (isWBNB) {\n path[1] = tokenOut;\n } else {\n path[1] = address(WBNB);\n path[2] = tokenOut;\n }\n }\n\n /// @notice Retrieves accrued BANANA from the protocol.\n function _claimBanana() internal {\n ICToken[] memory tokens = new ICToken[](1);\n tokens[0] = cToken;\n rainMaker.claimComp(address(this), tokens);\n }\n\n /// @notice Changes the existing BANANA on the contract to an asset token.\n function _swapBananaToAsset() internal {\n uint256 bananaBalance = IERC20Upgradeable(BANANA).balanceOf(\n address(this)\n );\n if (bananaBalance < minBananaToSell) {\n return;\n }\n\n pancakeRouter.swapExactTokensForTokens(\n bananaBalance,\n 0,\n _tokenSwapPath(BANANA, address(asset)),\n address(this),\n block.timestamp // solhint-disable-line not-rely-on-time\n );\n }\n\n /// @inheritdoc BaseStrategy\n function _harvest(uint256 outstandingDebt)\n internal\n override\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n )\n {\n profit = 0;\n loss = 0;\n\n // No positions to harvest, allocate available funds to pay the debt (if any)\n if (cToken.balanceOf(address(this)) == 0) {\n debtPayment = MathUpgradeable.min(\n asset.balanceOf(address(this)),\n outstandingDebt\n );\n return (profit, loss, debtPayment);\n }\n\n uint256 deposits = depositedBalance();\n\n _claimBanana();\n _swapBananaToAsset();\n\n uint256 assetBalance = asset.balanceOf(address(this));\n uint256 balance = deposits + assetBalance;\n\n uint256 debt = vault.currentDebt();\n\n if (balance > debt) {\n profit = balance - debt;\n if (assetBalance < profit) {\n debtPayment = MathUpgradeable.min(\n assetBalance,\n outstandingDebt\n );\n profit = assetBalance - debtPayment;\n } else if (assetBalance > profit + outstandingDebt) {\n debtPayment = outstandingDebt;\n } else {\n debtPayment = assetBalance - profit;\n }\n } else {\n loss = debt - balance;\n debtPayment = MathUpgradeable.min(assetBalance, outstandingDebt);\n }\n }\n\n /// @inheritdoc BaseStrategy\n function _adjustPosition(uint256 outstandingDebt) internal override {\n if (paused()) {\n return;\n }\n\n uint256 assetBalance = asset.balanceOf(address(this));\n if (assetBalance < outstandingDebt) {\n // We compare the balance with 1 because of rounding error\n if (cToken.balanceOf(address(this)) > 1) {\n _liquidatePosition(outstandingDebt - assetBalance);\n }\n return;\n }\n\n uint256 freeBalance = assetBalance - outstandingDebt;\n if (freeBalance > 0) {\n uint256 result = cToken.mint(freeBalance);\n if (result > 0) {\n revert MintError(result);\n }\n }\n }\n\n /// @inheritdoc BaseStrategy\n /// @dev Tagged with the keyword \"virtual\" for testing purposes.\n function _liquidatePosition(uint256 assets)\n internal\n virtual\n override\n returns (uint256 liquidatedAmount, uint256 loss)\n {\n uint256 assetBalance = asset.balanceOf(address(this));\n if (assetBalance < assets) {\n uint256 deposits = depositedBalance();\n uint256 amountToRedeem = MathUpgradeable.min(deposits, assets);\n uint256 result = cToken.redeemUnderlying(amountToRedeem);\n if (result > 0) {\n revert RedeemError(result);\n }\n liquidatedAmount = amountToRedeem;\n loss = assets - liquidatedAmount;\n } else {\n liquidatedAmount = assets;\n }\n }\n\n /// @inheritdoc BaseStrategy\n function _liquidateAllPositions()\n internal\n override\n returns (uint256 amountFreed)\n {\n uint256 amountToRedeem = depositedBalance();\n uint256 result = cToken.redeemUnderlying(amountToRedeem);\n if (result > 0) {\n revert RedeemError(result);\n }\n amountFreed = amountToRedeem;\n }\n}\n" + }, + "src/strategies/BaseStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport {IStrategy} from \"./IStrategy.sol\";\nimport {IVault} from \"../IVault.sol\";\nimport {GelatoJobAdapter} from \"../automation/GelatoJobAdapter.sol\";\nimport {Job} from \"../automation/Job.sol\";\nimport {HealthChecker} from \"../healthcheck/HealthChecker.sol\";\nimport {PriceConverter} from \"../structures/PriceConverter.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\nerror CallerIsNotAVault();\nerror IncompatiblePriceFeeds();\n\nabstract contract BaseStrategy is\n IStrategy,\n SafeInitializable,\n GelatoJobAdapter,\n HealthChecker,\n PausableUpgradeable\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using PriceConverter for AggregatorV3Interface;\n\n IVault public vault;\n IERC20Upgradeable public asset;\n\n /// @notice Use this to adjust the threshold at which running a debt causes a work trigger.\n uint256 public debtThreshold;\n\n /// @notice The estimated amount of gas required for the \"work\" execution.\n uint256 public estimatedWorkGas;\n\n /// @notice Shows how many times the gas price spent for the \"work\" function should be lower than the profit to trigger.\n uint256 public profitFactor;\n\n /// @notice The USD price feed for the native token of the network on which this strategy works.\n AggregatorV3Interface internal _nativeTokenPriceFeed;\n\n /// @notice The USD price feed for the strategy asset.\n AggregatorV3Interface internal _assetPriceFeed;\n\n /// @notice The underlying asset's decimals.\n uint256 internal _assetDecimals;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n event Harvested(\n uint256 profit,\n uint256 loss,\n uint256 debtPayment,\n uint256 outstandingDebt\n );\n\n event DebtThresholdUpdated(uint256 debtThreshold);\n\n event EstimatedWorkGasUpdated(uint256 estimatedWorkGas);\n\n event UpdatedProfitFactor(uint256 profitFactor);\n\n modifier onlyVault() {\n if (msg.sender != address(vault)) {\n revert CallerIsNotAVault();\n }\n _;\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n function __BaseStrategy_init(\n IVault _vault,\n address _ops,\n uint256 _minReportInterval,\n bool _isPrepaid,\n address __nativeTokenPriceFeed,\n address __assetPriceFeed,\n address _healthCheck\n ) internal onlyInitializing {\n __HealthChecker_init(_healthCheck); // ownable under the hood\n __Pausable_init();\n __GelatoJobAdapter_init(_ops, _minReportInterval, _isPrepaid);\n\n __BaseStrategy_init_unchained(\n _vault,\n __nativeTokenPriceFeed,\n __assetPriceFeed\n );\n }\n\n function __BaseStrategy_init_unchained(\n IVault _vault,\n address __nativeTokenPriceFeed,\n address __assetPriceFeed\n ) internal onlyInitializing {\n vault = _vault;\n asset = IVault(vault).asset();\n\n debtThreshold = 0;\n estimatedWorkGas = 0;\n profitFactor = 100;\n\n _nativeTokenPriceFeed = AggregatorV3Interface(__nativeTokenPriceFeed);\n _assetPriceFeed = AggregatorV3Interface(__assetPriceFeed);\n if (_nativeTokenPriceFeed.decimals() != _assetPriceFeed.decimals()) {\n revert IncompatiblePriceFeeds();\n }\n\n _assetDecimals = IERC20MetadataUpgradeable(address(asset)).decimals();\n\n approveTokenMax(address(asset), address(_vault));\n }\n\n /// @notice Harvests the strategy, recognizing any profits or losses and adjusting the strategy's investments.\n /// @inheritdoc Job\n function _work() internal override {\n uint256 profit = 0;\n uint256 loss = 0;\n uint256 debtPayment = 0;\n\n uint256 outstandingDebt = vault.outstandingDebt();\n if (paused()) {\n (profit, loss, debtPayment) = _harvestAfterShutdown(\n outstandingDebt\n );\n } else {\n (profit, loss, debtPayment) = _harvest(outstandingDebt);\n }\n\n if (profit > 0) {\n vault.reportPositiveDebtManagement(profit, debtPayment);\n } else {\n vault.reportNegativeDebtManagement(loss, debtPayment);\n }\n\n // If the strategy needs to repay the entire debt, we need to take all available funds.\n // We will take the current debt in the report above, but we still need to free up whatever is left.\n // This can happen, if the ratio is reduced to 0 or if the vault has been shutted down.\n outstandingDebt = vault.outstandingDebt();\n outstandingDebt = vault.currentDebtRatio() == 0 || vault.paused()\n ? estimatedTotalAssets()\n : outstandingDebt;\n\n _adjustPosition(outstandingDebt);\n\n uint256 totalDebt = vault.currentDebt();\n performHealthCheck(\n address(this),\n profit,\n loss,\n debtPayment,\n outstandingDebt,\n totalDebt\n );\n\n emit Harvested(profit, loss, debtPayment, outstandingDebt);\n }\n\n /// @inheritdoc Job\n function _canWork() internal view override returns (bool) {\n if (!vault.isActivated()) {\n return false;\n }\n\n // Trigger this job if the strategy has the outstanding debt to repay\n uint256 outstanding = vault.outstandingDebt();\n if (outstanding > debtThreshold) {\n return true;\n }\n\n // Trigger this job if the strategy has some loss to report\n uint256 total = estimatedTotalAssets();\n uint256 debt = vault.currentDebt();\n if (total + debtThreshold < debt) {\n return true;\n }\n\n // Estimate accumulated profit\n uint256 profit = 0;\n if (total > debt) {\n profit = total - debt;\n }\n\n // Check the gas cost againts the profit and available credit.\n // There is no sense to call the \"work\" function, if we don't have decent amount of funds to move.\n return _checkGasPriceAgainstProfit(profit);\n }\n\n /// @notice Calculates the gas price of this transaction and compares it againts the specified profit.\n /// @param profit Profit to be compared to the cost of gas.\n /// @return \"true\" if the gas price (mult. to \"profitFactor\" is lower than the strategy profit, in USD).\n function _checkGasPriceAgainstProfit(uint256 profit) internal view returns (bool) {\n uint256 credit = vault.availableCredit();\n uint256 gasCost = _gasPriceUSD() * estimatedWorkGas;\n return profitFactor * gasCost < _convertAmountToUSD(credit + profit);\n }\n\n /// @inheritdoc IStrategy\n function withdraw(uint256 assets) external override onlyVault returns (uint256 loss) { // Vault already have nonReentrant modifier check\n // Liquidate the requested amount of tokens\n uint256 amountFreed;\n (amountFreed, loss) = _liquidatePosition(assets);\n\n // Send it directly back to the vault\n IERC20Upgradeable(asset).safeTransfer(msg.sender, amountFreed);\n }\n\n /// @notice Shutdown the strategy and revoke it form the vault.\n function shutdown() external nonReentrant onlyOwner { // need check nonReentrant to avoid cyclic call\n _pause();\n IVault(vault).revokeStrategy(address(this));\n }\n\n /// @notice Sets the debt threshold.\n /// @param _debtThreshold The new debt threshold value.\n function setDebtThreshold(uint256 _debtThreshold) external onlyOwner {\n debtThreshold = _debtThreshold;\n emit DebtThresholdUpdated(_debtThreshold);\n }\n\n /// @notice Sets the estimated gas that will be required for \"work\" function.\n /// @param _estimatedWorkGas The estimated \"work\" gas value.\n function setEstimatedWorkGas(uint256 _estimatedWorkGas) external onlyOwner {\n estimatedWorkGas = _estimatedWorkGas;\n emit EstimatedWorkGasUpdated(_estimatedWorkGas);\n }\n\n /// @notice Sets the profit factor.\n /// @param _profitFactor The new profit factor value.\n function setProfitFactor(uint256 _profitFactor) external onlyOwner {\n profitFactor = _profitFactor;\n emit UpdatedProfitFactor(_profitFactor);\n }\n\n /// @notice Frees up as much funds of the base protocol as possible.\n /// @dev This function is called on harvest if the strategy was shutted down.\n /// @param outstandingDebt The outstanding debt of the strategy.\n function _harvestAfterShutdown(uint256 outstandingDebt)\n internal\n virtual\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n )\n {\n uint256 amountFreed = _liquidateAllPositions();\n if (amountFreed < outstandingDebt) {\n loss = outstandingDebt - amountFreed;\n } else if (amountFreed > outstandingDebt) {\n profit = amountFreed - outstandingDebt;\n }\n debtPayment = outstandingDebt - loss;\n }\n\n /// @notice Calculates the gas price of the current transaction (in USD).\n function _gasPriceUSD() internal view returns (uint256) {\n return _nativeTokenPriceFeed.convertAmount(tx.gasprice, 18);\n }\n\n /// @notice Calculates the pice of the specified amount of \"asset\" (in USD).\n function _convertAmountToUSD(uint256 amount)\n internal\n view\n returns (uint256)\n {\n return _assetPriceFeed.convertAmount(amount, _assetDecimals);\n }\n\n /// @notice Sets the max token allowance for the specified spender.\n function approveTokenMax(address token, address spender) internal {\n IERC20Upgradeable(token).safeApprove(spender, type(uint256).max);\n }\n\n /// @notice Estimates the total amount of strategy funds (including those invested in the base protocol).\n function estimatedTotalAssets() public view virtual returns (uint256);\n\n /// @notice The main function of the strategy.\n /// By calling this function, the strategy must realize (take out) the possible profits from the underlying protocol.\n function _harvest(uint256 outstandingDebt)\n internal\n virtual\n returns (\n uint256 profit,\n uint256 loss,\n uint256 debtPayment\n );\n\n /// @notice Performs the deposit of the free funds to the underlying protocol.\n function _adjustPosition(uint256 outstandingDebt) internal virtual;\n\n /// @notice Withdraws the specific amount of \"asset\" from the underlying protocol.\n /// @param assets The amount of token to withdraw.\n /// @return liquidatedAmount Withdrawn amount\n /// @return loss The amount that could not be withdrawn\n function _liquidatePosition(uint256 assets)\n internal\n virtual\n returns (uint256 liquidatedAmount, uint256 loss);\n\n /// @notice Withdraws the entire invested amount from the underlying protocol.\n function _liquidateAllPositions()\n internal\n virtual\n returns (uint256 amountFreed);\n}\n" + }, + "src/strategies/IStrategy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IVault} from \"../IVault.sol\";\n\ninterface IStrategy {\n /// @notice Returns the name of this strategy.\n function name() external view returns (string memory);\n\n /// @notice Returns the contract address of the underlying asset of this strategy.\n function asset() external view returns (IERC20Upgradeable);\n\n /// @notice Returns the contract address of the Vault to which this strategy is connected.\n function vault() external view returns (IVault);\n\n /// @notice Transfers a specified amount of tokens to the vault.\n /// @param assets A amount of tokens to withdraw.\n /// @return loss A number of tokens that the strategy could not return.\n function withdraw(uint256 assets) external returns (uint256 loss);\n}\n" + }, + "src/strategies/protocols/ICToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @notice Interface for Compound-like market (or vault in common terms), that allows to deposit and borrow tokens.\ninterface ICToken {\n function decimals() external returns (uint8);\n\n function underlying() external returns (address);\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external returns (uint256);\n\n function getAccountSnapshot(address account)\n external\n view\n returns (\n uint256,\n uint256,\n uint256,\n uint256\n );\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function totalBorrowsCurrent() external returns (uint256);\n\n function borrowBalanceCurrent(address account) external returns (uint256);\n\n function borrowBalanceStored(address account)\n external\n view\n returns (uint256);\n\n function exchangeRateCurrent() external returns (uint256);\n\n function exchangeRateStored() external view returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount)\n external\n returns (uint256);\n\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n ICToken cTokenCollateral\n ) external returns (uint256);\n}\n" + }, + "src/strategies/protocols/IPancakeRouter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/// @notice Interface for Uniswap-like exchange router.\ninterface IPancakeRouter {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n}\n" + }, + "src/strategies/protocols/IRainMaker.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ICToken} from \"./ICToken.sol\";\n\n/// @notice Interface for a compound-like controller used to control incentivized tokens received during interaction with the protocol.\ninterface IRainMaker {\n struct CompMarketState {\n /// @notice The market's last updated compBorrowIndex or compSupplyIndex\n uint224 index;\n /// @notice The block number the index was last updated at\n uint32 block;\n }\n\n function compSupplierIndex(address, address)\n external\n view\n returns (uint256);\n\n function compSpeeds(address cToken) external view returns (uint256);\n\n function compSupplySpeeds(address cToken) external view returns (uint256);\n\n function compBorrowSpeeds(address cToken) external view returns (uint256);\n\n function claimComp(address holder, ICToken[] memory cTokens) external;\n\n function claimComp(address holder) external;\n\n function compAccrued(address holder) external view returns (uint256);\n\n function compSupplyState(address cToken)\n external\n view\n returns (CompMarketState memory);\n}\n" + }, + "src/structures/AddressList.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nerror ListsDoNotMatch();\n\nlibrary AddressList {\n /// @notice Adds an address to the list.\n /// @param list the list of addresses.\n /// @param addr the address to add.\n function add(address[] storage list, address addr) internal {\n list.push(addr);\n }\n\n /// @notice Checks if the list contains the specified item.\n /// @param list the list of addresses.\n /// @param addr the address to find.\n function contains(address[] storage list, address addr)\n internal\n view\n returns (bool)\n {\n for (uint256 i = 0; i < list.length; i++) {\n if (list[i] == addr) {\n return true;\n }\n }\n return false;\n }\n\n /// @notice Removes an address from the list and fills the gap with the following items by moving them up.\n /// @param list the list of addresses.\n /// @param addr the address to remove.\n /// @return A boolean value that indicates if the address was found and removed from the list.\n function remove(address[] storage list, address addr)\n internal\n returns (bool)\n {\n bool addressFound;\n for (uint256 i = 0; i < list.length; i++) {\n if (list[i] == addr) {\n addressFound = true;\n }\n if (addressFound && i < list.length - 1) {\n list[i] = list[i + 1];\n }\n }\n if (addressFound) {\n list.pop();\n }\n return addressFound;\n }\n\n /// @notice Checks if the list can be reordered in the specified way.\n /// @param list the list of addresses.\n /// @param reoderedList the desired reordered list, which must have the same content as the existing list.\n /// @return A reordered list\n function reorder(address[] storage list, address[] memory reoderedList)\n internal\n view\n returns (address[] memory)\n {\n uint256 length = list.length;\n if (length != reoderedList.length) {\n revert ListsDoNotMatch();\n }\n for (uint256 i = 0; i < length; i++) {\n address existingAddress = list[i];\n for (uint256 j = 0; j < length; j++) {\n // Address is found, move to the next item\n if (existingAddress == reoderedList[j]) {\n break;\n }\n // If this is the last iteration, then the address is not found\n if (j == length - 1) {\n revert ListsDoNotMatch();\n }\n }\n }\n return reoderedList;\n }\n}\n" + }, + "src/structures/PriceConverter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\nimport {SafeMathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\";\n\nerror NegativePrice();\n\nlibrary PriceConverter {\n using SafeMathUpgradeable for uint256;\n\n uint256 public constant UP_TO_DECIMALS = 18;\n\n /// @notice Calculates the price of the specified number of tokens.\n /// @dev This function converts the specified number of tokens to their price (scaled to 18 decimal places).\n /// @param priceFeed The Chainlink's price feed aggregator.\n /// @param amount Number of tokens, the value of which needs to be calculated.\n /// @param decimals Decimals of the specified token.\n /// @return The calculated price of the tokens.\n function convertAmount(\n AggregatorV3Interface priceFeed,\n uint256 amount,\n uint256 decimals\n ) internal view returns (uint256) {\n (, int256 price, , , ) = priceFeed.latestRoundData();\n if (price < 0) {\n revert NegativePrice();\n }\n\n // Scaling decimals up to 18 places to increase accuracy.\n // For example, the \"USD\" price feed has 8 decimal places, so the calculation may result in zeros if a small [amount] is passed.\n uint256 priceDecimals = priceFeed.decimals();\n (, uint256 priceScaledDecimals) = UP_TO_DECIMALS.trySub(priceDecimals);\n uint256 scaledPrice = uint256(price) * 10**priceScaledDecimals;\n\n return amount * scaledPrice / 10**decimals;\n }\n}\n" + }, + "src/tokens/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {ERC777Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport {IERC4626} from \"./IERC4626.sol\";\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\n\n/// @title ERC4626 upgradable tokenized Vault implementation based on ERC-777.\n/// More info in [EIP](https://eips.ethereum.org/EIPS/eip-4626)\n/// Based on Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/mixins/ERC4626.sol)\n///\n/// ERC-777 and ERC-20 tokens represent \"shares\"\n/// Vault “shares” which represent a claim to ownership on a fraction of the Vault’s underlying holdings.\n/// -\n/// @notice Rationale\n/// The mint method was included for symmetry and feature completeness.\n/// Most current use cases of share-based Vaults do not ascribe special meaning to the shares\n/// such that a user would optimize for a specific number of shares (mint)\n/// rather than specific amount of underlying (deposit).\n/// However, it is easy to imagine future Vault strategies which would have unique\n/// and independently useful share representations.\n/// The convertTo functions serve as rough estimates that do not account for operation specific details\n/// like withdrawal fees, etc. They were included for frontends and applications that need an average\n/// value of shares or assets, not an exact value possibly including slippage or other fees.\n/// For applications that need an exact value that attempts to account for fees and slippage we have\n/// included a corresponding preview function to match each mutable function.\n/// These functions must not account for deposit or withdrawal limits, to ensure they are easily composable,\n/// the max functions are provided for that purpose.\nabstract contract ERC4626Upgradeable is\n SafeInitializable,\n ERC777Upgradeable,\n ReentrancyGuardUpgradeable,\n IERC4626\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using FixedPointMathLib for uint256;\n\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n IERC20Upgradeable public asset;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /* ///////////////////////////// EVENTS ///////////////////////////// */\n\n /// `sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`.\n /// emitted when tokens are deposited into the Vault via the mint and deposit methods.\n event Deposit(\n address indexed caller,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /// `sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`.\n /// emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n /**\n * Constructor for the ERC4626Upgradeable contract\n * @param _asset which will be stored in this Vault\n * @dev `defaultOperators` may be an empty array.\n */\n function __ERC4626_init(\n IERC20Upgradeable _asset,\n string memory name_,\n string memory symbol_,\n address[] memory defaultOperators_\n ) internal onlyInitializing {\n __ERC777_init(name_, symbol_, defaultOperators_);\n __ReentrancyGuard_init();\n\n __ERC4626_init_unchained(_asset);\n }\n\n /**\n * Unchained constructor for the ERC4626Upgradeable contract, without parents contracts init\n * @param _asset which will be stored in this Vault\n */\n function __ERC4626_init_unchained(IERC20Upgradeable _asset)\n internal\n onlyInitializing\n {\n asset = _asset;\n }\n\n /* ///////////////////////////// DEPOSIT / WITHDRAWAL ///////////////////////////// */\n\n /// @notice Mints Vault shares to receiver by depositing exactly amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage,\n /// the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function deposit(uint256 assets, address receiver)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n shares = previewDeposit(assets);\n // Check for rounding error since we round down in previewDeposit.\n require(shares != 0, \"Given assets result in 0 shares.\");\n\n _receiveAndDeposit(assets, shares, receiver);\n }\n\n /// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function mint(uint256 shares, address receiver)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n // No need to check for rounding error, previewMint rounds up.\n assets = previewMint(shares);\n\n _receiveAndDeposit(assets, shares, receiver);\n }\n\n /// @notice Base deposit logic which common for public deposit and mint function\n /// Trasfer assets from sender and mint shares for receiver\n function _receiveAndDeposit(\n uint256 assets,\n uint256 shares,\n address receiver\n ) internal {\n // cases when msg.sender != receiver are error prone\n // but they are allowed by the standard... we need take care of it ourselves\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares, \"\", \"\");\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n /// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n /// - emit the Withdraw event.\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\n /// - support a withdraw flow where the shares are burned from owner directly where msg.sender\n /// has ERC-20 approval over the shares of owner.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the withdraw execution, and are accounted for during withdraw.\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual nonReentrant returns (uint256 shares) {\n // No need to check for rounding error, previewWithdraw rounds up.\n shares = previewWithdraw(assets);\n\n _withdrawAndSend(assets, shares, receiver, owner);\n }\n\n /// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n /// - emit the Withdraw event.\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\n /// - support a redeem flow where the shares are burned from owner directly where msg.sender\n /// has ERC-20 approval over the shares of owner.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the redeem execution, and are accounted for during redeem.\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual nonReentrant returns (uint256 assets) {\n assets = previewRedeem(shares);\n // Check for rounding error since we round down in previewRedeem.\n require(assets != 0, \"Given shares result in 0 assets.\");\n\n _withdrawAndSend(assets, shares, receiver, owner);\n }\n\n /// @notice Burn owner shares and send tokens to receiver.\n function _withdrawAndSend(\n uint256 assets,\n uint256 shares,\n address receiver,\n address owner\n ) internal {\n // cases when msg.sender != receiver != owner is error prune\n // but they allowed by standard... take care of it by self\n if (msg.sender != owner) {\n _spendAllowance(owner, msg.sender, shares);\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares, \"\", \"\");\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /* ///////////////////////////// ACCOUNTING ///////////////////////////// */\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block,\n /// given current on-chain conditions.\n /// - return as close to and no more than the exact amount of Vault shares that would be minted\n /// in a deposit call in the same transaction.\n /// I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction.\n /// - NOT account for deposit limits like those returned from maxDeposit\n /// and should always act as though the deposit would be accepted,\n /// regardless if the user has enough tokens approved, etc.\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n /// - NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause deposit to revert.\n /// Note that any unfavorable discrepancy between convertToShares and previewDeposit\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by depositing.\n function previewDeposit(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n return convertToShares(assets);\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block,\n /// given current on-chain conditions.\n /// - return as close to and no fewer than the exact amount of assets that would be deposited\n /// in a mint call in the same transaction.\n /// I.e. mint should return the same or fewer assets as previewMint if called in the same transaction.\n /// - NOT account for mint limits like those returned from maxMint\n /// and should always act as though the mint would be accepted,\n /// regardless if the user has enough tokens approved, etc.\n /// - inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause mint to revert.\n /// Note that any unfavorable discrepancy between convertToAssets and previewMint\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by minting.\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return shares;\n }\n\n return shares.mulDivUp(totalAssets(), supply);\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal\n /// at the current block, given current on-chain conditions.\n /// - return as close to and no fewer than the exact amount of Vault shares\n /// that would be burned in a withdraw call in the same transaction.\n /// I.e. withdraw should return the same or fewer shares as previewWithdraw\n /// if called in the same transaction.\n /// - NOT account for withdrawal limits like those returned from maxWithdraw\n /// and should always act as though the withdrawal would be accepted,\n /// regardless if the user has enough shares, etc.\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause withdraw to revert.\n /// Note that any unfavorable discrepancy between convertToShares and previewWithdraw\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by depositing.\n function previewWithdraw(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return assets;\n }\n return assets.mulDivUp(supply, totalAssets());\n }\n\n /// @notice Allows an on-chain or off-chain user to simulate the effects of their\n /// redeemption at the current block, given current on-chain conditions.\n /// - return as close to and no more than the exact amount of assets that would be withdrawn\n /// in a redeem call in the same transaction.\n /// I.e. redeem should return the same or more assets as previewRedeem\n /// if called in the same transaction.\n /// - NOT account for redemption limits like those returned from maxRedeem\n /// and should always act as though the redemption would be accepted,\n /// regardless if the user has enough shares, etc.\n /// - inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n /// - NOT revert due to vault specific user/global limits.\n /// MAY revert due to other conditions that would also cause redeem to revert.\n /// Note that any unfavorable discrepancy between convertToAssets and previewRedeem\n /// SHOULD be considered slippage in share price or some other type of condition,\n /// meaning the depositor will lose assets by redeeming.\n function previewRedeem(uint256 shares)\n public\n view\n virtual\n returns (uint256)\n {\n return convertToAssets(shares);\n }\n\n /// @notice The amount of shares that the Vault would exchange for the amount of assets provided,\n /// in an ideal scenario where all the conditions are met.\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\n /// - do NOT show any variations depending on the caller.\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\n /// - round down towards 0.\n /// This calculation MAY NOT reflect the “per-user” price-per-share,\n /// and instead should reflect the “average-user’s” price-per-share,\n /// meaning what the average user should expect to see when exchanging to and from.\n function convertToShares(uint256 assets)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return assets;\n }\n\n return assets.mulDivDown(supply, totalAssets());\n }\n\n /// @notice The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.\n /// - is NOT inclusive of any fees that are charged against assets in the Vault.\n /// - do NOT show any variations depending on the caller.\n /// - do NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n /// - do NOT revert unless due to integer overflow caused by an unreasonably large input.\n /// - round down towards 0.\n /// This calculation MAY NOT reflect the “per-user” price-per-share,\n /// and instead should reflect the “average-user’s” price-per-share,\n /// meaning what the average user should expect to see when exchanging to and from.\n function convertToAssets(uint256 shares)\n public\n view\n virtual\n returns (uint256)\n {\n uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.\n if (supply == 0) {\n return shares;\n }\n\n return shares.mulDivDown(totalAssets(), supply);\n }\n\n /// @notice Total amount of the underlying asset that is “managed” by Vault.\n /// - include any compounding that occurs from yield.\n /// - inclusive of any fees that are charged against assets in the Vault.\n /// - is NOT revert\n /// @dev Must be implemented by child contract.\n function totalAssets() public view virtual returns (uint256);\n\n /* //////////////////////////////// DEPOSIT / WITHDRAWAL LIMIT //////////////////////////////// */\n\n /// @notice Maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n /// through a deposit call.\n /// - returns the maximum amount of assets deposit would allow to be deposited\n /// for receiver and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\n /// - factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /// @notice Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call.\n /// - return the maximum amount of shares mint would allow to be deposited to receiver\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.\n /// - factor in both global and user-specific limits,\n /// like if mints are entirely disabled (even temporarily) it MUST return 0.\n /// - return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /// @notice Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault,\n /// through a withdraw call.\n /// - return the maximum amount of assets that could be transferred from owner through withdraw\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// - factor in both global and user-specific limits,\n /// like if withdrawals are entirely disabled (even temporarily) it MUST return 0.\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf(owner));\n }\n\n /// @notice Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n /// through a redeem call.\n /// - return the maximum amount of shares that could be transferred from owner through redeem\n /// and not cause a revert, which MUST NOT be higher than the actual maximum\n /// that would be accepted (it should underestimate if necessary).\n /// - factor in both global and user-specific limits,\n /// like if redemption is entirely disabled (even temporarily) it MUST return 0.\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf(owner);\n }\n\n /* //////////////////////////////// INTERNAL HOOKS //////////////////////////////// */\n\n /// @notice Called before withdraw will be made the Vault.\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\n\n /// @notice Called when a deposit is made to the Vault.\n /// @dev allow implement additional logic for withdraw, hooks a prefered way rather then wrapping\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {} // solhint-disable-line no-empty-blocks\n}\n" + }, + "src/tokens/ERC5484Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {ERC721EnumerableUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\nimport {ERC721URIStorageUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {IAccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {CountersUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport {IERC5484} from \"./IERC5484.sol\";\n\ncontract ERC5484Upgradeable is\n IERC5484,\n Initializable,\n ERC721Upgradeable,\n ERC721EnumerableUpgradeable,\n ERC721URIStorageUpgradeable,\n AccessControlUpgradeable\n{\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n CountersUpgradeable.Counter private _tokenIdCounter;\n\n /// @dev burn mode with different behavior\n BurnAuth private _burnAuth;\n\n /// @dev Token can me minted only once per user\n bool private _mintOnce;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n /// @dev Modifier to protect a burn a token without permission\n modifier allowedTransfer(address to, address from, uint256 tokenId) {\n bool isMint = from == address(0);\n bool isBurner = hasRole(BURNER_ROLE, msg.sender);\n bool isBurn = !isMint && to == address(0);\n if(_burnAuth == BurnAuth.Neither) {\n // nobody can burn token\n require(isMint, \"ERC5484: can't be transferred\");\n } else if(_burnAuth == BurnAuth.IssuerOnly) {\n // only issuer can burn token\n // so we are checking if token is generation with condition from == address(0)\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\n bool isBurnOperation = isBurner && isBurn;\n require(isMint || isBurnOperation, \"ERC5484: can't be transferred\");\n } else if (_burnAuth == BurnAuth.OwnerOnly){\n // only owner can burn token\n // so we are checking if token is generation with condition from == ownerOf(tokenId) and it is burn operation\n bool isOwner = _ownerOf(tokenId) == msg.sender && hasRole(BURNER_ROLE, msg.sender);\n require(isMint || (isOwner && isBurn), \"ERC5484: can't be transferred\");\n } else if (_burnAuth == BurnAuth.Both) {\n // both owner and issuer can burn token\n // so we are checking if token is minting with condition from == address(0)\n // or we are checking that token belongs to other user and message sender is owner and it is burn operation\n require(isMint || (isBurn && isBurner), \"ERC5484: can't be transferred\");\n }\n _;\n }\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n function __ERC5484Upgradeable_init(\n string memory name_,\n string memory symbol_,\n BurnAuth burnAuth_,\n bool mintOnce_,\n address admin_\n ) internal onlyInitializing {\n __ERC721_init(name_, symbol_);\n __ERC721Enumerable_init();\n __ERC721URIStorage_init();\n __AccessControl_init();\n _burnAuth = burnAuth_;\n _mintOnce = mintOnce_;\n\n // setup roles depend on mode for SoulBound token\n _setupRole(DEFAULT_ADMIN_ROLE, admin_);\n _setupRole(MINTER_ROLE, admin_);\n if(burnAuth_ == BurnAuth.IssuerOnly || burnAuth_ == BurnAuth.Both) {\n _setupRole(BURNER_ROLE, admin_);\n }\n }\n\n /// @dev function for mint new SBT token\n /// @param to address of user who will receive token\n /// @param uri token metadata uri\n function safeMint(address to, string memory uri) public virtual onlyRole(MINTER_ROLE) {\n // allow to mint only once per user if _mintOnce is true\n if(_mintOnce && balanceOf(to) != 0) {\n return;\n }\n\n // mint token\n uint256 tokenId = _tokenIdCounter.current();\n _tokenIdCounter.increment();\n _safeMint(to, tokenId);\n _setTokenURI(tokenId, uri);\n\n // set permission to burn token\n if(_burnAuth == BurnAuth.OwnerOnly || _burnAuth == BurnAuth.Both) {\n _setupRole(BURNER_ROLE, to);\n }\n\n // emit event\n emit Issued(address(0), to, tokenId, _burnAuth);\n }\n\n /// @dev Token is SOUL BOUND and it is not allowed to move token between users\n function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)\n internal\n virtual\n allowedTransfer(to, from, tokenId)\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\n {\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\n }\n\n /// @dev Burns `tokenId`. See {ERC721-_burn}.\n function burn(uint256 tokenId) external\n onlyRole(BURNER_ROLE)\n virtual\n {\n _burn(tokenId);\n }\n\n /// @dev See {ERC721-_burn}\n function _burn(uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable){\n super._burn(tokenId);\n }\n\n /// @dev See {IERC721Metadata-tokenURI}.\n function tokenURI(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable)\n returns (string memory)\n {\n return super.tokenURI(tokenId);\n }\n\n /// @dev See {IERC165-supportsInterface}.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable, AccessControlUpgradeable)\n virtual\n returns (bool)\n {\n return interfaceId == type(IERC5484).interfaceId\n || interfaceId == type(IAccessControlUpgradeable).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /// @notice provides burn authorization of the token id.\n /// @dev unassigned tokenIds are invalid, and queries do throw\n /// @param tokenId The identifier for a token.\n function burnAuth(uint256 tokenId) external view virtual returns (BurnAuth){\n require(_exists(tokenId), \"ERC5484: token doesn't exists\");\n return _burnAuth;\n }\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[48] private __gap;\n}" + }, + "src/tokens/IERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title ERC4626 complient Vault interface\ninterface IERC4626 {\n /// @notice The underlying token managed by the Vault. Has units defined by the corresponding ERC-20 contract.\n /// Stored as address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n function asset() external view returns (IERC20Upgradeable);\n}\n" + }, + "src/tokens/IERC5484.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\ninterface IERC5484 {\n /// A guideline to standardlize burn-authorization's number coding\n enum BurnAuth {\n IssuerOnly,\n OwnerOnly,\n Both,\n Neither\n }\n\n /// @notice Emitted when a soulbound token is issued.\n /// @dev This emit is an add-on to nft's transfer emit in order to distinguish sbt\n /// from vanilla nft while providing backward compatibility.\n /// @param from The issuer\n /// @param to The receiver\n /// @param tokenId The id of the issued token\n event Issued (\n address indexed from,\n address indexed to,\n uint256 indexed tokenId,\n BurnAuth burnAuth\n );\n\n /// @notice provides burn authorization of the token id.\n /// @dev unassigned tokenIds are invalid, and queries do throw\n /// @param tokenId The identifier for a token.\n function burnAuth(uint256 tokenId) external view returns (BurnAuth);\n}" + }, + "src/tokens/IVaultFounderToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport {IERC721MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\nimport {IERC721EnumerableUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\";\nimport {IERC5484} from \"./IERC5484.sol\";\n\n/// @title ERC721 complient Token interface\ninterface IVaultFounderToken is\n IERC5484,\n IERC721Upgradeable,\n IERC721MetadataUpgradeable,\n IERC721EnumerableUpgradeable\n{\n function priceOf(uint256 tokenId) external view returns (uint256);\n function nextTokenPrice() external view returns (uint256);\n function setTokenURI(string memory _tokenURI) external;\n}" + }, + "src/tokens/IVaultHook.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\n\n/// @title ERC4626 Vault Token lifecycle hook interface\ninterface IVaultHook {\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request) external;\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external;\n}\n\nstruct ERC4626UpgradeableRequest {\n /// @dev The amount of assets to be deposited.\n uint256 assets;\n\n /// @dev The amount of shares to be minted.\n uint256 shares;\n\n /// @dev The address that initiated the request.\n address requestSender;\n\n /// @dev The amount of assets the sender is allowed to withdraw.\n uint256 senderMaxWithdraw;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[46] gap;\n}" + }, + "src/tokens/RewardHolder.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\nimport {Vault} from \"../Vault.sol\";\n\ncontract RewardHolder is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable {\n using FixedPointMathLib for uint256;\n\n /// @notice Emitted reward is claimed by a token owner\n event RewardClaimed(uint256 reward, address receiver);\n /// @notice Emitted when new rewards are deposited\n event RewardDeposited(address sender, uint value);\n\n /// @notice Accumulator of the total earned interest rate since the opening of the token\n uint public rewardIndex = 1e8;\n\n /// @notice The owners' reward indexes for eachas of the last time they accrued\n mapping(address => uint) public rewardOwnerIndex;\n\n /// @notice\n uint public numberCoins;\n\n Vault public vault;\n\n bytes32 public constant BALANCE_UPDATER_ROLE = keccak256(\"BALANCE_UPDATE_ROLE\");\n bytes32 public constant REWARD_CLAIMER_ROLE = keccak256(\"BALANCE_UPDATE_ROLE\");\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n function __RewardHolder_init(\n address admin_\n ) internal onlyInitializing {\n __AccessControl_init();\n _setupRole(BALANCE_UPDATER_ROLE, admin_);\n _setupRole(DEFAULT_ADMIN_ROLE, admin_);\n __ReentrancyGuard_init();\n }\n\n /// @dev set vault\n /// @notice that is mandatory to be set before reward can be claimed\n function setVault(Vault vault_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n vault = vault_;\n }\n\n /// @dev deposit reward to the contract to be claimed by token owners\n /// @notice only role with BALANCE_UPDATER_ROLE can call this function\n /// @param plusReward amount of reward to be deposited\n function depositReward(uint256 plusReward) public onlyRole(BALANCE_UPDATER_ROLE) nonReentrant {\n // update reward index for claim reward logic\n rewardIndex += plusReward;\n emit RewardDeposited(_msgSender(), plusReward);\n }\n\n /// @dev claim reward for token owner\n /// @notice only role with REWARD_CLAIMER_ROLE can call this function\n function claimReward() external onlyRole(REWARD_CLAIMER_ROLE) nonReentrant {\n require(vault != Vault(address(0)), \"Vault not set.\");\n\n require(rewardOwnerIndex[msg.sender] != 0, \"Caller doesn't have reward.\");\n\n uint deltaIndex = rewardIndex - rewardOwnerIndex[msg.sender];\n\n // calculate reward for token owner\n //todo discuss the proper calculation mechanism\n uint256 tokenOwnerReward = deltaIndex.mulDivDown(1, numberCoins);\n rewardOwnerIndex[msg.sender] = rewardIndex;\n\n // transfer reward to token owner\n vault.transfer(msg.sender, tokenOwnerReward);\n emit RewardClaimed(tokenOwnerReward, address(msg.sender));\n }\n\n /// @dev setup new owner for reward usually called when minting new token\n function setupNewOwner(address rewardOwner) external onlyRole(BALANCE_UPDATER_ROLE) {\n rewardOwnerIndex[rewardOwner] = rewardIndex;\n _setupRole(REWARD_CLAIMER_ROLE, rewardOwner);\n numberCoins++;\n }\n}" + }, + "src/tokens/SafeERC4626Lifecycle.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {SafeERC4626Upgradeable} from \"./SafeERC4626Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\nimport {IVaultHook, ERC4626UpgradeableRequest} from \"./IVaultHook.sol\";\n\nabstract contract SafeERC4626Lifecycle is SafeERC4626Upgradeable {\n // list of hooks\n IVaultHook[] public withdrawHooks;\n IVaultHook[] public depositHooks;\n\n /// @dev Adds hook to the list of deposit hooks\n function addDepositHook(IVaultHook hook) internal {\n depositHooks.push(hook);\n }\n\n /// @dev Adds hook to the list of withdraw hooks\n function addWithdrawHook(IVaultHook hook) internal {\n withdrawHooks.push(hook);\n }\n\n /// @dev Removes hook from the list of deposit hooks\n function removeDepositHook(IVaultHook hook) internal {\n // find hook\n for (uint256 i = 0; i < depositHooks.length; i++)\n {\n if (depositHooks[i] == hook)\n {\n // remove hook\n depositHooks[i] = depositHooks[depositHooks.length - 1];\n depositHooks.pop();\n return;\n }\n }\n }\n\n /// @dev Removes hook from the list of withdraw hooks\n function removeWithdrawHook(IVaultHook hook) internal {\n // find hook\n for (uint256 i = 0; i < withdrawHooks.length; i++)\n {\n if (withdrawHooks[i] == hook)\n {\n // remove hook\n withdrawHooks[i] = withdrawHooks[withdrawHooks.length - 1];\n withdrawHooks.pop();\n return;\n }\n }\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function beforeWithdraw(uint256 assets, uint256 shares)\n internal virtual override(ERC4626Upgradeable)\n {\n // if there are no hooks, then return to save gas\n if(withdrawHooks.length == 0) {\n return;\n }\n uint256[46] memory gap_; // this is needed for future upgrades\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\n assets: assets,\n shares: shares,\n requestSender: msg.sender,\n senderMaxWithdraw: maxWithdraw(msg.sender),\n gap: gap_\n });\n // iterate over hooks and call it\n for (uint256 i = 0; i < withdrawHooks.length; i++)\n {\n IVaultHook hook = withdrawHooks[i];\n hook.beforeWithdrawTrigger(request);\n }\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function afterDeposit(uint256 assets, uint256 shares)\n internal virtual override(ERC4626Upgradeable)\n {\n // if there are no depositHooks, then return to save gas\n if(depositHooks.length == 0) {\n return;\n }\n uint256[46] memory gap_; // this is needed for future upgrades\n ERC4626UpgradeableRequest memory request = ERC4626UpgradeableRequest({\n assets: assets,\n shares: shares,\n requestSender: msg.sender,\n senderMaxWithdraw: maxWithdraw(msg.sender),\n gap: gap_\n });\n // iterate over depositHooks and call it\n for (uint256 i = 0; i < depositHooks.length; i++)\n {\n IVaultHook hook = depositHooks[i];\n hook.afterDepositTrigger(request);\n }\n }\n}" + }, + "src/tokens/SafeERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\n\n/// @title Safier and limited implementation of ERC-4626\n/// @notice ERC-4626 standard allow deposit and withdraw not for message sender.\n/// It commonly known issue, which hardly to test and much error prune.\n/// Such interfaces caused vulnarabilities, which resulted in million dollars hacks.\n/// On anther hand, this interfaces not have any use cases which cannot be implemented without `transferFrom` method.\n/// This implementation prevent spends and allowances from any methods except transferFrom/send\n/// Also main business logic simplified to reduce gas consumption.\nabstract contract SafeERC4626Upgradeable is ERC4626Upgradeable {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using FixedPointMathLib for uint256;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /**\n * Constructor for the SafeERC4626Upgradeable contract\n * @param _asset which will be stored in this Vault\n * @dev `defaultOperators` may be an empty array.\n */\n function __SafeERC4626_init(\n IERC20Upgradeable _asset,\n string memory name_,\n string memory symbol_,\n address[] memory defaultOperators_\n ) internal onlyInitializing {\n __ERC4626_init(_asset, name_, symbol_, defaultOperators_);\n }\n\n /**\n * Unchained constructor for the SafeERC4626Upgradeable contract, without parents contracts init\n * @param _asset which will be stored in this Vault\n */\n function __SafeERC4626Upgradeable_init_unchained(IERC20Upgradeable _asset)\n internal\n onlyInitializing\n {\n __ERC4626_init_unchained(_asset);\n }\n\n /// @notice Mints the Vault shares for msg.sender, according to the number of deposited base tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function deposit(uint256 assets)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n shares = previewDeposit(assets);\n // Check for rounding error since we round down in previewDeposit.\n require(shares != 0, \"Given assets result in 0 shares.\");\n\n _receiveAndDeposit(assets, shares, msg.sender);\n }\n\n /// @notice Mints exactly requested Vault shares to msg.sender by depositing any required amount of underlying tokens.\n /// - emits the Deposit event.\n /// - support ERC-20 approve / transferFrom on asset as a deposit flow.\n /// MAY support an additional flow in which the underlying tokens are owned by the Vault contract\n /// before the deposit execution, and are accounted for during deposit.\n /// - revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).\n /// Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n function mint(uint256 shares)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n // No need to check for rounding error, previewMint rounds up.\n assets = previewMint(shares);\n\n _receiveAndDeposit(assets, shares, msg.sender);\n }\n\n /// @notice Burns shares from msg.sender and sends exactly assets of underlying tokens to msg.sender.\n /// - emit the Withdraw event.\n /// - support a withdraw flow where the shares are burned from owner directly where owner is msg.sender.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the withdraw execution, and are accounted for during withdraw.\n /// - revert if all of assets cannot be withdrawn (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function withdraw(uint256 assets)\n public\n virtual\n nonReentrant\n returns (uint256 shares)\n {\n // No need to check for rounding error, previewWithdraw rounds up.\n shares = previewWithdraw(assets);\n\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\n }\n\n /// @notice Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender.\n /// - emit the Withdraw event.\n /// - support a redeem flow where the shares are burned from owner directly where owner is msg.sender.\n /// - MAY support an additional flow in which the shares are transferred to the Vault contract\n /// before the redeem execution, and are accounted for during redeem.\n /// - revert if all of shares cannot be redeemed (due to withdrawal limit being reached,\n /// slippage, the owner not having enough shares, etc).\n /// Note that some implementations will require pre-requesting to the Vault\n /// before a withdrawal may be performed. Those methods should be performed separately.\n function redeem(uint256 shares)\n public\n virtual\n nonReentrant\n returns (uint256 assets)\n {\n assets = previewRedeem(shares);\n // Check for rounding error since we round down in previewRedeem.\n require(assets != 0, \"Given shares result in 0 assets.\");\n\n _withdrawAndSend(assets, shares, msg.sender, msg.sender);\n }\n\n /* //////////////////// Backwards compatible methods ////////////////////////// */\n\n /// @inheritdoc ERC4626Upgradeable\n function deposit(\n uint256 assets,\n address /* receiver */\n ) public virtual override returns (uint256 shares) {\n // nonReentrant under the hood\n return deposit(assets);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function mint(\n uint256 shares,\n address /* receiver */\n ) public virtual override returns (uint256 assets) {\n // nonReentrant under the hood\n return mint(shares);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function withdraw(\n uint256 assets,\n address, /* receiver */\n address /* owner */\n ) public virtual override returns (uint256 shares) {\n // nonReentrant under the hood\n return withdraw(assets);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function redeem(\n uint256 shares,\n address, /* receiver */\n address /* owner */\n ) public virtual override returns (uint256 assets) {\n // nonReentrant under the hood\n return redeem(shares);\n }\n}\n" + }, + "src/tokens/VaultFounderToken.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {IERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\n\nimport {SafeInitializable} from \"../upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"../upgradeable/SafeUUPSUpgradeable.sol\";\nimport {IVersionable} from \"../upgradeable/IVersionable.sol\";\nimport {ERC5484Upgradeable} from \"./ERC5484Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./ERC4626Upgradeable.sol\";\nimport {IVaultFounderToken} from \"./IVaultFounderToken.sol\";\nimport {IVaultHook, ERC4626UpgradeableRequest} from \"./IVaultHook.sol\";\nimport {RewardHolder} from \"./RewardHolder.sol\";\n\ncontract VaultFounderToken is IVaultFounderToken, SafeUUPSUpgradeable, ERC5484Upgradeable, IVaultHook, RewardHolder {\n\n // Max number of tokens that can be minted\n uint256 private _maxCountTokens;\n\n // Next token price multiplier in percents\n uint256 private _nextTokenPriceMultiplier;\n\n // Initial token price\n uint256 private _initialTokenPrice;\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[46] private __gap;\n\n /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n uint256 maxCountTokens_,\n uint256 nextTokenPriceMultiplier_,\n uint256 initialTokenPrice_,\n address admin_\n ) public initializer {\n __SafeUUPSUpgradeable_init_direct();\n __ERC5484Upgradeable_init(\"Eonian Vault Founder Token\", \"EVFT\", BurnAuth.Neither, true, admin_);\n __RewardHolder_init(admin_);\n _maxCountTokens = maxCountTokens_;\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\n _initialTokenPrice = initialTokenPrice_;\n }\n\n /// @inheritdoc IVersionable\n function version() external pure returns (string memory) {\n return \"0.1.0\";\n }\n\n /// @dev function for mint new SBT token\n /// @param to address of user who will receive token\n /// @param uri token metadata uri\n function safeMint(address to, string memory uri) public virtual override(ERC5484Upgradeable) {\n if(totalSupply() < _maxCountTokens) {\n super.safeMint(to, uri);\n }\n }\n\n /// @inheritdoc ERC721Upgradeable\n function _safeMint(address to, uint256 tokenId) internal override {\n require(totalSupply() < _maxCountTokens, \"EVFT: max number of tokens\");\n super._safeMint(to, tokenId);\n }\n\n function priceOf(uint256 tokenId) external view returns (uint256) {\n require(tokenId < totalSupply(), \"EVFT: Token does not exist\");\n return _priceOf(tokenId);\n }\n\n function _priceOf(uint256 tokenId) internal view returns (uint256) {\n uint256 price = _initialTokenPrice;\n for (uint256 i = 0; i < tokenId; i++) {\n price = (price * _nextTokenPriceMultiplier) / 10_000;\n }\n return price;\n }\n\n function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _nextTokenPriceMultiplier = nextTokenPriceMultiplier_;\n }\n\n function nextTokenPrice() external view returns (uint256){\n return _nextTokenPrice();\n }\n\n function _nextTokenPrice() internal view returns (uint256){\n return _priceOf(totalSupply());\n }\n\n function setTokenURI(string memory _tokenURI) external override {\n address tokenOwner = msg.sender;\n uint256 tokenId = tokenOfOwnerByIndex(tokenOwner, 0);\n _setTokenURI(tokenId, _tokenURI);\n }\n\n function afterDepositTrigger(ERC4626UpgradeableRequest memory request)\n external override\n {\n if(request.senderMaxWithdraw >= _nextTokenPrice()) {\n safeMint(request.requestSender, \"\");\n }\n }\n\n /* solhint-disable no-empty-blocks */\n function beforeWithdrawTrigger(ERC4626UpgradeableRequest memory request) external override\n {\n //empty code\n }\n /* solhint-disable no-empty-blocks */\n\n /// @dev See {IERC165-supportsInterface}.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC5484Upgradeable, AccessControlUpgradeable, IERC165Upgradeable)\n virtual\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n}" + }, + "src/upgradeable/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n// Import to compile and make ERC1967Proxy available for deploy\nimport {ERC1967Proxy} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";" + }, + "src/upgradeable/IVersionable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\n/** \n * Allow properly identify different versions of the same contract \n * and track upgrades results \n * */\ninterface IVersionable {\n /// @notice Returns the current version of this contract\n /// @return a version in semantic versioning format\n function version() external pure returns (string memory);\n}\n" + }, + "src/upgradeable/SafeInitializable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IVersionable} from \"./IVersionable.sol\";\n\n/** Implement best practices for initializable contracts */\nabstract contract SafeInitializable is IVersionable, Initializable {\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /**\n * This constructor prevents UUPS Uninitialized Proxies Vulnerability in all contracts which inherit from it.\n * More info about vulnerability: https://medium.com/immunefi/wormhole-uninitialized-proxy-bugfix-review-90250c41a43a\n * \n * @dev Initial fix for this vulnerability was suggested as using `_disableInitializers()` function in constructor,\n * but later, in version 4.3.2, OpenZeppelin implemented `onlyProxy` modifier for UUPS upgradable contracts,\n * which fixed this vulnerability. Still, `_disableInitializers()` is a best practice which prevents unintended access \n * to implementation contracts that can be used maliciously.\n * \n * More info: https://forum.openzeppelin.com/t/how-to-test-upgradeability-for-proxies/33436/7 \n * and https://forum.openzeppelin.com/t/uupsupgradeable-vulnerability-post-mortem/15680\n * \n * To prevent code duplication of constructor, this contract can be used. On the other hand, \n * it can be used as a marker for contracts that are safe from this vulnerability.\n * Additionally, `needDisableInitializers` parameter can be used to enable initializers in mocks and unit tests.\n *\n * @param needDisableInitializers - if true, initializers will be disabled\n */\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) {\n if(needDisableInitializers) {\n _disableInitializers();\n }\n }\n}" + }, + "src/upgradeable/SafeUUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {SafeInitializable} from \"./SafeInitializable.sol\";\n\n/** \n * Implement basic safety mechanism for UUPS proxy\n * based on owner authorization for upgrades\n * */\nabstract contract SafeUUPSUpgradeable is UUPSUpgradeable, SafeInitializable, OwnableUpgradeable {\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /** Init all required constructors, including ownable */\n function __SafeUUPSUpgradeable_init() internal onlyInitializing {\n __SafeUUPSUpgradeable_init_direct();\n\n __Ownable_init();\n }\n\n /** Init only direct constructors, UUPS only */\n function __SafeUUPSUpgradeable_init_direct() internal onlyInitializing {\n __UUPSUpgradeable_init();\n }\n\n /** Authorise that upgrades can do only owner */\n function _authorizeUpgrade(address newImplementation) internal onlyOwner override {} // solhint-disable-line no-empty-blocks\n}\n" + }, + "src/Vault.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.19;\n\nimport {MathUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\";\nimport {SafeERC20Upgradeable, IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\nimport {IVault} from \"./IVault.sol\";\nimport {Lender, BorrowerDoesNotExist} from \"./lending/Lender.sol\";\nimport {SafeERC4626Upgradeable} from \"./tokens/SafeERC4626Upgradeable.sol\";\nimport {ERC4626Upgradeable} from \"./tokens/ERC4626Upgradeable.sol\";\nimport {IStrategy} from \"./strategies/IStrategy.sol\";\nimport {AddressList} from \"./structures/AddressList.sol\";\nimport {SafeInitializable} from \"./upgradeable/SafeInitializable.sol\";\nimport {SafeUUPSUpgradeable} from \"./upgradeable/SafeUUPSUpgradeable.sol\";\nimport {IVersionable} from \"./upgradeable/IVersionable.sol\";\nimport {SafeERC4626Lifecycle} from \"./tokens/SafeERC4626Lifecycle.sol\";\nimport {IVaultHook} from \"./tokens/IVaultHook.sol\";\nimport {VaultFounderToken} from \"./tokens/VaultFounderToken.sol\";\n\n\nerror ExceededMaximumFeeValue();\nerror UnexpectedZeroAddress();\nerror InappropriateStrategy();\nerror StrategyNotFound();\nerror StrategyAlreadyExists();\nerror InsufficientVaultBalance(uint256 assets, uint256 shares);\nerror WrongQueueSize(uint256 size);\nerror InvalidLockedProfitReleaseRate(uint256 durationInSeconds);\nerror AccessDeniedForCaller(address caller);\n\ncontract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Lender, SafeERC4626Lifecycle {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using AddressList for address[];\n\n /// @notice Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).\n uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;\n\n /// @notice Rewards contract where management fees are sent to.\n address public rewards;\n\n /// @notice Vault Founders Token contract where rewards for founders are sent to.\n address public founders;\n\n /// @notice Vault management fee (in BPS).\n uint256 public managementFee;\n\n /// @notice Vault founders reward (in BPS).\n uint256 public vaultFoundersRewardFee;\n\n /// @notice Arranged list of addresses of strategies, which defines the order for withdrawal.\n address[] public withdrawalQueue;\n\n /// @notice The amount of funds that cannot be withdrawn by users.\n /// Decreases with time at the rate of \"lockedProfitReleaseRate\".\n uint256 public lockedProfitBaseline;\n\n /// @notice The rate of \"lockedProfitBaseline\" decline on the locked-in profit scale (scaled to 1e18).\n /// Represents the amount of funds that will be unlocked when one second passes.\n uint256 public lockedProfitReleaseRate;\n\n /// @notice Event that should happen when the strategy connects to the vault.\n /// @param strategy Address of the strategy contract.\n /// @param debtRatio Maximum portion of the loan that the strategy can take (in BPS).\n event StrategyAdded(address indexed strategy, uint256 debtRatio);\n\n /// @notice Event that should happen when the strategy has been revoked from the vault.\n /// @param strategy Address of the strategy contract.\n event StrategyRevoked(address indexed strategy);\n\n /// @notice Event that should happen when the strategy has been removed from the vault.\n /// @param strategy Address of the strategy contract.\n /// @param fromQueueOnly If \"true\", then the strategy has only been removed from the withdrawal queue.\n event StrategyRemoved(address indexed strategy, bool fromQueueOnly);\n\n /// @notice Event that should happen when the strategy has been returned to the withdrawal queue.\n /// @param strategy Address of the strategy contract.\n event StrategyReturnedToQueue(address indexed strategy);\n\n /// @notice Event that should happen when the locked-in profit release rate changed.\n event LockedProfitReleaseRateChanged(uint256 rate);\n\n /// @dev This empty reserved space is put in place to allow future versions to add new\n /// variables without shifting down storage in the inheritance chain.\n /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[50] private __gap;\n\n /// @inheritdoc IVersionable\n function version() external pure override returns (string memory) {\n return \"0.1.9\";\n }\n\n modifier onlyOwnerOrStrategy(address strategy) {\n if (msg.sender != owner() && msg.sender != strategy) {\n revert AccessDeniedForCaller(msg.sender);\n }\n _;\n }\n\n // ------------------------------------------ Constructors ------------------------------------------\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks\n\n function initialize(\n address _asset,\n address _rewards,\n uint256 _managementFee,\n uint256 _lockedProfitReleaseRate,\n string memory _name,\n string memory _symbol,\n address[] memory _defaultOperators,\n uint256 _foundersRewardRate\n ) public initializer {\n __SafeUUPSUpgradeable_init(); // Ownable under the hood\n __Lender_init();\n __SafeERC4626_init(\n IERC20Upgradeable(_asset),\n bytes(_name).length == 0\n ? string.concat(\n IERC20Metadata(_asset).symbol(),\n \" Eonian Vault Shares\"\n )\n : _name,\n bytes(_symbol).length == 0\n ? string.concat(\"eon\", IERC20Metadata(_asset).symbol())\n : _symbol,\n _defaultOperators\n );\n\n setRewards(_rewards);\n setManagementFee(_managementFee);\n setLockedProfitReleaseRate(_lockedProfitReleaseRate);\n setFoundersRewardFee(_foundersRewardRate);\n }\n\n /// @dev Override to add the \"whenNotPaused\" modifier\n /// @inheritdoc SafeERC4626Upgradeable\n function deposit(uint256 assets)\n public\n override\n whenNotPaused\n returns (uint256 shares)\n {\n return super.deposit(assets);\n }\n\n /// @notice Hook that is used before withdrawals to release assets from strategies if necessary.\n /// @inheritdoc ERC4626Upgradeable\n function beforeWithdraw(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\n // There is no need to withdraw assets from strategies, the vault has sufficient funds\n if (_freeAssets() >= assets) {\n return;\n }\n\n for (uint256 i = 0; i < withdrawalQueue.length; i++) {\n // If the vault already has the required amount of funds, we need to finish the withdrawal\n uint256 vaultBalance = _freeAssets();\n if (assets <= vaultBalance) {\n break;\n }\n\n address strategy = withdrawalQueue[i];\n\n // We can only withdraw the amount that the strategy has as debt,\n // so that the strategy can work on the unreported (yet) funds it has earned\n uint256 requiredAmount = MathUpgradeable.min(\n assets - vaultBalance,\n borrowersData[strategy].debt\n );\n\n // Skip this strategy is there is nothing to withdraw\n if (requiredAmount == 0) {\n continue;\n }\n\n // Withdraw the required amount of funds from the strategy\n uint256 loss = IStrategy(strategy).withdraw(requiredAmount);\n\n // If the strategy failed to return all of the requested funds, we need to reduce the strategy's debt ratio\n if (loss > 0) {\n _decreaseBorrowerCredibility(strategy, loss);\n }\n }\n\n // Revert if insufficient assets remain in the vault after withdrawal from all strategies\n if (_freeAssets() < assets) {\n revert InsufficientVaultBalance(assets, shares);\n }\n\n // apply the hook\n SafeERC4626Lifecycle.beforeWithdraw(assets, shares);\n }\n\n /// @notice Adds a new strategy to the vault.\n /// @param strategy a new strategy address.\n /// @param debtRatio a ratio that shows how much of the new strategy can take, relative to other strategies.\n function addStrategy(address strategy, uint256 debtRatio)\n external\n onlyOwner\n whenNotPaused\n {\n if (strategy == address(0)) {\n revert UnexpectedZeroAddress();\n }\n\n // Strategy should refer to this vault and has the same underlying asset\n if (\n this != IStrategy(strategy).vault() ||\n asset != IStrategy(strategy).asset()\n ) {\n revert InappropriateStrategy();\n }\n\n _registerBorrower(strategy, debtRatio);\n withdrawalQueue.add(strategy);\n\n emit StrategyAdded(strategy, debtRatio);\n }\n\n /// @notice Adds a strategy to the withdrawal queue. The strategy must already be registered as a borrower.\n /// @param strategy a strategy address.\n function addStrategyToQueue(address strategy) external onlyOwner {\n if (strategy == address(0)) {\n revert UnexpectedZeroAddress();\n }\n\n if (withdrawalQueue.contains(strategy)) {\n revert StrategyAlreadyExists();\n }\n\n if (borrowersData[strategy].activationTimestamp == 0) {\n revert BorrowerDoesNotExist();\n }\n\n withdrawalQueue.add(strategy);\n\n emit StrategyReturnedToQueue(strategy);\n }\n\n /// @inheritdoc IVault\n function revokeStrategy(address strategy)\n external\n onlyOwnerOrStrategy(strategy)\n {\n _setBorrowerDebtRatio(strategy, 0);\n emit StrategyRevoked(strategy);\n }\n\n /// @notice Removes a strategy from the vault.\n /// @param strategy a strategy to remove.\n /// @param fromQueueOnly if \"true\", then the strategy will only be removed from the withdrawal queue.\n function removeStrategy(address strategy, bool fromQueueOnly)\n external\n onlyOwner\n {\n bool removedFromQueue = withdrawalQueue.remove(strategy);\n if (!removedFromQueue) {\n revert StrategyNotFound();\n }\n\n if (!fromQueueOnly) {\n _unregisterBorrower(strategy);\n }\n\n emit StrategyRemoved(strategy, fromQueueOnly);\n }\n\n /// @notice Sets the withdrawal queue.\n /// @param queue a new queue that will replace the existing one.\n /// Should contain only those elements that already present in the existing queue.\n function reorderWithdrawalQueue(address[] memory queue) external onlyOwner {\n withdrawalQueue = withdrawalQueue.reorder(queue);\n }\n\n /// @notice Sets the vault rewards address.\n /// @param _rewards a new rewards address.\n function setRewards(address _rewards) public onlyOwner {\n rewards = _rewards;\n }\n\n /// @notice Sets the vault management fee. Both management and foundersReward fee can't exceed 100%\n /// @param _managementFee a new management fee value (in BPS).\n function setManagementFee(uint256 _managementFee) public onlyOwner {\n if (_managementFee + vaultFoundersRewardFee > MAX_BPS) {\n revert ExceededMaximumFeeValue();\n }\n\n managementFee = _managementFee;\n }\n\n /// @notice Sets the vault founder token contract;\n /// @param _founders a new founder token contract address.\n function setFounders(address _founders) external onlyOwner {\n founders = _founders;\n addDepositHook(IVaultHook(founders));\n }\n\n /// @notice Sets the vault founder token reward rate. Both management and foundersReward fee can't exceed 100%\n /// @param _foundersRewardFee a new founder token reward fee (in BPS).\n function setFoundersRewardFee(uint256 _foundersRewardFee) public onlyOwner {\n if (_foundersRewardFee + managementFee > MAX_BPS) {\n revert ExceededMaximumFeeValue();\n }\n vaultFoundersRewardFee = _foundersRewardFee;\n }\n\n /// @notice Switches the vault pause state.\n /// @param shutdown a new vault pause state. If \"true\" is passed, the vault will be paused.\n function setEmergencyShutdown(bool shutdown) external onlyOwner {\n shutdown ? _pause() : _unpause();\n }\n\n /// @notice Changes the rate of release of locked-in profit.\n /// @param rate the rate of release of locked profit (percent per second scaled to 1e18).\n /// The desire value of this parameter can be calculated as 1e18 / DurationInSeconds.\n function setLockedProfitReleaseRate(uint256 rate) public onlyOwner {\n if (rate > LOCKED_PROFIT_RELEASE_SCALE) {\n revert InvalidLockedProfitReleaseRate(rate);\n }\n\n lockedProfitReleaseRate = rate;\n emit LockedProfitReleaseRateChanged(rate);\n }\n\n /// @notice Calculates the locked profit, takes into account the change since the last report.\n function _lockedProfit() internal view returns (uint256) {\n // Release rate should be small, since the timestamp can be manipulated by the node operator,\n // not expected to have much impact, since the changes will be applied to all users and cannot be abused directly.\n uint256 ratio = (block.timestamp - lastReportTimestamp) * lockedProfitReleaseRate; // solhint-disable-line not-rely-on-time\n\n // In case the ratio >= scale, the calculation anyway leads to zero.\n if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) {\n return 0;\n }\n\n uint256 lockedProfitChange = (ratio * lockedProfitBaseline) / LOCKED_PROFIT_RELEASE_SCALE;\n\n // Reducing locked profits over time frees up profits for users\n return lockedProfitBaseline - lockedProfitChange;\n }\n\n /// @inheritdoc Lender\n function _chargeFees(uint256 extraFreeFunds)\n internal\n override\n returns (uint256)\n {\n uint256 fee = (extraFreeFunds * managementFee) / MAX_BPS;\n if (fee > 0) {\n _mint(rewards, convertToShares(fee), \"\", \"\", false);\n }\n if(founders == address(0)) {\n return fee;\n }\n uint256 vaultFoundersReward = (extraFreeFunds * vaultFoundersRewardFee) / MAX_BPS;\n if (vaultFoundersReward > 0) {\n _mint(founders, convertToShares(vaultFoundersReward), \"\", \"\", false);\n }\n return fee + vaultFoundersReward;\n }\n\n /// @notice Updates the locked-in profit value according to the positive debt management report of the strategy\n /// @inheritdoc Lender\n function _afterPositiveDebtManagementReport(\n uint256 extraFreeFunds,\n uint256 chargedFees\n ) internal override {\n // Locking every reported strategy profit, taking into account the charged fees.\n lockedProfitBaseline = _lockedProfit() + extraFreeFunds - chargedFees;\n }\n\n /// @notice Updates the locked-in profit value according to the negative debt management report of the strategy\n /// @inheritdoc Lender\n function _afterNegativeDebtManagementReport(uint256 loss)\n internal\n override\n {\n uint256 currentLockedProfit = _lockedProfit();\n\n // If a loss occurs, it is necessary to release the appropriate amount of funds that users were able to withdraw it.\n lockedProfitBaseline = currentLockedProfit > loss\n ? currentLockedProfit - loss\n : 0;\n }\n\n /// @notice Returns the current debt of the strategy.\n /// @param strategy the strategy address.\n function strategyDebt(address strategy) external view returns (uint256) {\n return borrowersData[strategy].debt;\n }\n\n /// @notice Returns the debt ratio of the strategy.\n /// @param strategy the strategy address.\n function strategyRatio(address strategy) external view returns (uint256) {\n return borrowersData[strategy].debtRatio;\n }\n\n /// @notice Returns the size of the withdrawal queue.\n function getQueueSize() external view returns (uint256) {\n return withdrawalQueue.length;\n }\n\n /// @inheritdoc Lender\n function _freeAssets() internal view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @inheritdoc Lender\n function _borrowerFreeAssets(address borrower)\n internal\n view\n override\n returns (uint256)\n {\n return asset.balanceOf(borrower);\n }\n\n /// @inheritdoc ERC4626Upgradeable\n function totalAssets() public view override returns (uint256) {\n return super.lendingAssets() - _lockedProfit();\n }\n\n /// @inheritdoc IVault\n /// @dev Explicitly overridden here to keep this function exposed via \"IVault\" interface.\n function paused()\n public\n view\n override(IVault, PausableUpgradeable)\n returns (bool)\n {\n return super.paused();\n }\n\n /// @inheritdoc Lender\n function _transferFundsToBorrower(address borrower, uint256 amount)\n internal\n override\n {\n asset.safeTransfer(borrower, amount);\n }\n\n /// @inheritdoc Lender\n function _takeFundsFromBorrower(address borrower, uint256 amount)\n internal\n override\n {\n asset.safeTransferFrom(borrower, address(this), amount);\n }\n\n function afterDeposit(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, SafeERC4626Lifecycle) {\n SafeERC4626Lifecycle.afterDeposit(assets, shares);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "storageLayout", + "devdoc", + "userdoc", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "contracts/=src/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "solmate/=lib/solmate/src/" + ] + } +} \ No newline at end of file diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 780b70e0..740cf7eb 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -19,6 +19,7 @@ "clean": "forge clean && rm -rf ./artifacts && rm -rf ./cache_hardhat && rm -rf ./out && rm -rf ./typechain-types", "test:fuzz": "FOUNDRY_FUZZ_RUNS=1000 forge test -vvv", "test:coverage": "forge coverage", + "test:coverage-report": "rm -rf coverage && mkdir coverage && forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage --ignore-errors category", "dev": "FOUNDRY_FUZZ_RUNS=5 forge test --watch -vvv", "serve": "hardhat node --export-all './deployments/local.json'", "lint": "solhint 'src/**/*.sol' --formatter stylish --fix && yarn lint:license", diff --git a/packages/contracts/src/Vault.sol b/packages/contracts/src/Vault.sol index 183eb08c..46aa504f 100644 --- a/packages/contracts/src/Vault.sol +++ b/packages/contracts/src/Vault.sol @@ -18,14 +18,20 @@ import {AddressList} from "./structures/AddressList.sol"; import {SafeInitializable} from "./upgradeable/SafeInitializable.sol"; import {SafeUUPSUpgradeable} from "./upgradeable/SafeUUPSUpgradeable.sol"; import {IVersionable} from "./upgradeable/IVersionable.sol"; +import {ERC4626Lifecycle} from "./tokens/ERC4626Lifecycle.sol"; +import {IVaultHook} from "./tokens/IVaultHook.sol"; +import {VaultFounderToken} from "./tokens/VaultFounderToken.sol"; +import {RewardHolder} from "./tokens/RewardHolder.sol"; + error ExceededMaximumFeeValue(); error InsufficientVaultBalance(uint256 assets, uint256 shares); error InvalidLockedProfitReleaseRate(uint256 durationInSeconds); error InappropriateStrategy(); +error FoundersNotSet(); -contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, StrategiesLender { +contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, StrategiesLender, ERC4626Lifecycle { using SafeERC20Upgradeable for IERC20Upgradeable; /// @notice Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%). @@ -45,10 +51,16 @@ contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Strategie /// Represents the amount of funds that will be unlocked when one second passes. uint256 public lockedProfitReleaseRate; + /// @notice Vault Founders Token contract where rewards for founders are sent to. + address public founders; + + /// @notice Vault founders reward (in BPS). + uint256 public foundersFee; + /// @dev This empty reserved space is put in place to allow future versions to add new /// variables without shifting down storage in the inheritance chain. /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps - uint256[50] private __gap; + uint256[48] private __gap; /// @notice Event that should happen when the locked-in profit release rate changed. event LockedProfitReleaseRateChanged(uint256 rate); @@ -70,7 +82,8 @@ contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Strategie uint256 _lockedProfitReleaseRate, string memory _name, string memory _symbol, - address[] memory _defaultOperators + address[] memory _defaultOperators, + uint256 _foundersFee ) public initializer { __SafeUUPSUpgradeable_init(); // Ownable under the hood __StrategiesLender_init_lenderSpecific(); // require Ownable @@ -91,6 +104,7 @@ contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Strategie setRewards(_rewards); setManagementFee(_managementFee); setLockedProfitReleaseRate(_lockedProfitReleaseRate); + setFoundersFee(_foundersFee); } /// @dev Override to add the "whenNotPaused" modifier @@ -106,7 +120,7 @@ contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Strategie /// @notice Hook that is used before withdrawals to release assets from strategies if necessary. /// @inheritdoc ERC4626Upgradeable - function beforeWithdraw(uint256 assets, uint256 shares) internal override { + function beforeWithdraw(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, ERC4626Lifecycle) { // There is no need to withdraw assets from strategies, the vault has sufficient funds if (_freeAssets() >= assets) { return; @@ -146,6 +160,9 @@ contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Strategie if (_freeAssets() < assets) { revert InsufficientVaultBalance(assets, shares); } + + // apply the hook + ERC4626Lifecycle.beforeWithdraw(assets, shares); } /// Check that all new strategies refer to this vault and has the same underlying asset @@ -161,16 +178,32 @@ contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Strategie rewards = _rewards; } - /// @notice Sets the vault management fee. + /// @notice Sets the vault management fee. Both management and foundersReward fee can't exceed 100% /// @param _managementFee a new management fee value (in BPS). function setManagementFee(uint256 _managementFee) public onlyOwner { - if (_managementFee > MAX_BPS) { + if (_managementFee + foundersFee > MAX_BPS) { revert ExceededMaximumFeeValue(); } managementFee = _managementFee; } + /// @notice Sets the vault founder token contract; + /// @param _founders a new founder token contract address. + function setFounders(address _founders) external onlyOwner { + founders = _founders; + addDepositHook(IVaultHook(founders)); + } + + /// @notice Sets the vault founder token reward rate. Both management and foundersReward fee can't exceed 100% + /// @param _foundersFee a new founder token reward fee (in BPS). + function setFoundersFee(uint256 _foundersFee) public onlyOwner { + if (_foundersFee + managementFee > MAX_BPS) { + revert ExceededMaximumFeeValue(); + } + foundersFee = _foundersFee; + } + /// @notice Changes the rate of release of locked-in profit. /// @param rate the rate of release of locked profit (percent per second scaled to 1e18). /// The desire value of this parameter can be calculated as 1e18 / DurationInSeconds. @@ -210,8 +243,17 @@ contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Strategie if (fee > 0) { _mint(rewards, convertToShares(fee), "", "", false); } - - return fee; + if(founders == address(0)) { + return fee; + } + uint256 vaultFoundersReward = (extraFreeFunds * foundersFee) / MAX_BPS; + if (vaultFoundersReward > 0) { + // if rewards are set, we mint the tokens to the vault and update index for Claim rewards contract + uint256 shares = convertToShares(vaultFoundersReward); + _mint(founders, shares, "", "", false); + RewardHolder(founders).depositReward(shares); + } + return fee + vaultFoundersReward; } /// @notice Updates the locked-in profit value according to the positive debt management report of the strategy @@ -284,4 +326,8 @@ contract Vault is IVault, SafeUUPSUpgradeable, SafeERC4626Upgradeable, Strategie { asset.safeTransferFrom(borrower, address(this), amount); } + + function afterDeposit(uint256 assets, uint256 shares) internal override(ERC4626Upgradeable, ERC4626Lifecycle) { + ERC4626Lifecycle.afterDeposit(assets, shares); + } } diff --git a/packages/contracts/src/tokens/ERC4626Lifecycle.sol b/packages/contracts/src/tokens/ERC4626Lifecycle.sol new file mode 100644 index 00000000..4084090d --- /dev/null +++ b/packages/contracts/src/tokens/ERC4626Lifecycle.sol @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity ^0.8.19; + +import {SafeERC4626Upgradeable} from "./SafeERC4626Upgradeable.sol"; +import {ERC4626Upgradeable} from "./ERC4626Upgradeable.sol"; +import {IVaultHook, ERC4626HookPayload} from "./IVaultHook.sol"; + +abstract contract ERC4626Lifecycle is SafeERC4626Upgradeable { + // list of hooks + IVaultHook[] public withdrawHooks; + IVaultHook[] public depositHooks; + + /// @dev This empty reserved space is put in place to allow future versions to add new + /// variables without shifting down storage in the inheritance chain. + /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + uint256[50] private __gap; + + /// @dev Adds hook to the list of deposit hooks + function addDepositHook(IVaultHook hook) internal { + depositHooks.push(hook); + } + + /// @dev Adds hook to the list of withdraw hooks + function addWithdrawHook(IVaultHook hook) internal { + withdrawHooks.push(hook); + } + + /// @dev Removes hook from the list of deposit hooks + function removeDepositHook(IVaultHook hook) internal { + // find hook + for (uint256 i = 0; i < depositHooks.length; i++) + { + if (depositHooks[i] == hook) + { + // remove hook + depositHooks[i] = depositHooks[depositHooks.length - 1]; + depositHooks.pop(); + return; + } + } + } + + /// @dev Removes hook from the list of withdraw hooks + function removeWithdrawHook(IVaultHook hook) internal { + // find hook + for (uint256 i = 0; i < withdrawHooks.length; i++) + { + if (withdrawHooks[i] == hook) + { + // remove hook + withdrawHooks[i] = withdrawHooks[withdrawHooks.length - 1]; + withdrawHooks.pop(); + return; + } + } + } + + /// @inheritdoc ERC4626Upgradeable + function beforeWithdraw(uint256 assets, uint256 shares) + internal virtual override(ERC4626Upgradeable) + { + // if there are no hooks, then return to save gas + if(withdrawHooks.length == 0) { + return; + } + ERC4626HookPayload memory request = ERC4626HookPayload({ + assets: assets, + shares: shares, + requestSender: msg.sender, + senderMaxWithdraw: maxWithdraw(msg.sender) + }); + // iterate over hooks and call it + for (uint256 i = 0; i < withdrawHooks.length; i++) + { + IVaultHook hook = withdrawHooks[i]; + hook.beforeWithdrawTrigger(request); + } + } + + /// @inheritdoc ERC4626Upgradeable + function afterDeposit(uint256 assets, uint256 shares) + internal virtual override(ERC4626Upgradeable) + { + // if there are no depositHooks, then return to save gas + if(depositHooks.length == 0) { + return; + } + ERC4626HookPayload memory request = ERC4626HookPayload({ + assets: assets, + shares: shares, + requestSender: msg.sender, + senderMaxWithdraw: maxWithdraw(msg.sender) + }); + // iterate over depositHooks and call it + for (uint256 i = 0; i < depositHooks.length; i++) + { + IVaultHook hook = depositHooks[i]; + hook.afterDepositTrigger(request); + } + } +} \ No newline at end of file diff --git a/packages/contracts/src/tokens/ERC5484Upgradeable.sol b/packages/contracts/src/tokens/ERC5484Upgradeable.sol new file mode 100644 index 00000000..e992c6ca --- /dev/null +++ b/packages/contracts/src/tokens/ERC5484Upgradeable.sol @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity ^0.8.19; + +import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; +import {ERC721EnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; +import {ERC721URIStorageUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol"; +import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import {IAccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol"; +import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import {CountersUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; +import {IERC5484} from "./IERC5484.sol"; + +contract ERC5484Upgradeable is + IERC5484, + Initializable, + ERC721Upgradeable, + ERC721EnumerableUpgradeable, + ERC721URIStorageUpgradeable, + AccessControlUpgradeable +{ + using CountersUpgradeable for CountersUpgradeable.Counter; + + // @dev utility object for counting tokens + CountersUpgradeable.Counter private _tokenIdCounter; + + /// @dev burn mode with different behavior + BurnAuth private _burnAuth; + + /// @dev Token can me minted only once per user + bool private _mintOnce; + + /// @dev This empty reserved space is put in place to allow future versions to add new + /// variables without shifting down storage in the inheritance chain. + /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + uint256[50] private __gap; + + /// @dev Role for minting tokens + /// value is 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6 + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + /// @dev Role for burning tokens which can be used only if _burnAuth isn't BurnAuth.None + /// value is 0x3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848 + bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); + + /// @dev Modifier to protect a burn a token without permission + modifier allowedTransfer(address to, address from, uint256 tokenId) { + bool isMint = from == address(0); + bool isBurner = hasRole(BURNER_ROLE, msg.sender); + bool isBurn = !isMint && to == address(0); + if(_burnAuth == BurnAuth.Neither) { + // nobody can burn token + require(isMint, "ERC5484: can't be transferred"); + } else if(_burnAuth == BurnAuth.IssuerOnly) { + // only issuer can burn token + // so we are checking if token is generation with condition from == address(0) + // or we are checking that token belongs to other user and message sender is owner and it is burn operation + bool isBurnOperation = isBurner && isBurn; + require(isMint || isBurnOperation, "ERC5484: can't be transferred"); + } else if (_burnAuth == BurnAuth.OwnerOnly){ + // only owner can burn token + // so we are checking if token is generation with condition from == ownerOf(tokenId) and it is burn operation + bool isOwner = _ownerOf(tokenId) == msg.sender && hasRole(BURNER_ROLE, msg.sender); + require(isMint || (isOwner && isBurn), "ERC5484: can't be transferred"); + } else if (_burnAuth == BurnAuth.Both) { + // both owner and issuer can burn token + // so we are checking if token is minting with condition from == address(0) + // or we are checking that token belongs to other user and message sender is owner and it is burn operation + require(isMint || (isBurn && isBurner), "ERC5484: can't be transferred"); + } + _; + } + + /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */ + + function __ERC5484Upgradeable_init( + string memory name_, + string memory symbol_, + BurnAuth burnAuth_, + bool mintOnce_ + ) internal onlyInitializing { + __ERC721_init(name_, symbol_); + __ERC721Enumerable_init(); + __ERC721URIStorage_init(); + __AccessControl_init(); + + __ERC5484Upgradeable_init_unchained(burnAuth_, mintOnce_); + } + + function __ERC5484Upgradeable_init_unchained( + BurnAuth burnAuth_, + bool mintOnce_ + ) internal onlyInitializing { + _burnAuth = burnAuth_; + _mintOnce = mintOnce_; + + // setup roles depend on mode for SoulBound token + _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); + } + + /// @dev function for mint new SBT token + /// @param to address of user who will receive token + /// @param uri token metadata uri + /// @return true if token was minted + function safeMint(address to, string memory uri) + public + virtual + onlyRole(MINTER_ROLE) + returns(bool) + { + // allow to mint only once per user if _mintOnce is true + if(_mintOnce && balanceOf(to) != 0) { + return false; + } + + // mint token + uint256 tokenId = _tokenIdCounter.current(); + _tokenIdCounter.increment(); + _safeMint(to, tokenId); + _setTokenURI(tokenId, uri); + + // set permission to burn token + if(_burnAuth == BurnAuth.OwnerOnly || _burnAuth == BurnAuth.Both) { + _setupRole(BURNER_ROLE, to); + } + + // emit event + emit Issued(address(0), to, tokenId, _burnAuth); + return true; + } + + /// @dev Token is SOUL BOUND and it is not allowed to move token between users + function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize) + internal + virtual + allowedTransfer(to, from, tokenId) + override(ERC721Upgradeable, ERC721EnumerableUpgradeable) + { + super._beforeTokenTransfer(from, to, tokenId, batchSize); + } + + /// @dev Burns `tokenId`. See {ERC721-_burn}. + function burn(uint256 tokenId) external + onlyRole(BURNER_ROLE) + virtual + { + _burn(tokenId); + } + + /// @dev See {ERC721-_burn} + function _burn(uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable){ + super._burn(tokenId); + } + + /// @dev See {IERC721Metadata-tokenURI}. + function tokenURI(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable) + returns (string memory) + { + return super.tokenURI(tokenId); + } + + /// @dev See {IERC165-supportsInterface}. + function supportsInterface(bytes4 interfaceId) + public + view + override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable, AccessControlUpgradeable) + virtual + returns (bool) + { + return interfaceId == type(IERC5484).interfaceId + || interfaceId == type(IAccessControlUpgradeable).interfaceId + || super.supportsInterface(interfaceId); + } + + /// @notice provides burn authorization of the token id. + /// @dev unassigned tokenIds are invalid, and queries do throw + /// @param tokenId The identifier for a token. + function burnAuth(uint256 tokenId) external view virtual returns (BurnAuth){ + require(_exists(tokenId), "ERC5484: token doesn't exists"); + return _burnAuth; + } +} \ No newline at end of file diff --git a/packages/contracts/src/tokens/IERC4626.sol b/packages/contracts/src/tokens/IERC4626.sol index fe2e8613..c77866c7 100644 --- a/packages/contracts/src/tokens/IERC4626.sol +++ b/packages/contracts/src/tokens/IERC4626.sol @@ -8,7 +8,7 @@ import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. */ interface IERC4626 { - + /* ///////////////////////////// EVENTS ///////////////////////////// */ /// `sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`. diff --git a/packages/contracts/src/tokens/IERC5484.sol b/packages/contracts/src/tokens/IERC5484.sol new file mode 100644 index 00000000..95998cd7 --- /dev/null +++ b/packages/contracts/src/tokens/IERC5484.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity ^0.8.19; + +interface IERC5484 { + /// A guideline to standardlize burn-authorization's number coding + enum BurnAuth { + IssuerOnly, + OwnerOnly, + Both, + Neither + } + + /// @notice Emitted when a soulbound token is issued. + /// @dev This emit is an add-on to nft's transfer emit in order to distinguish sbt + /// from vanilla nft while providing backward compatibility. + /// @param from The issuer + /// @param to The receiver + /// @param tokenId The id of the issued token + event Issued ( + address indexed from, + address indexed to, + uint256 indexed tokenId, + BurnAuth burnAuth + ); + + /// @notice provides burn authorization of the token id. + /// @dev unassigned tokenIds are invalid, and queries do throw + /// @param tokenId The identifier for a token. + function burnAuth(uint256 tokenId) external view returns (BurnAuth); +} \ No newline at end of file diff --git a/packages/contracts/src/tokens/IVaultFounderToken.sol b/packages/contracts/src/tokens/IVaultFounderToken.sol new file mode 100644 index 00000000..a7e27b26 --- /dev/null +++ b/packages/contracts/src/tokens/IVaultFounderToken.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity ^0.8.19; + +import {IERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; +import {IERC721MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol"; +import {IERC721EnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol"; +import {IERC5484} from "./IERC5484.sol"; + +/// @title ERC721 complient Token interface +interface IVaultFounderToken is + IERC5484, + IERC721Upgradeable, + IERC721MetadataUpgradeable, + IERC721EnumerableUpgradeable +{ + /// @dev set token metadata uri + /// can be used as utility method and custom logic on front-end + function setTokenURI(string memory _tokenURI) external; + /// @dev set token metadata uri + /// can be used as utility method and custom logic on front-end by owner of the contract + /// in case of end user has a wrong uri or somebody corrupted it + function setTokenURI(string memory _tokenURI, uint256 tokenId) external; +} \ No newline at end of file diff --git a/packages/contracts/src/tokens/IVaultHook.sol b/packages/contracts/src/tokens/IVaultHook.sol new file mode 100644 index 00000000..d0421a5d --- /dev/null +++ b/packages/contracts/src/tokens/IVaultHook.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity ^0.8.19; + +import {ERC4626Upgradeable} from "./ERC4626Upgradeable.sol"; + +/// @title ERC4626 Vault Token lifecycle hook interface +interface IVaultHook { + function afterDepositTrigger(ERC4626HookPayload memory request) external; + function beforeWithdrawTrigger(ERC4626HookPayload memory request) external; +} + +struct ERC4626HookPayload { + /// @dev The amount of assets to be deposited. + uint256 assets; + + /// @dev The amount of shares to be minted. + uint256 shares; + + /// @dev The address that initiated the request. + address requestSender; + + /// @dev The amount of assets the sender is allowed to withdraw. + uint256 senderMaxWithdraw; +} \ No newline at end of file diff --git a/packages/contracts/src/tokens/RewardHolder.sol b/packages/contracts/src/tokens/RewardHolder.sol new file mode 100644 index 00000000..1c14f1e5 --- /dev/null +++ b/packages/contracts/src/tokens/RewardHolder.sol @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity ^0.8.19; + +import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; + +import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; +import {Vault} from "../Vault.sol"; + +contract RewardHolder is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable { + using FixedPointMathLib for uint256; + + /// @notice Emitted reward is claimed by a token owner + event RewardClaimed(uint256 reward, address receiver); + /// @notice Emitted when new rewards are deposited + event RewardDeposited(address sender, uint value); + /// @notice Emitted when a new owner is added + event OwnerAdded(address owner, uint index); + + /// @notice Accumulator of the total earned interest rate since the opening of the token + uint public rewardIndex = 1; + + /// @notice The owners' reward indexes for eachas of the last time they accrued + mapping(address => uint) public rewardOwnerIndex; + + /// @notice + uint16 public numberCoins; + + Vault public vault; + + /// @dev This empty reserved space is put in place to allow future versions to add new + /// variables without shifting down storage in the inheritance chain. + /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + uint256[50] private __gap; + + // 0xbb788f92e65e1a823e2c502bc4e7f9c3e55531bd56bfc7c0a895fb3ac9eb7716 + bytes32 public constant BALANCE_UPDATER_ROLE = keccak256("BALANCE_UPDATE_ROLE"); + + /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */ + + function __RewardHolder_init() internal onlyInitializing { + __AccessControl_init(); + __ReentrancyGuard_init(); + __RewardHolder_init_unchained(); + } + + function __RewardHolder_init_unchained() internal onlyInitializing { + _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); + } + + /// @dev set vault + /// @notice that is mandatory to be set before reward can be claimed + function _setVault(Vault vault_) internal virtual onlyRole(DEFAULT_ADMIN_ROLE) { + if(address(vault) != address(0)) { + revokeRole(BALANCE_UPDATER_ROLE, address(vault)); + } + vault = vault_; + grantRole(BALANCE_UPDATER_ROLE, address(vault)); + } + + /// @dev deposit reward to the contract to be claimed by token owners + /// @notice only role with BALANCE_UPDATER_ROLE can call this function + /// @param plusReward amount of reward to be deposited + function depositReward(uint256 plusReward) external onlyRole(BALANCE_UPDATER_ROLE) nonReentrant { + // update reward index for claim reward logic + rewardIndex += plusReward; + emit RewardDeposited(_msgSender(), plusReward); + } + + /// @dev claim reward for token owner + function claimReward() external nonReentrant { + require(vault != Vault(address(0)), "Vault not set."); + require(rewardOwnerIndex[msg.sender] != 0, "Caller doesn't have reward."); + + // calculate reward for token owner + uint256 tokenOwnerReward = calcReward(); + rewardOwnerIndex[msg.sender] = rewardIndex; + + // transfer reward to token owner + vault.transfer(msg.sender, tokenOwnerReward); + emit RewardClaimed(tokenOwnerReward, address(msg.sender)); + } + + function calcReward() public view returns (uint256) { + if(numberCoins == 0 || rewardOwnerIndex[msg.sender] == 0) { + return 0; + } + uint deltaIndex = rewardIndex - rewardOwnerIndex[msg.sender]; + return deltaIndex / numberCoins; + } + + /// @dev setup new owner for reward usually called when minting new token + function setupNewOwner(address rewardOwner) internal virtual onlyRole(BALANCE_UPDATER_ROLE) { + rewardOwnerIndex[rewardOwner] = rewardIndex; + numberCoins++; + emit OwnerAdded(rewardOwner, rewardIndex); + } +} \ No newline at end of file diff --git a/packages/contracts/src/tokens/VaultFounderToken.sol b/packages/contracts/src/tokens/VaultFounderToken.sol new file mode 100644 index 00000000..324cf3fc --- /dev/null +++ b/packages/contracts/src/tokens/VaultFounderToken.sol @@ -0,0 +1,153 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity ^0.8.19; + +import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import {IERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol"; +import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; +import {ERC721URIStorageUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol"; + +import {SafeInitializable} from "../upgradeable/SafeInitializable.sol"; +import {SafeUUPSUpgradeable} from "../upgradeable/SafeUUPSUpgradeable.sol"; +import {IVersionable} from "../upgradeable/IVersionable.sol"; +import {ERC5484Upgradeable} from "./ERC5484Upgradeable.sol"; +import {ERC4626Upgradeable} from "./ERC4626Upgradeable.sol"; +import {IVaultFounderToken} from "./IVaultFounderToken.sol"; +import {IVaultHook, ERC4626HookPayload} from "./IVaultHook.sol"; +import {RewardHolder} from "./RewardHolder.sol"; +import {Vault} from "../Vault.sol"; + +contract VaultFounderToken is IVaultFounderToken, SafeUUPSUpgradeable, ERC5484Upgradeable, IVaultHook, RewardHolder { + + // Max number of tokens that can be minted + uint256 public maxCountTokens; + + // Next token price multiplier in percents + uint256 public nextTokenPriceMultiplier; + + /// @dev return price for the next token + uint256 public nextTokenPrice; + + /// @dev This empty reserved space is put in place to allow future versions to add new + /// variables without shifting down storage in the inheritance chain. + /// See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + uint256[50] private __gap; + + /// @notice Emit when new token minted and token price updated. + /// @param founder Address of the founder. + /// @param tokenPrice Price of the token. + /// @param nextTokenPrice Price of the next token. + /// @param nextTokenPriceMultiplier Next token price multiplier in percents. + event FounderAdded( + address indexed founder, + uint256 tokenPrice, + uint256 nextTokenPrice, + uint256 nextTokenPriceMultiplier + ); + + /* ///////////////////////////// CONSTRUCTORS ///////////////////////////// */ + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(bool needDisableInitializers) SafeInitializable(needDisableInitializers) {} // solhint-disable-line no-empty-blocks + + function initialize( + uint256 maxCountTokens_, + uint256 nextTokenPriceMultiplier_, + uint256 initialTokenPrice_ + ) public initializer { + __SafeUUPSUpgradeable_init_direct(); + __ERC5484Upgradeable_init("Eonian Vault Founder Token", "EVFT", BurnAuth.Neither, true); // __AccessControl_init inside + __ReentrancyGuard_init(); + __RewardHolder_init_unchained(); // require __AccessControl_init + + maxCountTokens = maxCountTokens_; + nextTokenPriceMultiplier = nextTokenPriceMultiplier_; + nextTokenPrice = initialTokenPrice_; + } + + /// @inheritdoc IVersionable + function version() external pure returns (string memory) { + return "0.1.0"; + } + + /// @dev set vault + /// @notice that is mandatory to be set before reward can be claimed + function setVault(Vault vault_) external onlyRole(DEFAULT_ADMIN_ROLE) { + if(address(vault) != address(0)) { + revokeRole(MINTER_ROLE, address(vault_)); + } + super._setVault(vault_); + grantRole(MINTER_ROLE, address(vault_)); + } + + /// @dev function for mint new SBT token + /// @param to address of user who will receive token + /// @param uri token metadata uri + /// @return true if token was minted + function safeMint(address to, string memory uri) public virtual override(ERC5484Upgradeable) returns(bool){ + if(totalSupply() >= maxCountTokens) { + return false; + } + + if(!super.safeMint(to, uri)) { // requires MINTER_ROLE inside + return false; + } + + setupNewOwner(to); + uint256 _nextTokenPrice = nextTokenPrice * nextTokenPriceMultiplier / 10000; + + // Will be used to record price of current holder token in The Graph + emit FounderAdded(to, nextTokenPrice, _nextTokenPrice, nextTokenPriceMultiplier); + + nextTokenPrice = _nextTokenPrice; + return true; + } + + /// @dev set multiplicator for the next token in percents + /// in case nextTokenPriceMultiplier_ = 13_000 the next price of the token will be: curPrice * 130% + /// @param nextTokenPriceMultiplier_ persent multiplicator + function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) { + // the price of the previous token + nextTokenPrice = nextTokenPrice * 10000 / nextTokenPriceMultiplier; + nextTokenPriceMultiplier = nextTokenPriceMultiplier_; + // calculation the price with the new multiplier + nextTokenPrice = nextTokenPrice * nextTokenPriceMultiplier_ / 10000; + } + + /// @inheritdoc IVaultFounderToken + function setTokenURI(string memory _tokenURI) external override { + address tokenOwner = msg.sender; + uint256 tokenId = tokenOfOwnerByIndex(tokenOwner, 0); + _setTokenURI(tokenId, _tokenURI); + } + + /// @inheritdoc IVaultFounderToken + function setTokenURI(string memory _tokenURI, uint256 tokenId) external override onlyRole(DEFAULT_ADMIN_ROLE) { + _setTokenURI(tokenId, _tokenURI); + } + + function afterDepositTrigger(ERC4626HookPayload memory request) + external override + { + if(request.senderMaxWithdraw >= nextTokenPrice) { + safeMint(request.requestSender, ""); + } + } + + /* solhint-disable no-empty-blocks */ + function beforeWithdrawTrigger(ERC4626HookPayload memory request) external override + { + //empty code + } + /* solhint-disable no-empty-blocks */ + + /// @dev See {IERC165-supportsInterface}. + function supportsInterface(bytes4 interfaceId) + public + view + override(ERC5484Upgradeable, AccessControlUpgradeable, IERC165Upgradeable) + virtual + returns (bool) + { + return super.supportsInterface(interfaceId); + } +} \ No newline at end of file diff --git a/packages/contracts/test/integration/ape-lending-strategy.test.ts b/packages/contracts/test/integration/ape-lending-strategy.test.ts index 30dbc0fe..c72a5759 100644 --- a/packages/contracts/test/integration/ape-lending-strategy.test.ts +++ b/packages/contracts/test/integration/ape-lending-strategy.test.ts @@ -5,6 +5,7 @@ import { ApeLendingStrategy__factory, IERC20, Vault, + VaultFounderToken, } from "../../typechain-types"; import { Contract } from "ethers"; import deployVault from "./helpers/deploy-vault"; @@ -14,6 +15,7 @@ import { binanceSmartChainFork } from "../../hardhat/forks"; import warp from "./helpers/warp"; import getToken from "./helpers/get-erc20-token"; import resetBalance from "./helpers/reset-balance"; +import deployVaultFounderToken from "./helpers/deploy-vault-founder-token"; describe("Ape Lending Strategy", function () { const { ethers } = hre; @@ -36,6 +38,7 @@ describe("Ape Lending Strategy", function () { let ops: SignerWithAddress; let vault: Vault; + let vaultFounderToken: VaultFounderToken; let strategy: ApeLendingStrategy; let assetToken: IERC20 & Contract; @@ -56,6 +59,15 @@ describe("Ape Lending Strategy", function () { vault = await deployVault(hre, { asset, rewards, signer: owner }); hre.tracer.nameTags[vault.address] = "Vault"; + vaultFounderToken = await deployVaultFounderToken(hre, { + maxCountTokens: 100, + nextTokenPriceMultiplier: 1200, + initialTokenPrice: 200, + signer: owner, + }); + vault.setFounders(vaultFounderToken.address); + vaultFounderToken.setVault(vault.address); + await resetBalance(vault.address, { tokens: [asset] }); strategy = await deployStrategy({ signer: owner, vault, asset }); diff --git a/packages/contracts/test/integration/helpers/deploy-vault-founder-token.ts b/packages/contracts/test/integration/helpers/deploy-vault-founder-token.ts new file mode 100644 index 00000000..8a880a30 --- /dev/null +++ b/packages/contracts/test/integration/helpers/deploy-vault-founder-token.ts @@ -0,0 +1,45 @@ +import { BigNumberish, Overrides, Signer } from "ethers"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { + VaultFounderToken, + VaultFounderToken__factory, +} from "../../../typechain-types"; + +async function _deployVaultFounderToken( + this: any, + hre: HardhatRuntimeEnvironment, + signer?: Signer | string, + ...params: Parameters +): Promise { + const factory = + await hre.ethers.getContractFactory( + "VaultFounderToken", + signer + ); + const contract = await factory.deploy(false); + await contract.deployed(); + + const transaction = await contract.initialize.call(this, ...params); + await transaction.wait(); + + return contract; +} + +type Options = { + maxCountTokens: BigNumberish; + nextTokenPriceMultiplier: BigNumberish; + initialTokenPrice: BigNumberish; + overrides?: Overrides & { from?: string | Promise }; + signer?: Signer | string; +}; + +export default async function deployVaultFounderToken( + hre: HardhatRuntimeEnvironment, + options: Options +): Promise { + const { signer, ...specifiedParams } = options; + const params = [...Object.values(specifiedParams)] as Parameters< + VaultFounderToken["initialize"] + >; + return await _deployVaultFounderToken(hre, signer, ...params); +} diff --git a/packages/contracts/test/integration/helpers/deploy-vault.ts b/packages/contracts/test/integration/helpers/deploy-vault.ts index 010ed293..69fd0c86 100644 --- a/packages/contracts/test/integration/helpers/deploy-vault.ts +++ b/packages/contracts/test/integration/helpers/deploy-vault.ts @@ -30,6 +30,7 @@ type Options = { name?: string; symbol?: string; defaultOperators?: string[]; + foundersRewardFee?: BigNumberish; overrides?: Overrides & { from?: string | Promise }; signer?: Signer | string; }; @@ -40,6 +41,7 @@ const defaultOptions: Partial = { name: "Vault Token", symbol: "VTN", defaultOperators: [], + foundersRewardFee: 100, // 1% }; export default async function deployVault( diff --git a/packages/contracts/test/unit/ApeLendingStrategy.t.sol b/packages/contracts/test/unit/ApeLendingStrategy.t.sol index 4580a9c5..bc08e691 100644 --- a/packages/contracts/test/unit/ApeLendingStrategy.t.sol +++ b/packages/contracts/test/unit/ApeLendingStrategy.t.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.0; import "forge-std/Test.sol"; -import "forge-std/console.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; @@ -17,6 +16,7 @@ import "./mocks/CTokenMock.sol"; import "./mocks/RainMakerMock.sol"; import "./mocks/PancakeRouterMock.sol"; import "./mocks/ApeLendingStrategyMock.sol"; +import "./mocks/VaultFounderTokenMock.sol"; import "contracts/strategies/CTokenBaseStrategy.sol"; @@ -37,6 +37,7 @@ contract ApeLendingStrategyTest is TestWithERC1820Registry { VaultMock vault; OpsMock ops; CTokenMock cToken; + VaultFounderTokenMock vaultFounderToken; address rewards = vm.addr(1); address alice = vm.addr(2); @@ -44,6 +45,7 @@ contract ApeLendingStrategyTest is TestWithERC1820Registry { uint256 defaultFee = 1000; uint256 defaultLPRRate = 10**18; + uint256 defaultFounderFee = 100; uint256 minReportInterval = 3600; bool isPrepaid = false; @@ -64,12 +66,18 @@ contract ApeLendingStrategyTest is TestWithERC1820Registry { underlying = new ERC20Mock("Mock Token", "TKN"); vm.label(address(underlying), "underlying"); + vaultFounderToken = new VaultFounderTokenMock(); + vault = new VaultMock( address(underlying), rewards, defaultFee, - defaultLPRRate + defaultLPRRate, + defaultFounderFee ); + vaultFounderToken.setVault(vault); + vault.setFounders(address(vaultFounderToken)); + vm.label(address(vault), "vault"); ops = new OpsMock(); @@ -149,8 +157,10 @@ contract ApeLendingStrategyTest is TestWithERC1820Registry { address(underlying), rewards, defaultFee, - defaultLPRRate + defaultLPRRate, + defaultFounderFee ); + vault.setFounders((address(vaultFounderToken))); vm.expectRevert(IncompatibleCTokenContract.selector); strategy = new ApeLendingStrategyMock( diff --git a/packages/contracts/test/unit/BaseStrategy.t.sol b/packages/contracts/test/unit/BaseStrategy.t.sol index bf32425b..ba693ada 100644 --- a/packages/contracts/test/unit/BaseStrategy.t.sol +++ b/packages/contracts/test/unit/BaseStrategy.t.sol @@ -10,6 +10,7 @@ import "./mocks/StrategyMock.sol"; import "./mocks/OpsMock.sol"; import "./mocks/BaseStrategyMock.sol"; import "./mocks/AggregatorV3Mock.sol"; +import "./mocks/VaultFounderTokenMock.sol"; import "contracts/IVault.sol"; import "contracts/structures/PriceConverter.sol"; @@ -24,6 +25,7 @@ contract BaseStrategyTest is TestWithERC1820Registry { ERC20Mock underlying; VaultMock vault; OpsMock ops; + VaultFounderTokenMock vaultFounderToken; AggregatorV3Mock nativeTokenPriceFeed; AggregatorV3Mock assetPriceFeed; @@ -36,19 +38,24 @@ contract BaseStrategyTest is TestWithERC1820Registry { uint256 defaultFee = 1000; uint256 defaultLPRRate = 10**18; + uint256 defaultFounderFee = 100; uint256 minReportInterval = 3600; bool isPrepaid = false; function setUp() public { underlying = new ERC20Mock("Mock Token", "TKN"); + vaultFounderToken = new VaultFounderTokenMock(); vault = new VaultMock( address(underlying), rewards, defaultFee, - defaultLPRRate + defaultLPRRate, + defaultFounderFee ); + vaultFounderToken.setVault(vault); + vault.setFounders((address(vaultFounderToken))); ops = new OpsMock(); ops.setGelato(payable(alice)); diff --git a/packages/contracts/test/unit/CTokenBaseStrategy.t.sol b/packages/contracts/test/unit/CTokenBaseStrategy.t.sol index 80d07405..97432e64 100644 --- a/packages/contracts/test/unit/CTokenBaseStrategy.t.sol +++ b/packages/contracts/test/unit/CTokenBaseStrategy.t.sol @@ -21,6 +21,7 @@ import "./mocks/CTokenBaseStrategyMock.sol"; import "contracts/strategies/CTokenBaseStrategy.sol"; import "./helpers/TestWithERC1820Registry.sol"; +import "./mocks/VaultFounderTokenMock.sol"; contract CTokenBaseStrategyTest is TestWithERC1820Registry { address private constant BANANA = 0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95; @@ -32,6 +33,7 @@ contract CTokenBaseStrategyTest is TestWithERC1820Registry { ERC20Mock underlying; VaultMock vault; + VaultFounderTokenMock vaultFounderToken; OpsMock ops; CTokenMock cToken; @@ -41,6 +43,7 @@ contract CTokenBaseStrategyTest is TestWithERC1820Registry { uint256 defaultFee = 1000; uint256 defaultLPRRate = 10**18; + uint256 defaultFounderFee = 100; uint256 minReportInterval = 3600; bool isPrepaid = false; @@ -65,10 +68,15 @@ contract CTokenBaseStrategyTest is TestWithERC1820Registry { address(underlying), rewards, defaultFee, - defaultLPRRate + defaultLPRRate, + defaultFounderFee ); vm.label(address(vault), "vault"); + vaultFounderToken = new VaultFounderTokenMock(); + vaultFounderToken.setVault(vault); + vault.setFounders(address(vaultFounderToken)); + ops = new OpsMock(); ops.setGelato(payable(alice)); vm.label(address(ops), "ops"); @@ -152,8 +160,12 @@ contract CTokenBaseStrategyTest is TestWithERC1820Registry { address(underlying), rewards, defaultFee, - defaultLPRRate + defaultLPRRate, + defaultFounderFee ); + vaultFounderToken = new VaultFounderTokenMock(); + vaultFounderToken.setVault(vault); + vault.setFounders(address(vaultFounderToken)); vm.expectRevert(IncompatibleCTokenContract.selector); strategy = new CTokenBaseStrategyMock( diff --git a/packages/contracts/test/unit/ERC4626Lifecycle.t.sol b/packages/contracts/test/unit/ERC4626Lifecycle.t.sol new file mode 100644 index 00000000..f7f268af --- /dev/null +++ b/packages/contracts/test/unit/ERC4626Lifecycle.t.sol @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.19; + +import "forge-std/Test.sol"; + +import {ERC20Mock} from "./mocks/ERC20Mock.sol"; +import {ERC4626LifecycleMock} from "./mocks/ERC4626LifecycleMock.sol"; +import {IVaultHookMock} from"./mocks/IVaultHookMock.sol"; +import {TestWithERC1820Registry} from "./helpers/TestWithERC1820Registry.sol"; + +import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import {ERC4626Lifecycle} from "contracts/tokens/ERC4626Lifecycle.sol"; +import {IVaultHook, ERC4626HookPayload} from "contracts/tokens/IVaultHook.sol"; + +contract SafeERC4626LifecycleTest is TestWithERC1820Registry { + ERC20Mock underlying; + ERC4626LifecycleMock vault; + + address private alice; + + function setUp() public { + underlying = new ERC20Mock("Mock Token", "TKN"); + + address[] memory defaultOperators; + vault = new ERC4626LifecycleMock( + IERC20Upgradeable(address(underlying)), + "Mock Token Vault", + "vwTKN", + defaultOperators + ); + + alice = address(0xAAAA); + + vm.label(alice, "alice"); + } + + function invariantMetadata() public { + assertEq(vault.name(), "Mock Token Vault"); + assertEq(vault.symbol(), "vwTKN"); + assertEq(vault.decimals(), 18); + } + + function testRegisterAndRunBeforeWithdrawalHook(uint128 withdrawAmount) public { + vm.assume(withdrawAmount > 0); + + //create a hook mock to be able check if the hook was called + IVaultHookMock hook1 = new IVaultHookMock(); + IVaultHookMock hook2 = new IVaultHookMock(); + vault.registerWithdrawHook(hook1); + vault.registerWithdrawHook(hook2); + assertEq(IVaultHookMock(hook1).beforeWithdrawHookCalledCounter(), 0); + assertEq(IVaultHookMock(hook2).beforeWithdrawHookCalledCounter(), 0); + + // Mint some initial funds for the vault + underlying.mint(address(vault), withdrawAmount); + + // Provide 1:1 shares of this amount to Alice + vault.mint(alice, withdrawAmount); + assertEq(vault.balanceOf(alice), withdrawAmount); + + // Alice withdraws half of her shares + vm.prank(alice); + vault.withdraw(withdrawAmount / 2); + + assertEq(hook1.beforeWithdrawHookCalledCounter(), 1); + assertEq(hook2.beforeWithdrawHookCalledCounter(), 1); + + // unregister hook2 to check if it wasn't called second time + vault.unregisterWithdrawHook(hook2); + + // Alice withdraws the second half of her shares + vm.prank(alice); + vault.withdraw(withdrawAmount / 2); + + assertEq(hook1.beforeWithdrawHookCalledCounter(), 2); + assertEq(hook2.beforeWithdrawHookCalledCounter(), 1); + } + + function testRegisterAndRunAfterDepositTriggerHook(uint128 depositAmount) public { + vm.assume(depositAmount > 2); + + //create a hook mock to be able check if the hook was called + IVaultHookMock hook1 = new IVaultHookMock(); + IVaultHookMock hook2 = new IVaultHookMock(); + vault.registerDepositHook(hook1); + vault.registerDepositHook(hook2); + assertEq(hook1.afterDepositHookCalledCounter(), 0); + assertEq(hook2.afterDepositHookCalledCounter(), 0); + + // Allow the vault to take funds from Alice + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, depositAmount); + + // Check if Alice has the initial balance + assertEq(underlying.balanceOf(alice), depositAmount); + + // deposit to the vault only half of the funds + vm.prank(alice); + vault.deposit(depositAmount / 2); + + assertEq(hook1.afterDepositHookCalledCounter(), 1); + assertEq(hook2.afterDepositHookCalledCounter(), 1); + + // unregister hook2 to check if it wasn't called second time + vault.unregisterDepositHook(hook2); + + // deposit to the vault the second half of the funds + vm.prank(alice); + vault.deposit(depositAmount / 2); + + assertEq(hook1.afterDepositHookCalledCounter(), 2); + assertEq(hook2.afterDepositHookCalledCounter(), 1); + } + +} diff --git a/packages/contracts/test/unit/ERC5484Upgradable.t.sol b/packages/contracts/test/unit/ERC5484Upgradable.t.sol new file mode 100644 index 00000000..6bc28612 --- /dev/null +++ b/packages/contracts/test/unit/ERC5484Upgradable.t.sol @@ -0,0 +1,231 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity >=0.8.19; + +import "forge-std/Test.sol"; + +import {IERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol"; +import {IERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; +import {IERC721EnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol"; + +import {TestWithERC1820Registry} from "./helpers/TestWithERC1820Registry.sol"; +import {AccessTestHelper} from "./helpers/AccessTestHelper.sol"; +import {ERC5484UpgradableMock} from "./mocks/ERC5484UpgradableMock.sol"; +import {ERC5484Upgradeable} from "contracts/tokens/ERC5484Upgradeable.sol"; +import {IERC5484} from "contracts/tokens/IERC5484.sol"; +import {IERC4626} from "contracts/tokens/IERC4626.sol"; + +contract ERC5484UpgradeableTest is TestWithERC1820Registry { + ERC5484Upgradeable private token; + + address private rewards = vm.addr(1); + address private culprit = vm.addr(2); + + address private alice = vm.addr(10); + address private bob = vm.addr(11); + + function setUp() public { + vm.label(rewards, "rewards"); + vm.label(culprit, "culprit"); + + vm.label(alice, "Alice"); + vm.label(bob, "Bob"); + + //create a new instance of Founder token contact before each test run + token = new ERC5484UpgradableMock( + "SBT Name", + "SBT", + IERC5484.BurnAuth.Neither, + true + ); + token.grantRole(token.MINTER_ROLE(), address(this)); + } + + function testVaultMetadata() public { + assertEq(token.symbol(), "SBT"); + assertEq(token.name(), "SBT Name"); + } + + function testMintToken() public { + token.safeMint(alice, "testUrl"); + token.safeMint(bob, "testUrl2"); + + assertEq(token.totalSupply(), 2); + assertEq(token.tokenURI(0), "testUrl"); + assertEq(token.tokenURI(1), "testUrl2"); + assertEq(token.ownerOf(0), alice); + assertEq(token.ownerOf(1), bob); + } + + function testMintTokenOnceFail(string memory url) public { + token.safeMint(alice, url); + + token.safeMint(alice, url); + + assertEq(token.totalSupply(), 1); + } + + function testMintTokenMultipleTimeForSingleUser(string memory url) public { + token = new ERC5484UpgradableMock( + "SBT Name", + "SBT", + IERC5484.BurnAuth.Neither, + false + ); + token.grantRole(token.MINTER_ROLE(), address(this)); + token.safeMint(alice, url); + token.safeMint(alice, url); + token.safeMint(alice, url); + + assertEq(token.totalSupply(), 3); + } + + function testTokenTransferFail(string memory url) public { + token.safeMint(alice, url); + + vm.prank(alice); + vm.expectRevert("ERC5484: can't be transferred"); + + token.transferFrom(alice, bob, 0); + } + + function testTokenBurnFailed(string memory url) public { + token.safeMint(alice, url); + + vm.prank(alice); + vm.expectRevert( + abi.encodePacked( + AccessTestHelper.getErrorMessage(address(this), token.BURNER_ROLE()) + ) + ); + token.burn(0); + + assertEq(token.totalSupply(), 1); + } + + function testBurnTokenForIssuerOnly(string memory url, bool mintOnce_) public { + token = new ERC5484UpgradableMock( + "SBT Name", + "SBT", + IERC5484.BurnAuth.IssuerOnly, + mintOnce_ + ); + token.grantRole(token.MINTER_ROLE(), address(this)); + token.grantRole(token.BURNER_ROLE(), address(this)); + + token.safeMint(alice, url); + assertEq(token.totalSupply(), 1); + + // can be burn only by issuer + vm.prank(address(this)); + token.burn(0); + + assertEq(token.totalSupply(), 0); + } + + function testBurnTokenForIssuerOnlyFail(string memory url, bool mintOnce_) public { + token = new ERC5484UpgradableMock( + "SBT Name", + "SBT", + IERC5484.BurnAuth.IssuerOnly, + mintOnce_ + ); + token.grantRole(token.MINTER_ROLE(), address(this)); + + token.safeMint(alice, url); + assertEq(token.totalSupply(), 1); + + // can't be burned by owner + string memory errorMessage = AccessTestHelper.getErrorMessage(address(alice), token.BURNER_ROLE()); // error message have to be generated before the call + vm.prank(alice); + vm.expectRevert(abi.encodePacked(errorMessage)); + + token.burn(0); + assertEq(token.totalSupply(), 1); + } + + function testBurnTokenForOwnerOnly(string memory url, bool mintOnce_) public{ + token = new ERC5484UpgradableMock( + "SBT Name", + "SBT", + IERC5484.BurnAuth.OwnerOnly, + mintOnce_ + ); + token.grantRole(token.MINTER_ROLE(), address(this)); + + token.safeMint(alice, url); + assertEq(token.totalSupply(), 1); + + // must pass since it can be burn only by owner + vm.prank(alice); + token.burn(0); + assertEq(token.totalSupply(), 0); + } + + function testBurnTokenForOwnerOnlyFail(string memory url, bool mintOnce_) public{ + token = new ERC5484UpgradableMock( + "SBT Name", + "SBT", + IERC5484.BurnAuth.OwnerOnly, + mintOnce_ + ); + token.grantRole(token.MINTER_ROLE(), address(this)); + + token.safeMint(alice, url); + assertEq(token.totalSupply(), 1); + + // must fail since it can be burn only by owner + vm.prank(address(0)); + vm.expectRevert( + abi.encodePacked( + AccessTestHelper.getErrorMessage(address(this), token.BURNER_ROLE()) + ) + ); + token.burn(0); + assertEq(token.totalSupply(), 1); + } + + function testBurnTokenForOwnerAndIssuerOnly(string memory url, bool mintOnce_) public{ + token = new ERC5484UpgradableMock( + "SBT Name", + "SBT", + IERC5484.BurnAuth.Both, + mintOnce_ + ); + token.grantRole(token.MINTER_ROLE(), address(this)); + token.grantRole(token.BURNER_ROLE(), address(alice)); + token.grantRole(token.BURNER_ROLE(), address(this)); + + token.safeMint(alice, url); + token.safeMint(bob, url); + assertEq(token.totalSupply(), 2); + + // must pass since it can be burn by owner + vm.prank(alice); + token.burn(0); + assertEq(token.totalSupply(), 1); + + // must pass since it can be burn by issuer + vm.prank(address(this)); + token.burn(1); + assertEq(token.totalSupply(), 0); + } + + function testSupportsInterface() public { + assertEq(token.supportsInterface(type(IERC5484).interfaceId), true); + assertEq(token.supportsInterface(type(IERC721EnumerableUpgradeable).interfaceId), true); + assertEq(token.supportsInterface(type(IERC721Upgradeable).interfaceId), true); + assertEq(token.supportsInterface(type(IERC165Upgradeable).interfaceId), true); + assertEq(token.supportsInterface(type(IERC4626).interfaceId), false); + } + + function testBurnAuth(string memory url) public { + token.safeMint(alice, url); + IERC5484.BurnAuth auth = token.burnAuth(0); + assertTrue(auth == IERC5484.BurnAuth.Neither); + } + + function testBurnAuthFail() public { + vm.expectRevert("ERC5484: token doesn't exists"); + token.burnAuth(0); + } +} \ No newline at end of file diff --git a/packages/contracts/test/unit/RewardHolder.t.sol b/packages/contracts/test/unit/RewardHolder.t.sol new file mode 100644 index 00000000..cfa844a8 --- /dev/null +++ b/packages/contracts/test/unit/RewardHolder.t.sol @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity >=0.8.19; + +import "forge-std/Test.sol"; + +import {TestWithERC1820Registry} from "./helpers/TestWithERC1820Registry.sol"; +import {AccessTestHelper} from "./helpers/AccessTestHelper.sol"; + +import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; +import {RewardHolderMock} from "./mocks/RewardHolderMock.sol"; +import {VaultMock} from "./mocks/VaultMock.sol"; +import {ERC20Mock} from "./mocks/ERC20Mock.sol"; + +contract ERC5484UpgradeableTest is TestWithERC1820Registry { + using FixedPointMathLib for uint256; + + RewardHolderMock private rewardHolder; + + uint256 defaultFee = 1000; + uint256 defaultLPRRate = 10**18; + uint256 defaultFounderRate = 100; + + ERC20Mock underlying; + VaultMock vault; + + address rewards = vm.addr(1); + address culprit = vm.addr(2); + + address private alice = vm.addr(10); + address private bob = vm.addr(11); + + // allow sending eth to the test contract + receive() external payable {} + + function setUp() public { + vm.label(alice, "Alice"); + vm.label(bob, "Bob"); + + underlying = new ERC20Mock("Mock Token", "TKN"); + vault = new VaultMock( + address(underlying), + rewards, + defaultFee, + defaultLPRRate, + defaultFounderRate + ); + + rewardHolder = new RewardHolderMock(); + rewardHolder.grantRole(rewardHolder.BALANCE_UPDATER_ROLE(), address(this)); + rewardHolder.setVault(vault); + } + + function testDepositReward(uint192 amount) public { + vm.assume(amount > 10**11 && amount < address(this).balance); + + // Allow the vault to take funds from Alice + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, amount); + + // Check if Alice has the initial balance + assertEq(underlying.balanceOf(alice), amount); + + // Put the funds in the vault to be able move them in to the reward holder + vm.prank(alice); + vault.deposit(amount); + + // Put funds on vault to be able to move them to token owners from the reward holder + rewardHolder.setupOwner(address(alice)); + vault.mint(address(rewardHolder), amount); + + vm.expectEmit(address(rewardHolder)); + rewardHolder.emitRewardDeposited(amount); + rewardHolder.depositReward(amount); + + assertEq(rewardHolder.numberCoins(), 1); + assertEq(rewardHolder.rewardIndex(), amount + 1); + + // Send reward to Alice and check emits + vm.expectEmit(address(rewardHolder)); + rewardHolder.emitRewardClaimed(amount, address(alice)); + vm.prank(alice); + rewardHolder.claimReward(); + } + + function testDepositRewardFail(uint192 amount) public { + vm.assume(amount > 10**11 && amount < address(this).balance); + + // Allow the vault to take funds from Alice but not from test to check roles + rewardHolder.revokeRole(rewardHolder.BALANCE_UPDATER_ROLE(), address(this)); + rewardHolder.grantRole(rewardHolder.BALANCE_UPDATER_ROLE(), address(alice)); + + // Allow the vault to take funds from Alice + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, amount); + + // Check if Alice has the initial balance + assertEq(underlying.balanceOf(alice), amount); + + // Put the funds in the vault to be able move them in to the reward holder + vm.prank(alice); + vault.deposit(amount); + + // Put funds on vault to be able to move them to token owners from the reward holder + vm.prank(alice); + rewardHolder.setupOwner(address(alice)); + vault.mint(address(rewardHolder), amount); + + vm.expectRevert( + abi.encodePacked( + AccessTestHelper.getErrorMessage(address(this), rewardHolder.BALANCE_UPDATER_ROLE()) + ) + ); + rewardHolder.depositReward(amount); + + } + + function testSetupNewsOwner() public { + rewardHolder.setupOwner(address(alice)); + assertEq(rewardHolder.numberCoins(), 1); + } + + function testSetupNewOwnerFail() public { + rewardHolder = new RewardHolderMock(); + rewardHolder.setVault(vault); + + vm.expectRevert( + abi.encodePacked( + AccessTestHelper.getErrorMessage(address(this), rewardHolder.BALANCE_UPDATER_ROLE()) + ) + ); + rewardHolder.setupOwner(address(alice)); + } + + function testCorrectRewardClaimed() public { + uint256 amount = 30000000; + + // Allow the vault to take funds from Alice, Bob + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + vm.prank(bob); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, amount); + underlying.mint(bob, amount); + + // Check if Alice has the initial balance + assertEq(underlying.balanceOf(alice), amount); + assertEq(underlying.balanceOf(bob), amount); + + // Put the funds in the vault to be able move them in to the reward holder + vm.prank(alice); + vault.deposit(amount); + vm.prank(bob); + vault.deposit(amount); + + // Put funds on vault to be able to move them to token owners from the reward holder + rewardHolder.setupOwner(address(alice)); + rewardHolder.setupOwner(address(bob)); + vault.mint(address(rewardHolder), amount); + rewardHolder.depositReward(amount); + + assertEq(rewardHolder.rewardIndex(), amount + 1); + + // Send reward to Alice and check emits + vm.expectEmit(address(rewardHolder)); + rewardHolder.emitRewardClaimed(amount / 2, address(alice)); + vm.prank(alice); + rewardHolder.claimReward(); + } + + function testCorrectRewardClaimed2(uint256 reward) public { + vm.assume(reward > 0 && reward < type(uint256).max / 2); + + rewardHolder.depositReward(reward); + + // to users set and reward have to be zero + assertEq(rewardHolder.calcReward(), 0); + + // setup new token owners and reward still have to be zero + rewardHolder.setupOwner(address(alice)); + rewardHolder.setupOwner(address(bob)); + rewardHolder.setupOwner(address(culprit)); + + // check for contract owner + assertEq(rewardHolder.calcReward(), 0); + // check for alice + vm.prank(alice); + assertEq(rewardHolder.calcReward(), 0); + + // deposit additional reward + rewardHolder.depositReward(reward); + + vm.prank(alice); + assertEq(rewardHolder.calcReward(), reward / 3); + } +} \ No newline at end of file diff --git a/packages/contracts/test/unit/Vault.t.sol b/packages/contracts/test/unit/Vault.t.sol index ea14762e..13fab21e 100644 --- a/packages/contracts/test/unit/Vault.t.sol +++ b/packages/contracts/test/unit/Vault.t.sol @@ -12,13 +12,16 @@ import "contracts/lending/Lender.sol"; import "contracts/lending/StrategiesLender.sol"; import "./helpers/TestWithERC1820Registry.sol"; +import "./mocks/VaultFounderTokenMock.sol"; contract VaultTest is TestWithERC1820Registry { uint256 constant MAX_BPS = 10_000; + uint256 constant MAX_DEPOSIT = 10**38; uint256 constant LOCKED_PROFIT_RELEASE_SCALE = 10**18; ERC20Mock underlying; VaultMock vault; + VaultFounderTokenMock vaultFounderToken; StrategyMock strategy; @@ -30,6 +33,7 @@ contract VaultTest is TestWithERC1820Registry { uint256 defaultFee = 1000; uint256 defaultLPRRate = 10**18; + uint256 defaultFounderFee = 100; function setUp() public { vm.label(rewards, "rewards"); @@ -39,12 +43,16 @@ contract VaultTest is TestWithERC1820Registry { vm.label(bob, "Bob"); underlying = new ERC20Mock("Mock Token", "TKN"); + vaultFounderToken = new VaultFounderTokenMock(); vault = new VaultMock( address(underlying), rewards, defaultFee, - defaultLPRRate + defaultLPRRate, + defaultFounderFee ); + vaultFounderToken.setVault(vault); + vault.setFounders(address(vaultFounderToken)); strategy = new StrategyMock(address(underlying), address(vault)); } @@ -65,7 +73,8 @@ contract VaultTest is TestWithERC1820Registry { defaultLPRRate, "", "", - new address[](0) + new address[](0), + defaultFounderFee ); } @@ -101,7 +110,8 @@ contract VaultTest is TestWithERC1820Registry { address(underlying), rewards, 0, - defaultLPRRate + defaultLPRRate, + defaultFounderFee ); StrategyMock strategyWrongVault = new StrategyMock( address(underlying), @@ -314,7 +324,7 @@ contract VaultTest is TestWithERC1820Registry { } function testSetManagementFee(uint256 newFee) public { - vm.assume(newFee <= MAX_BPS); + vm.assume(newFee <= MAX_BPS - defaultFounderFee); assertEq(vault.managementFee(), defaultFee); @@ -358,22 +368,188 @@ contract VaultTest is TestWithERC1820Registry { vault.setEmergencyShutdown(true); } + function testChargingAndFounderFeesFail() public { + vm.expectRevert(ExceededMaximumFeeValue.selector); + + uint256 fee = MAX_BPS; + uint256 founderFee = 1; + + vault = new VaultMock( + address(underlying), + rewards, + fee, + defaultLPRRate, + founderFee + ); + } + + // test only chargingFees function testChargingFees() public { uint256 fee = MAX_BPS; + uint256 deposit = 10_000_000; vault = new VaultMock( address(underlying), rewards, fee, - defaultLPRRate + defaultLPRRate, + 0 + ); + strategy = new StrategyMock(address(underlying), address(vault)); + + // Mint some initial funds for the vault + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, deposit); + + // Alice deposits funds to the vault + vm.prank(alice); + vault.deposit(deposit); + + // Initialize the strategy + vault.addStrategy(address(strategy), MAX_BPS); + vm.prank(address(strategy)); + vault.reportPositiveDebtManagement(0, 0); + + // Assume some time passed and strategy got a profit + vm.warp(block.timestamp + 1000); + underlying.mint(address(vault), 10_000); + + vm.expectEmit(true, true, true, true); + vault.emitMintTransferEvent(address(rewards), 9990); + + + vm.prank(address(strategy)); + vault.reportPositiveDebtManagement(10_000, 0); + + // The full amount must be transferred to the vaultFounderToken address, as the fee factor is 50% + assertEq(vault.balanceOf(rewards), 9990); + } + + // test only founderFees + function testChargingFoundersFees() public { + uint256 founderFee = MAX_BPS; + uint256 deposit = 10_000_000; + + vault = new VaultMock( + address(underlying), + rewards, + 0, + defaultLPRRate, + founderFee ); + vault.setFounders(address(vaultFounderToken)); + vaultFounderToken.setVault(vault); strategy = new StrategyMock(address(underlying), address(vault)); // Mint some initial funds for the vault - underlying.mint(address(vault), 10_000_000); + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, deposit); + + // Alice deposits funds to the vault + vm.prank(alice); + vault.deposit(deposit); + + // Initialize the strategy + vault.addStrategy(address(strategy), MAX_BPS); + vm.prank(address(strategy)); + vault.reportPositiveDebtManagement(0, 0); + + // Assume some time passed and strategy got a profit + vm.warp(block.timestamp + 1000); + underlying.mint(address(vault), 10_000); + + vm.expectEmit(true, true, true, true); + vault.emitMintTransferEvent(address(vaultFounderToken), 9990); + + vm.prank(address(strategy)); + vault.reportPositiveDebtManagement(10_000, 0); + + // The full amount must be transferred to the rewards address, as the fee factor is 50% + assertEq(vault.balanceOf(address(vaultFounderToken)), 9990); + } + + function testChargingManagmentAndFoundersFees() public { + uint256 chargingFee = 100; + uint256 founderFee = 100; + uint256 deposit = 10_000_000; + + vault = new VaultMock( + address(underlying), + rewards, + chargingFee, + defaultLPRRate, + founderFee + ); + vault.setFounders(address(vaultFounderToken)); + vaultFounderToken.setVault(vault); + strategy = new StrategyMock(address(underlying), address(vault)); + + // Mint some initial funds for the vault + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, deposit); + + // Alice deposits funds to the vault + vm.prank(alice); + vault.deposit(deposit); + + // Initialize the strategy + vault.addStrategy(address(strategy), MAX_BPS); + vm.prank(address(strategy)); + vault.reportPositiveDebtManagement(0, 0); + + // Assume some time passed and strategy got a profit + vm.warp(block.timestamp + 1000); + underlying.mint(address(vault), 10_000); + + vm.expectEmit(true, true, true, true); + vault.emitMintTransferEvent(address(rewards), 99); + vm.expectEmit(true, true, true, true); + vault.emitMintTransferEvent(address(vaultFounderToken), 99); + + vm.prank(address(strategy)); + vault.reportPositiveDebtManagement(10_000, 0); + + // The half amount must be transferred to the rewards address, as the fee factor is 50% + assertEq(vault.balanceOf(address(vaultFounderToken)), 99); + // The half amount must be transferred to the vaultFounderToken address, as the fee factor is 50% + assertEq(vault.balanceOf(rewards), 99); + } + + function testChargingManagementFeesWithoutVaultFounderToken() public { + uint256 chargingFee = 100; + uint256 founderFee = 100; + uint256 deposit = 10_000_000; + + vault = new VaultMock( + address(underlying), + rewards, + chargingFee, + defaultLPRRate, + founderFee + ); + strategy = new StrategyMock(address(underlying), address(vault)); + + // Mint some initial funds for the vault + vm.prank(alice); underlying.increaseAllowance(address(vault), type(uint256).max); + // Give the required funds to Alice + underlying.mint(alice, deposit); + + // Alice deposits funds to the vault + vm.prank(alice); + vault.deposit(deposit); + // Initialize the strategy vault.addStrategy(address(strategy), MAX_BPS); vm.prank(address(strategy)); @@ -384,22 +560,25 @@ contract VaultTest is TestWithERC1820Registry { underlying.mint(address(vault), 10_000); vm.expectEmit(true, true, true, true); - vault.emitMintTransferEvent(rewards, 10_000); + vault.emitMintTransferEvent(address(rewards), 99); vm.prank(address(strategy)); vault.reportPositiveDebtManagement(10_000, 0); - // The full amount must be transferred to the rewards address, as the fee factor is 100% - assertEq(vault.balanceOf(rewards), 10_000); + // The half amount must be transferred to the vaultFounderToken address, as the fee factor is 50% + assertEq(vault.balanceOf(rewards), 99); } function testChargingFeesFuzz( uint192 initialVaultBalance, uint16 fee, uint16 strategyRatio, - uint256 strategyGain + uint256 strategyGain, + uint256 founderFee ) public { vm.assume(fee <= MAX_BPS); + vm.assume(founderFee <= MAX_BPS); + vm.assume(fee + founderFee <= MAX_BPS); vm.assume(strategyRatio <= MAX_BPS); vm.assume( strategyGain < @@ -410,7 +589,8 @@ contract VaultTest is TestWithERC1820Registry { address(underlying), rewards, fee, - defaultLPRRate + defaultLPRRate, + founderFee ); strategy = new StrategyMock(address(underlying), address(vault)); @@ -478,6 +658,7 @@ contract VaultTest is TestWithERC1820Registry { uint256 gain ) public { vm.assume(gain < initialVaultBalance / 10); + vm.assume(initialVaultBalance < 10**16); // Mint some initial funds for the vault underlying.mint(address(vault), initialVaultBalance); @@ -658,7 +839,7 @@ contract VaultTest is TestWithERC1820Registry { } function testDepositAndAssessShares(uint192 deposit) public { - vm.assume(deposit > 0); + vm.assume(deposit > 0 && deposit < MAX_DEPOSIT); // Allow the vault to take funds from Alice vm.prank(alice); @@ -749,7 +930,7 @@ contract VaultTest is TestWithERC1820Registry { uint128 strategyBalance, uint128 withdrawAmount ) public { - vm.assume(withdrawAmount > 0); + vm.assume(withdrawAmount > 0 && withdrawAmount < MAX_DEPOSIT); vm.assume(vaultBalance > 0); vm.assume(withdrawAmount > vaultBalance); vm.assume(strategyBalance >= withdrawAmount - vaultBalance); @@ -833,16 +1014,18 @@ contract VaultTest is TestWithERC1820Registry { vault.setLockedProfitReleaseRate(rate); } - function testLockedProfitRelease() public { + function testLockedProfitRelease1() public { uint256 initialVaultBalance = 10_000_000; uint256 gain = 1_000_000; uint256 fees = 0; + uint256 foundersFees = 0; uint256 lockedProfitReleaseRate = LOCKED_PROFIT_RELEASE_SCALE / 6 hours; _initVaultWithStrategy( initialVaultBalance, fees, - lockedProfitReleaseRate + lockedProfitReleaseRate, + foundersFees ); // Assume some time passed and strategy got a profit @@ -875,13 +1058,15 @@ contract VaultTest is TestWithERC1820Registry { function testLockedProfitReleaseWithFees() public { uint256 initialVaultBalance = 10_000_000; uint256 gain = 1_000_000; - uint256 fees = 1_000; + uint256 fees = 500; + uint256 foundersFees = 500; uint256 lockedProfitReleaseRate = LOCKED_PROFIT_RELEASE_SCALE / 6 hours; _initVaultWithStrategy( initialVaultBalance, fees, - lockedProfitReleaseRate + lockedProfitReleaseRate, + foundersFees ); // Assume some time passed and strategy got a profit @@ -891,7 +1076,7 @@ contract VaultTest is TestWithERC1820Registry { vault.reportPositiveDebtManagement(gain, 0); // Immediately after the report, all profit should be locked (except the fees) - uint256 feesAmount = (fees * gain) / MAX_BPS; + uint256 feesAmount = (fees * gain) / MAX_BPS + (foundersFees * gain) / MAX_BPS; assertEq(vault.totalAssets(), initialVaultBalance + feesAmount); assertEq(vault.calculateLockedProfit(), gain - feesAmount); @@ -915,17 +1100,75 @@ contract VaultTest is TestWithERC1820Registry { _assertEqWithRoundingError(vault.calculateLockedProfit(), 0); } + function testFounderFeeCanBeClaimed() public { + uint256 initialVaultBalance = 10_000_000; + uint256 deposit = 10_000; + uint256 gain = 1_000_000; + uint256 fees = 500; + uint256 foundersFees = 500; + uint256 lockedProfitReleaseRate = LOCKED_PROFIT_RELEASE_SCALE / 6 hours; + + _initVaultWithStrategy( + initialVaultBalance, + fees, + lockedProfitReleaseRate, + foundersFees + ); + + // Give the required funds to Alice and Bob + underlying.mint(alice, deposit); + underlying.mint(bob, deposit); + + // Allow the vault to take funds from Alice and Bob + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + vm.prank(bob); + underlying.increaseAllowance(address(vault), type(uint256).max); + vm.prank(alice); + vault.deposit(deposit); + vm.prank(bob); + vault.deposit(deposit); + + assertEq(vaultFounderToken.totalSupply(), 2); + + // Assume some time passed and strategy got a profit + vm.warp(block.timestamp + 1000); + underlying.mint(address(strategy), gain); + vm.prank(address(strategy)); + vault.reportPositiveDebtManagement(gain, 0); + + // Immediately after the report, all profit should be locked (except the fees) + uint256 feesAmount = (fees * gain) / MAX_BPS + (foundersFees * gain) / MAX_BPS; + assertEq(vault.totalAssets(), initialVaultBalance + feesAmount + deposit * 2); + assertEq(vault.calculateLockedProfit(), gain - feesAmount); + + // check alice has balance + + console.log(vault.balanceOf(address(vaultFounderToken))); + // let's try to claim rewards + vm.prank(alice); + vaultFounderToken.claimReward(); + + // check alice has empty balance after claim and bob still has balance + vm.prank(alice); + assertEq(vaultFounderToken.calcReward(), 0); + vm.prank(bob); + assertEq(vaultFounderToken.calcReward(), 25); + } + function testLockedProfitReleaseWithNegativeReport() public { uint256 initialVaultBalance = 10_000_000; uint256 gain = 1_000_000; uint256 loss = 250_000; uint256 fees = 0; + uint256 foundersFees = 0; uint256 lockedProfitReleaseRate = LOCKED_PROFIT_RELEASE_SCALE / 6 hours; _initVaultWithStrategy( initialVaultBalance, fees, - lockedProfitReleaseRate + lockedProfitReleaseRate, + foundersFees ); // Assume some time passed and strategy got a profit @@ -968,14 +1211,18 @@ contract VaultTest is TestWithERC1820Registry { function _initVaultWithStrategy( uint256 initialVaultBalance, uint256 fees, - uint256 lockedProfitReleaseRate + uint256 lockedProfitReleaseRate, + uint256 foundersFee ) private { vault = new VaultMock( address(underlying), rewards, fees, - lockedProfitReleaseRate + lockedProfitReleaseRate, + foundersFee ); + vault.setFounders(address(vaultFounderToken)); + vaultFounderToken.setVault(vault); strategy = new StrategyMock(address(underlying), address(vault)); // Mint some initial funds for the vault @@ -994,4 +1241,68 @@ contract VaultTest is TestWithERC1820Registry { uint256 min = Math.min(a, b); assertLe(max - min, 1); } + + function testFounderTokenMint(uint192 deposit) public { + // deposit have to be above min first investment + vm.assume(deposit > 200 && deposit < MAX_DEPOSIT); + + + vault = new VaultMock( + address(underlying), + rewards, + 0, + defaultLPRRate, + 0 + ); + vaultFounderToken = new VaultFounderTokenMock(); + vault.setFounders(address(vaultFounderToken)); + vaultFounderToken.setVault(vault); + + // Allow the vault to take funds from Alice + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, deposit); + + // Check if Alice has the initial balance + assertEq(underlying.balanceOf(alice), deposit); + assertEq(vaultFounderToken.totalSupply(), 0); + + vm.prank(alice); + vault.deposit(deposit); + + // Check if Alice has a new vault founder token generated + assertEq(vaultFounderToken.totalSupply(), 1); + } + + function testFounderTokenMintWithoutVaultFounderToken(uint192 deposit) public { + // deposit have to be above min first investment + vm.assume(deposit > 200 && deposit < MAX_DEPOSIT); + + + vault = new VaultMock( + address(underlying), + rewards, + 0, + defaultLPRRate, + 0 + ); + + // Allow the vault to take funds from Alice + vm.prank(alice); + underlying.increaseAllowance(address(vault), type(uint256).max); + + // Give the required funds to Alice + underlying.mint(alice, deposit); + + // Check if Alice has the initial balance + assertEq(underlying.balanceOf(alice), deposit); + + vm.prank(alice); + vault.deposit(deposit); + + // Check if Alice has a new vault founder token generated + } + } diff --git a/packages/contracts/test/unit/VaultFounderToken.t.sol b/packages/contracts/test/unit/VaultFounderToken.t.sol new file mode 100644 index 00000000..9e7d07ad --- /dev/null +++ b/packages/contracts/test/unit/VaultFounderToken.t.sol @@ -0,0 +1,149 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.19; + +import "forge-std/Test.sol"; + +import {TestWithERC1820Registry} from "./helpers/TestWithERC1820Registry.sol"; +import {AccessTestHelper} from "./helpers/AccessTestHelper.sol"; +import {VaultFounderToken} from "contracts/tokens/VaultFounderToken.sol"; +import {VaultFounderTokenMock} from "./mocks/VaultFounderTokenMock.sol"; +import {VaultMock} from "./mocks/VaultMock.sol"; +import "./mocks/ERC20Mock.sol"; + +contract VaultFounderTokenTest is TestWithERC1820Registry { + VaultFounderTokenMock private token; + + address private rewards = vm.addr(1); + address private culprit = vm.addr(2); + + address private alice = vm.addr(10); + address private bob = vm.addr(11); + + function setUp() public { + vm.label(rewards, "rewards"); + vm.label(culprit, "culprit"); + + vm.label(alice, "Alice"); + vm.label(bob, "Bob"); + + //create a new instance of Founder token contact before each test run + token = new VaultFounderTokenMock(); + token.grantRole(token.BALANCE_UPDATER_ROLE(), address(this)); + token.grantRole(token.MINTER_ROLE(), address(this)); + } + + function testVaultMetadata() public { + assertEq(token.symbol(), "EVFT"); + assertEq(token.name(), "Eonian Vault Founder Token"); + } + + function testMintToken() public { + token.safeMint(alice, "testUrl"); + token.safeMint(bob, "testUrl2"); + + assertEq(token.totalSupply(), 2); + assertEq(token.tokenURI(0), "testUrl"); + assertEq(token.tokenURI(1), "testUrl2"); + assertEq(token.ownerOf(0), alice); + assertEq(token.ownerOf(1), bob); + } + + function testMintTokenFail(string memory url) public { + token.safeMint(alice, url); + token.safeMint(alice, url); + + assertEq(token.totalSupply(), 1); + } + + function testBurnTokenFail(string memory url) public { + token.safeMint(alice, url); + + vm.prank(alice); + vm.expectRevert("ERC5484: can't be transferred"); + + token.transferFrom(alice, bob, 0); + } + + function testCreateMoreTokenThanAllowedFail() public { + token.safeMint(alice, "testUrl"); + token.safeMint(bob, "testUrl"); + token.safeMint(culprit, "testUrl"); + token.safeMint(rewards, "testUrl"); + + assertEq(token.totalSupply(), 3); + } + + function testNextTokenPrice() public { + assertEq(token.nextTokenPrice(), 200); + token.safeMint(alice, "testUrl"); + assertEq(token.nextTokenPrice(), 240); + token.safeMint(bob, "testUrl2"); + assertEq(token.nextTokenPrice(), 288); + token.safeMint(culprit, "testUrl3"); + assertEq(token.nextTokenPrice(), 345); + } + + function testSetTokenURI() public { + token.safeMint(alice, "testUrl"); + vm.prank(alice); + token.setTokenURI("testUrl2"); + assertEq(token.tokenURI(0), "testUrl2"); + } + + function testSetTokenURI2() public { + token.safeMint(alice, "testUrl"); + token.setTokenURI("testUrl2", 0); + assertEq(token.tokenURI(0), "testUrl2"); + } + + function testSetTokenURIFail() public { + token.safeMint(alice, "testUrl"); + vm.expectRevert("ERC721Enumerable: owner index out of bounds"); + token.setTokenURI("testUrl2"); + } + + function testSetTokenURI2Fail() public { + token.safeMint(alice, "testUrl"); + vm.expectRevert( + abi.encodePacked( + AccessTestHelper.getErrorMessage(address(alice), token.DEFAULT_ADMIN_ROLE()) + ) + ); + vm.prank(alice); + token.setTokenURI("testUrl2", 0); + } + + function testSetTokenMultiplier() public { + assertEq(token.nextTokenPrice(), 200); + token.safeMint(alice, "testUrl"); + token.setNextTokenMultiplier(20_000); + assertEq(token.nextTokenPrice(), 400); + } + + function testSetTokenMultiplierFail() public { + assertEq(token.nextTokenPrice(), 200); + vm.expectRevert(abi.encodePacked( + AccessTestHelper.getErrorMessage(address(alice), token.DEFAULT_ADMIN_ROLE()) + )); + vm.prank(alice); + token.setNextTokenMultiplier(200); + } + + function testSetVault() public { + ERC20Mock underlying = new ERC20Mock("Mock Token", "TKN"); + uint256 defaultFee = 1000; + uint256 defaultLPRRate = 10**18; + uint256 defaultFounderFee = 100; + + VaultMock vault = new VaultMock( + address(underlying), + rewards, + defaultFee, + defaultLPRRate, + defaultFounderFee + ); + vault.setFounders(address(token)); + assertEq(vault.founders(), address(token)); + } + +} diff --git a/packages/contracts/test/unit/helpers/AccessTestHelper.sol b/packages/contracts/test/unit/helpers/AccessTestHelper.sol new file mode 100644 index 00000000..bb3a158d --- /dev/null +++ b/packages/contracts/test/unit/helpers/AccessTestHelper.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity >=0.8.19; + +import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; + +library AccessTestHelper{ + + function getErrorMessage(address account, bytes32 role) public pure returns (string memory) { + return string( + abi.encodePacked( + "AccessControl: account ", + StringsUpgradeable.toHexString(account), + " is missing role ", + StringsUpgradeable.toHexString(uint256(role), 32) + ) + ); + } + +} \ No newline at end of file diff --git a/packages/contracts/test/unit/mocks/ERC4626LifecycleMock.sol b/packages/contracts/test/unit/mocks/ERC4626LifecycleMock.sol new file mode 100644 index 00000000..195d97b0 --- /dev/null +++ b/packages/contracts/test/unit/mocks/ERC4626LifecycleMock.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.19; + +import {ERC4626Lifecycle} from "contracts/tokens/ERC4626Lifecycle.sol"; +import {IVaultHook} from "contracts/tokens/IVaultHook.sol"; +import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import {SafeInitializableMock} from "./SafeInitializableMock.sol"; + +contract ERC4626LifecycleMock is ERC4626Lifecycle, SafeInitializableMock { + constructor( + IERC20Upgradeable _asset, + string memory name_, + string memory symbol_, + address[] memory defaultOperators_ + ) initializer { + __ERC4626_init(_asset, name_, symbol_, defaultOperators_); + } + + function totalAssets() public view override returns (uint256) { + return asset.balanceOf(address(this)); + } + + function registerDepositHook(IVaultHook hook) public { + addDepositHook(hook); + } + + function registerWithdrawHook(IVaultHook hook) public { + addWithdrawHook(hook); + } + + function unregisterDepositHook(IVaultHook hook) public { + removeDepositHook(hook); + } + + function unregisterWithdrawHook(IVaultHook hook) public { + removeWithdrawHook(hook); + } + + function mint(address to, uint256 amount) external { + _mint(to, amount, "", "", false); + } +} \ No newline at end of file diff --git a/packages/contracts/test/unit/mocks/ERC5484UpgradableMock.sol b/packages/contracts/test/unit/mocks/ERC5484UpgradableMock.sol new file mode 100644 index 00000000..bc21628b --- /dev/null +++ b/packages/contracts/test/unit/mocks/ERC5484UpgradableMock.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.4; + +import {Vault} from "contracts/Vault.sol"; +import {ERC5484Upgradeable} from "contracts/tokens/ERC5484Upgradeable.sol"; + +contract ERC5484UpgradableMock is ERC5484Upgradeable { + constructor( + string memory name_, + string memory symbol_, + BurnAuth burnAuth_, + bool mintOnce_ + ) initializer { + __ERC5484Upgradeable_init(name_, symbol_, burnAuth_, mintOnce_); + } +} \ No newline at end of file diff --git a/packages/contracts/test/unit/mocks/IVaultHookMock.sol b/packages/contracts/test/unit/mocks/IVaultHookMock.sol new file mode 100644 index 00000000..751b1dfc --- /dev/null +++ b/packages/contracts/test/unit/mocks/IVaultHookMock.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.19; + +import {ERC4626Upgradeable} from "contracts/tokens/ERC4626Upgradeable.sol"; +import {IVaultHook, ERC4626HookPayload} from "contracts/tokens/IVaultHook.sol"; + +contract IVaultHookMock is IVaultHook { + uint256 public beforeWithdrawHookCalledCounter; + uint256 public afterDepositHookCalledCounter; + + constructor() { + beforeWithdrawHookCalledCounter = 0; + afterDepositHookCalledCounter = 0; + } + + function afterDepositTrigger(ERC4626HookPayload memory /*request*/) + external override + { + afterDepositHookCalledCounter++; + } + + function beforeWithdrawTrigger(ERC4626HookPayload memory /*request*/) + external override + { + beforeWithdrawHookCalledCounter++; + } +} \ No newline at end of file diff --git a/packages/contracts/test/unit/mocks/RewardHolderMock.sol b/packages/contracts/test/unit/mocks/RewardHolderMock.sol new file mode 100644 index 00000000..3da552ba --- /dev/null +++ b/packages/contracts/test/unit/mocks/RewardHolderMock.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.19; + +import {RewardHolder} from "contracts/tokens/RewardHolder.sol"; +import {Vault} from "contracts/Vault.sol"; + +contract RewardHolderMock is RewardHolder { + constructor() initializer { + __RewardHolder_init(); + } + + function emitRewardDeposited(uint256 plusReward) external { + emit RewardDeposited(msg.sender, plusReward); + } + + function emitRewardClaimed(uint256 reward, address receiver) external { + emit RewardClaimed(reward, receiver); + } + + function setupOwner(address rewardOwner) external { + setupNewOwner(rewardOwner); + } + + function checkRole(bytes32 role, address account) onlyRole(BALANCE_UPDATER_ROLE) external view returns (bool) { + return hasRole(role, account); + } + + function setVault(Vault vault_) external { + _setVault(vault_); + } +} \ No newline at end of file diff --git a/packages/contracts/test/unit/mocks/VaultFounderTokenMock.sol b/packages/contracts/test/unit/mocks/VaultFounderTokenMock.sol new file mode 100644 index 00000000..5577491f --- /dev/null +++ b/packages/contracts/test/unit/mocks/VaultFounderTokenMock.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.19; + +import {VaultFounderToken} from "contracts/tokens/VaultFounderToken.sol"; + +contract VaultFounderTokenMock is VaultFounderToken { + constructor() VaultFounderToken(false) { + initialize( + 3, + 12_000, + 200 + ); + } +} \ No newline at end of file diff --git a/packages/contracts/test/unit/mocks/VaultMock.sol b/packages/contracts/test/unit/mocks/VaultMock.sol index 5353ef84..092ae76d 100644 --- a/packages/contracts/test/unit/mocks/VaultMock.sol +++ b/packages/contracts/test/unit/mocks/VaultMock.sol @@ -8,7 +8,8 @@ contract VaultMock is Vault { address underlying, address rewards, uint256 fee, - uint256 lockedProfitReleaseDuration + uint256 lockedProfitReleaseDuration, + uint256 _foundersRewardFee ) Vault(false) { initialize( underlying, @@ -17,7 +18,8 @@ contract VaultMock is Vault { lockedProfitReleaseDuration, "", "", - new address[](0) + new address[](0), + _foundersRewardFee ); }