@pendle/core-v2 0.16.6-testnet → 0.17.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/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -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 +16 -5
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +0 -13
- 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/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -15
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.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 +25 -13
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +221 -50
- 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/SYBase.sol/SYBase.json +141 -0
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.json +141 -0
- 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 +143 -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 +1144 -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 +1209 -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 +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +3 -82
- 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 +142 -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 +997 -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 +143 -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 +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +83 -10
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +35 -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/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 +105 -31
- 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 +14 -7
- 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/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.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 +8 -8
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +18 -18
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- 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 +2 -2
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +28 -28
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +17 -5
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +50 -19
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.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 +7 -7
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +13 -0
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.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 +2 -2
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +58 -2
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +2 -46
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +62 -62
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +11 -11
- 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 +20 -20
- 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 +2 -2
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +3 -3
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +4 -4
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -186
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.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/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +1 -1
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +3 -6
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +7 -4
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +10 -5
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +1 -4
- package/contracts/LiquidityMining/libraries/VeHistoryLib.sol +0 -5
- package/contracts/core/BulkSeller/BulkSeller.sol +0 -5
- package/contracts/core/BulkSeller/BulkSellerFactory.sol +7 -6
- package/contracts/core/Market/MarketMathCore.sol +52 -11
- package/contracts/core/Market/PendleMarket.sol +35 -22
- package/contracts/core/Market/PendleMarketFactory.sol +67 -35
- package/contracts/core/StandardizedYield/SYBase.sol +26 -3
- package/contracts/core/StandardizedYield/SYBaseWithRewards.sol +3 -1
- 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 +46 -26
- package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +152 -0
- package/contracts/core/StandardizedYield/implementations/Convex/{ConvexCurveLP → base}/PendleConvexLPSY.sol +0 -0
- package/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol +128 -0
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +30 -12
- package/contracts/core/YieldContracts/PendleYieldToken.sol +79 -22
- 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 +12 -2
- package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -1
- package/contracts/interfaces/Curve/ICrvPool.sol +3 -4
- package/contracts/interfaces/Curve/ITriCrvPool.sol +41 -0
- package/contracts/interfaces/IERC4626.sol +1 -1
- package/contracts/interfaces/ILooksFeeSharing.sol +5 -0
- package/contracts/interfaces/ILooksStaking.sol +13 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +4 -4
- package/contracts/interfaces/IPActionMintRedeem.sol +8 -8
- package/contracts/interfaces/IPActionSwapYT.sol +2 -2
- package/contracts/interfaces/IPMarket.sol +20 -4
- package/contracts/interfaces/IPMarketFactory.sol +15 -5
- package/contracts/interfaces/IPMsgSendEndpoint.sol +1 -1
- package/contracts/interfaces/IPYieldContractFactory.sol +2 -2
- package/contracts/interfaces/IPYieldToken.sol +2 -0
- package/contracts/interfaces/IStandardizedYield.sol +15 -10
- package/contracts/offchain-helpers/BulkSellerOffchain.sol +17 -8
- package/contracts/offchain-helpers/MarketMathStatic.sol +35 -96
- package/contracts/offchain-helpers/RouterStatic.sol +8 -6
- package/contracts/router/ActionAddRemoveLiq.sol +102 -10
- package/contracts/router/ActionMintRedeem.sol +44 -4
- package/contracts/router/ActionSwapPT.sol +41 -11
- package/contracts/router/ActionSwapPTYT.sol +32 -7
- package/contracts/router/ActionSwapYT.sol +49 -33
- package/contracts/router/PendleRouter.sol +3 -11
- package/contracts/router/base/MarketApproxLib.sol +52 -18
- package/deployments/43113-core.json +18 -14
- package/deployments/43113-markets/USDC-FEB-2ND.json +10 -0
- package/deployments/43113-markets/WETH-FEB-2ND.json +10 -0
- package/deployments/43113-testenv.json +1 -2
- package/package.json +5 -5
- package/typechain-types/ActionAddRemoveLiq.ts +18 -18
- package/typechain-types/ActionMintRedeem.ts +30 -30
- package/typechain-types/ActionSwapPTYT.ts +5 -5
- package/typechain-types/ActionSwapYT.ts +5 -5
- package/typechain-types/BulkSeller.ts +0 -19
- package/typechain-types/BulkSellerOffchain.ts +74 -0
- package/typechain-types/IBooster.ts +9 -3
- package/typechain-types/ICrvPool.ts +4 -9
- package/typechain-types/IERC4626.ts +5 -5
- package/typechain-types/IPActionAddRemoveLiq.ts +13 -13
- package/typechain-types/IPActionMintRedeem.ts +30 -30
- package/typechain-types/IPActionSwapYT.ts +5 -5
- package/typechain-types/IPAllAction.ts +48 -48
- package/typechain-types/IPMarket.ts +26 -16
- package/typechain-types/IPMarketFactory.ts +70 -37
- package/typechain-types/IPMsgSendEndpoint.ts +1 -1
- package/typechain-types/IPYieldContractFactory.ts +11 -11
- package/typechain-types/IPYieldToken.ts +21 -0
- package/typechain-types/MarketMathStatic.ts +0 -67
- package/typechain-types/PendleConvexLPSY.ts +204 -0
- package/typechain-types/PendleMarket.ts +26 -16
- package/typechain-types/PendleMarketFactory.ts +316 -92
- package/typechain-types/PendleQiTokenSY.ts +204 -0
- package/typechain-types/PendleRouter.ts +3 -287
- package/typechain-types/PendleWstEthSY.ts +204 -0
- package/typechain-types/PendleYieldContractFactory.ts +63 -18
- package/typechain-types/PendleYieldToken.ts +42 -0
- package/typechain-types/RouterStatic.ts +2 -2
- package/typechain-types/SYBase.ts +204 -0
- package/typechain-types/SYBaseWithRewards.ts +204 -0
- package/typechain-types/VotingEscrowPendleSidechain.ts +8 -8
- package/typechain-types/VotingEscrowTokenBase.ts +0 -21
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +10 -10
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +19 -19
- package/typechain-types/factories/ActionMisc__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +2 -2
- package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +3 -3
- package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +1 -1
- package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerOffchain__factory.ts +57 -1
- package/typechain-types/factories/BulkSeller__factory.ts +1 -14
- package/typechain-types/factories/Errors__factory.ts +104 -30
- package/typechain-types/factories/IBooster__factory.ts +1 -1
- package/typechain-types/factories/ICrvPool__factory.ts +14 -7
- package/typechain-types/factories/IERC4626__factory.ts +1 -1
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +8 -8
- package/typechain-types/factories/IPActionMintRedeem__factory.ts +18 -18
- package/typechain-types/factories/IPActionSwapYT__factory.ts +2 -2
- package/typechain-types/factories/IPAllAction__factory.ts +28 -28
- package/typechain-types/factories/IPMarketFactory__factory.ts +50 -19
- package/typechain-types/factories/IPMarket__factory.ts +17 -5
- package/typechain-types/factories/IPMsgSendEndpoint__factory.ts +1 -1
- package/typechain-types/factories/IPYieldContractFactory__factory.ts +7 -7
- package/typechain-types/factories/IPYieldToken__factory.ts +13 -0
- package/typechain-types/factories/MarketMathStatic__factory.ts +1 -45
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleConvexLPSY__factory.ts +141 -0
- package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
- package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
- 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 +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +220 -49
- package/typechain-types/factories/PendleMarket__factory.ts +18 -6
- 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 +1 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +142 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -185
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleWstEthSY__factory.ts +142 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +82 -9
- package/typechain-types/factories/PendleYieldToken__factory.ts +38 -3
- package/typechain-types/factories/RouterStatic__factory.ts +3 -3
- package/typechain-types/factories/SYBaseWithRewards__factory.ts +141 -0
- package/typechain-types/factories/SYBase__factory.ts +141 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +15 -4
- package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +0 -13
- package/typechain-types/hardhat.d.ts +0 -36
- package/typechain-types/index.ts +0 -6
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.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 -182
- package/contracts/offchain-helpers/ImplicitSwapfeeContract.sol +0 -30
- package/deployments/43113-markets/QIWBTC-3RD-FEB.json +0 -11
- package/deployments/43113-markets/benqi-market-QI-AVAX-FEB-2ND.json +0 -9
- package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
- package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -9
- package/deployments/80001-core.json +0 -16
- package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
- package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
- package/deployments/80001-testenv.json +0 -22
|
@@ -83,6 +83,10 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
83
83
|
/**
|
|
84
84
|
* @notice PendleMarket allows users to provide in PT & SY in exchange for LPs, which
|
|
85
85
|
* will grant LP holders more exchange fee over time
|
|
86
|
+
* @dev will mint as much LP as possible such that the corresponding SY and PT used do
|
|
87
|
+
* not exceed `netSyDesired` and `netPtDesired`, respectively
|
|
88
|
+
* @dev PT and SY should be transferred to this contract prior to calling
|
|
89
|
+
* @dev will revert if PT is expired
|
|
86
90
|
*/
|
|
87
91
|
function mint(
|
|
88
92
|
address receiver,
|
|
@@ -98,7 +102,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
98
102
|
uint256 netPtUsed
|
|
99
103
|
)
|
|
100
104
|
{
|
|
101
|
-
MarketState memory market = readState();
|
|
105
|
+
MarketState memory market = readState(msg.sender);
|
|
102
106
|
PYIndex index = YT.newIndex();
|
|
103
107
|
|
|
104
108
|
uint256 lpToReserve;
|
|
@@ -129,14 +133,14 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
129
133
|
|
|
130
134
|
/**
|
|
131
135
|
* @notice LP Holders can burn their LP to receive back SY & PT proportionally
|
|
132
|
-
* to their share of market
|
|
136
|
+
* to their share of the market
|
|
133
137
|
*/
|
|
134
138
|
function burn(
|
|
135
139
|
address receiverSy,
|
|
136
140
|
address receiverPt,
|
|
137
141
|
uint256 netLpToBurn
|
|
138
142
|
) external nonReentrant returns (uint256 netSyOut, uint256 netPtOut) {
|
|
139
|
-
MarketState memory market = readState();
|
|
143
|
+
MarketState memory market = readState(msg.sender);
|
|
140
144
|
|
|
141
145
|
_burn(address(this), netLpToBurn);
|
|
142
146
|
|
|
@@ -158,16 +162,18 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
158
162
|
- Release the calculated amount of SY to receiver
|
|
159
163
|
- Callback to msg.sender if data.length > 0
|
|
160
164
|
- Ensure exactPtIn amount of PT has been transferred to this address
|
|
161
|
-
* @
|
|
165
|
+
* @dev will revert if PT is expired
|
|
166
|
+
* @param data bytes data to be sent in the callback (if any)
|
|
162
167
|
*/
|
|
163
168
|
function swapExactPtForSy(
|
|
164
169
|
address receiver,
|
|
165
170
|
uint256 exactPtIn,
|
|
166
171
|
bytes calldata data
|
|
167
|
-
) external nonReentrant notExpired returns (uint256 netSyOut, uint256
|
|
168
|
-
MarketState memory market = readState();
|
|
172
|
+
) external nonReentrant notExpired returns (uint256 netSyOut, uint256 netSyFee) {
|
|
173
|
+
MarketState memory market = readState(msg.sender);
|
|
169
174
|
|
|
170
|
-
|
|
175
|
+
uint256 netSyToReserve;
|
|
176
|
+
(netSyOut, netSyFee, netSyToReserve) = market.swapExactPtForSy(
|
|
171
177
|
YT.newIndex(),
|
|
172
178
|
exactPtIn,
|
|
173
179
|
block.timestamp
|
|
@@ -185,26 +191,28 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
185
191
|
if (_selfBalance(PT) < market.totalPt.Uint())
|
|
186
192
|
revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
|
|
187
193
|
|
|
188
|
-
emit Swap(receiver, exactPtIn.neg(), netSyOut.Int(), netSyToReserve);
|
|
194
|
+
emit Swap(receiver, exactPtIn.neg(), netSyOut.Int(), netSyFee, netSyToReserve);
|
|
189
195
|
}
|
|
190
196
|
|
|
191
197
|
/**
|
|
192
198
|
* @notice Pendle Market allows swaps between PT & SY it is holding. This function
|
|
193
|
-
* aims to swap an exact amount of
|
|
199
|
+
* aims to swap SY for an exact amount of PT.
|
|
194
200
|
* @dev steps working of this function
|
|
195
201
|
- The exact outcome amount of PT will be transferred to receiver
|
|
196
202
|
- Callback to msg.sender if data.length > 0
|
|
197
203
|
- Ensure the calculated required amount of SY is transferred to this address
|
|
198
|
-
* @
|
|
204
|
+
* @dev will revert if PT is expired
|
|
205
|
+
* @param data bytes data to be sent in the callback (if any)
|
|
199
206
|
*/
|
|
200
207
|
function swapSyForExactPt(
|
|
201
208
|
address receiver,
|
|
202
209
|
uint256 exactPtOut,
|
|
203
210
|
bytes calldata data
|
|
204
|
-
) external nonReentrant notExpired returns (uint256 netSyIn, uint256
|
|
205
|
-
MarketState memory market = readState();
|
|
211
|
+
) external nonReentrant notExpired returns (uint256 netSyIn, uint256 netSyFee) {
|
|
212
|
+
MarketState memory market = readState(msg.sender);
|
|
206
213
|
|
|
207
|
-
|
|
214
|
+
uint256 netSyToReserve;
|
|
215
|
+
(netSyIn, netSyFee, netSyToReserve) = market.swapSyForExactPt(
|
|
208
216
|
YT.newIndex(),
|
|
209
217
|
exactPtOut,
|
|
210
218
|
block.timestamp
|
|
@@ -223,22 +231,27 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
223
231
|
if (_selfBalance(SY) < market.totalSy.Uint())
|
|
224
232
|
revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
|
|
225
233
|
|
|
226
|
-
emit Swap(receiver, exactPtOut.Int(), netSyIn.neg(), netSyToReserve);
|
|
234
|
+
emit Swap(receiver, exactPtOut.Int(), netSyIn.neg(), netSyFee, netSyToReserve);
|
|
227
235
|
}
|
|
228
236
|
|
|
229
|
-
/// @notice
|
|
237
|
+
/// @notice forces balances to match reserves
|
|
230
238
|
function skim() external nonReentrant {
|
|
231
|
-
MarketState memory market = readState();
|
|
239
|
+
MarketState memory market = readState(msg.sender);
|
|
232
240
|
uint256 excessPt = _selfBalance(PT) - market.totalPt.Uint();
|
|
233
241
|
uint256 excessSy = _selfBalance(SY) - market.totalSy.Uint();
|
|
234
|
-
IERC20(PT).safeTransfer(market.treasury, excessPt);
|
|
235
|
-
IERC20(SY).safeTransfer(market.treasury, excessSy);
|
|
242
|
+
if (excessPt != 0) IERC20(PT).safeTransfer(market.treasury, excessPt);
|
|
243
|
+
if (excessSy != 0) IERC20(SY).safeTransfer(market.treasury, excessSy);
|
|
236
244
|
}
|
|
237
245
|
|
|
246
|
+
/**
|
|
247
|
+
* @notice redeems the user's reward
|
|
248
|
+
* @return amount of reward token redeemed, in the same order as `getRewardTokens()`
|
|
249
|
+
*/
|
|
238
250
|
function redeemRewards(address user) external nonReentrant returns (uint256[] memory) {
|
|
239
251
|
return _redeemRewards(user);
|
|
240
252
|
}
|
|
241
253
|
|
|
254
|
+
/// @notice returns the list of reward tokens
|
|
242
255
|
function getRewardTokens() external view returns (address[] memory) {
|
|
243
256
|
return _getRewardTokens();
|
|
244
257
|
}
|
|
@@ -248,7 +261,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
248
261
|
//////////////////////////////////////////////////////////////*/
|
|
249
262
|
|
|
250
263
|
function observe(uint32[] memory secondsAgos)
|
|
251
|
-
|
|
264
|
+
external
|
|
252
265
|
view
|
|
253
266
|
returns (uint216[] memory lnImpliedRateCumulative)
|
|
254
267
|
{
|
|
@@ -278,14 +291,14 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
278
291
|
/**
|
|
279
292
|
* @notice read the state of the market from storage into memory for gas-efficient manipulation
|
|
280
293
|
*/
|
|
281
|
-
function readState() public view returns (MarketState memory market) {
|
|
294
|
+
function readState(address router) public view returns (MarketState memory market) {
|
|
282
295
|
market.totalPt = _storage.totalPt;
|
|
283
296
|
market.totalSy = _storage.totalSy;
|
|
284
297
|
market.totalLp = totalSupply().Int();
|
|
285
298
|
|
|
286
299
|
(market.treasury, market.lnFeeRateRoot, market.reserveFeePercent) = IPMarketFactory(
|
|
287
300
|
factory
|
|
288
|
-
).
|
|
301
|
+
).getMarketConfig(router);
|
|
289
302
|
|
|
290
303
|
market.scalarRoot = scalarRoot;
|
|
291
304
|
market.expiry = expiry;
|
|
@@ -302,7 +315,7 @@ contract PendleMarket is PendleERC20Permit, PendleGauge, IPMarket {
|
|
|
302
315
|
(uint16 observationIndex, uint16 observationCardinality) = observations.write(
|
|
303
316
|
_storage.observationIndex,
|
|
304
317
|
uint32(block.timestamp),
|
|
305
|
-
|
|
318
|
+
_storage.lastLnImpliedRate,
|
|
306
319
|
_storage.observationCardinality,
|
|
307
320
|
_storage.observationCardinalityNext
|
|
308
321
|
);
|
|
@@ -10,19 +10,9 @@ import "../libraries/BaseSplitCodeFactory.sol";
|
|
|
10
10
|
import "../libraries/Errors.sol";
|
|
11
11
|
import "../libraries/BoringOwnableUpgradeable.sol";
|
|
12
12
|
|
|
13
|
-
import "./PendleMarket.sol";
|
|
14
|
-
import "./PendleGauge.sol";
|
|
15
|
-
|
|
16
13
|
contract PendleMarketFactory is BoringOwnableUpgradeable, IPMarketFactory {
|
|
17
14
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
18
15
|
|
|
19
|
-
struct MarketConfig {
|
|
20
|
-
address treasury;
|
|
21
|
-
uint88 lnFeeRateRoot;
|
|
22
|
-
uint8 reserveFeePercent;
|
|
23
|
-
// 1 SLOT = 256 bits
|
|
24
|
-
}
|
|
25
|
-
|
|
26
16
|
address public immutable marketCreationCodeContractA;
|
|
27
17
|
uint256 public immutable marketCreationCodeSizeA;
|
|
28
18
|
address public immutable marketCreationCodeContractB;
|
|
@@ -30,6 +20,15 @@ contract PendleMarketFactory is BoringOwnableUpgradeable, IPMarketFactory {
|
|
|
30
20
|
|
|
31
21
|
address public immutable yieldContractFactory;
|
|
32
22
|
uint256 public immutable maxLnFeeRateRoot;
|
|
23
|
+
uint8 public constant maxReserveFeePercent = 100;
|
|
24
|
+
int256 public constant minInitialAnchor = Math.IONE;
|
|
25
|
+
|
|
26
|
+
address public treasury;
|
|
27
|
+
FeeConfig public defaultFee;
|
|
28
|
+
/// 1 SLOT
|
|
29
|
+
|
|
30
|
+
// router -> overriddenFee
|
|
31
|
+
mapping(address => FeeConfig) public overriddenFee;
|
|
33
32
|
|
|
34
33
|
// PT -> scalarRoot -> initialAnchor
|
|
35
34
|
mapping(address => mapping(int256 => mapping(int256 => address))) internal markets;
|
|
@@ -37,8 +36,6 @@ contract PendleMarketFactory is BoringOwnableUpgradeable, IPMarketFactory {
|
|
|
37
36
|
address public vePendle;
|
|
38
37
|
address public gaugeController;
|
|
39
38
|
|
|
40
|
-
MarketConfig public marketConfig;
|
|
41
|
-
|
|
42
39
|
constructor(
|
|
43
40
|
address _yieldContractFactory,
|
|
44
41
|
address _marketCreationCodeContractA,
|
|
@@ -57,23 +54,22 @@ contract PendleMarketFactory is BoringOwnableUpgradeable, IPMarketFactory {
|
|
|
57
54
|
|
|
58
55
|
function initialize(
|
|
59
56
|
address _treasury,
|
|
60
|
-
|
|
61
|
-
uint8
|
|
57
|
+
uint80 _defaultLnFeeRateRoot,
|
|
58
|
+
uint8 _defaultReserveFeePercent,
|
|
62
59
|
address newVePendle,
|
|
63
60
|
address newGaugeController
|
|
64
61
|
) external initializer {
|
|
65
62
|
__BoringOwnable_init();
|
|
66
63
|
setTreasury(_treasury);
|
|
67
|
-
|
|
68
|
-
setReserveFeePercent(_reserveFeePercent);
|
|
64
|
+
setDefaultFee(_defaultLnFeeRateRoot, _defaultReserveFeePercent);
|
|
69
65
|
|
|
70
66
|
vePendle = newVePendle;
|
|
71
67
|
gaugeController = newGaugeController;
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
/**
|
|
75
|
-
* @notice Create a market between PT and its corresponding SY
|
|
76
|
-
*
|
|
71
|
+
* @notice Create a market between PT and its corresponding SY with scalar & anchor config.
|
|
72
|
+
* Anyone is allowed to create a market on their own.
|
|
77
73
|
*/
|
|
78
74
|
function createNewMarket(
|
|
79
75
|
address PT,
|
|
@@ -87,6 +83,9 @@ contract PendleMarketFactory is BoringOwnableUpgradeable, IPMarketFactory {
|
|
|
87
83
|
if (markets[PT][scalarRoot][initialAnchor] != address(0))
|
|
88
84
|
revert Errors.MarketFactoryMarketExists();
|
|
89
85
|
|
|
86
|
+
if (initialAnchor < minInitialAnchor)
|
|
87
|
+
revert Errors.MarketFactoryInitialAnchorTooLow(initialAnchor, minInitialAnchor);
|
|
88
|
+
|
|
90
89
|
market = BaseSplitCodeFactory._create2(
|
|
91
90
|
0,
|
|
92
91
|
bytes32(block.chainid),
|
|
@@ -104,38 +103,71 @@ contract PendleMarketFactory is BoringOwnableUpgradeable, IPMarketFactory {
|
|
|
104
103
|
emit CreateNewMarket(market, PT, scalarRoot, initialAnchor);
|
|
105
104
|
}
|
|
106
105
|
|
|
106
|
+
function getMarketConfig(address router)
|
|
107
|
+
external
|
|
108
|
+
view
|
|
109
|
+
returns (
|
|
110
|
+
address _treasury,
|
|
111
|
+
uint80 _lnFeeRateRoot,
|
|
112
|
+
uint8 _reserveFeePercent
|
|
113
|
+
)
|
|
114
|
+
{
|
|
115
|
+
(_treasury, _lnFeeRateRoot, _reserveFeePercent) = (
|
|
116
|
+
treasury,
|
|
117
|
+
defaultFee.lnFeeRateRoot,
|
|
118
|
+
defaultFee.reserveFeePercent
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
FeeConfig memory over = overriddenFee[router];
|
|
122
|
+
if (over.active) {
|
|
123
|
+
(_lnFeeRateRoot, _reserveFeePercent) = (over.lnFeeRateRoot, over.reserveFeePercent);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
107
127
|
/// @dev for gas-efficient verification of market
|
|
108
128
|
function isValidMarket(address market) external view returns (bool) {
|
|
109
129
|
return allMarkets.contains(market);
|
|
110
130
|
}
|
|
111
131
|
|
|
112
|
-
function treasury() external view returns (address) {
|
|
113
|
-
return marketConfig.treasury;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
132
|
function setTreasury(address newTreasury) public onlyOwner {
|
|
117
|
-
|
|
133
|
+
if (newTreasury == address(0)) revert Errors.MarketFactoryZeroTreasury();
|
|
134
|
+
|
|
135
|
+
treasury = newTreasury;
|
|
118
136
|
_emitNewMarketConfigEvent();
|
|
119
137
|
}
|
|
120
138
|
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
marketConfig.lnFeeRateRoot = newLnFeeRateRoot;
|
|
139
|
+
function setDefaultFee(uint80 newLnFeeRateRoot, uint8 newReserveFeePercent) public onlyOwner {
|
|
140
|
+
_verifyFeeConfig(newLnFeeRateRoot, newReserveFeePercent);
|
|
141
|
+
defaultFee = FeeConfig(newLnFeeRateRoot, newReserveFeePercent, true);
|
|
126
142
|
_emitNewMarketConfigEvent();
|
|
127
143
|
}
|
|
128
144
|
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
145
|
+
function setOverriddenFee(
|
|
146
|
+
address router,
|
|
147
|
+
uint80 newLnFeeRateRoot,
|
|
148
|
+
uint8 newReserveFeePercent
|
|
149
|
+
) public onlyOwner {
|
|
150
|
+
_verifyFeeConfig(newLnFeeRateRoot, newReserveFeePercent);
|
|
151
|
+
overriddenFee[router] = FeeConfig(newLnFeeRateRoot, newReserveFeePercent, true);
|
|
152
|
+
emit SetOverriddenFee(router, newLnFeeRateRoot, newReserveFeePercent);
|
|
153
|
+
}
|
|
132
154
|
|
|
133
|
-
|
|
134
|
-
|
|
155
|
+
function unsetOverriddenFee(address router) external onlyOwner {
|
|
156
|
+
delete overriddenFee[router];
|
|
157
|
+
emit UnsetOverriddenFee(router);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function _verifyFeeConfig(uint80 newLnFeeRateRoot, uint8 newReserveFeePercent) internal view {
|
|
161
|
+
if (newLnFeeRateRoot > maxLnFeeRateRoot)
|
|
162
|
+
revert Errors.MarketFactoryLnFeeRateRootTooHigh(newLnFeeRateRoot, maxLnFeeRateRoot);
|
|
163
|
+
if (newReserveFeePercent > maxReserveFeePercent)
|
|
164
|
+
revert Errors.MarketFactoryReserveFeePercentTooHigh(
|
|
165
|
+
newReserveFeePercent,
|
|
166
|
+
maxReserveFeePercent
|
|
167
|
+
);
|
|
135
168
|
}
|
|
136
169
|
|
|
137
170
|
function _emitNewMarketConfigEvent() internal {
|
|
138
|
-
|
|
139
|
-
emit NewMarketConfig(local.treasury, local.lnFeeRateRoot, local.reserveFeePercent);
|
|
171
|
+
emit NewMarketConfig(treasury, defaultFee.lnFeeRateRoot, defaultFee.reserveFeePercent);
|
|
140
172
|
}
|
|
141
173
|
}
|
|
@@ -7,8 +7,16 @@ import "../erc20/PendleERC20Permit.sol";
|
|
|
7
7
|
import "../libraries/math/Math.sol";
|
|
8
8
|
import "../libraries/TokenHelper.sol";
|
|
9
9
|
import "../libraries/Errors.sol";
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import "../libraries/BoringOwnableUpgradeable.sol";
|
|
11
|
+
import "@openzeppelin/contracts/security/Pausable.sol";
|
|
12
|
+
|
|
13
|
+
abstract contract SYBase is
|
|
14
|
+
IStandardizedYield,
|
|
15
|
+
PendleERC20Permit,
|
|
16
|
+
TokenHelper,
|
|
17
|
+
BoringOwnableUpgradeable,
|
|
18
|
+
Pausable
|
|
19
|
+
{
|
|
12
20
|
using Math for uint256;
|
|
13
21
|
|
|
14
22
|
address public immutable yieldToken;
|
|
@@ -17,8 +25,9 @@ abstract contract SYBase is IStandardizedYield, PendleERC20Permit, TokenHelper {
|
|
|
17
25
|
string memory _name,
|
|
18
26
|
string memory _symbol,
|
|
19
27
|
address _yieldToken
|
|
20
|
-
) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals()) {
|
|
28
|
+
) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals()) initializer {
|
|
21
29
|
yieldToken = _yieldToken;
|
|
30
|
+
__BoringOwnable_init();
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
// solhint-disable no-empty-blocks
|
|
@@ -180,6 +189,20 @@ abstract contract SYBase is IStandardizedYield, PendleERC20Permit, TokenHelper {
|
|
|
180
189
|
return _previewRedeem(tokenOut, amountSharesToRedeem);
|
|
181
190
|
}
|
|
182
191
|
|
|
192
|
+
function pause() external onlyOwner {
|
|
193
|
+
_pause();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function unpause() external onlyOwner {
|
|
197
|
+
_unpause();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function _beforeTokenTransfer(
|
|
201
|
+
address,
|
|
202
|
+
address,
|
|
203
|
+
uint256
|
|
204
|
+
) internal virtual override whenNotPaused {}
|
|
205
|
+
|
|
183
206
|
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
184
207
|
internal
|
|
185
208
|
view
|
|
@@ -29,6 +29,7 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
|
|
|
29
29
|
virtual
|
|
30
30
|
override
|
|
31
31
|
nonReentrant
|
|
32
|
+
whenNotPaused
|
|
32
33
|
returns (uint256[] memory rewardAmounts)
|
|
33
34
|
{
|
|
34
35
|
_updateAndDistributeRewards(user);
|
|
@@ -73,6 +74,7 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
|
|
|
73
74
|
function rewardIndexesCurrent()
|
|
74
75
|
external
|
|
75
76
|
override
|
|
77
|
+
whenNotPaused
|
|
76
78
|
nonReentrant
|
|
77
79
|
returns (uint256[] memory indexes)
|
|
78
80
|
{
|
|
@@ -120,7 +122,7 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
|
|
|
120
122
|
address from,
|
|
121
123
|
address to,
|
|
122
124
|
uint256
|
|
123
|
-
) internal virtual override {
|
|
125
|
+
) internal virtual override whenNotPaused {
|
|
124
126
|
_updateAndDistributeRewardsForTwo(from, to);
|
|
125
127
|
}
|
|
126
128
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "./base/PendleConvexLPSY.sol";
|
|
5
|
+
import "./base/CurveFraxUsdcPoolHelper.sol";
|
|
6
|
+
import "../../../libraries/ArrayLib.sol";
|
|
7
|
+
|
|
8
|
+
contract PendleCurveFraxUsdcSY is PendleConvexLPSY {
|
|
9
|
+
using ArrayLib for address[];
|
|
10
|
+
|
|
11
|
+
uint256 public constant PID = 100;
|
|
12
|
+
|
|
13
|
+
address public constant FRAX = CurveFraxUsdcPoolHelper.FRAX;
|
|
14
|
+
address public constant USDC = CurveFraxUsdcPoolHelper.USDC;
|
|
15
|
+
|
|
16
|
+
constructor(string memory _name, string memory _symbol)
|
|
17
|
+
PendleConvexLPSY(
|
|
18
|
+
_name,
|
|
19
|
+
_symbol,
|
|
20
|
+
PID,
|
|
21
|
+
CurveFraxUsdcPoolHelper.LP,
|
|
22
|
+
CurveFraxUsdcPoolHelper.POOL
|
|
23
|
+
)
|
|
24
|
+
{
|
|
25
|
+
_safeApproveInf(FRAX, crvPool);
|
|
26
|
+
_safeApproveInf(USDC, crvPool);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _depositToCurve(address tokenIn, uint256 amountTokenToDeposit)
|
|
30
|
+
internal
|
|
31
|
+
virtual
|
|
32
|
+
override
|
|
33
|
+
returns (uint256 amountLpOut)
|
|
34
|
+
{
|
|
35
|
+
uint256[2] memory amounts;
|
|
36
|
+
amounts[_getIndex(tokenIn)] = amountTokenToDeposit;
|
|
37
|
+
amountLpOut = ICrvPool(crvPool).add_liquidity(amounts, 0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function _redeemFromCurve(address tokenOut, uint256 amountLpToRedeem)
|
|
41
|
+
internal
|
|
42
|
+
virtual
|
|
43
|
+
override
|
|
44
|
+
returns (uint256 amountTokenOut)
|
|
45
|
+
{
|
|
46
|
+
amountTokenOut = ICrvPool(crvPool).remove_liquidity_one_coin(
|
|
47
|
+
amountLpToRedeem,
|
|
48
|
+
Math.Int128(_getIndex(tokenOut)),
|
|
49
|
+
0
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function _previewDepositToCurve(address tokenIn, uint256 amountTokenToDeposit)
|
|
54
|
+
internal
|
|
55
|
+
view
|
|
56
|
+
virtual
|
|
57
|
+
override
|
|
58
|
+
returns (uint256)
|
|
59
|
+
{
|
|
60
|
+
return CurveFraxUsdcPoolHelper.previewAddLiquidity(tokenIn, amountTokenToDeposit);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function _previewRedeemFromCurve(address tokenOut, uint256 amountLpToRedeem)
|
|
64
|
+
internal
|
|
65
|
+
view
|
|
66
|
+
virtual
|
|
67
|
+
override
|
|
68
|
+
returns (uint256)
|
|
69
|
+
{
|
|
70
|
+
return
|
|
71
|
+
ICrvPool(crvPool).calc_withdraw_one_coin(
|
|
72
|
+
amountLpToRedeem,
|
|
73
|
+
Math.Int128(_getIndex(tokenOut))
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function _getIndex(address token) internal pure returns (uint256) {
|
|
78
|
+
return (token == FRAX ? 0 : 1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
82
|
+
res = new address[](3);
|
|
83
|
+
res[0] = crvLp;
|
|
84
|
+
res[1] = FRAX;
|
|
85
|
+
res[2] = USDC;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
89
|
+
res = new address[](3);
|
|
90
|
+
res[0] = crvLp;
|
|
91
|
+
res[1] = FRAX;
|
|
92
|
+
res[2] = USDC;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function isValidTokenIn(address token) public view virtual override returns (bool res) {
|
|
96
|
+
res = (token == crvLp || token == FRAX || token == USDC);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function isValidTokenOut(address token) public view override returns (bool res) {
|
|
100
|
+
res = (token == crvLp || token == FRAX || token == USDC);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "./base/PendleConvexLPSY.sol";
|
|
5
|
+
import "./base/CurveUsdd3CrvPoolHelper.sol";
|
|
6
|
+
import "../../../libraries/ArrayLib.sol";
|
|
7
|
+
|
|
8
|
+
contract PendleCurveUsdd3CrvSY is PendleConvexLPSY {
|
|
9
|
+
using ArrayLib for address[];
|
|
10
|
+
|
|
11
|
+
uint256 public constant PID = 96;
|
|
12
|
+
address public constant USDD = CurveUsdd3CrvPoolHelper.USDD;
|
|
13
|
+
address public constant LP_3CRV = Curve3CrvPoolHelper.LP;
|
|
14
|
+
address public constant DAI = Curve3CrvPoolHelper.DAI;
|
|
15
|
+
address public constant USDC = Curve3CrvPoolHelper.USDC;
|
|
16
|
+
address public constant USDT = Curve3CrvPoolHelper.USDT;
|
|
17
|
+
address public constant POOL_3CRV = Curve3CrvPoolHelper.POOL;
|
|
18
|
+
uint256 public constant INDEX_OF_3CRV = 1;
|
|
19
|
+
|
|
20
|
+
constructor(string memory _name, string memory _symbol)
|
|
21
|
+
PendleConvexLPSY(
|
|
22
|
+
_name,
|
|
23
|
+
_symbol,
|
|
24
|
+
PID,
|
|
25
|
+
CurveUsdd3CrvPoolHelper.POOL,
|
|
26
|
+
CurveUsdd3CrvPoolHelper.POOL
|
|
27
|
+
)
|
|
28
|
+
{
|
|
29
|
+
_safeApproveInf(USDD, crvPool);
|
|
30
|
+
_safeApproveInf(LP_3CRV, crvPool);
|
|
31
|
+
_safeApproveInf(DAI, POOL_3CRV);
|
|
32
|
+
_safeApproveInf(USDC, POOL_3CRV);
|
|
33
|
+
_safeApproveInf(USDT, POOL_3CRV);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _depositToCurve(address tokenIn, uint256 amountTokenToDeposit)
|
|
37
|
+
internal
|
|
38
|
+
virtual
|
|
39
|
+
override
|
|
40
|
+
returns (uint256 amountLpOut)
|
|
41
|
+
{
|
|
42
|
+
uint256 preBalanceLp = _selfBalance(crvLp);
|
|
43
|
+
|
|
44
|
+
uint256[2] memory amounts;
|
|
45
|
+
|
|
46
|
+
if (Curve3CrvPoolHelper.is3CrvToken(tokenIn)) {
|
|
47
|
+
uint256 amount3CrvLp = Curve3CrvPoolHelper.deposit3Crv(tokenIn, amountTokenToDeposit);
|
|
48
|
+
amounts[INDEX_OF_3CRV] = amount3CrvLp;
|
|
49
|
+
} else {
|
|
50
|
+
// one of the 2 LP
|
|
51
|
+
amounts[_getIndex(tokenIn)] = amountTokenToDeposit;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
ICrvPool(crvPool).add_liquidity(amounts, 0);
|
|
55
|
+
|
|
56
|
+
amountLpOut = _selfBalance(crvLp) - preBalanceLp;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function _redeemFromCurve(address tokenOut, uint256 amountLpToRedeem)
|
|
60
|
+
internal
|
|
61
|
+
virtual
|
|
62
|
+
override
|
|
63
|
+
returns (uint256 amountTokenOut)
|
|
64
|
+
{
|
|
65
|
+
address tokenToRemove = (tokenOut == USDD) ? USDD : LP_3CRV;
|
|
66
|
+
|
|
67
|
+
uint256 preBalanceToken = _selfBalance(tokenToRemove);
|
|
68
|
+
|
|
69
|
+
ICrvPool(crvPool).remove_liquidity_one_coin(
|
|
70
|
+
amountLpToRedeem,
|
|
71
|
+
Math.Int128(_getIndex(tokenToRemove)),
|
|
72
|
+
0
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
uint256 amountTokenRemoved = _selfBalance(tokenToRemove) - preBalanceToken;
|
|
76
|
+
|
|
77
|
+
if (Curve3CrvPoolHelper.is3CrvToken(tokenOut)) {
|
|
78
|
+
amountTokenOut = Curve3CrvPoolHelper.redeem3Crv(tokenOut, amountTokenRemoved);
|
|
79
|
+
} else {
|
|
80
|
+
// one of the 2 LP
|
|
81
|
+
amountTokenOut = amountTokenRemoved;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function _previewDepositToCurve(address tokenIn, uint256 amountTokenToDeposit)
|
|
86
|
+
internal
|
|
87
|
+
view
|
|
88
|
+
virtual
|
|
89
|
+
override
|
|
90
|
+
returns (uint256)
|
|
91
|
+
{
|
|
92
|
+
return CurveUsdd3CrvPoolHelper.previewAddLiquidity(tokenIn, amountTokenToDeposit);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function _previewRedeemFromCurve(address tokenOut, uint256 amountLpToRedeem)
|
|
96
|
+
internal
|
|
97
|
+
view
|
|
98
|
+
virtual
|
|
99
|
+
override
|
|
100
|
+
returns (uint256)
|
|
101
|
+
{
|
|
102
|
+
address tokenToRemove = tokenOut == USDD ? USDD : LP_3CRV;
|
|
103
|
+
uint256 amountTokenRemoved = ICrvPool(crvPool).calc_withdraw_one_coin(
|
|
104
|
+
amountLpToRedeem,
|
|
105
|
+
Math.Int128(_getIndex(tokenToRemove))
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (Curve3CrvPoolHelper.is3CrvToken(tokenOut)) {
|
|
109
|
+
return Curve3CrvPoolHelper.preview3CrvRedeem(tokenOut, amountTokenRemoved);
|
|
110
|
+
} else {
|
|
111
|
+
// one of the 2 LP
|
|
112
|
+
return amountTokenRemoved;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function _getIndex(address token) internal pure returns (uint256) {
|
|
117
|
+
return (token == USDD ? 0 : 1);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
121
|
+
res = new address[](6);
|
|
122
|
+
res[0] = crvLp;
|
|
123
|
+
res[1] = USDD;
|
|
124
|
+
res[2] = LP_3CRV;
|
|
125
|
+
res[3] = DAI;
|
|
126
|
+
res[4] = USDC;
|
|
127
|
+
res[5] = USDT;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
131
|
+
res = new address[](6);
|
|
132
|
+
res[0] = crvLp;
|
|
133
|
+
res[1] = USDD;
|
|
134
|
+
res[2] = LP_3CRV;
|
|
135
|
+
res[3] = DAI;
|
|
136
|
+
res[4] = USDC;
|
|
137
|
+
res[5] = USDT;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function isValidTokenIn(address token) public view virtual override returns (bool res) {
|
|
141
|
+
res = (token == crvLp ||
|
|
142
|
+
token == USDD ||
|
|
143
|
+
token == LP_3CRV ||
|
|
144
|
+
Curve3CrvPoolHelper.is3CrvToken(token));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function isValidTokenOut(address token) public view override returns (bool res) {
|
|
148
|
+
res = (token == crvLp ||
|
|
149
|
+
token == USDD ||
|
|
150
|
+
token == LP_3CRV ||
|
|
151
|
+
Curve3CrvPoolHelper.is3CrvToken(token));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function _getRewardTokens() internal pure override returns (address[] memory rewardTokens) {
|
|
155
|
+
rewardTokens = new address[](3);
|
|
156
|
+
rewardTokens[0] = USDD;
|
|
157
|
+
rewardTokens[1] = CRV;
|
|
158
|
+
rewardTokens[2] = CVX;
|
|
159
|
+
}
|
|
160
|
+
}
|