@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
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.9;
|
|
3
|
-
|
|
4
|
-
import "./PendleBaseToken.sol";
|
|
5
|
-
import "../SuperComposableYield/ISuperComposableYield.sol";
|
|
6
|
-
import "../interfaces/IPYieldToken.sol";
|
|
7
|
-
import "../interfaces/IPPrincipalToken.sol";
|
|
8
|
-
import "../libraries/math/Math.sol";
|
|
9
|
-
import "../interfaces/IPYieldContractFactory.sol";
|
|
10
|
-
import "../SuperComposableYield/SCYUtils.sol";
|
|
11
|
-
import "../SuperComposableYield/implementations/RewardManager.sol";
|
|
12
|
-
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
|
|
13
|
-
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
14
|
-
|
|
15
|
-
/*
|
|
16
|
-
With YT yielding more SCYs overtime, which is allowed to be redeemed by users, the reward distribution should
|
|
17
|
-
be based on the amount of SCYs that their YT currently represent, plus with their dueInterest.
|
|
18
|
-
|
|
19
|
-
It has been proven and tested that impliedScyBalance will not change over time, unless users redeem their interest or redeemPY.
|
|
20
|
-
|
|
21
|
-
Due to this, it is required to update users' accruedReward STRICTLY BEFORE redeeming their interest.
|
|
22
|
-
*/
|
|
23
|
-
contract PendleYieldToken is PendleBaseToken, RewardManager, IPYieldToken, ReentrancyGuard {
|
|
24
|
-
using Math for uint256;
|
|
25
|
-
using SafeERC20 for IERC20;
|
|
26
|
-
|
|
27
|
-
struct InterestData {
|
|
28
|
-
uint256 lastScyIndex;
|
|
29
|
-
uint256 dueInterest;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
address public immutable SCY;
|
|
33
|
-
address public immutable PT;
|
|
34
|
-
|
|
35
|
-
/// params to do interests & rewards accounting
|
|
36
|
-
uint256 public lastScyBalance;
|
|
37
|
-
uint256 public lastScyIndexBeforeExpiry;
|
|
38
|
-
|
|
39
|
-
/// params to do fee accounting
|
|
40
|
-
mapping(address => uint256) public totalRewardsPostExpiry;
|
|
41
|
-
uint256 public totalInterestPostExpiry;
|
|
42
|
-
uint256 public totalProtocolFee;
|
|
43
|
-
|
|
44
|
-
mapping(address => InterestData) internal interestData;
|
|
45
|
-
|
|
46
|
-
constructor(
|
|
47
|
-
address _SCY,
|
|
48
|
-
address _PT,
|
|
49
|
-
string memory _name,
|
|
50
|
-
string memory _symbol,
|
|
51
|
-
uint8 __decimals,
|
|
52
|
-
uint256 _expiry
|
|
53
|
-
) PendleBaseToken(_name, _symbol, __decimals, _expiry) {
|
|
54
|
-
require(_SCY != address(0) && _PT != address(0), "zero address");
|
|
55
|
-
SCY = _SCY;
|
|
56
|
-
PT = _PT;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @notice this function splits scy into PT + YT of equal qty
|
|
61
|
-
* @dev the scy to tokenize has to be pre-transferred to this contract prior to the function call
|
|
62
|
-
*/
|
|
63
|
-
function mintPY(address receiverPT, address receiverYT)
|
|
64
|
-
external
|
|
65
|
-
nonReentrant
|
|
66
|
-
returns (uint256 amountPYOut)
|
|
67
|
-
{
|
|
68
|
-
uint256 amountToTokenize = _receiveSCY();
|
|
69
|
-
|
|
70
|
-
amountPYOut = _calcAmountToMint(amountToTokenize);
|
|
71
|
-
|
|
72
|
-
_mint(receiverYT, amountPYOut);
|
|
73
|
-
|
|
74
|
-
IPPrincipalToken(PT).mintByYT(receiverPT, amountPYOut);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/// @dev this function converts PY tokens into scy, but interests & rewards are not redeemed at the same time
|
|
78
|
-
function redeemPY(address receiver) external nonReentrant returns (uint256 amountScyOut) {
|
|
79
|
-
// minimum of PT & YT balance
|
|
80
|
-
uint256 amountPYToRedeem = IERC20(PT).balanceOf(address(this));
|
|
81
|
-
if (!isExpired()) {
|
|
82
|
-
amountPYToRedeem = Math.min(amountPYToRedeem, balanceOf(address(this)));
|
|
83
|
-
_burn(address(this), amountPYToRedeem);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
IPPrincipalToken(PT).burnByYT(address(this), amountPYToRedeem);
|
|
87
|
-
|
|
88
|
-
uint256 amountScyToTreasury;
|
|
89
|
-
(amountScyOut, amountScyToTreasury) = _calcAmountToRedeem(amountPYToRedeem);
|
|
90
|
-
|
|
91
|
-
totalInterestPostExpiry += amountScyToTreasury;
|
|
92
|
-
|
|
93
|
-
IERC20(SCY).safeTransfer(receiver, amountScyOut);
|
|
94
|
-
_afterTransferOutSCY();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @dev as mentioned in doc, updateDueReward should be placed strictly before every redeemDueInterest
|
|
99
|
-
*/
|
|
100
|
-
function redeemDueInterestAndRewards(address user)
|
|
101
|
-
external
|
|
102
|
-
nonReentrant
|
|
103
|
-
returns (uint256 interestOut, uint256[] memory rewardsOut)
|
|
104
|
-
{
|
|
105
|
-
// redeemDueRewards before redeemDueInterest
|
|
106
|
-
_updateUserReward(user);
|
|
107
|
-
_updateUserInterest(user);
|
|
108
|
-
rewardsOut = _doTransferOutRewardsForUser(user, user);
|
|
109
|
-
interestOut = _doTransferOutDueInterest(user);
|
|
110
|
-
|
|
111
|
-
emit RedeemReward(user, rewardsOut);
|
|
112
|
-
emit RedeemInterest(user, interestOut);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @dev as mentioned in doc, updateDueReward should be placed strictly before every redeemDueInterest
|
|
117
|
-
*/
|
|
118
|
-
function redeemDueInterest(address user) external nonReentrant returns (uint256 interestOut) {
|
|
119
|
-
_updateUserReward(user); /// strictly required, see above for explanation
|
|
120
|
-
|
|
121
|
-
_updateUserInterest(user);
|
|
122
|
-
interestOut = _doTransferOutDueInterest(user);
|
|
123
|
-
emit RedeemInterest(user, interestOut);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function redeemDueRewards(address user)
|
|
127
|
-
external
|
|
128
|
-
nonReentrant
|
|
129
|
-
returns (uint256[] memory rewardsOut)
|
|
130
|
-
{
|
|
131
|
-
_updateUserReward(user);
|
|
132
|
-
|
|
133
|
-
rewardsOut = _doTransferOutRewardsForUser(user, user);
|
|
134
|
-
emit RedeemReward(user, rewardsOut);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @dev updateGlobalReward does not need reentrancy modifier since the rewards
|
|
139
|
-
* will be transfered directly from SCY to YT, without triggering any callbacks
|
|
140
|
-
*/
|
|
141
|
-
function updateGlobalReward() external nonReentrant {
|
|
142
|
-
_updateGlobalReward();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function updateUserReward(address user) external nonReentrant {
|
|
146
|
-
_updateUserReward(user);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function updateUserInterest(address user) external nonReentrant {
|
|
150
|
-
_updateUserInterest(user);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function _updateUserInterest(address user) internal {
|
|
154
|
-
uint256 prevIndex = interestData[user].lastScyIndex;
|
|
155
|
-
|
|
156
|
-
(, uint256 currentIndexBeforeExpiry) = getScyIndex();
|
|
157
|
-
|
|
158
|
-
if (prevIndex == currentIndexBeforeExpiry) return;
|
|
159
|
-
if (prevIndex == 0) {
|
|
160
|
-
interestData[user].lastScyIndex = currentIndexBeforeExpiry;
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
uint256 principal = balanceOf(user);
|
|
165
|
-
|
|
166
|
-
uint256 interestFromYT = (principal * (currentIndexBeforeExpiry - prevIndex)).divDown(
|
|
167
|
-
prevIndex * currentIndexBeforeExpiry
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
interestData[user].dueInterest += interestFromYT;
|
|
171
|
-
interestData[user].lastScyIndex = currentIndexBeforeExpiry;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function getInterestData(address user)
|
|
175
|
-
external
|
|
176
|
-
view
|
|
177
|
-
returns (uint256 lastScyIndex, uint256 dueInterest)
|
|
178
|
-
{
|
|
179
|
-
return (interestData[user].lastScyIndex, interestData[user].dueInterest);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/// @dev override the default updateGlobalReward to avoid distributing the rewards after
|
|
183
|
-
/// YT has expired. Instead, these funds will go to the treasury
|
|
184
|
-
function _updateGlobalReward() internal virtual override {
|
|
185
|
-
if (!_shouldUpdateGlobalReward()) return;
|
|
186
|
-
_redeemExternalReward();
|
|
187
|
-
|
|
188
|
-
uint256 totalShares = _rewardSharesTotal();
|
|
189
|
-
|
|
190
|
-
address[] memory rewardTokens = getRewardTokens();
|
|
191
|
-
_initGlobalReward(rewardTokens);
|
|
192
|
-
|
|
193
|
-
bool _isExpired = isExpired();
|
|
194
|
-
for (uint256 i = 0; i < rewardTokens.length; ++i) {
|
|
195
|
-
address token = rewardTokens[i];
|
|
196
|
-
|
|
197
|
-
uint256 currentRewardBalance = IERC20(token).balanceOf(address(this));
|
|
198
|
-
uint256 totalIncomeReward = currentRewardBalance - globalReward[token].lastBalance;
|
|
199
|
-
|
|
200
|
-
if (_isExpired) {
|
|
201
|
-
totalRewardsPostExpiry[token] += totalIncomeReward;
|
|
202
|
-
} else if (totalShares != 0) {
|
|
203
|
-
globalReward[token].index += totalIncomeReward.divDown(totalShares);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
globalReward[token].lastBalance = currentRewardBalance;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function _doTransferOutDueInterest(address user) internal returns (uint256 interestOut) {
|
|
211
|
-
uint256 interestPreFee = interestData[user].dueInterest;
|
|
212
|
-
interestData[user].dueInterest = 0;
|
|
213
|
-
|
|
214
|
-
uint256 feeRate = IPYieldContractFactory(factory).interestFeeRate();
|
|
215
|
-
uint256 feeAmount = interestPreFee.mulDown(feeRate);
|
|
216
|
-
totalProtocolFee += feeAmount;
|
|
217
|
-
|
|
218
|
-
interestOut = interestPreFee - feeAmount;
|
|
219
|
-
IERC20(SCY).safeTransfer(user, interestOut);
|
|
220
|
-
_afterTransferOutSCY();
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function _redeemExternalReward() internal virtual override {
|
|
224
|
-
ISuperComposableYield(SCY).redeemReward(address(this)); // ignore return
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/// @dev to be overriden if there is rewards
|
|
228
|
-
function _rewardSharesTotal() internal virtual override returns (uint256) {
|
|
229
|
-
return IERC20(SCY).balanceOf(address(this));
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/// @dev to be overriden if there is rewards
|
|
233
|
-
function _rewardSharesUser(address user) internal virtual override returns (uint256) {
|
|
234
|
-
return getImpliedScyBalance(user);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function getRewardTokens()
|
|
238
|
-
public
|
|
239
|
-
view
|
|
240
|
-
virtual
|
|
241
|
-
override(RewardManager, IRewardManager)
|
|
242
|
-
returns (address[] memory)
|
|
243
|
-
{
|
|
244
|
-
return ISuperComposableYield(SCY).getRewardTokens();
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function getScyIndex() public returns (uint256 currentIndex, uint256 lastIndexBeforeExpiry) {
|
|
248
|
-
currentIndex = ISuperComposableYield(SCY).scyIndexCurrent();
|
|
249
|
-
if (isExpired()) {
|
|
250
|
-
lastIndexBeforeExpiry = lastScyIndexBeforeExpiry;
|
|
251
|
-
} else {
|
|
252
|
-
lastScyIndexBeforeExpiry = lastIndexBeforeExpiry = currentIndex;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* @dev In case the pool is expired and there is left some SCY not yet redeemed from the contract, the rewards should
|
|
258
|
-
* be claimed before withdrawing to treasury.
|
|
259
|
-
*
|
|
260
|
-
* @dev And since the reward distribution (which based on users' dueInterest) stopped at the scyIndexBeforeExpiry, it is not
|
|
261
|
-
* necessary to updateUserInterest along with reward here.
|
|
262
|
-
*/
|
|
263
|
-
function withdrawFeeToTreasury() public {
|
|
264
|
-
address[] memory rewardTokens = getRewardTokens();
|
|
265
|
-
if (isExpired()) {
|
|
266
|
-
_updateGlobalReward(); // as refered to the doc above
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
uint256 length = rewardTokens.length;
|
|
270
|
-
address treasury = IPYieldContractFactory(factory).treasury();
|
|
271
|
-
uint256[] memory amountRewardsOut = new uint256[](length);
|
|
272
|
-
|
|
273
|
-
for (uint256 i = 0; i < length; i++) {
|
|
274
|
-
address token = rewardTokens[i];
|
|
275
|
-
uint256 outAmount = totalRewardsPostExpiry[token];
|
|
276
|
-
if (outAmount > 0) IERC20(rewardTokens[i]).safeTransfer(treasury, outAmount);
|
|
277
|
-
totalRewardsPostExpiry[token] = 0;
|
|
278
|
-
amountRewardsOut[i] = outAmount;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
uint256 totalScyFee = totalProtocolFee + totalInterestPostExpiry;
|
|
282
|
-
totalProtocolFee = totalInterestPostExpiry = 0;
|
|
283
|
-
|
|
284
|
-
if (totalScyFee > 0) {
|
|
285
|
-
IERC20(SCY).safeTransfer(treasury, totalScyFee);
|
|
286
|
-
_afterTransferOutSCY();
|
|
287
|
-
}
|
|
288
|
-
emit WithdrawFeeToTreasury(amountRewardsOut, totalScyFee);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function _calcAmountToMint(uint256 amount) internal returns (uint256) {
|
|
292
|
-
(, uint256 lastIndexBeforeExpiry) = getScyIndex();
|
|
293
|
-
return SCYUtils.scyToAsset(lastIndexBeforeExpiry, amount);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function _calcAmountToRedeem(uint256 amount)
|
|
297
|
-
internal
|
|
298
|
-
returns (uint256 amountToUser, uint256 amountToTreasury)
|
|
299
|
-
{
|
|
300
|
-
(uint256 currentIndex, uint256 lastIndexBeforeExpiry) = getScyIndex();
|
|
301
|
-
uint256 totalRedeemable = SCYUtils.assetToScy(lastIndexBeforeExpiry, amount);
|
|
302
|
-
amountToUser = SCYUtils.assetToScy(currentIndex, amount);
|
|
303
|
-
amountToTreasury = totalRedeemable - amountToUser;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
function _receiveSCY() internal returns (uint256 amount) {
|
|
307
|
-
uint256 balanceScy = IERC20(SCY).balanceOf(address(this));
|
|
308
|
-
amount = balanceScy - lastScyBalance;
|
|
309
|
-
require(amount > 0, "RECEIVE_ZERO");
|
|
310
|
-
lastScyBalance = balanceScy;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function _afterTransferOutSCY() internal {
|
|
314
|
-
lastScyBalance = IERC20(SCY).balanceOf(address(this));
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function getImpliedScyBalance(address user) public view returns (uint256) {
|
|
318
|
-
uint256 scyIndex = interestData[user].lastScyIndex;
|
|
319
|
-
return SCYUtils.assetToScy(scyIndex, balanceOf(user)) + interestData[user].dueInterest;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function _beforeTokenTransfer(
|
|
323
|
-
address from,
|
|
324
|
-
address to,
|
|
325
|
-
uint256
|
|
326
|
-
) internal override {
|
|
327
|
-
_updateGlobalReward();
|
|
328
|
-
|
|
329
|
-
// Before the change in YT balance, users' impliedScyBalance is kept unchanged from last time
|
|
330
|
-
// Therefore, both updating due interest before or after due reward work the same.
|
|
331
|
-
if (from != address(0) && from != address(this)) {
|
|
332
|
-
_updateUserInterest(from);
|
|
333
|
-
_updateUserRewardSkipGlobal(from);
|
|
334
|
-
}
|
|
335
|
-
if (to != address(0) && to != address(this)) {
|
|
336
|
-
_updateUserInterest(to);
|
|
337
|
-
_updateUserRewardSkipGlobal(to);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.9;
|
|
3
|
-
|
|
4
|
-
import "../../interfaces/IPActionRedeem.sol";
|
|
5
|
-
import "../../SuperComposableYield/ISuperComposableYield.sol";
|
|
6
|
-
import "../../interfaces/IPYieldToken.sol";
|
|
7
|
-
import "../../core/PendleMarket.sol";
|
|
8
|
-
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
9
|
-
|
|
10
|
-
contract ActionRedeem is IPActionRedeem {
|
|
11
|
-
function redeemDueIncome(
|
|
12
|
-
address user,
|
|
13
|
-
address[] calldata scys,
|
|
14
|
-
address[] calldata yieldTokens,
|
|
15
|
-
address[] calldata /*gauges*/
|
|
16
|
-
)
|
|
17
|
-
external
|
|
18
|
-
returns (
|
|
19
|
-
uint256[][] memory scyRewards,
|
|
20
|
-
uint256[] memory ytInterests,
|
|
21
|
-
uint256[][] memory ytRewards
|
|
22
|
-
)
|
|
23
|
-
{
|
|
24
|
-
scyRewards = new uint256[][](scys.length);
|
|
25
|
-
for (uint256 i = 0; i < scys.length; ++i) {
|
|
26
|
-
scyRewards[i] = ISuperComposableYield(scys[i]).redeemReward(user);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
ytInterests = new uint256[](yieldTokens.length);
|
|
30
|
-
ytRewards = new uint256[][](yieldTokens.length);
|
|
31
|
-
for (uint256 i = 0; i < yieldTokens.length; ++i) {
|
|
32
|
-
(ytInterests[i], ytRewards[i]) = IPYieldToken(yieldTokens[i])
|
|
33
|
-
.redeemDueInterestAndRewards(user);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.9;
|
|
3
|
-
|
|
4
|
-
interface IPActionRedeem {
|
|
5
|
-
function redeemDueIncome(
|
|
6
|
-
address user,
|
|
7
|
-
address[] calldata scys,
|
|
8
|
-
address[] calldata yieldTokens,
|
|
9
|
-
address[] calldata /*gauges*/
|
|
10
|
-
)
|
|
11
|
-
external
|
|
12
|
-
returns (
|
|
13
|
-
uint256[][] memory scyRewards,
|
|
14
|
-
uint256[] memory ytInterests,
|
|
15
|
-
uint256[][] memory ytRewards
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.9;
|
|
3
|
-
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
4
|
-
|
|
5
|
-
interface IPBaseToken is IERC20Metadata {
|
|
6
|
-
function expiry() external view returns (uint256);
|
|
7
|
-
|
|
8
|
-
function isExpired() external view returns (bool);
|
|
9
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
pragma solidity 0.8.9;
|
|
2
|
-
pragma abicoder v2;
|
|
3
|
-
|
|
4
|
-
interface IPGauge {
|
|
5
|
-
// ============= ACTIONS =============
|
|
6
|
-
|
|
7
|
-
function stake(address receiver) external;
|
|
8
|
-
|
|
9
|
-
function withdraw(address receiver, uint256 amount) external;
|
|
10
|
-
|
|
11
|
-
function redeemReward(address receiver) external returns (uint256 redeemedReward);
|
|
12
|
-
|
|
13
|
-
// ============= USER INFO =============
|
|
14
|
-
|
|
15
|
-
function readUserInfo(address user)
|
|
16
|
-
external
|
|
17
|
-
returns (
|
|
18
|
-
uint256 lpStaked,
|
|
19
|
-
uint256 activeLpAmount,
|
|
20
|
-
uint256 accruedReward
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
// ============= META DATA =============
|
|
24
|
-
|
|
25
|
-
function readGlobalInfo()
|
|
26
|
-
external
|
|
27
|
-
returns (
|
|
28
|
-
uint256 totalLpStaked,
|
|
29
|
-
uint256 totalActiveLp,
|
|
30
|
-
uint256 pendlePerSec
|
|
31
|
-
);
|
|
32
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
pragma solidity 0.8.9;
|
|
2
|
-
pragma abicoder v2;
|
|
3
|
-
|
|
4
|
-
interface IPVotingEscrowController {
|
|
5
|
-
function pendlePerSec() external returns (uint256);
|
|
6
|
-
|
|
7
|
-
function totalVote() external returns (uint256);
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @return vote Amount of vePendle voted for pool
|
|
11
|
-
* @return pendleSpeed Amount of Pendle incentivized for pool per second
|
|
12
|
-
*/
|
|
13
|
-
function readPoolRewardInfo(address pool) external returns (uint256 vote, uint256 pendleSpeed);
|
|
14
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
pragma solidity 0.8.9;
|
|
2
|
-
pragma abicoder v2;
|
|
3
|
-
|
|
4
|
-
interface IPendleGauge {
|
|
5
|
-
// ============= ACTIONS =============
|
|
6
|
-
|
|
7
|
-
function stake(address receiver) external;
|
|
8
|
-
|
|
9
|
-
function withdraw(address receiver, uint256 amount) external;
|
|
10
|
-
|
|
11
|
-
function redeemReward(address receiver) external returns (uint256 redeemedReward);
|
|
12
|
-
|
|
13
|
-
// ============= USER INFO =============
|
|
14
|
-
|
|
15
|
-
function readUserInfo(address user)
|
|
16
|
-
external
|
|
17
|
-
returns (
|
|
18
|
-
uint256 lpStaked,
|
|
19
|
-
uint256 activeLpAmount,
|
|
20
|
-
uint256 accruedReward
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
// ============= META DATA =============
|
|
24
|
-
|
|
25
|
-
function readGlobalInfo()
|
|
26
|
-
external
|
|
27
|
-
returns (
|
|
28
|
-
uint256 totalLpStaked,
|
|
29
|
-
uint256 totalActiveLp,
|
|
30
|
-
uint256 pendlePerSec
|
|
31
|
-
);
|
|
32
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
|
|
3
|
-
pragma solidity 0.8.9;
|
|
4
|
-
pragma abicoder v2;
|
|
5
|
-
|
|
6
|
-
interface IVePToken {
|
|
7
|
-
// ============= USER INFO =============
|
|
8
|
-
|
|
9
|
-
function balanceOf(address user) external view returns (uint256);
|
|
10
|
-
|
|
11
|
-
// ============= META DATA =============
|
|
12
|
-
|
|
13
|
-
function totalSupply() external view returns (uint256);
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
pragma solidity 0.8.9;
|
|
2
|
-
pragma abicoder v2;
|
|
3
|
-
|
|
4
|
-
interface VotingEscrowController {
|
|
5
|
-
function pendlePerSec() external returns (uint256);
|
|
6
|
-
|
|
7
|
-
function totalVote() external returns (uint256);
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @return vote :Amount of vePendle voted for pool
|
|
11
|
-
* @return pendleSpeed :Amount of Pendle incentivized for pool per second
|
|
12
|
-
*/
|
|
13
|
-
function readPoolRewardInfo(address pool) external returns (uint256 vote, uint256 pendleSpeed);
|
|
14
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
pragma solidity 0.8.9;
|
|
2
|
-
pragma abicoder v2;
|
|
3
|
-
|
|
4
|
-
import "./IVePToken.sol";
|
|
5
|
-
|
|
6
|
-
interface IVotingEscrowPendle is IVePToken {
|
|
7
|
-
// ============= ACTIONS =============
|
|
8
|
-
|
|
9
|
-
function lock(uint256 expiry) external returns (uint256);
|
|
10
|
-
|
|
11
|
-
function increaseLockAmount(address receiver) external returns (uint256);
|
|
12
|
-
|
|
13
|
-
function increaseLockDuration(uint256 duration) external returns (uint256);
|
|
14
|
-
|
|
15
|
-
function withdraw(address user) external returns (uint256);
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @return amount :amount of vePendle voted for pool
|
|
19
|
-
*/
|
|
20
|
-
function vote(address gauge, uint256 weight) external returns (uint256 amount);
|
|
21
|
-
|
|
22
|
-
// ============= USER INFO =============
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @return lockedAmount :amount of PENDLE user locked
|
|
26
|
-
* @return expiry :expiry of users' locked PENDLE
|
|
27
|
-
*/
|
|
28
|
-
function readUserInfo(address user)
|
|
29
|
-
external
|
|
30
|
-
view
|
|
31
|
-
returns (uint256 lockedAmount, uint256 expiry);
|
|
32
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.9;
|
|
3
|
-
|
|
4
|
-
import "./Math.sol";
|
|
5
|
-
import "./LogExpMath.sol";
|
|
6
|
-
import "../SCYIndex.sol";
|
|
7
|
-
import "./MarketMathCore.sol";
|
|
8
|
-
|
|
9
|
-
// solhint-disable ordering
|
|
10
|
-
library MarketMathAux {
|
|
11
|
-
using Math for uint256;
|
|
12
|
-
using Math for int256;
|
|
13
|
-
|
|
14
|
-
function addLiquidity(
|
|
15
|
-
MarketState memory market,
|
|
16
|
-
SCYIndex index,
|
|
17
|
-
uint256 scyDesired,
|
|
18
|
-
uint256 ptDesired,
|
|
19
|
-
bool updateState
|
|
20
|
-
)
|
|
21
|
-
internal
|
|
22
|
-
pure
|
|
23
|
-
returns (
|
|
24
|
-
uint256 lpToReserve,
|
|
25
|
-
uint256 lpToAccount,
|
|
26
|
-
uint256 scyUsed,
|
|
27
|
-
uint256 ptUsed
|
|
28
|
-
)
|
|
29
|
-
{
|
|
30
|
-
(
|
|
31
|
-
int256 _lpToReserve,
|
|
32
|
-
int256 _lpToAccount,
|
|
33
|
-
int256 _scyUsed,
|
|
34
|
-
int256 _otUsed
|
|
35
|
-
) = MarketMathCore.addLiquidityCore(
|
|
36
|
-
market,
|
|
37
|
-
index,
|
|
38
|
-
scyDesired.Int(),
|
|
39
|
-
ptDesired.Int(),
|
|
40
|
-
updateState
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
lpToReserve = _lpToReserve.Uint();
|
|
44
|
-
lpToAccount = _lpToAccount.Uint();
|
|
45
|
-
scyUsed = _scyUsed.Uint();
|
|
46
|
-
ptUsed = _otUsed.Uint();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function removeLiquidity(
|
|
50
|
-
MarketState memory market,
|
|
51
|
-
uint256 lpToRemove,
|
|
52
|
-
bool updateState
|
|
53
|
-
) internal pure returns (uint256 scyToAccount, uint256 netPtToAccount) {
|
|
54
|
-
(int256 _scyToAccount, int256 _ptToAccount) = MarketMathCore.removeLiquidityCore(
|
|
55
|
-
market,
|
|
56
|
-
lpToRemove.Int(),
|
|
57
|
-
updateState
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
scyToAccount = _scyToAccount.Uint();
|
|
61
|
-
netPtToAccount = _ptToAccount.Uint();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function swapExactPtForScy(
|
|
65
|
-
MarketState memory market,
|
|
66
|
-
SCYIndex index,
|
|
67
|
-
uint256 exactPtToMarket,
|
|
68
|
-
uint256 blockTime,
|
|
69
|
-
bool updateState
|
|
70
|
-
) internal pure returns (uint256 netScyToAccount, uint256 netScyToReserve) {
|
|
71
|
-
(int256 _netScyToAccount, int256 _netScyToReserve) = MarketMathCore.executeTradeCore(
|
|
72
|
-
market,
|
|
73
|
-
index,
|
|
74
|
-
exactPtToMarket.neg(),
|
|
75
|
-
blockTime,
|
|
76
|
-
updateState
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
netScyToAccount = _netScyToAccount.Uint();
|
|
80
|
-
netScyToReserve = _netScyToReserve.Uint();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function swapScyForExactPt(
|
|
84
|
-
MarketState memory market,
|
|
85
|
-
SCYIndex index,
|
|
86
|
-
uint256 exactPtToAccount,
|
|
87
|
-
uint256 blockTime,
|
|
88
|
-
bool updateState
|
|
89
|
-
) internal pure returns (uint256 netScyToMarket, uint256 netScyToReserve) {
|
|
90
|
-
(int256 _netScyToAccount, int256 _netScyToReserve) = MarketMathCore.executeTradeCore(
|
|
91
|
-
market,
|
|
92
|
-
index,
|
|
93
|
-
exactPtToAccount.Int(),
|
|
94
|
-
blockTime,
|
|
95
|
-
updateState
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
netScyToMarket = _netScyToAccount.neg().Uint();
|
|
99
|
-
netScyToReserve = _netScyToReserve.Uint();
|
|
100
|
-
}
|
|
101
|
-
}
|