@pendle/core-v2 0.17.5-testnet → 0.17.7-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/README.md +28 -0
- 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/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
- 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 +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +22 -28
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +3 -22
- 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 +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 +2 -2
- 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/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 +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +2 -2
- 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 +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +2 -2
- 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 +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 +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
- 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/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.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 +2 -18
- package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.json +2 -2
- package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- 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/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.json +187 -1
- package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.json +0 -19
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.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/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.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 +2 -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 -2
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +160 -60
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
- 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 +2 -2
- 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 +2 -2
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/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/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +1 -4
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +6 -5
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +1 -4
- package/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +9 -6
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +9 -21
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +0 -3
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +0 -3
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +34 -54
- package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +6 -25
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +20 -38
- package/contracts/LiquidityMining/libraries/VeHistoryLib.sol +1 -1
- package/contracts/core/BulkSeller/BulkSeller.sol +35 -42
- package/contracts/core/BulkSeller/BulkSellerFactory.sol +5 -9
- package/contracts/core/BulkSeller/BulkSellerMathCore.sol +6 -5
- package/contracts/core/StandardizedYield/SYBase.sol +5 -23
- package/contracts/core/StandardizedYield/SYBaseWithRewards.sol +1 -3
- package/contracts/core/StandardizedYield/implementations/Ape/PendleApeStakingSY.sol +184 -0
- package/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol +1 -3
- package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +1 -1
- package/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol +1 -1
- package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +1 -1
- package/contracts/core/YieldContracts/PendleYieldToken.sol +6 -6
- package/contracts/core/erc20/PendleERC20.sol +2 -2
- package/contracts/core/erc20/PendleERC20Permit.sol +1 -1
- package/contracts/core/libraries/ArrayLib.sol +1 -1
- package/contracts/core/libraries/BoringOwnableUpgradeable.sol +1 -1
- package/contracts/core/libraries/Errors.sol +2 -1
- package/contracts/core/libraries/MiniHelpers.sol +1 -0
- package/contracts/core/libraries/TokenHelper.sol +4 -5
- package/contracts/interfaces/Curve/ICrvPool.sol +3 -4
- package/contracts/interfaces/Curve/ITriCrvPool.sol +1 -4
- package/contracts/interfaces/IApeStaking.sol +27 -0
- package/contracts/interfaces/IBoringOwnableUpgradeable.sol +2 -2
- package/contracts/interfaces/ILayerZeroEndpoint.sol +1 -1
- package/contracts/interfaces/ILayerZeroReceiver.sol +8 -3
- package/contracts/interfaces/IPBulkSeller.sol +30 -6
- package/contracts/interfaces/IPBulkSellerFactory.sol +0 -2
- package/contracts/interfaces/IPMarket.sol +2 -12
- package/contracts/interfaces/IPMsgReceiverApp.sol +1 -1
- package/contracts/interfaces/IPMsgSendEndpoint.sol +1 -1
- package/contracts/interfaces/IPVeToken.sol +1 -1
- package/contracts/interfaces/IREDACTEDStaking.sol +1 -1
- package/contracts/interfaces/IStETH.sol +1 -1
- package/contracts/interfaces/IStargateLPStaking.sol +1 -1
- package/contracts/interfaces/IStargatePool.sol +1 -1
- package/contracts/interfaces/IStargateRouter.sol +1 -1
- package/contracts/interfaces/IWXBTRFLY.sol +1 -1
- package/contracts/offchain-helpers/MarketMathStatic.sol +140 -37
- package/contracts/offchain-helpers/RouterStatic.sol +48 -27
- package/contracts/router/ActionAddRemoveLiq.sol +2 -2
- package/contracts/router/ActionMintRedeem.sol +4 -4
- package/contracts/router/ActionSwapPT.sol +4 -4
- package/contracts/router/ActionSwapPTYT.sol +1 -1
- package/contracts/router/ActionSwapYT.sol +8 -8
- package/contracts/router/base/ActionBaseMintRedeem.sol +6 -7
- package/contracts/router/base/MarketApproxLib.sol +14 -8
- package/contracts/router/kyberswap/AggregationRouterHelper.sol +1 -1
- package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +1 -1
- package/contracts/router/kyberswap/IMultihopRouter.sol +1 -1
- package/deployments/43113-core.json +1 -1
- package/deployments/43113-markets/APE-30-MARCH.json +10 -0
- package/package.json +1 -1
- package/typechain-types/BulkSeller.ts +59 -6
- package/typechain-types/BulkSellerFactory.ts +0 -16
- package/typechain-types/IApeStaking.ts +274 -0
- package/typechain-types/IPBulkSeller.ts +178 -9
- package/typechain-types/IPBulkSellerFactory.ts +0 -16
- package/typechain-types/PendleApeStakingSY.ts +1251 -0
- package/typechain-types/RouterStatic.ts +40 -20
- package/typechain-types/SYBaseAutoCompound.ts +1203 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
- 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 +1 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
- 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 +2 -21
- package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
- package/typechain-types/factories/BulkSeller__factory.ts +21 -27
- package/typechain-types/factories/Errors__factory.ts +1 -17
- package/typechain-types/factories/IApeStaking__factory.ts +127 -0
- package/typechain-types/factories/IPBulkSellerFactory__factory.ts +0 -19
- package/typechain-types/factories/IPBulkSeller__factory.ts +187 -1
- package/typechain-types/factories/MarketMathStatic__factory.ts +1 -1
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleApeStakingSY__factory.ts +1065 -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 +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- 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 +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +101 -1
- package/typechain-types/factories/SYBaseAutoCompound__factory.ts +942 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
|
@@ -13,10 +13,6 @@ import "../../core/libraries/Errors.sol";
|
|
|
13
13
|
|
|
14
14
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
15
15
|
|
|
16
|
-
/// This contract is upgradable because
|
|
17
|
-
/// - its constructor only sets immutable variables
|
|
18
|
-
/// - it has storage gaps for safe addition of future variables
|
|
19
|
-
/// - it inherits only upgradable contract
|
|
20
16
|
abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
21
17
|
using VeBalanceLib for VeBalance;
|
|
22
18
|
using VeBalanceLib for LockedPosition;
|
|
@@ -50,7 +46,7 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
|
50
46
|
|
|
51
47
|
uint128 public constant MAX_LOCK_TIME = 104 weeks;
|
|
52
48
|
uint128 public constant WEEK = 1 weeks;
|
|
53
|
-
uint128 public constant GOVERNANCE_PENDLE_VOTE = 10**
|
|
49
|
+
uint128 public constant GOVERNANCE_PENDLE_VOTE = 10 * (10**6) * (10**18); // 10 mils of PENDLE
|
|
54
50
|
|
|
55
51
|
IPVeToken public immutable vePendle;
|
|
56
52
|
|
|
@@ -147,12 +143,10 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
|
147
143
|
for (uint256 i = 0; i < pools.length; ++i) poolVotes[i] = data.poolVotes[pools[i]];
|
|
148
144
|
}
|
|
149
145
|
|
|
150
|
-
/// @dev trivial view function
|
|
151
146
|
function getAllActivePools() external view returns (address[] memory) {
|
|
152
147
|
return allActivePools.values();
|
|
153
148
|
}
|
|
154
149
|
|
|
155
|
-
/// @dev trivial view function
|
|
156
150
|
function getAllRemovedPools(uint256 start, uint256 end)
|
|
157
151
|
external
|
|
158
152
|
view
|
|
@@ -166,12 +160,10 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
|
166
160
|
for (uint256 i = start; i <= end; ++i) arr[i - start] = allRemovedPools.at(i);
|
|
167
161
|
}
|
|
168
162
|
|
|
169
|
-
/// @dev trivial view function
|
|
170
163
|
function getActiveChainPools(uint64 chainId) external view returns (address[] memory) {
|
|
171
164
|
return activeChainPools[chainId].values();
|
|
172
165
|
}
|
|
173
166
|
|
|
174
|
-
/// @dev trivial view function
|
|
175
167
|
function getUserPoolVote(address user, address pool)
|
|
176
168
|
external
|
|
177
169
|
view
|
|
@@ -193,14 +185,9 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
|
193
185
|
}
|
|
194
186
|
|
|
195
187
|
/*///////////////////////////////////////////////////////////////
|
|
196
|
-
|
|
188
|
+
INTERNAL DATA MANIPULATION FUNCTIONS
|
|
197
189
|
//////////////////////////////////////////////////////////////*/
|
|
198
190
|
|
|
199
|
-
/**
|
|
200
|
-
* @dev expected behavior:
|
|
201
|
-
- add to allActivePools, activeChainPools
|
|
202
|
-
- set params in poolData
|
|
203
|
-
*/
|
|
204
191
|
function _addPool(uint64 chainId, address pool) internal {
|
|
205
192
|
if (!activeChainPools[chainId].add(pool)) assert(false);
|
|
206
193
|
if (!allActivePools.add(pool)) assert(false);
|
|
@@ -209,12 +196,6 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
|
209
196
|
poolData[pool].lastSlopeChangeAppliedAt = WeekMath.getCurrentWeekStart();
|
|
210
197
|
}
|
|
211
198
|
|
|
212
|
-
/**
|
|
213
|
-
* @dev expected behavior:
|
|
214
|
-
- remove from allActivePool, activeChainPools
|
|
215
|
-
- add to allRemovedPools
|
|
216
|
-
- clear all params in poolData
|
|
217
|
-
*/
|
|
218
199
|
function _removePool(address pool) internal {
|
|
219
200
|
uint64 chainId = poolData[pool].chainId;
|
|
220
201
|
if (!activeChainPools[chainId].remove(pool)) assert(false);
|
|
@@ -224,10 +205,6 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
|
224
205
|
delete poolData[pool];
|
|
225
206
|
}
|
|
226
207
|
|
|
227
|
-
/**
|
|
228
|
-
* @notice set the final pool vote for weekData
|
|
229
|
-
* @dev assumption: weekData[wTime].poolVotes[pool] == 0
|
|
230
|
-
*/
|
|
231
208
|
function _setFinalPoolVoteForWeek(
|
|
232
209
|
address pool,
|
|
233
210
|
uint128 wTime,
|
|
@@ -247,6 +224,10 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
|
247
224
|
emit PoolVoteChange(pool, vote);
|
|
248
225
|
}
|
|
249
226
|
|
|
227
|
+
/**
|
|
228
|
+
* @notice modifies `user`'s vote weight on `pool`
|
|
229
|
+
* @dev works by simply removing the old vote position, then adds in a fresh vote
|
|
230
|
+
*/
|
|
250
231
|
function _modifyVoteWeight(
|
|
251
232
|
address user,
|
|
252
233
|
address pool,
|
|
@@ -66,14 +66,14 @@ contract VotingEscrowPendleMainchain is
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* @notice
|
|
70
|
-
|
|
71
|
-
* @
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
* @dev
|
|
69
|
+
* @notice increases the lock position of a user (amount and/or expiry). Applicable even when
|
|
70
|
+
* user has no position or the current position has expired.
|
|
71
|
+
* @param additionalAmountToLock pendle amount to be pulled in from user to lock.
|
|
72
|
+
* @param newExpiry new lock expiry. Must be a valid week beginning, and resulting lock
|
|
73
|
+
* duration (since `block.timestamp`) must be within the allowed range.
|
|
74
|
+
* @dev Will revert if resulting position has zero lock amount.
|
|
75
|
+
* @dev See `_increasePosition()` for details on inner workings.
|
|
76
|
+
* @dev Sidechain broadcasting is not bundled since it can be done anytime after.
|
|
77
77
|
*/
|
|
78
78
|
function increaseLockPosition(uint128 additionalAmountToLock, uint128 newExpiry)
|
|
79
79
|
public
|
|
@@ -104,13 +104,8 @@ contract VotingEscrowPendleMainchain is
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* @notice
|
|
108
|
-
* @dev
|
|
109
|
-
- positionData is cleared
|
|
110
|
-
- pendle is transferred out
|
|
111
|
-
- _totalSupply, lastSlopeChangeAppliedAt, slopeChanges, totalSupplyAt all doesn't need to be updated
|
|
112
|
-
since these data will automatically hold true when _applySlopeChange() is called
|
|
113
|
-
- no checkpoint is added
|
|
107
|
+
* @notice Withdraws an expired lock position, returns locked PENDLE back to user
|
|
108
|
+
* @dev reverts if position is not expired, or if no locked PENDLE to withdraw
|
|
114
109
|
* @dev broadcast is not bundled since it can be done anytime after
|
|
115
110
|
*/
|
|
116
111
|
function withdraw() external returns (uint128 amount) {
|
|
@@ -129,9 +124,8 @@ contract VotingEscrowPendleMainchain is
|
|
|
129
124
|
}
|
|
130
125
|
|
|
131
126
|
/**
|
|
132
|
-
* @notice update & return the current totalSupply
|
|
133
|
-
* @dev
|
|
134
|
-
- _totalSupply & lastSlopeChangeAppliedAt is updated
|
|
127
|
+
* @notice update & return the current totalSupply, but does not broadcast info to other chains
|
|
128
|
+
* @dev See `broadcastTotalSupply()` and `broadcastUserPosition()` for broadcasting
|
|
135
129
|
*/
|
|
136
130
|
function totalSupplyCurrent()
|
|
137
131
|
public
|
|
@@ -143,19 +137,14 @@ contract VotingEscrowPendleMainchain is
|
|
|
143
137
|
return supply.getCurrentValue();
|
|
144
138
|
}
|
|
145
139
|
|
|
146
|
-
|
|
147
|
-
* @notice broadcast the totalSupply to different chains
|
|
148
|
-
* @dev state changes expected:
|
|
149
|
-
- all chains in chainIds receive the new totalSupply
|
|
150
|
-
*/
|
|
140
|
+
/// @notice updates and broadcast the current totalSupply to different chains
|
|
151
141
|
function broadcastTotalSupply(uint256[] calldata chainIds) public payable refundUnusedEth {
|
|
152
142
|
_broadcastPosition(address(0), chainIds);
|
|
153
143
|
}
|
|
154
144
|
|
|
155
145
|
/**
|
|
156
|
-
* @notice broadcast the position of
|
|
157
|
-
*
|
|
158
|
-
- all chains in chainIds receive the new totalSupply & user's new position
|
|
146
|
+
* @notice updates and broadcast the position of `user` to different chains, also updates and
|
|
147
|
+
* broadcasts totalSupply
|
|
159
148
|
*/
|
|
160
149
|
function broadcastUserPosition(address user, uint256[] calldata chainIds)
|
|
161
150
|
public
|
|
@@ -200,13 +189,8 @@ contract VotingEscrowPendleMainchain is
|
|
|
200
189
|
|
|
201
190
|
/**
|
|
202
191
|
* @notice increase the locking position of the user
|
|
203
|
-
* @dev
|
|
204
|
-
|
|
205
|
-
* @dev expected state changes:
|
|
206
|
-
- a new lock with the amount & expiry increase accordingly
|
|
207
|
-
- pendle is taken in if necessary
|
|
208
|
-
- _totalSupply, lastSlopeChangeAppliedAt, slopeChanges, totalSupplyAt is updated
|
|
209
|
-
- a checkpoint is added
|
|
192
|
+
* @dev works by simply removing the old position from all relevant data (as if the user has
|
|
193
|
+
* never locked) and then add in the new position
|
|
210
194
|
*/
|
|
211
195
|
function _increasePosition(
|
|
212
196
|
address user,
|
|
@@ -241,10 +225,8 @@ contract VotingEscrowPendleMainchain is
|
|
|
241
225
|
}
|
|
242
226
|
|
|
243
227
|
/**
|
|
244
|
-
* @notice
|
|
245
|
-
|
|
246
|
-
* @dev state changes expected:
|
|
247
|
-
- _totalSupply, lastSlopeChangeAppliedAt, totalSupplyAt is updated
|
|
228
|
+
* @notice updates the totalSupply, processing all slope changes of past weeks. At the same time,
|
|
229
|
+
* set the finalized totalSupplyAt
|
|
248
230
|
*/
|
|
249
231
|
function _applySlopeChange() internal returns (VeBalance memory, uint128) {
|
|
250
232
|
VeBalance memory supply = _totalSupply;
|
|
@@ -271,7 +253,7 @@ contract VotingEscrowPendleMainchain is
|
|
|
271
253
|
function _broadcastPosition(address user, uint256[] calldata chainIds) internal {
|
|
272
254
|
if (chainIds.length == 0) revert Errors.ArrayEmpty();
|
|
273
255
|
|
|
274
|
-
(VeBalance memory supply,) = _applySlopeChange();
|
|
256
|
+
(VeBalance memory supply, ) = _applySlopeChange();
|
|
275
257
|
|
|
276
258
|
bytes memory userData = (
|
|
277
259
|
user == address(0) ? EMPTY_BYTES : abi.encode(user, positionData[user])
|
|
@@ -18,29 +18,6 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
|
|
|
18
18
|
using SafeERC20 for IERC20;
|
|
19
19
|
using BulkSellerMathCore for BulkSellerState;
|
|
20
20
|
|
|
21
|
-
event SwapExactTokenForSy(address receiver, uint256 netTokenIn, uint256 netSyOut);
|
|
22
|
-
event SwapExactSyForToken(address receiver, uint256 netSyIn, uint256 netTokenOut);
|
|
23
|
-
event RateUpdated(
|
|
24
|
-
uint256 newRateTokenToSy,
|
|
25
|
-
uint256 newRateSyToToken,
|
|
26
|
-
uint256 oldRateTokenToSy,
|
|
27
|
-
uint256 oldRateSyToToken
|
|
28
|
-
);
|
|
29
|
-
event ReBalanceTokenToSy(
|
|
30
|
-
uint256 netTokenDeposit,
|
|
31
|
-
uint256 netSyFromToken,
|
|
32
|
-
uint256 newTokenProp,
|
|
33
|
-
uint256 oldTokenProp
|
|
34
|
-
);
|
|
35
|
-
event ReBalanceSyToToken(
|
|
36
|
-
uint256 netSyRedeem,
|
|
37
|
-
uint256 netTokenFromSy,
|
|
38
|
-
uint256 newTokenProp,
|
|
39
|
-
uint256 oldTokenProp
|
|
40
|
-
);
|
|
41
|
-
event ReserveUpdated(uint256 totalToken, uint256 totalSy);
|
|
42
|
-
event FeeRateUpdated(uint256 newFeeRate, uint256 oldFeeRate);
|
|
43
|
-
|
|
44
21
|
struct BulkSellerStorage {
|
|
45
22
|
uint128 rateTokenToSy;
|
|
46
23
|
uint128 rateSyToToken;
|
|
@@ -61,11 +38,6 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
|
|
|
61
38
|
_;
|
|
62
39
|
}
|
|
63
40
|
|
|
64
|
-
modifier onlyAdmin() {
|
|
65
|
-
if (!IPBulkSellerFactory(factory).isAdmin(msg.sender)) revert Errors.BulkNotAdmin();
|
|
66
|
-
_;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
41
|
// Since this contract is a beacon contract, no constructor should be defined.
|
|
70
42
|
function initialize(
|
|
71
43
|
address _token,
|
|
@@ -76,46 +48,52 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
|
|
|
76
48
|
token = _token;
|
|
77
49
|
SY = _SY;
|
|
78
50
|
factory = _factory;
|
|
51
|
+
_safeApproveInf(token, SY);
|
|
79
52
|
}
|
|
80
53
|
|
|
81
54
|
function swapExactTokenForSy(
|
|
82
55
|
address receiver,
|
|
83
56
|
uint256 netTokenIn,
|
|
84
57
|
uint256 minSyOut
|
|
85
|
-
) external nonReentrant returns (uint256 netSyOut) {
|
|
58
|
+
) external payable nonReentrant returns (uint256 netSyOut) {
|
|
86
59
|
BulkSellerState memory state = readState();
|
|
87
60
|
|
|
61
|
+
_transferIn(token, msg.sender, netTokenIn);
|
|
62
|
+
|
|
88
63
|
netSyOut = state.swapExactTokenForSy(netTokenIn);
|
|
89
64
|
|
|
90
65
|
if (netSyOut < minSyOut) revert Errors.BulkInSufficientSyOut(netSyOut, minSyOut);
|
|
91
66
|
|
|
92
|
-
|
|
67
|
+
_transferOut(SY, receiver, netSyOut);
|
|
93
68
|
|
|
94
69
|
_writeState(state);
|
|
95
70
|
|
|
96
|
-
if (_selfBalance(token) < state.totalToken)
|
|
97
|
-
revert Errors.BulkInsufficientTokenReceived(_selfBalance(token), state.totalToken);
|
|
98
|
-
|
|
99
71
|
emit SwapExactTokenForSy(receiver, netTokenIn, netSyOut);
|
|
100
72
|
}
|
|
101
73
|
|
|
102
74
|
function swapExactSyForToken(
|
|
103
75
|
address receiver,
|
|
104
76
|
uint256 exactSyIn,
|
|
105
|
-
uint256 minTokenOut
|
|
77
|
+
uint256 minTokenOut,
|
|
78
|
+
bool swapFromInternalBalance
|
|
106
79
|
) external nonReentrant returns (uint256 netTokenOut) {
|
|
107
80
|
BulkSellerState memory state = readState();
|
|
108
81
|
|
|
82
|
+
if (!swapFromInternalBalance) _transferIn(SY, msg.sender, exactSyIn);
|
|
83
|
+
else {
|
|
84
|
+
uint256 netSyReceived = _selfBalance(SY) - state.totalSy;
|
|
85
|
+
if (netSyReceived < exactSyIn)
|
|
86
|
+
revert Errors.BulkInsufficientSyReceived(exactSyIn, netSyReceived);
|
|
87
|
+
}
|
|
88
|
+
|
|
109
89
|
netTokenOut = state.swapExactSyForToken(exactSyIn);
|
|
110
90
|
|
|
111
91
|
if (netTokenOut < minTokenOut)
|
|
112
92
|
revert Errors.BulkInSufficientTokenOut(netTokenOut, minTokenOut);
|
|
113
|
-
if (receiver != address(this)) _transferOut(token, receiver, netTokenOut);
|
|
114
93
|
|
|
115
|
-
|
|
94
|
+
_transferOut(token, receiver, netTokenOut);
|
|
116
95
|
|
|
117
|
-
|
|
118
|
-
revert Errors.BulkInsufficientSyReceived(_selfBalance(SY), state.totalSy);
|
|
96
|
+
_writeState(state);
|
|
119
97
|
|
|
120
98
|
emit SwapExactSyForToken(receiver, exactSyIn, netTokenOut);
|
|
121
99
|
}
|
|
@@ -159,7 +137,7 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
|
|
|
159
137
|
_writeState(state);
|
|
160
138
|
}
|
|
161
139
|
|
|
162
|
-
function decreaseReserve(uint256 netTokenOut, uint256 netSyOut) external
|
|
140
|
+
function decreaseReserve(uint256 netTokenOut, uint256 netSyOut) external onlyMaintainer {
|
|
163
141
|
BulkSellerState memory state = readState();
|
|
164
142
|
|
|
165
143
|
if (netTokenOut == type(uint256).max) netTokenOut = state.totalToken;
|
|
@@ -176,6 +154,24 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
|
|
|
176
154
|
_writeState(state);
|
|
177
155
|
}
|
|
178
156
|
|
|
157
|
+
function redeemRewards() external onlyMaintainer {
|
|
158
|
+
IStandardizedYield(SY).claimRewards(address(this));
|
|
159
|
+
address[] memory rewardTokens = IStandardizedYield(SY).getRewardTokens();
|
|
160
|
+
|
|
161
|
+
for (uint256 i = 0; i < rewardTokens.length; i++) {
|
|
162
|
+
if (rewardTokens[i] == token) continue;
|
|
163
|
+
_transferOut(rewardTokens[i], msg.sender, _selfBalance(rewardTokens[i]));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function skim() external onlyMaintainer {
|
|
168
|
+
BulkSellerState memory state = readState();
|
|
169
|
+
uint256 excessToken = _selfBalance(token) - state.totalToken;
|
|
170
|
+
uint256 excessSy = _selfBalance(SY) - state.totalSy;
|
|
171
|
+
if (excessToken != 0) IERC20(token).safeTransfer(msg.sender, excessToken);
|
|
172
|
+
if (excessSy != 0) IERC20(SY).safeTransfer(msg.sender, excessSy);
|
|
173
|
+
}
|
|
174
|
+
|
|
179
175
|
function reBalance(uint256 targetProp, uint256 maxDiff) external onlyMaintainer {
|
|
180
176
|
BulkSellerState memory state = readState();
|
|
181
177
|
uint256 oldTokenProp = state.getTokenProp();
|
|
@@ -224,7 +220,6 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
|
|
|
224
220
|
}
|
|
225
221
|
|
|
226
222
|
function _depositToken(uint256 netTokenDeposit) internal returns (uint256 netSyFromToken) {
|
|
227
|
-
_safeApprove(token, SY, netTokenDeposit);
|
|
228
223
|
uint256 nativeToDeposit = token == NATIVE ? netTokenDeposit : 0;
|
|
229
224
|
return
|
|
230
225
|
IStandardizedYield(SY).deposit{ value: nativeToDeposit }(
|
|
@@ -239,6 +234,4 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
|
|
|
239
234
|
_transferOut(SY, SY, netSyRedeem);
|
|
240
235
|
return IStandardizedYield(SY).redeem(address(this), netSyRedeem, token, 0, true);
|
|
241
236
|
}
|
|
242
|
-
|
|
243
|
-
receive() external payable {}
|
|
244
237
|
}
|
|
@@ -25,8 +25,8 @@ contract BulkSellerFactory is
|
|
|
25
25
|
|
|
26
26
|
mapping(address => mapping(address => address)) internal syToBulkSeller;
|
|
27
27
|
|
|
28
|
-
modifier
|
|
29
|
-
if (!
|
|
28
|
+
modifier onlyMaintainer() {
|
|
29
|
+
if (!isMaintainer(msg.sender)) revert Errors.BulkNotMaintainer();
|
|
30
30
|
_;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -39,7 +39,7 @@ contract BulkSellerFactory is
|
|
|
39
39
|
|
|
40
40
|
function createBulkSeller(address token, address SY)
|
|
41
41
|
external
|
|
42
|
-
|
|
42
|
+
onlyMaintainer
|
|
43
43
|
returns (address bulk)
|
|
44
44
|
{
|
|
45
45
|
IStandardizedYield _SY = IStandardizedYield(SY);
|
|
@@ -72,12 +72,8 @@ contract BulkSellerFactory is
|
|
|
72
72
|
return (hasRole(DEFAULT_ADMIN_ROLE, addr) || hasRole(MAINTAINER, addr));
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function isAdmin(address addr) public view override returns (bool) {
|
|
76
|
-
return hasRole(DEFAULT_ADMIN_ROLE, addr);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
75
|
// ----------------- upgrade-related -----------------
|
|
80
|
-
function upgradeBeacon(address newImplementation) public
|
|
76
|
+
function upgradeBeacon(address newImplementation) public onlyMaintainer {
|
|
81
77
|
require(
|
|
82
78
|
AddressUpgradeable.isContract(newImplementation),
|
|
83
79
|
"UpgradeableBeacon: implementation is not a contract"
|
|
@@ -86,5 +82,5 @@ contract BulkSellerFactory is
|
|
|
86
82
|
emit UpgradedBeacon(newImplementation);
|
|
87
83
|
}
|
|
88
84
|
|
|
89
|
-
function _authorizeUpgrade(address) internal override
|
|
85
|
+
function _authorizeUpgrade(address) internal override onlyMaintainer {}
|
|
90
86
|
}
|
|
@@ -76,13 +76,14 @@ library BulkSellerMathCore {
|
|
|
76
76
|
uint256 currentTokenProp = getTokenProp(state);
|
|
77
77
|
|
|
78
78
|
if (currentTokenProp > targetTokenProp) {
|
|
79
|
-
netTokenToDeposit = state
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
netTokenToDeposit = state
|
|
80
|
+
.totalToken
|
|
81
|
+
.mulDown(currentTokenProp - targetTokenProp)
|
|
82
|
+
.divDown(currentTokenProp);
|
|
82
83
|
} else {
|
|
83
84
|
uint256 currentSyProp = Math.ONE - currentTokenProp;
|
|
84
|
-
netSyToRedeem = state.totalSy.mulDown(
|
|
85
|
-
|
|
85
|
+
netSyToRedeem = state.totalSy.mulDown(targetTokenProp - currentTokenProp).divDown(
|
|
86
|
+
currentSyProp
|
|
86
87
|
);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
pragma solidity 0.8.17;
|
|
3
|
-
import "../../interfaces/IStandardizedYield.sol";
|
|
4
3
|
|
|
4
|
+
import "../../interfaces/IStandardizedYield.sol";
|
|
5
5
|
import "../erc20/PendleERC20Permit.sol";
|
|
6
|
-
|
|
7
6
|
import "../libraries/math/Math.sol";
|
|
8
7
|
import "../libraries/TokenHelper.sol";
|
|
9
8
|
import "../libraries/Errors.sol";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
abstract contract SYBase is
|
|
14
|
-
IStandardizedYield,
|
|
15
|
-
PendleERC20Permit,
|
|
16
|
-
TokenHelper,
|
|
17
|
-
BoringOwnableUpgradeable,
|
|
18
|
-
Pausable
|
|
19
|
-
{
|
|
9
|
+
|
|
10
|
+
abstract contract SYBase is IStandardizedYield, PendleERC20Permit, TokenHelper {
|
|
20
11
|
using Math for uint256;
|
|
21
12
|
|
|
22
13
|
address public immutable yieldToken;
|
|
@@ -25,9 +16,8 @@ abstract contract SYBase is
|
|
|
25
16
|
string memory _name,
|
|
26
17
|
string memory _symbol,
|
|
27
18
|
address _yieldToken
|
|
28
|
-
) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals())
|
|
19
|
+
) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals()) {
|
|
29
20
|
yieldToken = _yieldToken;
|
|
30
|
-
__BoringOwnable_init();
|
|
31
21
|
}
|
|
32
22
|
|
|
33
23
|
// solhint-disable no-empty-blocks
|
|
@@ -189,19 +179,11 @@ abstract contract SYBase is
|
|
|
189
179
|
return _previewRedeem(tokenOut, amountSharesToRedeem);
|
|
190
180
|
}
|
|
191
181
|
|
|
192
|
-
function pause() external onlyOwner {
|
|
193
|
-
_pause();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function unpause() external onlyOwner {
|
|
197
|
-
_unpause();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
182
|
function _beforeTokenTransfer(
|
|
201
183
|
address,
|
|
202
184
|
address,
|
|
203
185
|
uint256
|
|
204
|
-
) internal virtual override
|
|
186
|
+
) internal virtual override {}
|
|
205
187
|
|
|
206
188
|
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
207
189
|
internal
|
|
@@ -29,7 +29,6 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
|
|
|
29
29
|
virtual
|
|
30
30
|
override
|
|
31
31
|
nonReentrant
|
|
32
|
-
whenNotPaused
|
|
33
32
|
returns (uint256[] memory rewardAmounts)
|
|
34
33
|
{
|
|
35
34
|
_updateAndDistributeRewards(user);
|
|
@@ -74,7 +73,6 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
|
|
|
74
73
|
function rewardIndexesCurrent()
|
|
75
74
|
external
|
|
76
75
|
override
|
|
77
|
-
whenNotPaused
|
|
78
76
|
nonReentrant
|
|
79
77
|
returns (uint256[] memory indexes)
|
|
80
78
|
{
|
|
@@ -122,7 +120,7 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
|
|
|
122
120
|
address from,
|
|
123
121
|
address to,
|
|
124
122
|
uint256
|
|
125
|
-
) internal virtual override
|
|
123
|
+
) internal virtual override {
|
|
126
124
|
_updateAndDistributeRewardsForTwo(from, to);
|
|
127
125
|
}
|
|
128
126
|
}
|