@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
|
@@ -4,13 +4,13 @@ pragma solidity 0.8.17;
|
|
|
4
4
|
import "../libraries/math/Math.sol";
|
|
5
5
|
import "../libraries/math/LogExpMath.sol";
|
|
6
6
|
|
|
7
|
-
import "../
|
|
7
|
+
import "../StandardizedYield/PYIndex.sol";
|
|
8
8
|
import "../libraries/MiniHelpers.sol";
|
|
9
9
|
import "../libraries/Errors.sol";
|
|
10
10
|
|
|
11
11
|
struct MarketState {
|
|
12
12
|
int256 totalPt;
|
|
13
|
-
int256
|
|
13
|
+
int256 totalSy;
|
|
14
14
|
int256 totalLp;
|
|
15
15
|
address treasury;
|
|
16
16
|
/// immutable variables ///
|
|
@@ -53,7 +53,7 @@ library MarketMathCore {
|
|
|
53
53
|
|
|
54
54
|
function addLiquidity(
|
|
55
55
|
MarketState memory market,
|
|
56
|
-
uint256
|
|
56
|
+
uint256 syDesired,
|
|
57
57
|
uint256 ptDesired,
|
|
58
58
|
uint256 blockTime
|
|
59
59
|
)
|
|
@@ -62,69 +62,66 @@ library MarketMathCore {
|
|
|
62
62
|
returns (
|
|
63
63
|
uint256 lpToReserve,
|
|
64
64
|
uint256 lpToAccount,
|
|
65
|
-
uint256
|
|
65
|
+
uint256 syUsed,
|
|
66
66
|
uint256 ptUsed
|
|
67
67
|
)
|
|
68
68
|
{
|
|
69
69
|
(
|
|
70
70
|
int256 _lpToReserve,
|
|
71
71
|
int256 _lpToAccount,
|
|
72
|
-
int256
|
|
72
|
+
int256 _syUsed,
|
|
73
73
|
int256 _ptUsed
|
|
74
|
-
) = addLiquidityCore(market,
|
|
74
|
+
) = addLiquidityCore(market, syDesired.Int(), ptDesired.Int(), blockTime);
|
|
75
75
|
|
|
76
76
|
lpToReserve = _lpToReserve.Uint();
|
|
77
77
|
lpToAccount = _lpToAccount.Uint();
|
|
78
|
-
|
|
78
|
+
syUsed = _syUsed.Uint();
|
|
79
79
|
ptUsed = _ptUsed.Uint();
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
function removeLiquidity(MarketState memory market, uint256 lpToRemove)
|
|
83
83
|
internal
|
|
84
84
|
pure
|
|
85
|
-
returns (uint256
|
|
85
|
+
returns (uint256 syToAccount, uint256 netPtToAccount)
|
|
86
86
|
{
|
|
87
|
-
(int256
|
|
88
|
-
market,
|
|
89
|
-
lpToRemove.Int()
|
|
90
|
-
);
|
|
87
|
+
(int256 _syToAccount, int256 _ptToAccount) = removeLiquidityCore(market, lpToRemove.Int());
|
|
91
88
|
|
|
92
|
-
|
|
89
|
+
syToAccount = _syToAccount.Uint();
|
|
93
90
|
netPtToAccount = _ptToAccount.Uint();
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
function
|
|
93
|
+
function swapExactPtForSy(
|
|
97
94
|
MarketState memory market,
|
|
98
95
|
PYIndex index,
|
|
99
96
|
uint256 exactPtToMarket,
|
|
100
97
|
uint256 blockTime
|
|
101
|
-
) internal pure returns (uint256
|
|
102
|
-
(int256
|
|
98
|
+
) internal pure returns (uint256 netSyToAccount, uint256 netSyToReserve) {
|
|
99
|
+
(int256 _netSyToAccount, int256 _netSyToReserve) = executeTradeCore(
|
|
103
100
|
market,
|
|
104
101
|
index,
|
|
105
102
|
exactPtToMarket.neg(),
|
|
106
103
|
blockTime
|
|
107
104
|
);
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
netSyToAccount = _netSyToAccount.Uint();
|
|
107
|
+
netSyToReserve = _netSyToReserve.Uint();
|
|
111
108
|
}
|
|
112
109
|
|
|
113
|
-
function
|
|
110
|
+
function swapSyForExactPt(
|
|
114
111
|
MarketState memory market,
|
|
115
112
|
PYIndex index,
|
|
116
113
|
uint256 exactPtToAccount,
|
|
117
114
|
uint256 blockTime
|
|
118
|
-
) internal pure returns (uint256
|
|
119
|
-
(int256
|
|
115
|
+
) internal pure returns (uint256 netSyToMarket, uint256 netSyToReserve) {
|
|
116
|
+
(int256 _netSyToAccount, int256 _netSyToReserve) = executeTradeCore(
|
|
120
117
|
market,
|
|
121
118
|
index,
|
|
122
119
|
exactPtToAccount.Int(),
|
|
123
120
|
blockTime
|
|
124
121
|
);
|
|
125
122
|
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
netSyToMarket = _netSyToAccount.neg().Uint();
|
|
124
|
+
netSyToReserve = _netSyToReserve.Uint();
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
/*///////////////////////////////////////////////////////////////
|
|
@@ -133,7 +130,7 @@ library MarketMathCore {
|
|
|
133
130
|
|
|
134
131
|
function addLiquidityCore(
|
|
135
132
|
MarketState memory market,
|
|
136
|
-
int256
|
|
133
|
+
int256 syDesired,
|
|
137
134
|
int256 ptDesired,
|
|
138
135
|
uint256 blockTime
|
|
139
136
|
)
|
|
@@ -142,34 +139,34 @@ library MarketMathCore {
|
|
|
142
139
|
returns (
|
|
143
140
|
int256 lpToReserve,
|
|
144
141
|
int256 lpToAccount,
|
|
145
|
-
int256
|
|
142
|
+
int256 syUsed,
|
|
146
143
|
int256 ptUsed
|
|
147
144
|
)
|
|
148
145
|
{
|
|
149
146
|
/// ------------------------------------------------------------
|
|
150
147
|
/// CHECKS
|
|
151
148
|
/// ------------------------------------------------------------
|
|
152
|
-
if (
|
|
149
|
+
if (syDesired == 0 || ptDesired == 0) revert Errors.MarketZeroAmountsInput();
|
|
153
150
|
if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();
|
|
154
151
|
|
|
155
152
|
/// ------------------------------------------------------------
|
|
156
153
|
/// MATH
|
|
157
154
|
/// ------------------------------------------------------------
|
|
158
155
|
if (market.totalLp == 0) {
|
|
159
|
-
lpToAccount = Math.sqrt((
|
|
156
|
+
lpToAccount = Math.sqrt((syDesired * ptDesired).Uint()).Int() - MINIMUM_LIQUIDITY;
|
|
160
157
|
lpToReserve = MINIMUM_LIQUIDITY;
|
|
161
|
-
|
|
158
|
+
syUsed = syDesired;
|
|
162
159
|
ptUsed = ptDesired;
|
|
163
160
|
} else {
|
|
164
161
|
int256 netLpByPt = (ptDesired * market.totalLp) / market.totalPt;
|
|
165
|
-
int256
|
|
166
|
-
if (netLpByPt <
|
|
162
|
+
int256 netLpBySy = (syDesired * market.totalLp) / market.totalSy;
|
|
163
|
+
if (netLpByPt < netLpBySy) {
|
|
167
164
|
lpToAccount = netLpByPt;
|
|
168
165
|
ptUsed = ptDesired;
|
|
169
|
-
|
|
166
|
+
syUsed = (market.totalSy * lpToAccount) / market.totalLp;
|
|
170
167
|
} else {
|
|
171
|
-
lpToAccount =
|
|
172
|
-
|
|
168
|
+
lpToAccount = netLpBySy;
|
|
169
|
+
syUsed = syDesired;
|
|
173
170
|
ptUsed = (market.totalPt * lpToAccount) / market.totalLp;
|
|
174
171
|
}
|
|
175
172
|
}
|
|
@@ -179,7 +176,7 @@ library MarketMathCore {
|
|
|
179
176
|
/// ------------------------------------------------------------
|
|
180
177
|
/// WRITE
|
|
181
178
|
/// ------------------------------------------------------------
|
|
182
|
-
market.
|
|
179
|
+
market.totalSy += syUsed;
|
|
183
180
|
market.totalPt += ptUsed;
|
|
184
181
|
market.totalLp += lpToAccount + lpToReserve;
|
|
185
182
|
}
|
|
@@ -187,7 +184,7 @@ library MarketMathCore {
|
|
|
187
184
|
function removeLiquidityCore(MarketState memory market, int256 lpToRemove)
|
|
188
185
|
internal
|
|
189
186
|
pure
|
|
190
|
-
returns (int256
|
|
187
|
+
returns (int256 netSyToAccount, int256 netPtToAccount)
|
|
191
188
|
{
|
|
192
189
|
/// ------------------------------------------------------------
|
|
193
190
|
/// CHECKS
|
|
@@ -197,17 +194,17 @@ library MarketMathCore {
|
|
|
197
194
|
/// ------------------------------------------------------------
|
|
198
195
|
/// MATH
|
|
199
196
|
/// ------------------------------------------------------------
|
|
200
|
-
|
|
197
|
+
netSyToAccount = (lpToRemove * market.totalSy) / market.totalLp;
|
|
201
198
|
netPtToAccount = (lpToRemove * market.totalPt) / market.totalLp;
|
|
202
199
|
|
|
203
|
-
if (
|
|
200
|
+
if (netSyToAccount == 0 || netPtToAccount == 0) revert Errors.MarketZeroAmountsOutput();
|
|
204
201
|
|
|
205
202
|
/// ------------------------------------------------------------
|
|
206
203
|
/// WRITE
|
|
207
204
|
/// ------------------------------------------------------------
|
|
208
205
|
market.totalLp = market.totalLp.subNoNeg(lpToRemove);
|
|
209
206
|
market.totalPt = market.totalPt.subNoNeg(netPtToAccount);
|
|
210
|
-
market.
|
|
207
|
+
market.totalSy = market.totalSy.subNoNeg(netSyToAccount);
|
|
211
208
|
}
|
|
212
209
|
|
|
213
210
|
function executeTradeCore(
|
|
@@ -215,7 +212,7 @@ library MarketMathCore {
|
|
|
215
212
|
PYIndex index,
|
|
216
213
|
int256 netPtToAccount,
|
|
217
214
|
uint256 blockTime
|
|
218
|
-
) internal pure returns (int256
|
|
215
|
+
) internal pure returns (int256 netSyToAccount, int256 netSyToReserve) {
|
|
219
216
|
/// ------------------------------------------------------------
|
|
220
217
|
/// CHECKS
|
|
221
218
|
/// ------------------------------------------------------------
|
|
@@ -228,7 +225,7 @@ library MarketMathCore {
|
|
|
228
225
|
/// ------------------------------------------------------------
|
|
229
226
|
MarketPreCompute memory comp = getMarketPreCompute(market, index, blockTime);
|
|
230
227
|
|
|
231
|
-
(
|
|
228
|
+
(netSyToAccount, netSyToReserve) = calcTrade(market, comp, index, netPtToAccount);
|
|
232
229
|
|
|
233
230
|
/// ------------------------------------------------------------
|
|
234
231
|
/// WRITE
|
|
@@ -238,8 +235,8 @@ library MarketMathCore {
|
|
|
238
235
|
comp,
|
|
239
236
|
index,
|
|
240
237
|
netPtToAccount,
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
netSyToAccount,
|
|
239
|
+
netSyToReserve,
|
|
243
240
|
blockTime
|
|
244
241
|
);
|
|
245
242
|
}
|
|
@@ -254,7 +251,7 @@ library MarketMathCore {
|
|
|
254
251
|
uint256 timeToExpiry = market.expiry - blockTime;
|
|
255
252
|
|
|
256
253
|
res.rateScalar = _getRateScalar(market, timeToExpiry);
|
|
257
|
-
res.totalAsset = index.
|
|
254
|
+
res.totalAsset = index.syToAsset(market.totalSy);
|
|
258
255
|
|
|
259
256
|
if (market.totalPt == 0 || res.totalAsset == 0)
|
|
260
257
|
revert Errors.MarketZeroTotalPtOrTotalAsset(market.totalPt, res.totalAsset);
|
|
@@ -274,7 +271,7 @@ library MarketMathCore {
|
|
|
274
271
|
MarketPreCompute memory comp,
|
|
275
272
|
PYIndex index,
|
|
276
273
|
int256 netPtToAccount
|
|
277
|
-
) internal pure returns (int256
|
|
274
|
+
) internal pure returns (int256 netSyToAccount, int256 netSyToReserve) {
|
|
278
275
|
int256 preFeeExchangeRate = _getExchangeRate(
|
|
279
276
|
market.totalPt,
|
|
280
277
|
comp.totalAsset,
|
|
@@ -299,10 +296,10 @@ library MarketMathCore {
|
|
|
299
296
|
int256 netAssetToReserve = (fee * market.reserveFeePercent.Int()) / PERCENTAGE_DECIMALS;
|
|
300
297
|
int256 netAssetToAccount = preFeeAssetToAccount - fee;
|
|
301
298
|
|
|
302
|
-
|
|
303
|
-
? index.
|
|
304
|
-
: index.
|
|
305
|
-
|
|
299
|
+
netSyToAccount = netAssetToAccount < 0
|
|
300
|
+
? index.assetToSyUp(netAssetToAccount)
|
|
301
|
+
: index.assetToSy(netAssetToAccount);
|
|
302
|
+
netSyToReserve = index.assetToSy(netAssetToReserve);
|
|
306
303
|
}
|
|
307
304
|
|
|
308
305
|
function _setNewMarketStateTrade(
|
|
@@ -310,18 +307,18 @@ library MarketMathCore {
|
|
|
310
307
|
MarketPreCompute memory comp,
|
|
311
308
|
PYIndex index,
|
|
312
309
|
int256 netPtToAccount,
|
|
313
|
-
int256
|
|
314
|
-
int256
|
|
310
|
+
int256 netSyToAccount,
|
|
311
|
+
int256 netSyToReserve,
|
|
315
312
|
uint256 blockTime
|
|
316
313
|
) internal pure {
|
|
317
314
|
uint256 timeToExpiry = market.expiry - blockTime;
|
|
318
315
|
|
|
319
316
|
market.totalPt = market.totalPt.subNoNeg(netPtToAccount);
|
|
320
|
-
market.
|
|
317
|
+
market.totalSy = market.totalSy.subNoNeg(netSyToAccount + netSyToReserve);
|
|
321
318
|
|
|
322
319
|
market.lastLnImpliedRate = _getLnImpliedRate(
|
|
323
320
|
market.totalPt,
|
|
324
|
-
index.
|
|
321
|
+
index.syToAsset(market.totalSy),
|
|
325
322
|
comp.rateScalar,
|
|
326
323
|
comp.rateAnchor,
|
|
327
324
|
timeToExpiry
|
|
@@ -432,7 +429,7 @@ library MarketMathCore {
|
|
|
432
429
|
/// ------------------------------------------------------------
|
|
433
430
|
/// MATH
|
|
434
431
|
/// ------------------------------------------------------------
|
|
435
|
-
int256 totalAsset = index.
|
|
432
|
+
int256 totalAsset = index.syToAsset(market.totalSy);
|
|
436
433
|
uint256 timeToExpiry = market.expiry - blockTime;
|
|
437
434
|
int256 rateScalar = _getRateScalar(market, timeToExpiry);
|
|
438
435
|
|
|
@@ -4,7 +4,7 @@ pragma solidity 0.8.17;
|
|
|
4
4
|
import "../../interfaces/IPGauge.sol";
|
|
5
5
|
import "../../interfaces/IPVeToken.sol";
|
|
6
6
|
import "../../interfaces/IPGaugeController.sol";
|
|
7
|
-
import "../../interfaces/
|
|
7
|
+
import "../../interfaces/IStandardizedYield.sol";
|
|
8
8
|
|
|
9
9
|
import "../RewardManager/RewardManager.sol";
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ abstract contract PendleGauge is RewardManager, IPGauge {
|
|
|
17
17
|
using SafeERC20 for IERC20;
|
|
18
18
|
using ArrayLib for address[];
|
|
19
19
|
|
|
20
|
-
address private immutable
|
|
20
|
+
address private immutable SY;
|
|
21
21
|
|
|
22
22
|
uint256 internal constant TOKENLESS_PRODUCTION = 40;
|
|
23
23
|
|
|
@@ -29,11 +29,11 @@ abstract contract PendleGauge is RewardManager, IPGauge {
|
|
|
29
29
|
mapping(address => uint256) public activeBalance;
|
|
30
30
|
|
|
31
31
|
constructor(
|
|
32
|
-
address
|
|
32
|
+
address _SY,
|
|
33
33
|
address _vePendle,
|
|
34
34
|
address _gaugeController
|
|
35
35
|
) {
|
|
36
|
-
|
|
36
|
+
SY = _SY;
|
|
37
37
|
vePENDLE = IPVeToken(_vePendle);
|
|
38
38
|
gaugeController = _gaugeController;
|
|
39
39
|
PENDLE = IPGaugeController(gaugeController).pendle();
|
|
@@ -94,7 +94,7 @@ abstract contract PendleGauge is RewardManager, IPGauge {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function _redeemExternalReward() internal virtual override {
|
|
97
|
-
|
|
97
|
+
IStandardizedYield(SY).claimRewards(address(this));
|
|
98
98
|
IPGaugeController(gaugeController).redeemMarketReward();
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -111,9 +111,9 @@ abstract contract PendleGauge is RewardManager, IPGauge {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
function _getRewardTokens() internal view virtual override returns (address[] memory) {
|
|
114
|
-
address[] memory
|
|
115
|
-
if (
|
|
116
|
-
return
|
|
114
|
+
address[] memory SYRewards = IStandardizedYield(SY).getRewardTokens();
|
|
115
|
+
if (SYRewards.contains(PENDLE)) return SYRewards;
|
|
116
|
+
return SYRewards.append(PENDLE);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
function _beforeTokenTransfer(
|
|
@@ -11,7 +11,7 @@ import "./OracleLib.sol";
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
Invariance to maintain:
|
|
14
|
-
- Internal balances totalPt &
|
|
14
|
+
- Internal balances totalPt & totalSy not interfered by people transferring tokens in directly
|
|
15
15
|
- address(0) & address(this) should never have any rewards & activeBalance accounting done. This is
|
|
16
16
|
guaranteed by address(0) & address(this) check in each updateForTwo function
|
|
17
17
|
*/
|
|
@@ -25,7 +25,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
25
25
|
|
|
26
26
|
struct MarketStorage {
|
|
27
27
|
int128 totalPt;
|
|
28
|
-
int128
|
|
28
|
+
int128 totalSy;
|
|
29
29
|
// 1 SLOT = 256 bits
|
|
30
30
|
uint96 lastLnImpliedRate;
|
|
31
31
|
uint16 observationIndex;
|
|
@@ -38,7 +38,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
38
38
|
string private constant SYMBOL = "PENDLE-LPT";
|
|
39
39
|
|
|
40
40
|
IPPrincipalToken internal immutable PT;
|
|
41
|
-
|
|
41
|
+
IStandardizedYield internal immutable SY;
|
|
42
42
|
IPYieldToken internal immutable YT;
|
|
43
43
|
|
|
44
44
|
address public immutable factory;
|
|
@@ -63,10 +63,10 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
63
63
|
address _gaugeController
|
|
64
64
|
)
|
|
65
65
|
PendleERC20Permit(NAME, SYMBOL, 18)
|
|
66
|
-
PendleGauge(IPPrincipalToken(_PT).
|
|
66
|
+
PendleGauge(IPPrincipalToken(_PT).SY(), _vePendle, _gaugeController)
|
|
67
67
|
{
|
|
68
68
|
PT = IPPrincipalToken(_PT);
|
|
69
|
-
|
|
69
|
+
SY = IStandardizedYield(PT.SY());
|
|
70
70
|
YT = IPYieldToken(PT.YT());
|
|
71
71
|
|
|
72
72
|
(_storage.observationCardinality, _storage.observationCardinalityNext) = observations
|
|
@@ -81,12 +81,12 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
* @notice PendleMarket allows users to provide in PT &
|
|
84
|
+
* @notice PendleMarket allows users to provide in PT & SY in exchange for LPs, which
|
|
85
85
|
* will grant LP holders more exchange fee over time
|
|
86
86
|
*/
|
|
87
87
|
function mint(
|
|
88
88
|
address receiver,
|
|
89
|
-
uint256
|
|
89
|
+
uint256 netSyDesired,
|
|
90
90
|
uint256 netPtDesired
|
|
91
91
|
)
|
|
92
92
|
external
|
|
@@ -94,7 +94,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
94
94
|
notExpired
|
|
95
95
|
returns (
|
|
96
96
|
uint256 netLpOut,
|
|
97
|
-
uint256
|
|
97
|
+
uint256 netSyUsed,
|
|
98
98
|
uint256 netPtUsed
|
|
99
99
|
)
|
|
100
100
|
{
|
|
@@ -103,8 +103,8 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
103
103
|
|
|
104
104
|
uint256 lpToReserve;
|
|
105
105
|
|
|
106
|
-
(lpToReserve, netLpOut,
|
|
107
|
-
|
|
106
|
+
(lpToReserve, netLpOut, netSyUsed, netPtUsed) = market.addLiquidity(
|
|
107
|
+
netSyDesired,
|
|
108
108
|
netPtDesired,
|
|
109
109
|
block.timestamp
|
|
110
110
|
);
|
|
@@ -119,120 +119,120 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
119
119
|
|
|
120
120
|
_writeState(market);
|
|
121
121
|
|
|
122
|
-
if (_selfBalance(
|
|
123
|
-
revert Errors.
|
|
122
|
+
if (_selfBalance(SY) < market.totalSy.Uint())
|
|
123
|
+
revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
|
|
124
124
|
if (_selfBalance(PT) < market.totalPt.Uint())
|
|
125
125
|
revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
|
|
126
126
|
|
|
127
|
-
emit Mint(receiver, netLpOut,
|
|
127
|
+
emit Mint(receiver, netLpOut, netSyUsed, netPtUsed);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* @notice LP Holders can burn their LP to receive back
|
|
131
|
+
* @notice LP Holders can burn their LP to receive back SY & PT proportionally
|
|
132
132
|
* to their share of market
|
|
133
133
|
*/
|
|
134
134
|
function burn(
|
|
135
|
-
address
|
|
135
|
+
address receiverSy,
|
|
136
136
|
address receiverPt,
|
|
137
137
|
uint256 netLpToBurn
|
|
138
|
-
) external nonReentrant returns (uint256
|
|
138
|
+
) external nonReentrant returns (uint256 netSyOut, uint256 netPtOut) {
|
|
139
139
|
MarketState memory market = readState();
|
|
140
140
|
|
|
141
141
|
_burn(address(this), netLpToBurn);
|
|
142
142
|
|
|
143
|
-
(
|
|
143
|
+
(netSyOut, netPtOut) = market.removeLiquidity(netLpToBurn);
|
|
144
144
|
|
|
145
|
-
if (
|
|
145
|
+
if (receiverSy != address(this)) IERC20(SY).safeTransfer(receiverSy, netSyOut);
|
|
146
146
|
if (receiverPt != address(this)) IERC20(PT).safeTransfer(receiverPt, netPtOut);
|
|
147
147
|
|
|
148
148
|
_writeState(market);
|
|
149
149
|
|
|
150
|
-
emit Burn(
|
|
150
|
+
emit Burn(receiverSy, receiverPt, netLpToBurn, netSyOut, netPtOut);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
* @notice Pendle Market allows swaps between PT &
|
|
155
|
-
* aims to swap an exact amount of PT to
|
|
154
|
+
* @notice Pendle Market allows swaps between PT & SY it is holding. This function
|
|
155
|
+
* aims to swap an exact amount of PT to SY.
|
|
156
156
|
* @dev steps working of this contract
|
|
157
|
-
- The outcome amount of
|
|
158
|
-
- Release the calculated amount of
|
|
157
|
+
- The outcome amount of SY will be precomputed by MarketMathLib
|
|
158
|
+
- Release the calculated amount of SY to receiver
|
|
159
159
|
- Callback to msg.sender if data.length > 0
|
|
160
160
|
- Ensure exactPtIn amount of PT has been transferred to this address
|
|
161
161
|
* @param data bytes data to be sent in the callback
|
|
162
162
|
*/
|
|
163
|
-
function
|
|
163
|
+
function swapExactPtForSy(
|
|
164
164
|
address receiver,
|
|
165
165
|
uint256 exactPtIn,
|
|
166
166
|
bytes calldata data
|
|
167
|
-
) external nonReentrant notExpired returns (uint256
|
|
167
|
+
) external nonReentrant notExpired returns (uint256 netSyOut, uint256 netSyToReserve) {
|
|
168
168
|
MarketState memory market = readState();
|
|
169
169
|
|
|
170
|
-
(
|
|
170
|
+
(netSyOut, netSyToReserve) = market.swapExactPtForSy(
|
|
171
171
|
YT.newIndex(),
|
|
172
172
|
exactPtIn,
|
|
173
173
|
block.timestamp
|
|
174
174
|
);
|
|
175
175
|
|
|
176
|
-
if (receiver != address(this)) IERC20(
|
|
177
|
-
IERC20(
|
|
176
|
+
if (receiver != address(this)) IERC20(SY).safeTransfer(receiver, netSyOut);
|
|
177
|
+
IERC20(SY).safeTransfer(market.treasury, netSyToReserve);
|
|
178
178
|
|
|
179
179
|
_writeState(market);
|
|
180
180
|
|
|
181
181
|
if (data.length > 0) {
|
|
182
|
-
IPMarketSwapCallback(msg.sender).swapCallback(exactPtIn.neg(),
|
|
182
|
+
IPMarketSwapCallback(msg.sender).swapCallback(exactPtIn.neg(), netSyOut.Int(), data);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
if (_selfBalance(PT) < market.totalPt.Uint())
|
|
186
186
|
revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
|
|
187
187
|
|
|
188
|
-
emit Swap(receiver, exactPtIn.neg(),
|
|
188
|
+
emit Swap(receiver, exactPtIn.neg(), netSyOut.Int(), netSyToReserve);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
* @notice Pendle Market allows swaps between PT &
|
|
193
|
-
* aims to swap an exact amount of
|
|
192
|
+
* @notice Pendle Market allows swaps between PT & SY it is holding. This function
|
|
193
|
+
* aims to swap an exact amount of SY to PT.
|
|
194
194
|
* @dev steps working of this function
|
|
195
195
|
- The exact outcome amount of PT will be transferred to receiver
|
|
196
196
|
- Callback to msg.sender if data.length > 0
|
|
197
|
-
- Ensure the calculated required amount of
|
|
197
|
+
- Ensure the calculated required amount of SY is transferred to this address
|
|
198
198
|
* @param data bytes data to be sent in the callback
|
|
199
199
|
*/
|
|
200
|
-
function
|
|
200
|
+
function swapSyForExactPt(
|
|
201
201
|
address receiver,
|
|
202
202
|
uint256 exactPtOut,
|
|
203
203
|
bytes calldata data
|
|
204
|
-
) external nonReentrant notExpired returns (uint256
|
|
204
|
+
) external nonReentrant notExpired returns (uint256 netSyIn, uint256 netSyToReserve) {
|
|
205
205
|
MarketState memory market = readState();
|
|
206
206
|
|
|
207
|
-
(
|
|
207
|
+
(netSyIn, netSyToReserve) = market.swapSyForExactPt(
|
|
208
208
|
YT.newIndex(),
|
|
209
209
|
exactPtOut,
|
|
210
210
|
block.timestamp
|
|
211
211
|
);
|
|
212
212
|
|
|
213
213
|
if (receiver != address(this)) IERC20(PT).safeTransfer(receiver, exactPtOut);
|
|
214
|
-
IERC20(
|
|
214
|
+
IERC20(SY).safeTransfer(market.treasury, netSyToReserve);
|
|
215
215
|
|
|
216
216
|
_writeState(market);
|
|
217
217
|
|
|
218
218
|
if (data.length > 0) {
|
|
219
|
-
IPMarketSwapCallback(msg.sender).swapCallback(exactPtOut.Int(),
|
|
219
|
+
IPMarketSwapCallback(msg.sender).swapCallback(exactPtOut.Int(), netSyIn.neg(), data);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
// have received enough
|
|
223
|
-
if (_selfBalance(
|
|
224
|
-
revert Errors.
|
|
222
|
+
// have received enough SY
|
|
223
|
+
if (_selfBalance(SY) < market.totalSy.Uint())
|
|
224
|
+
revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
|
|
225
225
|
|
|
226
|
-
emit Swap(receiver, exactPtOut.Int(),
|
|
226
|
+
emit Swap(receiver, exactPtOut.Int(), netSyIn.neg(), netSyToReserve);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/// @notice force balances to match reserves
|
|
230
230
|
function skim() external nonReentrant {
|
|
231
231
|
MarketState memory market = readState();
|
|
232
232
|
uint256 excessPt = _selfBalance(PT) - market.totalPt.Uint();
|
|
233
|
-
uint256
|
|
233
|
+
uint256 excessSy = _selfBalance(SY) - market.totalSy.Uint();
|
|
234
234
|
IERC20(PT).safeTransfer(market.treasury, excessPt);
|
|
235
|
-
IERC20(
|
|
235
|
+
IERC20(SY).safeTransfer(market.treasury, excessSy);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
function redeemRewards(address user) external nonReentrant returns (uint256[] memory) {
|
|
@@ -280,7 +280,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
280
280
|
*/
|
|
281
281
|
function readState() public view returns (MarketState memory market) {
|
|
282
282
|
market.totalPt = _storage.totalPt;
|
|
283
|
-
market.
|
|
283
|
+
market.totalSy = _storage.totalSy;
|
|
284
284
|
market.totalLp = totalSupply().Int();
|
|
285
285
|
|
|
286
286
|
(market.treasury, market.lnFeeRateRoot, market.reserveFeePercent) = IPMarketFactory(
|
|
@@ -297,7 +297,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
297
297
|
function _writeState(MarketState memory market) internal {
|
|
298
298
|
uint96 lastLnImpliedRate96 = market.lastLnImpliedRate.Uint96();
|
|
299
299
|
int128 totalPt128 = market.totalPt.Int128();
|
|
300
|
-
int128
|
|
300
|
+
int128 totalSy128 = market.totalSy.Int128();
|
|
301
301
|
|
|
302
302
|
(uint16 observationIndex, uint16 observationCardinality) = observations.write(
|
|
303
303
|
_storage.observationIndex,
|
|
@@ -308,7 +308,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
308
308
|
);
|
|
309
309
|
|
|
310
310
|
_storage.totalPt = totalPt128;
|
|
311
|
-
_storage.
|
|
311
|
+
_storage.totalSy = totalSy128;
|
|
312
312
|
_storage.lastLnImpliedRate = lastLnImpliedRate96;
|
|
313
313
|
_storage.observationIndex = observationIndex;
|
|
314
314
|
_storage.observationCardinality = observationCardinality;
|
|
@@ -324,12 +324,12 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
324
324
|
external
|
|
325
325
|
view
|
|
326
326
|
returns (
|
|
327
|
-
|
|
327
|
+
IStandardizedYield _SY,
|
|
328
328
|
IPPrincipalToken _PT,
|
|
329
329
|
IPYieldToken _YT
|
|
330
330
|
)
|
|
331
331
|
{
|
|
332
|
-
|
|
332
|
+
_SY = SY;
|
|
333
333
|
_PT = PT;
|
|
334
334
|
_YT = YT;
|
|
335
335
|
}
|
|
@@ -72,7 +72,7 @@ contract PendleMarketFactory is BoringOwnableUpgradeable, IPMarketFactory {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* @notice Create a market between PT and its corresponding
|
|
75
|
+
* @notice Create a market between PT and its corresponding SY
|
|
76
76
|
* with scalar & anchor config. Anyone is allowed to create a market on their own.
|
|
77
77
|
*/
|
|
78
78
|
function createNewMarket(
|
|
@@ -3,7 +3,7 @@ pragma solidity 0.8.17;
|
|
|
3
3
|
|
|
4
4
|
import "./RewardManagerAbstract.sol";
|
|
5
5
|
|
|
6
|
-
/// NOTE: This RewardManager is used with PendleMarket &
|
|
6
|
+
/// NOTE: This RewardManager is used with PendleMarket & SY. For YT, it will use RewardManagerAbstract
|
|
7
7
|
/// NOTE: RewardManager must not have duplicated rewardTokens
|
|
8
8
|
abstract contract RewardManager is RewardManagerAbstract {
|
|
9
9
|
using Math for uint256;
|