@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,242 +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/IQiErc20.sol";
|
|
6
|
-
import "../../../interfaces/IQiAvax.sol";
|
|
7
|
-
import "../../../interfaces/IBenQiComptroller.sol";
|
|
8
|
-
import "../../../interfaces/IWAvax.sol";
|
|
9
|
-
import "../../../interfaces/ISAvax.sol";
|
|
10
|
-
|
|
11
|
-
import "./PendleQiTokenHelper.sol";
|
|
12
|
-
|
|
13
|
-
contract PendleQiSAvaxSCY is SCYBaseWithRewards, PendleQiTokenHelper {
|
|
14
|
-
address public immutable QI;
|
|
15
|
-
address public immutable WAVAX;
|
|
16
|
-
address public immutable comptroller;
|
|
17
|
-
|
|
18
|
-
address public immutable SAVAX;
|
|
19
|
-
address public immutable QI_SAVAX;
|
|
20
|
-
|
|
21
|
-
constructor(
|
|
22
|
-
string memory _name,
|
|
23
|
-
string memory _symbol,
|
|
24
|
-
address _qiSAvax,
|
|
25
|
-
address _WAVAX,
|
|
26
|
-
uint256 _initialExchangeRateMantissa
|
|
27
|
-
)
|
|
28
|
-
SCYBaseWithRewards(_name, _symbol, _qiSAvax)
|
|
29
|
-
PendleQiTokenHelper(_qiSAvax, _initialExchangeRateMantissa)
|
|
30
|
-
{
|
|
31
|
-
require(_qiSAvax != address(0), "zero address");
|
|
32
|
-
require(_WAVAX != address(0), "zero address");
|
|
33
|
-
|
|
34
|
-
QI_SAVAX = _qiSAvax;
|
|
35
|
-
WAVAX = _WAVAX;
|
|
36
|
-
|
|
37
|
-
SAVAX = IQiErc20(QI_SAVAX).underlying();
|
|
38
|
-
comptroller = IQiToken(_qiSAvax).comptroller();
|
|
39
|
-
|
|
40
|
-
QI = IBenQiComptroller(comptroller).qiAddress();
|
|
41
|
-
|
|
42
|
-
_safeApprove(SAVAX, QI_SAVAX, type(uint256).max);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/*///////////////////////////////////////////////////////////////
|
|
46
|
-
DEPOSIT/REDEEM USING BASE TOKENS
|
|
47
|
-
//////////////////////////////////////////////////////////////*/
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @dev See {SCYBase-_deposit}
|
|
51
|
-
*
|
|
52
|
-
* The underlying yield token is qiToken (qiSAvax). Tokens allowed for deposit are sAvax, qiSAvax, AVAX, WAVAX.
|
|
53
|
-
*
|
|
54
|
-
*If the base token deposited is underlying asset, the function first convert those deposited SAvax into qiSAvax. Then the corresponding amount of shares is returned.
|
|
55
|
-
*
|
|
56
|
-
* If the base token is AVAX, it will swap to SAvax which will then be deposited to QiSAvax.
|
|
57
|
-
*
|
|
58
|
-
* If the base token is WAVAX, it will unwrap to AVAX, then swap to SAvax which will be deposited to mint QiSAvax.
|
|
59
|
-
*
|
|
60
|
-
* The exchange rate of qiToken (qiSAvax) to shares is 1:1
|
|
61
|
-
*/
|
|
62
|
-
function _deposit(address tokenIn, uint256 amountDeposited)
|
|
63
|
-
internal
|
|
64
|
-
override
|
|
65
|
-
returns (uint256 amountSharesOut)
|
|
66
|
-
{
|
|
67
|
-
if (tokenIn == QI_SAVAX) {
|
|
68
|
-
amountSharesOut = amountDeposited;
|
|
69
|
-
} else if (tokenIn == WAVAX || tokenIn == NATIVE) {
|
|
70
|
-
// If 'tokenIn' is WAVAX or NATIVE
|
|
71
|
-
if (tokenIn == WAVAX) {
|
|
72
|
-
// Unwrap WAVAX into Native Avax token first
|
|
73
|
-
IWAvax(WAVAX).withdraw(amountDeposited);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Swap AVAX for SAVAX (regardless from AVAX directly or unwrapped from WAVAX), note since exchange rate of AVAX to SAVAX is NOT 1:1, retrieve amount of SAvax received after depositing NATIVE.
|
|
77
|
-
uint256 sAvaxToMintQiSAvaxAmount = ISAvax(tokenIn).submit{ value: amountDeposited }();
|
|
78
|
-
|
|
79
|
-
// Deposit (WAVAX or NATIVE) converted sAvax into BenQi.
|
|
80
|
-
amountSharesOut = _depositUnderlyingIntoBenQi(sAvaxToMintQiSAvaxAmount);
|
|
81
|
-
} else {
|
|
82
|
-
// If token deposited is sAvax, it will directly mint qiSAvax from BenQi using amountDeposited
|
|
83
|
-
amountSharesOut = _depositUnderlyingIntoBenQi(amountDeposited);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @dev Deposits underlying token (sAvax) into BenQi and returns the amount of qiSAvax or shares (since qiSAvax : shares == 1:1).
|
|
89
|
-
*/
|
|
90
|
-
function _depositUnderlyingIntoBenQi(uint256 amountDeposited)
|
|
91
|
-
internal
|
|
92
|
-
returns (uint256 amountSharesDeposited)
|
|
93
|
-
{
|
|
94
|
-
IQiErc20 QiSAvax = IQiErc20(QI_SAVAX);
|
|
95
|
-
|
|
96
|
-
uint256 preBalanceQiSAvax = QiSAvax.balanceOf(address(this));
|
|
97
|
-
|
|
98
|
-
uint256 errCode = QiSAvax.mint(amountDeposited);
|
|
99
|
-
require(errCode == 0, "mint failed");
|
|
100
|
-
|
|
101
|
-
amountSharesDeposited = QiSAvax.balanceOf(address(this)) - preBalanceQiSAvax;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @dev See {SCYBase-_redeem}
|
|
106
|
-
*
|
|
107
|
-
* The shares are redeemed into the same amount of qiTokens (qiSAvax). If `tokenOut` is the underlying asset sAvax.
|
|
108
|
-
*
|
|
109
|
-
* Only SAvax or QiSAvax can be withdrawn.
|
|
110
|
-
*
|
|
111
|
-
* the function also redeems said asset from the corresponding amount of qiToken (qiSAvax).
|
|
112
|
-
*/
|
|
113
|
-
function _redeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
114
|
-
internal
|
|
115
|
-
override
|
|
116
|
-
returns (uint256 amountTokenOut)
|
|
117
|
-
{
|
|
118
|
-
if (tokenOut == QI_SAVAX) {
|
|
119
|
-
amountTokenOut = amountSharesToRedeem;
|
|
120
|
-
} else {
|
|
121
|
-
uint256 preBalanceUnderlying = _selfBalance(SAVAX);
|
|
122
|
-
|
|
123
|
-
uint256 errCode = IQiErc20(QI_SAVAX).redeem(amountSharesToRedeem);
|
|
124
|
-
require(errCode == 0, "redeem failed");
|
|
125
|
-
|
|
126
|
-
// Even though underlying is not rewardToken, we still manually check balance for accounting purposes.
|
|
127
|
-
amountTokenOut = _selfBalance(SAVAX) - preBalanceUnderlying;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/*///////////////////////////////////////////////////////////////
|
|
132
|
-
EXCHANGE-RATE
|
|
133
|
-
//////////////////////////////////////////////////////////////*/
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* @notice Calculates and updates the exchange rate of shares to underlying asset token
|
|
137
|
-
* @dev It is the exchange rate of qiSAvax to native Avax token, this is calculated from sAvax to QiSAvax Exchange rate and then followed by converting that exchange rate relative to native Avax exchange rate.
|
|
138
|
-
*/
|
|
139
|
-
function exchangeRate() public view override returns (uint256) {
|
|
140
|
-
uint256 qiSAvaxToSAvaxExchangeRate = _exchangeRateCurrentView();
|
|
141
|
-
return ISAvax(SAVAX).getPooledAvaxByShares(qiSAvaxToSAvaxExchangeRate);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/*///////////////////////////////////////////////////////////////
|
|
145
|
-
REWARDS-RELATED
|
|
146
|
-
//////////////////////////////////////////////////////////////*/
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* @dev See {ISuperComposableYield-getRewardTokens}
|
|
150
|
-
*/
|
|
151
|
-
function _getRewardTokens() internal view override returns (address[] memory res) {
|
|
152
|
-
res = new address[](2);
|
|
153
|
-
res[0] = QI;
|
|
154
|
-
res[1] = WAVAX;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function _redeemExternalReward() internal override {
|
|
158
|
-
address[] memory holders = new address[](1);
|
|
159
|
-
address[] memory qiTokens = new address[](1);
|
|
160
|
-
holders[0] = address(this);
|
|
161
|
-
qiTokens[0] = QI_SAVAX;
|
|
162
|
-
|
|
163
|
-
IBenQiComptroller(comptroller).claimReward(0, holders, qiTokens, false, true);
|
|
164
|
-
IBenQiComptroller(comptroller).claimReward(1, holders, qiTokens, false, true);
|
|
165
|
-
|
|
166
|
-
if (address(this).balance != 0) IWAvax(WAVAX).deposit{ value: address(this).balance };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/*///////////////////////////////////////////////////////////////
|
|
170
|
-
MISC FUNCTIONS FOR METADATA
|
|
171
|
-
//////////////////////////////////////////////////////////////*/
|
|
172
|
-
|
|
173
|
-
/*
|
|
174
|
-
* @dev 'tokenIn' accepted for deposit are NATIVE, WAVAX, SAVAX and QiSAVAX.
|
|
175
|
-
*/
|
|
176
|
-
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
177
|
-
internal
|
|
178
|
-
view
|
|
179
|
-
override
|
|
180
|
-
returns (uint256 amountSharesOut)
|
|
181
|
-
{
|
|
182
|
-
if (tokenIn == QI_SAVAX) {
|
|
183
|
-
amountSharesOut = amountTokenToDeposit;
|
|
184
|
-
} else if (tokenIn == SAVAX) {
|
|
185
|
-
amountSharesOut = (amountTokenToDeposit * 1e18) / _exchangeRateCurrentView();
|
|
186
|
-
} else {
|
|
187
|
-
// NATIVE or WAVAX - use exchange rate from qiSAvax to underlying asset.
|
|
188
|
-
amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/*
|
|
193
|
-
* @dev 'tokenOut' accepted for deposit are SAVAX and QiSAVAX.
|
|
194
|
-
*/
|
|
195
|
-
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
196
|
-
internal
|
|
197
|
-
view
|
|
198
|
-
override
|
|
199
|
-
returns (uint256 amountTokenOut)
|
|
200
|
-
{
|
|
201
|
-
if (tokenOut == QI_SAVAX) {
|
|
202
|
-
amountTokenOut = amountSharesToRedeem;
|
|
203
|
-
} else {
|
|
204
|
-
// if 'tokenOut' == SAVAX
|
|
205
|
-
amountTokenOut = (amountSharesToRedeem * _exchangeRateCurrentView()) / 1e18;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
210
|
-
res = new address[](2);
|
|
211
|
-
res[0] = QI_SAVAX;
|
|
212
|
-
res[1] = SAVAX;
|
|
213
|
-
res[2] = WAVAX;
|
|
214
|
-
res[4] = NATIVE;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
218
|
-
res = new address[](2);
|
|
219
|
-
res[0] = QI_SAVAX;
|
|
220
|
-
res[1] = SAVAX;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
224
|
-
return token == QI_SAVAX || token == SAVAX || token == WAVAX || token == NATIVE;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
228
|
-
return token == QI_SAVAX || token == SAVAX;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function assetInfo()
|
|
232
|
-
external
|
|
233
|
-
pure
|
|
234
|
-
returns (
|
|
235
|
-
AssetType assetType,
|
|
236
|
-
address assetAddress,
|
|
237
|
-
uint8 assetDecimals
|
|
238
|
-
)
|
|
239
|
-
{
|
|
240
|
-
return (AssetType.TOKEN, NATIVE, 18);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
@@ -1,146 +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/ISAvax.sol";
|
|
6
|
-
import "../../../interfaces/IWAvax.sol";
|
|
7
|
-
|
|
8
|
-
// BENQI Stake AVAX (sAVAX) -> 0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE
|
|
9
|
-
|
|
10
|
-
// Exchange rate of sAVAX -> AVAX increases over time, no additional rewards but has a 15day lock-up period with 2 day redemption period.
|
|
11
|
-
// Yield Token -> sAVAX (Interest Bearing)
|
|
12
|
-
|
|
13
|
-
contract PendleSAvaxSCY is SCYBase {
|
|
14
|
-
address public immutable SAVAX;
|
|
15
|
-
address public immutable WAVAX;
|
|
16
|
-
|
|
17
|
-
uint256 private constant BASE = 1e18;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
string memory _name,
|
|
21
|
-
string memory _symbol,
|
|
22
|
-
address _sAvax,
|
|
23
|
-
address _wAvax
|
|
24
|
-
) SCYBase(_name, _symbol, _sAvax) {
|
|
25
|
-
require(_sAvax != address(0), "zero address");
|
|
26
|
-
require(_wAvax != address(0), "zero address");
|
|
27
|
-
SAVAX = _sAvax;
|
|
28
|
-
WAVAX = _wAvax;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/*///////////////////////////////////////////////////////////////
|
|
32
|
-
DEPOSIT/REDEEM USING BASE TOKENS
|
|
33
|
-
//////////////////////////////////////////////////////////////*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @dev See {SCYBase-_deposit}
|
|
37
|
-
*
|
|
38
|
-
* The underlying yield token is sAvax. Tokens accepted for deposit are NATIVE, WAVAX, and sAVAX.
|
|
39
|
-
*
|
|
40
|
-
*If the base token deposited is native AVAX, the function converts it into sAVAX first. Then the corresponding amount of shares is returned.
|
|
41
|
-
*
|
|
42
|
-
* If WAVAX is deposited, it will first unwrap to native AVAX and then convert into sAVAX.
|
|
43
|
-
*
|
|
44
|
-
* The exchange rate of sAVAX to shares is 1:1
|
|
45
|
-
*/
|
|
46
|
-
function _deposit(address tokenIn, uint256 amountDeposited)
|
|
47
|
-
internal
|
|
48
|
-
virtual
|
|
49
|
-
override
|
|
50
|
-
returns (uint256 amountSharesOut)
|
|
51
|
-
{
|
|
52
|
-
// Comments: No check for address token IN (need to be implemented in higher level function)
|
|
53
|
-
if (tokenIn == SAVAX) {
|
|
54
|
-
amountSharesOut = amountDeposited;
|
|
55
|
-
} else {
|
|
56
|
-
// Handle WAVAX or NATIVE Avax - If WAVAX need to unwrap to NATIVE Avax first then deposit.
|
|
57
|
-
if (tokenIn == WAVAX) {
|
|
58
|
-
IWAvax(WAVAX).withdraw(amountDeposited);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
amountSharesOut = ISAvax(tokenIn).submit{ value: amountDeposited }();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @dev See {SCYBase-_redeem}
|
|
67
|
-
*
|
|
68
|
-
* The shares are redeemed into the same amount of sAVAX. `tokenOut` will only be in sAVAX where exchange rate will be 1:1 to SCY.
|
|
69
|
-
*/
|
|
70
|
-
function _redeem(address, uint256 amountSharesToRedeem)
|
|
71
|
-
internal
|
|
72
|
-
virtual
|
|
73
|
-
override
|
|
74
|
-
returns (uint256 amountTokenOut)
|
|
75
|
-
{
|
|
76
|
-
amountTokenOut = amountSharesToRedeem;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/*///////////////////////////////////////////////////////////////
|
|
80
|
-
EXCHANGE-RATE
|
|
81
|
-
//////////////////////////////////////////////////////////////*/
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @notice Calculates and updates the exchange rate of shares to underlying asset token
|
|
85
|
-
* @dev It is the exchange rate of sAVAX to AVAX.
|
|
86
|
-
*/
|
|
87
|
-
function exchangeRate() public view virtual override returns (uint256 currentRate) {
|
|
88
|
-
return ISAvax(SAVAX).getPooledAvaxByShares(BASE);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/*///////////////////////////////////////////////////////////////
|
|
92
|
-
MISC FUNCTIONS FOR METADATA
|
|
93
|
-
//////////////////////////////////////////////////////////////*/
|
|
94
|
-
|
|
95
|
-
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
96
|
-
internal
|
|
97
|
-
view
|
|
98
|
-
override
|
|
99
|
-
returns (uint256 amountSharesOut)
|
|
100
|
-
{
|
|
101
|
-
if (tokenIn == SAVAX) amountSharesOut = amountTokenToDeposit;
|
|
102
|
-
else amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function _previewRedeem(address, uint256 amountSharesToRedeem)
|
|
106
|
-
internal
|
|
107
|
-
view
|
|
108
|
-
override
|
|
109
|
-
returns (uint256 amountTokenOut)
|
|
110
|
-
{
|
|
111
|
-
// Since only SAvax can be redeemed
|
|
112
|
-
amountTokenOut = amountSharesToRedeem;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
116
|
-
res = new address[](3);
|
|
117
|
-
res[0] = NATIVE;
|
|
118
|
-
res[1] = SAVAX;
|
|
119
|
-
res[2] = WAVAX;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
123
|
-
res = new address[](1);
|
|
124
|
-
res[0] = SAVAX;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
128
|
-
return (token == NATIVE || token == SAVAX || token == WAVAX);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
132
|
-
return token == SAVAX;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function assetInfo()
|
|
136
|
-
external
|
|
137
|
-
pure
|
|
138
|
-
returns (
|
|
139
|
-
AssetType assetType,
|
|
140
|
-
address assetAddress,
|
|
141
|
-
uint8 assetDecimals
|
|
142
|
-
)
|
|
143
|
-
{
|
|
144
|
-
return (AssetType.TOKEN, NATIVE, 18);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
@@ -1,176 +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/IEulerEToken.sol";
|
|
5
|
-
import "../../../interfaces/IEulerMarkets.sol";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
Euler Finance (Money Markets) - Permissionless Lending/Borrowing Protocol for any ERC20 tokens (Built on top of Uniswap v3 oracle protocol which faciliates people to active their own markets and manage their own lending and borrowing facilities)
|
|
9
|
-
|
|
10
|
-
External Rewards (EUL distribution) are only applicable for borrowers, hence no external rewards for SCY to deal with since only only lending feature is used.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
contract PendleEulerSCY is SCYBase {
|
|
14
|
-
address public immutable underlying;
|
|
15
|
-
address public immutable eToken;
|
|
16
|
-
|
|
17
|
-
constructor(
|
|
18
|
-
string memory _name,
|
|
19
|
-
string memory _symbol,
|
|
20
|
-
address _eToken,
|
|
21
|
-
address _eulerMarkets, // pass eulerMarkets to double check both eToken & underlying
|
|
22
|
-
address _euler // need to approve spending by euler
|
|
23
|
-
) SCYBase(_name, _symbol, _eToken) {
|
|
24
|
-
require(_eToken != address(0), "zero address");
|
|
25
|
-
require(_eulerMarkets != address(0), "zero address");
|
|
26
|
-
|
|
27
|
-
eToken = _eToken;
|
|
28
|
-
|
|
29
|
-
underlying = IEulerMarkets(_eulerMarkets).eTokenToUnderlying(eToken);
|
|
30
|
-
|
|
31
|
-
_safeApprove(underlying, _euler, type(uint256).max);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/*///////////////////////////////////////////////////////////////
|
|
35
|
-
DEPOSIT/REDEEM USING BASE TOKENS
|
|
36
|
-
//////////////////////////////////////////////////////////////*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @dev See {SCYBase-_deposit}
|
|
40
|
-
*
|
|
41
|
-
* The underlying yield token is underlying ETokens. Tokens accepted are EToken or the underlying base token.
|
|
42
|
-
*
|
|
43
|
-
*If underlying ETokens are deposited directly, they are swapped to shares 1:1
|
|
44
|
-
*
|
|
45
|
-
* If underlying base tokens are deposited, SCY contract will deposit into the lending pool and swap shares based on amount of eTokens minted.
|
|
46
|
-
*
|
|
47
|
-
* The exchange rate of EToken to shares is 1:1
|
|
48
|
-
*/
|
|
49
|
-
function _deposit(address tokenIn, uint256 amountDeposited)
|
|
50
|
-
internal
|
|
51
|
-
virtual
|
|
52
|
-
override
|
|
53
|
-
returns (uint256 amountSharesOut)
|
|
54
|
-
{
|
|
55
|
-
if (tokenIn == eToken) {
|
|
56
|
-
amountSharesOut = amountDeposited;
|
|
57
|
-
} else {
|
|
58
|
-
uint256 preBalanceEToken = _selfBalance(eToken);
|
|
59
|
-
|
|
60
|
-
// Deposit underlying tokens to convert into eTokens
|
|
61
|
-
IEulerEToken(eToken).deposit(0, amountDeposited);
|
|
62
|
-
|
|
63
|
-
// Since 'deposit' function doesn't return the amount of eTokens minted, calculate change in EToken balance to find the amount of shares out
|
|
64
|
-
amountSharesOut = _selfBalance(eToken) - preBalanceEToken;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @dev See {SCYBase-_redeem}
|
|
70
|
-
*
|
|
71
|
-
* The shares are redeemed into the same amount of underlying eTokens.
|
|
72
|
-
*
|
|
73
|
-
If `tokenOut` is underlying base Token, the function also swaps back eTokens to underlying base tokens from the lending Pool based on the prevailing exchange rate.
|
|
74
|
-
*
|
|
75
|
-
* The exchange rate of shares to EToken is 1:1
|
|
76
|
-
*/
|
|
77
|
-
function _redeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
78
|
-
internal
|
|
79
|
-
virtual
|
|
80
|
-
override
|
|
81
|
-
returns (uint256 amountTokenOut)
|
|
82
|
-
{
|
|
83
|
-
if (tokenOut == eToken) {
|
|
84
|
-
amountTokenOut = amountSharesToRedeem;
|
|
85
|
-
} else {
|
|
86
|
-
// 'tokenOut' is underlying base token
|
|
87
|
-
uint256 preBalanceUnderlying = _selfBalance(underlying);
|
|
88
|
-
|
|
89
|
-
// Swap EToken for underlying base tokens
|
|
90
|
-
IEulerEToken(eToken).withdraw(
|
|
91
|
-
0,
|
|
92
|
-
IEulerEToken(eToken).convertBalanceToUnderlying(amountSharesToRedeem)
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
// Since 'withdraw' function doesn't return the amount of underlying tokens swapped from eTokens, calculate change in underlying balance to find the amount of shares out
|
|
96
|
-
amountTokenOut = _selfBalance(underlying) - preBalanceUnderlying;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/*///////////////////////////////////////////////////////////////
|
|
101
|
-
EXCHANGE-RATE
|
|
102
|
-
//////////////////////////////////////////////////////////////*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @notice Calculates and updates the exchange rate of shares to underlying base token
|
|
106
|
-
* @dev It is the exchange rate of underlying EToken (since EToken to shares is 1:1) to underlying Base Token.
|
|
107
|
-
*/
|
|
108
|
-
function exchangeRate() public view virtual override returns (uint256 currentRate) {
|
|
109
|
-
return IEulerEToken(eToken).convertBalanceToUnderlying(1e18);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/*///////////////////////////////////////////////////////////////
|
|
113
|
-
MISC FUNCTIONS FOR METADATA
|
|
114
|
-
//////////////////////////////////////////////////////////////*/
|
|
115
|
-
|
|
116
|
-
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
117
|
-
internal
|
|
118
|
-
view
|
|
119
|
-
override
|
|
120
|
-
returns (uint256 amountSharesOut)
|
|
121
|
-
{
|
|
122
|
-
if (tokenIn == eToken) {
|
|
123
|
-
amountSharesOut = amountTokenToDeposit;
|
|
124
|
-
} else {
|
|
125
|
-
amountSharesOut = IEulerEToken(eToken).convertUnderlyingToBalance(
|
|
126
|
-
amountTokenToDeposit
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
132
|
-
internal
|
|
133
|
-
view
|
|
134
|
-
override
|
|
135
|
-
returns (uint256 amountTokenOut)
|
|
136
|
-
{
|
|
137
|
-
if (tokenOut == eToken) {
|
|
138
|
-
amountTokenOut = amountSharesToRedeem;
|
|
139
|
-
} else {
|
|
140
|
-
amountTokenOut = IEulerEToken(eToken).convertBalanceToUnderlying(amountSharesToRedeem);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
145
|
-
res = new address[](2);
|
|
146
|
-
res[0] = underlying;
|
|
147
|
-
res[1] = eToken;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
151
|
-
res = new address[](2);
|
|
152
|
-
res[0] = underlying;
|
|
153
|
-
res[1] = eToken;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
157
|
-
return token == underlying || token == eToken;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
161
|
-
return token == underlying || token == eToken;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function assetInfo()
|
|
165
|
-
external
|
|
166
|
-
view
|
|
167
|
-
returns (
|
|
168
|
-
AssetType assetType,
|
|
169
|
-
address assetAddress,
|
|
170
|
-
uint8 assetDecimals
|
|
171
|
-
)
|
|
172
|
-
{
|
|
173
|
-
// All underlying asset tokens are of ERC20 standard
|
|
174
|
-
return (AssetType.TOKEN, underlying, IERC20Metadata(underlying).decimals());
|
|
175
|
-
}
|
|
176
|
-
}
|