@pendle/core-v2 0.6.8 → 0.7.0
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 +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +751 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +4 -0
- package/build/artifacts/contracts/{core/PendleSCYImpl → SuperComposableYield/SCY-implementations}/AaveV3/WadRayMath.sol/WadRayMath.json +3 -3
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +27 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +761 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.json +635 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +609 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.json +653 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +622 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.json +622 -0
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/{ISuperComposableYield.sol/ISuperComposableYield.json → base-implementations/SCYBase.sol/SCYBase.json} +221 -141
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/{implementations → base-implementations}/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +247 -223
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol/CelerReceiver.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol/CelerReceiver.json +128 -0
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSender.sol/CelerSender.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations/IRewardManager.sol/IRewardManager.json → core/LiquidityMining/CelerAbstracts/CelerSender.sol/CelerSender.json} +29 -33
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol/PendleGaugeController.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol/PendleGaugeController.json +193 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchain.json +255 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechain.json +318 -0
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +4 -0
- package/build/artifacts/contracts/{interfaces/IPVotingEscrow.sol/IVotingEscrowPendle.json → core/LiquidityMining/PendleGauge.sol/PendleGauge.json} +57 -65
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol/PendleVotingController.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol/PendleVotingController.json +707 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol/VotingControllerStorage.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol/VotingControllerStorage.json +342 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +547 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +353 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol/VotingEscrowToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol/VotingEscrowToken.json +138 -0
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +922 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +345 -0
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +4 -0
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +254 -0
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +4 -0
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +329 -0
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -20
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +445 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +344 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +750 -0
- 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 +123 -77
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +39 -42
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.json +163 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.json +0 -13
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.json +1 -14
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.json +10 -0
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.json +39 -0
- 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/IBenQiComptroller.sol/IBenQiComptroller.json +13 -0
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.json +74 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IVePToken.sol/IVePToken.json → ICelerMessageBus.sol/ICelerMessageBus.json} +21 -11
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.json +45 -0
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +4 -0
- package/build/artifacts/contracts/{core/PendleBaseToken.sol/PendleBaseToken.json → interfaces/IERC4626.sol/IERC4626.json} +53 -68
- 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 +4 -0
- package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.json +962 -0
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.json +122 -58
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.json +36 -21
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +116 -81
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.json +109 -0
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.json +132 -0
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +35 -54
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +31 -0
- 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/IPPrincipalToken.sol/IPPrincipalToken.json +5 -5
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +99 -0
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +167 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.json +148 -0
- 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 +85 -83
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPBaseToken.sol/IPBaseToken.json → IQiAvax.sol/IQiAvax.json} +106 -15
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.json +117 -0
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.json +117 -0
- package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +4 -0
- package/build/artifacts/contracts/{periphery/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.json → interfaces/IRewardManager.sol/IRewardManager.json} +12 -14
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations/SCYBase.sol/SCYBase.json → interfaces/ISuperComposableYield.sol/ISuperComposableYield.json} +183 -181
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.json +13 -0
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.json +13 -0
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.json +13 -0
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations → libraries}/RewardManager.sol/RewardManager.json +44 -33
- package/build/artifacts/contracts/libraries/RewardManagerMini.sol/RewardManagerMini.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/RewardManagerMini.sol/RewardManagerMini.json +101 -0
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol}/SCYIndexLib.json +3 -3
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield → libraries/SCY}/SCYUtils.sol/SCYUtils.json +3 -3
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{math/MarketMathAux.sol/MarketMathAux.json → VeBalanceLib.sol/VeBalanceLib.json} +4 -4
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/MiniDeployer.sol/MiniDeployer.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/MiniDeployer.sol/MiniDeployer.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions/base/ActionType.sol/ActionType.json → libraries/helpers/TokenHelper.sol/TokenHelper.json} +2 -2
- 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 +4 -0
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +10 -0
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.json +10 -0
- package/build/artifacts/contracts/libraries/solmate/LibRLP.sol/LibRLP.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/solmate/LibRLP.sol/LibRLP.json +10 -0
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.json +10 -0
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{JoeLibrary.sol → traderjoe/JoeLibrary.sol}/JoeLibrary.json +3 -3
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.json +24 -0
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +862 -0
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.json +2 -2
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +147 -0
- package/contracts/{core/PendleSCYImpl → SuperComposableYield/SCY-implementations}/AaveV3/WadRayMath.sol +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +74 -0
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +187 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol +123 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +99 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol +245 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +107 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +120 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +197 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +131 -0
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol +47 -0
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSender.sol +52 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol +141 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol +30 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol +22 -0
- package/contracts/core/LiquidityMining/PendleGauge.sol +118 -0
- package/contracts/core/LiquidityMining/README.md +63 -0
- package/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol +323 -0
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol +224 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +241 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +73 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol +53 -0
- package/contracts/core/{PendleMarket.sol → Market/PendleMarket.sol} +139 -103
- package/contracts/core/{PendleMarketFactory.sol → Market/PendleMarketFactory.sol} +62 -19
- package/contracts/core/PendleERC20.sol +358 -0
- package/contracts/core/PendleERC20Permit.sol +84 -0
- package/contracts/core/PendleRouter.sol +6 -12
- package/contracts/core/YieldContracts/InterestManagerYT.sol +87 -0
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +52 -0
- package/contracts/core/{PendleYieldContractFactory.sol → YieldContracts/PendleYieldContractFactory.sol} +46 -25
- package/contracts/core/YieldContracts/PendleYieldToken.sol +340 -0
- package/contracts/core/actions/ActionCallback.sol +63 -43
- package/contracts/core/actions/ActionCore.sol +95 -78
- package/contracts/core/actions/ActionYT.sol +35 -86
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +133 -78
- package/contracts/core/actions/base/ActionSCYAndPYBase.sol +31 -46
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +127 -45
- package/contracts/core/actions/base/CallbackHelper.sol +81 -0
- package/contracts/interfaces/IAToken.sol +11 -1
- package/contracts/interfaces/IAavePool.sol +1 -1
- package/contracts/interfaces/IAaveRewardsController.sol +1 -1
- package/contracts/interfaces/IBenQiComptroller.sol +3 -1
- package/contracts/interfaces/IBenQiInterestRateModel.sol +16 -0
- package/contracts/interfaces/ICelerMessageBus.sol +28 -0
- package/contracts/interfaces/ICelerMessageReceiverApp.sol +25 -0
- package/contracts/interfaces/IERC4626.sol +39 -0
- package/contracts/interfaces/IJoeRouter01.sol +1 -1
- package/contracts/interfaces/IJoeRouter02.sol +52 -0
- package/contracts/interfaces/IPActionCore.sol +44 -27
- package/contracts/interfaces/IPActionYT.sol +12 -9
- package/contracts/interfaces/IPAllAction.sol +2 -3
- package/contracts/interfaces/IPGaugeController.sol +22 -0
- package/contracts/interfaces/IPGaugeControllerMainchain.sol +12 -0
- package/contracts/interfaces/IPGovernanceManager.sol +1 -1
- package/contracts/interfaces/IPInterestManagerYT.sol +9 -0
- package/contracts/interfaces/IPMarket.sol +13 -13
- package/contracts/interfaces/IPMarketAddRemoveCallback.sol +3 -3
- package/contracts/interfaces/IPMarketFactory.sol +8 -1
- package/contracts/interfaces/IPMarketSwapCallback.sol +1 -1
- package/contracts/interfaces/IPPermissionsV2Upg.sol +1 -1
- package/contracts/interfaces/IPPrincipalToken.sol +9 -5
- package/contracts/interfaces/IPRouterStatic.sol +1 -1
- package/contracts/interfaces/IPVeToken.sol +10 -5
- package/contracts/interfaces/IPVotingController.sol +21 -0
- package/contracts/interfaces/IPVotingEscrow.sol +14 -22
- package/contracts/interfaces/IPYieldContractFactory.sol +1 -1
- package/contracts/interfaces/IPYieldToken.sol +17 -17
- package/contracts/interfaces/IQiAvax.sol +31 -0
- package/contracts/interfaces/IQiErc20.sol +1 -1
- package/contracts/interfaces/IQiToken.sol +22 -1
- package/contracts/interfaces/IREDACTEDStaking.sol +1 -1
- package/contracts/interfaces/IRewardManager.sol +9 -0
- package/contracts/interfaces/ISuperComposableYield.sol +182 -0
- package/contracts/interfaces/IWETH.sol +1 -1
- package/contracts/interfaces/IWXBTRFLY.sol +3 -1
- package/contracts/interfaces/IWstETH.sol +3 -1
- package/contracts/interfaces/IYearnVault.sol +3 -1
- package/contracts/libraries/RewardManager.sol +78 -0
- package/contracts/libraries/RewardManagerAbstract.sol +81 -0
- package/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol} +8 -8
- package/contracts/libraries/SCY/SCYUtils.sol +18 -0
- package/contracts/libraries/VeBalanceLib.sol +114 -0
- package/contracts/libraries/helpers/ArrayLib.sol +65 -0
- package/contracts/libraries/helpers/ExpiryUtilsLib.sol +1 -1
- package/contracts/libraries/helpers/MiniDeployer.sol +23 -0
- package/contracts/libraries/helpers/MiniHelpers.sol +15 -0
- package/contracts/libraries/helpers/TokenHelper.sol +105 -0
- package/contracts/libraries/math/LogExpMath.sol +59 -1
- package/contracts/libraries/math/MarketApproxLib.sol +167 -164
- package/contracts/libraries/math/MarketMathCore.sol +106 -25
- package/contracts/libraries/math/Math.sol +28 -21
- package/contracts/libraries/math/WeekMath.sol +19 -0
- package/contracts/libraries/solmate/Bytes32AddressLib.sol +14 -0
- package/contracts/libraries/solmate/LibRLP.sol +30 -0
- package/contracts/libraries/solmate/SSTORE2.sol +99 -0
- package/contracts/libraries/{JoeLibrary.sol → traderjoe/JoeLibrary.sol} +3 -2
- package/contracts/{periphery → libraries/traderjoe}/PendleJoeSwapHelperUpg.sol +8 -10
- package/contracts/{core → offchain-helpers}/RouterStatic.sol +24 -19
- package/contracts/periphery/PendleGovernanceManager.sol +1 -1
- package/contracts/periphery/PermissionsV2Upg.sol +1 -1
- package/package.json +1 -1
- package/typechain-types/ActionCore.ts +169 -96
- package/typechain-types/ActionSCYAndPTBase.ts +210 -0
- package/typechain-types/ActionSCYAndPYBase.ts +0 -13
- package/typechain-types/ActionSCYAndYTBase.ts +8 -21
- package/typechain-types/ActionYT.ts +73 -64
- package/typechain-types/BeaconProxy.ts +97 -0
- package/typechain-types/CelerReceiver.ts +267 -0
- package/typechain-types/CelerSender.ts +197 -0
- package/typechain-types/ERC1967Upgrade.ts +97 -0
- package/typechain-types/ERC20Permit.ts +521 -0
- package/typechain-types/IAToken.ts +55 -0
- package/typechain-types/IBeacon.ts +87 -0
- package/typechain-types/IBenQiComptroller.ts +13 -0
- package/typechain-types/IBenQiInterestRateModel.ts +162 -0
- package/typechain-types/ICelerMessageBus.ts +134 -0
- package/typechain-types/ICelerMessageReceiverApp.ts +120 -0
- package/typechain-types/IERC1822Proxiable.ts +87 -0
- package/typechain-types/IERC20Permit.ts +175 -0
- package/typechain-types/IERC4626.ts +463 -0
- package/typechain-types/IJoeRouter02.ts +1420 -0
- package/typechain-types/IPActionCore.ts +169 -83
- package/typechain-types/IPActionYT.ts +65 -43
- package/typechain-types/IPAllAction.ts +190 -137
- package/typechain-types/IPGauge.ts +104 -0
- package/typechain-types/IPGaugeController.ts +191 -0
- package/typechain-types/IPGaugeControllerMainchain.ts +236 -0
- package/typechain-types/IPMarket.ts +73 -74
- package/typechain-types/IPMarketFactory.ts +27 -0
- package/typechain-types/IPPrincipalToken.ts +8 -20
- package/typechain-types/IPVeToken.ts +198 -0
- package/typechain-types/IPVotingController.ts +179 -0
- package/typechain-types/IPVotingEscrow.ts +217 -0
- package/typechain-types/IPVotingEscrowController.ts +154 -0
- package/typechain-types/IPYieldToken.ts +176 -213
- package/typechain-types/IQiAvax.ts +551 -0
- package/typechain-types/IQiErc20.ts +171 -0
- package/typechain-types/IQiToken.ts +171 -0
- package/typechain-types/IRewardManager.ts +16 -87
- package/typechain-types/ISuperComposableYield.ts +283 -269
- package/typechain-types/IWXBTRFLY.ts +13 -0
- package/typechain-types/IWstETH.ts +13 -0
- package/typechain-types/IYearnVault.ts +13 -0
- package/typechain-types/PendleAaveV3SCY.ts +382 -477
- package/typechain-types/PendleBtrflyScy.ts +287 -348
- package/typechain-types/PendleERC20.ts +339 -0
- package/typechain-types/PendleERC20Permit.ts +443 -0
- package/typechain-types/PendleERC4626SCY.ts +801 -0
- package/typechain-types/PendleGauge.ts +276 -0
- package/typechain-types/PendleGaugeController.ts +346 -0
- package/typechain-types/PendleGaugeControllerMainchain.ts +410 -0
- package/typechain-types/PendleGaugeControllerSidechain.ts +524 -0
- package/typechain-types/PendleJoeLpSCY.ts +837 -0
- package/typechain-types/PendleJoeSwapHelperUpg.ts +0 -13
- package/typechain-types/PendleMarket.ts +265 -151
- package/typechain-types/PendleMarketFactory.ts +111 -16
- package/typechain-types/PendleMarketRewards.ts +1317 -0
- package/typechain-types/PendlePrincipalToken.ts +103 -130
- package/typechain-types/PendleQiTokenHelper.ts +57 -0
- package/typechain-types/PendleQiTokenSCY.ts +991 -0
- package/typechain-types/PendleRouter.ts +0 -19
- package/typechain-types/PendleVotingController.ts +1042 -0
- package/typechain-types/PendleWstEthSCY.ts +813 -0
- package/typechain-types/PendleYearnVaultScy.ts +278 -339
- package/typechain-types/PendleYieldContractFactory.ts +43 -27
- package/typechain-types/PendleYieldToken.ts +297 -428
- package/typechain-types/RewardManager.ts +70 -69
- package/typechain-types/RewardManagerMini.ts +200 -0
- package/typechain-types/SCYBase.ts +276 -335
- package/typechain-types/SCYBaseWithRewards.ts +367 -424
- package/typechain-types/VotingControllerStorage.ts +507 -0
- package/typechain-types/VotingEscrowPendleMainchain.ts +854 -0
- package/typechain-types/VotingEscrowPendleSidechain.ts +546 -0
- package/typechain-types/VotingEscrowToken.ts +251 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +122 -80
- package/typechain-types/factories/ActionRedeem__factory.ts +1 -1
- package/typechain-types/factories/ActionSCYAndPTBase__factory.ts +187 -0
- package/typechain-types/factories/ActionSCYAndPYBase__factory.ts +0 -13
- package/typechain-types/factories/ActionSCYAndYTBase__factory.ts +1 -14
- package/typechain-types/factories/ActionYT__factory.ts +39 -48
- package/typechain-types/factories/BeaconProxy__factory.ts +141 -0
- package/typechain-types/factories/CelerReceiver__factory.ts +140 -0
- package/typechain-types/factories/CelerSender__factory.ts +85 -0
- package/typechain-types/factories/ERC1967Upgrade__factory.ts +71 -0
- package/typechain-types/factories/ERC20Permit__factory.ts +368 -0
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IAToken__factory.ts +39 -0
- package/typechain-types/factories/IBeacon__factory.ts +36 -0
- package/typechain-types/factories/IBenQiComptroller__factory.ts +13 -0
- package/typechain-types/factories/IBenQiInterestRateModel__factory.ts +93 -0
- package/typechain-types/factories/ICelerMessageBus__factory.ts +68 -0
- package/typechain-types/factories/ICelerMessageReceiverApp__factory.ts +64 -0
- package/typechain-types/factories/IERC1822Proxiable__factory.ts +39 -0
- package/typechain-types/factories/IERC20Permit__factory.ts +98 -0
- package/typechain-types/factories/IERC4626__factory.ts +330 -0
- package/typechain-types/factories/IJoeRouter02__factory.ts +974 -0
- package/typechain-types/factories/IPActionCore__factory.ts +122 -58
- package/typechain-types/factories/IPActionYT__factory.ts +36 -21
- package/typechain-types/factories/IPAllAction__factory.ts +116 -81
- package/typechain-types/factories/IPGaugeControllerMainchain__factory.ts +151 -0
- package/typechain-types/factories/IPGaugeController__factory.ts +124 -0
- package/typechain-types/factories/IPGauge__factory.ts +42 -0
- package/typechain-types/factories/IPMarketFactory__factory.ts +31 -0
- package/typechain-types/factories/IPMarket__factory.ts +35 -54
- package/typechain-types/factories/IPPrincipalToken__factory.ts +5 -5
- package/typechain-types/factories/IPVeToken__factory.ts +111 -0
- package/typechain-types/factories/IPVotingController__factory.ts +182 -0
- package/typechain-types/factories/IPVotingEscrowController__factory.ts +80 -0
- package/typechain-types/factories/IPVotingEscrow__factory.ts +163 -0
- package/typechain-types/factories/IPYieldToken__factory.ts +85 -83
- package/typechain-types/factories/IQiAvax__factory.ts +362 -0
- package/typechain-types/factories/IQiErc20__factory.ts +117 -0
- package/typechain-types/factories/IQiToken__factory.ts +117 -0
- package/typechain-types/factories/IRewardManager__factory.ts +5 -47
- package/typechain-types/factories/ISuperComposableYield__factory.ts +201 -138
- package/typechain-types/factories/IWXBTRFLY__factory.ts +13 -0
- package/typechain-types/factories/IWstETH__factory.ts +13 -0
- package/typechain-types/factories/IYearnVault__factory.ts +13 -0
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +246 -315
- package/typechain-types/factories/PendleBtrflyScy__factory.ts +200 -234
- package/typechain-types/factories/PendleERC20Permit__factory.ts +405 -0
- package/typechain-types/factories/PendleERC20__factory.ts +327 -0
- package/typechain-types/factories/PendleERC4626SCY__factory.ts +678 -0
- package/typechain-types/factories/PendleGaugeControllerMainchain__factory.ts +332 -0
- package/typechain-types/factories/PendleGaugeControllerSidechain__factory.ts +391 -0
- package/typechain-types/factories/PendleGaugeController__factory.ts +212 -0
- package/typechain-types/factories/PendleGauge__factory.ts +171 -0
- package/typechain-types/factories/PendleGovernanceManager__factory.ts +1 -1
- package/typechain-types/factories/PendleJoeLpSCY__factory.ts +726 -0
- package/typechain-types/factories/PendleJoeSwapHelperUpg__factory.ts +0 -13
- package/typechain-types/factories/PendleMarketFactory__factory.ts +90 -5
- package/typechain-types/factories/PendleMarketRewards__factory.ts +1140 -0
- package/typechain-types/factories/PendleMarket__factory.ts +182 -94
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +74 -77
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +99 -0
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +845 -0
- package/typechain-types/factories/PendleRouter__factory.ts +1 -23
- package/typechain-types/factories/PendleVotingController__factory.ts +776 -0
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +686 -0
- package/typechain-types/factories/PendleYearnVaultScy__factory.ts +218 -243
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +39 -29
- package/typechain-types/factories/PendleYieldToken__factory.ts +153 -211
- package/typechain-types/factories/RewardManagerMini__factory.ts +116 -0
- package/typechain-types/factories/RewardManager__factory.ts +43 -32
- package/typechain-types/factories/RouterStatic__factory.ts +1 -1
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +242 -218
- package/typechain-types/factories/SCYBase__factory.ts +195 -176
- package/typechain-types/factories/VotingControllerStorage__factory.ts +361 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +616 -0
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +415 -0
- package/typechain-types/factories/VotingEscrowToken__factory.ts +153 -0
- package/typechain-types/hardhat.d.ts +338 -131
- package/typechain-types/index.ts +92 -38
- package/build/artifacts/contracts/SuperComposableYield/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCYUtils.sol/SCYUtils.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/IRewardManager.sol/IRewardManager.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/RewardManager.sol/RewardManager.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/SCYBase.sol/SCYBase.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleBaseToken.sol/PendleBaseToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarket.sol/PendleMarket.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarket.sol/PendleMarket.json +0 -842
- package/build/artifacts/contracts/core/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarketFactory.sol/PendleMarketFactory.json +0 -265
- package/build/artifacts/contracts/core/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendlePrincipalToken.sol/PendlePrincipalToken.json +0 -452
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +0 -783
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol/PendleBenQiErc20SCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol/PendleBenQiErc20SCY.json +0 -766
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol/PendleBtrflyScy.json +0 -641
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleStETHSCY.sol/PendleStEthSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleStETHSCY.sol/PendleStEthSCY.json +0 -623
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol/PendleYearnVaultScy.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol/PendleYearnVaultScy.json +0 -623
- package/build/artifacts/contracts/core/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +0 -339
- package/build/artifacts/contracts/core/PendleYieldToken.sol/PendleYieldToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleYieldToken.sol/PendleYieldToken.json +0 -808
- package/build/artifacts/contracts/core/RouterStatic.sol/RouterStatic.dbg.json +0 -4
- package/build/artifacts/contracts/core/RouterStatic.sol/RouterStatic.json +0 -862
- package/build/artifacts/contracts/core/actions/ActionRedeem.sol/ActionRedeem.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionRedeem.sol/ActionRedeem.json +0 -55
- package/build/artifacts/contracts/core/actions/base/ActionType.sol/ActionType.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPActionRedeem.sol/IPActionRedeem.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPActionRedeem.sol/IPActionRedeem.json +0 -55
- package/build/artifacts/contracts/interfaces/IPBaseToken.sol/IPBaseToken.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPendleGauge.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPendleGauge.json +0 -113
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IVePToken.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IVePToken.json +0 -43
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IVotingEscrowPendle.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/VotingEscrowController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/VotingEscrowController.json +0 -61
- package/build/artifacts/contracts/interfaces/IPendleGauge.sol/IPendleGauge.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPendleGauge.sol/IPendleGauge.json +0 -113
- package/build/artifacts/contracts/interfaces/IVePToken.sol/IVePToken.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IVotingEscrowController.sol/VotingEscrowController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IVotingEscrowController.sol/VotingEscrowController.json +0 -61
- package/build/artifacts/contracts/interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.json +0 -167
- package/build/artifacts/contracts/libraries/JoeLibrary.sol/JoeLibrary.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/SCYIndex.sol/SCYIndexLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/MarketMathAux.sol/MarketMathAux.dbg.json +0 -4
- package/build/artifacts/contracts/periphery/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +0 -4
- package/contracts/SuperComposableYield/ISuperComposableYield.sol +0 -80
- package/contracts/SuperComposableYield/SCYUtils.sol +0 -14
- package/contracts/SuperComposableYield/implementations/IRewardManager.sol +0 -16
- package/contracts/SuperComposableYield/implementations/RewardManager.sol +0 -151
- package/contracts/SuperComposableYield/implementations/SCYBase.sol +0 -166
- package/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol +0 -88
- package/contracts/core/PendleBaseToken.sol +0 -35
- package/contracts/core/PendlePrincipalToken.sol +0 -54
- package/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol +0 -140
- package/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol +0 -133
- package/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol +0 -120
- package/contracts/core/PendleSCYImpl/PendleStETHSCY.sol +0 -107
- package/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol +0 -109
- package/contracts/core/PendleYieldToken.sol +0 -340
- package/contracts/core/actions/ActionRedeem.sol +0 -36
- package/contracts/core/actions/base/ActionType.sol +0 -11
- package/contracts/interfaces/IPActionRedeem.sol +0 -17
- package/contracts/interfaces/IPBaseToken.sol +0 -9
- package/contracts/interfaces/IPGauge.sol +0 -32
- package/contracts/interfaces/IPVotingEscrowController.sol +0 -14
- package/contracts/interfaces/IPendleGauge.sol +0 -32
- package/contracts/interfaces/IVePToken.sol +0 -14
- package/contracts/interfaces/IVotingEscrowController.sol +0 -14
- package/contracts/interfaces/IVotingEscrowPendle.sol +0 -32
- package/contracts/libraries/math/MarketMathAux.sol +0 -101
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
import "../../../interfaces/IPMarketFactory.sol";
|
|
5
5
|
import "../../../interfaces/IPMarket.sol";
|
|
6
6
|
import "../../../interfaces/IPMarketAddRemoveCallback.sol";
|
|
7
7
|
import "../../../interfaces/IPMarketSwapCallback.sol";
|
|
8
8
|
import "../../../libraries/math/MarketApproxLib.sol";
|
|
9
|
-
import "../../../libraries/math/MarketMathAux.sol";
|
|
10
9
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
10
|
+
import "./ActionSCYAndPYBase.sol";
|
|
11
11
|
|
|
12
|
-
abstract contract ActionSCYAndPTBase {
|
|
12
|
+
abstract contract ActionSCYAndPTBase is ActionSCYAndPYBase {
|
|
13
13
|
using Math for uint256;
|
|
14
14
|
using Math for int256;
|
|
15
15
|
using MarketMathCore for MarketState;
|
|
16
|
-
using MarketMathAux for MarketState;
|
|
17
16
|
using MarketApproxLib for MarketState;
|
|
18
17
|
using SafeERC20 for IERC20;
|
|
18
|
+
using SCYIndexLib for ISuperComposableYield;
|
|
19
|
+
|
|
20
|
+
bytes private constant EMPTY_BYTES = abi.encode();
|
|
19
21
|
|
|
20
22
|
/// @dev since this contract will be proxied, it must not contains non-immutable variables
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @dev inner working of this function:
|
|
26
|
-
- market.addLiquidity is called
|
|
27
|
-
- LP is minted to the receiver, and this router's addLiquidityCallback is invoked
|
|
28
|
-
- the router will transfer the necessary scy & pt from msg.sender to the market, and finish the callback
|
|
29
|
-
*/
|
|
24
|
+
/// @dev For doPull: if doPull is true, this function will do transferFrom as necessary from msg.sender. Else, it will
|
|
25
|
+
/// assume tokens have already been transferred in.
|
|
26
|
+
|
|
30
27
|
function _addLiquidity(
|
|
31
28
|
address receiver,
|
|
32
29
|
address market,
|
|
@@ -46,12 +43,13 @@ abstract contract ActionSCYAndPTBase {
|
|
|
46
43
|
|
|
47
44
|
MarketState memory state = IPMarket(market).readState(false);
|
|
48
45
|
(, netLpOut, scyUsed, ptUsed) = state.addLiquidity(
|
|
49
|
-
|
|
46
|
+
SCY.newIndex(),
|
|
50
47
|
scyDesired,
|
|
51
48
|
ptDesired,
|
|
52
49
|
false
|
|
53
50
|
);
|
|
54
51
|
|
|
52
|
+
// early-check
|
|
55
53
|
require(netLpOut >= minLpOut, "insufficient lp out");
|
|
56
54
|
|
|
57
55
|
if (doPull) {
|
|
@@ -59,17 +57,17 @@ abstract contract ActionSCYAndPTBase {
|
|
|
59
57
|
IERC20(PT).safeTransferFrom(msg.sender, market, ptUsed);
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
(netLpOut, , ) = IPMarket(market).addLiquidity(
|
|
61
|
+
receiver,
|
|
62
|
+
ptDesired,
|
|
63
|
+
scyDesired,
|
|
64
|
+
EMPTY_BYTES
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// fail-safe
|
|
68
|
+
require(netLpOut >= minLpOut, "FS insufficient lp out");
|
|
63
69
|
}
|
|
64
70
|
|
|
65
|
-
/**
|
|
66
|
-
* @notice removeLiquidity from the market to receive both SCY & PT. The receiver will receive
|
|
67
|
-
SCY & PT before msg.sender is required to transfer in the necessary LP
|
|
68
|
-
* @dev inner working of this function:
|
|
69
|
-
- market.removeLiquidity is called
|
|
70
|
-
- SCY & PT is transferred to the receiver, and the router's callback is invoked
|
|
71
|
-
- the router will transfer the necessary LP from msg.sender to the market, and finish the callback
|
|
72
|
-
*/
|
|
73
71
|
function _removeLiquidity(
|
|
74
72
|
address receiver,
|
|
75
73
|
address market,
|
|
@@ -81,24 +79,27 @@ abstract contract ActionSCYAndPTBase {
|
|
|
81
79
|
MarketState memory state = IPMarket(market).readState(false);
|
|
82
80
|
|
|
83
81
|
(netScyOut, netPtOut) = state.removeLiquidity(lpToRemove, false);
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
|
|
83
|
+
// early-check
|
|
84
|
+
require(netScyOut >= scyOutMin, "insufficient SCY out");
|
|
85
|
+
require(netPtOut >= ptOutMin, "insufficient PT out");
|
|
86
86
|
|
|
87
87
|
if (doPull) {
|
|
88
88
|
IERC20(market).safeTransferFrom(msg.sender, market, lpToRemove);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
IPMarket(market).removeLiquidity(
|
|
91
|
+
(netScyOut, netPtOut) = IPMarket(market).removeLiquidity(
|
|
92
|
+
receiver,
|
|
93
|
+
receiver,
|
|
94
|
+
lpToRemove,
|
|
95
|
+
EMPTY_BYTES
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// fail-safe
|
|
99
|
+
require(netScyOut >= scyOutMin, "FS insufficient SCY out");
|
|
100
|
+
require(netPtOut >= ptOutMin, "FS insufficient PT out");
|
|
92
101
|
}
|
|
93
102
|
|
|
94
|
-
/**
|
|
95
|
-
* @notice swap exact PT for SCY, with receiver receiving SCY before msg.sender is required to
|
|
96
|
-
transfer the owed PT
|
|
97
|
-
* @dev inner working of this function:
|
|
98
|
-
- market.swap is called
|
|
99
|
-
- SCY is transferred to the receiver, and the router's callback is invoked
|
|
100
|
-
- the router will transfer the necessary PT from msg.sender to the market, and finish the callback
|
|
101
|
-
*/
|
|
102
103
|
function _swapExactPtForScy(
|
|
103
104
|
address receiver,
|
|
104
105
|
address market,
|
|
@@ -107,58 +108,48 @@ abstract contract ActionSCYAndPTBase {
|
|
|
107
108
|
bool doPull
|
|
108
109
|
) internal returns (uint256 netScyOut) {
|
|
109
110
|
if (doPull) {
|
|
110
|
-
|
|
111
|
-
IERC20(PT).safeTransferFrom(msg.sender, market, exactPtIn);
|
|
111
|
+
(, IPPrincipalToken PT, ) = IPMarket(market).readTokens();
|
|
112
|
+
IERC20(address(PT)).safeTransferFrom(msg.sender, market, exactPtIn);
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
(netScyOut, ) = IPMarket(market).swapExactPtForScy(
|
|
115
|
-
receiver,
|
|
116
|
-
exactPtIn,
|
|
117
|
-
minScyOut,
|
|
118
|
-
abi.encode()
|
|
119
|
-
);
|
|
115
|
+
(netScyOut, ) = IPMarket(market).swapExactPtForScy(receiver, exactPtIn, EMPTY_BYTES);
|
|
120
116
|
|
|
121
|
-
require(netScyOut >= minScyOut, "insufficient
|
|
117
|
+
require(netScyOut >= minScyOut, "insufficient SCY out");
|
|
122
118
|
}
|
|
123
119
|
|
|
124
120
|
/**
|
|
125
|
-
* @notice
|
|
126
|
-
|
|
127
|
-
* @dev inner working of this function is similar to swapExactPtForScy
|
|
128
|
-
* @param approx params to approx. Guess params will be the min, max & offchain guess for netPtIn
|
|
121
|
+
* @notice Note that the amount of SCY out will be a bit more than `exactScyOut`, since an approximation is used. It's
|
|
122
|
+
guaranteed that the `netScyOut` is at least `exactScyOut`
|
|
129
123
|
*/
|
|
130
124
|
function _swapPtForExactScy(
|
|
131
125
|
address receiver,
|
|
132
126
|
address market,
|
|
133
127
|
uint256 exactScyOut,
|
|
134
|
-
|
|
128
|
+
uint256 maxPtIn,
|
|
129
|
+
ApproxParams memory guessPtIn,
|
|
135
130
|
bool doPull
|
|
136
131
|
) internal returns (uint256 netPtIn) {
|
|
137
132
|
MarketState memory state = IPMarket(market).readState(false);
|
|
138
133
|
(ISuperComposableYield SCY, IPPrincipalToken PT, ) = IPMarket(market).readTokens();
|
|
139
134
|
|
|
140
135
|
(netPtIn, ) = state.approxSwapPtForExactScy(
|
|
141
|
-
|
|
136
|
+
SCY.newIndex(),
|
|
142
137
|
exactScyOut,
|
|
143
138
|
block.timestamp,
|
|
144
|
-
|
|
139
|
+
guessPtIn
|
|
145
140
|
);
|
|
141
|
+
require(netPtIn <= maxPtIn, "exceed limit PT in");
|
|
146
142
|
|
|
147
143
|
if (doPull) {
|
|
148
144
|
IERC20(PT).safeTransferFrom(msg.sender, market, netPtIn);
|
|
149
145
|
}
|
|
150
146
|
|
|
151
|
-
IPMarket(market).swapExactPtForScy(receiver, netPtIn,
|
|
147
|
+
(uint256 netScyOut, ) = IPMarket(market).swapExactPtForScy(receiver, netPtIn, EMPTY_BYTES);
|
|
148
|
+
|
|
149
|
+
// fail-safe
|
|
150
|
+
require(netScyOut >= exactScyOut, "FS insufficient SCY out");
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
/**
|
|
155
|
-
* @notice swap SCY for exact PT, with receiver receiving PT before msg.sender is required to
|
|
156
|
-
transfer the owed SCY
|
|
157
|
-
* @dev inner working of this function:
|
|
158
|
-
- market.swap is called
|
|
159
|
-
- PT is transferred to the receiver, and the router's callback is invoked
|
|
160
|
-
- the router will transfer the necessary SCY from msg.sender to the market, and finish the callback
|
|
161
|
-
*/
|
|
162
153
|
function _swapScyForExactPt(
|
|
163
154
|
address receiver,
|
|
164
155
|
address market,
|
|
@@ -167,52 +158,116 @@ abstract contract ActionSCYAndPTBase {
|
|
|
167
158
|
bool doPull
|
|
168
159
|
) internal returns (uint256 netScyIn) {
|
|
169
160
|
MarketState memory state = IPMarket(market).readState(false);
|
|
170
|
-
|
|
161
|
+
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
171
162
|
|
|
172
|
-
(netScyIn, ) = state.swapScyForExactPt(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
block.timestamp,
|
|
176
|
-
false
|
|
177
|
-
);
|
|
178
|
-
require(netScyIn <= maxScyIn, "exceed limit scy in");
|
|
163
|
+
(netScyIn, ) = state.swapScyForExactPt(SCY.newIndex(), exactPtOut, block.timestamp);
|
|
164
|
+
|
|
165
|
+
require(netScyIn <= maxScyIn, "exceed limit SCY in");
|
|
179
166
|
|
|
180
167
|
if (doPull) {
|
|
181
168
|
IERC20(SCY).safeTransferFrom(msg.sender, market, netScyIn);
|
|
182
169
|
}
|
|
183
170
|
|
|
184
|
-
IPMarket(market).swapScyForExactPt(receiver, exactPtOut,
|
|
171
|
+
IPMarket(market).swapScyForExactPt(receiver, exactPtOut, EMPTY_BYTES); // ignore return
|
|
172
|
+
|
|
173
|
+
// no fail-safe since exactly netScyIn will go into the market
|
|
185
174
|
}
|
|
186
175
|
|
|
187
176
|
/**
|
|
188
|
-
* @
|
|
189
|
-
|
|
190
|
-
- The outcome amount of PT in is approximated
|
|
191
|
-
- market.swapExactPtToScy() is called, user will receive their PT
|
|
192
|
-
- The approximated amount of PT is transferred from msg.sender to market via router
|
|
193
|
-
* @param approx params to approx. Guess params will be the min, max & offchain guess for netPtOut
|
|
177
|
+
* @notice Note that although we will only use almost all of the `exactScyIn`, we will still transfer all in so that
|
|
178
|
+
not to leave dust behind
|
|
194
179
|
*/
|
|
195
180
|
function _swapExactScyForPt(
|
|
196
181
|
address receiver,
|
|
197
182
|
address market,
|
|
198
183
|
uint256 exactScyIn,
|
|
199
|
-
|
|
184
|
+
uint256 minPtOut,
|
|
185
|
+
ApproxParams memory guessPtOut,
|
|
200
186
|
bool doPull
|
|
201
187
|
) internal returns (uint256 netPtOut) {
|
|
202
188
|
MarketState memory state = IPMarket(market).readState(false);
|
|
203
|
-
|
|
189
|
+
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
204
190
|
|
|
205
191
|
(netPtOut, ) = state.approxSwapExactScyForPt(
|
|
206
|
-
|
|
192
|
+
SCY.newIndex(),
|
|
207
193
|
exactScyIn,
|
|
208
194
|
block.timestamp,
|
|
209
|
-
|
|
195
|
+
guessPtOut
|
|
210
196
|
);
|
|
211
197
|
|
|
198
|
+
require(netPtOut >= minPtOut, "insufficient PT out");
|
|
199
|
+
|
|
212
200
|
if (doPull) {
|
|
213
201
|
IERC20(SCY).safeTransferFrom(msg.sender, market, exactScyIn);
|
|
214
202
|
}
|
|
215
203
|
|
|
216
|
-
IPMarket(market).swapScyForExactPt(receiver, netPtOut,
|
|
204
|
+
IPMarket(market).swapScyForExactPt(receiver, netPtOut, EMPTY_BYTES); // ignore return
|
|
205
|
+
|
|
206
|
+
// no fail-safe since exactly netPtOut >= minPtOut will be out
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @notice swap from any ERC20 tokens, through Uniswap's forks, to get baseTokens to make SCY, then swap
|
|
211
|
+
from SCY to PT
|
|
212
|
+
* @dev simply a combination of _mintScyFromRawToken & _swapExactScyForPt
|
|
213
|
+
*/
|
|
214
|
+
function _swapExactRawTokenForPt(
|
|
215
|
+
address receiver,
|
|
216
|
+
address market,
|
|
217
|
+
uint256 exactRawTokenIn,
|
|
218
|
+
uint256 minPtOut,
|
|
219
|
+
address[] calldata path,
|
|
220
|
+
ApproxParams memory guessPtOut,
|
|
221
|
+
bool doPull
|
|
222
|
+
) internal returns (uint256 netPtOut) {
|
|
223
|
+
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
224
|
+
|
|
225
|
+
// all output SCY is transferred directly to the market
|
|
226
|
+
uint256 netScyUseToBuyPt = _mintScyFromRawToken(
|
|
227
|
+
market,
|
|
228
|
+
address(SCY),
|
|
229
|
+
exactRawTokenIn,
|
|
230
|
+
1,
|
|
231
|
+
path,
|
|
232
|
+
doPull
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
// SCY is already in the market, hence doPull = false
|
|
236
|
+
netPtOut = _swapExactScyForPt(
|
|
237
|
+
receiver,
|
|
238
|
+
market,
|
|
239
|
+
netScyUseToBuyPt,
|
|
240
|
+
minPtOut,
|
|
241
|
+
guessPtOut,
|
|
242
|
+
false
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @notice swap from PT to SCY, then redeem SCY to baseToken & swap through Uniswap's forks to get rawTokenOut
|
|
248
|
+
* @dev simply a combination of _swapExactPtForScy & _redeemScyToRawToken
|
|
249
|
+
*/
|
|
250
|
+
function _swapExactPtForRawToken(
|
|
251
|
+
address receiver,
|
|
252
|
+
address market,
|
|
253
|
+
uint256 exactPtIn,
|
|
254
|
+
uint256 minRawTokenOut,
|
|
255
|
+
address[] calldata path,
|
|
256
|
+
bool doPull
|
|
257
|
+
) internal returns (uint256 netRawTokenOut) {
|
|
258
|
+
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
259
|
+
|
|
260
|
+
// all output SCY is directly transferred to the SCY contract
|
|
261
|
+
_swapExactPtForScy(address(SCY), market, exactPtIn, 1, doPull);
|
|
262
|
+
|
|
263
|
+
// since all SCY is already at the SCY contract, doPull = false
|
|
264
|
+
netRawTokenOut = _redeemScyToRawToken(
|
|
265
|
+
receiver,
|
|
266
|
+
address(SCY),
|
|
267
|
+
0,
|
|
268
|
+
minRawTokenOut,
|
|
269
|
+
path,
|
|
270
|
+
false
|
|
271
|
+
);
|
|
217
272
|
}
|
|
218
273
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
5
|
-
import "../../../
|
|
6
|
-
import "../../../
|
|
5
|
+
import "../../../libraries/traderjoe/PendleJoeSwapHelperUpg.sol";
|
|
6
|
+
import "../../../libraries/helpers/MiniHelpers.sol";
|
|
7
|
+
import "../../../interfaces/ISuperComposableYield.sol";
|
|
7
8
|
import "../../../interfaces/IPYieldToken.sol";
|
|
8
9
|
|
|
9
10
|
// solhint-disable no-empty-blocks
|
|
@@ -43,24 +44,19 @@ abstract contract ActionSCYAndPYBase is PendleJoeSwapHelperUpg {
|
|
|
43
44
|
);
|
|
44
45
|
|
|
45
46
|
/// @dev since this contract will be proxied, it must not contains non-immutable variables
|
|
46
|
-
constructor(address
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
constructor(address _joeFactory) PendleJoeSwapHelperUpg(_joeFactory) {}
|
|
48
|
+
|
|
49
|
+
/// @dev for Path. If no swap is needed, path = [token]
|
|
50
|
+
/// else, path = [inputToken, token0, token1, ...., outputToken]
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
|
-
* @notice swap rawToken to baseToken
|
|
52
|
-
* @param path the path to swap from rawToken to baseToken. path = [baseToken] if no swap is needed
|
|
53
|
-
* @dev inner working of this function:
|
|
54
|
-
- if [rawToken == baseToken], rawToken is transferred to SCY contract
|
|
55
|
-
else, it is transferred to the first pair of path, swap is called, and the output token is transferred
|
|
56
|
-
to SCY contract
|
|
57
|
-
- SCY.mint is called, minting SCY directly to receiver
|
|
53
|
+
* @notice swap rawToken to baseToken through Uniswap's forks & use it to mint SCY
|
|
58
54
|
*/
|
|
59
55
|
function _mintScyFromRawToken(
|
|
60
|
-
|
|
56
|
+
address receiver,
|
|
61
57
|
address SCY,
|
|
58
|
+
uint256 netRawTokenIn,
|
|
62
59
|
uint256 minScyOut,
|
|
63
|
-
address receiver,
|
|
64
60
|
address[] calldata path,
|
|
65
61
|
bool doPull
|
|
66
62
|
) internal returns (uint256 netScyOut) {
|
|
@@ -74,26 +70,18 @@ abstract contract ActionSCYAndPYBase is PendleJoeSwapHelperUpg {
|
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
address baseToken = path[path.length - 1];
|
|
77
|
-
netScyOut = ISuperComposableYield(SCY).
|
|
73
|
+
netScyOut = ISuperComposableYield(SCY).deposit(receiver, baseToken, 0, minScyOut);
|
|
78
74
|
emit MintScyFromRawToken(msg.sender, path[0], netRawTokenIn, SCY, netScyOut);
|
|
79
75
|
}
|
|
80
76
|
|
|
81
77
|
/**
|
|
82
|
-
|
|
83
|
-
* @dev path[0] will be the baseToken that SCY is redeemed to, and path[path.length-1] is the
|
|
84
|
-
final rawToken output
|
|
85
|
-
* @param path the path to swap from rawToken to baseToken. path = [baseToken] if no swap is needed
|
|
86
|
-
* @dev inner working of this function:
|
|
87
|
-
- SCY is transferred to SCY contract
|
|
88
|
-
- if [rawToken == baseToken], SCY.redeem is called & directly redeem tokens to the receiver
|
|
89
|
-
else, SCY.redeem is called with receiver = first pair in the path,
|
|
90
|
-
and swap is called, and the output token is transferred to receiver
|
|
78
|
+
* @notice redeem SCY to baseToken -> swap baseToken to rawToken through Uniswap's forks
|
|
91
79
|
*/
|
|
92
80
|
function _redeemScyToRawToken(
|
|
81
|
+
address receiver,
|
|
93
82
|
address SCY,
|
|
94
83
|
uint256 netScyIn,
|
|
95
84
|
uint256 minRawTokenOut,
|
|
96
|
-
address receiver,
|
|
97
85
|
address[] memory path,
|
|
98
86
|
bool doPull
|
|
99
87
|
) internal returns (uint256 netRawTokenOut) {
|
|
@@ -103,14 +91,16 @@ abstract contract ActionSCYAndPYBase is PendleJoeSwapHelperUpg {
|
|
|
103
91
|
|
|
104
92
|
address baseToken = path[0];
|
|
105
93
|
if (path.length == 1) {
|
|
106
|
-
netRawTokenOut = ISuperComposableYield(SCY).
|
|
94
|
+
netRawTokenOut = ISuperComposableYield(SCY).redeem(
|
|
107
95
|
receiver,
|
|
96
|
+
0,
|
|
108
97
|
baseToken,
|
|
109
98
|
minRawTokenOut
|
|
110
99
|
);
|
|
111
100
|
} else {
|
|
112
|
-
uint256 netBaseTokenOut = ISuperComposableYield(SCY).
|
|
101
|
+
uint256 netBaseTokenOut = ISuperComposableYield(SCY).redeem(
|
|
113
102
|
_getFirstPair(path),
|
|
103
|
+
0,
|
|
114
104
|
baseToken,
|
|
115
105
|
1
|
|
116
106
|
);
|
|
@@ -122,40 +112,35 @@ abstract contract ActionSCYAndPYBase is PendleJoeSwapHelperUpg {
|
|
|
122
112
|
}
|
|
123
113
|
|
|
124
114
|
/**
|
|
125
|
-
* @notice swap rawToken to baseToken -> convert to SCY -> convert to PT + YT
|
|
126
|
-
* @param path the path to swap from rawToken to baseToken. path = [baseToken] if no swap is needed
|
|
127
|
-
* @dev inner working of this function:
|
|
128
|
-
- same as mintScyFromRawToken, except the receiver of SCY will be the YT contract, then mintPY
|
|
129
|
-
will be called, minting PT + YT directly to receiver
|
|
115
|
+
* @notice swap rawToken to baseToken through Uniswap's forks -> convert to SCY -> convert to PT + YT
|
|
130
116
|
*/
|
|
131
117
|
function _mintPyFromRawToken(
|
|
132
|
-
|
|
118
|
+
address receiver,
|
|
133
119
|
address YT,
|
|
120
|
+
uint256 netRawTokenIn,
|
|
134
121
|
uint256 minPyOut,
|
|
135
|
-
address receiver,
|
|
136
122
|
address[] calldata path,
|
|
137
123
|
bool doPull
|
|
138
124
|
) internal returns (uint256 netPyOut) {
|
|
139
125
|
address SCY = IPYieldToken(YT).SCY();
|
|
140
|
-
|
|
126
|
+
|
|
127
|
+
_mintScyFromRawToken(YT, SCY, netRawTokenIn, 1, path, doPull);
|
|
128
|
+
|
|
141
129
|
netPyOut = IPYieldToken(YT).mintPY(receiver, receiver);
|
|
142
130
|
require(netPyOut >= minPyOut, "insufficient PY out");
|
|
131
|
+
|
|
143
132
|
emit MintPyFromRawToken(msg.sender, path[0], netRawTokenIn, YT, netPyOut);
|
|
144
133
|
}
|
|
145
134
|
|
|
146
135
|
/**
|
|
147
|
-
* @notice redeem PT + YT to SCY -> redeem SCY to baseToken -> swap baseToken to rawToken
|
|
148
|
-
|
|
149
|
-
* @dev inner working of this function:
|
|
150
|
-
- PT (+ YT if not expired) is transferred to the YT contract
|
|
151
|
-
- redeemPY is called, redeem all outcome SCY to the SCY contract
|
|
152
|
-
- The rest is the same as redeemScyToRawToken (except the first SCY transfer is skipped)
|
|
136
|
+
* @notice redeem PT + YT to SCY -> redeem SCY to baseToken -> swap baseToken to rawToken through Uniswap's forks.
|
|
137
|
+
If the YT hasn't expired, both PT & YT will be needed to redeem. Else, only PT is needed
|
|
153
138
|
*/
|
|
154
139
|
function _redeemPyToRawToken(
|
|
140
|
+
address receiver,
|
|
155
141
|
address YT,
|
|
156
142
|
uint256 netPyIn,
|
|
157
143
|
uint256 minRawTokenOut,
|
|
158
|
-
address receiver,
|
|
159
144
|
address[] memory path,
|
|
160
145
|
bool doPull
|
|
161
146
|
) internal returns (uint256 netRawTokenOut) {
|
|
@@ -163,14 +148,14 @@ abstract contract ActionSCYAndPYBase is PendleJoeSwapHelperUpg {
|
|
|
163
148
|
address SCY = IPYieldToken(YT).SCY();
|
|
164
149
|
|
|
165
150
|
if (doPull) {
|
|
166
|
-
bool
|
|
151
|
+
bool needToBurnYt = (!IPYieldToken(YT).isExpired());
|
|
167
152
|
IERC20(PT).safeTransferFrom(msg.sender, YT, netPyIn);
|
|
168
|
-
if (
|
|
153
|
+
if (needToBurnYt) IERC20(YT).safeTransferFrom(msg.sender, YT, netPyIn);
|
|
169
154
|
}
|
|
170
155
|
|
|
171
156
|
IPYieldToken(YT).redeemPY(SCY); // ignore return
|
|
172
157
|
|
|
173
|
-
netRawTokenOut = _redeemScyToRawToken(SCY, 0, minRawTokenOut,
|
|
158
|
+
netRawTokenOut = _redeemScyToRawToken(receiver, SCY, 0, minRawTokenOut, path, false);
|
|
174
159
|
|
|
175
160
|
emit RedeemPyToRawToken(msg.sender, YT, netPyIn, path[path.length - 1], netRawTokenOut);
|
|
176
161
|
}
|