@pendle/core-v2 0.6.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +751 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +4 -0
- package/build/artifacts/contracts/{core/PendleSCYImpl → SuperComposableYield/SCY-implementations}/AaveV3/WadRayMath.sol/WadRayMath.json +3 -3
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +27 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +761 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.json +635 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +609 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.json +653 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +622 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.json +622 -0
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/{ISuperComposableYield.sol/ISuperComposableYield.json → base-implementations/SCYBase.sol/SCYBase.json} +221 -141
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/{implementations → base-implementations}/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +247 -223
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol/CelerReceiver.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol/CelerReceiver.json +128 -0
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSender.sol/CelerSender.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations/IRewardManager.sol/IRewardManager.json → core/LiquidityMining/CelerAbstracts/CelerSender.sol/CelerSender.json} +29 -33
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol/PendleGaugeController.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol/PendleGaugeController.json +193 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchain.json +255 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechain.json +318 -0
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +4 -0
- package/build/artifacts/contracts/{interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.json → core/LiquidityMining/PendleGauge.sol/PendleGauge.json} +57 -65
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol/PendleVotingController.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol/PendleVotingController.json +707 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol/VotingControllerStorage.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol/VotingControllerStorage.json +342 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +547 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +353 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol/VotingEscrowToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol/VotingEscrowToken.json +138 -0
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +922 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +345 -0
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +4 -0
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +254 -0
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +4 -0
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +329 -0
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -20
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +445 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +344 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +750 -0
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.json +123 -77
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +39 -42
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.json +163 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.json +0 -13
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.json +1 -14
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.json +10 -0
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.json +39 -0
- package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.json +13 -0
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.json +74 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IVePToken.sol/IVePToken.json → ICelerMessageBus.sol/ICelerMessageBus.json} +21 -11
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.json +45 -0
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +4 -0
- package/build/artifacts/contracts/{core/PendleBaseToken.sol/PendleBaseToken.json → interfaces/IERC4626.sol/IERC4626.json} +53 -68
- package/build/artifacts/contracts/interfaces/IJoePair.sol/IJoePair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter01.sol/IJoeRouter01.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.json +962 -0
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.json +122 -58
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.json +36 -21
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +116 -81
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.json +109 -0
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.json +132 -0
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +35 -54
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +31 -0
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.json +5 -5
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +61 -5
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +167 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.json +70 -89
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +85 -83
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPBaseToken.sol/IPBaseToken.json → IQiAvax.sol/IQiAvax.json} +106 -15
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.json +117 -0
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.json +117 -0
- package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +4 -0
- package/build/artifacts/contracts/{periphery/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.json → interfaces/IRewardManager.sol/IRewardManager.json} +12 -14
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations/SCYBase.sol/SCYBase.json → interfaces/ISuperComposableYield.sol/ISuperComposableYield.json} +183 -181
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.json +13 -0
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.json +13 -0
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.json +13 -0
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations → libraries}/RewardManager.sol/RewardManager.json +44 -33
- package/build/artifacts/contracts/libraries/RewardManagerMini.sol/RewardManagerMini.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/RewardManagerMini.sol/RewardManagerMini.json +101 -0
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol}/SCYIndexLib.json +3 -3
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield → libraries/SCY}/SCYUtils.sol/SCYUtils.json +3 -3
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{math/MarketMathAux.sol/MarketMathAux.json → VeBalanceLib.sol/VeBalanceLib.json} +4 -4
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/MiniDeployer.sol/MiniDeployer.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/MiniDeployer.sol/MiniDeployer.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions/base/ActionType.sol/ActionType.json → libraries/helpers/TokenHelper.sol/TokenHelper.json} +2 -2
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.json +2 -2
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +10 -0
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.json +10 -0
- package/build/artifacts/contracts/libraries/solmate/LibRLP.sol/LibRLP.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/solmate/LibRLP.sol/LibRLP.json +10 -0
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.json +10 -0
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{JoeLibrary.sol → traderjoe/JoeLibrary.sol}/JoeLibrary.json +3 -3
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.json +24 -0
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +862 -0
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.json +2 -2
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +147 -0
- package/contracts/{core/PendleSCYImpl → SuperComposableYield/SCY-implementations}/AaveV3/WadRayMath.sol +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +74 -0
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +187 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol +123 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +99 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol +245 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +107 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +120 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +197 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +131 -0
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol +47 -0
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSender.sol +52 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol +141 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol +30 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol +22 -0
- package/contracts/core/LiquidityMining/PendleGauge.sol +118 -0
- package/contracts/core/LiquidityMining/README.md +63 -0
- package/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol +323 -0
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol +224 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +241 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +73 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol +53 -0
- package/contracts/core/{PendleMarket.sol → Market/PendleMarket.sol} +139 -103
- package/contracts/core/{PendleMarketFactory.sol → Market/PendleMarketFactory.sol} +62 -19
- package/contracts/core/PendleERC20.sol +358 -0
- package/contracts/core/PendleERC20Permit.sol +84 -0
- package/contracts/core/PendleRouter.sol +6 -12
- package/contracts/core/YieldContracts/InterestManagerYT.sol +87 -0
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +52 -0
- package/contracts/core/{PendleYieldContractFactory.sol → YieldContracts/PendleYieldContractFactory.sol} +46 -25
- package/contracts/core/YieldContracts/PendleYieldToken.sol +340 -0
- package/contracts/core/actions/ActionCallback.sol +63 -43
- package/contracts/core/actions/ActionCore.sol +95 -78
- package/contracts/core/actions/ActionYT.sol +35 -86
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +133 -78
- package/contracts/core/actions/base/ActionSCYAndPYBase.sol +31 -46
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +127 -45
- package/contracts/core/actions/base/CallbackHelper.sol +81 -0
- package/contracts/interfaces/IAToken.sol +11 -1
- package/contracts/interfaces/IAavePool.sol +1 -1
- package/contracts/interfaces/IAaveRewardsController.sol +1 -1
- package/contracts/interfaces/IBenQiComptroller.sol +3 -1
- package/contracts/interfaces/IBenQiInterestRateModel.sol +16 -0
- package/contracts/interfaces/ICelerMessageBus.sol +28 -0
- package/contracts/interfaces/ICelerMessageReceiverApp.sol +25 -0
- package/contracts/interfaces/IERC4626.sol +39 -0
- package/contracts/interfaces/IJoeRouter01.sol +1 -1
- package/contracts/interfaces/IJoeRouter02.sol +52 -0
- package/contracts/interfaces/IPActionCore.sol +44 -27
- package/contracts/interfaces/IPActionYT.sol +12 -9
- package/contracts/interfaces/IPAllAction.sol +2 -3
- package/contracts/interfaces/IPGaugeController.sol +22 -0
- package/contracts/interfaces/IPGaugeControllerMainchain.sol +12 -0
- package/contracts/interfaces/IPGovernanceManager.sol +1 -1
- package/contracts/interfaces/IPInterestManagerYT.sol +9 -0
- package/contracts/interfaces/IPMarket.sol +13 -13
- package/contracts/interfaces/IPMarketAddRemoveCallback.sol +3 -3
- package/contracts/interfaces/IPMarketFactory.sol +8 -1
- package/contracts/interfaces/IPMarketSwapCallback.sol +1 -1
- package/contracts/interfaces/IPPermissionsV2Upg.sol +1 -1
- package/contracts/interfaces/IPPrincipalToken.sol +9 -5
- package/contracts/interfaces/IPRouterStatic.sol +1 -1
- package/contracts/interfaces/IPVeToken.sol +9 -4
- package/contracts/interfaces/IPVotingController.sol +21 -0
- package/contracts/interfaces/IPVotingEscrow.sol +14 -22
- package/contracts/interfaces/IPYieldContractFactory.sol +1 -1
- package/contracts/interfaces/IPYieldToken.sol +17 -17
- package/contracts/interfaces/IQiAvax.sol +31 -0
- package/contracts/interfaces/IQiErc20.sol +1 -1
- package/contracts/interfaces/IQiToken.sol +22 -1
- package/contracts/interfaces/IREDACTEDStaking.sol +1 -1
- package/contracts/interfaces/IRewardManager.sol +9 -0
- package/contracts/interfaces/ISuperComposableYield.sol +182 -0
- package/contracts/interfaces/IWETH.sol +1 -1
- package/contracts/interfaces/IWXBTRFLY.sol +3 -1
- package/contracts/interfaces/IWstETH.sol +3 -1
- package/contracts/interfaces/IYearnVault.sol +3 -1
- package/contracts/libraries/RewardManager.sol +78 -0
- package/contracts/libraries/RewardManagerAbstract.sol +81 -0
- package/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol} +8 -8
- package/contracts/libraries/SCY/SCYUtils.sol +18 -0
- package/contracts/libraries/VeBalanceLib.sol +114 -0
- package/contracts/libraries/helpers/ArrayLib.sol +65 -0
- package/contracts/libraries/helpers/ExpiryUtilsLib.sol +1 -1
- package/contracts/libraries/helpers/MiniDeployer.sol +23 -0
- package/contracts/libraries/helpers/MiniHelpers.sol +15 -0
- package/contracts/libraries/helpers/TokenHelper.sol +105 -0
- package/contracts/libraries/math/LogExpMath.sol +59 -1
- package/contracts/libraries/math/MarketApproxLib.sol +167 -164
- package/contracts/libraries/math/MarketMathCore.sol +106 -25
- package/contracts/libraries/math/Math.sol +28 -21
- package/contracts/libraries/math/WeekMath.sol +19 -0
- package/contracts/libraries/solmate/Bytes32AddressLib.sol +14 -0
- package/contracts/libraries/solmate/LibRLP.sol +30 -0
- package/contracts/libraries/solmate/SSTORE2.sol +99 -0
- package/contracts/libraries/{JoeLibrary.sol → traderjoe/JoeLibrary.sol} +3 -2
- package/contracts/{periphery → libraries/traderjoe}/PendleJoeSwapHelperUpg.sol +8 -10
- package/contracts/{core → offchain-helpers}/RouterStatic.sol +24 -19
- package/contracts/periphery/PendleGovernanceManager.sol +1 -1
- package/contracts/periphery/PermissionsV2Upg.sol +1 -1
- package/package.json +1 -1
- package/typechain-types/ActionCore.ts +169 -96
- package/typechain-types/{ActionSCYAndYOBase.ts → ActionSCYAndPTBase.ts} +54 -67
- package/typechain-types/ActionSCYAndPYBase.ts +0 -13
- package/typechain-types/ActionSCYAndYTBase.ts +8 -21
- package/typechain-types/ActionYT.ts +73 -64
- package/typechain-types/BeaconProxy.ts +97 -0
- package/typechain-types/CelerReceiver.ts +267 -0
- package/typechain-types/CelerSender.ts +197 -0
- package/typechain-types/ERC1967Upgrade.ts +97 -0
- package/typechain-types/{ERC20Burnable.ts → ERC20Permit.ts} +116 -68
- package/typechain-types/IAToken.ts +55 -0
- package/typechain-types/{QiDelegationStorage.ts → IBeacon.ts} +11 -6
- package/typechain-types/IBenQiComptroller.ts +13 -0
- package/typechain-types/{InterestRateModel.ts → IBenQiInterestRateModel.ts} +12 -28
- package/typechain-types/ICelerMessageBus.ts +134 -0
- package/typechain-types/{IMessageReceiverApp.ts → ICelerMessageReceiverApp.ts} +19 -9
- package/typechain-types/{PermissionsV2.ts → IERC1822Proxiable.ts} +13 -13
- package/typechain-types/IERC20Permit.ts +175 -0
- package/typechain-types/{ERC20Premined.ts → IERC4626.ts} +103 -113
- package/typechain-types/IJoeRouter02.ts +1420 -0
- package/typechain-types/IPActionCore.ts +169 -83
- package/typechain-types/IPActionYT.ts +65 -43
- package/typechain-types/IPAllAction.ts +190 -137
- package/typechain-types/IPGauge.ts +1 -138
- package/typechain-types/IPGaugeController.ts +191 -0
- package/typechain-types/IPGaugeControllerMainchain.ts +236 -0
- package/typechain-types/IPMarket.ts +73 -74
- package/typechain-types/IPMarketFactory.ts +27 -0
- package/typechain-types/IPPrincipalToken.ts +8 -20
- package/typechain-types/IPVeToken.ts +103 -8
- package/typechain-types/IPVotingController.ts +179 -0
- package/typechain-types/IPVotingEscrow.ts +100 -180
- package/typechain-types/IPYieldToken.ts +176 -213
- package/typechain-types/{IPOwnershipToken.ts → IQiAvax.ts} +190 -127
- package/typechain-types/IQiErc20.ts +171 -0
- package/typechain-types/IQiToken.ts +171 -0
- package/typechain-types/IRewardManager.ts +16 -87
- package/typechain-types/ISuperComposableYield.ts +283 -269
- package/typechain-types/IWXBTRFLY.ts +13 -0
- package/typechain-types/IWstETH.ts +13 -0
- package/typechain-types/IYearnVault.ts +13 -0
- package/typechain-types/PendleAaveV3SCY.ts +382 -477
- package/typechain-types/PendleBtrflyScy.ts +287 -348
- package/typechain-types/{EIP20Interface.ts → PendleERC20.ts} +39 -37
- package/typechain-types/{ERC20PresetFixedSupply.ts → PendleERC20Permit.ts} +100 -130
- package/typechain-types/{LYTBaseWithRewards.ts → PendleERC4626SCY.ts} +311 -316
- package/typechain-types/PendleGauge.ts +113 -306
- package/typechain-types/PendleGaugeController.ts +346 -0
- package/typechain-types/PendleGaugeControllerMainchain.ts +410 -0
- package/typechain-types/PendleGaugeControllerSidechain.ts +524 -0
- package/typechain-types/{PendleYTLYTBenqi.ts → PendleJoeLpSCY.ts} +336 -362
- package/typechain-types/PendleJoeSwapHelperUpg.ts +0 -13
- package/typechain-types/PendleMarket.ts +265 -151
- package/typechain-types/PendleMarketFactory.ts +111 -16
- package/typechain-types/PendleMarketRewards.ts +1317 -0
- package/typechain-types/PendlePrincipalToken.ts +103 -130
- package/typechain-types/{PermlessAbstract.ts → PendleQiTokenHelper.ts} +5 -5
- package/typechain-types/{PendleBenQiErc20LYT.ts → PendleQiTokenSCY.ts} +395 -305
- package/typechain-types/PendleRouter.ts +0 -19
- package/typechain-types/PendleVotingController.ts +1042 -0
- package/typechain-types/{PendleAaveV3LYT.ts → PendleWstEthSCY.ts} +325 -320
- package/typechain-types/PendleYearnVaultScy.ts +278 -339
- package/typechain-types/PendleYieldContractFactory.ts +43 -27
- package/typechain-types/PendleYieldToken.ts +297 -428
- package/typechain-types/RewardManager.ts +70 -69
- package/typechain-types/RewardManagerMini.ts +200 -0
- package/typechain-types/SCYBase.ts +276 -335
- package/typechain-types/SCYBaseWithRewards.ts +367 -424
- package/typechain-types/VotingControllerStorage.ts +507 -0
- package/typechain-types/VotingEscrowPendleMainchain.ts +854 -0
- package/typechain-types/VotingEscrowPendleSidechain.ts +546 -0
- package/typechain-types/VotingEscrowToken.ts +251 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +122 -80
- package/typechain-types/factories/ActionRedeem__factory.ts +1 -1
- package/typechain-types/factories/{ActionSCYAndYOBase__factory.ts → ActionSCYAndPTBase__factory.ts} +20 -33
- package/typechain-types/factories/ActionSCYAndPYBase__factory.ts +0 -13
- package/typechain-types/factories/ActionSCYAndYTBase__factory.ts +1 -14
- package/typechain-types/factories/ActionYT__factory.ts +39 -48
- package/typechain-types/factories/BeaconProxy__factory.ts +141 -0
- package/typechain-types/factories/{CrosschainReceiver__factory.ts → CelerReceiver__factory.ts} +37 -84
- package/typechain-types/factories/CelerSender__factory.ts +85 -0
- package/typechain-types/factories/{IRainbowBridge__factory.ts → ERC1967Upgrade__factory.ts} +27 -32
- package/typechain-types/factories/{IPOwnershipToken__factory.ts → ERC20Permit__factory.ts} +83 -64
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IAToken__factory.ts +39 -0
- package/typechain-types/factories/{PermissionsV2__factory.ts → IBeacon__factory.ts} +7 -7
- package/typechain-types/factories/IBenQiComptroller__factory.ts +13 -0
- package/typechain-types/factories/{InterestRateModel__factory.ts → IBenQiInterestRateModel__factory.ts} +12 -27
- package/typechain-types/factories/{PendleRouterBase__factory.ts → ICelerMessageBus__factory.ts} +29 -29
- package/typechain-types/factories/{IMessageReceiverApp__factory.ts → ICelerMessageReceiverApp__factory.ts} +19 -10
- package/typechain-types/factories/{IPermissionsV2__factory.ts → IERC1822Proxiable__factory.ts} +11 -11
- package/typechain-types/factories/IERC20Permit__factory.ts +98 -0
- package/typechain-types/factories/{ERC20Burnable__factory.ts → IERC4626__factory.ts} +55 -49
- package/typechain-types/factories/IJoeRouter02__factory.ts +974 -0
- package/typechain-types/factories/IPActionCore__factory.ts +122 -58
- package/typechain-types/factories/IPActionYT__factory.ts +36 -21
- package/typechain-types/factories/IPAllAction__factory.ts +116 -81
- package/typechain-types/factories/IPGaugeControllerMainchain__factory.ts +151 -0
- package/typechain-types/factories/IPGaugeController__factory.ts +124 -0
- package/typechain-types/factories/IPGauge__factory.ts +3 -86
- package/typechain-types/factories/IPMarketFactory__factory.ts +31 -0
- package/typechain-types/factories/IPMarket__factory.ts +35 -54
- package/typechain-types/factories/IPPrincipalToken__factory.ts +5 -5
- package/typechain-types/factories/IPVeToken__factory.ts +61 -5
- package/typechain-types/factories/IPVotingController__factory.ts +182 -0
- package/typechain-types/factories/IPVotingEscrow__factory.ts +68 -87
- package/typechain-types/factories/IPYieldToken__factory.ts +85 -83
- package/typechain-types/factories/{ILiquidYieldToken__factory.ts → IQiAvax__factory.ts} +58 -125
- package/typechain-types/factories/IQiErc20__factory.ts +117 -0
- package/typechain-types/factories/IQiToken__factory.ts +117 -0
- package/typechain-types/factories/IRewardManager__factory.ts +5 -47
- package/typechain-types/factories/ISuperComposableYield__factory.ts +201 -138
- package/typechain-types/factories/IWXBTRFLY__factory.ts +13 -0
- package/typechain-types/factories/IWstETH__factory.ts +13 -0
- package/typechain-types/factories/IYearnVault__factory.ts +13 -0
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +246 -315
- package/typechain-types/factories/PendleBtrflyScy__factory.ts +200 -234
- package/typechain-types/factories/PendleERC20Permit__factory.ts +405 -0
- package/typechain-types/factories/PendleERC20__factory.ts +327 -0
- package/typechain-types/factories/PendleERC4626SCY__factory.ts +678 -0
- package/typechain-types/factories/PendleGaugeControllerMainchain__factory.ts +332 -0
- package/typechain-types/factories/PendleGaugeControllerSidechain__factory.ts +391 -0
- package/typechain-types/factories/{EIP20NonStandardInterface__factory.ts → PendleGaugeController__factory.ts} +90 -91
- package/typechain-types/factories/PendleGauge__factory.ts +42 -254
- package/typechain-types/factories/PendleGovernanceManager__factory.ts +1 -1
- package/typechain-types/factories/PendleJoeLpSCY__factory.ts +726 -0
- package/typechain-types/factories/PendleJoeSwapHelperUpg__factory.ts +0 -13
- package/typechain-types/factories/PendleMarketFactory__factory.ts +90 -5
- package/typechain-types/factories/PendleMarketRewards__factory.ts +1140 -0
- package/typechain-types/factories/PendleMarket__factory.ts +182 -94
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +74 -77
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +99 -0
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +845 -0
- package/typechain-types/factories/PendleRouter__factory.ts +1 -23
- package/typechain-types/factories/PendleVotingController__factory.ts +776 -0
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +686 -0
- package/typechain-types/factories/PendleYearnVaultScy__factory.ts +218 -243
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +39 -29
- package/typechain-types/factories/PendleYieldToken__factory.ts +153 -211
- package/typechain-types/factories/RewardManagerMini__factory.ts +116 -0
- package/typechain-types/factories/RewardManager__factory.ts +43 -32
- package/typechain-types/factories/RouterStatic__factory.ts +1 -1
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +242 -218
- package/typechain-types/factories/SCYBase__factory.ts +195 -176
- package/typechain-types/factories/VotingControllerStorage__factory.ts +361 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +616 -0
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +415 -0
- package/typechain-types/factories/VotingEscrowToken__factory.ts +153 -0
- package/typechain-types/hardhat.d.ts +327 -156
- package/typechain-types/index.ts +88 -50
- package/build/artifacts/contracts/SuperComposableYield/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCYUtils.sol/SCYUtils.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/IRewardManager.sol/IRewardManager.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/RewardManager.sol/RewardManager.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/SCYBase.sol/SCYBase.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleBaseToken.sol/PendleBaseToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarket.sol/PendleMarket.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarket.sol/PendleMarket.json +0 -842
- package/build/artifacts/contracts/core/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarketFactory.sol/PendleMarketFactory.json +0 -265
- package/build/artifacts/contracts/core/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendlePrincipalToken.sol/PendlePrincipalToken.json +0 -452
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +0 -783
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol/PendleBenQiErc20SCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol/PendleBenQiErc20SCY.json +0 -766
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol/PendleBtrflyScy.json +0 -641
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleStETHSCY.sol/PendleStEthSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleStETHSCY.sol/PendleStEthSCY.json +0 -623
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol/PendleYearnVaultScy.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol/PendleYearnVaultScy.json +0 -623
- package/build/artifacts/contracts/core/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +0 -339
- package/build/artifacts/contracts/core/PendleYieldToken.sol/PendleYieldToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleYieldToken.sol/PendleYieldToken.json +0 -808
- package/build/artifacts/contracts/core/RouterStatic.sol/RouterStatic.dbg.json +0 -4
- package/build/artifacts/contracts/core/RouterStatic.sol/RouterStatic.json +0 -862
- package/build/artifacts/contracts/core/actions/ActionRedeem.sol/ActionRedeem.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionRedeem.sol/ActionRedeem.json +0 -55
- package/build/artifacts/contracts/core/actions/base/ActionType.sol/ActionType.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPActionRedeem.sol/IPActionRedeem.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPActionRedeem.sol/IPActionRedeem.json +0 -55
- package/build/artifacts/contracts/interfaces/IPBaseToken.sol/IPBaseToken.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.json +0 -113
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/IPVotingEscrowController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/IPVotingEscrowController.json +0 -61
- package/build/artifacts/contracts/interfaces/IPendleGauge.sol/IPendleGauge.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPendleGauge.sol/IPendleGauge.json +0 -113
- package/build/artifacts/contracts/interfaces/IVePToken.sol/IVePToken.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IVotingEscrowController.sol/VotingEscrowController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IVotingEscrowController.sol/VotingEscrowController.json +0 -61
- package/build/artifacts/contracts/interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/JoeLibrary.sol/JoeLibrary.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/SCYIndex.sol/SCYIndexLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/MarketMathAux.sol/MarketMathAux.dbg.json +0 -4
- package/build/artifacts/contracts/periphery/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +0 -4
- package/contracts/SuperComposableYield/ISuperComposableYield.sol +0 -80
- package/contracts/SuperComposableYield/SCYUtils.sol +0 -14
- package/contracts/SuperComposableYield/implementations/IRewardManager.sol +0 -16
- package/contracts/SuperComposableYield/implementations/RewardManager.sol +0 -151
- package/contracts/SuperComposableYield/implementations/SCYBase.sol +0 -166
- package/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol +0 -88
- package/contracts/core/PendleBaseToken.sol +0 -35
- package/contracts/core/PendlePrincipalToken.sol +0 -54
- package/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol +0 -140
- package/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol +0 -133
- package/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol +0 -120
- package/contracts/core/PendleSCYImpl/PendleStETHSCY.sol +0 -107
- package/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol +0 -109
- package/contracts/core/PendleYieldToken.sol +0 -340
- package/contracts/core/actions/ActionRedeem.sol +0 -36
- package/contracts/core/actions/base/ActionType.sol +0 -11
- package/contracts/interfaces/IPActionRedeem.sol +0 -17
- package/contracts/interfaces/IPBaseToken.sol +0 -9
- package/contracts/interfaces/IPGauge.sol +0 -32
- package/contracts/interfaces/IPVotingEscrowController.sol +0 -14
- package/contracts/interfaces/IPendleGauge.sol +0 -32
- package/contracts/interfaces/IVePToken.sol +0 -14
- package/contracts/interfaces/IVotingEscrowController.sol +0 -14
- package/contracts/interfaces/IVotingEscrowPendle.sol +0 -32
- package/contracts/libraries/math/MarketMathAux.sol +0 -101
- package/typechain-types/AggregatorV2V3Interface.ts +0 -380
- package/typechain-types/BenqiChainlinkOracle.ts +0 -362
- package/typechain-types/BoringOwnable.ts +0 -194
- package/typechain-types/BoringOwnableData.ts +0 -100
- package/typechain-types/BoringOwnableUpg.ts +0 -194
- package/typechain-types/BoringOwnableUpgData.ts +0 -100
- package/typechain-types/Comptroller.ts +0 -2860
- package/typechain-types/ComptrollerErrorReporter.ts +0 -70
- package/typechain-types/ComptrollerInterface.ts +0 -881
- package/typechain-types/ComptrollerVXStorage.ts +0 -781
- package/typechain-types/CrosschainContract.ts +0 -113
- package/typechain-types/CrosschainReceiver.ts +0 -347
- package/typechain-types/CrosschainSender.ts +0 -210
- package/typechain-types/EIP20NonStandardInterface.ts +0 -298
- package/typechain-types/ERC20Locker.ts +0 -91
- package/typechain-types/EpochController.ts +0 -195
- package/typechain-types/FundKeeper.ts +0 -347
- package/typechain-types/GaugeTypeControllerAbstract.ts +0 -546
- package/typechain-types/GaugeTypeControllerCrosschain.ts +0 -733
- package/typechain-types/GaugeTypeControllerMainchain.ts +0 -604
- package/typechain-types/IGaugeController.ts +0 -99
- package/typechain-types/ILiquidYieldToken.ts +0 -639
- package/typechain-types/ILiquidYieldTokenWrap.ts +0 -790
- package/typechain-types/IMessageBus.ts +0 -543
- package/typechain-types/IPFlashCallback.ts +0 -115
- package/typechain-types/IPLiquidYieldToken.ts +0 -641
- package/typechain-types/IPMarketCallback.ts +0 -107
- package/typechain-types/IPRouterCore.ts +0 -769
- package/typechain-types/IPRouterRedeem.ts +0 -155
- package/typechain-types/IPRouterYT.ts +0 -489
- package/typechain-types/IPermissionsV2.ts +0 -87
- package/typechain-types/IRainbowBridge.ts +0 -91
- package/typechain-types/ISCYRewardIndex.ts +0 -695
- package/typechain-types/IVEPendleToken.ts +0 -121
- package/typechain-types/IXPendle.ts +0 -114
- package/typechain-types/JumpRateModel.ts +0 -347
- package/typechain-types/LYTBase.ts +0 -721
- package/typechain-types/LYTWrap.ts +0 -872
- package/typechain-types/LYTWrapWithRewards.ts +0 -979
- package/typechain-types/LiquidityMining.ts +0 -468
- package/typechain-types/Maximillion.ts +0 -145
- package/typechain-types/Ownable.ts +0 -160
- package/typechain-types/PendleBenqiLiquidYieldToken.ts +0 -1013
- package/typechain-types/PendleBtrflyLYT.ts +0 -781
- package/typechain-types/PendleJoeSwapHelper.ts +0 -92
- package/typechain-types/PendleLYTMockYT.ts +0 -894
- package/typechain-types/PendleLiquidYieldToken.ts +0 -814
- package/typechain-types/PendleLiquidYieldTokenBase.ts +0 -941
- package/typechain-types/PendleOwnershipToken.ts +0 -598
- package/typechain-types/PendleRouter01.ts +0 -184
- package/typechain-types/PendleRouter02.ts +0 -564
- package/typechain-types/PendleRouter03.ts +0 -224
- package/typechain-types/PendleRouterBase.ts +0 -126
- package/typechain-types/PendleRouterCore.ts +0 -328
- package/typechain-types/PendleRouterCoreUpg.ts +0 -798
- package/typechain-types/PendleRouterLytAndForge.ts +0 -331
- package/typechain-types/PendleRouterMarketBase.ts +0 -82
- package/typechain-types/PendleRouterOT.ts +0 -463
- package/typechain-types/PendleRouterProxy.ts +0 -335
- package/typechain-types/PendleRouterRawTokenOT.ts +0 -865
- package/typechain-types/PendleRouterRawTokenYT.ts +0 -520
- package/typechain-types/PendleRouterRedeemUpg.ts +0 -125
- package/typechain-types/PendleRouterSCYAndForgeBaseUpg.ts +0 -98
- package/typechain-types/PendleRouterStaticUpg.ts +0 -399
- package/typechain-types/PendleRouterYT.ts +0 -227
- package/typechain-types/PendleRouterYTBaseUpg.ts +0 -134
- package/typechain-types/PendleRouterYTUpg.ts +0 -537
- package/typechain-types/PendleYearnVaultLYT.ts +0 -723
- package/typechain-types/PglStakingContract.ts +0 -662
- package/typechain-types/PglStakingContractProxy.ts +0 -256
- package/typechain-types/PglStakingContractProxyStorage.ts +0 -136
- package/typechain-types/PglStakingContractStorage.ts +0 -397
- package/typechain-types/PriceOracle.ts +0 -116
- package/typechain-types/ProtocolFakeUser.ts +0 -105
- package/typechain-types/Qi.ts +0 -760
- package/typechain-types/QiAvax.ts +0 -1720
- package/typechain-types/QiDelegateInterface.ts +0 -145
- package/typechain-types/QiDelegatorInterface.ts +0 -149
- package/typechain-types/QiErc20.ts +0 -1846
- package/typechain-types/QiErc20Delegate.ts +0 -1926
- package/typechain-types/QiErc20Delegator.ts +0 -1885
- package/typechain-types/QiErc20Interface.ts +0 -382
- package/typechain-types/QiErc20Storage.ts +0 -79
- package/typechain-types/QiToken.ts +0 -1475
- package/typechain-types/QiTokenInterface.ts +0 -1419
- package/typechain-types/QiTokenSaleDistributor.ts +0 -771
- package/typechain-types/QiTokenSaleDistributorProxy.ts +0 -256
- package/typechain-types/QiTokenSaleDistributorProxyStorage.ts +0 -136
- package/typechain-types/QiTokenSaleDistributorStorage.ts +0 -401
- package/typechain-types/QiTokenStorage.ts +0 -311
- package/typechain-types/ReentrancyGuard.ts +0 -52
- package/typechain-types/SingleGaugeTypeController.ts +0 -478
- package/typechain-types/TokenErrorReporter.ts +0 -70
- package/typechain-types/Unitroller.ts +0 -356
- package/typechain-types/UnitrollerAdminStorage.ts +0 -143
- package/typechain-types/VePendle.ts +0 -1156
- package/typechain-types/VePendleCrosschain.ts +0 -969
- package/typechain-types/VePendleToken.ts +0 -688
- package/typechain-types/VotingController.ts +0 -883
- package/typechain-types/WETH9.ts +0 -414
- package/typechain-types/WhitePaperInterestRateModel.ts +0 -304
- package/typechain-types/XPendle.ts +0 -618
- package/typechain-types/factories/AggregatorV2V3Interface__factory.ts +0 -288
- package/typechain-types/factories/BenqiChainlinkOracle__factory.ts +0 -311
- package/typechain-types/factories/BoringOwnableData__factory.ts +0 -90
- package/typechain-types/factories/BoringOwnableUpgData__factory.ts +0 -94
- package/typechain-types/factories/BoringOwnableUpg__factory.ts +0 -139
- package/typechain-types/factories/BoringOwnable__factory.ts +0 -149
- package/typechain-types/factories/ComptrollerErrorReporter__factory.ts +0 -93
- package/typechain-types/factories/ComptrollerInterface__factory.ts +0 -595
- package/typechain-types/factories/ComptrollerVXStorage__factory.ts +0 -610
- package/typechain-types/factories/Comptroller__factory.ts +0 -2189
- package/typechain-types/factories/CrosschainContract__factory.ts +0 -52
- package/typechain-types/factories/CrosschainSender__factory.ts +0 -104
- package/typechain-types/factories/EIP20Interface__factory.ts +0 -248
- package/typechain-types/factories/ERC20Locker__factory.ts +0 -73
- package/typechain-types/factories/ERC20Premined__factory.ts +0 -393
- package/typechain-types/factories/ERC20PresetFixedSupply__factory.ts +0 -422
- package/typechain-types/factories/EpochController__factory.ts +0 -170
- package/typechain-types/factories/FundKeeper__factory.ts +0 -212
- package/typechain-types/factories/GaugeTypeControllerAbstract__factory.ts +0 -387
- package/typechain-types/factories/GaugeTypeControllerCrosschain__factory.ts +0 -522
- package/typechain-types/factories/GaugeTypeControllerMainchain__factory.ts +0 -431
- package/typechain-types/factories/IGaugeController__factory.ts +0 -45
- package/typechain-types/factories/ILiquidYieldTokenWrap__factory.ts +0 -533
- package/typechain-types/factories/IMessageBus__factory.ts +0 -396
- package/typechain-types/factories/IPFlashCallback__factory.ts +0 -49
- package/typechain-types/factories/IPLiquidYieldToken__factory.ts +0 -433
- package/typechain-types/factories/IPMarketCallback__factory.ts +0 -55
- package/typechain-types/factories/IPRouterCore__factory.ts +0 -531
- package/typechain-types/factories/IPRouterRedeem__factory.ts +0 -72
- package/typechain-types/factories/IPRouterYT__factory.ts +0 -305
- package/typechain-types/factories/ISCYRewardIndex__factory.ts +0 -465
- package/typechain-types/factories/IVEPendleToken__factory.ts +0 -71
- package/typechain-types/factories/IXPendle__factory.ts +0 -61
- package/typechain-types/factories/JumpRateModel__factory.ts +0 -334
- package/typechain-types/factories/LYTBaseWithRewards__factory.ts +0 -530
- package/typechain-types/factories/LYTBase__factory.ts +0 -474
- package/typechain-types/factories/LYTWrapWithRewards__factory.ts +0 -643
- package/typechain-types/factories/LYTWrap__factory.ts +0 -574
- package/typechain-types/factories/LiquidityMining__factory.ts +0 -367
- package/typechain-types/factories/Maximillion__factory.ts +0 -125
- package/typechain-types/factories/Ownable__factory.ts +0 -75
- package/typechain-types/factories/PendleAaveV3LYT__factory.ts +0 -657
- package/typechain-types/factories/PendleBenQiErc20LYT__factory.ts +0 -748
- package/typechain-types/factories/PendleBenqiLiquidYieldToken__factory.ts +0 -785
- package/typechain-types/factories/PendleBtrflyLYT__factory.ts +0 -647
- package/typechain-types/factories/PendleJoeSwapHelper__factory.ts +0 -52
- package/typechain-types/factories/PendleLYTMockYT__factory.ts +0 -732
- package/typechain-types/factories/PendleLiquidYieldTokenBase__factory.ts +0 -603
- package/typechain-types/factories/PendleLiquidYieldToken__factory.ts +0 -510
- package/typechain-types/factories/PendleOwnershipToken__factory.ts +0 -527
- package/typechain-types/factories/PendleRouter01__factory.ts +0 -152
- package/typechain-types/factories/PendleRouter02__factory.ts +0 -438
- package/typechain-types/factories/PendleRouter03__factory.ts +0 -190
- package/typechain-types/factories/PendleRouterCoreUpg__factory.ts +0 -635
- package/typechain-types/factories/PendleRouterCore__factory.ts +0 -268
- package/typechain-types/factories/PendleRouterLytAndForge__factory.ts +0 -294
- package/typechain-types/factories/PendleRouterMarketBase__factory.ts +0 -43
- package/typechain-types/factories/PendleRouterOT__factory.ts +0 -372
- package/typechain-types/factories/PendleRouterProxy__factory.ts +0 -285
- package/typechain-types/factories/PendleRouterRawTokenOT__factory.ts +0 -697
- package/typechain-types/factories/PendleRouterRawTokenYT__factory.ts +0 -431
- package/typechain-types/factories/PendleRouterRedeemUpg__factory.ts +0 -112
- package/typechain-types/factories/PendleRouterSCYAndForgeBaseUpg__factory.ts +0 -56
- package/typechain-types/factories/PendleRouterStaticUpg__factory.ts +0 -315
- package/typechain-types/factories/PendleRouterYTBaseUpg__factory.ts +0 -66
- package/typechain-types/factories/PendleRouterYTUpg__factory.ts +0 -422
- package/typechain-types/factories/PendleRouterYT__factory.ts +0 -184
- package/typechain-types/factories/PendleYTLYTBenqi__factory.ts +0 -713
- package/typechain-types/factories/PendleYearnVaultLYT__factory.ts +0 -586
- package/typechain-types/factories/PermlessAbstract__factory.ts +0 -30
- package/typechain-types/factories/PglStakingContractProxyStorage__factory.ts +0 -130
- package/typechain-types/factories/PglStakingContractProxy__factory.ts +0 -187
- package/typechain-types/factories/PglStakingContractStorage__factory.ts +0 -309
- package/typechain-types/factories/PglStakingContract__factory.ts +0 -446
- package/typechain-types/factories/PriceOracle__factory.ts +0 -59
- package/typechain-types/factories/ProtocolFakeUser__factory.ts +0 -87
- package/typechain-types/factories/QiAvax__factory.ts +0 -1471
- package/typechain-types/factories/QiDelegateInterface__factory.ts +0 -65
- package/typechain-types/factories/QiDelegationStorage__factory.ts +0 -79
- package/typechain-types/factories/QiDelegatorInterface__factory.ts +0 -89
- package/typechain-types/factories/QiErc20Delegate__factory.ts +0 -1563
- package/typechain-types/factories/QiErc20Delegator__factory.ts +0 -1648
- package/typechain-types/factories/QiErc20Interface__factory.ts +0 -239
- package/typechain-types/factories/QiErc20Storage__factory.ts +0 -79
- package/typechain-types/factories/QiErc20__factory.ts +0 -1515
- package/typechain-types/factories/QiTokenInterface__factory.ts +0 -1182
- package/typechain-types/factories/QiTokenSaleDistributorProxyStorage__factory.ts +0 -124
- package/typechain-types/factories/QiTokenSaleDistributorProxy__factory.ts +0 -171
- package/typechain-types/factories/QiTokenSaleDistributorStorage__factory.ts +0 -289
- package/typechain-types/factories/QiTokenSaleDistributor__factory.ts +0 -480
- package/typechain-types/factories/QiTokenStorage__factory.ts +0 -274
- package/typechain-types/factories/QiToken__factory.ts +0 -1219
- package/typechain-types/factories/Qi__factory.ts +0 -648
- package/typechain-types/factories/ReentrancyGuard__factory.ts +0 -69
- package/typechain-types/factories/SingleGaugeTypeController__factory.ts +0 -341
- package/typechain-types/factories/TokenErrorReporter__factory.ts +0 -89
- package/typechain-types/factories/UnitrollerAdminStorage__factory.ts +0 -128
- package/typechain-types/factories/Unitroller__factory.ts +0 -305
- package/typechain-types/factories/VePendleCrosschain__factory.ts +0 -727
- package/typechain-types/factories/VePendleToken__factory.ts +0 -494
- package/typechain-types/factories/VePendle__factory.ts +0 -800
- package/typechain-types/factories/VotingController__factory.ts +0 -610
- package/typechain-types/factories/WETH9__factory.ts +0 -342
- package/typechain-types/factories/WhitePaperInterestRateModel__factory.ts +0 -281
- package/typechain-types/factories/XPendle__factory.ts +0 -473
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.13;
|
|
25
|
+
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
26
|
+
|
|
27
|
+
interface ISuperComposableYield is IERC20Metadata {
|
|
28
|
+
/// @dev Emitted when any base tokens is deposited to mint shares
|
|
29
|
+
event Deposit(
|
|
30
|
+
address indexed caller,
|
|
31
|
+
address indexed receiver,
|
|
32
|
+
address indexed tokenIn,
|
|
33
|
+
uint256 amountDeposited,
|
|
34
|
+
uint256 amountScyOut
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
/// @dev Emitted when any shares are redeemed for base tokens
|
|
38
|
+
event Redeem(
|
|
39
|
+
address indexed caller,
|
|
40
|
+
address indexed receiver,
|
|
41
|
+
address indexed tokenOut,
|
|
42
|
+
uint256 amountScyToRedeem,
|
|
43
|
+
uint256 amountTokenOut
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
/// @dev check assetInfo for more information
|
|
47
|
+
enum AssetType {
|
|
48
|
+
TOKEN,
|
|
49
|
+
LIQUIDITY
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// @dev Emitted when (`user`) claims their rewards
|
|
53
|
+
event ClaimRewards(address indexed user, address[] rewardTokens, uint256[] rewardAmounts);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @notice mints an amount of shares by depositing a base token.
|
|
57
|
+
* @param receiver shares recipient address
|
|
58
|
+
* @param tokenIn address of the base tokens to mint shares
|
|
59
|
+
* @param amountTokenToPull amount of base tokens to be transferred from (`msg.sender`)
|
|
60
|
+
* @param minSharesOut reverts if amount of shares minted is lower than this
|
|
61
|
+
* @return amountSharesOut amount of shares minted
|
|
62
|
+
* @dev
|
|
63
|
+
*
|
|
64
|
+
* This contract receives base tokens using these two (possibly both) methods:
|
|
65
|
+
* - The tokens have been transferred directly to this contract prior to calling deposit().
|
|
66
|
+
* - Exactly `amountTokenToPull` are transferred to this contract using `transferFrom()` upon calling deposit().
|
|
67
|
+
*
|
|
68
|
+
* The amount of shares minted will be based on the combined amount of base tokens deposited
|
|
69
|
+
* using the given two methods.
|
|
70
|
+
*
|
|
71
|
+
* Emits a {Deposit} event
|
|
72
|
+
*
|
|
73
|
+
* Requirements:
|
|
74
|
+
* - (`baseTokenIn`) must be a valid base token.
|
|
75
|
+
* - There must be an ongoing approval from (`msg.sender`) for this contract with
|
|
76
|
+
* at least `amountTokenToPull` base tokens.
|
|
77
|
+
*/
|
|
78
|
+
function deposit(
|
|
79
|
+
address receiver,
|
|
80
|
+
address tokenIn,
|
|
81
|
+
uint256 amountTokenToPull,
|
|
82
|
+
uint256 minSharesOut
|
|
83
|
+
) external payable returns (uint256 amountSharesOut);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @notice redeems an amount of base tokens by burning some shares
|
|
87
|
+
* @param receiver recipient address
|
|
88
|
+
* @param amountSharesToPull amount of shares to be transferred from (`msg.sender`)
|
|
89
|
+
* @param tokenOut address of the base token to be redeemed
|
|
90
|
+
* @param minTokenOut reverts if amount of base token redeemed is lower than this
|
|
91
|
+
* @return amountTokenOut amount of base tokens redeemed
|
|
92
|
+
* @dev
|
|
93
|
+
*
|
|
94
|
+
* This contract receives shares using these two (possibly both) methods:
|
|
95
|
+
* - The shares have been transferred directly to this contract prior to calling redeem().
|
|
96
|
+
* - Exactly `amountSharesToPull` are transferred to this contract using `transferFrom()` upon calling redeem().
|
|
97
|
+
*
|
|
98
|
+
* The amount of base tokens redeemed based on the combined amount of shares deposited
|
|
99
|
+
* using the given two methods
|
|
100
|
+
*
|
|
101
|
+
* Emits a {Redeem} event
|
|
102
|
+
*
|
|
103
|
+
* Requirements:
|
|
104
|
+
* - (`tokenOut`) must be a valid base token.
|
|
105
|
+
* - There must be an ongoing approval from (`msg.sender`) for this contract with
|
|
106
|
+
* at least `amountSharesToPull` shares.
|
|
107
|
+
*/
|
|
108
|
+
function redeem(
|
|
109
|
+
address receiver,
|
|
110
|
+
uint256 amountSharesToPull,
|
|
111
|
+
address tokenOut,
|
|
112
|
+
uint256 minTokenOut
|
|
113
|
+
) external returns (uint256 amountTokenOut);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @notice exchangeRate * scyBalance / 1e18 must return the asset balance of the account
|
|
117
|
+
* @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of scy
|
|
118
|
+
he can mint must be X * exchangeRate / 1e18
|
|
119
|
+
* @dev SCYUtils's assetToScy & scyToAsset should be used instead of raw multiplication
|
|
120
|
+
& division
|
|
121
|
+
*/
|
|
122
|
+
function exchangeRate() external view returns (uint256 res);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @notice claims reward for (`user`)
|
|
126
|
+
* @param user the user receiving their rewards
|
|
127
|
+
* @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`
|
|
128
|
+
* @dev
|
|
129
|
+
* Emits a `ClaimRewardss` event
|
|
130
|
+
* See {getRewardTokens} for list of reward tokens
|
|
131
|
+
*/
|
|
132
|
+
function claimRewards(address user) external returns (uint256[] memory rewardAmounts);
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @notice get the amount of unclaimed rewards for (`user`)
|
|
136
|
+
* @param user the user to check for
|
|
137
|
+
* @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`
|
|
138
|
+
*/
|
|
139
|
+
function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts);
|
|
140
|
+
|
|
141
|
+
function rewardIndexesCurrent() external returns (uint256[] memory indexes);
|
|
142
|
+
|
|
143
|
+
function rewardIndexesStored() external view returns (uint256[] memory indexes);
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @notice returns the list of reward token addresses
|
|
147
|
+
*/
|
|
148
|
+
function getRewardTokens() external view returns (address[] memory);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @notice returns the address of the underlying yield token
|
|
152
|
+
*/
|
|
153
|
+
function yieldToken() external view returns (address);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @notice returns a list of all the base tokens that can be deposited to mint shares
|
|
157
|
+
*/
|
|
158
|
+
function getBaseTokens() external view returns (address[] memory res);
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @notice checks whether a token is a valid base token
|
|
162
|
+
* @notice returns a boolean indicating whether this is a valid token
|
|
163
|
+
*/
|
|
164
|
+
function isValidBaseToken(address token) external view returns (bool);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @notice This function contains information to interpret what the asset is
|
|
168
|
+
* @notice decimals is the decimals to format asset balances
|
|
169
|
+
* @notice if asset is an ERC20 token, assetType = 0, assetAddress is the address of the token
|
|
170
|
+
* @notice if asset is liquidity of an AMM (like sqrt(k) in UniswapV2 forks), assetType = 1,
|
|
171
|
+
assetAddress is the address of the LP token
|
|
172
|
+
* @notice assetDecimals is the decimals of the asset
|
|
173
|
+
*/
|
|
174
|
+
function assetInfo()
|
|
175
|
+
external
|
|
176
|
+
view
|
|
177
|
+
returns (
|
|
178
|
+
AssetType assetType,
|
|
179
|
+
address assetAddress,
|
|
180
|
+
uint8 assetDecimals
|
|
181
|
+
);
|
|
182
|
+
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
|
-
pragma solidity 0.8.
|
|
23
|
+
pragma solidity 0.8.13;
|
|
24
24
|
|
|
25
25
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
26
26
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
|
-
pragma solidity 0.8.
|
|
23
|
+
pragma solidity 0.8.13;
|
|
24
24
|
|
|
25
25
|
interface IWXBTRFLY {
|
|
26
26
|
function wrapFromBTRFLY(uint256 _amount) external returns (uint256);
|
|
@@ -31,6 +31,8 @@ interface IWXBTRFLY {
|
|
|
31
31
|
|
|
32
32
|
function unwrapToxBTRFLY(uint256 _amount) external returns (uint256);
|
|
33
33
|
|
|
34
|
+
function BTRFLY() external view returns (address);
|
|
35
|
+
|
|
34
36
|
function xBTRFLY() external view returns (address);
|
|
35
37
|
|
|
36
38
|
function xBTRFLYValue(uint256 _amount) external view returns (uint256);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
interface IWstETH {
|
|
5
5
|
function wrap(uint256 _stETHAmount) external returns (uint256);
|
|
6
6
|
|
|
7
7
|
function unwrap(uint256 _wstETHAmount) external returns (uint256);
|
|
8
8
|
|
|
9
|
+
function stETH() external view returns (address);
|
|
10
|
+
|
|
9
11
|
function stEthPerToken() external view returns (uint256);
|
|
10
12
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
pragma solidity 0.8.
|
|
24
|
+
pragma solidity 0.8.13;
|
|
25
25
|
|
|
26
26
|
interface IYearnVault {
|
|
27
27
|
function deposit(uint256 amount) external returns (uint256);
|
|
@@ -29,4 +29,6 @@ interface IYearnVault {
|
|
|
29
29
|
function withdraw(uint256 maxShares) external returns (uint256);
|
|
30
30
|
|
|
31
31
|
function pricePerShare() external view returns (uint256);
|
|
32
|
+
|
|
33
|
+
function token() external view returns (address);
|
|
32
34
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
import "../interfaces/IRewardManager.sol";
|
|
4
|
+
import "./RewardManagerAbstract.sol";
|
|
5
|
+
import "./math/Math.sol";
|
|
6
|
+
import "../libraries/helpers/ArrayLib.sol";
|
|
7
|
+
|
|
8
|
+
/// * This RewardManager can be used with any contracts, regardless of what tokens that contract stores
|
|
9
|
+
/// since the RewardManager will maintain its own internal balance
|
|
10
|
+
/// * Use with SCY + PendleMarket. For YT, it has its own native implementation for gas saving
|
|
11
|
+
abstract contract RewardManager is RewardManagerAbstract {
|
|
12
|
+
using Math for uint256;
|
|
13
|
+
using ArrayLib for uint256[];
|
|
14
|
+
|
|
15
|
+
uint256 public lastRewardBlock;
|
|
16
|
+
|
|
17
|
+
mapping(address => RewardState) public rewardState;
|
|
18
|
+
|
|
19
|
+
uint256 internal constant INITIAL_REWARD_INDEX = 1;
|
|
20
|
+
|
|
21
|
+
function _updateRewardIndex()
|
|
22
|
+
internal
|
|
23
|
+
virtual
|
|
24
|
+
override
|
|
25
|
+
returns (address[] memory tokens, uint256[] memory indexes)
|
|
26
|
+
{
|
|
27
|
+
tokens = _getRewardTokens();
|
|
28
|
+
indexes = new uint256[](tokens.length);
|
|
29
|
+
|
|
30
|
+
if (tokens.length == 0) return (tokens, indexes);
|
|
31
|
+
|
|
32
|
+
if (lastRewardBlock != block.number) {
|
|
33
|
+
// if we have not yet update the index for this block
|
|
34
|
+
lastRewardBlock = block.number;
|
|
35
|
+
|
|
36
|
+
uint256 totalShares = _rewardSharesTotal();
|
|
37
|
+
|
|
38
|
+
uint256[] memory preBalances = _selfBalances(tokens);
|
|
39
|
+
|
|
40
|
+
_redeemExternalReward();
|
|
41
|
+
|
|
42
|
+
uint256[] memory accrued = _selfBalances(tokens).sub(preBalances);
|
|
43
|
+
|
|
44
|
+
for (uint256 i = 0; i < tokens.length; ++i) {
|
|
45
|
+
address token = tokens[i];
|
|
46
|
+
uint256 index = rewardState[token].index;
|
|
47
|
+
|
|
48
|
+
if (index == 0) index = INITIAL_REWARD_INDEX;
|
|
49
|
+
if (totalShares != 0) index += accrued[i].divDown(totalShares);
|
|
50
|
+
|
|
51
|
+
rewardState[token].index = index.Uint128();
|
|
52
|
+
rewardState[token].lastBalance += accrued[i].Uint128();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
for (uint256 i = 0; i < tokens.length; i++) indexes[i] = rewardState[tokens[i]].index;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// @dev this function doesn't need redeemExternal since redeemExternal is bundled in updateRewardIndex
|
|
60
|
+
/// @dev this function also has to update rewardState.lastBalance
|
|
61
|
+
function _doTransferOutRewards(address user, address receiver)
|
|
62
|
+
internal
|
|
63
|
+
virtual
|
|
64
|
+
override
|
|
65
|
+
returns (uint256[] memory rewardAmounts)
|
|
66
|
+
{
|
|
67
|
+
address[] memory tokens = _getRewardTokens();
|
|
68
|
+
rewardAmounts = new uint256[](tokens.length);
|
|
69
|
+
for (uint256 i = 0; i < tokens.length; i++) {
|
|
70
|
+
rewardAmounts[i] = userReward[tokens[i]][user].accrued;
|
|
71
|
+
if (rewardAmounts[i] != 0) {
|
|
72
|
+
userReward[tokens[i]][user].accrued = 0;
|
|
73
|
+
rewardState[tokens[i]].lastBalance -= rewardAmounts[i].Uint128();
|
|
74
|
+
_transferOut(tokens[i], receiver, rewardAmounts[i]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
import "../interfaces/IRewardManager.sol";
|
|
4
|
+
import "./helpers/TokenHelper.sol";
|
|
5
|
+
import "./math/Math.sol";
|
|
6
|
+
|
|
7
|
+
abstract contract RewardManagerAbstract is IRewardManager, TokenHelper {
|
|
8
|
+
using Math for uint256;
|
|
9
|
+
|
|
10
|
+
struct RewardState {
|
|
11
|
+
uint128 index;
|
|
12
|
+
uint128 lastBalance;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
struct UserReward {
|
|
16
|
+
uint128 index;
|
|
17
|
+
uint128 accrued;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// [token] => [user] => (index,accured)
|
|
21
|
+
mapping(address => mapping(address => UserReward)) public userReward;
|
|
22
|
+
|
|
23
|
+
function _updateAndDistributeRewards(address user) internal virtual {
|
|
24
|
+
_updateAndDistributeRewardsForTwo(user, address(0));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _updateAndDistributeRewardsForTwo(address user1, address user2) internal virtual {
|
|
28
|
+
(address[] memory tokens, uint256[] memory indexes) = _updateRewardIndex();
|
|
29
|
+
if (tokens.length == 0) return;
|
|
30
|
+
|
|
31
|
+
if (user1 != address(0) && user1 != address(this))
|
|
32
|
+
_distributeRewards(user1, tokens, indexes);
|
|
33
|
+
if (user2 != address(0) && user2 != address(this))
|
|
34
|
+
_distributeRewards(user2, tokens, indexes);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// @dev private function
|
|
38
|
+
function _distributeRewards(
|
|
39
|
+
address user,
|
|
40
|
+
address[] memory tokens,
|
|
41
|
+
uint256[] memory indexes
|
|
42
|
+
) private {
|
|
43
|
+
uint256 userShares = _rewardSharesUser(user);
|
|
44
|
+
|
|
45
|
+
for (uint256 i = 0; i < tokens.length; ++i) {
|
|
46
|
+
address token = tokens[i];
|
|
47
|
+
uint256 index = indexes[i];
|
|
48
|
+
uint256 userIndex = userReward[token][user].index;
|
|
49
|
+
|
|
50
|
+
if (userIndex == 0) userIndex = index;
|
|
51
|
+
if (userIndex == index) continue;
|
|
52
|
+
|
|
53
|
+
uint256 deltaIndex = index - userIndex;
|
|
54
|
+
uint256 rewardDelta = userShares.mulDown(deltaIndex);
|
|
55
|
+
uint256 rewardAccrued = userReward[token][user].accrued + rewardDelta;
|
|
56
|
+
|
|
57
|
+
userReward[token][user] = UserReward({
|
|
58
|
+
index: index.Uint128(),
|
|
59
|
+
accrued: rewardAccrued.Uint128()
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _updateRewardIndex()
|
|
65
|
+
internal
|
|
66
|
+
virtual
|
|
67
|
+
returns (address[] memory tokens, uint256[] memory indexes);
|
|
68
|
+
|
|
69
|
+
function _redeemExternalReward() internal virtual;
|
|
70
|
+
|
|
71
|
+
function _doTransferOutRewards(address user, address receiver)
|
|
72
|
+
internal
|
|
73
|
+
virtual
|
|
74
|
+
returns (uint256[] memory rewardAmounts);
|
|
75
|
+
|
|
76
|
+
function _getRewardTokens() internal view virtual returns (address[] memory);
|
|
77
|
+
|
|
78
|
+
function _rewardSharesUser(address user) internal view virtual returns (uint256);
|
|
79
|
+
|
|
80
|
+
function _rewardSharesTotal() internal view virtual returns (uint256);
|
|
81
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
import "../../interfaces/ISuperComposableYield.sol";
|
|
4
|
+
import "./SCYUtils.sol";
|
|
5
|
+
import "../math/Math.sol";
|
|
6
6
|
|
|
7
7
|
type SCYIndex is uint256;
|
|
8
8
|
|
|
@@ -10,12 +10,12 @@ library SCYIndexLib {
|
|
|
10
10
|
using Math for uint256;
|
|
11
11
|
using Math for int256;
|
|
12
12
|
|
|
13
|
-
function newIndex(ISuperComposableYield SCY) internal returns (SCYIndex) {
|
|
14
|
-
return SCYIndex.wrap(SCY.
|
|
13
|
+
function newIndex(ISuperComposableYield SCY) internal view returns (SCYIndex) {
|
|
14
|
+
return SCYIndex.wrap(SCY.exchangeRate());
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function newIndex(address SCY) internal returns (SCYIndex) {
|
|
18
|
-
return SCYIndex.wrap(ISuperComposableYield(SCY).
|
|
17
|
+
function newIndex(address SCY) internal view returns (SCYIndex) {
|
|
18
|
+
return SCYIndex.wrap(ISuperComposableYield(SCY).exchangeRate());
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function scyToAsset(SCYIndex index, uint256 scyAmount)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
|
|
4
|
+
library SCYUtils {
|
|
5
|
+
uint256 internal constant ONE = 1e18;
|
|
6
|
+
|
|
7
|
+
function scyToAsset(uint256 exchangeRate, uint256 scyAmount) internal pure returns (uint256) {
|
|
8
|
+
return (scyAmount * exchangeRate) / ONE;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function assetToScy(uint256 exchangeRate, uint256 assetAmount)
|
|
12
|
+
internal
|
|
13
|
+
pure
|
|
14
|
+
returns (uint256)
|
|
15
|
+
{
|
|
16
|
+
return (assetAmount * ONE) / exchangeRate;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
|
|
4
|
+
struct VeBalance {
|
|
5
|
+
uint128 bias;
|
|
6
|
+
uint128 slope;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
struct LockedPosition {
|
|
10
|
+
uint128 amount;
|
|
11
|
+
uint128 expiry;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
struct Checkpoint {
|
|
15
|
+
VeBalance balance;
|
|
16
|
+
uint128 timestamp;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
library VeBalanceLib {
|
|
20
|
+
uint128 internal constant MAX_LOCK_TIME = 104 weeks;
|
|
21
|
+
|
|
22
|
+
function add(VeBalance memory a, VeBalance memory b)
|
|
23
|
+
internal
|
|
24
|
+
pure
|
|
25
|
+
returns (VeBalance memory res)
|
|
26
|
+
{
|
|
27
|
+
res.bias = a.bias + b.bias;
|
|
28
|
+
res.slope = a.slope + b.slope;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function sub(VeBalance memory a, VeBalance memory b)
|
|
32
|
+
internal
|
|
33
|
+
pure
|
|
34
|
+
returns (VeBalance memory res)
|
|
35
|
+
{
|
|
36
|
+
res.bias = a.bias - b.bias;
|
|
37
|
+
res.slope = a.slope - b.slope;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function sub(
|
|
41
|
+
VeBalance memory a,
|
|
42
|
+
uint128 slope,
|
|
43
|
+
uint128 expiry
|
|
44
|
+
) internal pure returns (VeBalance memory res) {
|
|
45
|
+
res.slope = a.slope - slope;
|
|
46
|
+
res.bias = a.bias - slope * expiry;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function isExpired(VeBalance memory a) internal view returns (bool) {
|
|
50
|
+
return a.slope * uint128(block.timestamp) >= a.bias;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getCurrentValue(VeBalance memory a) internal view returns (uint128) {
|
|
54
|
+
if (isExpired(a)) return 0;
|
|
55
|
+
return getValueAt(a, uint128(block.timestamp));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getValueAt(VeBalance memory a, uint128 t) internal pure returns (uint128) {
|
|
59
|
+
return a.bias - a.slope * t;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getExpiry(VeBalance memory a) internal pure returns (uint128) {
|
|
63
|
+
require(a.slope != 0, "zero slope");
|
|
64
|
+
return a.bias / a.slope;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getCheckpointValueAt(Checkpoint[] storage checkpoints, uint128 timestamp)
|
|
68
|
+
internal
|
|
69
|
+
view
|
|
70
|
+
returns (uint128)
|
|
71
|
+
{
|
|
72
|
+
if (checkpoints.length == 0 || checkpoints[0].timestamp > timestamp) {
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
uint256 left = 0;
|
|
77
|
+
uint256 right = checkpoints.length;
|
|
78
|
+
|
|
79
|
+
while (left < right) {
|
|
80
|
+
uint256 mid = (left + right) / 2;
|
|
81
|
+
if (checkpoints[mid].timestamp <= timestamp) {
|
|
82
|
+
left = mid;
|
|
83
|
+
} else {
|
|
84
|
+
right = mid - 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
VeBalance memory bal = checkpoints[left].balance;
|
|
89
|
+
if (getExpiry(bal) <= timestamp) {
|
|
90
|
+
return 0;
|
|
91
|
+
} else {
|
|
92
|
+
return getValueAt(bal, timestamp);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function convertToVeBalance(LockedPosition memory position)
|
|
97
|
+
internal
|
|
98
|
+
pure
|
|
99
|
+
returns (VeBalance memory res)
|
|
100
|
+
{
|
|
101
|
+
res.slope = position.amount / MAX_LOCK_TIME;
|
|
102
|
+
require(res.slope > 0, "zero slope");
|
|
103
|
+
res.bias = res.slope * position.expiry;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function convertToVeBalance(uint128 amount, uint128 expiry)
|
|
107
|
+
internal
|
|
108
|
+
pure
|
|
109
|
+
returns (uint128, uint128)
|
|
110
|
+
{
|
|
111
|
+
VeBalance memory balance = convertToVeBalance(LockedPosition(amount, expiry));
|
|
112
|
+
return (balance.bias, balance.slope);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
library ArrayLib {
|
|
5
|
+
function padZeroRight(uint256[] memory input, uint256 length)
|
|
6
|
+
internal
|
|
7
|
+
pure
|
|
8
|
+
returns (uint256[] memory)
|
|
9
|
+
{
|
|
10
|
+
uint256[] memory output = new uint256[](length);
|
|
11
|
+
uint256 inputLength = input.length;
|
|
12
|
+
for (uint8 i = 0; i < length; ) {
|
|
13
|
+
if (i < inputLength) output[i] = input[i];
|
|
14
|
+
else output[i] = 0;
|
|
15
|
+
unchecked {
|
|
16
|
+
i++;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return output;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function contains(address[] memory array, address element) internal pure returns (bool) {
|
|
23
|
+
uint256 length = array.length;
|
|
24
|
+
for (uint256 i = 0; i < length; ) {
|
|
25
|
+
if (array[i] == element) return true;
|
|
26
|
+
unchecked {
|
|
27
|
+
i++;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function append(address[] memory inp, address element)
|
|
34
|
+
internal
|
|
35
|
+
pure
|
|
36
|
+
returns (address[] memory out)
|
|
37
|
+
{
|
|
38
|
+
uint256 length = inp.length;
|
|
39
|
+
out = new address[](length + 1);
|
|
40
|
+
for (uint256 i = 0; i < length; ) {
|
|
41
|
+
out[i] = inp[i];
|
|
42
|
+
unchecked {
|
|
43
|
+
i++;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
out[length] = element;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function sub(uint256[] memory a, uint256[] memory b)
|
|
50
|
+
internal
|
|
51
|
+
pure
|
|
52
|
+
returns (uint256[] memory res)
|
|
53
|
+
{
|
|
54
|
+
uint256 length = a.length;
|
|
55
|
+
require(length == b.length, "length mismatch");
|
|
56
|
+
res = new uint256[](length);
|
|
57
|
+
|
|
58
|
+
for (uint256 i = 0; i < length; ) {
|
|
59
|
+
res[i] = a[i] - b[i];
|
|
60
|
+
unchecked {
|
|
61
|
+
i++;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
import "../solmate/SSTORE2.sol";
|
|
4
|
+
|
|
5
|
+
/// @dev save creation code of a contract onchain, and load it when necessary
|
|
6
|
+
abstract contract MiniDeployer {
|
|
7
|
+
function _setCreationCode(bytes memory newCreationCode) internal returns (address pointer) {
|
|
8
|
+
require(newCreationCode.length > 0, "zero length");
|
|
9
|
+
pointer = SSTORE2.write(newCreationCode);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function _deployWithArgs(address creationCodePointer, bytes memory args)
|
|
13
|
+
internal
|
|
14
|
+
returns (address deployedContract)
|
|
15
|
+
{
|
|
16
|
+
require(creationCodePointer != address(0), "zero pointer");
|
|
17
|
+
bytes memory finalCreationCode = abi.encodePacked(SSTORE2.read(creationCodePointer), args);
|
|
18
|
+
assembly {
|
|
19
|
+
deployedContract := create(0, add(finalCreationCode, 32), mload(finalCreationCode))
|
|
20
|
+
}
|
|
21
|
+
require(deployedContract != address(0), "deployment failed");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
pragma solidity 0.8.13;
|
|
2
|
+
|
|
3
|
+
library MiniHelpers {
|
|
4
|
+
function isCurrentlyExpired(uint256 expiry) internal view returns (bool) {
|
|
5
|
+
return (expiry <= block.timestamp);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function isExpired(uint256 expiry, uint256 blockTime) internal pure returns (bool) {
|
|
9
|
+
return (expiry <= blockTime);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function isTimeInThePast(uint256 timestamp) internal view returns (bool) {
|
|
13
|
+
return (timestamp <= block.timestamp); // same definition as isCurrentlyExpired
|
|
14
|
+
}
|
|
15
|
+
}
|