@pendle/core-v2 0.11.11-testnet → 0.12.1-testnet
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/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +199 -30
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.json +1030 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.json +1025 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.json +948 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +76 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +140 -25
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.json +138 -23
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +138 -23
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +310 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/{CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.json → CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.json} +18 -85
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +336 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/{CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json → CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.json} +8 -21
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.json +131 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +297 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +376 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +11 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +29 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +40 -86
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +228 -40
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +232 -12
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +164 -47
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +25 -93
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +222 -9
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +106 -5
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- 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 +13 -2
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +87 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +80 -16
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +164 -2
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +172 -4
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +109 -2
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.json +57 -4
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.json +7 -2
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.json +199 -4
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.json +108 -2
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.json +146 -4
- package/build/artifacts/contracts/core/actions/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.json +177 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.json +78 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.json +24 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.json +264 -0
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +305 -0
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- 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/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.json +34 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +31 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +30 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.json +10 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +30 -0
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +101 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.json +112 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.json +76 -0
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.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 +13 -0
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.json +24 -0
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.json +63 -0
- 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/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +148 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPVotingEscrow.sol/IPVotingEscrow.json → IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.json} +88 -2
- 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/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +4 -28
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
- 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/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/Errors.sol/Errors.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/Errors.sol/Errors.json +886 -0
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.json +28 -2
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{solmate/SSTORE2.sol/SSTORE2.json → VeHistoryLib.sol/CheckpointHelper.json} +4 -4
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +45 -0
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/{SSTORE2Deployer.sol/SSTORE2Deployer.json → BaseSplitCodeFactory.sol/CodeDeployer.json} +4 -4
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
- package/build/artifacts/contracts/libraries/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.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 +1 -1
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +167 -0
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +182 -4
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +142 -66
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +3 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +19 -16
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol +135 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol +96 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol +215 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol +83 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +10 -15
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +30 -43
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +74 -0
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +38 -0
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +83 -0
- package/contracts/core/LiquidityMining/{CelerAbstracts/CelerSenderUpg.sol → CrossChainMsg/PendleMsgSenderAppUpg.sol} +12 -13
- package/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol +159 -0
- package/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol +96 -0
- package/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol +68 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +4 -3
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +6 -2
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +12 -4
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +29 -19
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +27 -19
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +63 -27
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +6 -5
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +2 -2
- package/contracts/core/Market/PendleMarket.sol +26 -24
- package/contracts/core/Market/PendleMarketFactory.sol +41 -20
- package/contracts/core/PendleERC20Permit.sol +84 -0
- package/contracts/core/PendleRouter.sol +2 -1
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +8 -7
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +37 -22
- package/contracts/core/YieldContracts/PendleYieldToken.sol +106 -35
- package/contracts/core/actions/ActionAddRemoveLiq.sol +58 -41
- package/contracts/core/actions/ActionCallback.sol +24 -14
- package/contracts/core/actions/ActionMintRedeem.sol +11 -5
- package/contracts/core/actions/ActionMisc.sol +2 -1
- package/contracts/core/actions/ActionSwapPT.sol +38 -19
- package/contracts/core/actions/ActionSwapPTYT.sol +7 -6
- package/contracts/core/actions/ActionSwapYT.sol +36 -19
- package/contracts/core/actions/base/ActionBaseMintRedeem.sol +15 -8
- package/contracts/interfaces/ConvexCurve/IBooster.sol +32 -0
- package/contracts/interfaces/ConvexCurve/ICrvDepositor.sol +20 -0
- package/contracts/interfaces/ConvexCurve/ICvxCrv.sol +6 -0
- package/contracts/interfaces/ConvexCurve/IRewards.sol +38 -0
- package/contracts/interfaces/Curve/ICrvPool.sol +69 -0
- package/contracts/interfaces/IBoringOwnableUpgradeable.sol +10 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +7 -7
- package/contracts/interfaces/IPActionSwapPT.sol +6 -6
- package/contracts/interfaces/IPActionSwapPTYT.sol +2 -2
- package/contracts/interfaces/IPActionSwapYT.sol +13 -13
- package/contracts/interfaces/IPFeeDistributor.sol +19 -0
- package/contracts/interfaces/IPFeeDistributorFactory.sol +14 -0
- package/contracts/interfaces/IPMarket.sol +2 -0
- package/contracts/interfaces/IPMsgReceiverApp.sol +7 -0
- package/contracts/interfaces/IPMsgSendEndpoint.sol +17 -0
- package/contracts/interfaces/IPVotingController.sol +22 -0
- package/contracts/interfaces/{IPVotingEscrow.sol → IPVotingEscrowMainchain.sol} +11 -1
- package/contracts/interfaces/ISuperComposableYield.sol +2 -7
- package/contracts/libraries/Errors.sol +121 -0
- package/contracts/libraries/OracleLib.sol +6 -3
- package/contracts/libraries/VeBalanceLib.sol +5 -1
- package/contracts/libraries/VeHistoryLib.sol +20 -31
- package/contracts/libraries/helpers/ArrayLib.sol +0 -17
- package/contracts/libraries/helpers/BaseSplitCodeFactory.sol +288 -0
- package/contracts/libraries/helpers/TokenHelper.sol +4 -0
- package/contracts/libraries/kyberswap/AggregationRouterHelper.sol +0 -7
- package/contracts/libraries/math/MarketMathCore.sol +29 -25
- package/contracts/libraries/math/Math.sol +6 -2
- package/contracts/libraries/math/WeekMath.sol +2 -2
- package/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol +43 -0
- package/contracts/offchain-helpers/MarketMathStatic.sol +36 -36
- package/contracts/offchain-helpers/RouterStatic.sol +53 -37
- package/deployments/43113-core.json +11 -10
- package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
- package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
- package/deployments/43113-testenv.json +9 -9
- package/deployments/80001-core.json +10 -9
- package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
- package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
- package/deployments/80001-testenv.json +16 -16
- package/package.json +1 -1
- package/typechain-types/ActionAddRemoveLiq.ts +18 -6
- package/typechain-types/ActionSwapPT.ts +18 -6
- package/typechain-types/ActionSwapPTYT.ts +6 -2
- package/typechain-types/ActionSwapYT.ts +18 -6
- package/typechain-types/IPActionAddRemoveLiq.ts +19 -7
- package/typechain-types/IPActionSwapPT.ts +18 -6
- package/typechain-types/IPActionSwapPTYT.ts +6 -2
- package/typechain-types/IPActionSwapYT.ts +18 -6
- package/typechain-types/IPAllAction.ts +61 -21
- package/typechain-types/IPBatchSeller.ts +19 -37
- package/typechain-types/IPMarket.ts +13 -0
- package/typechain-types/IPVotingController.ts +244 -7
- package/typechain-types/ISuperComposableYield.ts +7 -46
- package/typechain-types/MarketMathStatic.ts +139 -10
- package/typechain-types/PendleBatchSeller.ts +72 -50
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +28 -149
- package/typechain-types/PendleMarket.ts +104 -0
- package/typechain-types/PendleMarketFactory.ts +76 -13
- package/typechain-types/PendlePrincipalToken.ts +104 -0
- package/typechain-types/PendleQiTokenSCY.ts +111 -46
- package/typechain-types/PendleVotingControllerUpg.ts +133 -77
- package/typechain-types/PendleWstEthSCY.ts +111 -46
- package/typechain-types/PendleYieldContractFactory.ts +84 -21
- package/typechain-types/PendleYieldToken.ts +175 -0
- package/typechain-types/RouterStatic.ts +136 -67
- package/typechain-types/SCYBase.ts +111 -46
- package/typechain-types/SCYBaseWithRewards.ts +111 -46
- package/typechain-types/VotingControllerStorageUpg.ts +246 -27
- package/typechain-types/VotingEscrowPendleMainchain.ts +81 -93
- package/typechain-types/VotingEscrowPendleSidechain.ts +26 -171
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +169 -1
- package/typechain-types/factories/ActionCallback__factory.ts +108 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +54 -1
- package/typechain-types/factories/ActionMisc__factory.ts +6 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +107 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +196 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +143 -1
- package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +31 -1
- package/typechain-types/factories/IPActionSwapPTYT__factory.ts +10 -0
- package/typechain-types/factories/IPActionSwapPT__factory.ts +30 -0
- package/typechain-types/factories/IPActionSwapYT__factory.ts +30 -0
- package/typechain-types/factories/IPAllAction__factory.ts +101 -1
- package/typechain-types/factories/IPBatchSeller__factory.ts +4 -10
- package/typechain-types/factories/IPMarket__factory.ts +13 -0
- package/typechain-types/factories/IPVotingController__factory.ts +148 -0
- package/typechain-types/factories/ISuperComposableYield__factory.ts +4 -28
- package/typechain-types/factories/MarketMathStatic__factory.ts +181 -3
- package/typechain-types/factories/OracleLib__factory.ts +27 -1
- package/typechain-types/factories/Pendle3CrvAndTokenSCY__factory.ts +1 -1
- package/typechain-types/factories/Pendle3CrvHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleBatchSeller__factory.ts +40 -118
- package/typechain-types/factories/PendleConvexCurveLP2PoolSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +11 -0
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +28 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +48 -86
- package/typechain-types/factories/PendleMarketFactory__factory.ts +129 -9
- package/typechain-types/factories/PendleMarket__factory.ts +214 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +86 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +198 -29
- package/typechain-types/factories/PendleRouter__factory.ts +12 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +235 -40
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +137 -22
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +103 -20
- package/typechain-types/factories/PendleYieldToken__factory.ts +163 -1
- package/typechain-types/factories/PtAMMArb__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +95 -19
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +136 -21
- package/typechain-types/factories/SCYBase__factory.ts +136 -21
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +232 -12
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +171 -47
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +31 -93
- package/typechain-types/hardhat.d.ts +393 -114
- package/typechain-types/index.ts +36 -66
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +0 -810
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.json +0 -10
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +0 -833
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +0 -723
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +0 -728
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +0 -705
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.json +0 -864
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.json +0 -718
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +0 -784
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.json +0 -134
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +0 -161
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol +0 -126
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +0 -242
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +0 -146
- package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +0 -176
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +0 -129
- package/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol +0 -193
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol +0 -155
- package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +0 -182
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol +0 -53
- package/contracts/libraries/helpers/SSTORE2Deployer.sol +0 -30
- package/contracts/libraries/solmate/SSTORE2.sol +0 -99
- package/contracts/offchain-helpers/SSTORE2DeployerContract.sol +0 -21
- package/deployments/43113-markets/benqi-market-10D931.json +0 -8
- package/deployments/43113-markets/benqi-market-9fbD64.json +0 -8
- package/deployments/43113-markets/benqi-market-A12361.json +0 -8
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
|
|
4
|
+
import "../../../libraries/math/Math.sol";
|
|
5
|
+
import "../../../libraries/helpers/ArrayLib.sol";
|
|
6
|
+
import "../../../libraries/helpers/MiniHelpers.sol";
|
|
7
|
+
import "../../../libraries/math/WeekMath.sol";
|
|
8
|
+
import "../../../libraries/Errors.sol";
|
|
9
|
+
import "../../../libraries/VeHistoryLib.sol";
|
|
10
|
+
import "../../../interfaces/IPFeeDistributor.sol";
|
|
11
|
+
import "../../../interfaces/IPFeeDistributorFactory.sol";
|
|
12
|
+
import "../../../periphery/BoringOwnableUpgradeable.sol";
|
|
13
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
14
|
+
|
|
15
|
+
contract PendleFeeDistributor is IPFeeDistributor, BoringOwnableUpgradeable {
|
|
16
|
+
using Math for uint256;
|
|
17
|
+
using SafeERC20 for IERC20;
|
|
18
|
+
using ArrayLib for address[];
|
|
19
|
+
using VeBalanceLib for VeBalance;
|
|
20
|
+
|
|
21
|
+
address public immutable factory;
|
|
22
|
+
address public immutable pool;
|
|
23
|
+
address public immutable rewardToken;
|
|
24
|
+
uint256 public immutable startEpoch;
|
|
25
|
+
|
|
26
|
+
uint256 public lastFinishedEpoch;
|
|
27
|
+
|
|
28
|
+
// [user] => [epoch]
|
|
29
|
+
mapping(address => uint256) public userLastClaimedEpoch;
|
|
30
|
+
|
|
31
|
+
// [epoch] => [incentive]
|
|
32
|
+
mapping(uint256 => uint256) public incentivesForEpoch;
|
|
33
|
+
|
|
34
|
+
constructor(
|
|
35
|
+
address _pool,
|
|
36
|
+
address _rewardToken,
|
|
37
|
+
uint256 _startEpoch
|
|
38
|
+
) initializer {
|
|
39
|
+
pool = _pool;
|
|
40
|
+
factory = msg.sender;
|
|
41
|
+
rewardToken = _rewardToken;
|
|
42
|
+
startEpoch = _startEpoch;
|
|
43
|
+
lastFinishedEpoch = _startEpoch;
|
|
44
|
+
__BoringOwnable_init();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function fund(uint256[] calldata rewardsForEpoch) external onlyOwner {
|
|
48
|
+
uint256 epoch = lastFinishedEpoch;
|
|
49
|
+
uint256 totalRewardFunding = 0;
|
|
50
|
+
for (uint256 i = 0; i < rewardsForEpoch.length; ++i) {
|
|
51
|
+
epoch += WeekMath.WEEK;
|
|
52
|
+
uint256 incentive = rewardsForEpoch[i];
|
|
53
|
+
|
|
54
|
+
incentivesForEpoch[epoch] += incentive;
|
|
55
|
+
totalRewardFunding += incentive;
|
|
56
|
+
|
|
57
|
+
emit Fund(epoch, incentive);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (epoch > WeekMath.getCurrentWeekStart()) revert Errors.FDCantFundFutureEpoch();
|
|
61
|
+
|
|
62
|
+
IERC20(rewardToken).transferFrom(msg.sender, address(this), totalRewardFunding);
|
|
63
|
+
lastFinishedEpoch = epoch;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function claimReward(address user) external returns (uint256 amountRewardOut) {
|
|
67
|
+
IPFeeDistributorFactory(factory).updateUserShare(user, pool);
|
|
68
|
+
|
|
69
|
+
uint256 finishedEpoch = lastFinishedEpoch;
|
|
70
|
+
uint256 userEpoch = userLastClaimedEpoch[user];
|
|
71
|
+
|
|
72
|
+
if (userEpoch == finishedEpoch) return 0;
|
|
73
|
+
if (userEpoch == 0) userEpoch = startEpoch;
|
|
74
|
+
|
|
75
|
+
while (userEpoch < finishedEpoch) {
|
|
76
|
+
userEpoch += WeekMath.WEEK;
|
|
77
|
+
|
|
78
|
+
uint256 incentive = incentivesForEpoch[userEpoch];
|
|
79
|
+
if (incentive == 0) continue;
|
|
80
|
+
|
|
81
|
+
(uint256 userShare, uint256 totalShare) = IPFeeDistributorFactory(factory)
|
|
82
|
+
.getUserAndTotalSharesAt(user, pool, userEpoch);
|
|
83
|
+
|
|
84
|
+
if (userShare == 0) continue;
|
|
85
|
+
|
|
86
|
+
amountRewardOut += (userShare * incentive) / totalShare;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
userLastClaimedEpoch[user] = finishedEpoch;
|
|
90
|
+
if (amountRewardOut > 0) {
|
|
91
|
+
IERC20(rewardToken).safeTransfer(user, amountRewardOut);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
emit ClaimReward(user, rewardToken, finishedEpoch, amountRewardOut);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
|
|
4
|
+
import "./PendleFeeDistributor.sol";
|
|
5
|
+
import "./EpochResultManager.sol";
|
|
6
|
+
import "../../../libraries/helpers/BaseSplitCodeFactory.sol";
|
|
7
|
+
import "../../../interfaces/IBoringOwnableUpgradeable.sol";
|
|
8
|
+
import "../../../interfaces/IPFeeDistributorFactory.sol";
|
|
9
|
+
|
|
10
|
+
contract PendleFeeDistributorFactory is BoringOwnableUpgradeable, EpochResultManager {
|
|
11
|
+
using Math for uint256;
|
|
12
|
+
|
|
13
|
+
struct PoolInfo {
|
|
14
|
+
address distributor;
|
|
15
|
+
uint64 startTime;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
address public immutable feeDistributorCreationCodeContractA;
|
|
19
|
+
uint256 public immutable feeDistributorCreationCodeSizeA;
|
|
20
|
+
address public immutable feeDistributorCreationCodeContractB;
|
|
21
|
+
uint256 public immutable feeDistributorCreationCodeSizeB;
|
|
22
|
+
|
|
23
|
+
address public immutable rewardToken;
|
|
24
|
+
uint256 public lastFinishedEpoch;
|
|
25
|
+
mapping(address => PoolInfo) public poolInfos;
|
|
26
|
+
|
|
27
|
+
constructor(
|
|
28
|
+
address _rewardToken,
|
|
29
|
+
address _votingController,
|
|
30
|
+
address _vePendle,
|
|
31
|
+
address _feeDistributorCreationCodeContractA,
|
|
32
|
+
uint256 _feeDistributorCreationCodeSizeA,
|
|
33
|
+
address _feeDistributorCreationCodeContractB,
|
|
34
|
+
uint256 _feeDistributorCreationCodeSizeB
|
|
35
|
+
) EpochResultManager(_votingController, _vePendle) initializer {
|
|
36
|
+
__BoringOwnable_init();
|
|
37
|
+
rewardToken = _rewardToken;
|
|
38
|
+
feeDistributorCreationCodeContractA = _feeDistributorCreationCodeContractA;
|
|
39
|
+
feeDistributorCreationCodeSizeA = _feeDistributorCreationCodeSizeA;
|
|
40
|
+
feeDistributorCreationCodeContractB = _feeDistributorCreationCodeContractB;
|
|
41
|
+
feeDistributorCreationCodeSizeB = _feeDistributorCreationCodeSizeB;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function createFeeDistributor(address pool, uint64 startTime)
|
|
45
|
+
external
|
|
46
|
+
onlyOwner
|
|
47
|
+
returns (address distributor)
|
|
48
|
+
{
|
|
49
|
+
if (poolInfos[pool].distributor != address(0))
|
|
50
|
+
revert Errors.FDFactoryDistributorAlreadyExisted(pool, poolInfos[pool].distributor);
|
|
51
|
+
|
|
52
|
+
distributor = BaseSplitCodeFactory._create2(
|
|
53
|
+
0,
|
|
54
|
+
bytes32(""),
|
|
55
|
+
abi.encode(pool, rewardToken, uint256(startTime)),
|
|
56
|
+
feeDistributorCreationCodeContractA,
|
|
57
|
+
feeDistributorCreationCodeSizeA,
|
|
58
|
+
feeDistributorCreationCodeContractB,
|
|
59
|
+
feeDistributorCreationCodeSizeB
|
|
60
|
+
);
|
|
61
|
+
IBoringOwnableUpgradeable(distributor).transferOwnership(msg.sender, true, false);
|
|
62
|
+
poolInfos[pool] = PoolInfo({ distributor: distributor, startTime: startTime });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function _getPoolStartTime(address pool) internal view virtual override returns (uint64) {
|
|
66
|
+
return poolInfos[pool].startTime;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -5,6 +5,7 @@ import "../../../interfaces/IPGaugeController.sol";
|
|
|
5
5
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
6
6
|
import "../../../libraries/math/Math.sol";
|
|
7
7
|
import "../../../libraries/math/WeekMath.sol";
|
|
8
|
+
import "../../../libraries/Errors.sol";
|
|
8
9
|
import "../../../interfaces/IPGaugeController.sol";
|
|
9
10
|
import "../../../interfaces/IPMarketFactory.sol";
|
|
10
11
|
import "../../../interfaces/IPMarket.sol";
|
|
@@ -35,7 +36,7 @@ abstract contract PendleGaugeControllerBaseUpg is IPGaugeController, BoringOwnab
|
|
|
35
36
|
uint128 incentiveEndsAt;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
uint128 internal constant WEEK = 1
|
|
39
|
+
uint128 internal constant WEEK = 1 days;
|
|
39
40
|
|
|
40
41
|
address public immutable pendle;
|
|
41
42
|
IPMarketFactory public immutable marketFactory;
|
|
@@ -46,7 +47,7 @@ abstract contract PendleGaugeControllerBaseUpg is IPGaugeController, BoringOwnab
|
|
|
46
47
|
uint256[100] private __gap;
|
|
47
48
|
|
|
48
49
|
modifier onlyPendleMarket() {
|
|
49
|
-
|
|
50
|
+
if (!marketFactory.isValidMarket(msg.sender)) revert Errors.GCNotPendleMarket(msg.sender);
|
|
50
51
|
_;
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -95,7 +96,7 @@ abstract contract PendleGaugeControllerBaseUpg is IPGaugeController, BoringOwnab
|
|
|
95
96
|
address[] memory markets,
|
|
96
97
|
uint256[] memory pendleAmounts
|
|
97
98
|
) internal {
|
|
98
|
-
|
|
99
|
+
if (markets.length != pendleAmounts.length) revert Errors.ArrayLengthMismatch();
|
|
99
100
|
|
|
100
101
|
if (epochRewardReceived[wTime]) return; // only accept the first message for the wTime
|
|
101
102
|
epochRewardReceived[wTime] = true;
|
package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol
CHANGED
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
pragma solidity 0.8.15;
|
|
3
3
|
|
|
4
4
|
import "./PendleGaugeControllerBaseUpg.sol";
|
|
5
|
+
import "../../../interfaces/IPGaugeControllerMainchain.sol";
|
|
5
6
|
|
|
6
7
|
/// This contract is upgradable because
|
|
7
8
|
/// - its constructor only sets immutable variables
|
|
8
9
|
/// - it inherits only upgradable contract
|
|
9
|
-
contract PendleGaugeControllerMainchainUpg is
|
|
10
|
+
contract PendleGaugeControllerMainchainUpg is
|
|
11
|
+
PendleGaugeControllerBaseUpg,
|
|
12
|
+
IPGaugeControllerMainchain
|
|
13
|
+
{
|
|
10
14
|
address public immutable votingController;
|
|
11
15
|
|
|
12
16
|
modifier onlyVotingController() {
|
|
13
|
-
|
|
17
|
+
if (msg.sender != votingController) revert Errors.GCNotVotingController(msg.sender);
|
|
14
18
|
_;
|
|
15
19
|
}
|
|
16
20
|
|
package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol
CHANGED
|
@@ -2,18 +2,26 @@
|
|
|
2
2
|
pragma solidity 0.8.15;
|
|
3
3
|
|
|
4
4
|
import "./PendleGaugeControllerBaseUpg.sol";
|
|
5
|
-
import "../
|
|
5
|
+
import "../CrossChainMsg/PendleMsgReceiverAppUpg.sol";
|
|
6
6
|
|
|
7
7
|
// solhint-disable no-empty-blocks
|
|
8
8
|
|
|
9
9
|
/// This contract is upgradable because
|
|
10
10
|
/// - its constructor only sets immutable variables
|
|
11
11
|
/// - it inherits only upgradable contract
|
|
12
|
-
contract PendleGaugeControllerSidechainUpg is
|
|
12
|
+
contract PendleGaugeControllerSidechainUpg is
|
|
13
|
+
PendleGaugeControllerBaseUpg,
|
|
14
|
+
PendleMsgReceiverAppUpg
|
|
15
|
+
{
|
|
13
16
|
constructor(
|
|
14
17
|
address _pendle,
|
|
15
|
-
address _marketFactory
|
|
16
|
-
|
|
18
|
+
address _marketFactory,
|
|
19
|
+
address _PendleMsgReceiveEndpointUpg
|
|
20
|
+
)
|
|
21
|
+
PendleGaugeControllerBaseUpg(_pendle, _marketFactory)
|
|
22
|
+
PendleMsgReceiverAppUpg(_PendleMsgReceiveEndpointUpg)
|
|
23
|
+
initializer
|
|
24
|
+
{}
|
|
17
25
|
|
|
18
26
|
function initialize() external initializer {
|
|
19
27
|
__BoringOwnable_init();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
pragma solidity 0.8.15;
|
|
3
3
|
|
|
4
4
|
import "./VotingControllerStorageUpg.sol";
|
|
5
|
-
import "../
|
|
5
|
+
import "../CrossChainMsg/PendleMsgSenderAppUpg.sol";
|
|
6
6
|
import "../../../libraries/VeBalanceLib.sol";
|
|
7
7
|
import "../../../libraries/math/Math.sol";
|
|
8
8
|
import "../../../interfaces/IPGaugeControllerMainchain.sol";
|
|
@@ -37,10 +37,9 @@ Cons:
|
|
|
37
37
|
/// - it has storage gaps for safe addition of future variables
|
|
38
38
|
/// - it inherits only upgradable contract
|
|
39
39
|
contract PendleVotingControllerUpg is
|
|
40
|
-
|
|
40
|
+
PendleMsgSenderAppUpg,
|
|
41
41
|
VotingControllerStorageUpg,
|
|
42
|
-
UUPSUpgradeable
|
|
43
|
-
IPVotingController
|
|
42
|
+
UUPSUpgradeable
|
|
44
43
|
{
|
|
45
44
|
using VeBalanceLib for VeBalance;
|
|
46
45
|
using Math for uint256;
|
|
@@ -48,10 +47,14 @@ contract PendleVotingControllerUpg is
|
|
|
48
47
|
using EnumerableMap for EnumerableMap.UintToAddressMap;
|
|
49
48
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
50
49
|
|
|
51
|
-
constructor(address _vePendle)
|
|
52
|
-
VotingControllerStorageUpg(_vePendle)
|
|
50
|
+
constructor(address _vePendle, address _pendleMsgSendEndpoint)
|
|
51
|
+
VotingControllerStorageUpg(_vePendle)
|
|
52
|
+
PendleMsgSenderAppUpg(_pendleMsgSendEndpoint) // constructor only set immutable variables
|
|
53
53
|
initializer
|
|
54
|
-
|
|
54
|
+
//solhint-disable-next-line
|
|
55
|
+
{
|
|
56
|
+
|
|
57
|
+
}
|
|
55
58
|
|
|
56
59
|
function initialize() external initializer {
|
|
57
60
|
__BoringOwnable_init();
|
|
@@ -72,8 +75,8 @@ contract PendleVotingControllerUpg is
|
|
|
72
75
|
function vote(address[] calldata pools, uint64[] calldata weights) external {
|
|
73
76
|
address user = msg.sender;
|
|
74
77
|
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
if (pools.length != weights.length) revert Errors.ArrayLengthMismatch();
|
|
79
|
+
if (user != owner && vePendle.balanceOf(user) == 0) revert Errors.VCZeroVePendle(user);
|
|
77
80
|
|
|
78
81
|
UserData storage uData = userData[user];
|
|
79
82
|
LockedPosition memory userPosition = _getUserVePendlePosition(user);
|
|
@@ -84,10 +87,11 @@ contract PendleVotingControllerUpg is
|
|
|
84
87
|
emit Vote(user, pools[i], weights[i], newVote);
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
if (uData.totalVotedWeight > VeBalanceLib.USER_VOTE_MAX_WEIGHT)
|
|
91
|
+
revert Errors.VCExceededMaxWeight(
|
|
92
|
+
uData.totalVotedWeight,
|
|
93
|
+
VeBalanceLib.USER_VOTE_MAX_WEIGHT
|
|
94
|
+
);
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
/**
|
|
@@ -99,7 +103,7 @@ contract PendleVotingControllerUpg is
|
|
|
99
103
|
- update poolData
|
|
100
104
|
*/
|
|
101
105
|
function applyPoolSlopeChanges(address pool) public {
|
|
102
|
-
|
|
106
|
+
if (!_isPoolActive(pool)) revert Errors.VCInactivePool(pool);
|
|
103
107
|
|
|
104
108
|
uint128 wTime = poolData[pool].lastSlopeChangeAppliedAt;
|
|
105
109
|
uint128 currentWeekStart = WeekMath.getCurrentWeekStart();
|
|
@@ -143,7 +147,7 @@ contract PendleVotingControllerUpg is
|
|
|
143
147
|
*/
|
|
144
148
|
function broadcastResults(uint64 chainId) external payable refundUnusedEth {
|
|
145
149
|
uint128 wTime = WeekMath.getCurrentWeekStart();
|
|
146
|
-
|
|
150
|
+
if (!weekData[wTime].isEpochFinalized) revert Errors.VCEpochNotFinalized(wTime);
|
|
147
151
|
_broadcastResults(chainId, wTime, pendlePerSec);
|
|
148
152
|
}
|
|
149
153
|
|
|
@@ -162,8 +166,8 @@ contract PendleVotingControllerUpg is
|
|
|
162
166
|
this function
|
|
163
167
|
*/
|
|
164
168
|
function addPool(uint64 chainId, address pool) external onlyOwner {
|
|
165
|
-
|
|
166
|
-
|
|
169
|
+
if (_isPoolActive(pool)) revert Errors.VCPoolAlreadyActive(pool);
|
|
170
|
+
if (allRemovedPools.contains(pool)) revert Errors.VCPoolAlreadyAddAndRemoved(pool);
|
|
167
171
|
|
|
168
172
|
_addPool(chainId, pool);
|
|
169
173
|
emit AddPool(chainId, pool);
|
|
@@ -180,7 +184,7 @@ contract PendleVotingControllerUpg is
|
|
|
180
184
|
this function
|
|
181
185
|
*/
|
|
182
186
|
function removePool(address pool) external onlyOwner {
|
|
183
|
-
|
|
187
|
+
if (!_isPoolActive(pool)) revert Errors.VCInactivePool(pool);
|
|
184
188
|
|
|
185
189
|
uint64 chainId = poolData[pool].chainId;
|
|
186
190
|
|
|
@@ -227,7 +231,12 @@ contract PendleVotingControllerUpg is
|
|
|
227
231
|
address[] memory pools = new address[](length);
|
|
228
232
|
uint256[] memory totalPendleAmounts = new uint256[](length);
|
|
229
233
|
|
|
230
|
-
return
|
|
234
|
+
return
|
|
235
|
+
pendleMsgSendEndpoint.calcFee(
|
|
236
|
+
destinationContracts.get(chainId),
|
|
237
|
+
chainId,
|
|
238
|
+
abi.encode(uint128(0), pools, totalPendleAmounts)
|
|
239
|
+
);
|
|
231
240
|
}
|
|
232
241
|
|
|
233
242
|
/*///////////////////////////////////////////////////////////////
|
|
@@ -288,5 +297,6 @@ contract PendleVotingControllerUpg is
|
|
|
288
297
|
}
|
|
289
298
|
}
|
|
290
299
|
|
|
300
|
+
//solhint-disable-next-line
|
|
291
301
|
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
|
292
302
|
}
|
|
@@ -6,13 +6,15 @@ import "../../../libraries/VeBalanceLib.sol";
|
|
|
6
6
|
import "../../../libraries/math/WeekMath.sol";
|
|
7
7
|
import "../../../libraries/helpers/MiniHelpers.sol";
|
|
8
8
|
import "../../../libraries/VeHistoryLib.sol";
|
|
9
|
+
import "../../../libraries/Errors.sol";
|
|
10
|
+
import "../../../interfaces/IPVotingController.sol";
|
|
9
11
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
10
12
|
|
|
11
13
|
/// This contract is upgradable because
|
|
12
14
|
/// - its constructor only sets immutable variables
|
|
13
15
|
/// - it has storage gaps for safe addition of future variables
|
|
14
16
|
/// - it inherits only upgradable contract
|
|
15
|
-
abstract contract VotingControllerStorageUpg {
|
|
17
|
+
abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
16
18
|
using VeBalanceLib for VeBalance;
|
|
17
19
|
using VeBalanceLib for LockedPosition;
|
|
18
20
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
@@ -44,7 +46,7 @@ abstract contract VotingControllerStorageUpg {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
uint128 public constant MAX_LOCK_TIME = 104 weeks;
|
|
47
|
-
uint128 public constant WEEK = 1
|
|
49
|
+
uint128 public constant WEEK = 1 days;
|
|
48
50
|
uint128 public constant GOVERNANCE_PENDLE_VOTE = 10**24;
|
|
49
51
|
|
|
50
52
|
IPVeToken public immutable vePendle;
|
|
@@ -83,6 +85,10 @@ abstract contract VotingControllerStorageUpg {
|
|
|
83
85
|
VIEW FUNCTIONS
|
|
84
86
|
//////////////////////////////////////////////////////////////*/
|
|
85
87
|
|
|
88
|
+
function getPoolTotalVoteAt(address pool, uint128 wTime) public view returns (uint128) {
|
|
89
|
+
return weekData[wTime].poolVotes[pool];
|
|
90
|
+
}
|
|
91
|
+
|
|
86
92
|
function getPoolData(address pool, uint128[] calldata wTimes)
|
|
87
93
|
public
|
|
88
94
|
view
|
|
@@ -102,7 +108,7 @@ abstract contract VotingControllerStorageUpg {
|
|
|
102
108
|
|
|
103
109
|
slopeChanges = new uint128[](wTimes.length);
|
|
104
110
|
for (uint256 i = 0; i < wTimes.length; ++i) {
|
|
105
|
-
|
|
111
|
+
if (!wTimes[i].isValidWTime()) revert Errors.InvalidWTime(wTimes[i]);
|
|
106
112
|
slopeChanges[i] = data.slopeChanges[wTimes[i]];
|
|
107
113
|
}
|
|
108
114
|
}
|
|
@@ -129,7 +135,7 @@ abstract contract VotingControllerStorageUpg {
|
|
|
129
135
|
uint128[] memory poolVotes
|
|
130
136
|
)
|
|
131
137
|
{
|
|
132
|
-
|
|
138
|
+
if (!wTime.isValidWTime()) revert Errors.InvalidWTime(wTime);
|
|
133
139
|
|
|
134
140
|
WeekData storage data = weekData[wTime];
|
|
135
141
|
|
|
@@ -151,7 +157,9 @@ abstract contract VotingControllerStorageUpg {
|
|
|
151
157
|
returns (uint256 lengthOfRemovedPools, address[] memory arr)
|
|
152
158
|
{
|
|
153
159
|
lengthOfRemovedPools = allRemovedPools.length();
|
|
154
|
-
|
|
160
|
+
|
|
161
|
+
if (end >= lengthOfRemovedPools) revert Errors.ArrayOutOfBounds();
|
|
162
|
+
|
|
155
163
|
arr = new address[](end - start + 1);
|
|
156
164
|
for (uint256 i = start; i <= end; ++i) arr[i - start] = allRemovedPools.at(i);
|
|
157
165
|
}
|
|
@@ -170,16 +178,16 @@ abstract contract VotingControllerStorageUpg {
|
|
|
170
178
|
return userData[user].voteForPools[pool];
|
|
171
179
|
}
|
|
172
180
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
function
|
|
181
|
+
function getUserPoolHistoryLength(address user, address pool) external view returns (uint256) {
|
|
182
|
+
return userPoolHistory[user][pool].length();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function getUserPoolHistoryAt(
|
|
178
186
|
address user,
|
|
179
187
|
address pool,
|
|
180
|
-
|
|
181
|
-
) external view returns (
|
|
182
|
-
return userPoolHistory[user][pool].
|
|
188
|
+
uint256 index
|
|
189
|
+
) external view returns (Checkpoint memory) {
|
|
190
|
+
return userPoolHistory[user][pool].get(index);
|
|
183
191
|
}
|
|
184
192
|
|
|
185
193
|
/*///////////////////////////////////////////////////////////////
|
|
@@ -192,8 +200,8 @@ abstract contract VotingControllerStorageUpg {
|
|
|
192
200
|
- set params in poolData
|
|
193
201
|
*/
|
|
194
202
|
function _addPool(uint64 chainId, address pool) internal {
|
|
195
|
-
|
|
196
|
-
|
|
203
|
+
if (!activeChainPools[chainId].add(pool)) assert(false);
|
|
204
|
+
if (!allActivePools.add(pool)) assert(false);
|
|
197
205
|
|
|
198
206
|
poolData[pool].chainId = chainId;
|
|
199
207
|
poolData[pool].lastSlopeChangeAppliedAt = WeekMath.getCurrentWeekStart();
|
|
@@ -207,9 +215,9 @@ abstract contract VotingControllerStorageUpg {
|
|
|
207
215
|
*/
|
|
208
216
|
function _removePool(address pool) internal {
|
|
209
217
|
uint64 chainId = poolData[pool].chainId;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
218
|
+
if (!activeChainPools[chainId].remove(pool)) assert(false);
|
|
219
|
+
if (!allActivePools.remove(pool)) assert(false);
|
|
220
|
+
if (!allRemovedPools.add(pool)) assert(false);
|
|
213
221
|
|
|
214
222
|
delete poolData[pool];
|
|
215
223
|
}
|
|
@@ -259,7 +267,7 @@ abstract contract VotingControllerStorageUpg {
|
|
|
259
267
|
|
|
260
268
|
// ADD NEW VOTE
|
|
261
269
|
if (weight != 0) {
|
|
262
|
-
|
|
270
|
+
if (!_isPoolActive(pool)) revert Errors.VCInactivePool(pool);
|
|
263
271
|
|
|
264
272
|
newVote = userPosition.convertToVeBalance(weight);
|
|
265
273
|
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
pragma solidity 0.8.15;
|
|
3
|
-
import "../../../interfaces/
|
|
3
|
+
import "../../../interfaces/IPVotingEscrowMainchain.sol";
|
|
4
4
|
import "../../../libraries/helpers/MiniHelpers.sol";
|
|
5
5
|
import "./VotingEscrowTokenBase.sol";
|
|
6
|
-
import "../
|
|
6
|
+
import "../CrossChainMsg/PendleMsgSenderAppUpg.sol";
|
|
7
7
|
import "../../../libraries/VeHistoryLib.sol";
|
|
8
|
+
import "../../../libraries/Errors.sol";
|
|
8
9
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
9
10
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
10
11
|
|
|
11
|
-
contract VotingEscrowPendleMainchain is
|
|
12
|
+
contract VotingEscrowPendleMainchain is
|
|
13
|
+
VotingEscrowTokenBase,
|
|
14
|
+
IPVotingEscrowMainchain,
|
|
15
|
+
PendleMsgSenderAppUpg
|
|
16
|
+
{
|
|
12
17
|
using SafeERC20 for IERC20;
|
|
13
18
|
using VeBalanceLib for VeBalance;
|
|
14
19
|
using VeBalanceLib for LockedPosition;
|
|
@@ -34,11 +39,11 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
34
39
|
// to ask for their vePendle balance at any wTime
|
|
35
40
|
mapping(address => Checkpoints.History) internal userHistory;
|
|
36
41
|
|
|
37
|
-
constructor(IERC20 _pendle)
|
|
42
|
+
constructor(IERC20 _pendle, address _pendleMsgSendEndpoint)
|
|
43
|
+
initializer
|
|
44
|
+
PendleMsgSenderAppUpg(_pendleMsgSendEndpoint)
|
|
45
|
+
{
|
|
38
46
|
pendle = _pendle;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function initialize() external initializer {
|
|
42
47
|
__BoringOwnable_init();
|
|
43
48
|
}
|
|
44
49
|
|
|
@@ -67,17 +72,17 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
67
72
|
returns (uint128 newVeBalance)
|
|
68
73
|
{
|
|
69
74
|
address user = msg.sender;
|
|
70
|
-
require(
|
|
71
|
-
WeekMath.isValidWTime(newExpiry) && !MiniHelpers.isTimeInThePast(newExpiry),
|
|
72
|
-
"invalid newExpiry"
|
|
73
|
-
);
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
if (!WeekMath.isValidWTime(newExpiry)) revert Errors.InvalidWTime(newExpiry);
|
|
77
|
+
if (MiniHelpers.isTimeInThePast(newExpiry)) revert Errors.ExpiryInThePast(newExpiry);
|
|
78
|
+
|
|
79
|
+
if (newExpiry < positionData[user].expiry) revert Errors.VENotAllowedReduceExpiry();
|
|
80
|
+
|
|
81
|
+
if (newExpiry > block.timestamp + MAX_LOCK_TIME) revert Errors.VEExceededMaxLockTime();
|
|
82
|
+
if (newExpiry < block.timestamp + MIN_LOCK_TIME) revert Errors.VEInsufficientLockTime();
|
|
78
83
|
|
|
79
84
|
uint128 newTotalAmountLocked = additionalAmountToLock + positionData[user].amount;
|
|
80
|
-
|
|
85
|
+
if (newTotalAmountLocked == 0) revert Errors.VEZeroAmountLocked();
|
|
81
86
|
|
|
82
87
|
uint128 additionalDurationToLock = newExpiry - positionData[user].expiry;
|
|
83
88
|
|
|
@@ -102,10 +107,11 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
102
107
|
*/
|
|
103
108
|
function withdraw() external returns (uint128 amount) {
|
|
104
109
|
address user = msg.sender;
|
|
105
|
-
|
|
110
|
+
|
|
111
|
+
if (!_isPositionExpired(user)) revert Errors.VEPositionNotExpired();
|
|
106
112
|
amount = positionData[user].amount;
|
|
107
113
|
|
|
108
|
-
|
|
114
|
+
if (amount == 0) revert Errors.VEZeroPosition();
|
|
109
115
|
|
|
110
116
|
delete positionData[user];
|
|
111
117
|
|
|
@@ -148,21 +154,50 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
148
154
|
payable
|
|
149
155
|
refundUnusedEth
|
|
150
156
|
{
|
|
151
|
-
|
|
157
|
+
if (user == address(0)) revert Errors.ZeroAddress();
|
|
152
158
|
_broadcastPosition(user, chainIds);
|
|
153
159
|
}
|
|
154
160
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return userHistory[user].getAtTimestamp(timestamp);
|
|
161
|
+
function getUserHistoryLength(address user) external view returns (uint256) {
|
|
162
|
+
return userHistory[user].length();
|
|
158
163
|
}
|
|
159
164
|
|
|
160
|
-
function
|
|
161
|
-
|
|
165
|
+
function getUserHistoryAt(address user, uint256 index)
|
|
166
|
+
external
|
|
167
|
+
view
|
|
168
|
+
returns (Checkpoint memory)
|
|
169
|
+
{
|
|
170
|
+
return userHistory[user].get(index);
|
|
162
171
|
}
|
|
163
172
|
|
|
164
|
-
function
|
|
165
|
-
|
|
173
|
+
function getBroadcastSupplyFee(uint256[] calldata chainIds)
|
|
174
|
+
external
|
|
175
|
+
view
|
|
176
|
+
returns (uint256[] memory fees)
|
|
177
|
+
{
|
|
178
|
+
fees = new uint256[](chainIds.length);
|
|
179
|
+
for (uint256 i = 0; i < chainIds.length; i++) {
|
|
180
|
+
fees[i] = pendleMsgSendEndpoint.calcFee(
|
|
181
|
+
destinationContracts.get(chainIds[i]),
|
|
182
|
+
chainIds[i],
|
|
183
|
+
SAMPLE_SUPPLY_UPDATE_MESSAGE
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function getBroadcastPositionFee(uint256[] calldata chainIds)
|
|
189
|
+
external
|
|
190
|
+
view
|
|
191
|
+
returns (uint256[] memory fees)
|
|
192
|
+
{
|
|
193
|
+
fees = new uint256[](chainIds.length);
|
|
194
|
+
for (uint256 i = 0; i < chainIds.length; i++) {
|
|
195
|
+
fees[i] = pendleMsgSendEndpoint.calcFee(
|
|
196
|
+
destinationContracts.get(chainIds[i]),
|
|
197
|
+
chainIds[i],
|
|
198
|
+
SAMPLE_POSITION_UPDATE_MESSAGE
|
|
199
|
+
);
|
|
200
|
+
}
|
|
166
201
|
}
|
|
167
202
|
|
|
168
203
|
/**
|
|
@@ -236,7 +271,7 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
236
271
|
|
|
237
272
|
/// @notice broadcast position to all chains in chainIds
|
|
238
273
|
function _broadcastPosition(address user, uint256[] calldata chainIds) internal {
|
|
239
|
-
|
|
274
|
+
if (chainIds.length == 0) revert Errors.ArrayEmpty();
|
|
240
275
|
|
|
241
276
|
(VeBalance memory supply, uint128 wTime) = _applySlopeChange();
|
|
242
277
|
|
|
@@ -245,7 +280,8 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
245
280
|
);
|
|
246
281
|
|
|
247
282
|
for (uint256 i = 0; i < chainIds.length; ++i) {
|
|
248
|
-
|
|
283
|
+
if (!destinationContracts.contains(chainIds[i]))
|
|
284
|
+
revert Errors.ChainNotSupported(chainIds[i]);
|
|
249
285
|
_broadcast(chainIds[i], wTime, supply, userData);
|
|
250
286
|
}
|
|
251
287
|
|