@pendle/core-v2 0.6.9 → 0.7.1-beta
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 +714 -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 +737 -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 +225 -225
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.json +128 -0
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations/RewardManager.sol/RewardManager.json → core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json} +34 -38
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +193 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.json +255 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.json +318 -0
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +4 -0
- package/build/artifacts/contracts/{interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.json → core/LiquidityMining/PendleGauge.sol/PendleGauge.json} +40 -72
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +776 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +309 -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 +519 -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/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.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 +898 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +351 -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/InterestManagerYT.sol/InterestManagerYT.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.json +35 -0
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +378 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +352 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +732 -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 +135 -0
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.json +158 -0
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.json +35 -0
- 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/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.json +2 -2
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +37 -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 +13 -0
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +61 -5
- 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 +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.json +70 -89
- 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 +156 -106
- 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/interfaces/IRewardManager.sol/IRewardManager.json +40 -0
- 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/IRewardManager.sol/IRewardManager.json → libraries/RewardManager.sol/RewardManager.json} +30 -30
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.json +40 -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/VeHistoryLib.sol/Checkpoints.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +10 -0
- 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/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/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.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/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/{periphery → libraries/traderjoe}/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.json +1 -14
- 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/CelerReceiverUpg.sol +53 -0
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +59 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +146 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol +33 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol +26 -0
- package/contracts/core/LiquidityMining/PendleGauge.sol +118 -0
- package/contracts/core/LiquidityMining/README.md +63 -0
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +336 -0
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +228 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +245 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +73 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +52 -0
- package/contracts/core/{PendleMarket.sol → Market/PendleMarket.sol} +135 -100
- package/contracts/core/{PendleMarketFactory.sol → Market/PendleMarketFactory.sol} +60 -20
- 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 +60 -0
- package/contracts/core/{PendleYieldContractFactory.sol → YieldContracts/PendleYieldContractFactory.sol} +43 -23
- package/contracts/core/YieldContracts/PendleYieldToken.sol +349 -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 +28 -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 +14 -2
- package/contracts/interfaces/IPMarketSwapCallback.sol +1 -1
- package/contracts/interfaces/IPPermissionsV2Upg.sol +1 -1
- package/contracts/interfaces/IPPrincipalToken.sol +11 -5
- package/contracts/interfaces/IPRouterStatic.sol +1 -1
- package/contracts/interfaces/IPVeToken.sol +9 -4
- 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 +28 -18
- 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 +85 -0
- package/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol} +8 -8
- package/contracts/libraries/SCY/SCYUtils.sol +18 -0
- package/contracts/libraries/VeBalanceLib.sol +80 -0
- package/contracts/libraries/VeHistoryLib.sol +60 -0
- package/contracts/libraries/helpers/ArrayLib.sol +65 -0
- package/contracts/libraries/helpers/ExpiryUtilsLib.sol +1 -1
- package/contracts/libraries/helpers/MiniHelpers.sol +15 -0
- package/contracts/libraries/helpers/SSTORE2Deployer.sol +30 -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/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 +25 -20
- package/contracts/periphery/PendleGovernanceManager.sol +1 -1
- package/contracts/periphery/PermissionsV2Upg.sol +7 -1
- package/deployments/43113-benqi.json +6 -0
- package/deployments/43113-core.json +14 -0
- package/deployments/43113-markets/benqi-market.json +7 -0
- package/deployments/80001-benqi.json +6 -0
- package/deployments/80001-core.json +13 -0
- package/deployments/80001-markets/benqi-market.json +7 -0
- package/package.json +2 -2
- package/typechain-types/ActionCore.ts +169 -96
- package/typechain-types/{ActionSCYAndYOBase.ts → ActionSCYAndPTBase.ts} +54 -67
- package/typechain-types/ActionSCYAndPYBase.ts +0 -13
- package/typechain-types/ActionSCYAndYTBase.ts +8 -21
- package/typechain-types/ActionYT.ts +73 -64
- package/typechain-types/CelerReceiverUpg.ts +267 -0
- package/typechain-types/CelerSenderUpg.ts +216 -0
- package/typechain-types/{ERC20Burnable.ts → ERC20Permit.ts} +116 -68
- package/typechain-types/IAToken.ts +55 -0
- package/typechain-types/IBenQiComptroller.ts +13 -0
- package/typechain-types/{InterestRateModel.ts → IBenQiInterestRateModel.ts} +12 -28
- package/typechain-types/ICelerMessageBus.ts +134 -0
- package/typechain-types/{IMessageReceiverApp.ts → ICelerMessageReceiverApp.ts} +19 -9
- package/typechain-types/IERC20Permit.ts +175 -0
- package/typechain-types/{ERC20Premined.ts → IERC4626.ts} +103 -113
- 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/IPGaugeController.ts +254 -0
- package/typechain-types/IPGaugeControllerMainchain.ts +298 -0
- package/typechain-types/{IVePToken.ts → IPInterestManagerYT.ts} +38 -27
- package/typechain-types/IPMarket.ts +73 -74
- package/typechain-types/IPMarketAddRemoveCallback.ts +10 -10
- package/typechain-types/IPMarketFactory.ts +38 -4
- package/typechain-types/IPPrincipalToken.ts +13 -0
- package/typechain-types/IPVeToken.ts +103 -8
- package/typechain-types/IPVotingController.ts +179 -0
- package/typechain-types/IPVotingEscrow.ts +100 -180
- package/typechain-types/IPYieldToken.ts +227 -264
- package/typechain-types/{PendleBaseToken.ts → IQiAvax.ts} +183 -107
- package/typechain-types/IQiErc20.ts +171 -0
- package/typechain-types/IQiToken.ts +171 -0
- package/typechain-types/IRewardManager.ts +16 -86
- 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/{PermissionsV2.ts → InterestManagerYT.ts} +30 -14
- package/typechain-types/PendleAaveV3SCY.ts +331 -496
- package/typechain-types/PendleBtrflyScy.ts +287 -348
- package/typechain-types/{IPBaseToken.ts → PendleERC20.ts} +5 -31
- package/typechain-types/{ERC20PresetFixedSupply.ts → PendleERC20Permit.ts} +100 -130
- package/typechain-types/{LYTBaseWithRewards.ts → PendleERC4626SCY.ts} +311 -316
- package/typechain-types/PendleGauge.ts +83 -315
- package/typechain-types/PendleGaugeControllerBaseUpg.ts +346 -0
- package/typechain-types/PendleGaugeControllerMainchainUpg.ts +410 -0
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +524 -0
- package/typechain-types/{PendleYTLYTBenqi.ts → PendleJoeLpSCY.ts} +336 -362
- package/typechain-types/PendleJoeSwapHelperUpg.ts +0 -13
- package/typechain-types/PendleMarket.ts +229 -154
- package/typechain-types/PendleMarketFactory.ts +127 -20
- package/typechain-types/PendlePrincipalToken.ts +0 -106
- package/typechain-types/{PermlessAbstract.ts → PendleQiTokenHelper.ts} +5 -5
- package/typechain-types/{PendleBenQiErc20LYT.ts → PendleQiTokenSCY.ts} +359 -308
- package/typechain-types/PendleRouter.ts +0 -19
- package/typechain-types/PendleVotingControllerUpg.ts +1145 -0
- package/typechain-types/{PendleAaveV3LYT.ts → PendleWstEthSCY.ts} +325 -320
- package/typechain-types/{ILiquidYieldTokenWrap.ts → PendleYearnVaultSCY.ts} +314 -290
- package/typechain-types/PendleYieldContractFactory.ts +74 -27
- package/typechain-types/PendleYieldToken.ts +272 -496
- package/typechain-types/RewardManager.ts +44 -82
- package/typechain-types/{IGaugeController.ts → RewardManagerAbstract.ts} +41 -32
- package/typechain-types/RouterStatic.ts +5 -11
- package/typechain-types/SCYBase.ts +276 -335
- package/typechain-types/SCYBaseWithRewards.ts +337 -433
- package/typechain-types/VotingControllerStorageUpg.ts +467 -0
- package/typechain-types/VotingEscrowPendleMainchain.ts +819 -0
- package/typechain-types/VotingEscrowPendleSidechain.ts +546 -0
- package/typechain-types/VotingEscrowTokenBase.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/{ActionSCYAndYOBase__factory.ts → ActionSCYAndPTBase__factory.ts} +20 -33
- 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/{CrosschainReceiver__factory.ts → CelerReceiverUpg__factory.ts} +39 -83
- package/typechain-types/factories/{CrosschainSender__factory.ts → CelerSenderUpg__factory.ts} +34 -37
- package/typechain-types/factories/{PendleBaseToken__factory.ts → ERC20Permit__factory.ts} +72 -52
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IAToken__factory.ts +39 -0
- package/typechain-types/factories/IBenQiComptroller__factory.ts +13 -0
- package/typechain-types/factories/{InterestRateModel__factory.ts → IBenQiInterestRateModel__factory.ts} +12 -27
- package/typechain-types/factories/{PendleRouterBase__factory.ts → ICelerMessageBus__factory.ts} +29 -29
- package/typechain-types/factories/{IMessageReceiverApp__factory.ts → ICelerMessageReceiverApp__factory.ts} +19 -10
- package/typechain-types/factories/IERC20Permit__factory.ts +98 -0
- package/typechain-types/factories/{ERC20Burnable__factory.ts → IERC4626__factory.ts} +55 -49
- 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 +177 -0
- package/typechain-types/factories/{IPGauge__factory.ts → IPGaugeController__factory.ts} +77 -52
- package/typechain-types/factories/IPInterestManagerYT__factory.ts +50 -0
- package/typechain-types/factories/IPMarketAddRemoveCallback__factory.ts +2 -2
- package/typechain-types/factories/IPMarketFactory__factory.ts +37 -0
- package/typechain-types/factories/IPMarket__factory.ts +35 -54
- package/typechain-types/factories/IPPrincipalToken__factory.ts +13 -0
- package/typechain-types/factories/IPVeToken__factory.ts +61 -5
- package/typechain-types/factories/IPVotingController__factory.ts +182 -0
- package/typechain-types/factories/IPVotingEscrow__factory.ts +68 -87
- package/typechain-types/factories/IPYieldToken__factory.ts +156 -106
- package/typechain-types/factories/{IPOwnershipToken__factory.ts → IQiAvax__factory.ts} +73 -60
- 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 +8 -45
- 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/InterestManagerYT__factory.ts +50 -0
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +212 -318
- 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/{EIP20NonStandardInterface__factory.ts → PendleGaugeControllerBaseUpg__factory.ts} +90 -91
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +334 -0
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +393 -0
- package/typechain-types/factories/PendleGauge__factory.ts +32 -268
- 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 +91 -5
- package/typechain-types/factories/PendleMarket__factory.ts +158 -94
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -75
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +99 -0
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +821 -0
- package/typechain-types/factories/PendleRouter__factory.ts +1 -23
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +845 -0
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +686 -0
- package/typechain-types/factories/PendleYearnVaultSCY__factory.ts +691 -0
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +42 -29
- package/typechain-types/factories/PendleYieldToken__factory.ts +165 -241
- package/typechain-types/factories/{PendleRouterSCYAndForgeBaseUpg__factory.ts → RewardManagerAbstract__factory.ts} +22 -19
- package/typechain-types/factories/RewardManager__factory.ts +28 -41
- package/typechain-types/factories/RouterStatic__factory.ts +2 -2
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +220 -220
- package/typechain-types/factories/SCYBase__factory.ts +195 -176
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +328 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +588 -0
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +415 -0
- package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +157 -0
- package/typechain-types/hardhat.d.ts +308 -155
- package/typechain-types/index.ts +84 -50
- 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/IPGauge.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.json +0 -113
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/IPVotingEscrowController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/IPVotingEscrowController.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/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
- package/deployments/kovan.json +0 -31
- package/typechain-types/ActionRedeem.ts +0 -125
- package/typechain-types/AggregatorV2V3Interface.ts +0 -380
- package/typechain-types/BenqiChainlinkOracle.ts +0 -362
- package/typechain-types/BoringOwnable.ts +0 -194
- package/typechain-types/BoringOwnableData.ts +0 -100
- package/typechain-types/BoringOwnableUpg.ts +0 -194
- package/typechain-types/BoringOwnableUpgData.ts +0 -100
- package/typechain-types/Comptroller.ts +0 -2860
- package/typechain-types/ComptrollerErrorReporter.ts +0 -70
- package/typechain-types/ComptrollerInterface.ts +0 -881
- package/typechain-types/ComptrollerVXStorage.ts +0 -781
- package/typechain-types/CrosschainContract.ts +0 -113
- package/typechain-types/CrosschainReceiver.ts +0 -347
- package/typechain-types/CrosschainSender.ts +0 -210
- package/typechain-types/EIP20Interface.ts +0 -337
- package/typechain-types/EIP20NonStandardInterface.ts +0 -298
- package/typechain-types/ERC20Locker.ts +0 -91
- package/typechain-types/EpochController.ts +0 -195
- package/typechain-types/FundKeeper.ts +0 -347
- package/typechain-types/GaugeTypeControllerAbstract.ts +0 -546
- package/typechain-types/GaugeTypeControllerCrosschain.ts +0 -733
- package/typechain-types/GaugeTypeControllerMainchain.ts +0 -604
- package/typechain-types/ILiquidYieldToken.ts +0 -639
- package/typechain-types/IMessageBus.ts +0 -543
- package/typechain-types/IPActionRedeem.ts +0 -125
- package/typechain-types/IPFlashCallback.ts +0 -115
- package/typechain-types/IPGauge.ts +0 -241
- package/typechain-types/IPLiquidYieldToken.ts +0 -641
- package/typechain-types/IPMarketCallback.ts +0 -107
- package/typechain-types/IPOwnershipToken.ts +0 -488
- package/typechain-types/IPRouterCore.ts +0 -769
- package/typechain-types/IPRouterRedeem.ts +0 -155
- package/typechain-types/IPRouterYT.ts +0 -489
- package/typechain-types/IPVotingEscrowController.ts +0 -154
- package/typechain-types/IPendleGauge.ts +0 -241
- package/typechain-types/IPermissionsV2.ts +0 -87
- package/typechain-types/IRainbowBridge.ts +0 -91
- package/typechain-types/ISCYRewardIndex.ts +0 -695
- package/typechain-types/IVEPendleToken.ts +0 -121
- package/typechain-types/IVotingEscrowPendle.ts +0 -297
- package/typechain-types/IXPendle.ts +0 -114
- package/typechain-types/JumpRateModel.ts +0 -347
- package/typechain-types/LYTBase.ts +0 -721
- package/typechain-types/LYTWrap.ts +0 -872
- package/typechain-types/LYTWrapWithRewards.ts +0 -979
- package/typechain-types/LiquidityMining.ts +0 -468
- package/typechain-types/Maximillion.ts +0 -145
- package/typechain-types/Ownable.ts +0 -160
- package/typechain-types/PendleBenQiErc20SCY.ts +0 -1050
- package/typechain-types/PendleBenqiLiquidYieldToken.ts +0 -1013
- package/typechain-types/PendleBtrflyLYT.ts +0 -781
- package/typechain-types/PendleJoeSwapHelper.ts +0 -92
- package/typechain-types/PendleLYTMockYT.ts +0 -894
- package/typechain-types/PendleLiquidYieldToken.ts +0 -814
- package/typechain-types/PendleLiquidYieldTokenBase.ts +0 -941
- package/typechain-types/PendleOwnershipToken.ts +0 -598
- package/typechain-types/PendleRouter01.ts +0 -184
- package/typechain-types/PendleRouter02.ts +0 -564
- package/typechain-types/PendleRouter03.ts +0 -224
- package/typechain-types/PendleRouterBase.ts +0 -126
- package/typechain-types/PendleRouterCore.ts +0 -328
- package/typechain-types/PendleRouterCoreUpg.ts +0 -798
- package/typechain-types/PendleRouterLytAndForge.ts +0 -331
- package/typechain-types/PendleRouterMarketBase.ts +0 -82
- package/typechain-types/PendleRouterOT.ts +0 -463
- package/typechain-types/PendleRouterProxy.ts +0 -335
- package/typechain-types/PendleRouterRawTokenOT.ts +0 -865
- package/typechain-types/PendleRouterRawTokenYT.ts +0 -520
- package/typechain-types/PendleRouterRedeemUpg.ts +0 -125
- package/typechain-types/PendleRouterSCYAndForgeBaseUpg.ts +0 -98
- package/typechain-types/PendleRouterStaticUpg.ts +0 -399
- package/typechain-types/PendleRouterYT.ts +0 -227
- package/typechain-types/PendleRouterYTBaseUpg.ts +0 -134
- package/typechain-types/PendleRouterYTUpg.ts +0 -537
- package/typechain-types/PendleStEthSCY.ts +0 -872
- package/typechain-types/PendleYearnVaultLYT.ts +0 -723
- package/typechain-types/PendleYearnVaultScy.ts +0 -875
- package/typechain-types/PglStakingContract.ts +0 -662
- package/typechain-types/PglStakingContractProxy.ts +0 -256
- package/typechain-types/PglStakingContractProxyStorage.ts +0 -136
- package/typechain-types/PglStakingContractStorage.ts +0 -397
- package/typechain-types/PriceOracle.ts +0 -116
- package/typechain-types/ProtocolFakeUser.ts +0 -105
- package/typechain-types/Qi.ts +0 -760
- package/typechain-types/QiAvax.ts +0 -1720
- package/typechain-types/QiDelegateInterface.ts +0 -145
- package/typechain-types/QiDelegationStorage.ts +0 -82
- package/typechain-types/QiDelegatorInterface.ts +0 -149
- package/typechain-types/QiErc20.ts +0 -1846
- package/typechain-types/QiErc20Delegate.ts +0 -1926
- package/typechain-types/QiErc20Delegator.ts +0 -1885
- package/typechain-types/QiErc20Interface.ts +0 -382
- package/typechain-types/QiErc20Storage.ts +0 -79
- package/typechain-types/QiToken.ts +0 -1475
- package/typechain-types/QiTokenInterface.ts +0 -1419
- package/typechain-types/QiTokenSaleDistributor.ts +0 -771
- package/typechain-types/QiTokenSaleDistributorProxy.ts +0 -256
- package/typechain-types/QiTokenSaleDistributorProxyStorage.ts +0 -136
- package/typechain-types/QiTokenSaleDistributorStorage.ts +0 -401
- package/typechain-types/QiTokenStorage.ts +0 -311
- package/typechain-types/ReentrancyGuard.ts +0 -52
- package/typechain-types/SingleGaugeTypeController.ts +0 -478
- package/typechain-types/TokenErrorReporter.ts +0 -70
- package/typechain-types/Unitroller.ts +0 -356
- package/typechain-types/UnitrollerAdminStorage.ts +0 -143
- package/typechain-types/VePendle.ts +0 -1156
- package/typechain-types/VePendleCrosschain.ts +0 -969
- package/typechain-types/VePendleToken.ts +0 -688
- package/typechain-types/VotingController.ts +0 -883
- package/typechain-types/VotingEscrowController.ts +0 -154
- package/typechain-types/WETH9.ts +0 -414
- package/typechain-types/WhitePaperInterestRateModel.ts +0 -304
- package/typechain-types/XPendle.ts +0 -618
- package/typechain-types/factories/ActionRedeem__factory.ts +0 -105
- package/typechain-types/factories/AggregatorV2V3Interface__factory.ts +0 -288
- package/typechain-types/factories/BenqiChainlinkOracle__factory.ts +0 -311
- package/typechain-types/factories/BoringOwnableData__factory.ts +0 -90
- package/typechain-types/factories/BoringOwnableUpgData__factory.ts +0 -94
- package/typechain-types/factories/BoringOwnableUpg__factory.ts +0 -139
- package/typechain-types/factories/BoringOwnable__factory.ts +0 -149
- package/typechain-types/factories/ComptrollerErrorReporter__factory.ts +0 -93
- package/typechain-types/factories/ComptrollerInterface__factory.ts +0 -595
- package/typechain-types/factories/ComptrollerVXStorage__factory.ts +0 -610
- package/typechain-types/factories/Comptroller__factory.ts +0 -2189
- package/typechain-types/factories/CrosschainContract__factory.ts +0 -52
- package/typechain-types/factories/EIP20Interface__factory.ts +0 -248
- package/typechain-types/factories/ERC20Locker__factory.ts +0 -73
- package/typechain-types/factories/ERC20Premined__factory.ts +0 -393
- package/typechain-types/factories/ERC20PresetFixedSupply__factory.ts +0 -422
- package/typechain-types/factories/EpochController__factory.ts +0 -170
- package/typechain-types/factories/FundKeeper__factory.ts +0 -212
- package/typechain-types/factories/GaugeTypeControllerAbstract__factory.ts +0 -387
- package/typechain-types/factories/GaugeTypeControllerCrosschain__factory.ts +0 -522
- package/typechain-types/factories/GaugeTypeControllerMainchain__factory.ts +0 -431
- package/typechain-types/factories/IGaugeController__factory.ts +0 -45
- package/typechain-types/factories/ILiquidYieldTokenWrap__factory.ts +0 -533
- package/typechain-types/factories/ILiquidYieldToken__factory.ts +0 -429
- package/typechain-types/factories/IMessageBus__factory.ts +0 -396
- package/typechain-types/factories/IPActionRedeem__factory.ts +0 -70
- package/typechain-types/factories/IPBaseToken__factory.ts +0 -271
- package/typechain-types/factories/IPFlashCallback__factory.ts +0 -49
- package/typechain-types/factories/IPLiquidYieldToken__factory.ts +0 -433
- package/typechain-types/factories/IPMarketCallback__factory.ts +0 -55
- package/typechain-types/factories/IPRouterCore__factory.ts +0 -531
- package/typechain-types/factories/IPRouterRedeem__factory.ts +0 -72
- package/typechain-types/factories/IPRouterYT__factory.ts +0 -305
- package/typechain-types/factories/IPVotingEscrowController__factory.ts +0 -80
- package/typechain-types/factories/IPendleGauge__factory.ts +0 -125
- package/typechain-types/factories/IPermissionsV2__factory.ts +0 -39
- package/typechain-types/factories/IRainbowBridge__factory.ts +0 -76
- package/typechain-types/factories/ISCYRewardIndex__factory.ts +0 -465
- package/typechain-types/factories/IVEPendleToken__factory.ts +0 -71
- package/typechain-types/factories/IVePToken__factory.ts +0 -55
- package/typechain-types/factories/IVotingEscrowPendle__factory.ts +0 -182
- package/typechain-types/factories/IXPendle__factory.ts +0 -61
- package/typechain-types/factories/JumpRateModel__factory.ts +0 -334
- package/typechain-types/factories/LYTBaseWithRewards__factory.ts +0 -530
- package/typechain-types/factories/LYTBase__factory.ts +0 -474
- package/typechain-types/factories/LYTWrapWithRewards__factory.ts +0 -643
- package/typechain-types/factories/LYTWrap__factory.ts +0 -574
- package/typechain-types/factories/LiquidityMining__factory.ts +0 -367
- package/typechain-types/factories/Maximillion__factory.ts +0 -125
- package/typechain-types/factories/Ownable__factory.ts +0 -75
- package/typechain-types/factories/PendleAaveV3LYT__factory.ts +0 -657
- package/typechain-types/factories/PendleBenQiErc20LYT__factory.ts +0 -748
- package/typechain-types/factories/PendleBenQiErc20SCY__factory.ts +0 -871
- package/typechain-types/factories/PendleBenqiLiquidYieldToken__factory.ts +0 -785
- package/typechain-types/factories/PendleBtrflyLYT__factory.ts +0 -647
- package/typechain-types/factories/PendleJoeSwapHelper__factory.ts +0 -52
- package/typechain-types/factories/PendleLYTMockYT__factory.ts +0 -732
- package/typechain-types/factories/PendleLiquidYieldTokenBase__factory.ts +0 -603
- package/typechain-types/factories/PendleLiquidYieldToken__factory.ts +0 -510
- package/typechain-types/factories/PendleOwnershipToken__factory.ts +0 -527
- package/typechain-types/factories/PendleRouter01__factory.ts +0 -152
- package/typechain-types/factories/PendleRouter02__factory.ts +0 -438
- package/typechain-types/factories/PendleRouter03__factory.ts +0 -190
- package/typechain-types/factories/PendleRouterCoreUpg__factory.ts +0 -635
- package/typechain-types/factories/PendleRouterCore__factory.ts +0 -268
- package/typechain-types/factories/PendleRouterLytAndForge__factory.ts +0 -294
- package/typechain-types/factories/PendleRouterMarketBase__factory.ts +0 -43
- package/typechain-types/factories/PendleRouterOT__factory.ts +0 -372
- package/typechain-types/factories/PendleRouterProxy__factory.ts +0 -285
- package/typechain-types/factories/PendleRouterRawTokenOT__factory.ts +0 -697
- package/typechain-types/factories/PendleRouterRawTokenYT__factory.ts +0 -431
- package/typechain-types/factories/PendleRouterRedeemUpg__factory.ts +0 -112
- package/typechain-types/factories/PendleRouterStaticUpg__factory.ts +0 -315
- package/typechain-types/factories/PendleRouterYTBaseUpg__factory.ts +0 -66
- package/typechain-types/factories/PendleRouterYTUpg__factory.ts +0 -422
- package/typechain-types/factories/PendleRouterYT__factory.ts +0 -184
- package/typechain-types/factories/PendleStEthSCY__factory.ts +0 -716
- package/typechain-types/factories/PendleYTLYTBenqi__factory.ts +0 -713
- package/typechain-types/factories/PendleYearnVaultLYT__factory.ts +0 -586
- package/typechain-types/factories/PendleYearnVaultScy__factory.ts +0 -716
- package/typechain-types/factories/PermissionsV2__factory.ts +0 -36
- package/typechain-types/factories/PermlessAbstract__factory.ts +0 -30
- package/typechain-types/factories/PglStakingContractProxyStorage__factory.ts +0 -130
- package/typechain-types/factories/PglStakingContractProxy__factory.ts +0 -187
- package/typechain-types/factories/PglStakingContractStorage__factory.ts +0 -309
- package/typechain-types/factories/PglStakingContract__factory.ts +0 -446
- package/typechain-types/factories/PriceOracle__factory.ts +0 -59
- package/typechain-types/factories/ProtocolFakeUser__factory.ts +0 -87
- package/typechain-types/factories/QiAvax__factory.ts +0 -1471
- package/typechain-types/factories/QiDelegateInterface__factory.ts +0 -65
- package/typechain-types/factories/QiDelegationStorage__factory.ts +0 -79
- package/typechain-types/factories/QiDelegatorInterface__factory.ts +0 -89
- package/typechain-types/factories/QiErc20Delegate__factory.ts +0 -1563
- package/typechain-types/factories/QiErc20Delegator__factory.ts +0 -1648
- package/typechain-types/factories/QiErc20Interface__factory.ts +0 -239
- package/typechain-types/factories/QiErc20Storage__factory.ts +0 -79
- package/typechain-types/factories/QiErc20__factory.ts +0 -1515
- package/typechain-types/factories/QiTokenInterface__factory.ts +0 -1182
- package/typechain-types/factories/QiTokenSaleDistributorProxyStorage__factory.ts +0 -124
- package/typechain-types/factories/QiTokenSaleDistributorProxy__factory.ts +0 -171
- package/typechain-types/factories/QiTokenSaleDistributorStorage__factory.ts +0 -289
- package/typechain-types/factories/QiTokenSaleDistributor__factory.ts +0 -480
- package/typechain-types/factories/QiTokenStorage__factory.ts +0 -274
- package/typechain-types/factories/QiToken__factory.ts +0 -1219
- package/typechain-types/factories/Qi__factory.ts +0 -648
- package/typechain-types/factories/ReentrancyGuard__factory.ts +0 -69
- package/typechain-types/factories/SingleGaugeTypeController__factory.ts +0 -341
- package/typechain-types/factories/TokenErrorReporter__factory.ts +0 -89
- package/typechain-types/factories/UnitrollerAdminStorage__factory.ts +0 -128
- package/typechain-types/factories/Unitroller__factory.ts +0 -305
- package/typechain-types/factories/VePendleCrosschain__factory.ts +0 -727
- package/typechain-types/factories/VePendleToken__factory.ts +0 -494
- package/typechain-types/factories/VePendle__factory.ts +0 -800
- package/typechain-types/factories/VotingController__factory.ts +0 -610
- package/typechain-types/factories/VotingEscrowController__factory.ts +0 -80
- package/typechain-types/factories/WETH9__factory.ts +0 -342
- package/typechain-types/factories/WhitePaperInterestRateModel__factory.ts +0 -281
- package/typechain-types/factories/XPendle__factory.ts +0 -473
|
@@ -21,27 +21,39 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
pragma solidity 0.8.
|
|
24
|
+
pragma solidity 0.8.15;
|
|
25
|
+
|
|
26
|
+
import "../../interfaces/IPYieldContractFactory.sol";
|
|
25
27
|
|
|
26
28
|
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
27
29
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
28
|
-
|
|
29
|
-
import "
|
|
30
|
-
import "
|
|
30
|
+
|
|
31
|
+
import "../../libraries/helpers/ExpiryUtilsLib.sol";
|
|
32
|
+
import "../../libraries/helpers/SSTORE2Deployer.sol";
|
|
33
|
+
import "../../libraries/helpers/MiniHelpers.sol";
|
|
34
|
+
|
|
35
|
+
import "../../periphery/PermissionsV2Upg.sol";
|
|
31
36
|
|
|
32
37
|
import "./PendlePrincipalToken.sol";
|
|
33
38
|
import "./PendleYieldToken.sol";
|
|
34
39
|
|
|
35
|
-
contract
|
|
40
|
+
/// @dev If this contract is ever made upgradeable, please pay attention to the numContractDeployed variable
|
|
41
|
+
contract PendleYieldContractFactory is PermissionsV2Upg, Initializable, IPYieldContractFactory {
|
|
36
42
|
using ExpiryUtils for string;
|
|
37
43
|
|
|
38
|
-
string
|
|
39
|
-
string
|
|
44
|
+
string private constant PT_PREFIX = "PT";
|
|
45
|
+
string private constant YT_PREFIX = "YT";
|
|
46
|
+
|
|
47
|
+
address public pendleYtCreationCodePointer;
|
|
40
48
|
|
|
41
49
|
uint256 public expiryDivisor;
|
|
42
50
|
uint256 public interestFeeRate;
|
|
43
51
|
address public treasury;
|
|
44
52
|
|
|
53
|
+
/// number of contracts that have been deployed from this address
|
|
54
|
+
/// must be increased everytime a new contract is deployed
|
|
55
|
+
uint256 public numContractDeployed;
|
|
56
|
+
|
|
45
57
|
// SCY => expiry => address
|
|
46
58
|
mapping(address => mapping(uint256 => address)) public getPT;
|
|
47
59
|
mapping(address => mapping(uint256 => address)) public getYT;
|
|
@@ -54,33 +66,39 @@ contract PendleYieldContractFactory is PermissionsV2Upg, IPYieldContractFactory
|
|
|
54
66
|
address _treasury,
|
|
55
67
|
address _governanceManager
|
|
56
68
|
) PermissionsV2Upg(_governanceManager) {
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
setExpiryDivisor(_expiryDivisor);
|
|
70
|
+
setInterestFeeRate(_interestFeeRate);
|
|
71
|
+
setTreasury(_treasury);
|
|
72
|
+
numContractDeployed++;
|
|
73
|
+
}
|
|
59
74
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
treasury = _treasury;
|
|
75
|
+
function initialize(bytes memory _pendleYtCreationCode) external initializer {
|
|
76
|
+
pendleYtCreationCodePointer = SSTORE2Deployer.setCreationCode(_pendleYtCreationCode);
|
|
63
77
|
}
|
|
64
78
|
|
|
65
79
|
/**
|
|
66
80
|
* @notice Create a pair of (PT, YT) from any SCY and valid expiry. Anyone can create a yield contract
|
|
81
|
+
* @dev It's intentional to make expiry an uint32 to guard against fat fingers. uint32.max is year 2106
|
|
67
82
|
*/
|
|
68
|
-
function createYieldContract(address SCY,
|
|
83
|
+
function createYieldContract(address SCY, uint32 expiry)
|
|
69
84
|
external
|
|
70
85
|
returns (address PT, address YT)
|
|
71
86
|
{
|
|
72
|
-
require(expiry
|
|
87
|
+
require(!MiniHelpers.isTimeInThePast(expiry), "expiry must be in the future");
|
|
73
88
|
|
|
74
89
|
require(expiry % expiryDivisor == 0, "must be multiple of divisor");
|
|
75
90
|
|
|
76
|
-
require(getPT[SCY][expiry] == address(0), "
|
|
91
|
+
require(getPT[SCY][expiry] == address(0), "PT already existed");
|
|
77
92
|
|
|
78
93
|
ISuperComposableYield _SCY = ISuperComposableYield(SCY);
|
|
79
94
|
|
|
80
|
-
uint8 assetDecimals = _SCY.
|
|
95
|
+
(, , uint8 assetDecimals) = _SCY.assetInfo();
|
|
81
96
|
|
|
82
|
-
PT
|
|
83
|
-
|
|
97
|
+
// no need salt since PT (and also YT) existence has been checked before hand
|
|
98
|
+
PT = SSTORE2Deployer.create2(
|
|
99
|
+
type(PendlePrincipalToken).creationCode,
|
|
100
|
+
bytes32(0),
|
|
101
|
+
abi.encode(
|
|
84
102
|
SCY,
|
|
85
103
|
PT_PREFIX.concat(_SCY.name(), expiry, " "),
|
|
86
104
|
PT_PREFIX.concat(_SCY.symbol(), expiry, "-"),
|
|
@@ -89,8 +107,10 @@ contract PendleYieldContractFactory is PermissionsV2Upg, IPYieldContractFactory
|
|
|
89
107
|
)
|
|
90
108
|
);
|
|
91
109
|
|
|
92
|
-
YT =
|
|
93
|
-
|
|
110
|
+
YT = SSTORE2Deployer.create2(
|
|
111
|
+
pendleYtCreationCodePointer,
|
|
112
|
+
bytes32(0),
|
|
113
|
+
abi.encode(
|
|
94
114
|
SCY,
|
|
95
115
|
PT,
|
|
96
116
|
YT_PREFIX.concat(_SCY.name(), expiry, " "),
|
|
@@ -110,18 +130,18 @@ contract PendleYieldContractFactory is PermissionsV2Upg, IPYieldContractFactory
|
|
|
110
130
|
emit CreateYieldContract(SCY, PT, YT, expiry);
|
|
111
131
|
}
|
|
112
132
|
|
|
113
|
-
function setExpiryDivisor(uint256 newExpiryDivisor)
|
|
133
|
+
function setExpiryDivisor(uint256 newExpiryDivisor) public onlyGovernance {
|
|
114
134
|
require(newExpiryDivisor != 0, "zero value");
|
|
115
135
|
expiryDivisor = newExpiryDivisor;
|
|
116
136
|
emit SetExpiryDivisor(newExpiryDivisor);
|
|
117
137
|
}
|
|
118
138
|
|
|
119
|
-
function setInterestFeeRate(uint256 newInterestFeeRate)
|
|
139
|
+
function setInterestFeeRate(uint256 newInterestFeeRate) public onlyGovernance {
|
|
120
140
|
interestFeeRate = newInterestFeeRate;
|
|
121
141
|
emit SetInterestFeeRate(newInterestFeeRate);
|
|
122
142
|
}
|
|
123
143
|
|
|
124
|
-
function setTreasury(address newTreasury)
|
|
144
|
+
function setTreasury(address newTreasury) public onlyGovernance {
|
|
125
145
|
require(newTreasury != address(0), "zero address");
|
|
126
146
|
treasury = newTreasury;
|
|
127
147
|
emit SetTreasury(treasury);
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
|
|
4
|
+
import "../../interfaces/ISuperComposableYield.sol";
|
|
5
|
+
import "../../interfaces/IPYieldToken.sol";
|
|
6
|
+
import "../../interfaces/IPPrincipalToken.sol";
|
|
7
|
+
|
|
8
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
9
|
+
|
|
10
|
+
import "../../libraries/math/Math.sol";
|
|
11
|
+
import "../../libraries/helpers/ArrayLib.sol";
|
|
12
|
+
import "../../interfaces/IPYieldContractFactory.sol";
|
|
13
|
+
import "../../libraries/SCY/SCYUtils.sol";
|
|
14
|
+
import "../../libraries/helpers/MiniHelpers.sol";
|
|
15
|
+
import "../../libraries/RewardManagerAbstract.sol";
|
|
16
|
+
import "../PendleERC20.sol";
|
|
17
|
+
import "./InterestManagerYT.sol";
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
With YT yielding more SCYs overtime, which is allowed to be redeemed by users, the reward distribution should
|
|
21
|
+
be based on the amount of SCYs that their YT currently represent, plus with their dueInterest.
|
|
22
|
+
|
|
23
|
+
It has been proven and tested that totalScyRedeemable will not change over time, unless users redeem their interest or redeemPY.
|
|
24
|
+
|
|
25
|
+
Due to this, it is required to update users' accruedReward STRICTLY BEFORE redeeming their interest.
|
|
26
|
+
*/
|
|
27
|
+
contract PendleYieldToken is
|
|
28
|
+
IPYieldToken,
|
|
29
|
+
PendleERC20,
|
|
30
|
+
RewardManagerAbstract,
|
|
31
|
+
InterestManagerYT
|
|
32
|
+
{
|
|
33
|
+
using Math for uint256;
|
|
34
|
+
using SafeERC20 for IERC20;
|
|
35
|
+
using ArrayLib for uint256[];
|
|
36
|
+
|
|
37
|
+
struct AfterExpiryData {
|
|
38
|
+
bool isFinalized;
|
|
39
|
+
uint128 firstScyIndex;
|
|
40
|
+
uint256[] firstRewardIndexes;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
address public immutable SCY;
|
|
44
|
+
address public immutable PT;
|
|
45
|
+
address public immutable factory;
|
|
46
|
+
uint256 public immutable expiry;
|
|
47
|
+
|
|
48
|
+
uint128 public scyReserve;
|
|
49
|
+
uint128 internal _scyIndexStored;
|
|
50
|
+
|
|
51
|
+
AfterExpiryData public afterExpiry;
|
|
52
|
+
|
|
53
|
+
modifier updateScyReserve() {
|
|
54
|
+
_;
|
|
55
|
+
_updateScyReserve();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
constructor(
|
|
59
|
+
address _SCY,
|
|
60
|
+
address _PT,
|
|
61
|
+
string memory _name,
|
|
62
|
+
string memory _symbol,
|
|
63
|
+
uint8 __decimals,
|
|
64
|
+
uint256 _expiry
|
|
65
|
+
) PendleERC20(_name, _symbol, __decimals) {
|
|
66
|
+
SCY = _SCY;
|
|
67
|
+
PT = _PT;
|
|
68
|
+
expiry = _expiry;
|
|
69
|
+
factory = msg.sender;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// @notice Tokenize SCY into PT + YT of equal qty. Every unit of underlying of SCY will create 1 PT + 1 YT
|
|
73
|
+
function mintPY(address receiverPT, address receiverYT)
|
|
74
|
+
external
|
|
75
|
+
nonReentrant
|
|
76
|
+
updateScyReserve
|
|
77
|
+
returns (uint256 amountPYOut)
|
|
78
|
+
{
|
|
79
|
+
require(!isExpired(), "yield contract expired");
|
|
80
|
+
|
|
81
|
+
uint256 amountScyToMint = _getFloatingScyAmount();
|
|
82
|
+
|
|
83
|
+
amountPYOut = _calcPYToMint(amountScyToMint);
|
|
84
|
+
|
|
85
|
+
_mint(receiverYT, amountPYOut);
|
|
86
|
+
|
|
87
|
+
IPPrincipalToken(PT).mintByYT(receiverPT, amountPYOut);
|
|
88
|
+
|
|
89
|
+
emit Mint(msg.sender, receiverPT, receiverYT, amountPYOut);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/// @dev this function converts PY tokens into scy, but interests & rewards are not redeemed at the same time
|
|
93
|
+
function redeemPY(address receiver)
|
|
94
|
+
external
|
|
95
|
+
nonReentrant
|
|
96
|
+
updateScyReserve
|
|
97
|
+
returns (uint256 amountScyOut)
|
|
98
|
+
{
|
|
99
|
+
address[] memory receivers = new address[](1);
|
|
100
|
+
uint256[] memory amounts = new uint256[](1);
|
|
101
|
+
(receivers[0], amounts[0]) = (receiver, type(uint256).max);
|
|
102
|
+
|
|
103
|
+
(amountScyOut, ) = _redeemPY(receivers, amounts);
|
|
104
|
+
|
|
105
|
+
emit Redeem(msg.sender, receiver, amountScyOut);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/// @dev this function limit how much each receiver will receive. For example, if the totalOut is 100,
|
|
109
|
+
/// and the max are 50 30 INF, the first receiver will receive 50, the second will receive 30, and the third will receive 20.
|
|
110
|
+
/// @dev intended to mostly be used by Pendle router
|
|
111
|
+
function redeemPY(address[] memory receivers, uint256[] memory maxAmountScyOuts)
|
|
112
|
+
external
|
|
113
|
+
nonReentrant
|
|
114
|
+
updateScyReserve
|
|
115
|
+
returns (uint256 totalAmountScyOut)
|
|
116
|
+
{
|
|
117
|
+
(totalAmountScyOut, ) = _redeemPY(receivers, maxAmountScyOuts);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @dev _updateAndDistributeRewards must be called before every distributeInterest
|
|
122
|
+
*/
|
|
123
|
+
function redeemDueInterestAndRewards(address user)
|
|
124
|
+
external
|
|
125
|
+
nonReentrant
|
|
126
|
+
updateScyReserve
|
|
127
|
+
returns (uint256 interestOut, uint256[] memory rewardsOut)
|
|
128
|
+
{
|
|
129
|
+
_updateAndDistributeRewards(user);
|
|
130
|
+
_distributeInterest(user);
|
|
131
|
+
rewardsOut = _doTransferOutRewards(user, user);
|
|
132
|
+
interestOut = _doTransferOutInterest(user, SCY, factory);
|
|
133
|
+
|
|
134
|
+
emit RedeemRewards(user, rewardsOut);
|
|
135
|
+
emit RedeemInterest(user, interestOut);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @dev as mentioned in doc, _updateAndDistributeRewards should be placed strictly before every _distributeInterest
|
|
140
|
+
*/
|
|
141
|
+
function redeemDueInterest(address user)
|
|
142
|
+
external
|
|
143
|
+
nonReentrant
|
|
144
|
+
updateScyReserve
|
|
145
|
+
returns (uint256 interestOut)
|
|
146
|
+
{
|
|
147
|
+
_updateAndDistributeRewards(user); /// strictly required, see above for explanation
|
|
148
|
+
_distributeInterest(user);
|
|
149
|
+
|
|
150
|
+
interestOut = _doTransferOutInterest(user, SCY, factory);
|
|
151
|
+
|
|
152
|
+
emit RedeemInterest(user, interestOut);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// @dev no updateScyReserve since this function doesn't change the SCY reserve
|
|
156
|
+
function redeemDueRewards(address user)
|
|
157
|
+
external
|
|
158
|
+
nonReentrant
|
|
159
|
+
returns (uint256[] memory rewardsOut)
|
|
160
|
+
{
|
|
161
|
+
_updateAndDistributeRewards(user);
|
|
162
|
+
rewardsOut = _doTransferOutRewards(user, user);
|
|
163
|
+
emit RedeemRewards(user, rewardsOut);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/// @dev this function will only redeem rewards to the treasury, hence
|
|
167
|
+
/// no need to guard it with onlyGovernance
|
|
168
|
+
/// @dev no updateScyReserve since this function doesn't change the SCY reserve
|
|
169
|
+
function redeemRewardsAfterExpiryForTreasury()
|
|
170
|
+
external
|
|
171
|
+
nonReentrant
|
|
172
|
+
returns (uint256[] memory rewardsOut)
|
|
173
|
+
{
|
|
174
|
+
require(isExpired(), "not expired");
|
|
175
|
+
address[] memory rewardTokens = _getRewardTokens();
|
|
176
|
+
uint256[] memory preBalances = _selfBalances(rewardTokens);
|
|
177
|
+
|
|
178
|
+
_redeemExternalReward();
|
|
179
|
+
|
|
180
|
+
rewardsOut = _selfBalances(rewardTokens).sub(preBalances);
|
|
181
|
+
_transferOut(rewardTokens, IPYieldContractFactory(factory).treasury(), rewardsOut);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/// @notice can be called by anyone to lock in all the indexes
|
|
185
|
+
function finalizeAfterExpiryData() public {
|
|
186
|
+
if (!isExpired() || afterExpiry.isFinalized) return;
|
|
187
|
+
afterExpiry.isFinalized = true;
|
|
188
|
+
afterExpiry.firstScyIndex = scyIndexCurrent().Uint128();
|
|
189
|
+
(, afterExpiry.firstRewardIndexes) = _updateRewardIndex();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/// @dev maximize the current rate with the previous rate to guarantee non-decreasing rate
|
|
193
|
+
function scyIndexCurrent() public returns (uint256 currentIndex) {
|
|
194
|
+
currentIndex = Math.max(ISuperComposableYield(SCY).exchangeRate(), _scyIndexStored);
|
|
195
|
+
_scyIndexStored = currentIndex.Uint128();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function scyIndexStored() public view returns (uint256) {
|
|
199
|
+
return _scyIndexStored;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function isExpired() public view returns (bool) {
|
|
203
|
+
return MiniHelpers.isCurrentlyExpired(expiry);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function _redeemPY(address[] memory receivers, uint256[] memory maxAmountScyOuts)
|
|
207
|
+
internal
|
|
208
|
+
returns (uint256 totalScyToReceivers, uint256 scyInterestAfterExpiry)
|
|
209
|
+
{
|
|
210
|
+
uint256 amountPYToRedeem = _getAmountPYToRedeem();
|
|
211
|
+
IPPrincipalToken(PT).burnByYT(address(this), amountPYToRedeem);
|
|
212
|
+
if (!isExpired()) _burn(address(this), amountPYToRedeem);
|
|
213
|
+
|
|
214
|
+
(totalScyToReceivers, scyInterestAfterExpiry) = _calcScyRedeemableFromPY(amountPYToRedeem);
|
|
215
|
+
|
|
216
|
+
if (scyInterestAfterExpiry != 0) {
|
|
217
|
+
address treasury = IPYieldContractFactory(factory).treasury();
|
|
218
|
+
_transferOut(SCY, treasury, scyInterestAfterExpiry);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
_transferOutMaxMulti(SCY, totalScyToReceivers, receivers, maxAmountScyOuts);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function _calcPYToMint(uint256 amountScy) internal returns (uint256 amountPY) {
|
|
225
|
+
// doesn't matter before or after expiry, since mintPY is only allowed before expiry
|
|
226
|
+
return SCYUtils.scyToAsset(scyIndexCurrent(), amountScy);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function _calcScyRedeemableFromPY(uint256 amountPY)
|
|
230
|
+
internal
|
|
231
|
+
returns (uint256 scyToUser, uint256 scyInterestAfterExpiry)
|
|
232
|
+
{
|
|
233
|
+
if (isExpired()) {
|
|
234
|
+
finalizeAfterExpiryData();
|
|
235
|
+
uint256 totalScyRedeemable = SCYUtils.assetToScy(afterExpiry.firstScyIndex, amountPY);
|
|
236
|
+
scyToUser = SCYUtils.assetToScy(scyIndexCurrent(), amountPY);
|
|
237
|
+
scyInterestAfterExpiry = totalScyRedeemable - scyToUser;
|
|
238
|
+
} else {
|
|
239
|
+
scyToUser = SCYUtils.assetToScy(scyIndexCurrent(), amountPY);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function _getAmountPYToRedeem() internal view returns (uint256) {
|
|
244
|
+
if (!isExpired())
|
|
245
|
+
return Math.min(IERC20(PT).balanceOf(address(this)), balanceOf(address(this)));
|
|
246
|
+
else return IERC20(PT).balanceOf(address(this));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function _updateScyReserve() internal virtual {
|
|
250
|
+
scyReserve = IERC20(SCY).balanceOf(address(this)).Uint128();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function _getFloatingScyAmount() internal view returns (uint256 amount) {
|
|
254
|
+
amount = IERC20(SCY).balanceOf(address(this)) - scyReserve;
|
|
255
|
+
require(amount > 0, "RECEIVE_ZERO");
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/*///////////////////////////////////////////////////////////////
|
|
259
|
+
INTEREST-RELATED
|
|
260
|
+
//////////////////////////////////////////////////////////////*/
|
|
261
|
+
|
|
262
|
+
function _getInterestIndex() internal virtual override returns (uint256 index) {
|
|
263
|
+
if (isExpired()) {
|
|
264
|
+
finalizeAfterExpiryData();
|
|
265
|
+
index = afterExpiry.firstScyIndex;
|
|
266
|
+
} else {
|
|
267
|
+
index = scyIndexCurrent();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function _YTbalance(address user) internal view override returns (uint256) {
|
|
272
|
+
return balanceOf(user);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/*///////////////////////////////////////////////////////////////
|
|
276
|
+
REWARDS-RELATED
|
|
277
|
+
//////////////////////////////////////////////////////////////*/
|
|
278
|
+
|
|
279
|
+
function _doTransferOutRewards(address user, address receiver)
|
|
280
|
+
internal
|
|
281
|
+
virtual
|
|
282
|
+
override
|
|
283
|
+
returns (uint256[] memory rewardAmounts)
|
|
284
|
+
{
|
|
285
|
+
_redeemExternalReward();
|
|
286
|
+
|
|
287
|
+
address[] memory tokens = _getRewardTokens();
|
|
288
|
+
rewardAmounts = new uint256[](tokens.length);
|
|
289
|
+
for (uint256 i = 0; i < tokens.length; i++) {
|
|
290
|
+
rewardAmounts[i] = userReward[tokens[i]][user].accrued;
|
|
291
|
+
if (rewardAmounts[i] != 0) {
|
|
292
|
+
userReward[tokens[i]][user].accrued = 0;
|
|
293
|
+
_transferOut(tokens[i], receiver, rewardAmounts[i]);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function getRewardTokens() external view returns (address[] memory) {
|
|
299
|
+
return _getRewardTokens();
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function _redeemExternalReward() internal virtual override {
|
|
303
|
+
ISuperComposableYield(SCY).claimRewards(address(this));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/// @dev effectively returning the amount of SCY generating rewards for this user
|
|
307
|
+
function _rewardSharesUser(address user) internal view virtual override returns (uint256) {
|
|
308
|
+
uint256 index = userInterest[user].index;
|
|
309
|
+
if (index == 0) return 0;
|
|
310
|
+
return SCYUtils.assetToScy(index, balanceOf(user)) + userInterest[user].accrued;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function _rewardSharesTotal() internal view virtual override returns (uint256) {
|
|
314
|
+
return scyReserve;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function _getRewardTokens() internal view override returns (address[] memory) {
|
|
318
|
+
return ISuperComposableYield(SCY).getRewardTokens();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function _updateRewardIndex()
|
|
322
|
+
internal
|
|
323
|
+
override
|
|
324
|
+
returns (address[] memory tokens, uint256[] memory indexes)
|
|
325
|
+
{
|
|
326
|
+
tokens = _getRewardTokens();
|
|
327
|
+
if (isExpired()) {
|
|
328
|
+
finalizeAfterExpiryData();
|
|
329
|
+
// padding to handle the very extreme case of SCY adding reward tokens after expiry
|
|
330
|
+
indexes = afterExpiry.firstRewardIndexes.padZeroRight(tokens.length);
|
|
331
|
+
} else {
|
|
332
|
+
indexes = rewardIndexesCurrent();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function rewardIndexesCurrent() public override returns (uint256[] memory) {
|
|
337
|
+
return ISuperComposableYield(SCY).rewardIndexesCurrent();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
//solhint-disable-next-line ordering
|
|
341
|
+
function _beforeTokenTransfer(
|
|
342
|
+
address from,
|
|
343
|
+
address to,
|
|
344
|
+
uint256
|
|
345
|
+
) internal override {
|
|
346
|
+
_distributeInterestForTwo(from, to);
|
|
347
|
+
_updateAndDistributeRewardsForTwo(from, to);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity 0.8.15;
|
|
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
|
-
import "../../
|
|
8
|
+
import "../../libraries/SCY/SCYUtils.sol";
|
|
9
9
|
import "../../libraries/math/MarketApproxLib.sol";
|
|
10
|
-
import "../../libraries/math/MarketMathAux.sol";
|
|
11
10
|
import "./base/ActionSCYAndPYBase.sol";
|
|
12
|
-
import "./base/
|
|
11
|
+
import "./base/CallbackHelper.sol";
|
|
13
12
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
14
13
|
|
|
15
|
-
contract ActionCallback is IPMarketSwapCallback,
|
|
16
|
-
address public immutable marketFactory;
|
|
14
|
+
contract ActionCallback is IPMarketSwapCallback, CallbackHelper {
|
|
17
15
|
using Math for int256;
|
|
18
16
|
using Math for uint256;
|
|
19
17
|
using SafeERC20 for ISuperComposableYield;
|
|
20
18
|
using SafeERC20 for IPYieldToken;
|
|
19
|
+
using SafeERC20 for IERC20;
|
|
20
|
+
using SCYIndexLib for SCYIndex;
|
|
21
|
+
using SCYIndexLib for ISuperComposableYield;
|
|
22
|
+
|
|
23
|
+
address public immutable marketFactory;
|
|
21
24
|
|
|
22
25
|
modifier onlyPendleMarket(address market) {
|
|
23
26
|
require(IPMarketFactory(marketFactory).isValidMarket(market), "INVALID_MARKET");
|
|
@@ -38,82 +41,99 @@ contract ActionCallback is IPMarketSwapCallback, ActionType {
|
|
|
38
41
|
int256 scyToAccount,
|
|
39
42
|
bytes calldata data
|
|
40
43
|
) external override onlyPendleMarket(msg.sender) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_swapYtForScy_callback(msg.sender, ptToAccount, scyToAccount, data);
|
|
44
|
+
address market = msg.sender;
|
|
45
|
+
ActionType swapType = _getActionType(data);
|
|
46
|
+
if (swapType == ActionType.SwapExactScyForYt) {
|
|
47
|
+
_callbackSwapExactScyForYt(market, ptToAccount, scyToAccount, data);
|
|
48
|
+
} else if (swapType == ActionType.SwapScyForExactYt) {
|
|
49
|
+
_callbackSwapScyForExactYt(market, ptToAccount, scyToAccount, data);
|
|
50
|
+
} else if (swapType == ActionType.SwapYtForScy) {
|
|
51
|
+
_callbackSwapYtForScy(market, ptToAccount, scyToAccount, data);
|
|
50
52
|
} else {
|
|
51
53
|
require(false, "unknown swapType");
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
/// @dev refer to _swapExactScyForYt
|
|
58
|
+
function _callbackSwapExactScyForYt(
|
|
56
59
|
address market,
|
|
57
60
|
int256 ptToAccount,
|
|
58
61
|
int256, /*scyToAccount*/
|
|
59
62
|
bytes calldata data
|
|
60
63
|
) internal {
|
|
61
64
|
(, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
62
|
-
(,
|
|
65
|
+
(address receiver, uint256 minYtOut) = _decodeSwapExactScyForYt(data);
|
|
63
66
|
|
|
64
67
|
uint256 ptOwed = ptToAccount.abs();
|
|
65
68
|
uint256 amountPYout = YT.mintPY(market, receiver);
|
|
66
69
|
|
|
67
|
-
require(amountPYout >= ptOwed, "insufficient
|
|
70
|
+
require(amountPYout >= ptOwed, "insufficient PT to pay");
|
|
71
|
+
require(amountPYout >= minYtOut, "insufficient YT out");
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
struct VarsSwapScyForExactYt {
|
|
75
|
+
address payer;
|
|
76
|
+
address receiver;
|
|
77
|
+
uint256 maxScyToPull;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// @dev refer to _swapScyForExactYt
|
|
81
|
+
function _callbackSwapScyForExactYt(
|
|
71
82
|
address market,
|
|
72
83
|
int256 ptToAccount,
|
|
73
84
|
int256 scyToAccount,
|
|
74
85
|
bytes calldata data
|
|
75
86
|
) internal {
|
|
76
|
-
|
|
87
|
+
VarsSwapScyForExactYt memory vars;
|
|
88
|
+
(vars.payer, vars.receiver, vars.maxScyToPull) = _decodeSwapScyForExactYt(data);
|
|
77
89
|
(ISuperComposableYield SCY, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
78
90
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
uint256
|
|
84
|
-
uint256
|
|
85
|
-
|
|
91
|
+
/// ------------------------------------------------------------
|
|
92
|
+
/// calc totalScyNeed
|
|
93
|
+
/// ------------------------------------------------------------
|
|
94
|
+
SCYIndex scyIndex = SCY.newIndex();
|
|
95
|
+
uint256 ptOwed = ptToAccount.abs();
|
|
96
|
+
uint256 totalScyNeed = scyIndex.assetToScy(ptOwed);
|
|
97
|
+
// to guard against precision issue of lacking a few units of SCY. rawDivUp is not Fixed-Point division
|
|
98
|
+
totalScyNeed += SCYIndex.unwrap(scyIndex).rawDivUp(SCYUtils.ONE);
|
|
86
99
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
/// ------------------------------------------------------------
|
|
101
|
+
/// calc netScyToPull
|
|
102
|
+
/// ------------------------------------------------------------
|
|
103
|
+
uint256 scyReceived = scyToAccount.Uint();
|
|
104
|
+
uint256 netScyToPull = totalScyNeed.subMax0(scyReceived);
|
|
105
|
+
require(netScyToPull <= vars.maxScyToPull, "exceed SCY in limit");
|
|
91
106
|
|
|
92
|
-
|
|
107
|
+
/// ------------------------------------------------------------
|
|
108
|
+
/// mint & transfer
|
|
109
|
+
/// ------------------------------------------------------------
|
|
110
|
+
SCY.safeTransferFrom(vars.payer, address(YT), netScyToPull);
|
|
93
111
|
|
|
112
|
+
uint256 amountPYout = YT.mintPY(market, vars.receiver);
|
|
94
113
|
require(amountPYout >= ptOwed, "insufficient pt to pay");
|
|
95
114
|
}
|
|
96
115
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*/
|
|
100
|
-
function _swapYtForScy_callback(
|
|
116
|
+
/// @dev refer to _swapExactYtForScy or _swapYtForExactScy
|
|
117
|
+
function _callbackSwapYtForScy(
|
|
101
118
|
address market,
|
|
102
119
|
int256, /*ptToAccount*/
|
|
103
120
|
int256 scyToAccount,
|
|
104
121
|
bytes calldata data
|
|
105
122
|
) internal {
|
|
106
|
-
(,
|
|
107
|
-
(
|
|
123
|
+
(address receiver, uint256 minScyOut) = _decodeSwapYtForScy(data);
|
|
124
|
+
(, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
108
125
|
|
|
109
126
|
uint256 scyOwed = scyToAccount.neg().Uint();
|
|
110
127
|
|
|
111
|
-
|
|
128
|
+
address[] memory receivers = new address[](2);
|
|
129
|
+
uint256[] memory amounts = new uint256[](2);
|
|
112
130
|
|
|
113
|
-
|
|
131
|
+
(receivers[0], amounts[0]) = (market, scyOwed);
|
|
132
|
+
(receivers[1], amounts[1]) = (receiver, type(uint256).max);
|
|
114
133
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
134
|
+
uint256 totalScyRedeemed = YT.redeemPY(receivers, amounts);
|
|
135
|
+
uint256 netScyOut = totalScyRedeemed - scyOwed;
|
|
136
|
+
|
|
137
|
+
require(netScyOut >= minScyOut, "insufficient SCY out");
|
|
118
138
|
}
|
|
119
139
|
}
|