@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
|
@@ -13,7 +13,7 @@ import "../../interfaces/IPYieldContractFactory.sol";
|
|
|
13
13
|
import "../../libraries/SCY/SCYUtils.sol";
|
|
14
14
|
import "../../libraries/helpers/MiniHelpers.sol";
|
|
15
15
|
import "../../libraries/RewardManagerAbstract.sol";
|
|
16
|
-
import "../
|
|
16
|
+
import "../PendleERC20.sol";
|
|
17
17
|
import "./InterestManagerYT.sol";
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -21,18 +21,13 @@ Invariances to maintain:
|
|
|
21
21
|
- address(0) & address(this) should never have any rewards & activeBalance accounting done. This is
|
|
22
22
|
guaranteed by address(0) & address(this) check in each updateForTwo function
|
|
23
23
|
*/
|
|
24
|
-
contract PendleYieldToken is
|
|
25
|
-
IPYieldToken,
|
|
26
|
-
PendleERC20Permit,
|
|
27
|
-
RewardManagerAbstract,
|
|
28
|
-
InterestManagerYT
|
|
29
|
-
{
|
|
24
|
+
contract PendleYieldToken is IPYieldToken, PendleERC20, RewardManagerAbstract, InterestManagerYT {
|
|
30
25
|
using Math for uint256;
|
|
31
26
|
using SafeERC20 for IERC20;
|
|
32
27
|
using ArrayLib for uint256[];
|
|
33
28
|
|
|
34
29
|
struct PostExpiryData {
|
|
35
|
-
uint128
|
|
30
|
+
uint128 firstPYIndex;
|
|
36
31
|
uint128 totalScyInterestForTreasury;
|
|
37
32
|
mapping(address => uint256) firstRewardIndex;
|
|
38
33
|
mapping(address => uint256) userRewardOwed;
|
|
@@ -44,7 +39,7 @@ contract PendleYieldToken is
|
|
|
44
39
|
uint256 public immutable expiry;
|
|
45
40
|
|
|
46
41
|
uint128 public scyReserve;
|
|
47
|
-
uint128 internal
|
|
42
|
+
uint128 internal _pyIndexStored;
|
|
48
43
|
|
|
49
44
|
PostExpiryData public postExpiry;
|
|
50
45
|
|
|
@@ -61,7 +56,7 @@ contract PendleYieldToken is
|
|
|
61
56
|
string memory _symbol,
|
|
62
57
|
uint8 __decimals,
|
|
63
58
|
uint256 _expiry
|
|
64
|
-
)
|
|
59
|
+
) PendleERC20(_name, _symbol, __decimals) {
|
|
65
60
|
SCY = _SCY;
|
|
66
61
|
PT = _PT;
|
|
67
62
|
expiry = _expiry;
|
|
@@ -84,6 +79,8 @@ contract PendleYieldToken is
|
|
|
84
79
|
_mint(receiverYT, amountPYOut);
|
|
85
80
|
|
|
86
81
|
IPPrincipalToken(PT).mintByYT(receiverPT, amountPYOut);
|
|
82
|
+
|
|
83
|
+
emit Mint(msg.sender, receiverPT, receiverYT, amountScyToMint, amountPYOut);
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
/// @dev this function converts PY tokens into scy, but interests & rewards are not redeemed at the same time
|
|
@@ -183,14 +180,14 @@ contract PendleYieldToken is
|
|
|
183
180
|
}
|
|
184
181
|
|
|
185
182
|
/// @dev maximize the current rate with the previous rate to guarantee non-decreasing rate
|
|
186
|
-
function
|
|
187
|
-
currentIndex = Math.max(ISuperComposableYield(SCY).exchangeRate(),
|
|
188
|
-
|
|
183
|
+
function pyIndexCurrent() public returns (uint256 currentIndex) {
|
|
184
|
+
currentIndex = Math.max(ISuperComposableYield(SCY).exchangeRate(), _pyIndexStored);
|
|
185
|
+
_pyIndexStored = currentIndex.Uint128();
|
|
189
186
|
emit NewInterestIndex(currentIndex);
|
|
190
187
|
}
|
|
191
188
|
|
|
192
|
-
function
|
|
193
|
-
return
|
|
189
|
+
function pyIndexStored() public view returns (uint256) {
|
|
190
|
+
return _pyIndexStored;
|
|
194
191
|
}
|
|
195
192
|
|
|
196
193
|
function isExpired() public view returns (bool) {
|
|
@@ -201,15 +198,15 @@ contract PendleYieldToken is
|
|
|
201
198
|
external
|
|
202
199
|
view
|
|
203
200
|
returns (
|
|
204
|
-
uint256
|
|
201
|
+
uint256 firstPYIndex,
|
|
205
202
|
uint256 totalScyInterestForTreasury,
|
|
206
203
|
uint256[] memory firstRewardIndexes,
|
|
207
204
|
uint256[] memory userRewardOwed
|
|
208
205
|
)
|
|
209
206
|
{
|
|
210
|
-
require(postExpiry.
|
|
207
|
+
require(postExpiry.firstPYIndex != 0, "PostExpiry data not set");
|
|
211
208
|
|
|
212
|
-
|
|
209
|
+
firstPYIndex = postExpiry.firstPYIndex;
|
|
213
210
|
totalScyInterestForTreasury = postExpiry.totalScyInterestForTreasury;
|
|
214
211
|
|
|
215
212
|
address[] memory tokens = getRewardTokens();
|
|
@@ -230,7 +227,7 @@ contract PendleYieldToken is
|
|
|
230
227
|
IPPrincipalToken(PT).burnByYT(address(this), totalAmountPYToRedeem);
|
|
231
228
|
if (!isExpired()) _burn(address(this), totalAmountPYToRedeem);
|
|
232
229
|
|
|
233
|
-
uint256 index =
|
|
230
|
+
uint256 index = pyIndexCurrent();
|
|
234
231
|
uint256 totalScyInterestPostExpiry;
|
|
235
232
|
amountScyOuts = new uint256[](receivers.length);
|
|
236
233
|
|
|
@@ -242,6 +239,8 @@ contract PendleYieldToken is
|
|
|
242
239
|
);
|
|
243
240
|
_transferOut(SCY, receivers[i], amountScyOuts[i]);
|
|
244
241
|
totalScyInterestPostExpiry += scyInterestPostExpiry;
|
|
242
|
+
|
|
243
|
+
emit Burn(msg.sender, receivers[i], amountPYToRedeems[i], amountScyOuts[i]);
|
|
245
244
|
}
|
|
246
245
|
if (totalScyInterestPostExpiry != 0) {
|
|
247
246
|
postExpiry.totalScyInterestForTreasury += totalScyInterestPostExpiry.Uint128();
|
|
@@ -250,14 +249,7 @@ contract PendleYieldToken is
|
|
|
250
249
|
|
|
251
250
|
function _calcPYToMint(uint256 amountScy) internal returns (uint256 amountPY) {
|
|
252
251
|
// doesn't matter before or after expiry, since mintPY is only allowed before expiry
|
|
253
|
-
return SCYUtils.scyToAsset(
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function _calcScyRedeemableFromPY(uint256 amountPY)
|
|
257
|
-
internal
|
|
258
|
-
returns (uint256 scyToUser, uint256 scyInterestPostExpiry)
|
|
259
|
-
{
|
|
260
|
-
return _calcScyRedeemableFromPY(amountPY, scyIndexCurrent());
|
|
252
|
+
return SCYUtils.scyToAsset(pyIndexCurrent(), amountScy);
|
|
261
253
|
}
|
|
262
254
|
|
|
263
255
|
function _calcScyRedeemableFromPY(uint256 amountPY, uint256 indexCurrent)
|
|
@@ -267,7 +259,7 @@ contract PendleYieldToken is
|
|
|
267
259
|
{
|
|
268
260
|
scyToUser = SCYUtils.assetToScy(indexCurrent, amountPY);
|
|
269
261
|
if (isExpired()) {
|
|
270
|
-
uint256 totalScyRedeemable = SCYUtils.assetToScy(postExpiry.
|
|
262
|
+
uint256 totalScyRedeemable = SCYUtils.assetToScy(postExpiry.firstPYIndex, amountPY);
|
|
271
263
|
scyInterestPostExpiry = totalScyRedeemable - scyToUser;
|
|
272
264
|
}
|
|
273
265
|
}
|
|
@@ -288,11 +280,11 @@ contract PendleYieldToken is
|
|
|
288
280
|
|
|
289
281
|
function _setPostExpiryData() internal {
|
|
290
282
|
PostExpiryData storage local = postExpiry;
|
|
291
|
-
if (local.
|
|
283
|
+
if (local.firstPYIndex != 0) return; // already set
|
|
292
284
|
|
|
293
285
|
_redeemExternalReward(); // do a final redeem. All the future reward income will belong to the treasury
|
|
294
286
|
|
|
295
|
-
local.
|
|
287
|
+
local.firstPYIndex = pyIndexCurrent().Uint128();
|
|
296
288
|
address[] memory rewardTokens = ISuperComposableYield(SCY).getRewardTokens();
|
|
297
289
|
uint256[] memory rewardIndexes = ISuperComposableYield(SCY).rewardIndexesCurrent();
|
|
298
290
|
for (uint256 i = 0; i < rewardTokens.length; i++) {
|
|
@@ -306,8 +298,8 @@ contract PendleYieldToken is
|
|
|
306
298
|
//////////////////////////////////////////////////////////////*/
|
|
307
299
|
|
|
308
300
|
function _getInterestIndex() internal virtual override returns (uint256 index) {
|
|
309
|
-
if (isExpired()) index = postExpiry.
|
|
310
|
-
else index =
|
|
301
|
+
if (isExpired()) index = postExpiry.firstPYIndex;
|
|
302
|
+
else index = pyIndexCurrent();
|
|
311
303
|
}
|
|
312
304
|
|
|
313
305
|
function _YTbalance(address user) internal view override returns (uint256) {
|
|
@@ -16,8 +16,8 @@ contract ActionCallback is IPMarketSwapCallback, CallbackHelper {
|
|
|
16
16
|
using SafeERC20 for ISuperComposableYield;
|
|
17
17
|
using SafeERC20 for IPYieldToken;
|
|
18
18
|
using SafeERC20 for IERC20;
|
|
19
|
-
using
|
|
20
|
-
using
|
|
19
|
+
using PYIndexLib for PYIndex;
|
|
20
|
+
using PYIndexLib for IPYieldToken;
|
|
21
21
|
|
|
22
22
|
address public immutable marketFactory;
|
|
23
23
|
|
|
@@ -90,9 +90,9 @@ contract ActionCallback is IPMarketSwapCallback, CallbackHelper {
|
|
|
90
90
|
/// ------------------------------------------------------------
|
|
91
91
|
/// calc totalScyNeed
|
|
92
92
|
/// ------------------------------------------------------------
|
|
93
|
-
|
|
93
|
+
PYIndex pyIndex = YT.newIndex();
|
|
94
94
|
uint256 ptOwed = ptToAccount.abs();
|
|
95
|
-
uint256 totalScyNeed =
|
|
95
|
+
uint256 totalScyNeed = pyIndex.assetToScyUp(ptOwed);
|
|
96
96
|
|
|
97
97
|
/// ------------------------------------------------------------
|
|
98
98
|
/// calc netScyToPull
|
|
@@ -104,7 +104,9 @@ contract ActionCallback is IPMarketSwapCallback, CallbackHelper {
|
|
|
104
104
|
/// ------------------------------------------------------------
|
|
105
105
|
/// mint & transfer
|
|
106
106
|
/// ------------------------------------------------------------
|
|
107
|
-
|
|
107
|
+
if (netScyToPull > 0) {
|
|
108
|
+
SCY.safeTransferFrom(vars.payer, address(YT), netScyToPull);
|
|
109
|
+
}
|
|
108
110
|
|
|
109
111
|
uint256 amountPYout = YT.mintPY(market, vars.receiver);
|
|
110
112
|
require(amountPYout >= ptOwed, "insufficient pt to pay");
|
|
@@ -118,15 +120,15 @@ contract ActionCallback is IPMarketSwapCallback, CallbackHelper {
|
|
|
118
120
|
bytes calldata data
|
|
119
121
|
) internal {
|
|
120
122
|
(address receiver, uint256 minScyOut) = _decodeSwapYtForScy(data);
|
|
121
|
-
(
|
|
122
|
-
|
|
123
|
+
(, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
124
|
+
PYIndex pyIndex = YT.newIndex();
|
|
123
125
|
|
|
124
126
|
uint256 scyOwed = scyToAccount.neg().Uint();
|
|
125
127
|
|
|
126
128
|
address[] memory receivers = new address[](2);
|
|
127
129
|
uint256[] memory amountPYToRedeems = new uint256[](2);
|
|
128
130
|
|
|
129
|
-
(receivers[0], amountPYToRedeems[0]) = (market,
|
|
131
|
+
(receivers[0], amountPYToRedeems[0]) = (market, pyIndex.scyToAssetUp(scyOwed));
|
|
130
132
|
(receivers[1], amountPYToRedeems[1]) = (
|
|
131
133
|
receiver,
|
|
132
134
|
ptToAccount.Uint() - amountPYToRedeems[0]
|
|
@@ -14,7 +14,7 @@ abstract contract ActionSCYAndPTBase is ActionSCYAndPYBase {
|
|
|
14
14
|
using MarketMathCore for MarketState;
|
|
15
15
|
using MarketApproxLib for MarketState;
|
|
16
16
|
using SafeERC20 for IERC20;
|
|
17
|
-
using
|
|
17
|
+
using PYIndexLib for IPYieldToken;
|
|
18
18
|
|
|
19
19
|
bytes private constant EMPTY_BYTES = abi.encode();
|
|
20
20
|
|
|
@@ -38,11 +38,12 @@ abstract contract ActionSCYAndPTBase is ActionSCYAndPYBase {
|
|
|
38
38
|
uint256 ptUsed
|
|
39
39
|
)
|
|
40
40
|
{
|
|
41
|
-
(ISuperComposableYield SCY, IPPrincipalToken PT, ) = IPMarket(market)
|
|
41
|
+
(ISuperComposableYield SCY, IPPrincipalToken PT, IPYieldToken YT) = IPMarket(market)
|
|
42
|
+
.readTokens();
|
|
42
43
|
|
|
43
44
|
MarketState memory state = IPMarket(market).readState(false);
|
|
44
45
|
(, netLpOut, scyUsed, ptUsed) = state.addLiquidity(
|
|
45
|
-
|
|
46
|
+
YT.newIndex(),
|
|
46
47
|
scyDesired,
|
|
47
48
|
ptDesired,
|
|
48
49
|
block.timestamp
|
|
@@ -119,10 +120,10 @@ abstract contract ActionSCYAndPTBase is ActionSCYAndPYBase {
|
|
|
119
120
|
bool doPull
|
|
120
121
|
) internal returns (uint256 netPtIn) {
|
|
121
122
|
MarketState memory state = IPMarket(market).readState(false);
|
|
122
|
-
(
|
|
123
|
+
(, IPPrincipalToken PT, IPYieldToken YT) = IPMarket(market).readTokens();
|
|
123
124
|
|
|
124
125
|
(netPtIn, , ) = state.approxSwapPtForExactScy(
|
|
125
|
-
|
|
126
|
+
YT.newIndex(),
|
|
126
127
|
exactScyOut,
|
|
127
128
|
block.timestamp,
|
|
128
129
|
guessPtIn
|
|
@@ -147,9 +148,9 @@ abstract contract ActionSCYAndPTBase is ActionSCYAndPYBase {
|
|
|
147
148
|
bool doPull
|
|
148
149
|
) internal returns (uint256 netScyIn) {
|
|
149
150
|
MarketState memory state = IPMarket(market).readState(false);
|
|
150
|
-
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
151
|
+
(ISuperComposableYield SCY, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
151
152
|
|
|
152
|
-
(netScyIn, ) = state.swapScyForExactPt(
|
|
153
|
+
(netScyIn, ) = state.swapScyForExactPt(YT.newIndex(), exactPtOut, block.timestamp);
|
|
153
154
|
|
|
154
155
|
require(netScyIn <= maxScyIn, "exceed limit SCY in");
|
|
155
156
|
|
|
@@ -175,10 +176,10 @@ abstract contract ActionSCYAndPTBase is ActionSCYAndPYBase {
|
|
|
175
176
|
bool doPull
|
|
176
177
|
) internal returns (uint256 netPtOut) {
|
|
177
178
|
MarketState memory state = IPMarket(market).readState(false);
|
|
178
|
-
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
179
|
+
(ISuperComposableYield SCY, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
179
180
|
|
|
180
181
|
(netPtOut, , ) = state.approxSwapExactScyForPt(
|
|
181
|
-
|
|
182
|
+
YT.newIndex(),
|
|
182
183
|
exactScyIn,
|
|
183
184
|
block.timestamp,
|
|
184
185
|
guessPtOut
|
|
@@ -16,7 +16,7 @@ abstract contract ActionSCYAndYTBase is ActionSCYAndPYBase, CallbackHelper {
|
|
|
16
16
|
using MarketApproxLib for MarketState;
|
|
17
17
|
using SafeERC20 for ISuperComposableYield;
|
|
18
18
|
using SafeERC20 for IPYieldToken;
|
|
19
|
-
using
|
|
19
|
+
using PYIndexLib for IPYieldToken;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @notice swap exact SCY to YT with the help of flashswaps & YT tokenization / redemption
|
|
@@ -40,7 +40,7 @@ abstract contract ActionSCYAndYTBase is ActionSCYAndPYBase, CallbackHelper {
|
|
|
40
40
|
MarketState memory state = IPMarket(market).readState(false);
|
|
41
41
|
|
|
42
42
|
(netYtOut, , ) = state.approxSwapExactScyForYt(
|
|
43
|
-
|
|
43
|
+
YT.newIndex(),
|
|
44
44
|
exactScyIn,
|
|
45
45
|
block.timestamp,
|
|
46
46
|
guessYtOut
|
|
@@ -118,6 +118,7 @@ abstract contract ActionSCYAndYTBase is ActionSCYAndPYBase, CallbackHelper {
|
|
|
118
118
|
exactYtOut, // exactPtIn = exactYtOut
|
|
119
119
|
_encodeSwapScyForExactYt(msg.sender, receiver, maxScyIn)
|
|
120
120
|
);
|
|
121
|
+
|
|
121
122
|
netScyIn = preScyBalance - SCY.balanceOf(msg.sender);
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -140,10 +141,10 @@ abstract contract ActionSCYAndYTBase is ActionSCYAndPYBase, CallbackHelper {
|
|
|
140
141
|
bool doPull
|
|
141
142
|
) internal returns (uint256 netYtIn) {
|
|
142
143
|
MarketState memory state = IPMarket(market).readState(false);
|
|
143
|
-
(
|
|
144
|
+
(, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
144
145
|
|
|
145
146
|
(netYtIn, , ) = state.approxSwapYtForExactScy(
|
|
146
|
-
|
|
147
|
+
YT.newIndex(),
|
|
147
148
|
exactScyOut,
|
|
148
149
|
block.timestamp,
|
|
149
150
|
guessYtIn
|
|
@@ -76,6 +76,6 @@ abstract contract CallbackHelper {
|
|
|
76
76
|
/// Misc functions
|
|
77
77
|
/// ------------------------------------------------------------
|
|
78
78
|
function _getActionType(bytes memory data) internal pure returns (ActionType actionType) {
|
|
79
|
-
|
|
79
|
+
actionType = abi.decode(data, (ActionType));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.15;
|
|
25
|
+
|
|
26
|
+
interface IEulerEToken {
|
|
27
|
+
/// @notice Address of underlying asset
|
|
28
|
+
function underlyingAsset() external view returns (address);
|
|
29
|
+
|
|
30
|
+
/// @notice Sum of all balances, in internal book-keeping units (non-increasing)
|
|
31
|
+
function totalSupply() external view returns (uint256);
|
|
32
|
+
|
|
33
|
+
/// @notice Sum of all balances, in underlying units (increases as interest is earned)
|
|
34
|
+
function totalSupplyUnderlying() external view returns (uint256);
|
|
35
|
+
|
|
36
|
+
/// @notice Transfer underlying tokens from sender to the Euler pool, and increase account's eTokens
|
|
37
|
+
/// @param subAccountId 0 for primary, 1-255 for a sub-account
|
|
38
|
+
/// @param amount In underlying units (use max uint256 for full underlying token balance)
|
|
39
|
+
function deposit(uint256 subAccountId, uint256 amount) external;
|
|
40
|
+
|
|
41
|
+
function balanceOf(address) external view returns (uint256);
|
|
42
|
+
|
|
43
|
+
/// @notice Balance of a particular account, in underlying units (increases as interest is earned)
|
|
44
|
+
function balanceOfUnderlying(address) external view returns (uint256);
|
|
45
|
+
|
|
46
|
+
/// @notice Convert an underlying amount to an eToken balance, taking into account current exchange rate
|
|
47
|
+
/// @param underlyingAmount Amount in underlying units (same decimals as underlying token)
|
|
48
|
+
/// @return eToken balance, in internal book-keeping units (18 decimals)
|
|
49
|
+
function convertUnderlyingToBalance(uint256 underlyingAmount) external view returns (uint256);
|
|
50
|
+
|
|
51
|
+
/// @notice Convert an eToken balance to an underlying amount, taking into account current exchange rate
|
|
52
|
+
/// @param balance eToken balance, in internal book-keeping units (18 decimals)
|
|
53
|
+
/// @return Amount in underlying units, (same decimals as underlying token)
|
|
54
|
+
function convertBalanceToUnderlying(uint256 balance) external view returns (uint256);
|
|
55
|
+
|
|
56
|
+
/// @notice Transfer underlying tokens from Euler pool to sender, and decrease account's eTokens
|
|
57
|
+
/// @param subAccountId 0 for primary, 1-255 for a sub-account
|
|
58
|
+
/// @param amount In underlying units (use max uint256 for full pool balance)
|
|
59
|
+
function withdraw(uint256 subAccountId, uint256 amount) external;
|
|
60
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.15;
|
|
25
|
+
|
|
26
|
+
interface IEulerMarkets {
|
|
27
|
+
/// @notice Given an EToken address, looks up the associated underlying
|
|
28
|
+
/// @param eToken EToken address
|
|
29
|
+
/// @return underlying Token address
|
|
30
|
+
function eTokenToUnderlying(address eToken) external view returns (address underlying);
|
|
31
|
+
|
|
32
|
+
/// @notice Given an underlying, lookup the associated EToken
|
|
33
|
+
/// @param underlying Token address
|
|
34
|
+
/// @return EToken address, or address(0) if not activated
|
|
35
|
+
function underlyingToEToken(address underlying) external view returns (address);
|
|
36
|
+
|
|
37
|
+
/// @notice Given an underlying, lookup the associated DToken
|
|
38
|
+
/// @param underlying Token address
|
|
39
|
+
/// @return DToken address, or address(0) if not activated
|
|
40
|
+
function underlyingToDToken(address underlying) external view returns (address);
|
|
41
|
+
|
|
42
|
+
/// @notice Retrieves the current interest rate for an asset
|
|
43
|
+
/// @param underlying Token address
|
|
44
|
+
/// @return The interest rate in yield-per-second, scaled by 10**27
|
|
45
|
+
function interestRate(address underlying) external view returns (int96);
|
|
46
|
+
}
|
|
@@ -4,6 +4,7 @@ pragma solidity 0.8.15;
|
|
|
4
4
|
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
5
5
|
import "./IPPrincipalToken.sol";
|
|
6
6
|
import "./IPYieldToken.sol";
|
|
7
|
+
import "./ISuperComposableYield.sol";
|
|
7
8
|
import "../libraries/math/MarketMathCore.sol";
|
|
8
9
|
|
|
9
10
|
interface IPMarket is IERC20Metadata {
|
|
@@ -59,7 +59,6 @@ interface IPRouterStatic {
|
|
|
59
59
|
|
|
60
60
|
function getMarketInfo(address market)
|
|
61
61
|
external
|
|
62
|
-
view
|
|
63
62
|
returns (
|
|
64
63
|
address pt,
|
|
65
64
|
address scy,
|
|
@@ -93,7 +92,6 @@ interface IPRouterStatic {
|
|
|
93
92
|
uint256 ptDesired
|
|
94
93
|
)
|
|
95
94
|
external
|
|
96
|
-
view
|
|
97
95
|
returns (
|
|
98
96
|
uint256 netLpOut,
|
|
99
97
|
uint256 scyUsed,
|
|
@@ -107,26 +105,35 @@ interface IPRouterStatic {
|
|
|
107
105
|
|
|
108
106
|
function swapExactPtForScyStatic(address market, uint256 exactPtIn)
|
|
109
107
|
external
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
returns (
|
|
109
|
+
uint256 netScyOut,
|
|
110
|
+
uint256 netScyFee,
|
|
111
|
+
uint256 priceImpact
|
|
112
|
+
);
|
|
112
113
|
|
|
113
114
|
function swapScyForExactPtStatic(address market, uint256 exactPtOut)
|
|
114
115
|
external
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
returns (
|
|
117
|
+
uint256 netScyIn,
|
|
118
|
+
uint256 netScyFee,
|
|
119
|
+
uint256 priceImpact
|
|
120
|
+
);
|
|
117
121
|
|
|
118
122
|
function swapExactScyForPtStatic(address market, uint256 exactScyIn)
|
|
119
123
|
external
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
returns (
|
|
125
|
+
uint256 netPtOut,
|
|
126
|
+
uint256 netScyFee,
|
|
127
|
+
uint256 priceImpact
|
|
128
|
+
);
|
|
122
129
|
|
|
123
130
|
// ============= OTHER HELPERS =============
|
|
124
131
|
|
|
125
|
-
function
|
|
132
|
+
function pyIndex(address market) external returns (PYIndex index);
|
|
126
133
|
|
|
127
134
|
function getPY(address py) external view returns (address pt, address yt);
|
|
128
135
|
|
|
129
|
-
function getPtImpliedYield(address market) external
|
|
136
|
+
function getPtImpliedYield(address market) external returns (int256);
|
|
130
137
|
|
|
131
138
|
function getUserPYInfo(address py, address user)
|
|
132
139
|
external
|
|
@@ -46,9 +46,9 @@ interface IPYieldToken is IERC20Metadata, IRewardManager, IPInterestManagerYT {
|
|
|
46
46
|
|
|
47
47
|
function rewardIndexesCurrent() external returns (uint256[] memory);
|
|
48
48
|
|
|
49
|
-
function
|
|
49
|
+
function pyIndexCurrent() external returns (uint256);
|
|
50
50
|
|
|
51
|
-
function
|
|
51
|
+
function pyIndexStored() external view returns (uint256);
|
|
52
52
|
|
|
53
53
|
function getRewardTokens() external view returns (address[] memory);
|
|
54
54
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
|
|
4
|
+
interface ISAvax {
|
|
5
|
+
function decimals() external pure returns (uint8);
|
|
6
|
+
|
|
7
|
+
function balanceOf(address account) external view returns (uint256);
|
|
8
|
+
|
|
9
|
+
function totalPooledAvax() external returns (uint256);
|
|
10
|
+
|
|
11
|
+
function totalShares() external returns (uint256);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @return The amount of AVAX that corresponds to `shareAmount` sAVAX token shares.
|
|
15
|
+
*/
|
|
16
|
+
function getPooledAvaxByShares(uint256 shareAmount) external view returns (uint256);
|
|
17
|
+
|
|
18
|
+
function cooldownPeriod() external returns (uint256);
|
|
19
|
+
|
|
20
|
+
function redeemPeriod() external returns (uint256);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @notice Process user deposit, mints liquid tokens and increase the pool buffer -> Will be called when NATIVE AVAX is transferred to SAVAX (Dont need to call this function explicitly)
|
|
24
|
+
* @return Amount of sAVAX shares generated
|
|
25
|
+
*/
|
|
26
|
+
function submit() external payable returns (uint256);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @notice Redeem all redeemable AVAX from all unlocks
|
|
30
|
+
*/
|
|
31
|
+
function redeem() external;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @notice Redeem AVAX after cooldown has finished
|
|
35
|
+
* @param unlockIndex Index number of the redeemed unlock request
|
|
36
|
+
*/
|
|
37
|
+
function redeem(uint256 unlockIndex) external;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @notice Redeem all sAVAX held in custody for overdue unlock requests
|
|
41
|
+
*/
|
|
42
|
+
function redeemOverdueShares() external;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @notice Redeem sAVAX held in custody for the given unlock request
|
|
46
|
+
* @param unlockIndex Unlock request array index
|
|
47
|
+
*/
|
|
48
|
+
function redeemOverdueShares(uint256 unlockIndex) external;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @notice Start unlocking cooldown period for `shareAmount` AVAX
|
|
52
|
+
* @param shareAmount Amount of shares to unlock
|
|
53
|
+
*/
|
|
54
|
+
function requestUnlock(uint256 shareAmount) external;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @notice Get the number of active unlock requests by user
|
|
58
|
+
* @param user User address
|
|
59
|
+
*/
|
|
60
|
+
function getUnlockRequestCount(address user) external view returns (uint256);
|
|
61
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
|
|
4
|
+
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
5
|
+
|
|
6
|
+
interface ISJoe {
|
|
7
|
+
function joe() external view returns (address);
|
|
8
|
+
|
|
9
|
+
function depositFeePercent() external view returns (uint256);
|
|
10
|
+
|
|
11
|
+
function internalJoeBalance() external view returns (uint256);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @notice Deposit JOE for reward token allocation
|
|
15
|
+
* @param _amount The amount of JOE to deposit
|
|
16
|
+
*/
|
|
17
|
+
function deposit(uint256 _amount) external;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @notice Get user info
|
|
21
|
+
* @param _user The address of the user
|
|
22
|
+
* @param _rewardToken The address of the reward token
|
|
23
|
+
* @return The amount of JOE user has deposited
|
|
24
|
+
* @return The reward debt for the chosen token
|
|
25
|
+
*/
|
|
26
|
+
function getUserInfo(address _user, IERC20Upgradeable _rewardToken)
|
|
27
|
+
external
|
|
28
|
+
view
|
|
29
|
+
returns (uint256, uint256);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @notice Get the number of reward tokens
|
|
33
|
+
* @return The length of the array
|
|
34
|
+
*/
|
|
35
|
+
function rewardTokensLength() external view returns (uint256);
|
|
36
|
+
|
|
37
|
+
function rewardTokens(uint256 _index) external view returns (address);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @notice View function to see pending reward token on frontend
|
|
41
|
+
* @param _user The address of the user
|
|
42
|
+
* @param _token The address of the token
|
|
43
|
+
* @return `_user`'s pending reward token
|
|
44
|
+
*/
|
|
45
|
+
function pendingReward(address _user, IERC20Upgradeable _token)
|
|
46
|
+
external
|
|
47
|
+
view
|
|
48
|
+
returns (uint256);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @notice Withdraw JOE and harvest the rewards
|
|
52
|
+
* @param _amount The amount of JOE to withdraw
|
|
53
|
+
*/
|
|
54
|
+
function withdraw(uint256 _amount) external;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @notice Withdraw without caring about rewards. EMERGENCY ONLY
|
|
58
|
+
*/
|
|
59
|
+
function emergencyWithdraw() external;
|
|
60
|
+
}
|