@pendle/core-v2 0.11.11-testnet → 0.12.1-testnet
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +199 -30
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.json +1030 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.json +1025 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.json +948 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +76 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +140 -25
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.json +138 -23
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +138 -23
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +310 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/{CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.json → CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.json} +18 -85
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +336 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/{CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json → CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.json} +8 -21
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.json +131 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +297 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +376 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +11 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +29 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +40 -86
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +228 -40
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +232 -12
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +164 -47
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +25 -93
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.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 +222 -9
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +106 -5
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +4 -0
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +329 -0
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +13 -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 +87 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +80 -16
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +164 -2
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +172 -4
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +109 -2
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.json +57 -4
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.json +7 -2
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.json +199 -4
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.json +108 -2
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.json +146 -4
- package/build/artifacts/contracts/core/actions/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.json +177 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.json +78 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.json +24 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.json +264 -0
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +305 -0
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.json +34 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +31 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +30 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.json +10 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +30 -0
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +101 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.json +112 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.json +76 -0
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +13 -0
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.json +24 -0
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.json +63 -0
- package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.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/IPVotingController.sol/IPVotingController.json +148 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPVotingEscrow.sol/IPVotingEscrow.json → IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.json} +88 -2
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/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/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +4 -28
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/Errors.sol/Errors.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/Errors.sol/Errors.json +886 -0
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.json +28 -2
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{solmate/SSTORE2.sol/SSTORE2.json → VeHistoryLib.sol/CheckpointHelper.json} +4 -4
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +45 -0
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/{SSTORE2Deployer.sol/SSTORE2Deployer.json → BaseSplitCodeFactory.sol/CodeDeployer.json} +4 -4
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
- package/build/artifacts/contracts/libraries/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.json +2 -2
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +167 -0
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +182 -4
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +142 -66
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +3 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +19 -16
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol +135 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol +96 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol +215 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol +83 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +10 -15
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +30 -43
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +74 -0
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +38 -0
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +83 -0
- package/contracts/core/LiquidityMining/{CelerAbstracts/CelerSenderUpg.sol → CrossChainMsg/PendleMsgSenderAppUpg.sol} +12 -13
- package/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol +159 -0
- package/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol +96 -0
- package/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol +68 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +4 -3
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +6 -2
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +12 -4
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +29 -19
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +27 -19
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +63 -27
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +6 -5
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +2 -2
- package/contracts/core/Market/PendleMarket.sol +26 -24
- package/contracts/core/Market/PendleMarketFactory.sol +41 -20
- package/contracts/core/PendleERC20Permit.sol +84 -0
- package/contracts/core/PendleRouter.sol +2 -1
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +8 -7
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +37 -22
- package/contracts/core/YieldContracts/PendleYieldToken.sol +106 -35
- package/contracts/core/actions/ActionAddRemoveLiq.sol +58 -41
- package/contracts/core/actions/ActionCallback.sol +24 -14
- package/contracts/core/actions/ActionMintRedeem.sol +11 -5
- package/contracts/core/actions/ActionMisc.sol +2 -1
- package/contracts/core/actions/ActionSwapPT.sol +38 -19
- package/contracts/core/actions/ActionSwapPTYT.sol +7 -6
- package/contracts/core/actions/ActionSwapYT.sol +36 -19
- package/contracts/core/actions/base/ActionBaseMintRedeem.sol +15 -8
- package/contracts/interfaces/ConvexCurve/IBooster.sol +32 -0
- package/contracts/interfaces/ConvexCurve/ICrvDepositor.sol +20 -0
- package/contracts/interfaces/ConvexCurve/ICvxCrv.sol +6 -0
- package/contracts/interfaces/ConvexCurve/IRewards.sol +38 -0
- package/contracts/interfaces/Curve/ICrvPool.sol +69 -0
- package/contracts/interfaces/IBoringOwnableUpgradeable.sol +10 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +7 -7
- package/contracts/interfaces/IPActionSwapPT.sol +6 -6
- package/contracts/interfaces/IPActionSwapPTYT.sol +2 -2
- package/contracts/interfaces/IPActionSwapYT.sol +13 -13
- package/contracts/interfaces/IPFeeDistributor.sol +19 -0
- package/contracts/interfaces/IPFeeDistributorFactory.sol +14 -0
- package/contracts/interfaces/IPMarket.sol +2 -0
- package/contracts/interfaces/IPMsgReceiverApp.sol +7 -0
- package/contracts/interfaces/IPMsgSendEndpoint.sol +17 -0
- package/contracts/interfaces/IPVotingController.sol +22 -0
- package/contracts/interfaces/{IPVotingEscrow.sol → IPVotingEscrowMainchain.sol} +11 -1
- package/contracts/interfaces/ISuperComposableYield.sol +2 -7
- package/contracts/libraries/Errors.sol +121 -0
- package/contracts/libraries/OracleLib.sol +6 -3
- package/contracts/libraries/VeBalanceLib.sol +5 -1
- package/contracts/libraries/VeHistoryLib.sol +20 -31
- package/contracts/libraries/helpers/ArrayLib.sol +0 -17
- package/contracts/libraries/helpers/BaseSplitCodeFactory.sol +288 -0
- package/contracts/libraries/helpers/TokenHelper.sol +4 -0
- package/contracts/libraries/kyberswap/AggregationRouterHelper.sol +0 -7
- package/contracts/libraries/math/MarketMathCore.sol +29 -25
- package/contracts/libraries/math/Math.sol +6 -2
- package/contracts/libraries/math/WeekMath.sol +2 -2
- package/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol +43 -0
- package/contracts/offchain-helpers/MarketMathStatic.sol +36 -36
- package/contracts/offchain-helpers/RouterStatic.sol +53 -37
- package/deployments/43113-core.json +11 -10
- package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
- package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
- package/deployments/43113-testenv.json +9 -9
- package/deployments/80001-core.json +10 -9
- package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
- package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
- package/deployments/80001-testenv.json +16 -16
- package/package.json +1 -1
- package/typechain-types/ActionAddRemoveLiq.ts +18 -6
- package/typechain-types/ActionSwapPT.ts +18 -6
- package/typechain-types/ActionSwapPTYT.ts +6 -2
- package/typechain-types/ActionSwapYT.ts +18 -6
- package/typechain-types/IPActionAddRemoveLiq.ts +19 -7
- package/typechain-types/IPActionSwapPT.ts +18 -6
- package/typechain-types/IPActionSwapPTYT.ts +6 -2
- package/typechain-types/IPActionSwapYT.ts +18 -6
- package/typechain-types/IPAllAction.ts +61 -21
- package/typechain-types/IPBatchSeller.ts +19 -37
- package/typechain-types/IPMarket.ts +13 -0
- package/typechain-types/IPVotingController.ts +244 -7
- package/typechain-types/ISuperComposableYield.ts +7 -46
- package/typechain-types/MarketMathStatic.ts +139 -10
- package/typechain-types/PendleBatchSeller.ts +72 -50
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +28 -149
- package/typechain-types/PendleMarket.ts +104 -0
- package/typechain-types/PendleMarketFactory.ts +76 -13
- package/typechain-types/PendlePrincipalToken.ts +104 -0
- package/typechain-types/PendleQiTokenSCY.ts +111 -46
- package/typechain-types/PendleVotingControllerUpg.ts +133 -77
- package/typechain-types/PendleWstEthSCY.ts +111 -46
- package/typechain-types/PendleYieldContractFactory.ts +84 -21
- package/typechain-types/PendleYieldToken.ts +175 -0
- package/typechain-types/RouterStatic.ts +136 -67
- package/typechain-types/SCYBase.ts +111 -46
- package/typechain-types/SCYBaseWithRewards.ts +111 -46
- package/typechain-types/VotingControllerStorageUpg.ts +246 -27
- package/typechain-types/VotingEscrowPendleMainchain.ts +81 -93
- package/typechain-types/VotingEscrowPendleSidechain.ts +26 -171
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +169 -1
- package/typechain-types/factories/ActionCallback__factory.ts +108 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +54 -1
- package/typechain-types/factories/ActionMisc__factory.ts +6 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +107 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +196 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +143 -1
- package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +31 -1
- package/typechain-types/factories/IPActionSwapPTYT__factory.ts +10 -0
- package/typechain-types/factories/IPActionSwapPT__factory.ts +30 -0
- package/typechain-types/factories/IPActionSwapYT__factory.ts +30 -0
- package/typechain-types/factories/IPAllAction__factory.ts +101 -1
- package/typechain-types/factories/IPBatchSeller__factory.ts +4 -10
- package/typechain-types/factories/IPMarket__factory.ts +13 -0
- package/typechain-types/factories/IPVotingController__factory.ts +148 -0
- package/typechain-types/factories/ISuperComposableYield__factory.ts +4 -28
- package/typechain-types/factories/MarketMathStatic__factory.ts +181 -3
- package/typechain-types/factories/OracleLib__factory.ts +27 -1
- package/typechain-types/factories/Pendle3CrvAndTokenSCY__factory.ts +1 -1
- package/typechain-types/factories/Pendle3CrvHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleBatchSeller__factory.ts +40 -118
- package/typechain-types/factories/PendleConvexCurveLP2PoolSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20Permit__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/PendleGaugeControllerBaseUpg__factory.ts +11 -0
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +28 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +48 -86
- package/typechain-types/factories/PendleMarketFactory__factory.ts +129 -9
- package/typechain-types/factories/PendleMarket__factory.ts +214 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +86 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +198 -29
- package/typechain-types/factories/PendleRouter__factory.ts +12 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +235 -40
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +137 -22
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +103 -20
- package/typechain-types/factories/PendleYieldToken__factory.ts +163 -1
- package/typechain-types/factories/PtAMMArb__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +95 -19
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +136 -21
- package/typechain-types/factories/SCYBase__factory.ts +136 -21
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +232 -12
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +171 -47
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +31 -93
- package/typechain-types/hardhat.d.ts +393 -114
- package/typechain-types/index.ts +36 -66
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +0 -810
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.json +0 -10
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +0 -833
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +0 -723
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +0 -728
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +0 -705
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.json +0 -864
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.json +0 -718
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +0 -784
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.json +0 -134
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +0 -161
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol +0 -126
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +0 -242
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +0 -146
- package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +0 -176
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +0 -129
- package/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol +0 -193
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol +0 -155
- package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +0 -182
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol +0 -53
- package/contracts/libraries/helpers/SSTORE2Deployer.sol +0 -30
- package/contracts/libraries/solmate/SSTORE2.sol +0 -99
- package/contracts/offchain-helpers/SSTORE2DeployerContract.sol +0 -21
- package/deployments/43113-markets/benqi-market-10D931.json +0 -8
- package/deployments/43113-markets/benqi-market-9fbD64.json +0 -8
- package/deployments/43113-markets/benqi-market-A12361.json +0 -8
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.15;
|
|
3
|
-
import "../base-implementations/SCYBase.sol";
|
|
4
|
-
import "../../interfaces/IERC4626.sol";
|
|
5
|
-
import "../../libraries/math/Math.sol";
|
|
6
|
-
|
|
7
|
-
contract PendleERC4626SCY is SCYBase {
|
|
8
|
-
using Math for uint256;
|
|
9
|
-
// if exchangeRate is >= 3e38, the contract will overflow & frozen.
|
|
10
|
-
// Therefore, a reasonable limit (1e30) is set here. It can be removed
|
|
11
|
-
// if the implementer is fully aware of the risk
|
|
12
|
-
uint256 private constant MAX_EXCHANGE_RATE = 1e30;
|
|
13
|
-
|
|
14
|
-
address public immutable underlying;
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
string memory _name,
|
|
18
|
-
string memory _symbol,
|
|
19
|
-
IERC4626 _yieldToken
|
|
20
|
-
) SCYBase(_name, _symbol, address(_yieldToken)) {
|
|
21
|
-
underlying = _yieldToken.asset();
|
|
22
|
-
_safeApprove(underlying, yieldToken, type(uint256).max);
|
|
23
|
-
_validateERC4626SCY();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function _validateERC4626SCY() internal view {
|
|
27
|
-
require(exchangeRate() <= 1e30, "too big exchangeRate");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/*///////////////////////////////////////////////////////////////
|
|
31
|
-
DEPOSIT/REDEEM USING BASE TOKENS
|
|
32
|
-
//////////////////////////////////////////////////////////////*/
|
|
33
|
-
|
|
34
|
-
function _deposit(address tokenIn, uint256 amountDeposited)
|
|
35
|
-
internal
|
|
36
|
-
virtual
|
|
37
|
-
override
|
|
38
|
-
returns (uint256 amountSharesOut)
|
|
39
|
-
{
|
|
40
|
-
// 1 4626 = 1 Share
|
|
41
|
-
if (tokenIn == yieldToken) {
|
|
42
|
-
amountSharesOut = amountDeposited;
|
|
43
|
-
} else {
|
|
44
|
-
// must be underlying
|
|
45
|
-
amountSharesOut = IERC4626(yieldToken).deposit(amountDeposited, address(this));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function _redeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
50
|
-
internal
|
|
51
|
-
virtual
|
|
52
|
-
override
|
|
53
|
-
returns (uint256 amountTokenOut)
|
|
54
|
-
{
|
|
55
|
-
if (tokenOut == yieldToken) {
|
|
56
|
-
amountTokenOut = amountSharesToRedeem;
|
|
57
|
-
} else {
|
|
58
|
-
amountTokenOut = IERC4626(yieldToken).redeem(
|
|
59
|
-
amountSharesToRedeem,
|
|
60
|
-
address(this),
|
|
61
|
-
address(this)
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/*///////////////////////////////////////////////////////////////
|
|
67
|
-
SCY-INDEX
|
|
68
|
-
//////////////////////////////////////////////////////////////*/
|
|
69
|
-
|
|
70
|
-
function exchangeRate() public view virtual override returns (uint256) {
|
|
71
|
-
return IERC4626(yieldToken).convertToAssets(Math.ONE);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/*///////////////////////////////////////////////////////////////
|
|
75
|
-
MISC FUNCTIONS FOR METADATA
|
|
76
|
-
//////////////////////////////////////////////////////////////*/
|
|
77
|
-
|
|
78
|
-
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
79
|
-
internal
|
|
80
|
-
view
|
|
81
|
-
override
|
|
82
|
-
returns (uint256 amountSharesOut)
|
|
83
|
-
{
|
|
84
|
-
if (tokenIn == yieldToken) amountSharesOut = amountTokenToDeposit;
|
|
85
|
-
else amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
89
|
-
internal
|
|
90
|
-
view
|
|
91
|
-
override
|
|
92
|
-
returns (uint256 amountTokenOut)
|
|
93
|
-
{
|
|
94
|
-
if (tokenOut == yieldToken) amountTokenOut = amountSharesToRedeem;
|
|
95
|
-
else amountTokenOut = (amountSharesToRedeem * exchangeRate()) / 1e18;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
99
|
-
res = new address[](2);
|
|
100
|
-
res[0] = underlying;
|
|
101
|
-
res[1] = yieldToken;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
105
|
-
res = new address[](2);
|
|
106
|
-
res[0] = underlying;
|
|
107
|
-
res[1] = yieldToken;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
111
|
-
return token == underlying || token == yieldToken;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
115
|
-
return token == underlying || token == yieldToken;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function assetInfo()
|
|
119
|
-
external
|
|
120
|
-
view
|
|
121
|
-
returns (
|
|
122
|
-
AssetType assetType,
|
|
123
|
-
address assetAddress,
|
|
124
|
-
uint8 assetDecimals
|
|
125
|
-
)
|
|
126
|
-
{
|
|
127
|
-
return (AssetType.TOKEN, underlying, IERC20Metadata(underlying).decimals());
|
|
128
|
-
}
|
|
129
|
-
}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.15;
|
|
3
|
-
import "../base-implementations/SCYBaseWithRewards.sol";
|
|
4
|
-
import "../../interfaces/IStargateRouter.sol";
|
|
5
|
-
import "../../interfaces/IStargatePool.sol";
|
|
6
|
-
import "../../interfaces/IStargateLPStaking.sol";
|
|
7
|
-
|
|
8
|
-
contract PendleStargateSCY is SCYBaseWithRewards {
|
|
9
|
-
address public immutable stgRouter;
|
|
10
|
-
uint16 public immutable stgRouterPoolId;
|
|
11
|
-
|
|
12
|
-
address public immutable stgStakingLP;
|
|
13
|
-
uint256 public immutable pid;
|
|
14
|
-
|
|
15
|
-
address public immutable underlying;
|
|
16
|
-
address public immutable stgPool;
|
|
17
|
-
address public immutable stgToken;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
string memory _name,
|
|
21
|
-
string memory _symbol,
|
|
22
|
-
address _stgRouter,
|
|
23
|
-
address _stgStakingLP,
|
|
24
|
-
uint256 _pid,
|
|
25
|
-
address _stgPool
|
|
26
|
-
) SCYBaseWithRewards(_name, _symbol, _stgPool) {
|
|
27
|
-
stgRouter = _stgRouter;
|
|
28
|
-
|
|
29
|
-
stgRouterPoolId = uint16(IStargatePool(_stgPool).poolId());
|
|
30
|
-
|
|
31
|
-
stgStakingLP = _stgStakingLP;
|
|
32
|
-
pid = _pid;
|
|
33
|
-
|
|
34
|
-
stgPool = _stgPool;
|
|
35
|
-
stgToken = IStargateLPStaking(_stgStakingLP).stargate();
|
|
36
|
-
underlying = IStargatePool(stgPool).token();
|
|
37
|
-
|
|
38
|
-
// verify _pid
|
|
39
|
-
require(
|
|
40
|
-
IStargateLPStaking(_stgStakingLP).poolInfo(_pid).lpToken == _stgPool,
|
|
41
|
-
"invalid pid"
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
_safeApprove(underlying, _stgRouter, type(uint256).max);
|
|
45
|
-
// There is not a need to approve LP for router since stargate uses direct burn
|
|
46
|
-
// _safeApprove(stgPool, _stgRouter, type(uint256).max);
|
|
47
|
-
_safeApprove(stgPool, _stgStakingLP, type(uint256).max);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/*///////////////////////////////////////////////////////////////
|
|
51
|
-
DEPOSIT/REDEEM USING BASE TOKENS
|
|
52
|
-
//////////////////////////////////////////////////////////////*/
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @dev See {SCYBase-_deposit}
|
|
56
|
-
*
|
|
57
|
-
* The underlying yield token is stargateLP. If the base token deposited is underlying, the function addLiquidity
|
|
58
|
-
* using stargateRouter first. Then the amount of LP out will be taken into calculation.
|
|
59
|
-
*
|
|
60
|
-
* The exchange rate of stargateLP to shares is 1:1
|
|
61
|
-
*/
|
|
62
|
-
function _deposit(address tokenIn, uint256 amountDeposited)
|
|
63
|
-
internal
|
|
64
|
-
virtual
|
|
65
|
-
override
|
|
66
|
-
returns (uint256 amountSharesOut)
|
|
67
|
-
{
|
|
68
|
-
if (tokenIn == stgPool) {
|
|
69
|
-
amountSharesOut = amountDeposited;
|
|
70
|
-
} else {
|
|
71
|
-
uint256 preBalanceStgPool = _selfBalance(stgPool);
|
|
72
|
-
IStargateRouter(stgRouter).addLiquidity(
|
|
73
|
-
stgRouterPoolId,
|
|
74
|
-
amountDeposited,
|
|
75
|
-
address(this)
|
|
76
|
-
);
|
|
77
|
-
amountSharesOut = _selfBalance(stgPool) - preBalanceStgPool;
|
|
78
|
-
}
|
|
79
|
-
IStargateLPStaking(stgStakingLP).deposit(pid, amountSharesOut);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @dev See {SCYBase-_redeem}
|
|
84
|
-
*
|
|
85
|
-
* The staked tokens are firstly withdraw from staking
|
|
86
|
-
*
|
|
87
|
-
* The shares are redeemed into underlying using router if necessary.
|
|
88
|
-
*/
|
|
89
|
-
function _redeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
90
|
-
internal
|
|
91
|
-
virtual
|
|
92
|
-
override
|
|
93
|
-
returns (uint256 amountTokenOut)
|
|
94
|
-
{
|
|
95
|
-
IStargateLPStaking(stgStakingLP).withdraw(pid, amountSharesToRedeem);
|
|
96
|
-
if (tokenOut == stgPool) {
|
|
97
|
-
amountTokenOut = amountSharesToRedeem;
|
|
98
|
-
} else {
|
|
99
|
-
uint256 preBalanceStgLp = IERC20(stgPool).balanceOf(address(this));
|
|
100
|
-
amountTokenOut = IStargateRouter(stgRouter).instantRedeemLocal(
|
|
101
|
-
stgRouterPoolId,
|
|
102
|
-
amountSharesToRedeem,
|
|
103
|
-
address(this)
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
uint256 amountLpUsed = preBalanceStgLp - IERC20(stgPool).balanceOf(address(this));
|
|
107
|
-
|
|
108
|
-
// Since stargate is a bridge, sometime there might not be enough fund in the pool to redeem
|
|
109
|
-
// In this case, stargate contract doesn't revert
|
|
110
|
-
require(amountLpUsed == amountSharesToRedeem, "insufficient fund to redeem");
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/*///////////////////////////////////////////////////////////////
|
|
115
|
-
EXCHANGE-RATE
|
|
116
|
-
//////////////////////////////////////////////////////////////*/
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* @notice Calculates and updates the exchange rate of shares to underlying asset token
|
|
120
|
-
* @dev It is the exchange rate of stgPool to underlying
|
|
121
|
-
*/
|
|
122
|
-
function exchangeRate() public view virtual override returns (uint256 currentRate) {
|
|
123
|
-
return IStargatePool(stgPool).amountLPtoLD(SCYUtils.ONE);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/*///////////////////////////////////////////////////////////////
|
|
127
|
-
MISC FUNCTIONS FOR METADATA
|
|
128
|
-
//////////////////////////////////////////////////////////////*/
|
|
129
|
-
|
|
130
|
-
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
131
|
-
res = new address[](2);
|
|
132
|
-
res[0] = stgPool;
|
|
133
|
-
res[1] = underlying;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
137
|
-
res = new address[](2);
|
|
138
|
-
res[0] = stgPool;
|
|
139
|
-
res[1] = underlying;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
143
|
-
return token == stgPool || token == underlying;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
147
|
-
return token == stgPool || token == underlying;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
151
|
-
internal
|
|
152
|
-
view
|
|
153
|
-
override
|
|
154
|
-
returns (uint256 amountSharesOut)
|
|
155
|
-
{
|
|
156
|
-
if (tokenIn == stgPool) amountSharesOut = amountTokenToDeposit;
|
|
157
|
-
else amountSharesOut = (amountTokenToDeposit * SCYUtils.ONE) / exchangeRate();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
161
|
-
internal
|
|
162
|
-
view
|
|
163
|
-
override
|
|
164
|
-
returns (uint256 amountTokenOut)
|
|
165
|
-
{
|
|
166
|
-
if (tokenOut == stgPool) amountTokenOut = amountSharesToRedeem;
|
|
167
|
-
else amountTokenOut = (amountSharesToRedeem * exchangeRate()) / SCYUtils.ONE;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function assetInfo()
|
|
171
|
-
external
|
|
172
|
-
view
|
|
173
|
-
returns (
|
|
174
|
-
AssetType assetType,
|
|
175
|
-
address assetAddress,
|
|
176
|
-
uint8 assetDecimals
|
|
177
|
-
)
|
|
178
|
-
{
|
|
179
|
-
return (AssetType.TOKEN, stgPool, IERC20Metadata(stgPool).decimals());
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function _redeemExternalReward() internal override {
|
|
183
|
-
IStargateLPStaking(stgStakingLP).withdraw(pid, 0);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* @dev See {ISuperComposableYield-getRewardTokens}
|
|
188
|
-
*/
|
|
189
|
-
function _getRewardTokens() internal view override returns (address[] memory res) {
|
|
190
|
-
res = new address[](1);
|
|
191
|
-
res[0] = stgToken;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.15;
|
|
3
|
-
|
|
4
|
-
import "../base-implementations/SCYBase.sol";
|
|
5
|
-
import "../../interfaces/IYearnVault.sol";
|
|
6
|
-
|
|
7
|
-
contract PendleYearnVaultSCY is SCYBase {
|
|
8
|
-
address public immutable underlying;
|
|
9
|
-
address public immutable yvToken;
|
|
10
|
-
uint256 internal immutable yvTokenDecimals;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
string memory _name,
|
|
14
|
-
string memory _symbol,
|
|
15
|
-
address _yvToken
|
|
16
|
-
) SCYBase(_name, _symbol, _yvToken) {
|
|
17
|
-
require(_yvToken != address(0), "zero address");
|
|
18
|
-
yvToken = _yvToken;
|
|
19
|
-
underlying = IYearnVault(yvToken).token();
|
|
20
|
-
yvTokenDecimals = IYearnVault(yvToken).decimals();
|
|
21
|
-
_safeApprove(underlying, yvToken, type(uint256).max);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/*///////////////////////////////////////////////////////////////
|
|
25
|
-
DEPOSIT/REDEEM USING BASE TOKENS
|
|
26
|
-
//////////////////////////////////////////////////////////////*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @dev See {SCYBase-_deposit}
|
|
30
|
-
*
|
|
31
|
-
* The underlying yield token is yvToken. If the base token deposited is underlying asset, the function
|
|
32
|
-
* first mints yvToken using those deposited. Then the corresponding amount of shares is returned.
|
|
33
|
-
*
|
|
34
|
-
* The exchange rate of yvToken to shares is 1:1
|
|
35
|
-
*/
|
|
36
|
-
function _deposit(address tokenIn, uint256 amountDeposited)
|
|
37
|
-
internal
|
|
38
|
-
virtual
|
|
39
|
-
override
|
|
40
|
-
returns (uint256 amountSharesOut)
|
|
41
|
-
{
|
|
42
|
-
if (tokenIn == yvToken) {
|
|
43
|
-
amountSharesOut = amountDeposited;
|
|
44
|
-
} else {
|
|
45
|
-
// tokenIn == underlying
|
|
46
|
-
uint256 preBalance = _selfBalance(yvToken);
|
|
47
|
-
IYearnVault(yvToken).deposit(amountDeposited);
|
|
48
|
-
amountSharesOut = _selfBalance(yvToken) - preBalance; // 1 yvToken = 1 SCY
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @dev See {SCYBase-_redeem}
|
|
54
|
-
*
|
|
55
|
-
* The shares are redeemed into the same amount of yvTokens. If `tokenOut` is the underlying asset,
|
|
56
|
-
* the function also withdraws said asset for redemption, using the corresponding amount of yvToken.
|
|
57
|
-
*/
|
|
58
|
-
function _redeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
59
|
-
internal
|
|
60
|
-
virtual
|
|
61
|
-
override
|
|
62
|
-
returns (uint256 amountTokenOut)
|
|
63
|
-
{
|
|
64
|
-
if (tokenOut == yvToken) {
|
|
65
|
-
amountTokenOut = amountSharesToRedeem;
|
|
66
|
-
} else {
|
|
67
|
-
// tokenOut == underlying
|
|
68
|
-
uint256 preBalanceYvToken = _selfBalance(yvToken);
|
|
69
|
-
|
|
70
|
-
amountTokenOut = IYearnVault(yvToken).withdraw(
|
|
71
|
-
amountSharesToRedeem,
|
|
72
|
-
address(this),
|
|
73
|
-
10000
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
require(
|
|
77
|
-
preBalanceYvToken - _selfBalance(yvToken) == amountSharesToRedeem,
|
|
78
|
-
"Yearn Vault SCY: Not allowed to redeem all shares"
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/*///////////////////////////////////////////////////////////////
|
|
84
|
-
EXCHANGE-RATE
|
|
85
|
-
//////////////////////////////////////////////////////////////*/
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @notice Calculates and updates the exchange rate of shares to underlying asset token
|
|
89
|
-
* @dev It is the price per share of the yvToken
|
|
90
|
-
*/
|
|
91
|
-
function exchangeRate() public view override returns (uint256) {
|
|
92
|
-
uint256 price = IYearnVault(yvToken).pricePerShare();
|
|
93
|
-
if (yvTokenDecimals <= 18) {
|
|
94
|
-
return price * (10**(18 - yvTokenDecimals));
|
|
95
|
-
} else {
|
|
96
|
-
return price / (10**(yvTokenDecimals - 18));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/*///////////////////////////////////////////////////////////////
|
|
101
|
-
MISC FUNCTIONS FOR METADATA
|
|
102
|
-
//////////////////////////////////////////////////////////////*/
|
|
103
|
-
|
|
104
|
-
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
105
|
-
internal
|
|
106
|
-
view
|
|
107
|
-
override
|
|
108
|
-
returns (uint256 amountSharesOut)
|
|
109
|
-
{
|
|
110
|
-
if (tokenIn == yvToken) amountSharesOut = amountTokenToDeposit;
|
|
111
|
-
else amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
115
|
-
internal
|
|
116
|
-
view
|
|
117
|
-
override
|
|
118
|
-
returns (uint256 amountTokenOut)
|
|
119
|
-
{
|
|
120
|
-
if (tokenOut == yvToken) amountTokenOut = amountSharesToRedeem;
|
|
121
|
-
else amountTokenOut = (amountSharesToRedeem * exchangeRate()) / 1e18;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
125
|
-
res = new address[](2);
|
|
126
|
-
res[0] = underlying;
|
|
127
|
-
res[1] = yvToken;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
131
|
-
res = new address[](2);
|
|
132
|
-
res[0] = underlying;
|
|
133
|
-
res[1] = yvToken;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
137
|
-
return token == underlying || token == yvToken;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
141
|
-
return token == underlying || token == yvToken;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function assetInfo()
|
|
145
|
-
external
|
|
146
|
-
view
|
|
147
|
-
returns (
|
|
148
|
-
AssetType assetType,
|
|
149
|
-
address assetAddress,
|
|
150
|
-
uint8 assetDecimals
|
|
151
|
-
)
|
|
152
|
-
{
|
|
153
|
-
return (AssetType.TOKEN, underlying, IERC20Metadata(underlying).decimals());
|
|
154
|
-
}
|
|
155
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.15;
|
|
3
|
-
|
|
4
|
-
import "../../base-implementations/SCYBaseWithRewards.sol";
|
|
5
|
-
import "../../../interfaces/ISJoe.sol";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
sJOE Staking
|
|
9
|
-
sJOE Staking is a highly accessible Staking option. Users can Stake into sJOE and unstake from sJOE at any time. There is however a deposit fee mechanism to prevent over-saturation.
|
|
10
|
-
|
|
11
|
-
Deposit Fee
|
|
12
|
-
Staking into sJOE may come with a fee
|
|
13
|
-
The fee can scale up to 3% Max, depending on the number of JOEs already Staked
|
|
14
|
-
The 3% Fee is taken from the JOEs that you deposit into the sJOE Pool
|
|
15
|
-
Currently any deposit fee taken will be sent to the Treasury
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Yield Generating Mechanism - Stake JOE into SJOE Contract
|
|
19
|
-
|
|
20
|
-
Asset - JOE
|
|
21
|
-
|
|
22
|
-
Shares - Shares (in contract *take note of deduction of fees after depositing)
|
|
23
|
-
|
|
24
|
-
Exchange Rate - Increases with sJOE rewards
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
// sJOE -> Staking contract that accepts JOE and yields USDC as the ONLY reward token
|
|
29
|
-
// sJOE Contract Address on Avalanche -> 0x1a731B2299E22FbAC282E7094EdA41046343Cb51
|
|
30
|
-
|
|
31
|
-
// JOE Contract Address on Avalanche -> 0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd
|
|
32
|
-
|
|
33
|
-
contract PendleSJoeSCY is SCYBaseWithRewards {
|
|
34
|
-
using SafeERC20 for IERC20;
|
|
35
|
-
|
|
36
|
-
address public immutable SJOE;
|
|
37
|
-
address public immutable JOE;
|
|
38
|
-
|
|
39
|
-
constructor(
|
|
40
|
-
string memory _name,
|
|
41
|
-
string memory _symbol,
|
|
42
|
-
address _sJOE
|
|
43
|
-
) SCYBaseWithRewards(_name, _symbol, ISJoe(_sJOE).joe()) {
|
|
44
|
-
require(_sJOE != address(0), "zero address");
|
|
45
|
-
SJOE = _sJOE;
|
|
46
|
-
JOE = yieldToken;
|
|
47
|
-
|
|
48
|
-
_safeApprove(JOE, SJOE, type(uint256).max);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/*///////////////////////////////////////////////////////////////
|
|
52
|
-
DEPOSIT/REDEEM USING BASE TOKENS
|
|
53
|
-
//////////////////////////////////////////////////////////////*/
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @dev See {SCYBase-_deposit}
|
|
57
|
-
*
|
|
58
|
-
* The underlying yield token is JOE (Since the amount of rewards is based on how much staked JOE inside sJOE contract). Only the base token JOE should be accepted. Then the corresponding amount of shares is returned.
|
|
59
|
-
*
|
|
60
|
-
* The exchange rate of JOE to shares is 1:1
|
|
61
|
-
|
|
62
|
-
* Each time deposit() is called, any pending rewards will be sent back to the SCY by default.
|
|
63
|
-
*/
|
|
64
|
-
function _deposit(address, uint256 amount)
|
|
65
|
-
internal
|
|
66
|
-
override
|
|
67
|
-
returns (uint256 amountSharesOut)
|
|
68
|
-
{
|
|
69
|
-
uint256 preBalanceSJoe = ISJoe(SJOE).internalJoeBalance();
|
|
70
|
-
|
|
71
|
-
ISJoe(SJOE).deposit(amount);
|
|
72
|
-
|
|
73
|
-
// Depositing JOE will incur deposit fee, hence amountSharesOut has to be calculated like this for accurate amount of SCY exchanged.
|
|
74
|
-
amountSharesOut = ISJoe(SJOE).internalJoeBalance() - preBalanceSJoe;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @dev See {SCYBase-_redeem}
|
|
79
|
-
*
|
|
80
|
-
* The shares are redeemed into the same amount of JOE Tokens. Hence `tokenOut` will only be the underlying asset (JOE) in this case. Since there will NOT be any withdrawal fee from sJOE, amountSharesToRedeem will always correspond amountTokenOut.
|
|
81
|
-
*/
|
|
82
|
-
function _redeem(address, uint256 amountSharesToRedeem)
|
|
83
|
-
internal
|
|
84
|
-
override
|
|
85
|
-
returns (uint256 amountTokenOut)
|
|
86
|
-
{
|
|
87
|
-
ISJoe(SJOE).withdraw(amountSharesToRedeem);
|
|
88
|
-
amountTokenOut = amountSharesToRedeem;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/*///////////////////////////////////////////////////////////////
|
|
92
|
-
EXCHANGE-RATE
|
|
93
|
-
//////////////////////////////////////////////////////////////*/
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @notice Exchange rate for JOE to SCY is 1:1
|
|
97
|
-
* @dev It is the exchange rate of Shares in sJOE to its underlying asset (JOE)
|
|
98
|
-
*/
|
|
99
|
-
function exchangeRate() public pure override returns (uint256) {
|
|
100
|
-
return SCYUtils.ONE;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/*///////////////////////////////////////////////////////////////
|
|
104
|
-
REWARDS-RELATED
|
|
105
|
-
//////////////////////////////////////////////////////////////*/
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @dev See {ISuperComposableYield-getRewardTokens}
|
|
109
|
-
*/
|
|
110
|
-
function _getRewardTokens() internal view override returns (address[] memory res) {
|
|
111
|
-
ISJoe SJOEContract = ISJoe(SJOE);
|
|
112
|
-
|
|
113
|
-
uint256 length = SJOEContract.rewardTokensLength();
|
|
114
|
-
|
|
115
|
-
res = new address[](length);
|
|
116
|
-
for (uint256 i = 0; i < length; ) {
|
|
117
|
-
res[i] = SJOEContract.rewardTokens(i);
|
|
118
|
-
unchecked {
|
|
119
|
-
i++;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function _redeemExternalReward() internal override {
|
|
125
|
-
// Since sJOE contract has no 'claimRewards' function, call withdraw() with a 0 amount to claim the rewards - Same as how sJOE pool is doing for their frontend.
|
|
126
|
-
ISJoe(SJOE).withdraw(0);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/*///////////////////////////////////////////////////////////////
|
|
130
|
-
MISC FUNCTIONS FOR METADATA
|
|
131
|
-
//////////////////////////////////////////////////////////////*/
|
|
132
|
-
|
|
133
|
-
function _previewDeposit(address, uint256 amountTokenToDeposit)
|
|
134
|
-
internal
|
|
135
|
-
view
|
|
136
|
-
override
|
|
137
|
-
returns (uint256 amountSharesOut)
|
|
138
|
-
{
|
|
139
|
-
uint256 sJoeDepositFeePrecision = ISJoe(SJOE).depositFeePercent();
|
|
140
|
-
|
|
141
|
-
amountSharesOut = ((1e18 - sJoeDepositFeePrecision / 1e18) * amountTokenToDeposit);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function _previewRedeem(address, uint256 amountSharesToRedeem)
|
|
145
|
-
internal
|
|
146
|
-
pure
|
|
147
|
-
override
|
|
148
|
-
returns (uint256 amountTokenOut)
|
|
149
|
-
{
|
|
150
|
-
amountTokenOut = amountSharesToRedeem;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
154
|
-
res = new address[](1);
|
|
155
|
-
res[0] = JOE;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
159
|
-
res = new address[](1);
|
|
160
|
-
res[0] = JOE;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
164
|
-
return token == JOE;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
168
|
-
return token == JOE;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function assetInfo()
|
|
172
|
-
external
|
|
173
|
-
view
|
|
174
|
-
returns (
|
|
175
|
-
AssetType assetType,
|
|
176
|
-
address assetAddress,
|
|
177
|
-
uint8 assetDecimals
|
|
178
|
-
)
|
|
179
|
-
{
|
|
180
|
-
return (AssetType.TOKEN, JOE, IERC20Metadata(JOE).decimals());
|
|
181
|
-
}
|
|
182
|
-
}
|