@pendle/core-v2 3.0.0-beta-11 → 3.0.0-beta-12
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/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +5 -23
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +2 -5
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +6 -20
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +6 -27
- package/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol +1 -2
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +1 -1
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +16 -17
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +6 -7
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +7 -8
- package/contracts/LiquidityMining/PendleMerkleDistributor.sol +2 -11
- package/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol +14 -37
- package/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol +19 -34
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +4 -14
- package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +4 -16
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +11 -39
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +3 -10
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +1 -1
- package/contracts/LiquidityMining/libraries/VeBalanceLib.sol +5 -20
- package/contracts/LiquidityMining/libraries/VeHistoryLib.sol +1 -3
- package/contracts/core/Market/MarketMathCore.sol +12 -37
- package/contracts/core/Market/OracleLib.sol +6 -24
- package/contracts/core/Market/PendleExternalRewardDistributor.sol +4 -10
- package/contracts/core/Market/PendleGauge.sol +3 -9
- package/contracts/core/Market/PendleMarket.sol +14 -39
- package/contracts/core/Market/PendleMarketFactory.sol +14 -21
- package/contracts/core/Market/v2/PendleGaugeV2.sol +8 -24
- package/contracts/core/Market/v2/PendleMarketFactoryV2.sol +7 -27
- package/contracts/core/Market/v2/PendleMarketV2.sol +13 -36
- package/contracts/core/Market/v3/PendleMarketFactoryV3.sol +137 -0
- package/contracts/core/Market/v3/PendleMarketV3.sol +360 -0
- package/contracts/core/RewardManager/PendleLinearDistributor.sol +143 -0
- package/contracts/core/RewardManager/RewardManager.sol +14 -7
- package/contracts/core/RewardManager/RewardManagerAbstract.sol +5 -17
- package/contracts/core/StandardizedYield/SYBase.sol +10 -40
- package/contracts/core/StandardizedYield/SYBaseUpg.sol +197 -0
- package/contracts/core/StandardizedYield/SYBaseWithRewards.sol +9 -41
- package/contracts/core/StandardizedYield/SYBaseWithRewardsUpg.sol +88 -0
- package/contracts/core/StandardizedYield/SYUtils.sol +1 -4
- package/contracts/core/StandardizedYield/StEthHelper.sol +3 -9
- package/contracts/core/StandardizedYield/implementations/AaveV3/PendleAaveV3SY.sol +94 -0
- package/contracts/core/StandardizedYield/implementations/AaveV3/libraries/AaveAdapterLib.sol +19 -0
- package/contracts/core/StandardizedYield/implementations/AaveV3/libraries/WadRayMath.sol +126 -0
- package/contracts/core/StandardizedYield/implementations/Ankr/PendleAnkrBNBSY.sol +4 -12
- package/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol +5 -19
- package/contracts/core/StandardizedYield/implementations/BalancerStable/AuraEthxBbAWethSY.sol +4 -14
- package/contracts/core/StandardizedYield/implementations/BalancerStable/AuraSwEthBbAWethSYV2.sol +4 -14
- package/contracts/core/StandardizedYield/implementations/BalancerStable/{PendleAuraWethVethSY.sol → AuraWethVethSYUpg.sol} +13 -20
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol +3 -7
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol +12 -29
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol +12 -29
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol +12 -29
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol +14 -39
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWstethAnkreth.sol +7 -28
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol +13 -30
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewProxy.sol +1 -1
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewV4.sol +50 -153
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewV5.sol +50 -157
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol +4 -16
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearMath.sol +6 -25
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearPreview.sol +36 -34
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol +4 -13
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol +20 -58
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol +28 -79
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV3Upg.sol +310 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol +1 -3
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol +2 -6
- package/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol +5 -13
- package/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol +9 -29
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol +2 -8
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol +1 -5
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol +8 -19
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol +7 -25
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol +8 -27
- package/contracts/core/StandardizedYield/implementations/ChainlinkRelayer/PendleChainlinkReceiver.sol +2 -2
- package/contracts/core/StandardizedYield/implementations/ChainlinkRelayer/PendleChainlinkRelayer.sol +4 -9
- package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol +3 -15
- package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol +5 -23
- package/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol +10 -40
- package/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol +2 -8
- package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +2 -7
- package/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol +5 -20
- package/contracts/core/StandardizedYield/implementations/Flux/FluxTokenLib.sol +6 -4
- package/contracts/core/StandardizedYield/implementations/Flux/PendleFluxLendingSY.sol +3 -11
- package/contracts/core/StandardizedYield/implementations/GLP/GLPPreviewHelper.sol +3 -9
- package/contracts/core/StandardizedYield/implementations/GLP/GMTokenPricingHelper.sol +115 -0
- package/contracts/core/StandardizedYield/implementations/GLP/PendleGMV2TokenSY.sol +134 -0
- package/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol +5 -19
- package/contracts/core/StandardizedYield/implementations/HMX/HLPPricingHelper.sol +3 -4
- package/contracts/core/StandardizedYield/implementations/HMX/PendleHlpSY.sol +18 -25
- package/contracts/core/StandardizedYield/implementations/Kyber/KyberMathHelper.sol +425 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/KyberNftManagerBaseUpg.sol +438 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/PendleKyberElasticSYUpg.sol +155 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/FullMath.sol +123 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/LiqDeltaMath.sol +17 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/LiquidityMath.sol +74 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/MathConstants.sol +19 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/QtyDeltaMath.sol +103 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/QuadMath.sol +31 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/ReinvestmentMath.sol +26 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/SafeCast.sol +73 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/SwapMath.sol +272 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/TickMath.sol +223 -0
- package/contracts/core/StandardizedYield/implementations/MUX/MlpPricingHelper.sol +26 -0
- package/contracts/core/StandardizedYield/implementations/MUX/PendleMlpSY.sol +195 -0
- package/contracts/core/StandardizedYield/implementations/MantleStakedEth/PendleMantleStakedEthSY.sol +12 -41
- package/contracts/core/StandardizedYield/implementations/MantleStakedEth/PendleOracleForSyProxy.sol +1 -1
- package/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol +13 -42
- package/contracts/core/StandardizedYield/implementations/PendleBridgedLSDSY.sol +4 -11
- package/contracts/core/StandardizedYield/implementations/PendleERC4626SY.sol +4 -16
- package/contracts/core/StandardizedYield/implementations/PendleEUSDSY.sol +3 -11
- package/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol +3 -11
- package/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol +5 -18
- package/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol +3 -7
- package/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol +5 -18
- package/contracts/core/StandardizedYield/implementations/PendleWbEthSY.sol +3 -10
- package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +4 -12
- package/contracts/core/StandardizedYield/implementations/Silo/PendleSiloWithIncentiveSY.sol +157 -0
- package/contracts/core/StandardizedYield/implementations/Stader/PendleETHXSY.sol +4 -12
- package/contracts/core/StandardizedYield/implementations/Swell/PendleSwETH.sol +4 -12
- package/contracts/core/StandardizedYield/implementations/Thena/PendleThenaSY.sol +9 -29
- package/contracts/core/StandardizedYield/implementations/Thena/ThenaLpHelper.sol +3 -10
- package/contracts/core/StandardizedYield/implementations/Thena/ThenaMath.sol +9 -30
- package/contracts/core/StandardizedYield/implementations/Thena/ThenaPreview.sol +10 -40
- package/contracts/core/YieldContracts/InterestManagerYT.sol +6 -8
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +1 -1
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +2 -3
- package/contracts/core/YieldContracts/PendleYieldToken.sol +17 -44
- package/contracts/core/YieldContractsV2/InterestManagerYTV2.sol +5 -14
- package/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol +1 -1
- package/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol +2 -3
- package/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol +13 -48
- package/contracts/core/erc20/PendleERC20.sol +2 -8
- package/contracts/core/erc20/PendleERC20Permit.sol +2 -6
- package/contracts/core/erc20/PendleERC20PermitUpg.sol +82 -0
- package/contracts/core/erc20/PendleERC20Upg.sol +334 -0
- package/contracts/core/libraries/ArrayLib.sol +7 -8
- package/contracts/core/libraries/BaseSplitCodeFactory.sol +1 -6
- package/contracts/core/libraries/Errors.sol +19 -1
- package/contracts/core/libraries/ExpiryUtilsLib.sol +3 -26
- package/contracts/core/libraries/StringLib.sol +5 -21
- package/contracts/core/libraries/TokenHelper.sol +3 -3
- package/contracts/core/libraries/math/LogExpMath.sol +1 -4
- package/contracts/core/libraries/math/PMath.sol +13 -15
- package/contracts/interfaces/AaveV3/IAaveV3AToken.sol +15 -0
- package/contracts/interfaces/AaveV3/IAaveV3Pool.sol +11 -0
- package/contracts/interfaces/Balancer/IComposableStable.sol +3 -4
- package/contracts/interfaces/Balancer/IERC4626LinearPool.sol +2 -10
- package/contracts/interfaces/Balancer/IMetaStablePool.sol +3 -11
- package/contracts/interfaces/Balancer/IVault.sol +3 -8
- package/contracts/interfaces/BinanceEth/IWBETH.sol +1 -1
- package/contracts/interfaces/Camelot/ICamelotNFTFactory.sol +1 -3
- package/contracts/interfaces/Camelot/ICamelotNFTHandler.sol +2 -10
- package/contracts/interfaces/Camelot/ICamelotNitroPool.sol +0 -1
- package/contracts/interfaces/Camelot/ICamelotNitroPoolFactory.sol +3 -12
- package/contracts/interfaces/Camelot/ICamelotPair.sol +5 -25
- package/contracts/interfaces/Camelot/ICamelotRouter.sol +1 -5
- package/contracts/interfaces/Camelot/IXGrail.sol +3 -11
- package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -3
- package/contracts/interfaces/Curve/ICrvPool.sol +3 -12
- package/contracts/interfaces/Curve/ITriCrvPool.sol +2 -9
- package/contracts/interfaces/Flux/IFluxErc20.sol +1 -1
- package/contracts/interfaces/Flux/IFluxInterestRateModel.sol +1 -5
- package/contracts/interfaces/GMX/IGMXPriceHelper.sol +6 -0
- package/contracts/interfaces/GMX/IGMXVault.sol +2 -9
- package/contracts/interfaces/GMX/IRewardRouterV2.sol +1 -4
- package/contracts/interfaces/HMX/IHLPStaking.sol +1 -1
- package/contracts/interfaces/HMX/IHMXCalculator.sol +1 -1
- package/contracts/interfaces/HMX/IHMXCompounder.sol +1 -1
- package/contracts/interfaces/HMX/IHMXStaking.sol +1 -1
- package/contracts/interfaces/HMX/IHMXVester.sol +1 -1
- package/contracts/interfaces/IApeStaking.sol +3 -9
- package/contracts/interfaces/IBenQiInterestRateModel.sol +1 -5
- package/contracts/interfaces/IDiamondCut.sol +1 -5
- package/contracts/interfaces/IDiamondLoupe.sol +1 -3
- package/contracts/interfaces/ILayerZeroReceiver.sol +1 -6
- package/contracts/interfaces/IPActionAddRemoveLiqV3.sol +10 -2
- package/contracts/interfaces/IPActionInfoStatic.sol +4 -7
- package/contracts/interfaces/IPActionMarketAuxStatic.sol +5 -9
- package/contracts/interfaces/IPActionMarketCoreStatic.sol +118 -58
- package/contracts/interfaces/IPActionMintRedeemStatic.sol +38 -21
- package/contracts/interfaces/IPActionMiscV3.sol +51 -26
- package/contracts/interfaces/IPActionStorageStatic.sol +5 -1
- package/contracts/interfaces/IPAllActionTypeV3.sol +1 -0
- package/contracts/interfaces/IPBulkSeller.sol +49 -0
- package/contracts/interfaces/IPBulkSellerFactory.sol +12 -0
- package/contracts/interfaces/IPBulkSellerSYCallback.sol +6 -0
- package/contracts/interfaces/IPFeeDistributor.sol +1 -3
- package/contracts/interfaces/IPFeeDistributorV2.sol +8 -7
- package/contracts/interfaces/IPGaugeController.sol +2 -8
- package/contracts/interfaces/IPGaugeControllerMainchain.sol +1 -5
- package/contracts/interfaces/IPInterestManagerYT.sol +3 -3
- package/contracts/interfaces/IPInterestManagerYTV2.sol +1 -4
- package/contracts/interfaces/IPLimitRouter.sol +24 -19
- package/contracts/interfaces/IPLinearDistributor.sol +21 -0
- package/contracts/interfaces/IPMarket.sol +4 -17
- package/contracts/interfaces/IPMarketFactory.sol +2 -13
- package/contracts/interfaces/IPMarketFactoryV3.sol +24 -0
- package/contracts/interfaces/IPMarketV3.sol +8 -0
- package/contracts/interfaces/IPOffchainStorage.sol +11 -0
- package/contracts/interfaces/IPPriceFeed.sol +6 -0
- package/contracts/interfaces/IPPtOracle.sol +2 -9
- package/contracts/interfaces/IPRouterHelper.sol +11 -7
- package/contracts/interfaces/IPRouterStatic.sol +1 -3
- package/contracts/interfaces/IPVotingController.sol +7 -19
- package/contracts/interfaces/IPVotingEscrowMainchain.sol +2 -8
- package/contracts/interfaces/IPYieldToken.sol +2 -8
- package/contracts/interfaces/IPYieldTokenV2.sol +1 -6
- package/contracts/interfaces/IPendlePreviewHelper.sol +2 -8
- package/contracts/interfaces/IRewardManager.sol +1 -4
- package/contracts/interfaces/IStETH.sol +1 -4
- package/contracts/interfaces/IStandardizedYield.sol +9 -16
- package/contracts/interfaces/IStargateLP.sol +0 -3
- package/contracts/interfaces/IStargateRouter.sol +1 -5
- package/contracts/interfaces/Kyber/IKyberElasticFactory.sol +157 -0
- package/contracts/interfaces/Kyber/IKyberElasticPool.sol +101 -0
- package/contracts/interfaces/Kyber/IKyberElasticRouter.sol +98 -0
- package/contracts/interfaces/Kyber/IKyberLiquidityMining.sol +209 -0
- package/contracts/interfaces/Kyber/IKyberMathHelper.sol +28 -0
- package/contracts/interfaces/Kyber/IKyberPositionManager.sol +179 -0
- package/contracts/interfaces/Lybra/IEUSD.sol +1 -1
- package/contracts/interfaces/MUX/IMUXRewardRouter.sol +139 -0
- package/contracts/interfaces/Silo/ISilo.sol +298 -0
- package/contracts/interfaces/Silo/ISiloIncentiveController.sol +16 -0
- package/contracts/interfaces/Silo/ISiloLens.sol +6 -0
- package/contracts/interfaces/Stader/IStaderStakeManager.sol +2 -2
- package/contracts/interfaces/Thena/IThenaFactory.sol +1 -5
- package/contracts/interfaces/Thena/IThenaGaugeV2.sol +1 -2
- package/contracts/interfaces/Thena/IThenaPair.sol +3 -5
- package/contracts/limit/LimitMathCore.sol +69 -60
- package/contracts/limit/{PendleOrderMixin.sol → LimitRouterBase.sol} +96 -79
- package/contracts/limit/PendleLimitRouter.sol +9 -13
- package/contracts/offchain-helpers/AutomateReady.sol +17 -32
- package/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol +6 -3
- package/contracts/offchain-helpers/BoringLpSeller.sol +4 -17
- package/contracts/offchain-helpers/BoringPtSeller.sol +2 -7
- package/contracts/offchain-helpers/Broadcaster.sol +1 -1
- package/contracts/offchain-helpers/BytesLib.sol +26 -14
- package/contracts/offchain-helpers/EmptyUUPS.sol +0 -1
- package/contracts/offchain-helpers/LegacyNFTHelper.sol +4 -23
- package/contracts/offchain-helpers/LimitBackendHelper.sol +25 -16
- package/contracts/offchain-helpers/MarketExchangeRateLib.sol +2 -13
- package/contracts/offchain-helpers/Multicall2.sol +2 -7
- package/contracts/offchain-helpers/PendleMulticallV1.sol +7 -7
- package/contracts/offchain-helpers/PendleMulticallV2.sol +12 -13
- package/contracts/offchain-helpers/PendleOffchainStorage.sol +59 -0
- package/contracts/offchain-helpers/SimulateHelper.sol +6 -7
- package/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol +15 -1
- package/contracts/oracles/PendleLpOracleLib.sol +9 -10
- package/contracts/oracles/PendlePtOracle.sol +8 -19
- package/contracts/oracles/PendlePtOracleLib.sol +8 -13
- package/contracts/oracles/samples/PendleLpGlpOracle.sol +6 -10
- package/contracts/oracles/samples/PendlePtGlpOracle.sol +6 -10
- package/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol +8 -15
- package/contracts/router/ActionAddRemoveLiqV3.sol +147 -52
- package/contracts/router/ActionCallbackV3.sol +11 -4
- package/contracts/router/ActionMiscV3.sol +43 -33
- package/contracts/router/ActionSwapPTV3.sol +18 -6
- package/contracts/router/ActionSwapYTV3.sol +42 -14
- package/contracts/router/PendleRouterHelper.sol +72 -40
- package/contracts/router/PendleRouterV3.sol +50 -50
- package/contracts/router/base/ActionBase.sol +86 -43
- package/contracts/router/base/CallbackHelper.sol +18 -20
- package/contracts/router/base/MarketApproxLib.sol +36 -32
- package/contracts/router/swap-aggregator/PendleSwap.sol +31 -7
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutorOptimistic.sol +63 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelper.sol +314 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperL2.sol +560 -0
- package/contracts/router/swap-aggregator/kyberswap/{IMetaAggregationRouterV2.sol → interfaces/IMetaAggregationRouterV2.sol} +11 -6
- package/contracts/router/swap-aggregator/kyberswap/{KyberInputScalingHelper.sol → l1-contracts/InputScalingHelper.sol} +70 -19
- package/contracts/router/swap-aggregator/kyberswap/{ScalingDataLib.sol → l1-contracts/ScalingDataLib.sol} +111 -53
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/BytesHelper.sol +29 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataReader.sol +149 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataWriter.sol +118 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/Common.sol +42 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/DexScaler.sol +382 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/ExecutorReader.sol +61 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/InputScalingHelperL2.sol +329 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/ScalingDataL2Lib.sol +173 -0
- package/contracts/router/swap-aggregator/oneinch/I1inchAggregationRouterV5.sol +4 -10
- package/contracts/router/swap-aggregator/oneinch/OneInchAggregationRouterHelper.sol +20 -14
- package/deployments/1-core.json +5 -2
- package/deployments/1-markets/EPENDLE-SEP2024.json +12 -0
- package/deployments/1-markets/SFRAX-MARCH2024.json +10 -0
- package/deployments/1-markets/SILO-CRVUSD-MARCH2024.json +10 -0
- package/deployments/10-core.json +6 -3
- package/deployments/42161-core.json +5 -2
- package/deployments/42161-markets/AAVE-USDC-JUNE2024.json +11 -0
- package/deployments/42161-markets/ARBSILO-USDC-FEB2024.json +10 -0
- package/deployments/42161-markets/GM-ARB-USDC-MARCH2024.json +10 -0
- package/deployments/42161-markets/KYBER-AXLWSTETH-WSTETH-MARCH2024.json +10 -0
- package/deployments/42161-markets/MLP-MARCH2024.json +10 -0
- package/deployments/42161-markets/WSTETH-ARBITRUM-MARCH2024.json +11 -0
- package/deployments/42161-markets/WSTETHSILO-ETH-MARCH2024.json +11 -0
- package/deployments/56-core.json +5 -2
- package/deployments/merkle-distribution/2023-10-26.json +7300 -0
- package/deployments/merkle-distribution/2023-11-30.json +7730 -0
- package/package.json +8 -8
- package/contracts/limit/helpers/ArgumentsDecoder.sol +0 -47
- package/contracts/limit/helpers/Permitable.sol +0 -48
- package/contracts/limit/helpers/RevertReasonParser.sol +0 -75
- package/contracts/offchain-helpers/ChainlinkRelayerGelato.sol +0 -37
- package/contracts/offchain-helpers/PtAndLpToAsset.sol +0 -62
- package/contracts/offchain-helpers/router-static/PendleRouterStatic.sol +0 -19
- package/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol +0 -112
- package/contracts/offchain-helpers/router-static/base/ActionLimitOrdersStatic.sol +0 -145
- package/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol +0 -171
- package/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol +0 -582
- package/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol +0 -116
- package/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol +0 -64
- package/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol +0 -53
- package/contracts/offchain-helpers/router-static/base/StorageLayout.sol +0 -18
- package/contracts/router/swap-aggregator/kyberswap/IExecutorHelper.sol +0 -231
- package/deployments/1-markets/BALANCER-LP-AURA-VETH-WETH-SEP2024.json +0 -8
- /package/contracts/router/swap-aggregator/kyberswap/{IAggregationExecutor.sol → interfaces/IAggregationExecutor.sol} +0 -0
- /package/deployments/1-markets/{BALANCER-LP-AURA-BBAWETHSWETH-SEP-26-2024.json → deprecated/BALANCER-LP-AURA-BBAWETHSWETH-SEP-26-2024.json} +0 -0
- /package/deployments/1-markets/{BALANCER-LP-AURA-ETHX-BBAWETH-SEP-26-2024.json → deprecated/BALANCER-LP-AURA-ETHX-BBAWETH-SEP-26-2024.json} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.17;
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import "../../interfaces/ILayerZeroEndpoint.sol";
|
|
5
5
|
import "../../interfaces/IPMsgReceiverApp.sol";
|
|
@@ -15,25 +15,14 @@ import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
|
15
15
|
* So we can leave the configuration unset.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
contract PendleMsgReceiveEndpointUpg is
|
|
19
|
-
ILayerZeroReceiver,
|
|
20
|
-
Initializable,
|
|
21
|
-
UUPSUpgradeable,
|
|
22
|
-
BoringOwnableUpgradeable
|
|
23
|
-
{
|
|
18
|
+
contract PendleMsgReceiveEndpointUpg is ILayerZeroReceiver, Initializable, UUPSUpgradeable, BoringOwnableUpgradeable {
|
|
24
19
|
using ExcessivelySafeCall for address;
|
|
25
20
|
|
|
26
21
|
address public immutable lzEndpoint;
|
|
27
22
|
address public immutable sendEndpointAddr;
|
|
28
23
|
uint64 public immutable sendEndpointChainId;
|
|
29
24
|
|
|
30
|
-
event MessageFailed(
|
|
31
|
-
uint16 _srcChainId,
|
|
32
|
-
bytes _path,
|
|
33
|
-
uint64 _nonce,
|
|
34
|
-
bytes _payload,
|
|
35
|
-
bytes _reason
|
|
36
|
-
);
|
|
25
|
+
event MessageFailed(uint16 _srcChainId, bytes _path, uint64 _nonce, bytes _payload, bytes _reason);
|
|
37
26
|
|
|
38
27
|
modifier onlyLzEndpoint() {
|
|
39
28
|
if (msg.sender != address(lzEndpoint)) revert Errors.OnlyLayerZeroEndpoint();
|
|
@@ -55,11 +44,7 @@ contract PendleMsgReceiveEndpointUpg is
|
|
|
55
44
|
|
|
56
45
|
// by default we will use LZ's default version (most updated version). Hence, it's not necessary
|
|
57
46
|
// to call setLzReceiveVersion
|
|
58
|
-
constructor(
|
|
59
|
-
address _lzEndpoint,
|
|
60
|
-
address _sendEndpointAddr,
|
|
61
|
-
uint64 _sendEndpointChainId
|
|
62
|
-
) initializer {
|
|
47
|
+
constructor(address _lzEndpoint, address _sendEndpointAddr, uint64 _sendEndpointChainId) initializer {
|
|
63
48
|
lzEndpoint = _lzEndpoint;
|
|
64
49
|
sendEndpointAddr = _sendEndpointAddr;
|
|
65
50
|
sendEndpointChainId = _sendEndpointChainId;
|
|
@@ -88,10 +73,7 @@ contract PendleMsgReceiveEndpointUpg is
|
|
|
88
73
|
}
|
|
89
74
|
}
|
|
90
75
|
|
|
91
|
-
function govExecuteMessage(
|
|
92
|
-
address receiver,
|
|
93
|
-
bytes calldata message
|
|
94
|
-
) external payable onlyOwner {
|
|
76
|
+
function govExecuteMessage(address receiver, bytes calldata message) external payable onlyOwner {
|
|
95
77
|
IPMsgReceiverApp(receiver).executeMessage(message);
|
|
96
78
|
}
|
|
97
79
|
|
|
@@ -13,8 +13,7 @@ abstract contract PendleMsgReceiverAppUpg is IPMsgReceiverApp {
|
|
|
13
13
|
uint256[100] private __gap;
|
|
14
14
|
|
|
15
15
|
modifier onlyFromPendleMsgReceiveEndpoint() {
|
|
16
|
-
if (msg.sender != pendleMsgReceiveEndpoint)
|
|
17
|
-
revert Errors.MsgNotFromReceiveEndpoint(msg.sender);
|
|
16
|
+
if (msg.sender != pendleMsgReceiveEndpoint) revert Errors.MsgNotFromReceiveEndpoint(msg.sender);
|
|
18
17
|
_;
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -22,9 +21,7 @@ abstract contract PendleMsgReceiverAppUpg is IPMsgReceiverApp {
|
|
|
22
21
|
pendleMsgReceiveEndpoint = _pendleMsgReceiveEndpoint;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
function executeMessage(
|
|
26
|
-
bytes calldata message
|
|
27
|
-
) external virtual onlyFromPendleMsgReceiveEndpoint {
|
|
24
|
+
function executeMessage(bytes calldata message) external virtual onlyFromPendleMsgReceiveEndpoint {
|
|
28
25
|
_executeMessage(message);
|
|
29
26
|
}
|
|
30
27
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.17;
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import "../../interfaces/IPMsgSendEndpoint.sol";
|
|
5
5
|
import "../../interfaces/ILayerZeroEndpoint.sol";
|
|
@@ -14,12 +14,7 @@ import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
|
14
14
|
* So we can leave the configuration unset.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
contract PendleMsgSendEndpointUpg is
|
|
18
|
-
IPMsgSendEndpoint,
|
|
19
|
-
Initializable,
|
|
20
|
-
UUPSUpgradeable,
|
|
21
|
-
BoringOwnableUpgradeable
|
|
22
|
-
{
|
|
17
|
+
contract PendleMsgSendEndpointUpg is IPMsgSendEndpoint, Initializable, UUPSUpgradeable, BoringOwnableUpgradeable {
|
|
23
18
|
using EnumerableMap for EnumerableMap.UintToAddressMap;
|
|
24
19
|
|
|
25
20
|
address payable public immutable refundAddress;
|
|
@@ -64,7 +59,7 @@ contract PendleMsgSendEndpointUpg is
|
|
|
64
59
|
uint256 estimatedGasAmount
|
|
65
60
|
) external payable onlyWhitelisted {
|
|
66
61
|
bytes memory path = abi.encodePacked(receiveEndpoints.get(dstChainId), address(this));
|
|
67
|
-
lzEndpoint.send{
|
|
62
|
+
lzEndpoint.send{value: msg.value}(
|
|
68
63
|
LayerZeroHelper._getLayerZeroChainIds(dstChainId),
|
|
69
64
|
path,
|
|
70
65
|
abi.encode(dstAddress, payload),
|
|
@@ -74,10 +69,7 @@ contract PendleMsgSendEndpointUpg is
|
|
|
74
69
|
);
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
function addReceiveEndpoints(
|
|
78
|
-
address endpointAddr,
|
|
79
|
-
uint256 endpointChainId
|
|
80
|
-
) external payable onlyOwner {
|
|
72
|
+
function addReceiveEndpoints(address endpointAddr, uint256 endpointChainId) external payable onlyOwner {
|
|
81
73
|
receiveEndpoints.set(endpointChainId, endpointAddr);
|
|
82
74
|
}
|
|
83
75
|
|
|
@@ -89,11 +81,7 @@ contract PendleMsgSendEndpointUpg is
|
|
|
89
81
|
ILayerZeroEndpoint(lzEndpoint).setSendVersion(_newVersion);
|
|
90
82
|
}
|
|
91
83
|
|
|
92
|
-
function getAllReceiveEndpoints()
|
|
93
|
-
external
|
|
94
|
-
view
|
|
95
|
-
returns (uint256[] memory chainIds, address[] memory addrs)
|
|
96
|
-
{
|
|
84
|
+
function getAllReceiveEndpoints() external view returns (uint256[] memory chainIds, address[] memory addrs) {
|
|
97
85
|
uint256 length = receiveEndpoints.length();
|
|
98
86
|
chainIds = new uint256[](length);
|
|
99
87
|
addrs = new address[](length);
|
|
@@ -105,9 +93,7 @@ contract PendleMsgSendEndpointUpg is
|
|
|
105
93
|
|
|
106
94
|
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
|
107
95
|
|
|
108
|
-
function _getAdapterParams(
|
|
109
|
-
uint256 estimatedGasAmount
|
|
110
|
-
) internal pure returns (bytes memory adapterParams) {
|
|
96
|
+
function _getAdapterParams(uint256 estimatedGasAmount) internal pure returns (bytes memory adapterParams) {
|
|
111
97
|
// this is more like "type" rather than version
|
|
112
98
|
// It is the type of adapter params you want to pass to relayer
|
|
113
99
|
adapterParams = abi.encodePacked(uint16(1), estimatedGasAmount);
|
|
@@ -38,20 +38,11 @@ abstract contract PendleMsgSenderAppUpg is BoringOwnableUpgradeable {
|
|
|
38
38
|
uint256 estimatedGasAmount = approxDstExecutionGas;
|
|
39
39
|
uint256 fee = pendleMsgSendEndpoint.calcFee(toAddr, chainId, message, estimatedGasAmount);
|
|
40
40
|
// LM contracts won't hold ETH on its own so this is fine
|
|
41
|
-
if (address(this).balance < fee)
|
|
42
|
-
|
|
43
|
-
pendleMsgSendEndpoint.sendMessage{ value: fee }(
|
|
44
|
-
toAddr,
|
|
45
|
-
chainId,
|
|
46
|
-
message,
|
|
47
|
-
estimatedGasAmount
|
|
48
|
-
);
|
|
41
|
+
if (address(this).balance < fee) revert Errors.InsufficientFeeToSendMsg(address(this).balance, fee);
|
|
42
|
+
pendleMsgSendEndpoint.sendMessage{value: fee}(toAddr, chainId, message, estimatedGasAmount);
|
|
49
43
|
}
|
|
50
44
|
|
|
51
|
-
function addDestinationContract(
|
|
52
|
-
address _address,
|
|
53
|
-
uint256 _chainId
|
|
54
|
-
) external payable onlyOwner {
|
|
45
|
+
function addDestinationContract(address _address, uint256 _chainId) external payable onlyOwner {
|
|
55
46
|
destinationContracts.set(_chainId, _address);
|
|
56
47
|
}
|
|
57
48
|
|
|
@@ -59,11 +50,7 @@ abstract contract PendleMsgSenderAppUpg is BoringOwnableUpgradeable {
|
|
|
59
50
|
approxDstExecutionGas = gas;
|
|
60
51
|
}
|
|
61
52
|
|
|
62
|
-
function getAllDestinationContracts()
|
|
63
|
-
public
|
|
64
|
-
view
|
|
65
|
-
returns (uint256[] memory chainIds, address[] memory addrs)
|
|
66
|
-
{
|
|
53
|
+
function getAllDestinationContracts() public view returns (uint256[] memory chainIds, address[] memory addrs) {
|
|
67
54
|
uint256 length = destinationContracts.length();
|
|
68
55
|
chainIds = new uint256[](length);
|
|
69
56
|
addrs = new address[](length);
|
|
@@ -73,16 +60,8 @@ abstract contract PendleMsgSenderAppUpg is BoringOwnableUpgradeable {
|
|
|
73
60
|
}
|
|
74
61
|
}
|
|
75
62
|
|
|
76
|
-
function _getSendMessageFee(
|
|
77
|
-
uint256 chainId,
|
|
78
|
-
bytes memory message
|
|
79
|
-
) internal view returns (uint256) {
|
|
63
|
+
function _getSendMessageFee(uint256 chainId, bytes memory message) internal view returns (uint256) {
|
|
80
64
|
return
|
|
81
|
-
pendleMsgSendEndpoint.calcFee(
|
|
82
|
-
destinationContracts.get(chainId),
|
|
83
|
-
chainId,
|
|
84
|
-
message,
|
|
85
|
-
approxDstExecutionGas
|
|
86
|
-
);
|
|
65
|
+
pendleMsgSendEndpoint.calcFee(destinationContracts.get(chainId), chainId, message, approxDstExecutionGas);
|
|
87
66
|
}
|
|
88
67
|
}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
pragma solidity >=0.7.6;
|
|
3
3
|
|
|
4
4
|
library ExcessivelySafeCall {
|
|
5
|
-
uint256 constant LOW_28_MASK =
|
|
6
|
-
0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
|
|
5
|
+
uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
|
|
7
6
|
|
|
8
7
|
/// @notice Use when you _really_ really _really_ don't trust the called
|
|
9
8
|
/// contract. This prevents the called contract from causing reversion of
|
|
@@ -24,11 +24,7 @@ import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
|
24
24
|
* on inheriting contracts
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
abstract contract PendleGaugeControllerBaseUpg is
|
|
28
|
-
IPGaugeController,
|
|
29
|
-
BoringOwnableUpgradeable,
|
|
30
|
-
UUPSUpgradeable
|
|
31
|
-
{
|
|
27
|
+
abstract contract PendleGaugeControllerBaseUpg is IPGaugeController, BoringOwnableUpgradeable, UUPSUpgradeable {
|
|
32
28
|
using SafeERC20 for IERC20;
|
|
33
29
|
using PMath for uint256;
|
|
34
30
|
|
|
@@ -43,6 +39,7 @@ abstract contract PendleGaugeControllerBaseUpg is
|
|
|
43
39
|
|
|
44
40
|
address public immutable pendle;
|
|
45
41
|
IPMarketFactory public immutable marketFactory;
|
|
42
|
+
IPMarketFactory public immutable marketFactory2;
|
|
46
43
|
|
|
47
44
|
mapping(address => MarketRewardData) public rewardData;
|
|
48
45
|
mapping(uint128 => bool) public epochRewardReceived;
|
|
@@ -50,13 +47,20 @@ abstract contract PendleGaugeControllerBaseUpg is
|
|
|
50
47
|
uint256[100] private __gap;
|
|
51
48
|
|
|
52
49
|
modifier onlyPendleMarket() {
|
|
53
|
-
if (
|
|
54
|
-
|
|
50
|
+
if (
|
|
51
|
+
marketFactory.isValidMarket(msg.sender) ||
|
|
52
|
+
(marketFactory2 != IPMarketFactory(address(0)) && marketFactory2.isValidMarket(msg.sender))
|
|
53
|
+
) {
|
|
54
|
+
_;
|
|
55
|
+
} else {
|
|
56
|
+
revert Errors.GCNotPendleMarket(msg.sender);
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
constructor(address _pendle, address _marketFactory) {
|
|
60
|
+
constructor(address _pendle, address _marketFactory, address _marketFactory2) {
|
|
58
61
|
pendle = _pendle;
|
|
59
62
|
marketFactory = IPMarketFactory(_marketFactory);
|
|
63
|
+
marketFactory2 = IPMarketFactory(_marketFactory2);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
/**
|
|
@@ -88,19 +92,16 @@ abstract contract PendleGaugeControllerBaseUpg is
|
|
|
88
92
|
* @notice receive voting results from VotingController. Only the first message for a timestamp
|
|
89
93
|
* will be accepted, all subsequent messages will be ignored
|
|
90
94
|
*/
|
|
91
|
-
function _receiveVotingResults(
|
|
92
|
-
uint128 wTime,
|
|
93
|
-
address[] memory markets,
|
|
94
|
-
uint256[] memory pendleAmounts
|
|
95
|
-
) internal {
|
|
95
|
+
function _receiveVotingResults(uint128 wTime, address[] memory markets, uint256[] memory pendleAmounts) internal {
|
|
96
96
|
if (markets.length != pendleAmounts.length) revert Errors.ArrayLengthMismatch();
|
|
97
97
|
|
|
98
98
|
if (epochRewardReceived[wTime]) return; // only accept the first message for the wTime
|
|
99
99
|
epochRewardReceived[wTime] = true;
|
|
100
100
|
|
|
101
101
|
for (uint256 i = 0; i < markets.length; ++i) {
|
|
102
|
-
if (!IPMarket(markets[i]).isExpired())
|
|
102
|
+
if (!IPMarket(markets[i]).isExpired()) {
|
|
103
103
|
_addRewardsToMarket(markets[i], pendleAmounts[i].Uint128());
|
|
104
|
+
}
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
emit ReceiveVotingResults(wTime, markets, pendleAmounts);
|
|
@@ -132,9 +133,7 @@ abstract contract PendleGaugeControllerBaseUpg is
|
|
|
132
133
|
* Pendle distributed to the accumulatedPendle
|
|
133
134
|
* @dev expect to update accumulatedPendle & lastUpdated in MarketRewardData
|
|
134
135
|
*/
|
|
135
|
-
function _getUpdatedMarketReward(
|
|
136
|
-
address market
|
|
137
|
-
) internal view returns (MarketRewardData memory) {
|
|
136
|
+
function _getUpdatedMarketReward(address market) internal view returns (MarketRewardData memory) {
|
|
138
137
|
MarketRewardData memory rwd = rewardData[market];
|
|
139
138
|
uint128 newLastUpdated = uint128(PMath.min(uint128(block.timestamp), rwd.incentiveEndsAt));
|
|
140
139
|
rwd.accumulatedPendle += rwd.pendlePerSec * (newLastUpdated - rwd.lastUpdated);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.17;
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import "./PendleGaugeControllerBaseUpg.sol";
|
|
5
5
|
import "../../interfaces/IPGaugeControllerMainchain.sol";
|
|
6
6
|
|
|
7
|
-
contract PendleGaugeControllerMainchainUpg is
|
|
8
|
-
PendleGaugeControllerBaseUpg,
|
|
9
|
-
IPGaugeControllerMainchain
|
|
10
|
-
{
|
|
7
|
+
contract PendleGaugeControllerMainchainUpg is PendleGaugeControllerBaseUpg, IPGaugeControllerMainchain {
|
|
11
8
|
address public immutable votingController;
|
|
12
9
|
|
|
13
10
|
modifier onlyVotingController() {
|
|
@@ -18,9 +15,11 @@ contract PendleGaugeControllerMainchainUpg is
|
|
|
18
15
|
constructor(
|
|
19
16
|
address _votingController,
|
|
20
17
|
address _pendle,
|
|
21
|
-
address _marketFactory
|
|
22
|
-
|
|
18
|
+
address _marketFactory,
|
|
19
|
+
address _marketFactory2
|
|
20
|
+
) PendleGaugeControllerBaseUpg(_pendle, _marketFactory, _marketFactory2) {
|
|
23
21
|
votingController = _votingController;
|
|
22
|
+
_disableInitializers();
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
function initialize() external initializer {
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.17;
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import "./PendleGaugeControllerBaseUpg.sol";
|
|
5
5
|
import "../CrossChainMsg/PendleMsgReceiverAppUpg.sol";
|
|
6
6
|
|
|
7
7
|
// solhint-disable no-empty-blocks
|
|
8
8
|
|
|
9
|
-
contract PendleGaugeControllerSidechainUpg is
|
|
10
|
-
PendleGaugeControllerBaseUpg,
|
|
11
|
-
PendleMsgReceiverAppUpg
|
|
12
|
-
{
|
|
9
|
+
contract PendleGaugeControllerSidechainUpg is PendleGaugeControllerBaseUpg, PendleMsgReceiverAppUpg {
|
|
13
10
|
constructor(
|
|
14
11
|
address _pendle,
|
|
15
12
|
address _marketFactory,
|
|
13
|
+
address _marketFactory2,
|
|
16
14
|
address _PendleMsgReceiveEndpointUpg
|
|
17
15
|
)
|
|
18
|
-
PendleGaugeControllerBaseUpg(_pendle, _marketFactory)
|
|
16
|
+
PendleGaugeControllerBaseUpg(_pendle, _marketFactory, _marketFactory2)
|
|
19
17
|
PendleMsgReceiverAppUpg(_PendleMsgReceiveEndpointUpg)
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
{
|
|
19
|
+
_disableInitializers();
|
|
20
|
+
}
|
|
22
21
|
|
|
23
22
|
function initialize() external initializer {
|
|
24
23
|
__BoringOwnable_init();
|
|
@@ -8,12 +8,7 @@ import "../core/libraries/BoringOwnableUpgradeable.sol";
|
|
|
8
8
|
import "../core/libraries/TokenHelper.sol";
|
|
9
9
|
import "../interfaces/IPMerkleDistributor.sol";
|
|
10
10
|
|
|
11
|
-
contract PendleMerkleDistributor is
|
|
12
|
-
IPMerkleDistributor,
|
|
13
|
-
UUPSUpgradeable,
|
|
14
|
-
BoringOwnableUpgradeable,
|
|
15
|
-
TokenHelper
|
|
16
|
-
{
|
|
11
|
+
contract PendleMerkleDistributor is IPMerkleDistributor, UUPSUpgradeable, BoringOwnableUpgradeable, TokenHelper {
|
|
17
12
|
address public immutable token;
|
|
18
13
|
|
|
19
14
|
bytes32 public merkleRoot;
|
|
@@ -74,11 +69,7 @@ contract PendleMerkleDistributor is
|
|
|
74
69
|
emit Verified(user, amountClaimable);
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
function _verifyMerkleData(
|
|
78
|
-
address user,
|
|
79
|
-
uint256 amount,
|
|
80
|
-
bytes32[] calldata proof
|
|
81
|
-
) internal view returns (bool) {
|
|
72
|
+
function _verifyMerkleData(address user, uint256 amount, bytes32[] calldata proof) internal view returns (bool) {
|
|
82
73
|
bytes32 leaf = keccak256(abi.encodePacked(user, amount));
|
|
83
74
|
return MerkleProof.verify(proof, merkleRoot, leaf);
|
|
84
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.17;
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
5
5
|
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
@@ -37,19 +37,14 @@ contract PendleFeeDistributor is UUPSUpgradeable, BoringOwnableUpgradeable, IPFe
|
|
|
37
37
|
_;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
constructor(
|
|
41
|
-
address _votingController,
|
|
42
|
-
address _vePendle,
|
|
43
|
-
address _rewardToken
|
|
44
|
-
) initializer {
|
|
40
|
+
constructor(address _votingController, address _vePendle, address _rewardToken) initializer {
|
|
45
41
|
votingController = _votingController;
|
|
46
42
|
vePendle = _vePendle;
|
|
47
43
|
token = _rewardToken;
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
function addPool(address pool, uint256 _startWeek) external onlyOwner {
|
|
51
|
-
if (!WeekMath.isValidWTime(_startWeek) || _startWeek == 0)
|
|
52
|
-
revert Errors.FDInvalidStartEpoch(_startWeek);
|
|
47
|
+
if (!WeekMath.isValidWTime(_startWeek) || _startWeek == 0) revert Errors.FDInvalidStartEpoch(_startWeek);
|
|
53
48
|
|
|
54
49
|
if (lastFundedWeek[pool] != 0) revert Errors.FDPoolAlreadyExists(pool);
|
|
55
50
|
|
|
@@ -70,8 +65,7 @@ contract PendleFeeDistributor is UUPSUpgradeable, BoringOwnableUpgradeable, IPFe
|
|
|
70
65
|
uint256 totalAmountToFund
|
|
71
66
|
) external onlyOwner {
|
|
72
67
|
uint256 length = pools.length;
|
|
73
|
-
if (wTimes.length != length || amounts.length != length)
|
|
74
|
-
revert Errors.ArrayLengthMismatch();
|
|
68
|
+
if (wTimes.length != length || amounts.length != length) revert Errors.ArrayLengthMismatch();
|
|
75
69
|
|
|
76
70
|
uint256 totalFunded = 0;
|
|
77
71
|
for (uint256 i = 0; i < length; ++i) {
|
|
@@ -79,17 +73,12 @@ contract PendleFeeDistributor is UUPSUpgradeable, BoringOwnableUpgradeable, IPFe
|
|
|
79
73
|
totalFunded += amounts[i].sum();
|
|
80
74
|
}
|
|
81
75
|
|
|
82
|
-
if (totalFunded != totalAmountToFund)
|
|
83
|
-
revert Errors.FDTotalAmountFundedNotMatch(totalFunded, totalAmountToFund);
|
|
76
|
+
if (totalFunded != totalAmountToFund) revert Errors.FDTotalAmountFundedNotMatch(totalFunded, totalAmountToFund);
|
|
84
77
|
|
|
85
78
|
IERC20(token).transferFrom(msg.sender, address(this), totalFunded);
|
|
86
79
|
}
|
|
87
80
|
|
|
88
|
-
function _fund(
|
|
89
|
-
address pool,
|
|
90
|
-
uint256[] calldata wTimes,
|
|
91
|
-
uint256[] calldata amounts
|
|
92
|
-
) internal ensureValidPool(pool) {
|
|
81
|
+
function _fund(address pool, uint256[] calldata wTimes, uint256[] calldata amounts) internal ensureValidPool(pool) {
|
|
93
82
|
if (wTimes.length != amounts.length) revert Errors.FDEpochLengthMismatch();
|
|
94
83
|
|
|
95
84
|
uint256 lastFunded = lastFundedWeek[pool];
|
|
@@ -100,8 +89,7 @@ contract PendleFeeDistributor is UUPSUpgradeable, BoringOwnableUpgradeable, IPFe
|
|
|
100
89
|
uint256 wTime = wTimes[i];
|
|
101
90
|
uint256 amount = amounts[i];
|
|
102
91
|
|
|
103
|
-
if (wTime != lastFunded + WeekMath.WEEK)
|
|
104
|
-
revert Errors.FDInvalidWTimeFund(lastFunded, wTime);
|
|
92
|
+
if (wTime != lastFunded + WeekMath.WEEK) revert Errors.FDInvalidWTimeFund(lastFunded, wTime);
|
|
105
93
|
|
|
106
94
|
fees[pool][wTime] += amount;
|
|
107
95
|
lastFunded += WeekMath.WEEK;
|
|
@@ -114,10 +102,7 @@ contract PendleFeeDistributor is UUPSUpgradeable, BoringOwnableUpgradeable, IPFe
|
|
|
114
102
|
lastFundedWeek[pool] = lastFunded;
|
|
115
103
|
}
|
|
116
104
|
|
|
117
|
-
function claimReward(address user, address[] calldata pools)
|
|
118
|
-
external
|
|
119
|
-
returns (uint256[] memory amountRewardOut)
|
|
120
|
-
{
|
|
105
|
+
function claimReward(address user, address[] calldata pools) external returns (uint256[] memory amountRewardOut) {
|
|
121
106
|
amountRewardOut = new uint256[](pools.length);
|
|
122
107
|
for (uint256 i = 0; i < pools.length; ) {
|
|
123
108
|
amountRewardOut[i] = _accumulateUserReward(pools[i], user);
|
|
@@ -132,11 +117,10 @@ contract PendleFeeDistributor is UUPSUpgradeable, BoringOwnableUpgradeable, IPFe
|
|
|
132
117
|
return allPools;
|
|
133
118
|
}
|
|
134
119
|
|
|
135
|
-
function _accumulateUserReward(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
120
|
+
function _accumulateUserReward(
|
|
121
|
+
address pool,
|
|
122
|
+
address user
|
|
123
|
+
) internal ensureValidPool(pool) returns (uint256 totalReward) {
|
|
140
124
|
uint256 length = _getUserCheckpointLength(pool, user);
|
|
141
125
|
if (length == 0) return 0;
|
|
142
126
|
|
|
@@ -180,10 +164,7 @@ contract PendleFeeDistributor is UUPSUpgradeable, BoringOwnableUpgradeable, IPFe
|
|
|
180
164
|
curWeek += WeekMath.WEEK;
|
|
181
165
|
}
|
|
182
166
|
|
|
183
|
-
userInfo[pool][user] = UserInfo({
|
|
184
|
-
firstUnclaimedWeek: uint128(curWeek),
|
|
185
|
-
iter: uint128(iter)
|
|
186
|
-
});
|
|
167
|
+
userInfo[pool][user] = UserInfo({firstUnclaimedWeek: uint128(curWeek), iter: uint128(iter)});
|
|
187
168
|
}
|
|
188
169
|
|
|
189
170
|
function _getPoolTotalSharesAt(address pool, uint128 wTime) internal view returns (uint256) {
|
|
@@ -194,11 +175,7 @@ contract PendleFeeDistributor is UUPSUpgradeable, BoringOwnableUpgradeable, IPFe
|
|
|
194
175
|
}
|
|
195
176
|
}
|
|
196
177
|
|
|
197
|
-
function _getUserCheckpointAt(
|
|
198
|
-
address pool,
|
|
199
|
-
address user,
|
|
200
|
-
uint256 index
|
|
201
|
-
) internal view returns (Checkpoint memory) {
|
|
178
|
+
function _getUserCheckpointAt(address pool, address user, uint256 index) internal view returns (Checkpoint memory) {
|
|
202
179
|
if (pool == vePendle) {
|
|
203
180
|
return IPVotingEscrowMainchain(vePendle).getUserHistoryAt(user, index);
|
|
204
181
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.17;
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
5
5
|
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
@@ -9,12 +9,7 @@ import "../../core/libraries/TokenHelper.sol";
|
|
|
9
9
|
import "../../core/libraries/Errors.sol";
|
|
10
10
|
import "../../interfaces/IPFeeDistributorV2.sol";
|
|
11
11
|
|
|
12
|
-
contract PendleFeeDistributorV2 is
|
|
13
|
-
UUPSUpgradeable,
|
|
14
|
-
BoringOwnableUpgradeable,
|
|
15
|
-
IPFeeDistributorV2,
|
|
16
|
-
TokenHelper
|
|
17
|
-
{
|
|
12
|
+
contract PendleFeeDistributorV2 is UUPSUpgradeable, BoringOwnableUpgradeable, IPFeeDistributorV2, TokenHelper {
|
|
18
13
|
bytes32 public merkleRoot;
|
|
19
14
|
|
|
20
15
|
struct ProtocolData {
|
|
@@ -52,10 +47,10 @@ contract PendleFeeDistributorV2 is
|
|
|
52
47
|
emit Claimed(user, amountOut);
|
|
53
48
|
}
|
|
54
49
|
|
|
55
|
-
function claimProtocol(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
50
|
+
function claimProtocol(
|
|
51
|
+
address receiver,
|
|
52
|
+
address[] calldata pools
|
|
53
|
+
) external returns (uint256 totalAmountOut, uint256[] memory amountsOut) {
|
|
59
54
|
unchecked {
|
|
60
55
|
address user = msg.sender;
|
|
61
56
|
|
|
@@ -81,11 +76,10 @@ contract PendleFeeDistributorV2 is
|
|
|
81
76
|
}
|
|
82
77
|
}
|
|
83
78
|
|
|
84
|
-
function getProtocolClaimables(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{
|
|
79
|
+
function getProtocolClaimables(
|
|
80
|
+
address user,
|
|
81
|
+
address[] calldata pools
|
|
82
|
+
) external view returns (uint256[] memory claimables) {
|
|
89
83
|
unchecked {
|
|
90
84
|
uint256 nPools = pools.length;
|
|
91
85
|
claimables = new uint256[](nPools);
|
|
@@ -103,21 +97,13 @@ contract PendleFeeDistributorV2 is
|
|
|
103
97
|
return protocol[user].totalAccrued;
|
|
104
98
|
}
|
|
105
99
|
|
|
106
|
-
function _verifyMerkleData(
|
|
107
|
-
address user,
|
|
108
|
-
uint256 amount,
|
|
109
|
-
bytes32[] calldata proof
|
|
110
|
-
) internal view returns (bool) {
|
|
100
|
+
function _verifyMerkleData(address user, uint256 amount, bytes32[] calldata proof) internal view returns (bool) {
|
|
111
101
|
bytes32 leaf = keccak256(abi.encodePacked(user, amount));
|
|
112
102
|
return MerkleProof.verify(proof, merkleRoot, leaf);
|
|
113
103
|
}
|
|
114
104
|
|
|
115
105
|
// ----------------- owner logic -----------------
|
|
116
|
-
function setMerkleRootAndFund(bytes32 newMerkleRoot, uint256 amountToFund)
|
|
117
|
-
external
|
|
118
|
-
payable
|
|
119
|
-
onlyOwner
|
|
120
|
-
{
|
|
106
|
+
function setMerkleRootAndFund(bytes32 newMerkleRoot, uint256 amountToFund) external payable onlyOwner {
|
|
121
107
|
_transferIn(NATIVE, msg.sender, amountToFund);
|
|
122
108
|
merkleRoot = newMerkleRoot;
|
|
123
109
|
emit SetMerkleRootAndFund(newMerkleRoot, amountToFund);
|
|
@@ -134,12 +120,12 @@ contract PendleFeeDistributorV2 is
|
|
|
134
120
|
|
|
135
121
|
function updateProtocolClaimable(UpdateProtocolStruct calldata ele) public onlyOwner {
|
|
136
122
|
unchecked {
|
|
137
|
-
(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
)
|
|
123
|
+
(address user, uint256[] calldata topUps, address[] calldata pools, bytes32[] calldata proof) = (
|
|
124
|
+
ele.user,
|
|
125
|
+
ele.topUps,
|
|
126
|
+
ele.pools,
|
|
127
|
+
ele.proof
|
|
128
|
+
);
|
|
143
129
|
|
|
144
130
|
uint256 nPools = pools.length;
|
|
145
131
|
if (nPools != topUps.length) revert Errors.ArrayLengthMismatch();
|
|
@@ -152,8 +138,7 @@ contract PendleFeeDistributorV2 is
|
|
|
152
138
|
}
|
|
153
139
|
|
|
154
140
|
uint256 newTotalAccrued = protocol[user].totalAccrued + sumTopUps;
|
|
155
|
-
if (!_verifyMerkleData(user, newTotalAccrued, proof))
|
|
156
|
-
revert Errors.InvalidMerkleProof();
|
|
141
|
+
if (!_verifyMerkleData(user, newTotalAccrued, proof)) revert Errors.InvalidMerkleProof();
|
|
157
142
|
|
|
158
143
|
protocol[user].totalAccrued = newTotalAccrued;
|
|
159
144
|
emit UpdateProtocolClaimable(user, sumTopUps);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.17;
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import "./VotingControllerStorageUpg.sol";
|
|
5
5
|
import "../CrossChainMsg/PendleMsgSenderAppUpg.sol";
|
|
@@ -32,11 +32,7 @@ Cons:
|
|
|
32
32
|
- Does not guarantee the reward will be distributed on epoch start and end
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
contract PendleVotingControllerUpg is
|
|
36
|
-
PendleMsgSenderAppUpg,
|
|
37
|
-
VotingControllerStorageUpg,
|
|
38
|
-
UUPSUpgradeable
|
|
39
|
-
{
|
|
35
|
+
contract PendleVotingControllerUpg is PendleMsgSenderAppUpg, VotingControllerStorageUpg, UUPSUpgradeable {
|
|
40
36
|
using VeBalanceLib for VeBalance;
|
|
41
37
|
using PMath for uint256;
|
|
42
38
|
using PMath for int256;
|
|
@@ -243,11 +239,7 @@ contract PendleVotingControllerUpg is
|
|
|
243
239
|
|
|
244
240
|
if (chainId == block.chainid) {
|
|
245
241
|
address gaugeController = destinationContracts.get(chainId);
|
|
246
|
-
IPGaugeControllerMainchain(gaugeController).updateVotingResults(
|
|
247
|
-
wTime,
|
|
248
|
-
pools,
|
|
249
|
-
totalPendleAmounts
|
|
250
|
-
);
|
|
242
|
+
IPGaugeControllerMainchain(gaugeController).updateVotingResults(wTime, pools, totalPendleAmounts);
|
|
251
243
|
} else {
|
|
252
244
|
_sendMessage(chainId, abi.encode(wTime, pools, totalPendleAmounts));
|
|
253
245
|
}
|
|
@@ -255,9 +247,7 @@ contract PendleVotingControllerUpg is
|
|
|
255
247
|
emit BroadcastResults(chainId, wTime, totalPendlePerSec);
|
|
256
248
|
}
|
|
257
249
|
|
|
258
|
-
function _getUserVePendlePosition(
|
|
259
|
-
address user
|
|
260
|
-
) internal view returns (LockedPosition memory userPosition) {
|
|
250
|
+
function _getUserVePendlePosition(address user) internal view returns (LockedPosition memory userPosition) {
|
|
261
251
|
if (user == owner) {
|
|
262
252
|
(userPosition.amount, userPosition.expiry) = (
|
|
263
253
|
GOVERNANCE_PENDLE_VOTE,
|