@pendle/core-v2 0.6.9 → 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/IVotingEscrowPendle.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 +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 +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 +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 +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/{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/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/{ERC20Burnable.ts → ERC20Permit.ts} +116 -68
- package/typechain-types/IAToken.ts +55 -0
- package/typechain-types/{QiDelegationStorage.ts → IBeacon.ts} +11 -6
- 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/{PermissionsV2.ts → IERC1822Proxiable.ts} +13 -13
- 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/IPGauge.ts +1 -138
- 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 +103 -8
- package/typechain-types/IPVotingController.ts +179 -0
- package/typechain-types/IPVotingEscrow.ts +100 -180
- package/typechain-types/IPYieldToken.ts +176 -213
- package/typechain-types/{IPOwnershipToken.ts → IQiAvax.ts} +190 -127
- 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/{EIP20Interface.ts → PendleERC20.ts} +39 -37
- package/typechain-types/{ERC20PresetFixedSupply.ts → PendleERC20Permit.ts} +100 -130
- package/typechain-types/{LYTBaseWithRewards.ts → PendleERC4626SCY.ts} +311 -316
- package/typechain-types/PendleGauge.ts +113 -306
- package/typechain-types/PendleGaugeController.ts +346 -0
- package/typechain-types/PendleGaugeControllerMainchain.ts +410 -0
- package/typechain-types/PendleGaugeControllerSidechain.ts +524 -0
- package/typechain-types/{PendleYTLYTBenqi.ts → PendleJoeLpSCY.ts} +336 -362
- 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/{PermlessAbstract.ts → PendleQiTokenHelper.ts} +5 -5
- package/typechain-types/{PendleBenQiErc20LYT.ts → PendleQiTokenSCY.ts} +395 -305
- package/typechain-types/PendleRouter.ts +0 -19
- package/typechain-types/PendleVotingController.ts +1042 -0
- package/typechain-types/{PendleAaveV3LYT.ts → PendleWstEthSCY.ts} +325 -320
- 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/{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/BeaconProxy__factory.ts +141 -0
- package/typechain-types/factories/{CrosschainReceiver__factory.ts → CelerReceiver__factory.ts} +37 -84
- package/typechain-types/factories/CelerSender__factory.ts +85 -0
- package/typechain-types/factories/{IRainbowBridge__factory.ts → ERC1967Upgrade__factory.ts} +27 -32
- package/typechain-types/factories/{IPOwnershipToken__factory.ts → ERC20Permit__factory.ts} +83 -64
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IAToken__factory.ts +39 -0
- package/typechain-types/factories/{PermissionsV2__factory.ts → IBeacon__factory.ts} +7 -7
- 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/{IPermissionsV2__factory.ts → IERC1822Proxiable__factory.ts} +11 -11
- 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 +151 -0
- package/typechain-types/factories/IPGaugeController__factory.ts +124 -0
- package/typechain-types/factories/IPGauge__factory.ts +3 -86
- 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 +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 +85 -83
- package/typechain-types/factories/{ILiquidYieldToken__factory.ts → IQiAvax__factory.ts} +58 -125
- 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/{EIP20NonStandardInterface__factory.ts → PendleGaugeController__factory.ts} +90 -91
- package/typechain-types/factories/PendleGauge__factory.ts +42 -254
- 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 +327 -156
- package/typechain-types/index.ts +88 -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/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/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/IGaugeController.ts +0 -99
- package/typechain-types/ILiquidYieldToken.ts +0 -639
- package/typechain-types/ILiquidYieldTokenWrap.ts +0 -790
- package/typechain-types/IMessageBus.ts +0 -543
- package/typechain-types/IPFlashCallback.ts +0 -115
- package/typechain-types/IPLiquidYieldToken.ts +0 -641
- package/typechain-types/IPMarketCallback.ts +0 -107
- package/typechain-types/IPRouterCore.ts +0 -769
- package/typechain-types/IPRouterRedeem.ts +0 -155
- package/typechain-types/IPRouterYT.ts +0 -489
- 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/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/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/PendleYearnVaultLYT.ts +0 -723
- 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/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/WETH9.ts +0 -414
- package/typechain-types/WhitePaperInterestRateModel.ts +0 -304
- package/typechain-types/XPendle.ts +0 -618
- 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/CrosschainSender__factory.ts +0 -104
- 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/IMessageBus__factory.ts +0 -396
- 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/ISCYRewardIndex__factory.ts +0 -465
- package/typechain-types/factories/IVEPendleToken__factory.ts +0 -71
- 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/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/PendleRouterSCYAndForgeBaseUpg__factory.ts +0 -56
- 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/PendleYTLYTBenqi__factory.ts +0 -713
- package/typechain-types/factories/PendleYearnVaultLYT__factory.ts +0 -586
- 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/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,40 @@
|
|
|
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.13;
|
|
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/solmate/LibRLP.sol";
|
|
33
|
+
import "../../libraries/helpers/MiniDeployer.sol";
|
|
34
|
+
import "../../libraries/helpers/MiniHelpers.sol";
|
|
35
|
+
|
|
36
|
+
import "../../periphery/PermissionsV2Upg.sol";
|
|
31
37
|
|
|
32
38
|
import "./PendlePrincipalToken.sol";
|
|
33
39
|
import "./PendleYieldToken.sol";
|
|
34
40
|
|
|
35
|
-
contract
|
|
41
|
+
/// @dev If this contract is ever made upgradeable, please pay attention to the numContractDeployed variable
|
|
42
|
+
contract PendleYieldContractFactory is PermissionsV2Upg, MiniDeployer, IPYieldContractFactory {
|
|
36
43
|
using ExpiryUtils for string;
|
|
37
44
|
|
|
38
|
-
string
|
|
39
|
-
string
|
|
45
|
+
string private constant PT_PREFIX = "PT";
|
|
46
|
+
string private constant YT_PREFIX = "YT";
|
|
47
|
+
|
|
48
|
+
address public immutable pendleYtCreationCodePointer;
|
|
40
49
|
|
|
41
50
|
uint256 public expiryDivisor;
|
|
42
51
|
uint256 public interestFeeRate;
|
|
43
52
|
address public treasury;
|
|
44
53
|
|
|
54
|
+
/// number of contracts that have been deployed from this address
|
|
55
|
+
/// must be increased everytime a new contract is deployed
|
|
56
|
+
uint256 public numContractDeployed;
|
|
57
|
+
|
|
45
58
|
// SCY => expiry => address
|
|
46
59
|
mapping(address => mapping(uint256 => address)) public getPT;
|
|
47
60
|
mapping(address => mapping(uint256 => address)) public getYT;
|
|
@@ -52,36 +65,41 @@ contract PendleYieldContractFactory is PermissionsV2Upg, IPYieldContractFactory
|
|
|
52
65
|
uint256 _expiryDivisor,
|
|
53
66
|
uint256 _interestFeeRate,
|
|
54
67
|
address _treasury,
|
|
55
|
-
address _governanceManager
|
|
68
|
+
address _governanceManager,
|
|
69
|
+
bytes memory _pendleYtCreationCode
|
|
56
70
|
) PermissionsV2Upg(_governanceManager) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
treasury = _treasury;
|
|
71
|
+
setExpiryDivisor(_expiryDivisor);
|
|
72
|
+
setInterestFeeRate(_interestFeeRate);
|
|
73
|
+
setTreasury(_treasury);
|
|
74
|
+
pendleYtCreationCodePointer = _setCreationCode(_pendleYtCreationCode);
|
|
75
|
+
numContractDeployed++;
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
/**
|
|
66
79
|
* @notice Create a pair of (PT, YT) from any SCY and valid expiry. Anyone can create a yield contract
|
|
80
|
+
* @dev It's intentional to make expiry an uint32 to guard against fat fingers. uint32.max is year 2106
|
|
67
81
|
*/
|
|
68
|
-
function createYieldContract(address SCY,
|
|
82
|
+
function createYieldContract(address SCY, uint32 expiry)
|
|
69
83
|
external
|
|
70
84
|
returns (address PT, address YT)
|
|
71
85
|
{
|
|
72
|
-
require(expiry
|
|
86
|
+
require(!MiniHelpers.isTimeInThePast(expiry), "expiry must be in the future");
|
|
73
87
|
|
|
74
88
|
require(expiry % expiryDivisor == 0, "must be multiple of divisor");
|
|
75
89
|
|
|
76
|
-
require(getPT[SCY][expiry] == address(0), "
|
|
90
|
+
require(getPT[SCY][expiry] == address(0), "PT already existed");
|
|
77
91
|
|
|
78
92
|
ISuperComposableYield _SCY = ISuperComposableYield(SCY);
|
|
79
93
|
|
|
80
|
-
uint8 assetDecimals = _SCY.
|
|
94
|
+
(, , uint8 assetDecimals) = _SCY.assetInfo();
|
|
95
|
+
|
|
96
|
+
address predictedPTAddress = LibRLP.computeAddress(address(this), ++numContractDeployed);
|
|
97
|
+
address predictedYTAddress = LibRLP.computeAddress(address(this), ++numContractDeployed);
|
|
81
98
|
|
|
82
99
|
PT = address(
|
|
83
100
|
new PendlePrincipalToken(
|
|
84
101
|
SCY,
|
|
102
|
+
predictedYTAddress,
|
|
85
103
|
PT_PREFIX.concat(_SCY.name(), expiry, " "),
|
|
86
104
|
PT_PREFIX.concat(_SCY.symbol(), expiry, "-"),
|
|
87
105
|
assetDecimals,
|
|
@@ -89,10 +107,13 @@ contract PendleYieldContractFactory is PermissionsV2Upg, IPYieldContractFactory
|
|
|
89
107
|
)
|
|
90
108
|
);
|
|
91
109
|
|
|
92
|
-
|
|
93
|
-
|
|
110
|
+
require(PT == predictedPTAddress, "IE predictedPTAddress");
|
|
111
|
+
|
|
112
|
+
YT = _deployWithArgs(
|
|
113
|
+
pendleYtCreationCodePointer,
|
|
114
|
+
abi.encode(
|
|
94
115
|
SCY,
|
|
95
|
-
|
|
116
|
+
predictedPTAddress,
|
|
96
117
|
YT_PREFIX.concat(_SCY.name(), expiry, " "),
|
|
97
118
|
YT_PREFIX.concat(_SCY.symbol(), expiry, "-"),
|
|
98
119
|
assetDecimals,
|
|
@@ -100,7 +121,7 @@ contract PendleYieldContractFactory is PermissionsV2Upg, IPYieldContractFactory
|
|
|
100
121
|
)
|
|
101
122
|
);
|
|
102
123
|
|
|
103
|
-
|
|
124
|
+
require(YT == predictedYTAddress, "IE predictedYTAddress");
|
|
104
125
|
|
|
105
126
|
getPT[SCY][expiry] = PT;
|
|
106
127
|
getYT[SCY][expiry] = YT;
|
|
@@ -110,18 +131,18 @@ contract PendleYieldContractFactory is PermissionsV2Upg, IPYieldContractFactory
|
|
|
110
131
|
emit CreateYieldContract(SCY, PT, YT, expiry);
|
|
111
132
|
}
|
|
112
133
|
|
|
113
|
-
function setExpiryDivisor(uint256 newExpiryDivisor)
|
|
134
|
+
function setExpiryDivisor(uint256 newExpiryDivisor) public onlyGovernance {
|
|
114
135
|
require(newExpiryDivisor != 0, "zero value");
|
|
115
136
|
expiryDivisor = newExpiryDivisor;
|
|
116
137
|
emit SetExpiryDivisor(newExpiryDivisor);
|
|
117
138
|
}
|
|
118
139
|
|
|
119
|
-
function setInterestFeeRate(uint256 newInterestFeeRate)
|
|
140
|
+
function setInterestFeeRate(uint256 newInterestFeeRate) public onlyGovernance {
|
|
120
141
|
interestFeeRate = newInterestFeeRate;
|
|
121
142
|
emit SetInterestFeeRate(newInterestFeeRate);
|
|
122
143
|
}
|
|
123
144
|
|
|
124
|
-
function setTreasury(address newTreasury)
|
|
145
|
+
function setTreasury(address newTreasury) public onlyGovernance {
|
|
125
146
|
require(newTreasury != address(0), "zero address");
|
|
126
147
|
treasury = newTreasury;
|
|
127
148
|
emit SetTreasury(treasury);
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.13;
|
|
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 "../PendleERC20Permit.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
|
+
PendleERC20Permit,
|
|
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
|
+
uint256 public scyReserve;
|
|
49
|
+
|
|
50
|
+
AfterExpiryData public afterExpiry;
|
|
51
|
+
|
|
52
|
+
modifier updateScyReserve() {
|
|
53
|
+
_;
|
|
54
|
+
_updateScyReserve();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
constructor(
|
|
58
|
+
address _SCY,
|
|
59
|
+
address _PT,
|
|
60
|
+
string memory _name,
|
|
61
|
+
string memory _symbol,
|
|
62
|
+
uint8 __decimals,
|
|
63
|
+
uint256 _expiry
|
|
64
|
+
) PendleERC20Permit(_name, _symbol, __decimals) {
|
|
65
|
+
SCY = _SCY;
|
|
66
|
+
PT = _PT;
|
|
67
|
+
expiry = _expiry;
|
|
68
|
+
factory = msg.sender;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @notice this function splits scy into PT + YT of equal qty
|
|
73
|
+
* @dev the scy to tokenize has to be pre-transferred to this contract prior to the function call
|
|
74
|
+
*/
|
|
75
|
+
function mintPY(address receiverPT, address receiverYT)
|
|
76
|
+
external
|
|
77
|
+
nonReentrant
|
|
78
|
+
updateScyReserve
|
|
79
|
+
returns (uint256 amountPYOut)
|
|
80
|
+
{
|
|
81
|
+
require(!isExpired(), "yield contract expired");
|
|
82
|
+
|
|
83
|
+
uint256 amountScyToMint = _getFloatingScyAmount();
|
|
84
|
+
|
|
85
|
+
amountPYOut = _calcPYToMint(amountScyToMint);
|
|
86
|
+
|
|
87
|
+
_mint(receiverYT, amountPYOut);
|
|
88
|
+
|
|
89
|
+
IPPrincipalToken(PT).mintByYT(receiverPT, 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
|
+
|
|
106
|
+
function redeemPY(address[] memory receivers, uint256[] memory amounts)
|
|
107
|
+
external
|
|
108
|
+
nonReentrant
|
|
109
|
+
updateScyReserve
|
|
110
|
+
returns (uint256 amountScyOut)
|
|
111
|
+
{
|
|
112
|
+
(amountScyOut, ) = _redeemPY(receivers, amounts);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @dev as mentioned in doc, updateDueReward should be placed strictly before every redeemDueInterest
|
|
117
|
+
*/
|
|
118
|
+
function redeemDueInterestAndRewards(address user)
|
|
119
|
+
external
|
|
120
|
+
nonReentrant
|
|
121
|
+
updateScyReserve
|
|
122
|
+
returns (uint256 interestOut, uint256[] memory rewardsOut)
|
|
123
|
+
{
|
|
124
|
+
// redeemDueRewards before redeemDueInterest
|
|
125
|
+
_updateAndDistributeRewards(user);
|
|
126
|
+
_distributeInterest(user);
|
|
127
|
+
rewardsOut = _doTransferOutRewards(user, user);
|
|
128
|
+
interestOut = _doTransferOutInterest(user, SCY, factory);
|
|
129
|
+
|
|
130
|
+
emit RedeemRewards(user, rewardsOut);
|
|
131
|
+
emit RedeemInterest(user, interestOut);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @dev as mentioned in doc, _updateAndDistributeRewards should be placed strictly before every _distributeInterest
|
|
136
|
+
*/
|
|
137
|
+
function redeemDueInterest(address user)
|
|
138
|
+
external
|
|
139
|
+
nonReentrant
|
|
140
|
+
updateScyReserve
|
|
141
|
+
returns (uint256 interestOut)
|
|
142
|
+
{
|
|
143
|
+
_updateAndDistributeRewards(user); /// strictly required, see above for explanation
|
|
144
|
+
_distributeInterest(user);
|
|
145
|
+
|
|
146
|
+
interestOut = _doTransferOutInterest(user, SCY, factory);
|
|
147
|
+
|
|
148
|
+
emit RedeemInterest(user, interestOut);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/// @dev no updateScyReserve since this function doesn't change the SCY reserve
|
|
152
|
+
function redeemDueRewards(address user)
|
|
153
|
+
external
|
|
154
|
+
nonReentrant
|
|
155
|
+
returns (uint256[] memory rewardsOut)
|
|
156
|
+
{
|
|
157
|
+
_updateAndDistributeRewards(user);
|
|
158
|
+
rewardsOut = _doTransferOutRewards(user, user);
|
|
159
|
+
emit RedeemRewards(user, rewardsOut);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/// @dev this function will only redeem rewards to the treasury, hence
|
|
163
|
+
/// no need to guard it with onlyGovernance
|
|
164
|
+
/// @dev no updateScyReserve since this function doesn't change the SCY reserve
|
|
165
|
+
function redeemRewardsAfterExpiryForTreasury()
|
|
166
|
+
external
|
|
167
|
+
nonReentrant
|
|
168
|
+
returns (uint256[] memory rewardsOut)
|
|
169
|
+
{
|
|
170
|
+
require(isExpired(), "not expired");
|
|
171
|
+
address[] memory rewardTokens = _getRewardTokens();
|
|
172
|
+
uint256[] memory preBalances = _selfBalances(rewardTokens);
|
|
173
|
+
|
|
174
|
+
_redeemExternalReward();
|
|
175
|
+
|
|
176
|
+
rewardsOut = _selfBalances(rewardTokens).sub(preBalances);
|
|
177
|
+
_transferOut(rewardTokens, IPYieldContractFactory(factory).treasury(), rewardsOut);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/// @notice can be called by anyone to lock in all the indexes
|
|
181
|
+
function finalizeAfterExpiryData() public {
|
|
182
|
+
if (!isExpired() || afterExpiry.isFinalized) return;
|
|
183
|
+
afterExpiry.isFinalized = true;
|
|
184
|
+
afterExpiry.firstScyIndex = ISuperComposableYield(SCY).exchangeRate().Uint128();
|
|
185
|
+
(, afterExpiry.firstRewardIndexes) = _updateRewardIndex();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/// @dev no reentrant & updateScyReserve since this function updates just the lastIndex
|
|
189
|
+
function getScyIndex() public view returns (uint256 currentIndex) {
|
|
190
|
+
return ISuperComposableYield(SCY).exchangeRate();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function isExpired() public view returns (bool) {
|
|
194
|
+
return MiniHelpers.isCurrentlyExpired(expiry);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function _redeemPY(address[] memory receivers, uint256[] memory maxScyAmounts)
|
|
198
|
+
internal
|
|
199
|
+
returns (uint256 totalScyToReceivers, uint256 scyInterestAfterExpiry)
|
|
200
|
+
{
|
|
201
|
+
uint256 amountPYToRedeem = _getAmountPYToRedeem();
|
|
202
|
+
IPPrincipalToken(PT).burnByYT(address(this), amountPYToRedeem);
|
|
203
|
+
if (!isExpired()) _burn(address(this), amountPYToRedeem);
|
|
204
|
+
|
|
205
|
+
(totalScyToReceivers, scyInterestAfterExpiry) = _calcScyRedeemableFromPY(amountPYToRedeem);
|
|
206
|
+
|
|
207
|
+
if (scyInterestAfterExpiry != 0) {
|
|
208
|
+
address treasury = IPYieldContractFactory(factory).treasury();
|
|
209
|
+
_transferOut(SCY, treasury, scyInterestAfterExpiry);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
_transferOutMaxMulti(SCY, totalScyToReceivers, receivers, maxScyAmounts);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function _calcPYToMint(uint256 amountScy) internal view returns (uint256 amountPY) {
|
|
216
|
+
// doesn't matter before or after expiry, since mintPY is only allowed before expiry
|
|
217
|
+
return SCYUtils.scyToAsset(getScyIndex(), amountScy);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function _calcScyRedeemableFromPY(uint256 amountPY)
|
|
221
|
+
internal
|
|
222
|
+
returns (uint256 scyToUser, uint256 scyInterestAfterExpiry)
|
|
223
|
+
{
|
|
224
|
+
if (isExpired()) {
|
|
225
|
+
finalizeAfterExpiryData();
|
|
226
|
+
uint256 totalScyRedeemable = SCYUtils.assetToScy(afterExpiry.firstScyIndex, amountPY);
|
|
227
|
+
scyToUser = SCYUtils.assetToScy(getScyIndex(), amountPY);
|
|
228
|
+
scyInterestAfterExpiry = totalScyRedeemable - scyToUser;
|
|
229
|
+
} else {
|
|
230
|
+
scyToUser = SCYUtils.assetToScy(getScyIndex(), amountPY);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function _getAmountPYToRedeem() internal view returns (uint256) {
|
|
235
|
+
if (!isExpired())
|
|
236
|
+
return Math.min(IERC20(PT).balanceOf(address(this)), balanceOf(address(this)));
|
|
237
|
+
else return IERC20(PT).balanceOf(address(this));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function _updateScyReserve() internal virtual {
|
|
241
|
+
scyReserve = IERC20(SCY).balanceOf(address(this)).Uint128();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function _getFloatingScyAmount() internal view returns (uint256 amount) {
|
|
245
|
+
amount = IERC20(SCY).balanceOf(address(this)) - scyReserve;
|
|
246
|
+
require(amount > 0, "RECEIVE_ZERO");
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/*///////////////////////////////////////////////////////////////
|
|
250
|
+
INTEREST-RELATED
|
|
251
|
+
//////////////////////////////////////////////////////////////*/
|
|
252
|
+
|
|
253
|
+
function _getInterestIndex() internal virtual override returns (uint256 index) {
|
|
254
|
+
if (isExpired()) {
|
|
255
|
+
finalizeAfterExpiryData();
|
|
256
|
+
index = afterExpiry.firstScyIndex;
|
|
257
|
+
} else {
|
|
258
|
+
index = ISuperComposableYield(SCY).exchangeRate();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function _YTbalance(address user) internal view override returns (uint256) {
|
|
263
|
+
return balanceOf(user);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/*///////////////////////////////////////////////////////////////
|
|
267
|
+
REWARDS-RELATED
|
|
268
|
+
//////////////////////////////////////////////////////////////*/
|
|
269
|
+
|
|
270
|
+
function _doTransferOutRewards(address user, address receiver)
|
|
271
|
+
internal
|
|
272
|
+
virtual
|
|
273
|
+
override
|
|
274
|
+
returns (uint256[] memory rewardAmounts)
|
|
275
|
+
{
|
|
276
|
+
_redeemExternalReward();
|
|
277
|
+
|
|
278
|
+
address[] memory tokens = _getRewardTokens();
|
|
279
|
+
rewardAmounts = new uint256[](tokens.length);
|
|
280
|
+
for (uint256 i = 0; i < tokens.length; i++) {
|
|
281
|
+
rewardAmounts[i] = userReward[tokens[i]][user].accrued;
|
|
282
|
+
if (rewardAmounts[i] != 0) {
|
|
283
|
+
userReward[tokens[i]][user].accrued = 0;
|
|
284
|
+
_transferOut(tokens[i], receiver, rewardAmounts[i]);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function getRewardTokens() external view returns (address[] memory) {
|
|
290
|
+
return _getRewardTokens();
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function _redeemExternalReward() internal virtual override {
|
|
294
|
+
ISuperComposableYield(SCY).claimRewards(address(this)); // ignore return
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/// @dev effectively returning the amount of SCY generating rewards for this user
|
|
298
|
+
function _rewardSharesUser(address user) internal view virtual override returns (uint256) {
|
|
299
|
+
uint256 index = userInterest[user].index;
|
|
300
|
+
if (index == 0) return 0;
|
|
301
|
+
return SCYUtils.assetToScy(index, balanceOf(user)) + userInterest[user].accrued;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function _rewardSharesTotal() internal view virtual override returns (uint256) {
|
|
305
|
+
return scyReserve;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function _getRewardTokens() internal view override returns (address[] memory) {
|
|
309
|
+
return ISuperComposableYield(SCY).getRewardTokens();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function _updateRewardIndex()
|
|
313
|
+
internal
|
|
314
|
+
override
|
|
315
|
+
returns (address[] memory tokens, uint256[] memory indexes)
|
|
316
|
+
{
|
|
317
|
+
tokens = _getRewardTokens();
|
|
318
|
+
if (isExpired()) {
|
|
319
|
+
finalizeAfterExpiryData();
|
|
320
|
+
// padding to handle the very extreme case of SCY adding reward tokens after expiry
|
|
321
|
+
indexes = afterExpiry.firstRewardIndexes.padZeroRight(tokens.length);
|
|
322
|
+
} else {
|
|
323
|
+
indexes = ISuperComposableYield(SCY).rewardIndexesCurrent();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function rewardIndexesCurrent() external override returns (uint256[] memory) {
|
|
328
|
+
return ISuperComposableYield(SCY).rewardIndexesCurrent();
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
//solhint-disable-next-line ordering
|
|
332
|
+
function _beforeTokenTransfer(
|
|
333
|
+
address from,
|
|
334
|
+
address to,
|
|
335
|
+
uint256
|
|
336
|
+
) internal override {
|
|
337
|
+
_distributeInterestForTwo(from, to);
|
|
338
|
+
_updateAndDistributeRewardsForTwo(from, to);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
@@ -1,23 +1,26 @@
|
|
|
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
|
-
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
|
}
|