@pendle/core-v2 0.8.0-beta-12 → 0.8.1-gamma
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/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +39 -7
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +833 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- 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 +39 -7
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +723 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +723 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +38 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.json +864 -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 +56 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.json +38 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +784 -0
- 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 +36 -4
- 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 +36 -4
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +242 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerSidechain.sol → PendleGaugeControllerSidechainUpg.sol}/PendleGaugeControllerSidechainUpg.json +3 -3
- 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 +46 -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 +0 -13
- 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 +66 -4
- 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 +26 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +24 -0
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +2 -2
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -77
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +21 -96
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +2 -2
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- 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/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 +4 -0
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.json +162 -0
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.json +87 -0
- package/build/artifacts/contracts/interfaces/IJoePair.sol/IJoePair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter01.sol/IJoeRouter01.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.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/IPInterestManagerYT.sol/IPInterestManagerYT.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- 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/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +38 -23
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +24 -0
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
- 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/IPYieldToken.sol/IPYieldToken.json +27 -27
- 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/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.json +199 -0
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.json +168 -0
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.json +92 -0
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.json +137 -0
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.json +135 -0
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.json +63 -0
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +36 -4
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.json +252 -0
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.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/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/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/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 +4 -0
- package/build/artifacts/contracts/libraries/{SCY/SCYIndex.sol/SCYIndexLib.json → helpers/PYIndex.sol/PYIndexLib.json} +4 -4
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.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/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +209 -41
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +13 -3
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +242 -0
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +14 -10
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +146 -0
- package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +170 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +12 -2
- package/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol +194 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +41 -10
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +12 -8
- package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +184 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +10 -12
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +1 -2
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +20 -10
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +3 -1
- package/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerMainchain.sol → PendleGaugeControllerMainchainUpg.sol} +0 -0
- package/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerSidechain.sol → PendleGaugeControllerSidechainUpg.sol} +0 -0
- package/contracts/core/LiquidityMining/PendleGauge.sol +3 -2
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +41 -29
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +4 -10
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +33 -16
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +2 -4
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +5 -1
- package/contracts/core/Market/PendleMarket.sol +4 -5
- package/contracts/core/Market/PendleMarketFactory.sol +2 -1
- package/contracts/core/PendleERC20.sol +1 -1
- package/contracts/core/YieldContracts/InterestManagerYT.sol +0 -2
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +2 -2
- package/contracts/core/YieldContracts/PendleYieldToken.sol +24 -32
- package/contracts/core/actions/ActionCallback.sol +10 -8
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +10 -9
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +5 -4
- package/contracts/core/actions/base/CallbackHelper.sol +1 -1
- package/contracts/interfaces/IEulerEToken.sol +60 -0
- package/contracts/interfaces/IEulerMarkets.sol +46 -0
- package/contracts/interfaces/IPGaugeController.sol +1 -1
- package/contracts/interfaces/IPInterestManagerYT.sol +1 -1
- package/contracts/interfaces/IPMarket.sol +1 -0
- package/contracts/interfaces/IPRouterStatic.sol +17 -10
- package/contracts/interfaces/IPVeToken.sol +2 -0
- package/contracts/interfaces/IPYieldToken.sol +2 -2
- package/contracts/interfaces/ISAvax.sol +61 -0
- package/contracts/interfaces/ISJoe.sol +60 -0
- package/contracts/interfaces/IStETH.sol +14 -0
- package/contracts/interfaces/IStargateLPStaking.sol +47 -0
- package/contracts/interfaces/IStargatePool.sol +49 -0
- package/contracts/interfaces/IStargateRouter.sol +37 -0
- package/contracts/interfaces/ISuperComposableYield.sol +6 -9
- package/contracts/interfaces/IWAvax.sol +34 -0
- package/contracts/libraries/RewardManager.sol +2 -3
- package/contracts/libraries/RewardManagerAbstract.sol +1 -0
- package/contracts/libraries/VeBalanceLib.sol +13 -0
- package/contracts/libraries/helpers/ArrayLib.sol +0 -17
- package/contracts/libraries/helpers/PYIndex.sol +69 -0
- package/contracts/libraries/helpers/TokenHelper.sol +4 -2
- package/contracts/libraries/math/LogExpMath.sol +46 -44
- package/contracts/libraries/math/MarketApproxLib.sol +10 -12
- package/contracts/libraries/math/MarketMathCore.sol +24 -15
- package/contracts/libraries/math/Math.sol +14 -0
- package/contracts/offchain-helpers/RouterStatic.sol +177 -66
- package/deployments/43113-benqi.json +2 -2
- package/deployments/43113-core.json +7 -7
- package/deployments/43113-markets/benqi-market-599408.json +7 -0
- package/deployments/43113-markets/benqi-market-93bbf0.json +7 -0
- package/deployments/80001-benqi.json +2 -2
- package/deployments/80001-core.json +6 -6
- package/deployments/80001-markets/benqi-market-007811.json +7 -0
- package/deployments/80001-markets/benqi-market-3fe528.json +7 -0
- package/package.json +3 -3
- package/typechain-types/CelerSenderUpg.ts +16 -16
- package/typechain-types/IERC20Upgradeable.ts +300 -0
- package/typechain-types/IEulerEToken.ts +320 -0
- package/typechain-types/IEulerMarkets.ts +204 -0
- package/typechain-types/IPInterestManagerYT.ts +3 -3
- package/typechain-types/IPRouterStatic.ts +75 -97
- package/typechain-types/IPVeToken.ts +34 -0
- package/typechain-types/IPYieldToken.ts +47 -47
- package/typechain-types/ISAvax.ts +430 -0
- package/typechain-types/ISJoe.ts +340 -0
- package/typechain-types/IStETH.ts +201 -0
- package/typechain-types/IStargateLPStaking.ts +108 -0
- package/typechain-types/IStargatePool.ts +94 -0
- package/typechain-types/ISuperComposableYield.ts +72 -26
- package/typechain-types/IWAvax.ts +380 -0
- package/typechain-types/PendleAaveV3SCY.ts +74 -28
- package/typechain-types/PendleERC4626SCY.ts +73 -27
- package/typechain-types/PendleEulerSCY.ts +965 -0
- package/typechain-types/PendlePrincipalToken.ts +0 -104
- package/typechain-types/PendleQiSAvaxSCY.ts +1098 -0
- package/typechain-types/PendleQiTokenSCY.ts +74 -28
- package/typechain-types/PendleSAvaxSCY.ts +962 -0
- package/typechain-types/PendleSJoeSCY.ts +1053 -0
- package/typechain-types/PendleStargatePool.ts +73 -27
- package/typechain-types/PendleStargateSCY.ts +1135 -0
- package/typechain-types/PendleVotingControllerUpg.ts +88 -75
- package/typechain-types/PendleWstEthSCY.ts +86 -27
- package/typechain-types/PendleYearnVaultScy.ts +73 -27
- package/typechain-types/PendleYieldToken.ts +44 -148
- package/typechain-types/RouterStatic.ts +327 -253
- package/typechain-types/SCYBase.ts +73 -27
- package/typechain-types/SCYBaseWithRewards.ts +73 -27
- package/typechain-types/VotingControllerStorageUpg.ts +0 -21
- package/typechain-types/VotingEscrowPendleMainchain.ts +118 -16
- package/typechain-types/VotingEscrowPendleSidechain.ts +34 -0
- package/typechain-types/VotingEscrowTokenBase.ts +34 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +1 -1
- package/typechain-types/factories/ActionYT__factory.ts +1 -1
- package/typechain-types/factories/CelerSenderUpg__factory.ts +2 -2
- package/typechain-types/factories/IERC20Upgradeable__factory.ts +209 -0
- package/typechain-types/factories/IEulerEToken__factory.ts +174 -0
- package/typechain-types/factories/IEulerMarkets__factory.ts +99 -0
- package/typechain-types/factories/IPInterestManagerYT__factory.ts +1 -1
- package/typechain-types/factories/IPRouterStatic__factory.ts +38 -23
- package/typechain-types/factories/IPVeToken__factory.ts +24 -0
- package/typechain-types/factories/IPYieldToken__factory.ts +27 -27
- package/typechain-types/factories/ISAvax__factory.ts +208 -0
- package/typechain-types/factories/ISJoe__factory.ts +177 -0
- package/typechain-types/factories/IStETH__factory.ts +101 -0
- package/typechain-types/factories/IStargateLPStaking__factory.ts +90 -0
- package/typechain-types/factories/IStargatePool__factory.ts +79 -0
- package/typechain-types/factories/ISuperComposableYield__factory.ts +36 -4
- package/typechain-types/factories/IWAvax__factory.ts +261 -0
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +38 -6
- package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20__factory.ts +1 -1
- package/typechain-types/factories/PendleERC4626SCY__factory.ts +37 -5
- package/typechain-types/factories/PendleEulerSCY__factory.ts +796 -0
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -76
- package/typechain-types/factories/PendleQiSAvaxSCY__factory.ts +917 -0
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +38 -6
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleSAvaxSCY__factory.ts +796 -0
- package/typechain-types/factories/PendleSJoeSCY__factory.ts +845 -0
- package/typechain-types/factories/PendleStargatePool__factory.ts +37 -5
- package/typechain-types/factories/PendleStargateSCY__factory.ts +952 -0
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +44 -38
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +65 -6
- package/typechain-types/factories/PendleYearnVaultScy__factory.ts +37 -5
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +19 -94
- package/typechain-types/factories/RouterStatic__factory.ts +208 -40
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +36 -4
- package/typechain-types/factories/SCYBase__factory.ts +36 -4
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +0 -13
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +65 -3
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +25 -1
- package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +24 -0
- package/typechain-types/hardhat.d.ts +103 -13
- package/typechain-types/index.ts +24 -4
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.json +0 -242
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +0 -329
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +0 -4
- package/contracts/core/PendleERC20Permit.sol +0 -84
- package/contracts/libraries/SCY/SCYIndex.sol +0 -72
- package/deployments/43113-markets/benqi-market-5C60ba.json +0 -7
- package/deployments/43113-markets/benqi-market-611eA3.json +0 -7
- package/deployments/43113-markets/benqi-market-A386eA.json +0 -7
- package/deployments/43113-markets/benqi-market-bf8841.json +0 -7
- package/deployments/80001-markets/benqi-market-5E1104.json +0 -7
- package/deployments/80001-markets/benqi-market-899134.json +0 -7
- package/deployments/80001-markets/benqi-market-94C86f.json +0 -7
- package/deployments/80001-markets/benqi-market-c68429.json +0 -7
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
// I dont think we need safecast for a trusted call like this
|
|
30
|
+
stgRouterPoolId = uint16(IStargatePool(_stgPool).poolId());
|
|
31
|
+
|
|
32
|
+
stgStakingLP = _stgStakingLP;
|
|
33
|
+
pid = _pid;
|
|
34
|
+
|
|
35
|
+
stgPool = _stgPool;
|
|
36
|
+
stgToken = IStargateLPStaking(_stgStakingLP).stargate();
|
|
37
|
+
underlying = IStargatePool(stgPool).token();
|
|
38
|
+
|
|
39
|
+
// verify _pid
|
|
40
|
+
require(
|
|
41
|
+
IStargateLPStaking(_stgStakingLP).poolInfo(_pid).lpToken == _stgPool,
|
|
42
|
+
"invalid pid"
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
_safeApprove(underlying, _stgRouter, type(uint256).max);
|
|
46
|
+
// There is not a need to approve LP for router since stargate uses direct burn
|
|
47
|
+
// _safeApprove(stgPool, _stgRouter, type(uint256).max);
|
|
48
|
+
_safeApprove(stgPool, _stgStakingLP, 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 stargateLP. If the base token deposited is underlying, the function addLiquidity
|
|
59
|
+
* using stargateRouter first. Then the amount of LP out will be taken into calculation.
|
|
60
|
+
*
|
|
61
|
+
* The exchange rate of stargateLP to shares is 1:1
|
|
62
|
+
*/
|
|
63
|
+
function _deposit(address tokenIn, uint256 amountDeposited)
|
|
64
|
+
internal
|
|
65
|
+
virtual
|
|
66
|
+
override
|
|
67
|
+
returns (uint256 amountSharesOut)
|
|
68
|
+
{
|
|
69
|
+
if (tokenIn == stgPool) {
|
|
70
|
+
amountSharesOut = amountDeposited;
|
|
71
|
+
} else {
|
|
72
|
+
uint256 preBalanceStgPool = _selfBalance(stgPool);
|
|
73
|
+
IStargateRouter(stgRouter).addLiquidity(
|
|
74
|
+
stgRouterPoolId,
|
|
75
|
+
amountDeposited,
|
|
76
|
+
address(this)
|
|
77
|
+
);
|
|
78
|
+
amountSharesOut = _selfBalance(stgPool) - preBalanceStgPool;
|
|
79
|
+
}
|
|
80
|
+
IStargateLPStaking(stgStakingLP).deposit(pid, amountSharesOut);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @dev See {SCYBase-_redeem}
|
|
85
|
+
*
|
|
86
|
+
* The staked tokens are firstly withdraw from staking
|
|
87
|
+
*
|
|
88
|
+
* The shares are redeemed into underlying using router if necessary.
|
|
89
|
+
*/
|
|
90
|
+
function _redeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
91
|
+
internal
|
|
92
|
+
virtual
|
|
93
|
+
override
|
|
94
|
+
returns (uint256 amountTokenOut)
|
|
95
|
+
{
|
|
96
|
+
IStargateLPStaking(stgStakingLP).withdraw(pid, amountSharesToRedeem);
|
|
97
|
+
if (tokenOut == stgPool) {
|
|
98
|
+
amountTokenOut = amountSharesToRedeem;
|
|
99
|
+
} else {
|
|
100
|
+
uint256 preBalanceStgLp = IERC20(stgPool).balanceOf(address(this));
|
|
101
|
+
amountTokenOut = IStargateRouter(stgRouter).instantRedeemLocal(
|
|
102
|
+
stgRouterPoolId,
|
|
103
|
+
amountSharesToRedeem,
|
|
104
|
+
address(this)
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
uint256 amountLpUsed = preBalanceStgLp - IERC20(stgPool).balanceOf(address(this));
|
|
108
|
+
|
|
109
|
+
// Since stargate is a bridge, sometime there might not be enough fund in the pool to redeem
|
|
110
|
+
// In this case, stargate contract doesn't revert
|
|
111
|
+
require(amountLpUsed == amountSharesToRedeem, "insufficient fund to redeem");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/*///////////////////////////////////////////////////////////////
|
|
116
|
+
EXCHANGE-RATE
|
|
117
|
+
//////////////////////////////////////////////////////////////*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @notice Calculates and updates the exchange rate of shares to underlying asset token
|
|
121
|
+
* @dev It is the exchange rate of stgPool to underlying
|
|
122
|
+
*/
|
|
123
|
+
function exchangeRate() public view virtual override returns (uint256 currentRate) {
|
|
124
|
+
return IStargatePool(stgPool).amountLPtoLD(SCYUtils.ONE);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/*///////////////////////////////////////////////////////////////
|
|
128
|
+
MISC FUNCTIONS FOR METADATA
|
|
129
|
+
//////////////////////////////////////////////////////////////*/
|
|
130
|
+
|
|
131
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
132
|
+
res = new address[](2);
|
|
133
|
+
res[0] = stgPool;
|
|
134
|
+
res[1] = underlying;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
138
|
+
res = new address[](2);
|
|
139
|
+
res[0] = stgPool;
|
|
140
|
+
res[1] = underlying;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
144
|
+
return token == stgPool || token == underlying;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
148
|
+
return token == stgPool || token == underlying;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
152
|
+
internal
|
|
153
|
+
view
|
|
154
|
+
override
|
|
155
|
+
returns (uint256 amountSharesOut)
|
|
156
|
+
{
|
|
157
|
+
if (tokenIn == stgPool) amountSharesOut = amountTokenToDeposit;
|
|
158
|
+
else amountSharesOut = (amountTokenToDeposit * SCYUtils.ONE) / exchangeRate();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
162
|
+
internal
|
|
163
|
+
view
|
|
164
|
+
override
|
|
165
|
+
returns (uint256 amountTokenOut)
|
|
166
|
+
{
|
|
167
|
+
if (tokenOut == stgPool) amountTokenOut = amountSharesToRedeem;
|
|
168
|
+
else amountTokenOut = (amountSharesToRedeem * exchangeRate()) / SCYUtils.ONE;
|
|
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, stgPool, IERC20Metadata(stgPool).decimals());
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function _redeemExternalReward() internal override {
|
|
184
|
+
IStargateLPStaking(stgStakingLP).withdraw(pid, 0);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @dev See {ISuperComposableYield-getRewardTokens}
|
|
189
|
+
*/
|
|
190
|
+
function _getRewardTokens() internal view override returns (address[] memory res) {
|
|
191
|
+
res = new address[](1);
|
|
192
|
+
res[0] = stgToken;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -2,16 +2,21 @@
|
|
|
2
2
|
pragma solidity 0.8.15;
|
|
3
3
|
import "../base-implementations/SCYBase.sol";
|
|
4
4
|
import "../../interfaces/IWstETH.sol";
|
|
5
|
+
import "../../interfaces/IWETH.sol";
|
|
6
|
+
import "../../interfaces/IStETH.sol";
|
|
5
7
|
|
|
6
8
|
contract PendleWstEthSCY is SCYBase {
|
|
9
|
+
address public immutable wETH;
|
|
7
10
|
address public immutable stETH;
|
|
8
11
|
address public immutable wstETH;
|
|
9
12
|
|
|
10
13
|
constructor(
|
|
11
14
|
string memory _name,
|
|
12
15
|
string memory _symbol,
|
|
16
|
+
address _wETH,
|
|
13
17
|
address _wstETH
|
|
14
18
|
) SCYBase(_name, _symbol, _wstETH) {
|
|
19
|
+
wETH = _wETH;
|
|
15
20
|
wstETH = _wstETH;
|
|
16
21
|
stETH = IWstETH(wstETH).stETH();
|
|
17
22
|
_safeApprove(stETH, wstETH, type(uint256).max);
|
|
@@ -38,7 +43,18 @@ contract PendleWstEthSCY is SCYBase {
|
|
|
38
43
|
if (tokenIn == wstETH) {
|
|
39
44
|
amountSharesOut = amountDeposited;
|
|
40
45
|
} else {
|
|
41
|
-
|
|
46
|
+
uint256 amountStETH;
|
|
47
|
+
if (tokenIn == stETH) {
|
|
48
|
+
amountStETH = amountDeposited;
|
|
49
|
+
} else {
|
|
50
|
+
uint256 stETHBalanceBefore = _selfBalance(stETH);
|
|
51
|
+
if (tokenIn == wETH) {
|
|
52
|
+
IWETH(wETH).withdraw(amountDeposited);
|
|
53
|
+
}
|
|
54
|
+
IStETH(stETH).submit{ value: amountDeposited }(address(0));
|
|
55
|
+
amountStETH = _selfBalance(stETH) - stETHBalanceBefore;
|
|
56
|
+
}
|
|
57
|
+
amountSharesOut = IWstETH(wstETH).wrap(amountStETH);
|
|
42
58
|
}
|
|
43
59
|
}
|
|
44
60
|
|
|
@@ -84,7 +100,15 @@ contract PendleWstEthSCY is SCYBase {
|
|
|
84
100
|
returns (uint256 amountSharesOut)
|
|
85
101
|
{
|
|
86
102
|
if (tokenIn == wstETH) amountSharesOut = amountTokenToDeposit;
|
|
87
|
-
else
|
|
103
|
+
else {
|
|
104
|
+
uint256 amountStETH;
|
|
105
|
+
if (tokenIn == stETH) {
|
|
106
|
+
amountStETH = amountTokenToDeposit;
|
|
107
|
+
} else {
|
|
108
|
+
amountStETH = IStETH(stETH).getSharesByPooledEth(amountTokenToDeposit);
|
|
109
|
+
}
|
|
110
|
+
amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
|
|
111
|
+
}
|
|
88
112
|
}
|
|
89
113
|
|
|
90
114
|
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
@@ -97,19 +121,26 @@ contract PendleWstEthSCY is SCYBase {
|
|
|
97
121
|
else amountTokenOut = (amountSharesToRedeem * exchangeRate()) / 1e18;
|
|
98
122
|
}
|
|
99
123
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
124
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
125
|
+
res = new address[](4);
|
|
126
|
+
res[0] = NATIVE;
|
|
127
|
+
res[1] = wETH;
|
|
128
|
+
res[2] = stETH;
|
|
129
|
+
res[3] = wstETH;
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
104
134
|
res = new address[](2);
|
|
105
135
|
res[0] = stETH;
|
|
106
136
|
res[1] = wstETH;
|
|
107
137
|
}
|
|
108
138
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
139
|
+
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
140
|
+
return token == stETH || token == wstETH || token == NATIVE || token == wETH;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
113
144
|
return token == stETH || token == wstETH;
|
|
114
145
|
}
|
|
115
146
|
|
|
@@ -121,19 +121,23 @@ contract PendleYearnVaultSCY is SCYBase {
|
|
|
121
121
|
else amountTokenOut = (amountSharesToRedeem * exchangeRate()) / 1e18;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
* @dev See {ISuperComposableYield-getBaseTokens}
|
|
126
|
-
*/
|
|
127
|
-
function getBaseTokens() public view virtual override returns (address[] memory res) {
|
|
124
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
128
125
|
res = new address[](2);
|
|
129
126
|
res[0] = underlying;
|
|
130
127
|
res[1] = yvToken;
|
|
131
128
|
}
|
|
132
129
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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) {
|
|
137
141
|
return token == underlying || token == yvToken;
|
|
138
142
|
}
|
|
139
143
|
|
|
@@ -0,0 +1,184 @@
|
|
|
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, _sJOE) {
|
|
44
|
+
require(_sJOE != address(0), "zero address");
|
|
45
|
+
SJOE = _sJOE;
|
|
46
|
+
JOE = ISJoe(SJOE).joe();
|
|
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 tokenIn, uint256 amountTokenToDeposit)
|
|
134
|
+
internal
|
|
135
|
+
view
|
|
136
|
+
override
|
|
137
|
+
returns (uint256 amountSharesOut)
|
|
138
|
+
{
|
|
139
|
+
uint256 sJoeDepositFeePrecision = ISJoe(SJOE).depositFeePercent();
|
|
140
|
+
|
|
141
|
+
amountSharesOut =
|
|
142
|
+
(((1e18 - sJoeDepositFeePrecision / 1e18) * amountTokenToDeposit) * 1e18) /
|
|
143
|
+
exchangeRate();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
147
|
+
internal
|
|
148
|
+
pure
|
|
149
|
+
override
|
|
150
|
+
returns (uint256 amountTokenOut)
|
|
151
|
+
{
|
|
152
|
+
amountTokenOut = (amountSharesToRedeem * exchangeRate()) / 1e18;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
156
|
+
res = new address[](1);
|
|
157
|
+
res[0] = JOE;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
161
|
+
res = new address[](1);
|
|
162
|
+
res[0] = JOE;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
166
|
+
return token == JOE;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
170
|
+
return token == JOE;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function assetInfo()
|
|
174
|
+
external
|
|
175
|
+
view
|
|
176
|
+
returns (
|
|
177
|
+
AssetType assetType,
|
|
178
|
+
address assetAddress,
|
|
179
|
+
uint8 assetDecimals
|
|
180
|
+
)
|
|
181
|
+
{
|
|
182
|
+
return (AssetType.TOKEN, JOE, IERC20Metadata(JOE).decimals());
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -38,7 +38,7 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
38
38
|
uint256 amountTokenToDeposit,
|
|
39
39
|
uint256 minSharesOut
|
|
40
40
|
) external payable nonReentrant returns (uint256 amountSharesOut) {
|
|
41
|
-
require(
|
|
41
|
+
require(isValidTokenIn(tokenIn), "SCY: Invalid tokenIn");
|
|
42
42
|
require(amountTokenToDeposit != 0, "SCY: amountTokenToDeposit cannot be 0");
|
|
43
43
|
|
|
44
44
|
if (tokenIn == NATIVE) require(msg.value == amountTokenToDeposit, "SCY: eth mismatch");
|
|
@@ -80,7 +80,7 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
80
80
|
address tokenOut,
|
|
81
81
|
uint256 minTokenOut
|
|
82
82
|
) internal returns (uint256 amountTokenOut) {
|
|
83
|
-
require(
|
|
83
|
+
require(isValidTokenOut(tokenOut), "SCY: invalid tokenOut");
|
|
84
84
|
require(amountSharesToRedeem != 0, "SCY: amountSharesToRedeem cannot be 0");
|
|
85
85
|
|
|
86
86
|
amountTokenOut = _redeem(tokenOut, amountSharesToRedeem);
|
|
@@ -181,7 +181,7 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
181
181
|
virtual
|
|
182
182
|
returns (uint256 amountSharesOut)
|
|
183
183
|
{
|
|
184
|
-
require(
|
|
184
|
+
require(isValidTokenIn(tokenIn), "SCY: Invalid tokenIn");
|
|
185
185
|
return _previewDeposit(tokenIn, amountTokenToDeposit);
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -191,7 +191,7 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
191
191
|
virtual
|
|
192
192
|
returns (uint256 amountTokenOut)
|
|
193
193
|
{
|
|
194
|
-
require(
|
|
194
|
+
require(isValidTokenOut(tokenOut), "SCY: Invalid tokenOut");
|
|
195
195
|
return _previewRedeem(tokenOut, amountSharesToRedeem);
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -207,13 +207,11 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
207
207
|
virtual
|
|
208
208
|
returns (uint256 amountTokenOut);
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
* @notice See {ISuperComposableYield-getBaseTokens}
|
|
212
|
-
*/
|
|
213
|
-
function getBaseTokens() external view virtual override returns (address[] memory res);
|
|
210
|
+
function getTokensIn() public view virtual returns (address[] memory res);
|
|
214
211
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
212
|
+
function getTokensOut() public view virtual returns (address[] memory res);
|
|
213
|
+
|
|
214
|
+
function isValidTokenIn(address token) public view virtual returns (bool);
|
|
215
|
+
|
|
216
|
+
function isValidTokenOut(address token) public view virtual returns (bool);
|
|
219
217
|
}
|
|
@@ -6,8 +6,7 @@ import "./SCYBase.sol";
|
|
|
6
6
|
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
7
7
|
import "../../libraries/math/Math.sol";
|
|
8
8
|
|
|
9
|
-
///
|
|
10
|
-
/// Please make sure that assumption always holds
|
|
9
|
+
/// NOTE: yieldToken MUST NEVER BE a rewardToken, else the rewardManager will behave erroneously
|
|
11
10
|
abstract contract SCYBaseWithRewards is SCYBase, RewardManager {
|
|
12
11
|
using Math for uint256;
|
|
13
12
|
using ArrayLib for address[];
|
|
@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
|
|
|
3
3
|
|
|
4
4
|
import "../../../interfaces/ICelerMessageBus.sol";
|
|
5
5
|
import "../../../periphery/PermissionsV2Upg.sol";
|
|
6
|
+
import "@openzeppelin/contracts/utils/Address.sol";
|
|
6
7
|
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
|
|
7
8
|
|
|
8
9
|
// solhint-disable no-empty-blocks
|
|
@@ -15,10 +16,18 @@ abstract contract CelerSenderUpg is PermissionsV2Upg {
|
|
|
15
16
|
|
|
16
17
|
ICelerMessageBus public celerMessageBus;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
// destinationContracts mapping contains one address for each chainId only
|
|
20
|
+
EnumerableMap.UintToAddressMap internal destinationContracts;
|
|
19
21
|
|
|
20
22
|
uint256[100] private __gap;
|
|
21
23
|
|
|
24
|
+
modifier refundUnusedEth() {
|
|
25
|
+
_;
|
|
26
|
+
if (address(this).balance > 0) {
|
|
27
|
+
Address.sendValue(payable(msg.sender), address(this).balance);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
constructor(address _governanceManager) PermissionsV2Upg(_governanceManager) {}
|
|
23
32
|
|
|
24
33
|
function setCelerMessageBus(address _celerMessageBus) external onlyGovernance {
|
|
@@ -26,34 +35,35 @@ abstract contract CelerSenderUpg is PermissionsV2Upg {
|
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
function _sendMessage(uint256 chainId, bytes memory message) internal {
|
|
29
|
-
assert(
|
|
30
|
-
address toAddr =
|
|
38
|
+
assert(destinationContracts.contains(chainId));
|
|
39
|
+
address toAddr = destinationContracts.get(chainId);
|
|
31
40
|
uint256 fee = celerMessageBus.calcFee(message);
|
|
41
|
+
require(msg.value >= fee, "Insufficient celer fee");
|
|
32
42
|
celerMessageBus.sendMessage{ value: fee }(toAddr, chainId, message);
|
|
33
43
|
}
|
|
34
44
|
|
|
35
|
-
function
|
|
45
|
+
function _afterAddDestinationContract(address addr, uint256 chainId) internal virtual {}
|
|
36
46
|
|
|
37
|
-
function
|
|
47
|
+
function addDestinationContract(address _address, uint256 _chainId)
|
|
38
48
|
external
|
|
39
49
|
payable
|
|
40
50
|
onlyGovernance
|
|
41
51
|
{
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
destinationContracts.set(_chainId, _address);
|
|
53
|
+
_afterAddDestinationContract(_address, _chainId);
|
|
44
54
|
}
|
|
45
55
|
|
|
46
|
-
function
|
|
56
|
+
function getAllDestinationContracts()
|
|
47
57
|
public
|
|
48
58
|
view
|
|
49
59
|
returns (uint256[] memory chainIds, address[] memory addrs)
|
|
50
60
|
{
|
|
51
|
-
uint256 length =
|
|
61
|
+
uint256 length = destinationContracts.length();
|
|
52
62
|
chainIds = new uint256[](length);
|
|
53
63
|
addrs = new address[](length);
|
|
54
64
|
|
|
55
65
|
for (uint256 i = 0; i < length; ++i) {
|
|
56
|
-
(chainIds[i], addrs[i]) =
|
|
66
|
+
(chainIds[i], addrs[i]) = destinationContracts.at(i);
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
}
|
|
@@ -7,6 +7,7 @@ import "../../../libraries/math/Math.sol";
|
|
|
7
7
|
import "../../../libraries/math/WeekMath.sol";
|
|
8
8
|
import "../../../interfaces/IPGaugeController.sol";
|
|
9
9
|
import "../../../interfaces/IPMarketFactory.sol";
|
|
10
|
+
import "../../../interfaces/IPMarket.sol";
|
|
10
11
|
import "../../../periphery/PermissionsV2Upg.sol";
|
|
11
12
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
12
13
|
|
|
@@ -101,7 +102,8 @@ abstract contract PendleGaugeControllerBaseUpg is IPGaugeController, Permissions
|
|
|
101
102
|
epochRewardReceived[wTime] = true;
|
|
102
103
|
|
|
103
104
|
for (uint256 i = 0; i < markets.length; ++i) {
|
|
104
|
-
|
|
105
|
+
if (!IPMarket(markets[i]).isExpired())
|
|
106
|
+
_addRewardsToMarket(markets[i], pendleAmounts[i].Uint128());
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
emit ReceiveVotingResults(wTime, markets, pendleAmounts);
|
|
File without changes
|