@pendle/core-v2 0.13.1-testnet → 0.14.0-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/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +89 -0
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +91 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +91 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.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 +26 -26
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
- package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield → StandardizedYield}/PYIndex.sol/PYIndexLib.json +3 -3
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/SCYBase.sol/SCYBase.json → StandardizedYield/SYBase.sol/SYBase.json} +11 -11
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/SCYBaseWithRewards.sol/SCYBaseWithRewards.json → StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.json} +11 -11
- package/build/artifacts/contracts/core/StandardizedYield/SYUtils.sol/SYUtils.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/SCYUtils.sol/SCYUtils.json → StandardizedYield/SYUtils.sol/SYUtils.json} +4 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield → StandardizedYield}/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +3 -3
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json → StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json} +17 -17
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.json +1028 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.json → StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.json} +47 -47
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield → StandardizedYield}/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +5 -5
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json → StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json} +13 -13
- 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 +4 -4
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +4 -4
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +24 -24
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +28 -28
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +30 -30
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +34 -34
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +20 -20
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.json +2 -2
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +20 -20
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +106 -106
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +18 -18
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.json +3 -3
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +6 -6
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{ISuperComposableYield.sol/ISuperComposableYield.json → IStandardizedYield.sol/IStandardizedYield.json} +5 -5
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +7 -7
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +116 -116
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +35 -35
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +12 -12
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +41 -41
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +28 -28
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +4 -4
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +22 -22
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +96 -27
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +40 -12
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +24 -5
- package/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol +133 -0
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +33 -0
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +8 -1
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +3 -3
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +2 -7
- package/contracts/core/Market/MarketMathCore.sol +50 -53
- package/contracts/core/Market/PendleGauge.sol +8 -8
- package/contracts/core/Market/PendleMarket.sol +49 -49
- package/contracts/core/Market/PendleMarketFactory.sol +1 -1
- package/contracts/core/RewardManager/RewardManager.sol +1 -1
- package/contracts/core/{SuperComposableYield → StandardizedYield}/PYIndex.sol +16 -16
- package/contracts/core/{SuperComposableYield/SCYBase.sol → StandardizedYield/SYBase.sol} +17 -17
- package/contracts/core/{SuperComposableYield/SCYBaseWithRewards.sol → StandardizedYield/SYBaseWithRewards.sol} +9 -9
- package/contracts/core/StandardizedYield/SYUtils.sol +26 -0
- package/contracts/core/{SuperComposableYield → StandardizedYield}/implementations/BenQi/PendleQiTokenHelper.sol +1 -1
- package/contracts/core/{SuperComposableYield/implementations/BenQi/PendleQiTokenSCY.sol → StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol} +10 -10
- package/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol +167 -0
- package/contracts/core/{SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol → StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol} +51 -70
- package/contracts/core/{SuperComposableYield → StandardizedYield}/implementations/Convex/Pendle3CrvHelper.sol +7 -7
- package/contracts/core/{SuperComposableYield/implementations/PendleWstEthSCY.sol → StandardizedYield/implementations/PendleWstEthSY.sol} +5 -5
- package/contracts/core/YieldContracts/InterestManagerYT.sol +7 -7
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +15 -15
- package/contracts/core/YieldContracts/PendleYieldToken.sol +71 -71
- package/contracts/core/libraries/Errors.sol +23 -21
- package/contracts/core/libraries/TokenHelper.sol +0 -33
- package/contracts/interfaces/Curve/ICrvPool.sol +2 -0
- package/contracts/interfaces/ILayerZeroEndpoint.sol +39 -0
- package/contracts/interfaces/ILayerZeroReceiver.sol +12 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +27 -27
- package/contracts/interfaces/IPActionMintRedeem.sol +30 -30
- package/contracts/interfaces/IPActionSwapPT.sol +16 -16
- package/contracts/interfaces/IPActionSwapPTYT.sol +2 -2
- package/contracts/interfaces/IPActionSwapYT.sol +16 -16
- package/contracts/interfaces/IPMarket.sol +14 -19
- package/contracts/interfaces/IPMarketSwapCallback.sol +1 -1
- package/contracts/interfaces/IPMsgSendEndpoint.sol +4 -2
- package/contracts/interfaces/IPPrincipalToken.sol +1 -1
- package/contracts/interfaces/IPYieldContractFactory.sol +3 -3
- package/contracts/interfaces/IPYieldToken.sol +7 -9
- package/contracts/interfaces/{ISuperComposableYield.sol → IStandardizedYield.sol} +6 -6
- package/contracts/offchain-helpers/MarketMathStatic.sol +116 -131
- package/contracts/offchain-helpers/RouterStatic.sol +80 -93
- package/contracts/router/ActionAddRemoveLiq.sol +99 -111
- package/contracts/router/ActionCallback.sol +46 -46
- package/contracts/router/ActionMintRedeem.sol +58 -58
- package/contracts/router/ActionSwapPT.sol +61 -69
- package/contracts/router/ActionSwapPTYT.sol +7 -7
- package/contracts/router/ActionSwapYT.sol +72 -79
- package/contracts/router/PendleRouter.sol +16 -16
- package/contracts/router/base/ActionBaseMintRedeem.sol +43 -43
- package/contracts/router/base/CallbackHelper.sol +20 -20
- package/contracts/router/base/MarketApproxLib.sol +166 -143
- package/contracts/router/kyberswap/KyberSwapHelper.sol +2 -2
- package/deployments/43113-core.json +16 -0
- package/{contracts/deployments → deployments}/43113-helper.json +0 -0
- 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/{contracts/deployments → deployments}/43113-testenv.json +0 -0
- package/deployments/80001-core.json +15 -0
- package/{contracts/deployments → deployments}/80001-testenv.json +0 -0
- package/package.json +2 -2
- package/typechain-types/ActionAddRemoveLiq.ts +127 -129
- package/typechain-types/ActionCallback.ts +5 -5
- package/typechain-types/ActionMintRedeem.ts +139 -141
- package/typechain-types/ActionSwapPT.ts +73 -73
- package/typechain-types/ActionSwapPTYT.ts +2 -2
- package/typechain-types/ActionSwapYT.ts +73 -73
- package/typechain-types/IPActionAddRemoveLiq.ts +127 -129
- package/typechain-types/IPActionMintRedeem.ts +139 -141
- package/typechain-types/IPActionSwapPT.ts +73 -73
- package/typechain-types/IPActionSwapPTYT.ts +2 -2
- package/typechain-types/IPActionSwapYT.ts +73 -73
- package/typechain-types/IPAllAction.ts +402 -406
- package/typechain-types/IPMarket.ts +51 -54
- package/typechain-types/IPMarketSwapCallback.ts +5 -5
- package/typechain-types/IPPrincipalToken.ts +8 -8
- package/typechain-types/IPYieldContractFactory.ts +13 -13
- package/typechain-types/IPYieldToken.ts +17 -17
- package/typechain-types/IStandardizedYield.ts +895 -0
- package/typechain-types/MarketMathStatic.ts +27 -27
- package/typechain-types/Pendle3CrvAndTokenSY.ts +1243 -0
- package/typechain-types/Pendle3CrvHelper.ts +13 -13
- package/typechain-types/PendleConvexLPSY.ts +1189 -0
- package/typechain-types/PendleGaugeControllerBaseUpg.ts +125 -0
- package/typechain-types/PendleGaugeControllerMainchainUpg.ts +125 -0
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +124 -0
- package/typechain-types/PendleMarket.ts +54 -57
- package/typechain-types/PendlePrincipalToken.ts +8 -8
- package/typechain-types/PendleQiTokenSY.ts +1166 -0
- package/typechain-types/PendleWstEthSY.ts +1040 -0
- package/typechain-types/PendleYieldContractFactory.ts +8 -8
- package/typechain-types/PendleYieldToken.ts +41 -44
- package/typechain-types/RouterStatic.ts +196 -196
- package/typechain-types/SYBase.ts +1001 -0
- package/typechain-types/SYBaseWithRewards.ts +1094 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +34 -34
- package/typechain-types/factories/ActionCallback__factory.ts +11 -11
- package/typechain-types/factories/ActionMintRedeem__factory.ts +38 -38
- package/typechain-types/factories/ActionMisc__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +3 -3
- package/typechain-types/factories/ActionSwapPT__factory.ts +27 -27
- package/typechain-types/factories/ActionSwapYT__factory.ts +21 -21
- package/typechain-types/factories/Errors__factory.ts +27 -27
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +30 -30
- package/typechain-types/factories/IPActionMintRedeem__factory.ts +34 -34
- package/typechain-types/factories/IPActionSwapPTYT__factory.ts +2 -2
- package/typechain-types/factories/IPActionSwapPT__factory.ts +20 -20
- package/typechain-types/factories/IPActionSwapYT__factory.ts +20 -20
- package/typechain-types/factories/IPAllAction__factory.ts +106 -106
- package/typechain-types/factories/IPMarketSwapCallback__factory.ts +1 -1
- package/typechain-types/factories/IPMarket__factory.ts +18 -18
- package/typechain-types/factories/IPPrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/IPYieldContractFactory__factory.ts +3 -3
- package/typechain-types/factories/IPYieldToken__factory.ts +6 -6
- package/typechain-types/factories/IStandardizedYield__factory.ts +658 -0
- package/typechain-types/factories/MarketMathStatic__factory.ts +6 -6
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/Pendle3CrvAndTokenSY__factory.ts +1124 -0
- package/typechain-types/factories/Pendle3CrvHelper__factory.ts +3 -3
- package/typechain-types/factories/PendleConvexLPSY__factory.ts +963 -0
- 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 +89 -0
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +90 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +90 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +21 -21
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +7 -7
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +1095 -0
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleWstEthSY__factory.ts +924 -0
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +3 -3
- package/typechain-types/factories/PendleYieldToken__factory.ts +27 -27
- package/typechain-types/factories/RouterStatic__factory.ts +57 -57
- package/typechain-types/factories/SYBaseWithRewards__factory.ts +867 -0
- package/typechain-types/factories/SYBase__factory.ts +795 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +33 -51
- package/typechain-types/index.ts +14 -18
- package/build/artifacts/contracts/core/SuperComposableYield/PYIndex.sol/PYIndexLib.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/SCYBase.sol/SCYBase.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/SCYUtils.sol/SCYUtils.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.json +0 -1030
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.json +0 -1025
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.json +0 -190
- package/contracts/core/SuperComposableYield/SCYUtils.sol +0 -34
- package/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol +0 -135
- package/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol +0 -96
- package/contracts/deployments/43113-core.json +0 -16
- package/contracts/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
- package/contracts/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
- package/contracts/deployments/80001-core.json +0 -15
- package/contracts/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
- package/contracts/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
- package/contracts/interfaces/ICelerMessageBus.sol +0 -28
- package/contracts/interfaces/ICelerMessageReceiverApp.sol +0 -25
- package/contracts/offchain-helpers/ImplicitSwapfeeContract.sol +0 -26
|
@@ -1,40 +1,72 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
pragma solidity 0.8.17;
|
|
3
3
|
|
|
4
|
-
import "../../interfaces/
|
|
4
|
+
import "../../interfaces/ILayerZeroEndpoint.sol";
|
|
5
5
|
import "../../interfaces/IPMsgReceiverApp.sol";
|
|
6
|
-
import "../../interfaces/
|
|
6
|
+
import "../../interfaces/ILayerZeroReceiver.sol";
|
|
7
7
|
import "../../core/libraries/BoringOwnableUpgradeable.sol";
|
|
8
8
|
import "../../core/libraries/Errors.sol";
|
|
9
|
+
import "./libraries/LayerZeroHelper.sol";
|
|
10
|
+
import "./libraries/ExcessivelySafeCall.sol";
|
|
9
11
|
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
10
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @dev Initially, currently we will use layer zero's default send and receive version (which is most updated)
|
|
15
|
+
* So we can leave the configuration unset.
|
|
16
|
+
*/
|
|
17
|
+
|
|
11
18
|
contract PendleMsgReceiveEndpointUpg is
|
|
12
|
-
|
|
19
|
+
ILayerZeroReceiver,
|
|
13
20
|
Initializable,
|
|
14
21
|
UUPSUpgradeable,
|
|
15
22
|
BoringOwnableUpgradeable
|
|
16
23
|
{
|
|
17
|
-
|
|
24
|
+
using ExcessivelySafeCall for address;
|
|
25
|
+
|
|
26
|
+
address public immutable lzEndpoint;
|
|
18
27
|
address public immutable sendEndpointAddr;
|
|
19
28
|
uint64 public immutable sendEndpointChainId;
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;
|
|
31
|
+
|
|
32
|
+
event MessageFailed(
|
|
33
|
+
uint16 _srcChainId,
|
|
34
|
+
bytes _path,
|
|
35
|
+
uint64 _nonce,
|
|
36
|
+
bytes _payload,
|
|
37
|
+
bytes _reason
|
|
38
|
+
);
|
|
39
|
+
event RetryMessageSuccess(
|
|
40
|
+
uint16 _srcChainId,
|
|
41
|
+
bytes _path,
|
|
42
|
+
uint64 _nonce,
|
|
43
|
+
bytes32 _payloadHash
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
modifier onlyLzEndpoint() {
|
|
47
|
+
if (msg.sender != address(lzEndpoint)) revert Errors.OnlyLayerZeroEndpoint();
|
|
23
48
|
_;
|
|
24
49
|
}
|
|
25
50
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
51
|
+
/**
|
|
52
|
+
* @dev Lz has a built-in feature for trusted receive and send endpoint
|
|
53
|
+
* But in order to aim for flexibility in switching to other crosschain messaging protocol, there
|
|
54
|
+
* is no harm to keep our current whitelisting mechanism.
|
|
55
|
+
*/
|
|
56
|
+
modifier mustOriginateFromSendEndpoint(uint16 srcChainId, bytes memory path) {
|
|
57
|
+
if (
|
|
58
|
+
sendEndpointAddr != LayerZeroHelper._getSrcAdrressFromPath(path) ||
|
|
59
|
+
sendEndpointChainId != LayerZeroHelper._getOriginalChainIds(srcChainId)
|
|
60
|
+
) revert Errors.MsgNotFromSendEndpoint(msg.sender);
|
|
29
61
|
_;
|
|
30
62
|
}
|
|
31
63
|
|
|
32
64
|
constructor(
|
|
33
|
-
|
|
65
|
+
address _lzEndpoint,
|
|
34
66
|
address _sendEndpointAddr,
|
|
35
67
|
uint64 _sendEndpointChainId
|
|
36
68
|
) initializer {
|
|
37
|
-
|
|
69
|
+
lzEndpoint = _lzEndpoint;
|
|
38
70
|
sendEndpointAddr = _sendEndpointAddr;
|
|
39
71
|
sendEndpointChainId = _sendEndpointChainId;
|
|
40
72
|
}
|
|
@@ -43,22 +75,55 @@ contract PendleMsgReceiveEndpointUpg is
|
|
|
43
75
|
__BoringOwnable_init();
|
|
44
76
|
}
|
|
45
77
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
uint64
|
|
50
|
-
bytes calldata
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
function lzReceive(
|
|
79
|
+
uint16 _srcChainId,
|
|
80
|
+
bytes calldata _path,
|
|
81
|
+
uint64 _nonce,
|
|
82
|
+
bytes calldata _payload
|
|
83
|
+
) external onlyLzEndpoint mustOriginateFromSendEndpoint(_srcChainId, _path) {
|
|
84
|
+
(bool success, bytes memory reason) = address(this).excessivelySafeCall(
|
|
85
|
+
gasleft(),
|
|
86
|
+
150,
|
|
87
|
+
abi.encodeWithSelector(this.nonBlockingReceive.selector, _payload)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
if (!success) {
|
|
91
|
+
failedMessages[_srcChainId][_path][_nonce] = keccak256(_payload);
|
|
92
|
+
emit MessageFailed(_srcChainId, _path, _nonce, _payload, reason);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function retryMessage(
|
|
97
|
+
uint16 _srcChainId,
|
|
98
|
+
bytes calldata _path,
|
|
99
|
+
uint64 _nonce,
|
|
100
|
+
bytes calldata _payload
|
|
101
|
+
) public payable virtual {
|
|
102
|
+
bytes32 payloadHash = failedMessages[_srcChainId][_path][_nonce];
|
|
103
|
+
|
|
104
|
+
if (payloadHash == bytes32(0) || keccak256(_payload) != payloadHash)
|
|
105
|
+
revert Errors.InvalidRetryData();
|
|
106
|
+
|
|
107
|
+
failedMessages[_srcChainId][_path][_nonce] = bytes32(0);
|
|
108
|
+
nonBlockingReceive(_payload);
|
|
109
|
+
emit RetryMessageSuccess(_srcChainId, _path, _nonce, payloadHash);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @dev LayerZero by default will stop all the incoming messages once some message failed to execute
|
|
114
|
+
* In the very extreme case that it fails to deliver some message to Pendle, we still want the crosschain
|
|
115
|
+
* messaging feature to keep functioning.
|
|
116
|
+
*
|
|
117
|
+
* @dev As the nature of all type of messages we have:
|
|
118
|
+
* - Update vePendle totalSupply
|
|
119
|
+
* - Update vePendle user balance
|
|
120
|
+
* - Send voting result to GaugeController
|
|
121
|
+
*
|
|
122
|
+
* There is not a need to ensure the index order of messages
|
|
123
|
+
*/
|
|
124
|
+
function nonBlockingReceive(bytes memory payload) public {
|
|
125
|
+
(address receiver, bytes memory message) = abi.decode(payload, (address, bytes));
|
|
126
|
+
IPMsgReceiverApp(receiver).executeMessage(message);
|
|
62
127
|
}
|
|
63
128
|
|
|
64
129
|
function govExecuteMessage(address receiver, bytes calldata message)
|
|
@@ -69,6 +134,10 @@ contract PendleMsgReceiveEndpointUpg is
|
|
|
69
134
|
IPMsgReceiverApp(receiver).executeMessage(message);
|
|
70
135
|
}
|
|
71
136
|
|
|
137
|
+
function setReceiveVersion(uint16 _newVersion) external {
|
|
138
|
+
ILayerZeroEndpoint(lzEndpoint).setReceiveVersion(_newVersion);
|
|
139
|
+
}
|
|
140
|
+
|
|
72
141
|
//solhint-disable-next-line
|
|
73
142
|
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
|
74
143
|
}
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
pragma solidity 0.8.17;
|
|
3
3
|
|
|
4
4
|
import "../../interfaces/IPMsgSendEndpoint.sol";
|
|
5
|
-
import "../../interfaces/
|
|
5
|
+
import "../../interfaces/ILayerZeroEndpoint.sol";
|
|
6
6
|
import "../../core/libraries/BoringOwnableUpgradeable.sol";
|
|
7
7
|
import "../../core/libraries/Errors.sol";
|
|
8
|
+
import "./libraries/LayerZeroHelper.sol";
|
|
8
9
|
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
|
|
9
10
|
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @dev Initially, currently we will use layer zero's default send and receive version (which is most updated)
|
|
14
|
+
* So we can leave the configuration unset.
|
|
15
|
+
*/
|
|
16
|
+
|
|
11
17
|
contract PendleMsgSendEndpointUpg is
|
|
12
18
|
IPMsgSendEndpoint,
|
|
13
19
|
Initializable,
|
|
@@ -16,7 +22,9 @@ contract PendleMsgSendEndpointUpg is
|
|
|
16
22
|
{
|
|
17
23
|
using EnumerableMap for EnumerableMap.UintToAddressMap;
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
address payable public immutable refundAddress;
|
|
26
|
+
ILayerZeroEndpoint public immutable lzEndpoint;
|
|
27
|
+
|
|
20
28
|
EnumerableMap.UintToAddressMap internal receiveEndpoints;
|
|
21
29
|
mapping(address => bool) public isWhitelisted;
|
|
22
30
|
|
|
@@ -25,8 +33,9 @@ contract PendleMsgSendEndpointUpg is
|
|
|
25
33
|
_;
|
|
26
34
|
}
|
|
27
35
|
|
|
28
|
-
constructor(
|
|
29
|
-
|
|
36
|
+
constructor(address _refundAddress, ILayerZeroEndpoint _lzEndpoint) initializer {
|
|
37
|
+
refundAddress = payable(_refundAddress);
|
|
38
|
+
lzEndpoint = _lzEndpoint;
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
function initialize() external initializer {
|
|
@@ -35,21 +44,36 @@ contract PendleMsgSendEndpointUpg is
|
|
|
35
44
|
|
|
36
45
|
function calcFee(
|
|
37
46
|
address dstAddress,
|
|
38
|
-
uint256
|
|
39
|
-
bytes memory
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
uint256 dstChainId,
|
|
48
|
+
bytes memory payload,
|
|
49
|
+
bytes memory adapterParams
|
|
50
|
+
) external view returns (uint256 fee) {
|
|
51
|
+
(fee, ) = lzEndpoint.estimateFees(
|
|
52
|
+
LayerZeroHelper._getLayerZeroChainIds(dstChainId),
|
|
53
|
+
receiveEndpoints.get(dstChainId),
|
|
54
|
+
abi.encode(dstAddress, payload),
|
|
55
|
+
false,
|
|
56
|
+
adapterParams
|
|
57
|
+
);
|
|
42
58
|
}
|
|
43
59
|
|
|
44
60
|
function sendMessage(
|
|
45
61
|
address dstAddress,
|
|
46
62
|
uint256 dstChainId,
|
|
47
|
-
bytes calldata
|
|
63
|
+
bytes calldata payload,
|
|
64
|
+
bytes calldata adapterParams
|
|
48
65
|
) external payable onlyWhitelisted {
|
|
49
|
-
|
|
66
|
+
bytes memory path = abi.encodePacked(
|
|
50
67
|
receiveEndpoints.get(dstChainId),
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
address(this)
|
|
69
|
+
);
|
|
70
|
+
lzEndpoint.send{ value: msg.value }(
|
|
71
|
+
LayerZeroHelper._getLayerZeroChainIds(dstChainId),
|
|
72
|
+
path,
|
|
73
|
+
abi.encode(dstAddress, payload),
|
|
74
|
+
refundAddress,
|
|
75
|
+
address(0),
|
|
76
|
+
adapterParams
|
|
53
77
|
);
|
|
54
78
|
}
|
|
55
79
|
|
|
@@ -65,6 +89,10 @@ contract PendleMsgSendEndpointUpg is
|
|
|
65
89
|
isWhitelisted[addr] = status;
|
|
66
90
|
}
|
|
67
91
|
|
|
92
|
+
function setLzSendVersion(uint16 _newVersion) external onlyOwner {
|
|
93
|
+
ILayerZeroEndpoint(lzEndpoint).setSendVersion(_newVersion);
|
|
94
|
+
}
|
|
95
|
+
|
|
68
96
|
function getAllReceiveEndpoints()
|
|
69
97
|
external
|
|
70
98
|
view
|
|
@@ -8,12 +8,14 @@ import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
|
|
|
8
8
|
|
|
9
9
|
// solhint-disable no-empty-blocks
|
|
10
10
|
/// This contract is upgradable because
|
|
11
|
-
/// - its constructor only sets immutable
|
|
11
|
+
/// - its constructor only sets immutable varia\bles
|
|
12
12
|
/// - it has storage gaps for safe addition of future variables
|
|
13
13
|
/// - it inherits only upgradable contract
|
|
14
14
|
abstract contract PendleMsgSenderAppUpg is BoringOwnableUpgradeable {
|
|
15
15
|
using EnumerableMap for EnumerableMap.UintToAddressMap;
|
|
16
16
|
|
|
17
|
+
uint256 public approxDstExecutionGas;
|
|
18
|
+
|
|
17
19
|
IPMsgSendEndpoint public immutable pendleMsgSendEndpoint;
|
|
18
20
|
|
|
19
21
|
// destinationContracts mapping contains one address for each chainId only
|
|
@@ -35,11 +37,12 @@ abstract contract PendleMsgSenderAppUpg is BoringOwnableUpgradeable {
|
|
|
35
37
|
function _sendMessage(uint256 chainId, bytes memory message) internal {
|
|
36
38
|
assert(destinationContracts.contains(chainId));
|
|
37
39
|
address toAddr = destinationContracts.get(chainId);
|
|
38
|
-
|
|
40
|
+
bytes memory adapterParams = _getAdapterParams();
|
|
41
|
+
uint256 fee = pendleMsgSendEndpoint.calcFee(toAddr, chainId, message, adapterParams);
|
|
39
42
|
// LM contracts won't hold ETH on its own so this is fine
|
|
40
43
|
if (address(this).balance < fee)
|
|
41
44
|
revert Errors.InsufficientFeeToSendMsg(address(this).balance, fee);
|
|
42
|
-
pendleMsgSendEndpoint.sendMessage{ value: fee }(toAddr, chainId, message);
|
|
45
|
+
pendleMsgSendEndpoint.sendMessage{ value: fee }(toAddr, chainId, message, adapterParams);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
function addDestinationContract(address _address, uint256 _chainId)
|
|
@@ -48,7 +51,10 @@ abstract contract PendleMsgSenderAppUpg is BoringOwnableUpgradeable {
|
|
|
48
51
|
onlyOwner
|
|
49
52
|
{
|
|
50
53
|
destinationContracts.set(_chainId, _address);
|
|
51
|
-
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function setApproxDstExecutionGas(uint256 gas) external onlyOwner {
|
|
57
|
+
approxDstExecutionGas = gas;
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
function getAllDestinationContracts()
|
|
@@ -65,5 +71,18 @@ abstract contract PendleMsgSenderAppUpg is BoringOwnableUpgradeable {
|
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
|
|
68
|
-
function
|
|
74
|
+
function _getAdapterParams() internal view returns (bytes memory) {
|
|
75
|
+
uint256 gas = approxDstExecutionGas;
|
|
76
|
+
if (gas == 0) revert Errors.ApproxDstExecutionGasNotSet();
|
|
77
|
+
// (version, gas consumption)
|
|
78
|
+
return abi.encodePacked(uint16(1), gas);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function _getSendMessageFee(
|
|
82
|
+
address dstContract,
|
|
83
|
+
uint256 chainId,
|
|
84
|
+
bytes memory message
|
|
85
|
+
) internal view returns (uint256) {
|
|
86
|
+
return pendleMsgSendEndpoint.calcFee(dstContract, chainId, message, _getAdapterParams());
|
|
87
|
+
}
|
|
69
88
|
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
2
|
+
pragma solidity >=0.7.6;
|
|
3
|
+
|
|
4
|
+
library ExcessivelySafeCall {
|
|
5
|
+
uint256 constant LOW_28_MASK =
|
|
6
|
+
0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
|
|
7
|
+
|
|
8
|
+
/// @notice Use when you _really_ really _really_ don't trust the called
|
|
9
|
+
/// contract. This prevents the called contract from causing reversion of
|
|
10
|
+
/// the caller in as many ways as we can.
|
|
11
|
+
/// @dev The main difference between this and a solidity low-level call is
|
|
12
|
+
/// that we limit the number of bytes that the callee can cause to be
|
|
13
|
+
/// copied to caller memory. This prevents stupid things like malicious
|
|
14
|
+
/// contracts returning 10,000,000 bytes causing a local OOG when copying
|
|
15
|
+
/// to memory.
|
|
16
|
+
/// @param _target The address to call
|
|
17
|
+
/// @param _gas The amount of gas to forward to the remote contract
|
|
18
|
+
/// @param _maxCopy The maximum number of bytes of returndata to copy
|
|
19
|
+
/// to memory.
|
|
20
|
+
/// @param _calldata The data to send to the remote contract
|
|
21
|
+
/// @return success and returndata, as `.call()`. Returndata is capped to
|
|
22
|
+
/// `_maxCopy` bytes.
|
|
23
|
+
function excessivelySafeCall(
|
|
24
|
+
address _target,
|
|
25
|
+
uint256 _gas,
|
|
26
|
+
uint16 _maxCopy,
|
|
27
|
+
bytes memory _calldata
|
|
28
|
+
) internal returns (bool, bytes memory) {
|
|
29
|
+
// set up for assembly call
|
|
30
|
+
uint256 _toCopy;
|
|
31
|
+
bool _success;
|
|
32
|
+
bytes memory _returnData = new bytes(_maxCopy);
|
|
33
|
+
// dispatch message to recipient
|
|
34
|
+
// by assembly calling "handle" function
|
|
35
|
+
// we call via assembly to avoid memcopying a very large returndata
|
|
36
|
+
// returned by a malicious contract
|
|
37
|
+
assembly {
|
|
38
|
+
_success := call(
|
|
39
|
+
_gas, // gas
|
|
40
|
+
_target, // recipient
|
|
41
|
+
0, // ether value
|
|
42
|
+
add(_calldata, 0x20), // inloc
|
|
43
|
+
mload(_calldata), // inlen
|
|
44
|
+
0, // outloc
|
|
45
|
+
0 // outlen
|
|
46
|
+
)
|
|
47
|
+
// limit our copy to 256 bytes
|
|
48
|
+
_toCopy := returndatasize()
|
|
49
|
+
if gt(_toCopy, _maxCopy) {
|
|
50
|
+
_toCopy := _maxCopy
|
|
51
|
+
}
|
|
52
|
+
// Store the length of the copied bytes
|
|
53
|
+
mstore(_returnData, _toCopy)
|
|
54
|
+
// copy the bytes from returndata[0:_toCopy]
|
|
55
|
+
returndatacopy(add(_returnData, 0x20), 0, _toCopy)
|
|
56
|
+
}
|
|
57
|
+
return (_success, _returnData);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/// @notice Use when you _really_ really _really_ don't trust the called
|
|
61
|
+
/// contract. This prevents the called contract from causing reversion of
|
|
62
|
+
/// the caller in as many ways as we can.
|
|
63
|
+
/// @dev The main difference between this and a solidity low-level call is
|
|
64
|
+
/// that we limit the number of bytes that the callee can cause to be
|
|
65
|
+
/// copied to caller memory. This prevents stupid things like malicious
|
|
66
|
+
/// contracts returning 10,000,000 bytes causing a local OOG when copying
|
|
67
|
+
/// to memory.
|
|
68
|
+
/// @param _target The address to call
|
|
69
|
+
/// @param _gas The amount of gas to forward to the remote contract
|
|
70
|
+
/// @param _maxCopy The maximum number of bytes of returndata to copy
|
|
71
|
+
/// to memory.
|
|
72
|
+
/// @param _calldata The data to send to the remote contract
|
|
73
|
+
/// @return success and returndata, as `.call()`. Returndata is capped to
|
|
74
|
+
/// `_maxCopy` bytes.
|
|
75
|
+
function excessivelySafeStaticCall(
|
|
76
|
+
address _target,
|
|
77
|
+
uint256 _gas,
|
|
78
|
+
uint16 _maxCopy,
|
|
79
|
+
bytes memory _calldata
|
|
80
|
+
) internal view returns (bool, bytes memory) {
|
|
81
|
+
// set up for assembly call
|
|
82
|
+
uint256 _toCopy;
|
|
83
|
+
bool _success;
|
|
84
|
+
bytes memory _returnData = new bytes(_maxCopy);
|
|
85
|
+
// dispatch message to recipient
|
|
86
|
+
// by assembly calling "handle" function
|
|
87
|
+
// we call via assembly to avoid memcopying a very large returndata
|
|
88
|
+
// returned by a malicious contract
|
|
89
|
+
assembly {
|
|
90
|
+
_success := staticcall(
|
|
91
|
+
_gas, // gas
|
|
92
|
+
_target, // recipient
|
|
93
|
+
add(_calldata, 0x20), // inloc
|
|
94
|
+
mload(_calldata), // inlen
|
|
95
|
+
0, // outloc
|
|
96
|
+
0 // outlen
|
|
97
|
+
)
|
|
98
|
+
// limit our copy to 256 bytes
|
|
99
|
+
_toCopy := returndatasize()
|
|
100
|
+
if gt(_toCopy, _maxCopy) {
|
|
101
|
+
_toCopy := _maxCopy
|
|
102
|
+
}
|
|
103
|
+
// Store the length of the copied bytes
|
|
104
|
+
mstore(_returnData, _toCopy)
|
|
105
|
+
// copy the bytes from returndata[0:_toCopy]
|
|
106
|
+
returndatacopy(add(_returnData, 0x20), 0, _toCopy)
|
|
107
|
+
}
|
|
108
|
+
return (_success, _returnData);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @notice Swaps function selectors in encoded contract calls
|
|
113
|
+
* @dev Allows reuse of encoded calldata for functions with identical
|
|
114
|
+
* argument types but different names. It simply swaps out the first 4 bytes
|
|
115
|
+
* for the new selector. This function modifies memory in place, and should
|
|
116
|
+
* only be used with caution.
|
|
117
|
+
* @param _newSelector The new 4-byte selector
|
|
118
|
+
* @param _buf The encoded contract args
|
|
119
|
+
*/
|
|
120
|
+
function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure {
|
|
121
|
+
require(_buf.length >= 4);
|
|
122
|
+
uint256 _mask = LOW_28_MASK;
|
|
123
|
+
assembly {
|
|
124
|
+
// load the first word of
|
|
125
|
+
let _word := mload(add(_buf, 0x20))
|
|
126
|
+
// mask out the top 4 bytes
|
|
127
|
+
// /x
|
|
128
|
+
_word := and(_word, _mask)
|
|
129
|
+
_word := or(_newSelector, _word)
|
|
130
|
+
mstore(add(_buf, 0x20), _word)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
library LayerZeroHelper {
|
|
6
|
+
uint256 constant EVM_ADDRESS_SIZE = 20;
|
|
7
|
+
|
|
8
|
+
function _getLayerZeroChainIds(uint256 chainId) internal pure returns (uint16) {
|
|
9
|
+
if (chainId == 43113) return 10106; // fuji testnet
|
|
10
|
+
else if (chainId == 80001) return 10109; // mumbai testnet
|
|
11
|
+
else if (chainId == 43114) return 106; // avax mainnet
|
|
12
|
+
revert("");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function _getOriginalChainIds(uint16 chainId) internal pure returns (uint256) {
|
|
16
|
+
if (chainId == 10106) return 43113; // fuji testnet
|
|
17
|
+
else if (chainId == 10109) return 80001; // mumbai testnet
|
|
18
|
+
else if (chainId == 106) return 43114; // avax mainnet
|
|
19
|
+
revert("");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function _getSrcAdrressFromPath(bytes memory path) internal pure returns (address src) {
|
|
23
|
+
assembly {
|
|
24
|
+
src := mload(add(add(path, EVM_ADDRESS_SIZE), EVM_ADDRESS_SIZE))
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _getDstAddressFromPath(bytes memory path) internal pure returns (address dst) {
|
|
29
|
+
assembly {
|
|
30
|
+
dst := mload(add(add(path, EVM_ADDRESS_SIZE), 0))
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -14,6 +14,7 @@ import "../../interfaces/IPMarket.sol";
|
|
|
14
14
|
|
|
15
15
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
16
16
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
17
|
+
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* @dev Gauge controller provides no write function to any party other than voting controller
|
|
@@ -28,7 +29,11 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
|
28
29
|
/// - its constructor only sets immutable variables
|
|
29
30
|
/// - it has storage gaps for safe addition of future variables
|
|
30
31
|
/// - it inherits only upgradable contract
|
|
31
|
-
abstract contract PendleGaugeControllerBaseUpg is
|
|
32
|
+
abstract contract PendleGaugeControllerBaseUpg is
|
|
33
|
+
IPGaugeController,
|
|
34
|
+
BoringOwnableUpgradeable,
|
|
35
|
+
UUPSUpgradeable
|
|
36
|
+
{
|
|
32
37
|
using SafeERC20 for IERC20;
|
|
33
38
|
using Math for uint256;
|
|
34
39
|
|
|
@@ -148,4 +153,6 @@ abstract contract PendleGaugeControllerBaseUpg is IPGaugeController, BoringOwnab
|
|
|
148
153
|
rwd.lastUpdated = newLastUpdated;
|
|
149
154
|
return rwd;
|
|
150
155
|
}
|
|
156
|
+
|
|
157
|
+
function _authorizeUpgrade(address) internal virtual override onlyOwner {}
|
|
151
158
|
}
|
|
@@ -21,7 +21,7 @@ Voting accounting:
|
|
|
21
21
|
will receive both of the reward pack
|
|
22
22
|
- Each pack of money will has it own id as timestamp, a gauge controller does not
|
|
23
23
|
receive a pack of money with the same id twice, this allow governance to rebroadcast
|
|
24
|
-
in case the last message was corrupted by
|
|
24
|
+
in case the last message was corrupted by LayerZero
|
|
25
25
|
|
|
26
26
|
Pros:
|
|
27
27
|
- If governance does not forget broadcasting the reward on the early of the week,
|
|
@@ -196,7 +196,7 @@ contract PendleVotingControllerUpg is
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
* @notice use the gov-privilege to force broadcast a message in case there are issues with
|
|
199
|
+
* @notice use the gov-privilege to force broadcast a message in case there are issues with LayerZero
|
|
200
200
|
* @dev it's intentional for this function to have minimal checks since we assume gov has done the
|
|
201
201
|
due diligence
|
|
202
202
|
* @dev gov should always call finalizeEpoch beforehand
|
|
@@ -233,7 +233,7 @@ contract PendleVotingControllerUpg is
|
|
|
233
233
|
uint256[] memory totalPendleAmounts = new uint256[](length);
|
|
234
234
|
|
|
235
235
|
return
|
|
236
|
-
|
|
236
|
+
_getSendMessageFee(
|
|
237
237
|
destinationContracts.get(chainId),
|
|
238
238
|
chainId,
|
|
239
239
|
abi.encode(uint128(0), pools, totalPendleAmounts)
|
|
@@ -181,7 +181,7 @@ contract VotingEscrowPendleMainchain is
|
|
|
181
181
|
{
|
|
182
182
|
fees = new uint256[](chainIds.length);
|
|
183
183
|
for (uint256 i = 0; i < chainIds.length; i++) {
|
|
184
|
-
fees[i] =
|
|
184
|
+
fees[i] = _getSendMessageFee(
|
|
185
185
|
destinationContracts.get(chainIds[i]),
|
|
186
186
|
chainIds[i],
|
|
187
187
|
SAMPLE_SUPPLY_UPDATE_MESSAGE
|
|
@@ -196,7 +196,7 @@ contract VotingEscrowPendleMainchain is
|
|
|
196
196
|
{
|
|
197
197
|
fees = new uint256[](chainIds.length);
|
|
198
198
|
for (uint256 i = 0; i < chainIds.length; i++) {
|
|
199
|
-
fees[i] =
|
|
199
|
+
fees[i] = _getSendMessageFee(
|
|
200
200
|
destinationContracts.get(chainIds[i]),
|
|
201
201
|
chainIds[i],
|
|
202
202
|
SAMPLE_POSITION_UPDATE_MESSAGE
|
|
@@ -295,11 +295,6 @@ contract VotingEscrowPendleMainchain is
|
|
|
295
295
|
emit BroadcastTotalSupply(supply, chainIds);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
function _afterAddDestinationContract(address, uint256 chainId) internal virtual override {
|
|
299
|
-
(VeBalance memory supply, uint128 wTime) = _applySlopeChange();
|
|
300
|
-
_broadcast(chainId, wTime, supply, EMPTY_BYTES);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
298
|
function _broadcast(
|
|
304
299
|
uint256 chainId,
|
|
305
300
|
uint128 wTime,
|