@pendle/core-v2 0.6.8 → 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/IPVotingEscrow.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 +4 -0
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +99 -0
- 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 +4 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.json +148 -0
- 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 +10 -5
- 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/ActionSCYAndPTBase.ts +210 -0
- 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/ERC20Permit.ts +521 -0
- package/typechain-types/IAToken.ts +55 -0
- package/typechain-types/IBeacon.ts +87 -0
- package/typechain-types/IBenQiComptroller.ts +13 -0
- package/typechain-types/IBenQiInterestRateModel.ts +162 -0
- package/typechain-types/ICelerMessageBus.ts +134 -0
- package/typechain-types/ICelerMessageReceiverApp.ts +120 -0
- package/typechain-types/IERC1822Proxiable.ts +87 -0
- package/typechain-types/IERC20Permit.ts +175 -0
- package/typechain-types/IERC4626.ts +463 -0
- 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 +104 -0
- 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 +198 -0
- package/typechain-types/IPVotingController.ts +179 -0
- package/typechain-types/IPVotingEscrow.ts +217 -0
- package/typechain-types/IPVotingEscrowController.ts +154 -0
- package/typechain-types/IPYieldToken.ts +176 -213
- package/typechain-types/IQiAvax.ts +551 -0
- 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/PendleERC20.ts +339 -0
- package/typechain-types/PendleERC20Permit.ts +443 -0
- package/typechain-types/PendleERC4626SCY.ts +801 -0
- package/typechain-types/PendleGauge.ts +276 -0
- package/typechain-types/PendleGaugeController.ts +346 -0
- package/typechain-types/PendleGaugeControllerMainchain.ts +410 -0
- package/typechain-types/PendleGaugeControllerSidechain.ts +524 -0
- package/typechain-types/PendleJoeLpSCY.ts +837 -0
- 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/PendleQiTokenHelper.ts +57 -0
- package/typechain-types/PendleQiTokenSCY.ts +991 -0
- package/typechain-types/PendleRouter.ts +0 -19
- package/typechain-types/PendleVotingController.ts +1042 -0
- package/typechain-types/PendleWstEthSCY.ts +813 -0
- 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/ActionSCYAndPTBase__factory.ts +187 -0
- 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/CelerReceiver__factory.ts +140 -0
- package/typechain-types/factories/CelerSender__factory.ts +85 -0
- package/typechain-types/factories/ERC1967Upgrade__factory.ts +71 -0
- package/typechain-types/factories/ERC20Permit__factory.ts +368 -0
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IAToken__factory.ts +39 -0
- package/typechain-types/factories/IBeacon__factory.ts +36 -0
- package/typechain-types/factories/IBenQiComptroller__factory.ts +13 -0
- package/typechain-types/factories/IBenQiInterestRateModel__factory.ts +93 -0
- package/typechain-types/factories/ICelerMessageBus__factory.ts +68 -0
- package/typechain-types/factories/ICelerMessageReceiverApp__factory.ts +64 -0
- package/typechain-types/factories/IERC1822Proxiable__factory.ts +39 -0
- package/typechain-types/factories/IERC20Permit__factory.ts +98 -0
- package/typechain-types/factories/IERC4626__factory.ts +330 -0
- 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 +42 -0
- 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 +111 -0
- package/typechain-types/factories/IPVotingController__factory.ts +182 -0
- package/typechain-types/factories/IPVotingEscrowController__factory.ts +80 -0
- package/typechain-types/factories/IPVotingEscrow__factory.ts +163 -0
- package/typechain-types/factories/IPYieldToken__factory.ts +85 -83
- package/typechain-types/factories/IQiAvax__factory.ts +362 -0
- 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/PendleGaugeController__factory.ts +212 -0
- package/typechain-types/factories/PendleGauge__factory.ts +171 -0
- 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 +338 -131
- package/typechain-types/index.ts +92 -38
- 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/IPendleGauge.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPendleGauge.json +0 -113
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IVePToken.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IVePToken.json +0 -43
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IVotingEscrowPendle.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/VotingEscrowController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/VotingEscrowController.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/interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.json +0 -167
- 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
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
|
|
4
|
+
import "../../interfaces/IPGaugeController.sol";
|
|
5
|
+
import "../../interfaces/IPVeToken.sol";
|
|
6
|
+
import "../../interfaces/ISuperComposableYield.sol";
|
|
7
|
+
import "../../libraries/RewardManager.sol";
|
|
8
|
+
import "../../libraries/math/Math.sol";
|
|
9
|
+
import "../../libraries/helpers/ArrayLib.sol";
|
|
10
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
11
|
+
|
|
12
|
+
abstract contract PendleGauge is RewardManager {
|
|
13
|
+
using Math for uint256;
|
|
14
|
+
using SafeERC20 for IERC20;
|
|
15
|
+
using ArrayLib for address[];
|
|
16
|
+
|
|
17
|
+
address private immutable SCY;
|
|
18
|
+
|
|
19
|
+
uint256 internal constant TOKENLESS_PRODUCTION = 40;
|
|
20
|
+
address internal immutable PENDLE;
|
|
21
|
+
|
|
22
|
+
IPVeToken public immutable vePENDLE;
|
|
23
|
+
address public immutable gaugeController;
|
|
24
|
+
|
|
25
|
+
uint256 public totalActiveSupply;
|
|
26
|
+
mapping(address => uint256) public activeBalance;
|
|
27
|
+
|
|
28
|
+
constructor(
|
|
29
|
+
address _SCY,
|
|
30
|
+
address _vePendle,
|
|
31
|
+
address _gaugeController
|
|
32
|
+
) {
|
|
33
|
+
SCY = _SCY;
|
|
34
|
+
vePENDLE = IPVeToken(_vePendle);
|
|
35
|
+
gaugeController = _gaugeController;
|
|
36
|
+
PENDLE = IPGaugeController(gaugeController).pendle();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @dev It is intended to have user's active balance updated when they try to redeem
|
|
41
|
+
*/
|
|
42
|
+
function _redeemRewards(address user) internal virtual returns (uint256[] memory) {
|
|
43
|
+
_updateAndDistributeRewards(user);
|
|
44
|
+
_updateUserActiveBalance(user);
|
|
45
|
+
return _doTransferOutRewards(user, user);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @dev since rewardShares will be modified after this function, it should update user reward beforehand
|
|
50
|
+
*/
|
|
51
|
+
function _updateUserActiveBalance(address user) internal virtual {
|
|
52
|
+
uint256 lpBalance = _stakedBalance(user);
|
|
53
|
+
uint256 veBoostedLpBalance = _calcVeBoostedLpBalance(user, lpBalance);
|
|
54
|
+
|
|
55
|
+
uint256 newActiveBalance = Math.min(veBoostedLpBalance, lpBalance);
|
|
56
|
+
|
|
57
|
+
totalActiveSupply = totalActiveSupply - activeBalance[user] + newActiveBalance;
|
|
58
|
+
activeBalance[user] = newActiveBalance;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function _calcVeBoostedLpBalance(address user, uint256 lpBalance)
|
|
62
|
+
internal
|
|
63
|
+
virtual
|
|
64
|
+
returns (uint256)
|
|
65
|
+
{
|
|
66
|
+
uint256 vePendleBalance = vePENDLE.balanceOf(user);
|
|
67
|
+
uint256 vePendleSupply = vePENDLE.totalSupplyCurrent();
|
|
68
|
+
// Inspired by Curve's Gauge
|
|
69
|
+
uint256 veBoostedLpBalance = (lpBalance * TOKENLESS_PRODUCTION) / 100;
|
|
70
|
+
if (vePendleSupply > 0) {
|
|
71
|
+
veBoostedLpBalance +=
|
|
72
|
+
(((_totalStaked() * vePendleBalance) / vePendleSupply) *
|
|
73
|
+
(100 - TOKENLESS_PRODUCTION)) /
|
|
74
|
+
100;
|
|
75
|
+
}
|
|
76
|
+
return veBoostedLpBalance;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function _redeemExternalReward() internal virtual override {
|
|
80
|
+
ISuperComposableYield(SCY).claimRewards(address(this));
|
|
81
|
+
IPGaugeController(gaugeController).claimMarketReward();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function _stakedBalance(address user) internal view virtual returns (uint256);
|
|
85
|
+
|
|
86
|
+
function _totalStaked() internal view virtual returns (uint256);
|
|
87
|
+
|
|
88
|
+
function _rewardSharesTotal() internal view virtual override returns (uint256) {
|
|
89
|
+
return totalActiveSupply;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function _rewardSharesUser(address user) internal view virtual override returns (uint256) {
|
|
93
|
+
return activeBalance[user];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function _getRewardTokens() internal view virtual override returns (address[] memory) {
|
|
97
|
+
address[] memory SCYRewards = ISuperComposableYield(SCY).getRewardTokens();
|
|
98
|
+
if (SCYRewards.contains(PENDLE)) return SCYRewards;
|
|
99
|
+
return SCYRewards.append(PENDLE);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function _beforeTokenTransfer(
|
|
103
|
+
address from,
|
|
104
|
+
address to,
|
|
105
|
+
uint256
|
|
106
|
+
) internal virtual {
|
|
107
|
+
_updateAndDistributeRewardsForTwo(from, to);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function _afterTokenTransfer(
|
|
111
|
+
address from,
|
|
112
|
+
address to,
|
|
113
|
+
uint256
|
|
114
|
+
) internal virtual {
|
|
115
|
+
if (from != address(0) && from != address(this)) _updateUserActiveBalance(from);
|
|
116
|
+
if (to != address(0) && to != address(this)) _updateUserActiveBalance(to);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# vePendle For Launch
|
|
2
|
+
|
|
3
|
+
### Locking PENDLE for vePendle (on ETH)
|
|
4
|
+
* Each user can only lock for a maximum of $MAXLOCKTIME$ = 2 years
|
|
5
|
+
* vePendle balance for users is represented by:
|
|
6
|
+
$balance_u(t) = bias_u - slope_u * t$
|
|
7
|
+
|
|
8
|
+
* As such, we just need to store $bias_u$ and $slope_u$ for each user. (Considerations: store $bias_u$ and $t_{expiry}$ for the user instead, because $t_{expiry}$ is always an exact number)
|
|
9
|
+
* The amount of PENDLE locked by user $u$ is $locked_u$
|
|
10
|
+
* For total supply, it's simply $totalBalance = totalBias - totalSlope * t$
|
|
11
|
+
* Possible actions by an user:
|
|
12
|
+
* User $u$ create a new lock by locking $d_{PENDLE}$ of PENDLE tokens, expiring at $t_{expiry}$
|
|
13
|
+
$slope_u = d_{PENDLE} / MAXLOCKTIME$
|
|
14
|
+
$bias_u = slope_u \cdot t_{expiry}$
|
|
15
|
+
* User $u$ locks an additional of $d_{PENDLE}$ PENDLE tokens, into his existing lock expiring at $t_{expiry}$
|
|
16
|
+
$slope_{u_{new}} = slope_u + d_{PENDLE} / MAXLOCKTIME$
|
|
17
|
+
$bias_{u_{new}} = slope_{u_{new}} \cdot t_{expiry}$
|
|
18
|
+
* User $u$ extends his expiry from $t_{expiry}$ to $t_{expiry_{new}}$
|
|
19
|
+
$bias_{u_{new}} = slope_{u} \cdot t_{expiry_{new}}$
|
|
20
|
+
|
|
21
|
+
* Similar to Curve:
|
|
22
|
+
* We store the checkpoints for when a user's $slope$ or $bias$ changes
|
|
23
|
+
* We restrict the possible expiries to exact weeks from UNIX timestamp 0
|
|
24
|
+
* We store the global bias and slope changes due to expiry of user's vote-locks per week, and process it when the week comes
|
|
25
|
+
|
|
26
|
+
### Cross-chain messaging module
|
|
27
|
+
* There are contracts inheritting `CelerSender` on governance chain - Ethereum, with a function `sendMessage(chain Y, sender, message)` to send messages to other chains.
|
|
28
|
+
* On each non-governance chain, we have contracts inheritting `CelerReceiver`. Each has a function `afterReceivingMessage(sender, message)` to receive the message from governance.
|
|
29
|
+
* When `sendMessage(chain Y, sender, message)` is called on governance chain, `afterReceivingMessage(sender, message)` will be called on chain Y, thanks to the cross-chain messaging module
|
|
30
|
+
* The current mechanics for the module is using Celer
|
|
31
|
+
* The cross-chain messaging module can be plugged in/plugged out by the governance address (which will initially be controlled by a team multisig)
|
|
32
|
+
|
|
33
|
+
### Voting for incentives on market and chains
|
|
34
|
+
* On Ethereum, there is a `VotingController` contract to control the voting on incentives for the different markets on the different chains.
|
|
35
|
+
* Adding a new chain:
|
|
36
|
+
* Only the governance address will be able to add markets and a new chains' GaugeController.
|
|
37
|
+
* There is a list of `(market)` that are elligible for the voting, added by governance
|
|
38
|
+
* markets that are expired will be removed by governance
|
|
39
|
+
* vePendle holders can allocate their vePendle to multiple markets on multiple chains
|
|
40
|
+
* Similar to Curve, we store the bias and slope of the total vePendle voted for every market
|
|
41
|
+
* Similary, we adjust the slope/bias changes due to expired vePendle at the weekly mark
|
|
42
|
+
* There is a global PENDLE per second rate for all the incentives across all the chains. This is set by governance.
|
|
43
|
+
* The `VotingController` does not hold any fund. The incentivizing PENDLE is transferred directly to GaugeController by governacne.
|
|
44
|
+
* GaugeControllers: admin can withdraw PENDLE from it
|
|
45
|
+
* In each chain, there is a `GaugeController` contract that is responsible for keeping PENDLE incentives and distributing PENDLE to incentivise different markets.
|
|
46
|
+
* At the finalization of each week (starting of new week), anyone can call a function `finalizeVotingResults` and then `broadcastVotes()` in `VotingController` to broadcast to any chain:
|
|
47
|
+
1. The PENDLE allocation of each market for the next week
|
|
48
|
+
2. The timestamp to mark which week is the incentivization coming from
|
|
49
|
+
When this happens, the `GaugeController` in each chain will update the PENDLE per second among the different markets
|
|
50
|
+
* At any time, the governacne has the voting power equivalent to locking X PENDLE in 2 years
|
|
51
|
+
|
|
52
|
+
### GaugeController
|
|
53
|
+
|
|
54
|
+
Gauge controller will receive the voting results from VotingController and incentivize the amount of PENDLE from `block.timestamp` to `block.timestamp + 1 WEEK`.
|
|
55
|
+
|
|
56
|
+
If there is still leftover reward in each pool, the gauge controller will remove and take the leftover to top up the incentivize for the current week.
|
|
57
|
+
|
|
58
|
+
### Gauge & Market
|
|
59
|
+
* The Gauge/Market will receive rewardTokens from SCY as well as claiming the PENDLE token from gauge controller. All of the reward tokens (including PENDLE) will be distributed with boosting mechanism
|
|
60
|
+
|
|
61
|
+
### Broadcasting vePendle balance & different address for boosting rewards for each chain
|
|
62
|
+
* At anytime, an address A could send a cross message to update the vePendle balance on a specific chain
|
|
63
|
+
* The governance reserves the right to set the vePENDLE delegator for some address (for other protocols to build on top).
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
|
|
4
|
+
import "./VotingControllerStorage.sol";
|
|
5
|
+
import "../CelerAbstracts/CelerSender.sol";
|
|
6
|
+
import "../../../libraries/VeBalanceLib.sol";
|
|
7
|
+
import "../../../libraries/math/Math.sol";
|
|
8
|
+
import "../../../interfaces/IPGaugeControllerMainchain.sol";
|
|
9
|
+
import "../../../interfaces/IPVotingController.sol";
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
Voting accounting:
|
|
13
|
+
- For gauge controller, it will consider each message from voting controller
|
|
14
|
+
as a pack of money to incentivize it during the very next WEEK (block.timestamp -> block.timestamp + WEEK)
|
|
15
|
+
- If the reward duration for the last pack of money has not ended, it will combine
|
|
16
|
+
the leftover reward with the current reward to distribute.
|
|
17
|
+
|
|
18
|
+
- In the very extreme case where no one broadcast the result of week x, and at week x+1,
|
|
19
|
+
the results for both are now broadcasted, then the WEEK of (block.timestamp -> WEEK)
|
|
20
|
+
will receive both of the reward pack
|
|
21
|
+
- Each pack of money will has it own id as timestamp, a gauge controller does not
|
|
22
|
+
receive a pack of money with the same id twice, this allow governance to rebroadcast
|
|
23
|
+
in case the last message was corrupted by Celer
|
|
24
|
+
|
|
25
|
+
Pros:
|
|
26
|
+
- If governance does not forget broadcasting the reward on the early of the week,
|
|
27
|
+
the mechanism works just the same as the epoch-based one
|
|
28
|
+
- If governance forget to broadcast the reward, the whole system still works normally,
|
|
29
|
+
the reward is still incentivized, but only approximately fair
|
|
30
|
+
Cons:
|
|
31
|
+
- Does not guarantee the reward will be distributed on epoch start and end
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
contract PendleVotingController is CelerSender, VotingControllerStorage, IPVotingController {
|
|
35
|
+
using VeBalanceLib for VeBalance;
|
|
36
|
+
using Math for uint256;
|
|
37
|
+
using Math for int256;
|
|
38
|
+
using EnumerableMap for EnumerableMap.UintToAddressMap;
|
|
39
|
+
using EnumerableSet for EnumerableSet.AddressSet;
|
|
40
|
+
|
|
41
|
+
constructor(address _vePendle, address _governanceManager)
|
|
42
|
+
VotingControllerStorage(_vePendle)
|
|
43
|
+
CelerSender(_governanceManager)
|
|
44
|
+
{}
|
|
45
|
+
|
|
46
|
+
/*///////////////////////////////////////////////////////////////
|
|
47
|
+
FUNCTIONS CAN BE CALLED BY ANYONE
|
|
48
|
+
//////////////////////////////////////////////////////////////*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @notice set a new voting weight for the target pool
|
|
52
|
+
* @dev pre-condition:
|
|
53
|
+
- pool must have been added before
|
|
54
|
+
- the vePENDLE position must still be active
|
|
55
|
+
* @dev state changes expected:
|
|
56
|
+
- update weekData (if any)
|
|
57
|
+
- update poolInfo, userData to reflect the new vote
|
|
58
|
+
- add 1 check point for both the unvote & new vote
|
|
59
|
+
* @dev vePENDLE position not expired is a must, else bias - t*slope < 0 & it will be
|
|
60
|
+
negative weight
|
|
61
|
+
*/
|
|
62
|
+
function vote(address pool, uint64 weight) external {
|
|
63
|
+
address user = msg.sender;
|
|
64
|
+
|
|
65
|
+
require(weight != 0, "zero weight");
|
|
66
|
+
require(_isPoolVotable(pool), "invalid pool");
|
|
67
|
+
require(!vePendle.isPositionExpired(user), "user position expired");
|
|
68
|
+
|
|
69
|
+
updatePoolVotes(pool);
|
|
70
|
+
_unvote(user, pool, false);
|
|
71
|
+
_vote(user, pool, weight);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @notice remove the vote from the current pool
|
|
76
|
+
* @dev no pre-condition as opposed to vote since this function is to clear the vote
|
|
77
|
+
* @dev allow removing vote from a non-votable pool BY not requiring pool to be votable
|
|
78
|
+
* @dev state changes expected:
|
|
79
|
+
- update weekData (if any)
|
|
80
|
+
- update poolInfo, userData to reflect the new vote
|
|
81
|
+
- add 1 check point for the unvote
|
|
82
|
+
*/
|
|
83
|
+
function unvote(address pool) external {
|
|
84
|
+
if (_isPoolVotable(pool)) {
|
|
85
|
+
updatePoolVotes(pool);
|
|
86
|
+
}
|
|
87
|
+
_unvote(msg.sender, pool, true);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @notice Process all the slopeChanges that haven't been processed & update these data into
|
|
92
|
+
poolInfo
|
|
93
|
+
* @dev pre-condition: the pool must be votable
|
|
94
|
+
* @dev state changes expected:
|
|
95
|
+
- update weekData
|
|
96
|
+
- update poolInfo
|
|
97
|
+
*/
|
|
98
|
+
function updatePoolVotes(address pool) public {
|
|
99
|
+
require(_isPoolVotable(pool), "invalid pool");
|
|
100
|
+
|
|
101
|
+
uint128 wTime = poolInfo[pool].lastUpdated;
|
|
102
|
+
uint128 currentWeekStart = WeekMath.getCurrentWeekStart();
|
|
103
|
+
|
|
104
|
+
// no state changes are expected
|
|
105
|
+
if (wTime >= currentWeekStart) return;
|
|
106
|
+
|
|
107
|
+
VeBalance memory currentVote = poolInfo[pool].vote;
|
|
108
|
+
while (wTime < currentWeekStart) {
|
|
109
|
+
wTime += WEEK;
|
|
110
|
+
currentVote = currentVote.sub(poolInfo[pool].slopeChanges[wTime], wTime);
|
|
111
|
+
_setFinalPoolVoteForWeek(pool, wTime, currentVote.getValueAt(wTime));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_setNewVotePoolInfo(pool, currentVote, wTime);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @notice finalize the voting results of all pools, up to the current epoch
|
|
119
|
+
* @dev state changes expected:
|
|
120
|
+
- weekData, poolInfo is updated for all pools in allPools
|
|
121
|
+
- isEpochFinalized is set to true for all epochs since the last time until now
|
|
122
|
+
* @dev this function might take a lot of gas, but can be mitigated by calling updatePoolVotes
|
|
123
|
+
separately, hence reduce the number of states to be updated
|
|
124
|
+
*/
|
|
125
|
+
function finalizeEpoch() public {
|
|
126
|
+
uint256 length = allPools.length();
|
|
127
|
+
for (uint256 i = 0; i < length; ++i) {
|
|
128
|
+
updatePoolVotes(allPools.at(i));
|
|
129
|
+
}
|
|
130
|
+
_setAllPastEpochsAsFinalized();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @notice broadcast the voting results of the current week to the chain with chainId. Can be
|
|
135
|
+
called by anyone
|
|
136
|
+
* @dev pre-condition: the epoch must have already been finalized by finalizeEpoch
|
|
137
|
+
* @dev state changes expected:
|
|
138
|
+
- the gaugeController receives the new pendle allocation
|
|
139
|
+
*/
|
|
140
|
+
function broadcastResults(uint64 chainId) external payable {
|
|
141
|
+
uint128 wTime = WeekMath.getCurrentWeekStart();
|
|
142
|
+
require(isEpochFinalized[wTime], "epoch not finalized");
|
|
143
|
+
_broadcastResults(chainId, wTime, pendlePerSec);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/*///////////////////////////////////////////////////////////////
|
|
147
|
+
GOVERNANCE-ONLY FUNCTIONS
|
|
148
|
+
//////////////////////////////////////////////////////////////*/
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @notice add a pool to allow users to vote. Can only be done by governance
|
|
152
|
+
* @dev pre-condition: pool must not have been added before
|
|
153
|
+
* @dev assumption: chainId is valid, pool does exist on the chain (guaranteed by gov)
|
|
154
|
+
* @dev state changes expected:
|
|
155
|
+
- add to allPools & chainPools
|
|
156
|
+
- set params in poolInfo
|
|
157
|
+
*/
|
|
158
|
+
function addPool(uint64 chainId, address pool) external onlyGovernance {
|
|
159
|
+
require(!_isPoolVotable(pool), "pool already added");
|
|
160
|
+
_addPool(chainId, pool);
|
|
161
|
+
emit AddPool(chainId, pool);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @notice remove a pool from voting. Can only be done by governance
|
|
166
|
+
* @dev pre-condition: pool must have been added before
|
|
167
|
+
* @dev state changes expected:
|
|
168
|
+
- update weekData (if any)
|
|
169
|
+
- remove from allPools & chainPools
|
|
170
|
+
- clear info in poolInfo
|
|
171
|
+
*/
|
|
172
|
+
function removePool(address pool) external onlyGovernance {
|
|
173
|
+
require(_isPoolVotable(pool), "invalid pool");
|
|
174
|
+
uint64 chainId = poolInfo[pool].chainId;
|
|
175
|
+
|
|
176
|
+
updatePoolVotes(pool);
|
|
177
|
+
_removePool(pool);
|
|
178
|
+
|
|
179
|
+
emit RemovePool(chainId, pool);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @notice use the gov-privilege to force broadcast a message in case there are issues with Celer
|
|
184
|
+
* @dev it's intentional for this function to have minimal checks since we assume gov has done the
|
|
185
|
+
due dilligence
|
|
186
|
+
* @dev gov should always call finalizeEpoch beforehand
|
|
187
|
+
* @dev state changes expected:
|
|
188
|
+
- the gaugeController receives the new pendle allocation
|
|
189
|
+
*/
|
|
190
|
+
function forceBroadcastResults(
|
|
191
|
+
uint64 chainId,
|
|
192
|
+
uint128 wTime,
|
|
193
|
+
uint128 forcedPendlePerSec
|
|
194
|
+
) external payable onlyGovernance {
|
|
195
|
+
_broadcastResults(chainId, wTime, forcedPendlePerSec);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @notice set new pendlePerSec
|
|
200
|
+
* @dev no zero checks because gov may want to stop liquidity mining
|
|
201
|
+
* @dev state changes expected: pendlePerSec is updated
|
|
202
|
+
*/
|
|
203
|
+
function setPendlePerSec(uint128 newPendlePerSec) external onlyGovernance {
|
|
204
|
+
pendlePerSec = newPendlePerSec;
|
|
205
|
+
emit SetPendlePerSec(newPendlePerSec);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/*///////////////////////////////////////////////////////////////
|
|
209
|
+
INTERNAL FUNCTIONS
|
|
210
|
+
//////////////////////////////////////////////////////////////*/
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @notice broadcast voting results of the timestamp to chainId
|
|
214
|
+
* @dev assumption: the epoch is already finalized, lastUpdated of all pools >= currentWeekTimestamp
|
|
215
|
+
* @dev state changes expected:
|
|
216
|
+
- the gaugeController receives the new pendle allocation
|
|
217
|
+
*/
|
|
218
|
+
function _broadcastResults(
|
|
219
|
+
uint64 chainId,
|
|
220
|
+
uint128 wTime,
|
|
221
|
+
uint128 totalPendlePerSec
|
|
222
|
+
) internal {
|
|
223
|
+
uint256 totalVotes = weekData[wTime].totalVotes;
|
|
224
|
+
if (totalVotes == 0) return;
|
|
225
|
+
|
|
226
|
+
uint256 length = chainPools[chainId].length();
|
|
227
|
+
if (length == 0) return;
|
|
228
|
+
|
|
229
|
+
address[] memory pools = chainPools[chainId].values();
|
|
230
|
+
uint256[] memory totalPendleAmounts = new uint256[](length);
|
|
231
|
+
|
|
232
|
+
for (uint256 i = 0; i < length; ++i) {
|
|
233
|
+
uint256 poolVotes = weekData[wTime].poolVotes[pools[i]];
|
|
234
|
+
uint256 pendlePerSec = (uint256(totalPendlePerSec) * poolVotes) / totalVotes;
|
|
235
|
+
totalPendleAmounts[i] = pendlePerSec * WEEK;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (chainId == block.chainid) {
|
|
239
|
+
address gaugeController = sidechainContracts.get(uint256(chainId));
|
|
240
|
+
IPGaugeControllerMainchain(gaugeController).updateVotingResults(
|
|
241
|
+
wTime,
|
|
242
|
+
pools,
|
|
243
|
+
totalPendleAmounts
|
|
244
|
+
);
|
|
245
|
+
} else {
|
|
246
|
+
_sendMessage(chainId, abi.encode(wTime, pools, totalPendleAmounts));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
emit BroadcastResults(chainId, wTime, totalPendlePerSec);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @notice remove the vote from the current pool
|
|
254
|
+
* @dev state changes expected:
|
|
255
|
+
- vote in poolInfo is cleared if the vote is still valid
|
|
256
|
+
- update UserData to remove the vote weight
|
|
257
|
+
- add a check-point if required
|
|
258
|
+
*/
|
|
259
|
+
function _unvote(
|
|
260
|
+
address user,
|
|
261
|
+
address pool,
|
|
262
|
+
bool doCreateCheckpoint
|
|
263
|
+
) internal {
|
|
264
|
+
VeBalance memory oldUVote = userData[user].voteForPools[pool].vote;
|
|
265
|
+
if (_isPoolVotable(pool) && _isVoteActive(oldUVote)) {
|
|
266
|
+
_subtractVotePoolInfo(pool, oldUVote);
|
|
267
|
+
}
|
|
268
|
+
_unsetVoteUserData(user, pool);
|
|
269
|
+
|
|
270
|
+
if (doCreateCheckpoint) {
|
|
271
|
+
_addUserPoolCheckpoint(user, pool, VeBalance(0, 0));
|
|
272
|
+
}
|
|
273
|
+
emit Unvote(user, pool, oldUVote);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @notice remove the vote from the current pool
|
|
278
|
+
* @dev there must not be any current vote on this pool by the user
|
|
279
|
+
* @dev state changes expected:
|
|
280
|
+
- vote in poolInfo is added
|
|
281
|
+
- update UserData to set the new vote weight
|
|
282
|
+
- add a check-point
|
|
283
|
+
*/
|
|
284
|
+
function _vote(
|
|
285
|
+
address user,
|
|
286
|
+
address pool,
|
|
287
|
+
uint64 weight
|
|
288
|
+
) internal {
|
|
289
|
+
VeBalance memory votingPower = _getVotingPowerByWeight(user, weight);
|
|
290
|
+
_addVotePoolInfo(pool, votingPower);
|
|
291
|
+
_setVoteUserData(user, pool, weight, votingPower);
|
|
292
|
+
_addUserPoolCheckpoint(user, pool, votingPower);
|
|
293
|
+
|
|
294
|
+
emit Vote(user, pool, weight, votingPower);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @notice return the corresponding voting power of an user given the weight. Basically his voting power
|
|
299
|
+
will be vePendle * weight / USER_VOTE_MAX_WEIGHT
|
|
300
|
+
* @notice governance will always has the vePendle equivalent to 1M PENDLE locked for MAX_LOCK_TIME
|
|
301
|
+
*/
|
|
302
|
+
function _getVotingPowerByWeight(address user, uint64 weight)
|
|
303
|
+
internal
|
|
304
|
+
view
|
|
305
|
+
virtual
|
|
306
|
+
returns (VeBalance memory res)
|
|
307
|
+
{
|
|
308
|
+
uint128 amount;
|
|
309
|
+
uint128 expiry;
|
|
310
|
+
|
|
311
|
+
if (user == _governance()) {
|
|
312
|
+
amount = GOVERNANCE_PENDLE_VOTE;
|
|
313
|
+
expiry = WeekMath.getWeekStartTimestamp(uint128(block.timestamp) + MAX_LOCK_TIME);
|
|
314
|
+
} else {
|
|
315
|
+
(amount, expiry) = vePendle.positionData(user);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
(res.bias, res.slope) = VeBalanceLib.convertToVeBalance(
|
|
319
|
+
uint128((uint256(amount) * weight) / USER_VOTE_MAX_WEIGHT),
|
|
320
|
+
expiry
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
}
|