@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
|
@@ -3,14 +3,14 @@ pragma solidity 0.8.17;
|
|
|
3
3
|
|
|
4
4
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
5
5
|
|
|
6
|
-
import "../../interfaces/
|
|
6
|
+
import "../../interfaces/IStandardizedYield.sol";
|
|
7
7
|
import "../../interfaces/IPYieldToken.sol";
|
|
8
8
|
import "../../interfaces/IPPrincipalToken.sol";
|
|
9
9
|
|
|
10
10
|
import "../libraries/math/Math.sol";
|
|
11
11
|
import "../libraries/ArrayLib.sol";
|
|
12
12
|
import "../../interfaces/IPYieldContractFactory.sol";
|
|
13
|
-
import "../
|
|
13
|
+
import "../StandardizedYield/SYUtils.sol";
|
|
14
14
|
import "../libraries/Errors.sol";
|
|
15
15
|
import "../libraries/MiniHelpers.sol";
|
|
16
16
|
|
|
@@ -35,17 +35,17 @@ contract PendleYieldToken is
|
|
|
35
35
|
|
|
36
36
|
struct PostExpiryData {
|
|
37
37
|
uint128 firstPYIndex;
|
|
38
|
-
uint128
|
|
38
|
+
uint128 totalSyInterestForTreasury;
|
|
39
39
|
mapping(address => uint256) firstRewardIndex;
|
|
40
40
|
mapping(address => uint256) userRewardOwed;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
address public immutable
|
|
43
|
+
address public immutable SY;
|
|
44
44
|
address public immutable PT;
|
|
45
45
|
address public immutable factory;
|
|
46
46
|
uint256 public immutable expiry;
|
|
47
47
|
|
|
48
|
-
uint128 public
|
|
48
|
+
uint128 public syReserve;
|
|
49
49
|
uint128 internal _pyIndexStored;
|
|
50
50
|
|
|
51
51
|
PostExpiryData public postExpiry;
|
|
@@ -53,7 +53,7 @@ contract PendleYieldToken is
|
|
|
53
53
|
modifier updateData() {
|
|
54
54
|
if (isExpired()) _setPostExpiryData();
|
|
55
55
|
_;
|
|
56
|
-
|
|
56
|
+
_updateSyReserve();
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
modifier notExpired() {
|
|
@@ -62,20 +62,20 @@ contract PendleYieldToken is
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
constructor(
|
|
65
|
-
address
|
|
65
|
+
address _SY,
|
|
66
66
|
address _PT,
|
|
67
67
|
string memory _name,
|
|
68
68
|
string memory _symbol,
|
|
69
69
|
uint8 __decimals,
|
|
70
70
|
uint256 _expiry
|
|
71
71
|
) PendleERC20Permit(_name, _symbol, __decimals) {
|
|
72
|
-
|
|
72
|
+
SY = _SY;
|
|
73
73
|
PT = _PT;
|
|
74
74
|
expiry = _expiry;
|
|
75
75
|
factory = msg.sender;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
/// @notice Tokenize
|
|
78
|
+
/// @notice Tokenize SY into PT + YT of equal qty. Every unit of underlying of SY will create 1 PT + 1 YT
|
|
79
79
|
function mintPY(address receiverPT, address receiverYT)
|
|
80
80
|
external
|
|
81
81
|
nonReentrant
|
|
@@ -85,52 +85,52 @@ contract PendleYieldToken is
|
|
|
85
85
|
{
|
|
86
86
|
address[] memory receiverPTs = new address[](1);
|
|
87
87
|
address[] memory receiverYTs = new address[](1);
|
|
88
|
-
uint256[] memory
|
|
88
|
+
uint256[] memory amountSyToMints = new uint256[](1);
|
|
89
89
|
|
|
90
|
-
(receiverPTs[0], receiverYTs[0],
|
|
90
|
+
(receiverPTs[0], receiverYTs[0], amountSyToMints[0]) = (
|
|
91
91
|
receiverPT,
|
|
92
92
|
receiverYT,
|
|
93
|
-
|
|
93
|
+
_getFloatingSyAmount()
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
-
uint256[] memory amountPYOuts = _mintPY(receiverPTs, receiverYTs,
|
|
96
|
+
uint256[] memory amountPYOuts = _mintPY(receiverPTs, receiverYTs, amountSyToMints);
|
|
97
97
|
amountPYOut = amountPYOuts[0];
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/// @notice Tokenize
|
|
100
|
+
/// @notice Tokenize SY into PT + YT of equal qty. Every unit of underlying of SY will create 1 PT + 1 YT
|
|
101
101
|
function mintPYMulti(
|
|
102
102
|
address[] calldata receiverPTs,
|
|
103
103
|
address[] calldata receiverYTs,
|
|
104
|
-
uint256[] calldata
|
|
104
|
+
uint256[] calldata amountSyToMints
|
|
105
105
|
) external nonReentrant notExpired updateData returns (uint256[] memory amountPYOuts) {
|
|
106
106
|
uint256 length = receiverPTs.length;
|
|
107
107
|
|
|
108
|
-
if (receiverYTs.length != length &&
|
|
108
|
+
if (receiverYTs.length != length && amountSyToMints.length == length)
|
|
109
109
|
revert Errors.ArrayLengthMismatch();
|
|
110
110
|
if (length == 0) revert Errors.ArrayEmpty();
|
|
111
111
|
|
|
112
|
-
uint256
|
|
113
|
-
if (
|
|
114
|
-
revert Errors.
|
|
112
|
+
uint256 totalSyToMint = amountSyToMints.sum();
|
|
113
|
+
if (totalSyToMint > _getFloatingSyAmount())
|
|
114
|
+
revert Errors.YieldContractInsufficientSy(totalSyToMint, _getFloatingSyAmount());
|
|
115
115
|
|
|
116
|
-
amountPYOuts = _mintPY(receiverPTs, receiverYTs,
|
|
116
|
+
amountPYOuts = _mintPY(receiverPTs, receiverYTs, amountSyToMints);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
/// @dev this function converts PY tokens into
|
|
119
|
+
/// @dev this function converts PY tokens into sy, but interests & rewards are not redeemed at the same time
|
|
120
120
|
function redeemPY(address receiver)
|
|
121
121
|
external
|
|
122
122
|
nonReentrant
|
|
123
123
|
updateData
|
|
124
|
-
returns (uint256
|
|
124
|
+
returns (uint256 amountSyOut)
|
|
125
125
|
{
|
|
126
126
|
address[] memory receivers = new address[](1);
|
|
127
127
|
uint256[] memory amounts = new uint256[](1);
|
|
128
128
|
(receivers[0], amounts[0]) = (receiver, _getAmountPYToRedeem());
|
|
129
129
|
|
|
130
|
-
uint256[] memory
|
|
131
|
-
|
|
130
|
+
uint256[] memory amountSyOuts;
|
|
131
|
+
amountSyOuts = _redeemPY(receivers, amounts);
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
amountSyOut = amountSyOuts[0];
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/// @dev this function limit how much each receiver will receive. For example, if the totalOut is 100,
|
|
@@ -140,16 +140,16 @@ contract PendleYieldToken is
|
|
|
140
140
|
external
|
|
141
141
|
nonReentrant
|
|
142
142
|
updateData
|
|
143
|
-
returns (uint256[] memory
|
|
143
|
+
returns (uint256[] memory amountSyOuts)
|
|
144
144
|
{
|
|
145
145
|
if (receivers.length != amountPYToRedeems.length) revert Errors.ArrayLengthMismatch();
|
|
146
146
|
if (receivers.length == 0) revert Errors.ArrayEmpty();
|
|
147
|
-
|
|
147
|
+
amountSyOuts = _redeemPY(receivers, amountPYToRedeems);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
|
-
* @dev With YT yielding interest in the form of
|
|
152
|
-
distribution should be based on the amount of
|
|
151
|
+
* @dev With YT yielding interest in the form of SY, which is redeemable by users, the reward
|
|
152
|
+
distribution should be based on the amount of SYs that their YT currently represent, plus their
|
|
153
153
|
dueInterest. It has been proven and tested that _rewardSharesUser will not change over time,
|
|
154
154
|
unless users redeem their dueInterest or redeemPY. Due to this, it is required to update users'
|
|
155
155
|
accruedReward STRICTLY BEFORE transferring out their interest.
|
|
@@ -175,7 +175,7 @@ contract PendleYieldToken is
|
|
|
175
175
|
|
|
176
176
|
if (redeemInterest) {
|
|
177
177
|
_distributeInterest(user);
|
|
178
|
-
interestOut = _doTransferOutInterest(user,
|
|
178
|
+
interestOut = _doTransferOutInterest(user, SY, factory);
|
|
179
179
|
emit RedeemInterest(user, interestOut);
|
|
180
180
|
} else {
|
|
181
181
|
interestOut = 0;
|
|
@@ -203,13 +203,13 @@ contract PendleYieldToken is
|
|
|
203
203
|
|
|
204
204
|
_transferOut(tokens, treasury, rewardsOut);
|
|
205
205
|
|
|
206
|
-
interestOut = postExpiry.
|
|
207
|
-
postExpiry.
|
|
208
|
-
_transferOut(
|
|
206
|
+
interestOut = postExpiry.totalSyInterestForTreasury;
|
|
207
|
+
postExpiry.totalSyInterestForTreasury = 0;
|
|
208
|
+
_transferOut(SY, treasury, interestOut);
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
function rewardIndexesCurrent() external override nonReentrant returns (uint256[] memory) {
|
|
212
|
-
return
|
|
212
|
+
return IStandardizedYield(SY).rewardIndexesCurrent();
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
/// @dev maximize the current rate with the previous rate to guarantee non-decreasing rate
|
|
@@ -228,7 +228,7 @@ contract PendleYieldToken is
|
|
|
228
228
|
view
|
|
229
229
|
returns (
|
|
230
230
|
uint256 firstPYIndex,
|
|
231
|
-
uint256
|
|
231
|
+
uint256 totalSyInterestForTreasury,
|
|
232
232
|
uint256[] memory firstRewardIndexes,
|
|
233
233
|
uint256[] memory userRewardOwed
|
|
234
234
|
)
|
|
@@ -236,7 +236,7 @@ contract PendleYieldToken is
|
|
|
236
236
|
if (postExpiry.firstPYIndex == 0) revert Errors.YCPostExpiryDataNotSet();
|
|
237
237
|
|
|
238
238
|
firstPYIndex = postExpiry.firstPYIndex;
|
|
239
|
-
|
|
239
|
+
totalSyInterestForTreasury = postExpiry.totalSyInterestForTreasury;
|
|
240
240
|
|
|
241
241
|
address[] memory tokens = getRewardTokens();
|
|
242
242
|
firstRewardIndexes = new uint256[](tokens.length);
|
|
@@ -251,14 +251,14 @@ contract PendleYieldToken is
|
|
|
251
251
|
function _mintPY(
|
|
252
252
|
address[] memory receiverPTs,
|
|
253
253
|
address[] memory receiverYTs,
|
|
254
|
-
uint256[] memory
|
|
254
|
+
uint256[] memory amountSyToMints
|
|
255
255
|
) internal returns (uint256[] memory amountPYOuts) {
|
|
256
|
-
amountPYOuts = new uint256[](
|
|
256
|
+
amountPYOuts = new uint256[](amountSyToMints.length);
|
|
257
257
|
|
|
258
258
|
uint256 index = _pyIndexCurrent();
|
|
259
259
|
|
|
260
|
-
for (uint256 i = 0; i <
|
|
261
|
-
amountPYOuts[i] = _calcPYToMint(
|
|
260
|
+
for (uint256 i = 0; i < amountSyToMints.length; i++) {
|
|
261
|
+
amountPYOuts[i] = _calcPYToMint(amountSyToMints[i], index);
|
|
262
262
|
|
|
263
263
|
_mint(receiverYTs[i], amountPYOuts[i]);
|
|
264
264
|
IPPrincipalToken(PT).mintByYT(receiverPTs[i], amountPYOuts[i]);
|
|
@@ -267,7 +267,7 @@ contract PendleYieldToken is
|
|
|
267
267
|
msg.sender,
|
|
268
268
|
receiverPTs[i],
|
|
269
269
|
receiverYTs[i],
|
|
270
|
-
|
|
270
|
+
amountSyToMints[i],
|
|
271
271
|
amountPYOuts[i]
|
|
272
272
|
);
|
|
273
273
|
}
|
|
@@ -283,50 +283,50 @@ contract PendleYieldToken is
|
|
|
283
283
|
|
|
284
284
|
function _redeemPY(address[] memory receivers, uint256[] memory amountPYToRedeems)
|
|
285
285
|
internal
|
|
286
|
-
returns (uint256[] memory
|
|
286
|
+
returns (uint256[] memory amountSyOuts)
|
|
287
287
|
{
|
|
288
288
|
uint256 totalAmountPYToRedeem = amountPYToRedeems.sum();
|
|
289
289
|
IPPrincipalToken(PT).burnByYT(address(this), totalAmountPYToRedeem);
|
|
290
290
|
if (!isExpired()) _burn(address(this), totalAmountPYToRedeem);
|
|
291
291
|
|
|
292
292
|
uint256 index = _pyIndexCurrent();
|
|
293
|
-
uint256
|
|
294
|
-
|
|
293
|
+
uint256 totalSyInterestPostExpiry;
|
|
294
|
+
amountSyOuts = new uint256[](receivers.length);
|
|
295
295
|
|
|
296
296
|
for (uint256 i = 0; i < receivers.length; i++) {
|
|
297
|
-
uint256
|
|
298
|
-
(
|
|
297
|
+
uint256 syInterestPostExpiry;
|
|
298
|
+
(amountSyOuts[i], syInterestPostExpiry) = _calcSyRedeemableFromPY(
|
|
299
299
|
amountPYToRedeems[i],
|
|
300
300
|
index
|
|
301
301
|
);
|
|
302
|
-
_transferOut(
|
|
303
|
-
|
|
302
|
+
_transferOut(SY, receivers[i], amountSyOuts[i]);
|
|
303
|
+
totalSyInterestPostExpiry += syInterestPostExpiry;
|
|
304
304
|
|
|
305
|
-
emit Burn(msg.sender, receivers[i], amountPYToRedeems[i],
|
|
305
|
+
emit Burn(msg.sender, receivers[i], amountPYToRedeems[i], amountSyOuts[i]);
|
|
306
306
|
}
|
|
307
|
-
if (
|
|
308
|
-
postExpiry.
|
|
307
|
+
if (totalSyInterestPostExpiry != 0) {
|
|
308
|
+
postExpiry.totalSyInterestForTreasury += totalSyInterestPostExpiry.Uint128();
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
function _calcPYToMint(uint256
|
|
312
|
+
function _calcPYToMint(uint256 amountSy, uint256 indexCurrent)
|
|
313
313
|
internal
|
|
314
314
|
pure
|
|
315
315
|
returns (uint256 amountPY)
|
|
316
316
|
{
|
|
317
317
|
// doesn't matter before or after expiry, since mintPY is only allowed before expiry
|
|
318
|
-
return
|
|
318
|
+
return SYUtils.syToAsset(indexCurrent, amountSy);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
function
|
|
321
|
+
function _calcSyRedeemableFromPY(uint256 amountPY, uint256 indexCurrent)
|
|
322
322
|
internal
|
|
323
323
|
view
|
|
324
|
-
returns (uint256
|
|
324
|
+
returns (uint256 syToUser, uint256 syInterestPostExpiry)
|
|
325
325
|
{
|
|
326
|
-
|
|
326
|
+
syToUser = SYUtils.assetToSy(indexCurrent, amountPY);
|
|
327
327
|
if (isExpired()) {
|
|
328
|
-
uint256
|
|
329
|
-
|
|
328
|
+
uint256 totalSyRedeemable = SYUtils.assetToSy(postExpiry.firstPYIndex, amountPY);
|
|
329
|
+
syInterestPostExpiry = totalSyRedeemable - syToUser;
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
|
|
@@ -335,13 +335,13 @@ contract PendleYieldToken is
|
|
|
335
335
|
else return _selfBalance(PT);
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
function
|
|
339
|
-
|
|
338
|
+
function _updateSyReserve() internal virtual {
|
|
339
|
+
syReserve = _selfBalance(SY).Uint128();
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
function
|
|
343
|
-
amount = _selfBalance(
|
|
344
|
-
if (amount == 0) revert Errors.
|
|
342
|
+
function _getFloatingSyAmount() internal view returns (uint256 amount) {
|
|
343
|
+
amount = _selfBalance(SY) - syReserve;
|
|
344
|
+
if (amount == 0) revert Errors.YCNoFloatingSy();
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
function _setPostExpiryData() internal {
|
|
@@ -351,8 +351,8 @@ contract PendleYieldToken is
|
|
|
351
351
|
_redeemExternalReward(); // do a final redeem. All the future reward income will belong to the treasury
|
|
352
352
|
|
|
353
353
|
local.firstPYIndex = _pyIndexCurrent().Uint128();
|
|
354
|
-
address[] memory rewardTokens =
|
|
355
|
-
uint256[] memory rewardIndexes =
|
|
354
|
+
address[] memory rewardTokens = IStandardizedYield(SY).getRewardTokens();
|
|
355
|
+
uint256[] memory rewardIndexes = IStandardizedYield(SY).rewardIndexesCurrent();
|
|
356
356
|
for (uint256 i = 0; i < rewardTokens.length; i++) {
|
|
357
357
|
local.firstRewardIndex[rewardTokens[i]] = rewardIndexes[i];
|
|
358
358
|
local.userRewardOwed[rewardTokens[i]] = _selfBalance(rewardTokens[i]);
|
|
@@ -369,7 +369,7 @@ contract PendleYieldToken is
|
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
function _pyIndexCurrent() internal returns (uint256 currentIndex) {
|
|
372
|
-
currentIndex = Math.max(
|
|
372
|
+
currentIndex = Math.max(IStandardizedYield(SY).exchangeRate(), _pyIndexStored);
|
|
373
373
|
_pyIndexStored = currentIndex.Uint128();
|
|
374
374
|
emit NewInterestIndex(currentIndex);
|
|
375
375
|
}
|
|
@@ -383,7 +383,7 @@ contract PendleYieldToken is
|
|
|
383
383
|
//////////////////////////////////////////////////////////////*/
|
|
384
384
|
|
|
385
385
|
function getRewardTokens() public view returns (address[] memory) {
|
|
386
|
-
return
|
|
386
|
+
return IStandardizedYield(SY).getRewardTokens();
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
function _doTransferOutRewards(address user, address receiver)
|
|
@@ -436,14 +436,14 @@ contract PendleYieldToken is
|
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
function _redeemExternalReward() internal virtual override {
|
|
439
|
-
|
|
439
|
+
IStandardizedYield(SY).claimRewards(address(this));
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
-
/// @dev effectively returning the amount of
|
|
442
|
+
/// @dev effectively returning the amount of SY generating rewards for this user
|
|
443
443
|
function _rewardSharesUser(address user) internal view virtual override returns (uint256) {
|
|
444
444
|
uint256 index = userInterest[user].index;
|
|
445
445
|
if (index == 0) return 0;
|
|
446
|
-
return
|
|
446
|
+
return SYUtils.assetToSy(index, balanceOf(user)) + userInterest[user].accrued;
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
function _updateRewardIndex()
|
|
@@ -457,7 +457,7 @@ contract PendleYieldToken is
|
|
|
457
457
|
for (uint256 i = 0; i < tokens.length; i++)
|
|
458
458
|
indexes[i] = postExpiry.firstRewardIndex[tokens[i]];
|
|
459
459
|
} else {
|
|
460
|
-
indexes =
|
|
460
|
+
indexes = IStandardizedYield(SY).rewardIndexesCurrent();
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
463
|
|
|
@@ -15,7 +15,7 @@ library Errors {
|
|
|
15
15
|
error MarketZeroLnImpliedRate();
|
|
16
16
|
error MarketInsufficientPtForTrade(int256 currentAmount, int256 requiredAmount);
|
|
17
17
|
error MarketInsufficientPtReceived(uint256 actualBalance, uint256 requiredBalance);
|
|
18
|
-
error
|
|
18
|
+
error MarketInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance);
|
|
19
19
|
error MarketZeroTotalPtOrTotalAsset(int256 totalPt, int256 totalAsset);
|
|
20
20
|
error MarketExchangeRateBelowOne(int256 exchangeRate);
|
|
21
21
|
error MarketProportionMustNotEqualOne();
|
|
@@ -36,15 +36,15 @@ library Errors {
|
|
|
36
36
|
|
|
37
37
|
// ROUTER
|
|
38
38
|
error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut);
|
|
39
|
-
error
|
|
39
|
+
error RouterInsufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut);
|
|
40
40
|
error RouterInsufficientPtOut(uint256 actualPtOut, uint256 requiredPtOut);
|
|
41
41
|
error RouterInsufficientYtOut(uint256 actualYtOut, uint256 requiredYtOut);
|
|
42
42
|
error RouterInsufficientPYOut(uint256 actualPYOut, uint256 requiredPYOut);
|
|
43
43
|
error RouterInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut);
|
|
44
|
-
error
|
|
44
|
+
error RouterExceededLimitSyIn(uint256 actualSyIn, uint256 limitSyIn);
|
|
45
45
|
error RouterExceededLimitPtIn(uint256 actualPtIn, uint256 limitPtIn);
|
|
46
46
|
error RouterExceededLimitYtIn(uint256 actualYtIn, uint256 limitYtIn);
|
|
47
|
-
error
|
|
47
|
+
error RouterInsufficientSyRepay(uint256 actualSyRepay, uint256 requiredSyRepay);
|
|
48
48
|
error RouterInsufficientPtRepay(uint256 actualPtRepay, uint256 requiredPtRepay);
|
|
49
49
|
|
|
50
50
|
error RouterTimeRangeZero();
|
|
@@ -54,31 +54,31 @@ library Errors {
|
|
|
54
54
|
// YIELD CONTRACT
|
|
55
55
|
error YCExpired();
|
|
56
56
|
error YCNotExpired();
|
|
57
|
-
error
|
|
57
|
+
error YieldContractInsufficientSy(uint256 actualSy, uint256 requiredSy);
|
|
58
58
|
error YCNothingToRedeem();
|
|
59
59
|
error YCPostExpiryDataNotSet();
|
|
60
|
-
error
|
|
60
|
+
error YCNoFloatingSy();
|
|
61
61
|
|
|
62
62
|
// YieldFactory
|
|
63
63
|
error YCFactoryInvalidExpiry();
|
|
64
64
|
error YCFactoryYieldContractExisted();
|
|
65
65
|
|
|
66
|
-
//
|
|
67
|
-
error
|
|
68
|
-
error
|
|
69
|
-
error
|
|
70
|
-
error
|
|
71
|
-
error
|
|
72
|
-
error
|
|
66
|
+
// SY
|
|
67
|
+
error SYInvalidTokenIn(address token);
|
|
68
|
+
error SYInvalidTokenOut(address token);
|
|
69
|
+
error SYZeroDeposit();
|
|
70
|
+
error SYZeroRedeem();
|
|
71
|
+
error SYInsufficientSharesOut(uint256 actualSharesOut, uint256 requiredSharesOut);
|
|
72
|
+
error SYInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut);
|
|
73
73
|
|
|
74
|
-
//
|
|
75
|
-
error
|
|
76
|
-
error
|
|
77
|
-
error
|
|
78
|
-
error
|
|
74
|
+
// SY-specific
|
|
75
|
+
error SYQiTokenMintFailed(uint256 errCode);
|
|
76
|
+
error SYQiTokenRedeemFailed(uint256 errCode);
|
|
77
|
+
error SYQiTokenRedeemRewardsFailed(uint256 rewardAccruedType0, uint256 rewardAccruedType1);
|
|
78
|
+
error SYQiTokenBorrowRateTooHigh(uint256 borrowRate, uint256 borrowRateMax);
|
|
79
79
|
|
|
80
|
-
error
|
|
81
|
-
error
|
|
80
|
+
error SYCurveInvalidPid();
|
|
81
|
+
error SYCurve3crvPoolNotFound();
|
|
82
82
|
|
|
83
83
|
// Liquidity Mining
|
|
84
84
|
error VCInactivePool(address pool);
|
|
@@ -111,6 +111,8 @@ library Errors {
|
|
|
111
111
|
error MsgNotFromSendEndpoint(address sender);
|
|
112
112
|
error MsgNotFromReceiveEndpoint(address sender);
|
|
113
113
|
error InsufficientFeeToSendMsg(uint256 currentFee, uint256 requiredFee);
|
|
114
|
+
error ApproxDstExecutionGasNotSet();
|
|
115
|
+
error InvalidRetryData();
|
|
114
116
|
|
|
115
117
|
// GENERIC MSG
|
|
116
118
|
error ArrayLengthMismatch();
|
|
@@ -118,7 +120,7 @@ library Errors {
|
|
|
118
120
|
error ArrayOutOfBounds();
|
|
119
121
|
error ZeroAddress();
|
|
120
122
|
|
|
121
|
-
error
|
|
123
|
+
error OnlyLayerZeroEndpoint();
|
|
122
124
|
error OnlyYT();
|
|
123
125
|
error OnlyYCFactory();
|
|
124
126
|
error OnlyWhitelisted();
|
|
@@ -8,39 +8,6 @@ abstract contract TokenHelper {
|
|
|
8
8
|
address internal constant NATIVE = address(0);
|
|
9
9
|
uint256 internal constant LOWER_BOUND_APPROVAL = type(uint96).max / 2; // some tokens use 96 bits for approval
|
|
10
10
|
|
|
11
|
-
function _transferFrom(
|
|
12
|
-
address token,
|
|
13
|
-
address from,
|
|
14
|
-
address to,
|
|
15
|
-
uint256 amount
|
|
16
|
-
) internal {
|
|
17
|
-
if (token == NATIVE) require(msg.value == amount, "eth mismatch");
|
|
18
|
-
else if (amount != 0) IERC20(token).safeTransferFrom(from, to, amount);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function _transferFrom(
|
|
22
|
-
address[] memory tokens,
|
|
23
|
-
address from,
|
|
24
|
-
address to,
|
|
25
|
-
uint256[] memory amounts
|
|
26
|
-
) internal {
|
|
27
|
-
uint256 length = tokens.length;
|
|
28
|
-
require(length == amounts.length, "length mismatch");
|
|
29
|
-
|
|
30
|
-
for (uint256 i = 0; i < length; ) {
|
|
31
|
-
if (amounts[i] > 0) {
|
|
32
|
-
if (tokens[i] == NATIVE) {
|
|
33
|
-
require(msg.value == amounts[i], "native mismatch");
|
|
34
|
-
} else {
|
|
35
|
-
IERC20(tokens[i]).safeTransferFrom(from, to, amounts[i]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
unchecked {
|
|
39
|
-
i++;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
11
|
function _transferIn(
|
|
45
12
|
address token,
|
|
46
13
|
address from,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.5.0;
|
|
4
|
+
|
|
5
|
+
interface ILayerZeroEndpoint {
|
|
6
|
+
// @notice send a LayerZero message to the specified address at a LayerZero endpoint.
|
|
7
|
+
// @param _dstChainId - the destination chain identifier
|
|
8
|
+
// @param _destination - the address on destination chain (in bytes). address length/format may vary by chains
|
|
9
|
+
// @param _payload - a custom bytes payload to send to the destination contract
|
|
10
|
+
// @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address
|
|
11
|
+
// @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction
|
|
12
|
+
// @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination
|
|
13
|
+
function send(
|
|
14
|
+
uint16 _dstChainId,
|
|
15
|
+
bytes calldata _destination,
|
|
16
|
+
bytes calldata _payload,
|
|
17
|
+
address payable _refundAddress,
|
|
18
|
+
address _zroPaymentAddress,
|
|
19
|
+
bytes calldata _adapterParams
|
|
20
|
+
) external payable;
|
|
21
|
+
|
|
22
|
+
// @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery
|
|
23
|
+
// @param _dstChainId - the destination chain identifier
|
|
24
|
+
// @param _userApplication - the user app address on this EVM chain
|
|
25
|
+
// @param _payload - the custom message to send over LayerZero
|
|
26
|
+
// @param _payInZRO - if false, user app pays the protocol fee in native token
|
|
27
|
+
// @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain
|
|
28
|
+
function estimateFees(
|
|
29
|
+
uint16 _dstChainId,
|
|
30
|
+
address _userApplication,
|
|
31
|
+
bytes calldata _payload,
|
|
32
|
+
bool _payInZRO,
|
|
33
|
+
bytes calldata _adapterParam
|
|
34
|
+
) external view returns (uint256 nativeFee, uint256 zroFee);
|
|
35
|
+
|
|
36
|
+
function setSendVersion(uint16 _newVersion) external;
|
|
37
|
+
|
|
38
|
+
function setReceiveVersion(uint16 _newVersion) external;
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.5.0;
|
|
4
|
+
|
|
5
|
+
interface ILayerZeroReceiver {
|
|
6
|
+
// @notice LayerZero endpoint will invoke this function to deliver the message on the destination
|
|
7
|
+
// @param _srcChainId - the source endpoint identifier
|
|
8
|
+
// @param _srcAddress - the source sending contract address from the source chain
|
|
9
|
+
// @param _nonce - the ordered message nonce
|
|
10
|
+
// @param _payload - the signed payload is the UA bytes has encoded to be sent
|
|
11
|
+
function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;
|
|
12
|
+
}
|