@pendle/core-v2 0.15.1-mainnet → 0.15.2-mainnet
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 +15 -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 +15 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.json +13 -0
- 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 +15 -2
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +15 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +13 -0
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +15 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +15 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +15 -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 +15 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +15 -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/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +4 -0
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +699 -0
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +515 -0
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +4 -0
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +10 -0
- 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 +2 -2
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +77 -17
- package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +1003 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +1068 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/{ConvexCurveLP → base}/PendleConvexLPSY.sol/PendleConvexLPSY.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +856 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +15 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +85 -4
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +17 -4
- package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.json +2 -2
- package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
- package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +3 -38
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.json +2 -2
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.json +13 -0
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +2 -2
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +284 -31
- package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +39 -85
- package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.json +213 -0
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.json +30 -0
- package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.json +76 -0
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +91 -17
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +50 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +20 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +20 -0
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +181 -17
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.json +173 -0
- package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.json +86 -0
- package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.json +34 -0
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +2 -2
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.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 +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.json +45 -0
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +15 -2
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +35 -0
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +2 -80
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +271 -61
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +102 -41
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +61 -24
- 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 +31 -24
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +31 -24
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +15 -2
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.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/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +191 -2
- package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.json +35 -0
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.json +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +58 -27
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +46 -12
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +31 -7
- package/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol +133 -0
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +27 -0
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +9 -10
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +9 -23
- package/contracts/core/BulkSeller/BulkSeller.sol +259 -0
- package/contracts/core/BulkSeller/BulkSellerFactory.sol +88 -0
- package/contracts/core/BulkSeller/BulkSellerMathCore.sol +143 -0
- package/contracts/core/Market/PendleMarket.sol +18 -7
- package/contracts/core/Market/PendleMarketFactory.sol +15 -5
- package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol +102 -0
- package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol +160 -0
- package/contracts/core/StandardizedYield/implementations/Convex/README.md +29 -0
- package/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol +215 -0
- package/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol +127 -0
- package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +152 -0
- package/contracts/core/StandardizedYield/implementations/Convex/{ConvexCurveLP → base}/PendleConvexLPSY.sol +2 -4
- package/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol +122 -0
- package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +17 -8
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +38 -11
- package/contracts/core/YieldContracts/PendleYieldToken.sol +54 -21
- package/contracts/core/erc20/PendleERC20.sol +4 -7
- package/contracts/core/libraries/BaseSplitCodeFactory.sol +1 -1
- package/contracts/core/libraries/BoringOwnableUpgradeable.sol +1 -1
- package/contracts/core/libraries/Errors.sol +32 -4
- package/contracts/core/libraries/StringLib.sol +782 -0
- package/contracts/core/libraries/TokenHelper.sol +9 -0
- package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -1
- package/contracts/interfaces/Curve/ICrvPool.sol +12 -31
- package/contracts/interfaces/Curve/ITriCrvPool.sol +41 -0
- package/contracts/interfaces/ILayerZeroEndpoint.sol +39 -0
- package/contracts/interfaces/ILayerZeroReceiver.sol +12 -0
- package/contracts/interfaces/ILooksFeeSharing.sol +5 -0
- package/contracts/interfaces/ILooksStaking.sol +13 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +3 -5
- package/contracts/interfaces/IPActionMintRedeem.sol +2 -0
- package/contracts/interfaces/IPBulkSeller.sol +28 -0
- package/contracts/interfaces/IPBulkSellerFactory.sol +12 -0
- package/contracts/interfaces/IPBulkSellerSYCallback.sol +10 -0
- package/contracts/interfaces/IPMarketFactory.sol +1 -1
- package/contracts/interfaces/IPMsgSendEndpoint.sol +4 -2
- package/contracts/interfaces/IPYieldContractFactory.sol +1 -1
- package/contracts/interfaces/IStETH.sol +6 -0
- package/contracts/interfaces/IStandardizedYield.sol +15 -10
- package/contracts/offchain-helpers/BulkSellerOffchain.sol +43 -0
- package/contracts/offchain-helpers/MarketMathStatic.sol +0 -173
- package/contracts/offchain-helpers/RouterStatic.sol +189 -50
- package/contracts/router/ActionAddRemoveLiq.sol +71 -52
- package/contracts/router/ActionCallback.sol +4 -8
- package/contracts/router/ActionMintRedeem.sol +27 -18
- package/contracts/router/ActionSwapPT.sol +8 -9
- package/contracts/router/ActionSwapPTYT.sol +3 -7
- package/contracts/router/ActionSwapYT.sol +15 -10
- package/contracts/router/PendleRouter.sol +3 -0
- package/contracts/router/base/ActionBaseMintRedeem.sol +78 -83
- package/contracts/router/base/MarketApproxLib.sol +1 -1
- package/contracts/router/kyberswap/AggregationRouterHelper.sol +17 -1
- package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +10 -0
- package/contracts/router/kyberswap/KyberSwapHelper.sol +21 -8
- package/deployments/1-markets/FRAX_30_MAR_23.json +8 -0
- package/deployments/1-markets/LOOKS_30_MAR_23.json +8 -0
- package/deployments/1-markets/USDD_MARCH_30.json +8 -0
- package/deployments/1-offchain-helper.json +3 -0
- package/package.json +3 -2
- package/typechain-types/AccessControl.ts +360 -0
- package/typechain-types/AccessControlUpgradeable.ts +369 -0
- package/typechain-types/ActionAddRemoveLiq.ts +64 -52
- package/typechain-types/ActionBaseMintRedeem.ts +8 -8
- package/typechain-types/ActionMintRedeem.ts +48 -16
- package/typechain-types/ActionSwapPT.ts +34 -12
- package/typechain-types/ActionSwapYT.ts +34 -12
- package/typechain-types/AggregationRouterHelper.ts +287 -3
- package/typechain-types/BaseSplitCodeFactoryContract.ts +9 -0
- package/typechain-types/BeaconProxy.ts +97 -0
- package/typechain-types/BoringOwnableUpgradeable.ts +9 -0
- package/typechain-types/BulkSeller.ts +777 -0
- package/typechain-types/BulkSellerFactory.ts +707 -0
- package/typechain-types/BulkSellerOffchain.ts +117 -0
- package/typechain-types/ContextUpgradeable.ts +68 -0
- package/typechain-types/Curve3CrvPoolHelper.ts +236 -0
- package/typechain-types/CurveFraxUsdcPoolHelper.ts +158 -0
- package/typechain-types/CurveUsdd3CrvPoolHelper.ts +184 -0
- package/typechain-types/ERC165.ts +102 -0
- package/typechain-types/ERC165Upgradeable.ts +113 -0
- package/typechain-types/IAccessControl.ts +305 -0
- package/typechain-types/IAccessControlUpgradeable.ts +305 -0
- package/typechain-types/IAggregationRouterHelper.ts +108 -0
- package/typechain-types/IBooster.ts +9 -3
- package/typechain-types/ICrvPool.ts +69 -172
- package/typechain-types/IERC165.ts +102 -0
- package/typechain-types/IERC165Upgradeable.ts +102 -0
- package/typechain-types/ILooksStaking.ts +27 -0
- package/typechain-types/IPActionAddRemoveLiq.ts +56 -44
- package/typechain-types/IPActionMintRedeem.ts +40 -8
- package/typechain-types/IPActionSwapPT.ts +26 -4
- package/typechain-types/IPActionSwapYT.ts +26 -4
- package/typechain-types/IPAllAction.ts +76 -54
- package/typechain-types/IPBulkSeller.ts +290 -0
- package/typechain-types/IPBulkSellerCallback.ts +115 -0
- package/typechain-types/IPBulkSellerFactory.ts +147 -0
- package/typechain-types/IPMarketFactory.ts +2 -2
- package/typechain-types/IPYieldContractFactory.ts +3 -3
- package/typechain-types/IStETH.ts +56 -0
- package/typechain-types/ITriCrvPool.ts +345 -0
- package/typechain-types/Initializable.ts +68 -0
- package/typechain-types/KyberSwapHelper.ts +8 -8
- package/typechain-types/MarketMathStatic.ts +0 -117
- package/typechain-types/PendleCurveFraxUsdcSY.ts +1228 -0
- package/typechain-types/PendleCurveUsdd3CrvSY.ts +1299 -0
- package/typechain-types/PendleFeeDistributor.ts +9 -0
- package/typechain-types/PendleFeeDistributorFactory.ts +9 -0
- package/typechain-types/PendleGaugeControllerBaseUpg.ts +9 -0
- package/typechain-types/PendleGaugeControllerMainchainUpg.ts +9 -0
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +9 -0
- package/typechain-types/PendleLooksStakingSY.ts +1052 -0
- package/typechain-types/PendleMarketFactory.ts +51 -2
- package/typechain-types/PendleMsgReceiveEndpointUpg.ts +9 -0
- package/typechain-types/PendleMsgSendEndpointUpg.ts +9 -0
- package/typechain-types/PendleMsgSenderAppUpg.ts +9 -0
- package/typechain-types/PendlePrincipalToken.ts +9 -0
- package/typechain-types/PendleRouter.ts +9 -0
- package/typechain-types/PendleVotingControllerUpg.ts +9 -0
- package/typechain-types/PendleYieldContractFactory.ts +57 -8
- package/typechain-types/PendleYieldToken.ts +21 -0
- package/typechain-types/ReentrancyGuardUpgradeable.ts +68 -0
- package/typechain-types/RouterStatic.ts +260 -22
- package/typechain-types/VotingEscrowPendleMainchain.ts +9 -0
- package/typechain-types/VotingEscrowPendleSidechain.ts +9 -0
- package/typechain-types/factories/AccessControlUpgradeable__factory.ts +247 -0
- package/typechain-types/factories/AccessControl__factory.ts +227 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +106 -59
- package/typechain-types/factories/ActionBaseMintRedeem__factory.ts +1 -1
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +65 -42
- package/typechain-types/factories/ActionMisc__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +35 -42
- package/typechain-types/factories/ActionSwapYT__factory.ts +35 -42
- package/typechain-types/factories/AggregationRouterHelper__factory.ts +190 -1
- package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +14 -1
- package/typechain-types/factories/BaseSplitCodeFactory__factory.ts +1 -1
- package/typechain-types/factories/BeaconProxy__factory.ts +141 -0
- package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
- package/typechain-types/factories/BoringOwnableUpgradeable__factory.ts +13 -0
- package/typechain-types/factories/BulkSellerFactory__factory.ts +568 -0
- package/typechain-types/factories/BulkSellerOffchain__factory.ts +88 -0
- package/typechain-types/factories/BulkSeller__factory.ts +749 -0
- package/typechain-types/factories/ContextUpgradeable__factory.ts +39 -0
- package/typechain-types/factories/Curve3CrvPoolHelper__factory.ts +220 -0
- package/typechain-types/factories/CurveFraxUsdcPoolHelper__factory.ts +146 -0
- package/typechain-types/factories/CurveUsdd3CrvPoolHelper__factory.ts +172 -0
- package/typechain-types/factories/ERC165Upgradeable__factory.ts +58 -0
- package/typechain-types/factories/ERC165__factory.ts +39 -0
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/Errors__factory.ts +283 -30
- package/typechain-types/factories/IAccessControlUpgradeable__factory.ts +202 -0
- package/typechain-types/factories/IAccessControl__factory.ts +198 -0
- package/typechain-types/factories/IAggregationRouterHelper__factory.ts +54 -0
- package/typechain-types/factories/IBooster__factory.ts +1 -1
- package/typechain-types/factories/ICrvPool__factory.ts +39 -85
- package/typechain-types/factories/IERC165Upgradeable__factory.ts +45 -0
- package/typechain-types/factories/IERC165__factory.ts +42 -0
- package/typechain-types/factories/ILooksStaking__factory.ts +7 -0
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +91 -17
- package/typechain-types/factories/IPActionMintRedeem__factory.ts +50 -0
- package/typechain-types/factories/IPActionSwapPT__factory.ts +20 -0
- package/typechain-types/factories/IPActionSwapYT__factory.ts +20 -0
- package/typechain-types/factories/IPAllAction__factory.ts +181 -17
- package/typechain-types/factories/IPBulkSellerCallback__factory.ts +53 -0
- package/typechain-types/factories/IPBulkSellerFactory__factory.ts +101 -0
- package/typechain-types/factories/IPBulkSeller__factory.ts +185 -0
- package/typechain-types/factories/IPMarketFactory__factory.ts +2 -2
- package/typechain-types/factories/IPYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/IStETH__factory.ts +45 -0
- package/typechain-types/factories/ITriCrvPool__factory.ts +225 -0
- package/typechain-types/factories/ImplicitSwapfeeContract__factory.ts +1 -1
- package/typechain-types/factories/Initializable__factory.ts +36 -0
- package/typechain-types/factories/KyberSwapHelper__factory.ts +1 -1
- package/typechain-types/factories/MarketMathStatic__factory.ts +1 -79
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1068 -0
- package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1133 -0
- package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +14 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +14 -1
- package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +13 -0
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +14 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +14 -1
- package/typechain-types/factories/PendleLooksStakingSY__factory.ts +937 -0
- package/typechain-types/factories/PendleMarketFactory__factory.ts +76 -16
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +14 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +14 -1
- package/typechain-types/factories/PendleMsgSenderAppUpg__factory.ts +13 -0
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +14 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +14 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +14 -1
- package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +84 -3
- package/typechain-types/factories/PendleYieldToken__factory.ts +16 -3
- package/typechain-types/factories/ReentrancyGuardUpgradeable__factory.ts +43 -0
- package/typechain-types/factories/RouterStatic__factory.ts +216 -2
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +14 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +14 -1
- package/typechain-types/hardhat.d.ts +233 -17
- package/typechain-types/index.ts +50 -6
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.json +0 -1018
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +0 -76
- package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.json +0 -182
- package/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol +0 -167
- package/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol +0 -83
- package/contracts/interfaces/ICelerMessageBus.sol +0 -28
- package/contracts/interfaces/ICelerMessageReceiverApp.sol +0 -25
package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../../../../libraries/math/Math.sol";
|
|
5
|
+
import "../../../../../interfaces/Curve/ICrvPool.sol";
|
|
6
|
+
import "./Curve3CrvPoolHelper.sol";
|
|
7
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
8
|
+
|
|
9
|
+
library CurveUsdd3CrvPoolHelper {
|
|
10
|
+
using Math for uint256;
|
|
11
|
+
|
|
12
|
+
uint256 internal constant N_COINS = 2;
|
|
13
|
+
uint256 internal constant A_PRECISION = 100;
|
|
14
|
+
uint256 internal constant PRECISION = 10**18;
|
|
15
|
+
uint256 internal constant rate_multiplier = 10**18;
|
|
16
|
+
uint256 internal constant FEE_DENOMINATOR = 10**10;
|
|
17
|
+
|
|
18
|
+
// LP == POOL
|
|
19
|
+
address internal constant POOL = 0xe6b5CC1B4b47305c58392CE3D359B10282FC36Ea;
|
|
20
|
+
address internal constant USDD = 0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6;
|
|
21
|
+
address internal constant LP_3CRV = 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490;
|
|
22
|
+
|
|
23
|
+
function _getBalances() internal view returns (uint256[N_COINS] memory balances) {
|
|
24
|
+
balances[0] = ICrvPool(POOL).balances(0);
|
|
25
|
+
balances[1] = ICrvPool(POOL).balances(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _getTokenAmounts(address token, uint256 amount)
|
|
29
|
+
internal
|
|
30
|
+
pure
|
|
31
|
+
returns (uint256[N_COINS] memory res)
|
|
32
|
+
{
|
|
33
|
+
res[token == USDD ? 0 : 1] = amount;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ----------------- Forked from https://etherscan.io/address/0xe6b5CC1B4b47305c58392CE3D359B10282FC36Ea#code -----------------
|
|
37
|
+
function previewAddLiquidity(address token, uint256 amount) internal view returns (uint256) {
|
|
38
|
+
uint256 amp = ICrvPool(POOL).A_precise();
|
|
39
|
+
|
|
40
|
+
uint256[N_COINS] memory rates;
|
|
41
|
+
|
|
42
|
+
rates[0] = rate_multiplier;
|
|
43
|
+
|
|
44
|
+
if (token == USDD || token == LP_3CRV) {
|
|
45
|
+
rates[1] = Curve3CrvPoolHelper.get_virtual_price();
|
|
46
|
+
} else {
|
|
47
|
+
(amount, rates[1]) = Curve3CrvPoolHelper.preview3CrvDeposit(token, amount);
|
|
48
|
+
token = LP_3CRV;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
uint256[N_COINS] memory amounts = _getTokenAmounts(token, amount);
|
|
52
|
+
|
|
53
|
+
uint256[N_COINS] memory old_balances = _getBalances();
|
|
54
|
+
uint256 D0 = get_D_mem(rates, old_balances, amp);
|
|
55
|
+
uint256[N_COINS] memory new_balances = arrayClone(old_balances);
|
|
56
|
+
|
|
57
|
+
uint256 total_supply = IERC20(POOL).totalSupply();
|
|
58
|
+
for (uint256 i = 0; i < N_COINS; ++i) {
|
|
59
|
+
new_balances[i] += amounts[i];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Invariant after change
|
|
63
|
+
uint256 D1 = get_D_mem(rates, new_balances, amp);
|
|
64
|
+
assert(D1 > D0);
|
|
65
|
+
|
|
66
|
+
// We need to recalculate the invariant accounting for fees
|
|
67
|
+
// to calculate fair user's share
|
|
68
|
+
uint256[N_COINS] memory fees;
|
|
69
|
+
uint256 mint_amount = 0;
|
|
70
|
+
|
|
71
|
+
uint256 base_fee = (ICrvPool(POOL).fee() * N_COINS) / (4 * (N_COINS - 1));
|
|
72
|
+
for (uint256 i = 0; i < N_COINS; ++i) {
|
|
73
|
+
uint256 ideal_balance = (D1 * old_balances[i]) / D0;
|
|
74
|
+
uint256 difference = 0;
|
|
75
|
+
uint256 new_balance = new_balances[i];
|
|
76
|
+
if (ideal_balance > new_balance) {
|
|
77
|
+
difference = ideal_balance - new_balance;
|
|
78
|
+
} else {
|
|
79
|
+
difference = new_balance - ideal_balance;
|
|
80
|
+
}
|
|
81
|
+
fees[i] = (base_fee * difference) / FEE_DENOMINATOR;
|
|
82
|
+
new_balances[i] -= fees[i];
|
|
83
|
+
}
|
|
84
|
+
uint256 D2 = get_D_mem(rates, new_balances, amp);
|
|
85
|
+
mint_amount = (total_supply * (D2 - D0)) / D0;
|
|
86
|
+
return mint_amount;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function get_D_mem(
|
|
90
|
+
uint256[N_COINS] memory _rates,
|
|
91
|
+
uint256[N_COINS] memory _balances,
|
|
92
|
+
uint256 _amp
|
|
93
|
+
) internal pure returns (uint256) {
|
|
94
|
+
uint256[N_COINS] memory xp = _xp_mem(_rates, _balances);
|
|
95
|
+
return get_D(xp, _amp);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function _xp_mem(uint256[N_COINS] memory _rates, uint256[N_COINS] memory balances)
|
|
99
|
+
internal
|
|
100
|
+
pure
|
|
101
|
+
returns (uint256[N_COINS] memory)
|
|
102
|
+
{
|
|
103
|
+
uint256[N_COINS] memory result;
|
|
104
|
+
for (uint256 i = 0; i < N_COINS; ++i) {
|
|
105
|
+
result[i] = balances[i] * _rates[i] / PRECISION;
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function get_D(uint256[N_COINS] memory _xp, uint256 _amp) internal pure returns (uint256) {
|
|
111
|
+
uint256 S = 0;
|
|
112
|
+
uint256 Dprev = 0;
|
|
113
|
+
for (uint256 k = 0; k < N_COINS; ++k) {
|
|
114
|
+
S += _xp[k];
|
|
115
|
+
}
|
|
116
|
+
if (S == 0) return 0;
|
|
117
|
+
|
|
118
|
+
uint256 D = S;
|
|
119
|
+
uint256 Ann = _amp * N_COINS;
|
|
120
|
+
for (uint256 _i = 0; _i < 255; ++_i) {
|
|
121
|
+
uint256 D_P = D;
|
|
122
|
+
for (uint256 k = 0; k < N_COINS; ++k) {
|
|
123
|
+
D_P = (D_P * D) / (_xp[k] * N_COINS);
|
|
124
|
+
}
|
|
125
|
+
Dprev = D;
|
|
126
|
+
D =
|
|
127
|
+
(((Ann * S) / A_PRECISION + D_P * N_COINS) * D) /
|
|
128
|
+
(((Ann - A_PRECISION) * D) / A_PRECISION + (N_COINS + 1) * D_P);
|
|
129
|
+
|
|
130
|
+
if (D > Dprev) {
|
|
131
|
+
if (D - Dprev <= 1) {
|
|
132
|
+
return D;
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
if (Dprev - D <= 1) {
|
|
136
|
+
return D;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
assert(false);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function arrayClone(uint256[N_COINS] memory a)
|
|
144
|
+
internal
|
|
145
|
+
pure
|
|
146
|
+
returns (uint256[N_COINS] memory res)
|
|
147
|
+
{
|
|
148
|
+
for (uint256 i = 0; i < N_COINS; ++i) {
|
|
149
|
+
res[i] = a[i];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -143,12 +143,10 @@ abstract contract PendleConvexLPSY is SYBaseWithRewards {
|
|
|
143
143
|
override
|
|
144
144
|
returns (uint256 amountTokenOut)
|
|
145
145
|
{
|
|
146
|
-
uint256 amountLpTokenToReceive = (amountSharesToRedeem * exchangeRate()) / 1e18;
|
|
147
|
-
|
|
148
146
|
if (tokenOut == crvLp) {
|
|
149
|
-
amountTokenOut =
|
|
147
|
+
amountTokenOut = amountSharesToRedeem;
|
|
150
148
|
} else {
|
|
151
|
-
amountTokenOut = _previewRedeemFromCurve(tokenOut,
|
|
149
|
+
amountTokenOut = _previewRedeemFromCurve(tokenOut, amountSharesToRedeem);
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
152
|
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../SYBase.sol";
|
|
5
|
+
import "../../../interfaces/ILooksFeeSharing.sol";
|
|
6
|
+
import "../../../interfaces/ILooksStaking.sol";
|
|
7
|
+
|
|
8
|
+
contract PendleLooksStakingSY is SYBase {
|
|
9
|
+
using Math for uint256;
|
|
10
|
+
|
|
11
|
+
address public immutable looks;
|
|
12
|
+
address public immutable stakingContract;
|
|
13
|
+
address public immutable feeSharingContract;
|
|
14
|
+
|
|
15
|
+
constructor(
|
|
16
|
+
string memory _name,
|
|
17
|
+
string memory _symbol,
|
|
18
|
+
address _looks,
|
|
19
|
+
address _stakingContract,
|
|
20
|
+
address _feeSharingContract
|
|
21
|
+
) SYBase(_name, _symbol, _looks) {
|
|
22
|
+
looks = _looks;
|
|
23
|
+
stakingContract = _stakingContract;
|
|
24
|
+
feeSharingContract = _feeSharingContract;
|
|
25
|
+
|
|
26
|
+
_safeApproveInf(_looks, _stakingContract);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*///////////////////////////////////////////////////////////////
|
|
30
|
+
DEPOSIT/REDEEM USING BASE TOKENS
|
|
31
|
+
//////////////////////////////////////////////////////////////*/
|
|
32
|
+
|
|
33
|
+
function _deposit(address, uint256 amountDeposited)
|
|
34
|
+
internal
|
|
35
|
+
virtual
|
|
36
|
+
override
|
|
37
|
+
returns (uint256 amountSharesOut)
|
|
38
|
+
{
|
|
39
|
+
uint256 previousShare = ILooksStaking(stakingContract).userInfo(address(this));
|
|
40
|
+
ILooksStaking(stakingContract).deposit(amountDeposited);
|
|
41
|
+
amountSharesOut = ILooksStaking(stakingContract).userInfo(address(this)) - previousShare;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function _redeem(
|
|
45
|
+
address receiver,
|
|
46
|
+
address,
|
|
47
|
+
uint256 amountSharesToRedeem
|
|
48
|
+
) internal virtual override returns (uint256 amountTokenOut) {
|
|
49
|
+
uint256 previousBalance = _selfBalance(looks);
|
|
50
|
+
ILooksStaking(stakingContract).withdraw(amountSharesToRedeem);
|
|
51
|
+
amountTokenOut = _selfBalance(looks) - previousBalance;
|
|
52
|
+
_transferOut(looks, receiver, amountTokenOut);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*///////////////////////////////////////////////////////////////
|
|
56
|
+
EXCHANGE-RATE
|
|
57
|
+
//////////////////////////////////////////////////////////////*/
|
|
58
|
+
|
|
59
|
+
function exchangeRate() public view virtual override returns (uint256) {
|
|
60
|
+
uint256 totalShares = ILooksStaking(stakingContract).totalShares();
|
|
61
|
+
uint256 totalLooks = ILooksFeeSharing(feeSharingContract).calculateSharesValueInLOOKS(
|
|
62
|
+
stakingContract
|
|
63
|
+
);
|
|
64
|
+
return totalLooks.divDown(totalShares);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*///////////////////////////////////////////////////////////////
|
|
68
|
+
MISC FUNCTIONS FOR METADATA
|
|
69
|
+
//////////////////////////////////////////////////////////////*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @dev LooksRare also uses 1e18 precision, so it is accurate to
|
|
73
|
+
* calculate preview results using our built-in exchangeRate function
|
|
74
|
+
*/
|
|
75
|
+
function _previewDeposit(address, uint256 amountTokenToDeposit)
|
|
76
|
+
internal
|
|
77
|
+
view
|
|
78
|
+
override
|
|
79
|
+
returns (uint256 amountSharesOut)
|
|
80
|
+
{
|
|
81
|
+
amountSharesOut = amountTokenToDeposit.divDown(exchangeRate());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function _previewRedeem(address, uint256 amountSharesToRedeem)
|
|
85
|
+
internal
|
|
86
|
+
view
|
|
87
|
+
override
|
|
88
|
+
returns (uint256 amountTokenOut)
|
|
89
|
+
{
|
|
90
|
+
amountTokenOut = amountSharesToRedeem.mulDown(exchangeRate());
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
94
|
+
res = new address[](1);
|
|
95
|
+
res[0] = looks;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
99
|
+
res = new address[](1);
|
|
100
|
+
res[0] = looks;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
104
|
+
return token == looks;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
108
|
+
return token == looks;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function assetInfo()
|
|
112
|
+
external
|
|
113
|
+
view
|
|
114
|
+
returns (
|
|
115
|
+
AssetType assetType,
|
|
116
|
+
address assetAddress,
|
|
117
|
+
uint8 assetDecimals
|
|
118
|
+
)
|
|
119
|
+
{
|
|
120
|
+
return (AssetType.TOKEN, looks, IERC20Metadata(looks).decimals());
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -50,9 +50,10 @@ contract PendleWstEthSY is SYBase {
|
|
|
50
50
|
} else {
|
|
51
51
|
if (tokenIn == wETH) IWETH(wETH).withdraw(amountDeposited);
|
|
52
52
|
|
|
53
|
-
uint256
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
uint256 amountStEthSharesOut = IStETH(stETH).submit{ value: amountDeposited }(
|
|
54
|
+
address(0)
|
|
55
|
+
);
|
|
56
|
+
amountStETH = IStETH(stETH).getPooledEthByShares(amountStEthSharesOut);
|
|
56
57
|
}
|
|
57
58
|
amountSharesOut = IWstETH(wstETH).wrap(amountStETH);
|
|
58
59
|
}
|
|
@@ -101,13 +102,21 @@ contract PendleWstEthSY is SYBase {
|
|
|
101
102
|
{
|
|
102
103
|
if (tokenIn == wstETH) amountSharesOut = amountTokenToDeposit;
|
|
103
104
|
else {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
if (tokenIn != stETH) {
|
|
106
|
+
uint256 totalShares = IStETH(stETH).getTotalShares();
|
|
107
|
+
uint256 totalPooledEth = IStETH(stETH).getTotalPooledEther();
|
|
108
|
+
uint256 amountStEthSharesOut = IStETH(stETH).getSharesByPooledEth(
|
|
109
|
+
amountTokenToDeposit
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
totalShares += amountStEthSharesOut;
|
|
113
|
+
totalPooledEth += amountTokenToDeposit;
|
|
114
|
+
|
|
115
|
+
uint256 stEthBalance = (amountStEthSharesOut * totalPooledEth) / totalShares;
|
|
116
|
+
amountSharesOut = (stEthBalance * totalShares) / totalPooledEth;
|
|
107
117
|
} else {
|
|
108
|
-
|
|
118
|
+
amountSharesOut = IStETH(stETH).getSharesByPooledEth(amountTokenToDeposit);
|
|
109
119
|
}
|
|
110
|
-
amountSharesOut = IStETH(stETH).getSharesByPooledEth(amountStETH);
|
|
111
120
|
}
|
|
112
121
|
}
|
|
113
122
|
|
|
@@ -9,7 +9,7 @@ import "../libraries/Errors.sol";
|
|
|
9
9
|
|
|
10
10
|
import "../erc20/PendleERC20Permit.sol";
|
|
11
11
|
|
|
12
|
-
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
|
12
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
13
13
|
|
|
14
14
|
contract PendlePrincipalToken is PendleERC20Permit, Initializable, IPPrincipalToken {
|
|
15
15
|
address public immutable SY;
|
|
@@ -22,7 +22,7 @@ contract PendlePrincipalToken is PendleERC20Permit, Initializable, IPPrincipalTo
|
|
|
22
22
|
_;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
modifier
|
|
25
|
+
modifier onlyYieldFactory() {
|
|
26
26
|
if (msg.sender != factory) revert Errors.OnlyYCFactory();
|
|
27
27
|
_;
|
|
28
28
|
}
|
|
@@ -39,7 +39,7 @@ contract PendlePrincipalToken is PendleERC20Permit, Initializable, IPPrincipalTo
|
|
|
39
39
|
factory = msg.sender;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function initialize(address _YT) external initializer
|
|
42
|
+
function initialize(address _YT) external initializer onlyYieldFactory {
|
|
43
43
|
YT = _YT;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -33,6 +33,7 @@ import "../libraries/BaseSplitCodeFactory.sol";
|
|
|
33
33
|
import "../libraries/MiniHelpers.sol";
|
|
34
34
|
import "../libraries/Errors.sol";
|
|
35
35
|
import "../libraries/BoringOwnableUpgradeable.sol";
|
|
36
|
+
import "../libraries/StringLib.sol";
|
|
36
37
|
|
|
37
38
|
import "./PendlePrincipalToken.sol";
|
|
38
39
|
import "./PendleYieldToken.sol";
|
|
@@ -40,9 +41,12 @@ import "./PendleYieldToken.sol";
|
|
|
40
41
|
/// @dev If this contract is ever made upgradeable, please pay attention to the numContractDeployed variable
|
|
41
42
|
contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContractFactory {
|
|
42
43
|
using ExpiryUtils for string;
|
|
44
|
+
using StringLib for string;
|
|
45
|
+
using StringLib for StringLib.slice;
|
|
43
46
|
|
|
44
47
|
string private constant PT_PREFIX = "PT";
|
|
45
48
|
string private constant YT_PREFIX = "YT";
|
|
49
|
+
string private constant SY_PREF = "SY-";
|
|
46
50
|
|
|
47
51
|
address public immutable ytCreationCodeContractA;
|
|
48
52
|
uint256 public immutable ytCreationCodeSizeA;
|
|
@@ -58,11 +62,15 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
|
|
|
58
62
|
uint96 public expiryDivisor;
|
|
59
63
|
|
|
60
64
|
// SY => expiry => address
|
|
65
|
+
// returns address(0) if not created
|
|
61
66
|
mapping(address => mapping(uint256 => address)) public getPT;
|
|
62
67
|
mapping(address => mapping(uint256 => address)) public getYT;
|
|
63
68
|
mapping(address => bool) public isPT;
|
|
64
69
|
mapping(address => bool) public isYT;
|
|
65
70
|
|
|
71
|
+
uint256 public constant maxInterestFeeRate = 2e17; // 20%
|
|
72
|
+
uint256 public constant maxRewardFeeRate = 2e17; // 20%
|
|
73
|
+
|
|
66
74
|
constructor(
|
|
67
75
|
address _ytCreationCodeContractA,
|
|
68
76
|
uint256 _ytCreationCodeSizeA,
|
|
@@ -92,10 +100,10 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
|
|
|
92
100
|
* @notice Create a pair of (PT, YT) from any SY and valid expiry. Anyone can create a yield contract
|
|
93
101
|
* @dev It's intentional to make expiry an uint32 to guard against fat fingers. uint32.max is year 2106
|
|
94
102
|
*/
|
|
95
|
-
function createYieldContract(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
{
|
|
103
|
+
function createYieldContract(
|
|
104
|
+
address SY,
|
|
105
|
+
uint32 expiry
|
|
106
|
+
) external returns (address PT, address YT) {
|
|
99
107
|
if (MiniHelpers.isTimeInThePast(expiry) || expiry % expiryDivisor != 0)
|
|
100
108
|
revert Errors.YCFactoryInvalidExpiry();
|
|
101
109
|
|
|
@@ -105,6 +113,9 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
|
|
|
105
113
|
|
|
106
114
|
(, , uint8 assetDecimals) = _SY.assetInfo();
|
|
107
115
|
|
|
116
|
+
string memory syCoreName = _stripSYPrefix(_SY.name());
|
|
117
|
+
string memory syCoreSymbol = _stripSYPrefix(_SY.symbol());
|
|
118
|
+
|
|
108
119
|
PT = Create2.deploy(
|
|
109
120
|
0,
|
|
110
121
|
bytes32(block.chainid),
|
|
@@ -112,8 +123,8 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
|
|
|
112
123
|
type(PendlePrincipalToken).creationCode,
|
|
113
124
|
abi.encode(
|
|
114
125
|
SY,
|
|
115
|
-
PT_PREFIX.concat(
|
|
116
|
-
PT_PREFIX.concat(
|
|
126
|
+
PT_PREFIX.concat(syCoreName, expiry, " "),
|
|
127
|
+
PT_PREFIX.concat(syCoreSymbol, expiry, "-"),
|
|
117
128
|
assetDecimals,
|
|
118
129
|
expiry
|
|
119
130
|
)
|
|
@@ -126,8 +137,8 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
|
|
|
126
137
|
abi.encode(
|
|
127
138
|
SY,
|
|
128
139
|
PT,
|
|
129
|
-
YT_PREFIX.concat(
|
|
130
|
-
YT_PREFIX.concat(
|
|
140
|
+
YT_PREFIX.concat(syCoreName, expiry, " "),
|
|
141
|
+
YT_PREFIX.concat(syCoreSymbol, expiry, "-"),
|
|
131
142
|
assetDecimals,
|
|
132
143
|
expiry
|
|
133
144
|
),
|
|
@@ -148,22 +159,38 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
|
|
|
148
159
|
}
|
|
149
160
|
|
|
150
161
|
function setExpiryDivisor(uint96 newExpiryDivisor) public onlyOwner {
|
|
162
|
+
if (newExpiryDivisor == 0) revert Errors.YCFactoryZeroExpiryDivisor();
|
|
163
|
+
|
|
151
164
|
expiryDivisor = newExpiryDivisor;
|
|
152
165
|
emit SetExpiryDivisor(newExpiryDivisor);
|
|
153
166
|
}
|
|
154
167
|
|
|
155
168
|
function setInterestFeeRate(uint128 newInterestFeeRate) public onlyOwner {
|
|
169
|
+
if (newInterestFeeRate > maxInterestFeeRate)
|
|
170
|
+
revert Errors.YCFactoryInterestFeeRateTooHigh(newInterestFeeRate, maxInterestFeeRate);
|
|
171
|
+
|
|
156
172
|
interestFeeRate = newInterestFeeRate;
|
|
157
173
|
emit SetInterestFeeRate(newInterestFeeRate);
|
|
158
174
|
}
|
|
159
175
|
|
|
160
|
-
function setRewardFeeRate(uint128
|
|
161
|
-
|
|
162
|
-
|
|
176
|
+
function setRewardFeeRate(uint128 newRewardFeeRate) public onlyOwner {
|
|
177
|
+
if (newRewardFeeRate > maxRewardFeeRate)
|
|
178
|
+
revert Errors.YCFactoryRewardFeeRateTooHigh(newRewardFeeRate, maxRewardFeeRate);
|
|
179
|
+
|
|
180
|
+
rewardFeeRate = newRewardFeeRate;
|
|
181
|
+
emit SetRewardFeeRate(newRewardFeeRate);
|
|
163
182
|
}
|
|
164
183
|
|
|
165
184
|
function setTreasury(address newTreasury) public onlyOwner {
|
|
185
|
+
if (newTreasury == address(0)) revert Errors.YCFactoryZeroTreasury();
|
|
186
|
+
|
|
166
187
|
treasury = newTreasury;
|
|
167
188
|
emit SetTreasury(newTreasury);
|
|
168
189
|
}
|
|
190
|
+
|
|
191
|
+
function _stripSYPrefix(string memory _str) internal pure returns (string memory) {
|
|
192
|
+
StringLib.slice memory str = _str.toSlice();
|
|
193
|
+
StringLib.slice memory delim = SY_PREF.toSlice();
|
|
194
|
+
return str.beyond(delim).toString();
|
|
195
|
+
}
|
|
169
196
|
}
|
|
@@ -45,7 +45,9 @@ contract PendleYieldToken is
|
|
|
45
45
|
address public immutable factory;
|
|
46
46
|
uint256 public immutable expiry;
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
uint256 public syReserve;
|
|
49
|
+
|
|
50
|
+
uint128 public pyIndexLastUpdatedBlock;
|
|
49
51
|
uint128 internal _pyIndexStored;
|
|
50
52
|
|
|
51
53
|
PostExpiryData public postExpiry;
|
|
@@ -61,6 +63,9 @@ contract PendleYieldToken is
|
|
|
61
63
|
_;
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
/**
|
|
67
|
+
* for all txs within the same block. Otherwise, the PY index is recalculated for every tx.
|
|
68
|
+
*/
|
|
64
69
|
constructor(
|
|
65
70
|
address _SY,
|
|
66
71
|
address _PT,
|
|
@@ -75,7 +80,10 @@ contract PendleYieldToken is
|
|
|
75
80
|
factory = msg.sender;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
|
|
83
|
+
/**
|
|
84
|
+
* @notice Tokenize SY into PT + YT of equal qty. Every unit of underlying of SY will create 1 PT + 1 YT
|
|
85
|
+
* @dev SY should be transferred directly into this contract prior to calling this function
|
|
86
|
+
*/
|
|
79
87
|
function mintPY(address receiverPT, address receiverYT)
|
|
80
88
|
external
|
|
81
89
|
nonReentrant
|
|
@@ -97,7 +105,7 @@ contract PendleYieldToken is
|
|
|
97
105
|
amountPYOut = amountPYOuts[0];
|
|
98
106
|
}
|
|
99
107
|
|
|
100
|
-
/// @notice Tokenize SY into PT + YT
|
|
108
|
+
/// @notice Tokenize SY into PT + YT for multiple receivers. See `mintPY()` for more details
|
|
101
109
|
function mintPYMulti(
|
|
102
110
|
address[] calldata receiverPTs,
|
|
103
111
|
address[] calldata receiverYTs,
|
|
@@ -116,7 +124,10 @@ contract PendleYieldToken is
|
|
|
116
124
|
amountPYOuts = _mintPY(receiverPTs, receiverYTs, amountSyToMints);
|
|
117
125
|
}
|
|
118
126
|
|
|
119
|
-
|
|
127
|
+
/**
|
|
128
|
+
* @notice Converts PY tokens into SY, but interests & rewards are not redeemed at the same time
|
|
129
|
+
* @dev PT/YT tokens should be transferred into this contract prior to redeeming
|
|
130
|
+
*/
|
|
120
131
|
function redeemPY(address receiver)
|
|
121
132
|
external
|
|
122
133
|
nonReentrant
|
|
@@ -133,9 +144,10 @@ contract PendleYieldToken is
|
|
|
133
144
|
amountSyOut = amountSyOuts[0];
|
|
134
145
|
}
|
|
135
146
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
/**
|
|
148
|
+
* @notice Converts PY tokens into SY for multiple receivers. See (`redeemPY`) for more details
|
|
149
|
+
* @dev Reverts if unable to redeem the total amount in `amountPYToRedeems`
|
|
150
|
+
*/
|
|
139
151
|
function redeemPYMulti(address[] calldata receivers, uint256[] calldata amountPYToRedeems)
|
|
140
152
|
external
|
|
141
153
|
nonReentrant
|
|
@@ -148,12 +160,15 @@ contract PendleYieldToken is
|
|
|
148
160
|
}
|
|
149
161
|
|
|
150
162
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
163
|
+
* @notice Redeems interests and rewards for `user`
|
|
164
|
+
* @param redeemInterest will only transfer out interest for user if true
|
|
165
|
+
* @param redeemRewards will only transfer out rewards for user if true
|
|
166
|
+
* @dev With YT yielding interest in the form of SY, which is redeemable by users, the reward
|
|
167
|
+
* distribution should be based on the amount of SYs that their YT currently represent, plus their
|
|
168
|
+
* dueInterest. It has been proven and tested that _rewardSharesUser will not change over time,
|
|
169
|
+
* unless users redeem their dueInterest or redeemPY. Due to this, it is required to update users'
|
|
170
|
+
* accruedReward STRICTLY BEFORE transferring out their interest.
|
|
171
|
+
*/
|
|
157
172
|
function redeemDueInterestAndRewards(
|
|
158
173
|
address user,
|
|
159
174
|
bool redeemInterest,
|
|
@@ -182,6 +197,7 @@ contract PendleYieldToken is
|
|
|
182
197
|
}
|
|
183
198
|
}
|
|
184
199
|
|
|
200
|
+
/// @dev reverts if called before expiry
|
|
185
201
|
function redeemInterestAndRewardsPostExpiryForTreasury()
|
|
186
202
|
external
|
|
187
203
|
nonReentrant
|
|
@@ -208,21 +224,36 @@ contract PendleYieldToken is
|
|
|
208
224
|
_transferOut(SY, treasury, interestOut);
|
|
209
225
|
}
|
|
210
226
|
|
|
227
|
+
/// @notice updates and returns the reward indexes
|
|
211
228
|
function rewardIndexesCurrent() external override nonReentrant returns (uint256[] memory) {
|
|
212
229
|
return IStandardizedYield(SY).rewardIndexesCurrent();
|
|
213
230
|
}
|
|
214
231
|
|
|
215
|
-
/// @dev
|
|
232
|
+
/// @dev maximizes the current rate with the previous rate to guarantee non-decreasing rate
|
|
216
233
|
function pyIndexCurrent() public nonReentrant returns (uint256 currentIndex) {
|
|
217
234
|
currentIndex = _pyIndexCurrent();
|
|
218
235
|
}
|
|
236
|
+
|
|
237
|
+
/// @notice returns the last-updated PY index
|
|
238
|
+
function pyIndexStored() public view returns (uint256) {
|
|
239
|
+
return _pyIndexStored;
|
|
240
|
+
}
|
|
219
241
|
|
|
242
|
+
/// @dev has no effect if called pre-expiry
|
|
220
243
|
function setPostExpiryData() external nonReentrant {
|
|
221
244
|
if (isExpired()) {
|
|
222
245
|
_setPostExpiryData();
|
|
223
246
|
}
|
|
224
247
|
}
|
|
225
248
|
|
|
249
|
+
/**
|
|
250
|
+
* @notice returns the current data post-expiry, if exists
|
|
251
|
+
* @dev reverts if post-expiry data not set (see `setPostExpiryData()`)
|
|
252
|
+
* @return firstPYIndex the earliest PY index post-expiry
|
|
253
|
+
* @return totalSyInterestForTreasury current amount of SY interests post-expiry for treasury
|
|
254
|
+
* @return firstRewardIndexes the earliest reward indices post-expiry, for each reward token
|
|
255
|
+
* @return userRewardOwed amount of unclaimed user rewards, for each reward token
|
|
256
|
+
*/
|
|
226
257
|
function getPostExpiryData()
|
|
227
258
|
external
|
|
228
259
|
view
|
|
@@ -273,10 +304,6 @@ contract PendleYieldToken is
|
|
|
273
304
|
}
|
|
274
305
|
}
|
|
275
306
|
|
|
276
|
-
function pyIndexStored() public view returns (uint256) {
|
|
277
|
-
return _pyIndexStored;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
307
|
function isExpired() public view returns (bool) {
|
|
281
308
|
return MiniHelpers.isCurrentlyExpired(expiry);
|
|
282
309
|
}
|
|
@@ -336,7 +363,7 @@ contract PendleYieldToken is
|
|
|
336
363
|
}
|
|
337
364
|
|
|
338
365
|
function _updateSyReserve() internal virtual {
|
|
339
|
-
syReserve = _selfBalance(SY)
|
|
366
|
+
syReserve = _selfBalance(SY);
|
|
340
367
|
}
|
|
341
368
|
|
|
342
369
|
function _getFloatingSyAmount() internal view returns (uint256 amount) {
|
|
@@ -369,8 +396,14 @@ contract PendleYieldToken is
|
|
|
369
396
|
}
|
|
370
397
|
|
|
371
398
|
function _pyIndexCurrent() internal returns (uint256 currentIndex) {
|
|
372
|
-
|
|
373
|
-
|
|
399
|
+
uint128 index128 = Math
|
|
400
|
+
.max(IStandardizedYield(SY).exchangeRate(), _pyIndexStored)
|
|
401
|
+
.Uint128();
|
|
402
|
+
|
|
403
|
+
currentIndex = index128;
|
|
404
|
+
_pyIndexStored = index128;
|
|
405
|
+
pyIndexLastUpdatedBlock = uint128(block.number);
|
|
406
|
+
|
|
374
407
|
emit NewInterestIndex(currentIndex);
|
|
375
408
|
}
|
|
376
409
|
|