@pendle/core-v2 2.11.0-mainnet → 2.12.0-mainnet
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/LiquidityMining/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/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +592 -0
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +79 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +77 -0
- 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 +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/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/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol/PendleAuraBalancerStableLPSYV2.dbg.json +1 -1
- 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/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.json +252 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.json +89 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.json +338 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.json +1464 -0
- 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/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.json +2 -2
- 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/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.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/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/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.json +2 -2
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.json +2 -2
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotFactory.sol/ICamelotFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotFactory.sol/ICamelotFactory.json +237 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTFactory.sol/ICamelotNFTFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTFactory.sol/ICamelotNFTFactory.json +56 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTHandler.sol/ICamelotNFTHandler.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTHandler.sol/ICamelotNFTHandler.json +142 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.json +402 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.json +438 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.json +729 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotRouter.sol/ICamelotRouter.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotRouter.sol/ICamelotRouter.json +647 -0
- package/build/artifacts/contracts/interfaces/Camelot/IXGrail.sol/IXGrail.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/IXGrail.sol/IXGrail.json +350 -0
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.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/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +77 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.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/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.json +2 -2
- package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.json +2 -2
- 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/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.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/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/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +1 -1
- 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/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol +224 -0
- package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +15 -0
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol +144 -0
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol +38 -0
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol +146 -0
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol +177 -0
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol +243 -0
- package/contracts/core/libraries/math/Math.sol +19 -3
- package/contracts/interfaces/Camelot/ICamelotFactory.sol +22 -0
- package/contracts/interfaces/Camelot/ICamelotNFTFactory.sol +11 -0
- package/contracts/interfaces/Camelot/ICamelotNFTHandler.sol +26 -0
- package/contracts/interfaces/Camelot/ICamelotNFTPool.sol +19 -0
- package/contracts/interfaces/Camelot/ICamelotNitroPool.sol +28 -0
- package/contracts/interfaces/Camelot/ICamelotPair.sol +109 -0
- package/contracts/interfaces/Camelot/ICamelotRouter.sol +127 -0
- package/contracts/interfaces/Camelot/IXGrail.sol +31 -0
- package/contracts/interfaces/IPVotingController.sol +10 -0
- package/deployments/42161-markets/CAMELOT-PEP-27JUNE2024-ARBITRUM.JSON.json +10 -0
- package/package.json +1 -1
- package/typechain-types/CamelotRewardHelper.ts +347 -0
- package/typechain-types/CamelotV1VolatileLpHelper.ts +152 -0
- package/typechain-types/CamelotV1VolatilePreview.ts +479 -0
- package/typechain-types/ICamelotFactory.ts +375 -0
- package/typechain-types/ICamelotNFTFactory.ts +122 -0
- package/typechain-types/ICamelotNFTHandler.ts +262 -0
- package/typechain-types/ICamelotNFTPool.ts +710 -0
- package/typechain-types/ICamelotNitroPool.ts +689 -0
- package/typechain-types/ICamelotPair.ts +16 -0
- package/typechain-types/IERC165.ts +102 -0
- package/typechain-types/IERC721.ts +487 -0
- package/typechain-types/IPVotingController.ts +93 -0
- package/typechain-types/IXGrail.ts +603 -0
- package/typechain-types/PendleCamelotV1VolatileSY.ts +1929 -0
- package/typechain-types/PendleVotingControllerUpg.ts +93 -0
- package/typechain-types/VotingControllerStorageUpg.ts +93 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
- package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageStatic__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/ActionVePendleStatic__factory.ts +1 -1
- package/typechain-types/factories/Broadcaster__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
- package/typechain-types/factories/BulkSeller__factory.ts +1 -1
- package/typechain-types/factories/CamelotRewardHelper__factory.ts +313 -0
- package/typechain-types/factories/CamelotV1VolatileLpHelper__factory.ts +108 -0
- package/typechain-types/factories/CamelotV1VolatilePreview__factory.ts +400 -0
- package/typechain-types/factories/ICamelotFactory__factory.ts +252 -0
- package/typechain-types/factories/ICamelotNFTFactory__factory.ts +71 -0
- package/typechain-types/factories/ICamelotNFTHandler__factory.ts +157 -0
- package/typechain-types/factories/ICamelotNFTPool__factory.ts +417 -0
- package/typechain-types/factories/ICamelotNitroPool__factory.ts +453 -0
- package/typechain-types/factories/ICamelotPair__factory.ts +13 -0
- package/typechain-types/factories/IERC165__factory.ts +42 -0
- package/typechain-types/factories/IERC721__factory.ts +308 -0
- package/typechain-types/factories/IPVotingController__factory.ts +77 -0
- package/typechain-types/factories/IXGrail__factory.ts +362 -0
- package/typechain-types/factories/PendleAuraWethAnkrethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethRocketEthSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethStafiEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethWstethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleCamelotV1VolatileSY__factory.ts +1557 -0
- package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
- package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGDaiSY__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/PendleGlpSY__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/PendlePtGlpOracle__factory.ts +1 -1
- package/typechain-types/factories/PendlePtOracle__factory.ts +1 -1
- package/typechain-types/factories/PendlePtUsdChainlinkOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleSfrxEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleStargateLPSY__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +78 -1
- package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactoryV2__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldTokenV2__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/SAPE__factory.ts +1 -1
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +77 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +135 -0
- package/typechain-types/index.ts +30 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.8.0;
|
|
4
|
+
|
|
5
|
+
import "../../../../interfaces/Camelot/ICamelotPair.sol";
|
|
6
|
+
import "../../../../interfaces/Camelot/ICamelotRouter.sol";
|
|
7
|
+
import "../../../../interfaces/Camelot/ICamelotFactory.sol";
|
|
8
|
+
import "../../../libraries/TokenHelper.sol";
|
|
9
|
+
import "../../../libraries/math/Math.sol";
|
|
10
|
+
import "./CamelotV1VolatileCommon.sol";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @notice This contract is intended to be launched on Arbitrum
|
|
14
|
+
* Thus, some obvious gas optimization might be ignored
|
|
15
|
+
*
|
|
16
|
+
* @notice Since Camelot LP may offer the pool token as a reward token (for example PENDLE/ETH
|
|
17
|
+
* has PENDLE rewards),
|
|
18
|
+
* this contract should not take into account any floating balance
|
|
19
|
+
* for swap/add liquidity
|
|
20
|
+
*/
|
|
21
|
+
abstract contract CamelotV1VolatileLpHelper is TokenHelper, CamelotV1VolatileCommon {
|
|
22
|
+
address public immutable token0;
|
|
23
|
+
address public immutable token1;
|
|
24
|
+
address public immutable pair;
|
|
25
|
+
address public immutable factory;
|
|
26
|
+
address public immutable router;
|
|
27
|
+
|
|
28
|
+
address public referrerForSwap;
|
|
29
|
+
|
|
30
|
+
constructor(
|
|
31
|
+
address _pair,
|
|
32
|
+
address _factory,
|
|
33
|
+
address _router,
|
|
34
|
+
address _referrerForSwap
|
|
35
|
+
) {
|
|
36
|
+
assert(ICamelotPair(_pair).stableSwap() == false);
|
|
37
|
+
|
|
38
|
+
pair = _pair;
|
|
39
|
+
factory = _factory;
|
|
40
|
+
router = _router;
|
|
41
|
+
token0 = ICamelotPair(pair).token0();
|
|
42
|
+
token1 = ICamelotPair(pair).token1();
|
|
43
|
+
referrerForSwap = _referrerForSwap;
|
|
44
|
+
|
|
45
|
+
_safeApproveInf(token0, router);
|
|
46
|
+
_safeApproveInf(token1, router);
|
|
47
|
+
_safeApproveInf(pair, router);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* ==================================================================
|
|
52
|
+
* ZAP ACTION RELATED
|
|
53
|
+
* ==================================================================
|
|
54
|
+
*/
|
|
55
|
+
function _zapIn(address tokenIn, uint256 amountIn) internal returns (uint256) {
|
|
56
|
+
(uint256 amount0ToAddLiq, uint256 amount1ToAddLiq) = _swapZapIn(tokenIn, amountIn);
|
|
57
|
+
return _addLiquidity(amount0ToAddLiq, amount1ToAddLiq);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _zapOut(address tokenOut, uint256 amountLpIn) internal returns (uint256) {
|
|
61
|
+
(uint256 amount0, uint256 amount1) = _removeLiquidity(amountLpIn);
|
|
62
|
+
if (tokenOut == token0) {
|
|
63
|
+
return amount0 + _swap(token1, amount1);
|
|
64
|
+
} else {
|
|
65
|
+
return amount1 + _swap(token0, amount0);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function _swapZapIn(address tokenIn, uint256 amountIn)
|
|
70
|
+
private
|
|
71
|
+
returns (uint256 amount0ToAddLiq, uint256 amount1ToAddLiq)
|
|
72
|
+
{
|
|
73
|
+
(uint256 reserve0, uint256 reserve1, uint256 fee0, uint256 fee1) = ICamelotPair(pair)
|
|
74
|
+
.getReserves();
|
|
75
|
+
|
|
76
|
+
if (tokenIn == token0) {
|
|
77
|
+
uint256 amount0ToSwap = _getZapInSwapAmount(amountIn, reserve0, fee0);
|
|
78
|
+
amount0ToAddLiq = amountIn - amount0ToSwap;
|
|
79
|
+
amount1ToAddLiq = _swap(token0, amount0ToSwap);
|
|
80
|
+
} else {
|
|
81
|
+
uint256 amount1ToSwap = _getZapInSwapAmount(amountIn, reserve1, fee1);
|
|
82
|
+
amount0ToAddLiq = _swap(token1, amount1ToSwap);
|
|
83
|
+
amount1ToAddLiq = amountIn - amount1ToSwap;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* ==================================================================
|
|
89
|
+
* CAMELOT ROUTER RELATED
|
|
90
|
+
* ==================================================================
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
function _addLiquidity(uint256 amount0ToAddLiq, uint256 amount1ToAddLiq)
|
|
94
|
+
private
|
|
95
|
+
returns (uint256 amountLpOut)
|
|
96
|
+
{
|
|
97
|
+
(, , amountLpOut) = ICamelotRouter(router).addLiquidity(
|
|
98
|
+
token0,
|
|
99
|
+
token1,
|
|
100
|
+
amount0ToAddLiq,
|
|
101
|
+
amount1ToAddLiq,
|
|
102
|
+
0,
|
|
103
|
+
0,
|
|
104
|
+
address(this),
|
|
105
|
+
block.timestamp
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function _removeLiquidity(uint256 amountLpToRemove)
|
|
110
|
+
private
|
|
111
|
+
returns (uint256 amountTokenA, uint256 amountTokenB)
|
|
112
|
+
{
|
|
113
|
+
return
|
|
114
|
+
ICamelotRouter(router).removeLiquidity(
|
|
115
|
+
token0,
|
|
116
|
+
token1,
|
|
117
|
+
amountLpToRemove,
|
|
118
|
+
0,
|
|
119
|
+
0,
|
|
120
|
+
address(this),
|
|
121
|
+
block.timestamp
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function _swap(address tokenIn, uint256 amountTokenIn) private returns (uint256) {
|
|
126
|
+
address[] memory path = new address[](2);
|
|
127
|
+
|
|
128
|
+
address tokenOut = tokenIn == token0 ? token1 : token0;
|
|
129
|
+
|
|
130
|
+
path[0] = tokenIn;
|
|
131
|
+
path[1] = tokenOut;
|
|
132
|
+
|
|
133
|
+
uint256 preBalance = _selfBalance(tokenOut);
|
|
134
|
+
|
|
135
|
+
ICamelotRouter(router).swapExactTokensForTokensSupportingFeeOnTransferTokens(
|
|
136
|
+
amountTokenIn,
|
|
137
|
+
0,
|
|
138
|
+
path,
|
|
139
|
+
address(this),
|
|
140
|
+
referrerForSwap,
|
|
141
|
+
block.timestamp
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
return _selfBalance(tokenOut) - preBalance;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
pragma solidity 0.8.17;
|
|
4
|
+
|
|
5
|
+
import "./CamelotV1VolatileCommon.sol";
|
|
6
|
+
|
|
7
|
+
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
8
|
+
import "../../../libraries/BoringOwnableUpgradeable.sol";
|
|
9
|
+
|
|
10
|
+
contract CamelotV1VolatilePreview is
|
|
11
|
+
CamelotV1VolatileCommon,
|
|
12
|
+
BoringOwnableUpgradeable,
|
|
13
|
+
UUPSUpgradeable
|
|
14
|
+
{
|
|
15
|
+
address internal immutable factory;
|
|
16
|
+
|
|
17
|
+
constructor(address _factory) initializer {
|
|
18
|
+
factory = _factory;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function initialize() external initializer {
|
|
22
|
+
__BoringOwnable_init();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// solhint-disable-next-line
|
|
26
|
+
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @notice The Camelot.swap() function takes reserve() as the previously recorded at the start
|
|
30
|
+
* and take into account ALL floating balances after.
|
|
31
|
+
*/
|
|
32
|
+
function previewZapIn(
|
|
33
|
+
CamelotPairData memory data,
|
|
34
|
+
address tokenIn,
|
|
35
|
+
uint256 amountTokenIn
|
|
36
|
+
) external view returns (uint256 amountLpOut) {
|
|
37
|
+
bool isToken0 = tokenIn == data.token0;
|
|
38
|
+
|
|
39
|
+
uint256 amountToSwap = isToken0
|
|
40
|
+
? _getZapInSwapAmount(amountTokenIn, data.reserve0, data.fee0)
|
|
41
|
+
: _getZapInSwapAmount(amountTokenIn, data.reserve1, data.fee1);
|
|
42
|
+
|
|
43
|
+
uint256 amountSwapOut = _getSwapAmountOut(
|
|
44
|
+
data,
|
|
45
|
+
amountToSwap,
|
|
46
|
+
tokenIn,
|
|
47
|
+
tokenIn == data.token0 ? data.fee0 : data.fee1
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
uint256 amount0ToAddLiq;
|
|
51
|
+
uint256 amount1ToAddLiq;
|
|
52
|
+
|
|
53
|
+
if (isToken0) {
|
|
54
|
+
data.reserve0 = _getPairBalance0(data) + amountToSwap;
|
|
55
|
+
data.reserve1 = _getPairBalance1(data) - amountSwapOut;
|
|
56
|
+
|
|
57
|
+
amount0ToAddLiq = amountTokenIn - amountToSwap;
|
|
58
|
+
amount1ToAddLiq = amountSwapOut;
|
|
59
|
+
} else {
|
|
60
|
+
data.reserve0 = _getPairBalance0(data) - amountSwapOut;
|
|
61
|
+
data.reserve1 = _getPairBalance1(data) + amountToSwap;
|
|
62
|
+
|
|
63
|
+
amount0ToAddLiq = amountSwapOut;
|
|
64
|
+
amount1ToAddLiq = amountTokenIn - amountToSwap;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return _calcAmountLpOut(data, amount0ToAddLiq, amount1ToAddLiq);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function previewZapOut(
|
|
71
|
+
CamelotPairData memory data,
|
|
72
|
+
address tokenOut,
|
|
73
|
+
uint256 amountLpIn
|
|
74
|
+
) external view returns (uint256) {
|
|
75
|
+
uint256 totalSupply = _getTotalSupplyAfterMintFee(data);
|
|
76
|
+
|
|
77
|
+
data.reserve0 = _getPairBalance0(data);
|
|
78
|
+
data.reserve1 = _getPairBalance1(data);
|
|
79
|
+
|
|
80
|
+
uint256 amount0Removed = (data.reserve0 * amountLpIn) / totalSupply;
|
|
81
|
+
uint256 amount1Removed = (data.reserve1 * amountLpIn) / totalSupply;
|
|
82
|
+
|
|
83
|
+
data.reserve0 -= amount0Removed;
|
|
84
|
+
data.reserve1 -= amount1Removed;
|
|
85
|
+
|
|
86
|
+
if (tokenOut == data.token0) {
|
|
87
|
+
return
|
|
88
|
+
amount0Removed + _getSwapAmountOut(data, amount1Removed, data.token1, data.fee1);
|
|
89
|
+
} else {
|
|
90
|
+
return
|
|
91
|
+
amount1Removed + _getSwapAmountOut(data, amount0Removed, data.token0, data.fee0);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function _getPairBalance0(CamelotPairData memory data) private view returns (uint256) {
|
|
96
|
+
return IERC20(data.token0).balanceOf(data.pair);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function _getPairBalance1(CamelotPairData memory data) private view returns (uint256) {
|
|
100
|
+
return IERC20(data.token1).balanceOf(data.pair);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// @reference: Camelot
|
|
104
|
+
function _getSwapAmountOut(
|
|
105
|
+
CamelotPairData memory data,
|
|
106
|
+
uint256 amountIn,
|
|
107
|
+
address tokenIn,
|
|
108
|
+
uint256 feePercent
|
|
109
|
+
) internal pure returns (uint256) {
|
|
110
|
+
(uint256 reserve0, uint256 reserve1) = tokenIn == data.token0
|
|
111
|
+
? (data.reserve0, data.reserve1)
|
|
112
|
+
: (data.reserve1, data.reserve0);
|
|
113
|
+
amountIn = amountIn * (FEE_DENOMINATOR - feePercent);
|
|
114
|
+
return (amountIn * reserve1) / (reserve0 * FEE_DENOMINATOR + amountIn);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @notice This function simulates Camelot router so any precision issues from their calculation
|
|
119
|
+
* is preserved in preview functions...
|
|
120
|
+
*/
|
|
121
|
+
function _calcAmountLpOut(
|
|
122
|
+
CamelotPairData memory data,
|
|
123
|
+
uint256 amount0ToAddLiq,
|
|
124
|
+
uint256 amount1ToAddLiq
|
|
125
|
+
) private view returns (uint256 amountLpOut) {
|
|
126
|
+
uint256 amount1Optimal = _quote(amount0ToAddLiq, data.reserve0, data.reserve1);
|
|
127
|
+
if (amount1Optimal <= amount1ToAddLiq) {
|
|
128
|
+
amount1ToAddLiq = amount1Optimal;
|
|
129
|
+
} else {
|
|
130
|
+
amount0ToAddLiq = _quote(amount1ToAddLiq, data.reserve1, data.reserve0);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
uint256 supply = _getTotalSupplyAfterMintFee(data);
|
|
134
|
+
return
|
|
135
|
+
Math.min(
|
|
136
|
+
(amount0ToAddLiq * supply) / data.reserve0,
|
|
137
|
+
(amount1ToAddLiq * supply) / data.reserve1
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function _quote(
|
|
142
|
+
uint256 amountA,
|
|
143
|
+
uint256 reserveA,
|
|
144
|
+
uint256 reserveB
|
|
145
|
+
) private pure returns (uint256 amountB) {
|
|
146
|
+
amountB = (amountA * reserveB) / reserveA;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function _getTotalSupplyAfterMintFee(CamelotPairData memory data)
|
|
150
|
+
private
|
|
151
|
+
view
|
|
152
|
+
returns (uint256)
|
|
153
|
+
{
|
|
154
|
+
(uint256 ownerFeeShare, address feeTo) = ICamelotFactory(factory).feeInfo();
|
|
155
|
+
bool feeOn = feeTo != address(0);
|
|
156
|
+
uint256 _kLast = ICamelotPair(data.pair).kLast();
|
|
157
|
+
|
|
158
|
+
uint256 totalSupply = ICamelotPair(data.pair).totalSupply();
|
|
159
|
+
// gas savings
|
|
160
|
+
if (feeOn) {
|
|
161
|
+
if (_kLast != 0) {
|
|
162
|
+
uint256 rootK = Math.sqrt(data.reserve0 * data.reserve1);
|
|
163
|
+
uint256 rootKLast = Math.sqrt(_kLast);
|
|
164
|
+
if (rootK > rootKLast) {
|
|
165
|
+
uint256 d = (FEE_DENOMINATOR * 100) / ownerFeeShare - 100;
|
|
166
|
+
uint256 numerator = totalSupply * (rootK - rootKLast) * 100;
|
|
167
|
+
uint256 denominator = rootK * d + rootKLast * 100;
|
|
168
|
+
uint256 liquidity = numerator / denominator;
|
|
169
|
+
if (liquidity > 0) {
|
|
170
|
+
totalSupply += liquidity;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return totalSupply;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
pragma solidity 0.8.17;
|
|
4
|
+
|
|
5
|
+
import "./CamelotRewardHelper.sol";
|
|
6
|
+
import "../../SYBaseWithRewards.sol";
|
|
7
|
+
import "./CamelotV1VolatilePreview.sol";
|
|
8
|
+
import "./CamelotV1VolatileLpHelper.sol";
|
|
9
|
+
|
|
10
|
+
contract PendleCamelotV1VolatileSY is
|
|
11
|
+
SYBaseWithRewards,
|
|
12
|
+
CamelotRewardHelper,
|
|
13
|
+
CamelotV1VolatileLpHelper
|
|
14
|
+
{
|
|
15
|
+
using Math for uint256;
|
|
16
|
+
using ArrayLib for address[];
|
|
17
|
+
|
|
18
|
+
address[] public rewardTokens;
|
|
19
|
+
CamelotV1VolatilePreview public immutable previewHelper;
|
|
20
|
+
bool public isRewardDisabled;
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
string memory _name,
|
|
24
|
+
string memory _symbol,
|
|
25
|
+
address _pair,
|
|
26
|
+
address _factory,
|
|
27
|
+
address _router,
|
|
28
|
+
address _nitroPool,
|
|
29
|
+
address _referrer,
|
|
30
|
+
CamelotV1VolatilePreview _previewHelper
|
|
31
|
+
)
|
|
32
|
+
CamelotV1VolatileLpHelper(_pair, _factory, _router, _referrer)
|
|
33
|
+
SYBaseWithRewards(_name, _symbol, _pair)
|
|
34
|
+
CamelotRewardHelper(_nitroPool, _pair)
|
|
35
|
+
{
|
|
36
|
+
rewardTokens.push(GRAIL);
|
|
37
|
+
updateRewardTokensList();
|
|
38
|
+
previewHelper = _previewHelper;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @dev See {SYBase-_deposit}
|
|
43
|
+
*/
|
|
44
|
+
function _deposit(address tokenIn, uint256 amountDeposited)
|
|
45
|
+
internal
|
|
46
|
+
virtual
|
|
47
|
+
override
|
|
48
|
+
returns (uint256)
|
|
49
|
+
{
|
|
50
|
+
uint256 amountLpDeposited;
|
|
51
|
+
if (tokenIn == pair) {
|
|
52
|
+
amountLpDeposited = amountDeposited;
|
|
53
|
+
} else {
|
|
54
|
+
amountLpDeposited = _zapIn(tokenIn, amountDeposited);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (isRewardDisabled) {
|
|
58
|
+
return amountLpDeposited;
|
|
59
|
+
} else {
|
|
60
|
+
return _increaseNftPoolPosition(amountLpDeposited);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @dev See {SYBase-_redeem}
|
|
66
|
+
*/
|
|
67
|
+
function _redeem(
|
|
68
|
+
address receiver,
|
|
69
|
+
address tokenOut,
|
|
70
|
+
uint256 amountSharesToRedeem
|
|
71
|
+
) internal virtual override returns (uint256 amountTokenOut) {
|
|
72
|
+
// solhint-disable-next-line
|
|
73
|
+
if (isRewardDisabled) {
|
|
74
|
+
// if isRewardDisabled is activated, the LP has been withdrawn from the pool
|
|
75
|
+
} else {
|
|
76
|
+
_decreaseNftPoolPosition(amountSharesToRedeem);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (tokenOut == pair) {
|
|
80
|
+
amountTokenOut = amountSharesToRedeem;
|
|
81
|
+
} else {
|
|
82
|
+
amountTokenOut = _zapOut(tokenOut, amountSharesToRedeem);
|
|
83
|
+
}
|
|
84
|
+
_transferOut(tokenOut, receiver, amountTokenOut);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function exchangeRate() public view virtual override returns (uint256) {
|
|
88
|
+
(uint256 reserve0, uint256 reserve1, , ) = ICamelotPair(pair).getReserves();
|
|
89
|
+
uint256 supply = ICamelotPair(pair).totalSupply();
|
|
90
|
+
return Math.sqrt(reserve0 * reserve1).divDown(supply);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*///////////////////////////////////////////////////////////////
|
|
94
|
+
REWARDS-RELATED
|
|
95
|
+
//////////////////////////////////////////////////////////////*/
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @dev See {IStandardizedYield-getRewardTokens}
|
|
99
|
+
*/
|
|
100
|
+
function _getRewardTokens() internal view virtual override returns (address[] memory res) {
|
|
101
|
+
uint256 extraRewardsLen = rewardTokens.length;
|
|
102
|
+
res = new address[](1 + extraRewardsLen);
|
|
103
|
+
res[0] = GRAIL;
|
|
104
|
+
for (uint256 i = 0; i < extraRewardsLen; i++) {
|
|
105
|
+
res[1 + i] = rewardTokens[i];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// @notice allows anyone to add new rewardTokens to this SY if a new rewardToken is added to the Nitro pool
|
|
110
|
+
function updateRewardTokensList() public virtual {
|
|
111
|
+
address token1 = ICamelotNitroPool(nitroPool).rewardsToken1().token;
|
|
112
|
+
address token2 = ICamelotNitroPool(nitroPool).rewardsToken2().token;
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
if (token1 != address(0) && !rewardTokens.contains(token1)) rewardTokens.push(token1);
|
|
116
|
+
if (token2 != address(0) && !rewardTokens.contains(token2)) rewardTokens.push(token2);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function _redeemExternalReward() internal override {
|
|
120
|
+
if (isRewardDisabled) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
ICamelotNitroPool(nitroPool).harvest();
|
|
125
|
+
ICamelotNFTPool(nftPool).harvestPosition(positionId);
|
|
126
|
+
_allocateXGrail();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/*///////////////////////////////////////////////////////////////
|
|
130
|
+
PREVIEW-RELATED
|
|
131
|
+
//////////////////////////////////////////////////////////////*/
|
|
132
|
+
|
|
133
|
+
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
134
|
+
internal
|
|
135
|
+
view
|
|
136
|
+
override
|
|
137
|
+
returns (uint256)
|
|
138
|
+
{
|
|
139
|
+
if (tokenIn == pair) {
|
|
140
|
+
return amountTokenToDeposit;
|
|
141
|
+
} else {
|
|
142
|
+
return previewHelper.previewZapIn(_getPairData(), tokenIn, amountTokenToDeposit);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
147
|
+
internal
|
|
148
|
+
view
|
|
149
|
+
override
|
|
150
|
+
returns (uint256)
|
|
151
|
+
{
|
|
152
|
+
if (tokenOut == pair) {
|
|
153
|
+
return amountSharesToRedeem;
|
|
154
|
+
} else {
|
|
155
|
+
return previewHelper.previewZapOut(_getPairData(), tokenOut, amountSharesToRedeem);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function _getPairData() internal view returns (CamelotPairData memory data) {
|
|
160
|
+
data.token0 = token0;
|
|
161
|
+
data.token1 = token1;
|
|
162
|
+
data.pair = pair;
|
|
163
|
+
(data.reserve0, data.reserve1, data.fee0, data.fee1) = ICamelotPair(pair).getReserves();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/*///////////////////////////////////////////////////////////////
|
|
167
|
+
MISC FUNCTIONS FOR METADATA
|
|
168
|
+
//////////////////////////////////////////////////////////////*/
|
|
169
|
+
|
|
170
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
171
|
+
res = new address[](3);
|
|
172
|
+
res[0] = token0;
|
|
173
|
+
res[1] = token1;
|
|
174
|
+
res[2] = pair;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
178
|
+
res = new address[](3);
|
|
179
|
+
res[0] = token0;
|
|
180
|
+
res[1] = token1;
|
|
181
|
+
res[2] = pair;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
185
|
+
return token == token0 || token == token1 || token == pair;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
189
|
+
return token == token0 || token == token1 || token == pair;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function assetInfo()
|
|
193
|
+
external
|
|
194
|
+
view
|
|
195
|
+
returns (
|
|
196
|
+
AssetType assetType,
|
|
197
|
+
address assetAddress,
|
|
198
|
+
uint8 assetDecimals
|
|
199
|
+
)
|
|
200
|
+
{
|
|
201
|
+
return (AssetType.LIQUIDITY, pair, IERC20Metadata(pair).decimals());
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/*///////////////////////////////////////////////////////////////
|
|
205
|
+
OWNER ONLY FUNCTIONS
|
|
206
|
+
//////////////////////////////////////////////////////////////*/
|
|
207
|
+
|
|
208
|
+
/// @dev Use emergencyWithdraw to ensure LP withdrawal is always successful
|
|
209
|
+
function setRewardDisabled(bool doRewardIndexUpdate) external onlyOwner {
|
|
210
|
+
if (doRewardIndexUpdate) _updateRewardIndex();
|
|
211
|
+
|
|
212
|
+
if (positionId != POSITION_UNINITIALIZED) {
|
|
213
|
+
ICamelotNitroPool(nitroPool).emergencyWithdraw(positionId);
|
|
214
|
+
ICamelotNFTPool(nftPool).emergencyWithdraw(positionId);
|
|
215
|
+
positionId = POSITION_UNINITIALIZED;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
isRewardDisabled = true;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function setReferrerForSwap(address newReferrer) external onlyOwner {
|
|
222
|
+
referrerForSwap = newReferrer;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// XGRAIL related, to be used only when this SY is deprecated
|
|
226
|
+
|
|
227
|
+
function redeemXGrailOwner(uint256 xGrailAmount, uint256 duration) external onlyOwner {
|
|
228
|
+
IXGrail(xGRAIL).redeem(xGrailAmount, duration);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function finalizeRedeem(uint256 redeemIndex) external onlyOwner {
|
|
232
|
+
uint256 preBalance = _selfBalance(GRAIL);
|
|
233
|
+
|
|
234
|
+
IXGrail(xGRAIL).finalizeRedeem(redeemIndex);
|
|
235
|
+
|
|
236
|
+
uint256 amount = _selfBalance(GRAIL) - preBalance;
|
|
237
|
+
_transferOut(GRAIL, msg.sender, amount);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function cancelRedeem(uint256 redeemIndex) external onlyOwner {
|
|
241
|
+
IXGrail(xGRAIL).cancelRedeem(redeemIndex);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -77,6 +77,10 @@ library Math {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
function square(uint256 x) internal pure returns (uint256) {
|
|
81
|
+
return x * x;
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
function abs(int256 x) internal pure returns (uint256) {
|
|
81
85
|
return uint256(x > 0 ? x : -x);
|
|
82
86
|
}
|
|
@@ -152,15 +156,27 @@ library Math {
|
|
|
152
156
|
return uint128(x);
|
|
153
157
|
}
|
|
154
158
|
|
|
155
|
-
function isAApproxB(
|
|
159
|
+
function isAApproxB(
|
|
160
|
+
uint256 a,
|
|
161
|
+
uint256 b,
|
|
162
|
+
uint256 eps
|
|
163
|
+
) internal pure returns (bool) {
|
|
156
164
|
return mulDown(b, ONE - eps) <= a && a <= mulDown(b, ONE + eps);
|
|
157
165
|
}
|
|
158
166
|
|
|
159
|
-
function isAGreaterApproxB(
|
|
167
|
+
function isAGreaterApproxB(
|
|
168
|
+
uint256 a,
|
|
169
|
+
uint256 b,
|
|
170
|
+
uint256 eps
|
|
171
|
+
) internal pure returns (bool) {
|
|
160
172
|
return a >= b && a <= mulDown(b, ONE + eps);
|
|
161
173
|
}
|
|
162
174
|
|
|
163
|
-
function isASmallerApproxB(
|
|
175
|
+
function isASmallerApproxB(
|
|
176
|
+
uint256 a,
|
|
177
|
+
uint256 b,
|
|
178
|
+
uint256 eps
|
|
179
|
+
) internal pure returns (bool) {
|
|
164
180
|
return a <= b && a >= mulDown(b, ONE - eps);
|
|
165
181
|
}
|
|
166
182
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
pragma solidity >=0.8.0;
|
|
2
|
+
|
|
3
|
+
interface ICamelotFactory {
|
|
4
|
+
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
|
|
5
|
+
|
|
6
|
+
function owner() external view returns (address);
|
|
7
|
+
function feePercentOwner() external view returns (address);
|
|
8
|
+
function setStableOwner() external view returns (address);
|
|
9
|
+
function feeTo() external view returns (address);
|
|
10
|
+
|
|
11
|
+
function ownerFeeShare() external view returns (uint256);
|
|
12
|
+
function referrersFeeShare(address) external view returns (uint256);
|
|
13
|
+
|
|
14
|
+
function getPair(address tokenA, address tokenB) external view returns (address pair);
|
|
15
|
+
function allPairs(uint256) external view returns (address pair);
|
|
16
|
+
function allPairsLength() external view returns (uint256);
|
|
17
|
+
|
|
18
|
+
function createPair(address tokenA, address tokenB) external returns (address pair);
|
|
19
|
+
|
|
20
|
+
function setFeeTo(address) external;
|
|
21
|
+
function feeInfo() external view returns (uint _ownerFeeShare, address _feeTo);
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
interface ICamelotNFTFactory {
|
|
5
|
+
function getPool(address lp) external view returns (address nftPool);
|
|
6
|
+
|
|
7
|
+
function grailToken() external view returns (address);
|
|
8
|
+
|
|
9
|
+
function xGrailToken() external view returns (address);
|
|
10
|
+
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
|
|
5
|
+
|
|
6
|
+
interface ICamelotNFTHandler is IERC721Receiver {
|
|
7
|
+
function onNFTHarvest(
|
|
8
|
+
address operator,
|
|
9
|
+
address to,
|
|
10
|
+
uint256 tokenId,
|
|
11
|
+
uint256 grailAmount,
|
|
12
|
+
uint256 xGrailAmount
|
|
13
|
+
) external returns (bool);
|
|
14
|
+
|
|
15
|
+
function onNFTAddToPosition(
|
|
16
|
+
address operator,
|
|
17
|
+
uint256 tokenId,
|
|
18
|
+
uint256 lpAmount
|
|
19
|
+
) external returns (bool);
|
|
20
|
+
|
|
21
|
+
function onNFTWithdraw(
|
|
22
|
+
address operator,
|
|
23
|
+
uint256 tokenId,
|
|
24
|
+
uint256 lpAmount
|
|
25
|
+
) external returns (bool);
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
4
|
+
|
|
5
|
+
interface ICamelotNFTPool is IERC721 {
|
|
6
|
+
function createPosition(uint256 amount, uint256 lockDuration) external;
|
|
7
|
+
|
|
8
|
+
function lastTokenId() external view returns (uint256);
|
|
9
|
+
|
|
10
|
+
function addToPosition(uint256 tokenId, uint256 amountToAdd) external;
|
|
11
|
+
|
|
12
|
+
function withdrawFromPosition(uint256 tokenId, uint256 amountToWithdraw) external;
|
|
13
|
+
|
|
14
|
+
function harvestPosition(uint256 tokenId) external;
|
|
15
|
+
|
|
16
|
+
function yieldBooster() external view returns (address);
|
|
17
|
+
|
|
18
|
+
function emergencyWithdraw(uint256 tokenId) external;
|
|
19
|
+
}
|