@pendle/core-v2 0.9.4-beta → 0.10.2-testnet
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +7 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/{PendleYearnVaultScy.sol → PendleYearnVaultSCY.sol}/PendleYearnVaultSCY.json +3 -3
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.json +67 -5
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json +63 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +65 -3
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +74 -10
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +79 -15
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +204 -123
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +127 -73
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +93 -34
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +90 -14
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +14 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +139 -37
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +84 -56
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +122 -11
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +96 -40
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +1025 -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/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.json +622 -0
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.json +35 -0
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.json +459 -0
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.json +459 -0
- package/build/artifacts/contracts/core/actions/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/base/{ActionSCYAndPTBase.sol/ActionSCYAndPTBase.json → ActionBaseMintRedeem.sol/ActionBaseMintRedeem.json} +2 -2
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.json +24 -0
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPActionCore.sol/IPActionCore.json → IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json} +141 -912
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +598 -0
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.json +35 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +435 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPActionYT.sol/IPActionYT.json → IPActionSwapYT.sol/IPActionSwapYT.json} +23 -11
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +323 -47
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.json → interfaces/IPGauge.sol/IPGauge.json} +5 -5
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +72 -29
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +0 -11
- 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/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +0 -37
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.json +1 -1
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
- 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/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.json +74 -0
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- 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/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +93 -0
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +427 -39
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +4 -0
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.json +86 -0
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +4 -0
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +37 -0
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +8 -0
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +11 -5
- package/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol +0 -1
- package/contracts/SuperComposableYield/SCY-implementations/{PendleYearnVaultScy.sol → PendleYearnVaultSCY.sol} +0 -0
- package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +1 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +1 -1
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol +7 -7
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +7 -6
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +4 -5
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +6 -3
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +6 -3
- package/contracts/core/LiquidityMining/PendleGauge.sol +3 -2
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +22 -28
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +71 -13
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +7 -4
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +6 -2
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +4 -3
- package/contracts/core/Market/PendleMarket.sol +93 -57
- package/contracts/core/Market/PendleMarketFactory.sol +18 -33
- package/contracts/core/PendleRouter.sol +60 -52
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +12 -12
- package/contracts/core/YieldContracts/PendleYieldToken.sol +1 -1
- package/contracts/core/actions/ActionAddRemoveLiq.sol +366 -0
- package/contracts/core/actions/ActionCallback.sol +6 -6
- package/contracts/core/actions/ActionMintRedeem.sol +124 -0
- package/contracts/core/actions/ActionMisc.sol +24 -0
- package/contracts/core/actions/ActionSwapPT.sol +199 -0
- package/contracts/core/actions/{base/ActionSCYAndYTBase.sol → ActionSwapYT.sol} +109 -74
- package/contracts/core/actions/base/{ActionSCYAndPYBase.sol → ActionBaseMintRedeem.sol} +9 -8
- package/contracts/interfaces/IBenQiComptroller.sol +2 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +188 -0
- package/contracts/interfaces/IPActionMintRedeem.sol +115 -0
- package/contracts/interfaces/IPActionMisc.sol +9 -0
- package/contracts/interfaces/IPActionSwapPT.sol +69 -0
- package/contracts/interfaces/{IPActionYT.sol → IPActionSwapYT.sol} +12 -10
- package/contracts/interfaces/IPAllAction.sol +12 -3
- package/contracts/interfaces/IPGauge.sol +6 -0
- package/contracts/interfaces/IPGaugeController.sol +0 -2
- package/contracts/interfaces/IPMarket.sol +28 -10
- package/contracts/interfaces/IPMarketFactory.sol +1 -7
- package/contracts/interfaces/IPVeToken.sol +1 -1
- package/contracts/interfaces/IPVotingController.sol +0 -2
- package/contracts/interfaces/IRewardManager.sol +1 -1
- package/contracts/libraries/OracleLib.sol +214 -0
- package/contracts/libraries/RewardManagerAbstract.sol +1 -1
- package/contracts/libraries/math/MarketApproxLib.sol +227 -14
- package/contracts/libraries/math/MarketMathCore.sol +0 -33
- package/contracts/offchain-helpers/MarketMathStatic.sol +565 -0
- package/contracts/offchain-helpers/RouterStatic.sol +187 -251
- package/contracts/periphery/BoringOwnableUpgradeable.sol +62 -0
- package/deployments/43113-core.json +7 -8
- package/deployments/43113-markets/benqi-market-590025.json +8 -0
- package/deployments/43113-markets/benqi-market-c93916.json +8 -0
- package/deployments/80001-core.json +6 -7
- package/deployments/80001-markets/benqi-market-3b8BD1.json +8 -0
- package/deployments/80001-markets/benqi-market-b61e7f.json +8 -0
- package/package.json +11 -11
- package/typechain-types/ActionAddRemoveLiq.ts +1037 -0
- package/typechain-types/ActionBaseMintRedeem.ts +87 -0
- package/typechain-types/ActionCore.ts +21 -20
- package/typechain-types/ActionMintRedeem.ts +665 -0
- package/typechain-types/ActionMisc.ts +105 -0
- package/typechain-types/ActionSwapPT.ts +515 -0
- package/typechain-types/ActionSwapYT.ts +515 -0
- package/typechain-types/ActionYT.ts +5 -4
- package/typechain-types/BoringOwnable.ts +194 -0
- package/typechain-types/BoringOwnableData.ts +100 -0
- package/typechain-types/BoringOwnableUpgradeable.ts +194 -0
- package/typechain-types/BoringOwnableUpgradeableData.ts +100 -0
- package/typechain-types/CelerReceiverUpg.ts +124 -19
- package/typechain-types/CelerSenderUpg.ts +116 -11
- package/typechain-types/IBenQiComptroller.ts +39 -0
- package/typechain-types/IPActionAddRemoveLiq.ts +1018 -0
- package/typechain-types/IPActionCore.ts +21 -20
- package/typechain-types/IPActionMintRedeem.ts +646 -0
- package/typechain-types/IPActionMisc.ts +105 -0
- package/typechain-types/IPActionSwapPT.ts +496 -0
- package/typechain-types/IPActionSwapYT.ts +496 -0
- package/typechain-types/IPActionYT.ts +5 -4
- package/typechain-types/IPAllAction.ts +431 -193
- package/typechain-types/IPGauge.ts +87 -0
- package/typechain-types/IPMarket.ts +133 -50
- package/typechain-types/IPMarketFactory.ts +7 -17
- package/typechain-types/IPVeToken.ts +8 -8
- package/typechain-types/IPVotingController.ts +0 -20
- package/typechain-types/IPYieldToken.ts +3 -3
- package/typechain-types/IRewardManager.ts +3 -3
- package/typechain-types/MarketMathStatic.ts +198 -0
- package/typechain-types/OracleLib.ts +124 -0
- package/typechain-types/PendleGaugeControllerBaseUpg.ts +118 -15
- package/typechain-types/PendleGaugeControllerMainchainUpg.ts +136 -9
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +138 -11
- package/typechain-types/PendleMarket.ts +178 -59
- package/typechain-types/PendleMarketFactory.ts +135 -61
- package/typechain-types/PendleRouter.ts +201 -31
- package/typechain-types/PendleVotingControllerUpg.ts +325 -149
- package/typechain-types/PendleYieldContractFactory.ts +144 -21
- package/typechain-types/RouterStatic.ts +344 -64
- package/typechain-types/VotingControllerStorageUpg.ts +182 -113
- package/typechain-types/VotingEscrowPendleMainchain.ts +170 -63
- package/typechain-types/VotingEscrowPendleSidechain.ts +163 -17
- package/typechain-types/VotingEscrowTokenBase.ts +27 -8
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1083 -0
- package/typechain-types/factories/ActionBaseMintRedeem__factory.ts +43 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +6 -6
- package/typechain-types/factories/ActionMintRedeem__factory.ts +680 -0
- package/typechain-types/factories/ActionMisc__factory.ts +85 -0
- package/typechain-types/factories/ActionSwapPT__factory.ts +514 -0
- package/typechain-types/factories/ActionSwapYT__factory.ts +514 -0
- package/typechain-types/factories/ActionYT__factory.ts +2 -2
- package/typechain-types/factories/BoringOwnableData__factory.ts +90 -0
- package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +96 -0
- package/typechain-types/factories/BoringOwnableUpgradeable__factory.ts +143 -0
- package/typechain-types/factories/BoringOwnable__factory.ts +141 -0
- package/typechain-types/factories/CelerReceiverUpg__factory.ts +67 -5
- package/typechain-types/factories/CelerSenderUpg__factory.ts +63 -1
- package/typechain-types/factories/IBenQiComptroller__factory.ts +24 -0
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +1020 -0
- package/typechain-types/factories/IPActionCore__factory.ts +5 -5
- package/typechain-types/factories/IPActionMintRedeem__factory.ts +613 -0
- package/typechain-types/factories/IPActionMisc__factory.ts +47 -0
- package/typechain-types/factories/IPActionSwapPT__factory.ts +450 -0
- package/typechain-types/factories/IPActionSwapYT__factory.ts +450 -0
- package/typechain-types/factories/IPActionYT__factory.ts +1 -1
- package/typechain-types/factories/IPAllAction__factory.ts +323 -47
- package/typechain-types/factories/IPGauge__factory.ts +36 -0
- package/typechain-types/factories/IPMarketFactory__factory.ts +0 -11
- package/typechain-types/factories/IPMarket__factory.ts +72 -29
- package/typechain-types/factories/IPVeToken__factory.ts +1 -1
- package/typechain-types/factories/IPVotingController__factory.ts +0 -37
- package/typechain-types/factories/IPYieldToken__factory.ts +1 -1
- package/typechain-types/factories/IRewardManager__factory.ts +1 -1
- package/typechain-types/factories/MarketMathStatic__factory.ts +146 -0
- package/typechain-types/factories/OracleLib__factory.ts +124 -0
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +1 -1
- package/typechain-types/factories/PendleERC4626SCY__factory.ts +1 -1
- package/typechain-types/factories/PendleEulerSCY__factory.ts +10 -1
- package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +65 -3
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +73 -13
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +79 -23
- package/typechain-types/factories/PendleMarketFactory__factory.ts +84 -86
- package/typechain-types/factories/PendleMarket__factory.ts +131 -37
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/PendleQiSAvaxSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +141 -22
- package/typechain-types/factories/PendleSAvaxSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleSJoeSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleStargateSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +203 -129
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleYearnVaultSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +97 -72
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +233 -39
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +126 -72
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +93 -41
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +90 -17
- package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +14 -1
- package/typechain-types/hardhat.d.ts +162 -0
- package/typechain-types/index.ts +36 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.json +0 -1801
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +0 -447
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.json +0 -24
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +0 -874
- package/contracts/core/actions/ActionCore.sol +0 -382
- package/contracts/core/actions/ActionYT.sol +0 -93
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +0 -303
- package/contracts/interfaces/IPActionCore.sol +0 -306
- package/contracts/interfaces/IPRouterStatic.sol +0 -152
- package/deployments/43113-markets/benqi-market-599408.json +0 -7
- package/deployments/43113-markets/benqi-market-93bbf0.json +0 -7
- package/deployments/43113-markets/benqi-market-95E744.json +0 -7
- package/deployments/43113-markets/benqi-market-D91a3F.json +0 -7
- package/deployments/80001-markets/benqi-market-007811.json +0 -7
- package/deployments/80001-markets/benqi-market-3fe528.json +0 -7
- package/typechain-types/FeeDistributorAbstract.ts +0 -164
- package/typechain-types/IPVotingControllerStorage.ts +0 -169
- package/typechain-types/factories/FeeDistributorAbstract__factory.ts +0 -90
- package/typechain-types/factories/IPVotingControllerStorage__factory.ts +0 -107
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.15;
|
|
3
|
-
|
|
4
|
-
import "../../../interfaces/IPMarketFactory.sol";
|
|
5
|
-
import "../../../interfaces/IPMarket.sol";
|
|
6
|
-
import "../../../interfaces/IPMarketSwapCallback.sol";
|
|
7
|
-
import "../../../libraries/math/MarketApproxLib.sol";
|
|
8
|
-
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
9
|
-
import "./ActionSCYAndPYBase.sol";
|
|
10
|
-
|
|
11
|
-
abstract contract ActionSCYAndPTBase is ActionSCYAndPYBase {
|
|
12
|
-
using Math for uint256;
|
|
13
|
-
using Math for int256;
|
|
14
|
-
using MarketMathCore for MarketState;
|
|
15
|
-
using MarketApproxLib for MarketState;
|
|
16
|
-
using SafeERC20 for IERC20;
|
|
17
|
-
using PYIndexLib for IPYieldToken;
|
|
18
|
-
|
|
19
|
-
bytes private constant EMPTY_BYTES = abi.encode();
|
|
20
|
-
|
|
21
|
-
/// @dev since this contract will be proxied, it must not contains non-immutable variables
|
|
22
|
-
|
|
23
|
-
/// @dev For doPull: if doPull is true, this function will do transferFrom as necessary from msg.sender. Else, it will
|
|
24
|
-
/// assume tokens have already been transferred in.
|
|
25
|
-
|
|
26
|
-
function _addLiquidityDualScyAndPt(
|
|
27
|
-
address receiver,
|
|
28
|
-
address market,
|
|
29
|
-
uint256 scyDesired,
|
|
30
|
-
uint256 ptDesired,
|
|
31
|
-
uint256 minLpOut,
|
|
32
|
-
bool doPull
|
|
33
|
-
)
|
|
34
|
-
internal
|
|
35
|
-
returns (
|
|
36
|
-
uint256 netLpOut,
|
|
37
|
-
uint256 scyUsed,
|
|
38
|
-
uint256 ptUsed
|
|
39
|
-
)
|
|
40
|
-
{
|
|
41
|
-
(ISuperComposableYield SCY, IPPrincipalToken PT, IPYieldToken YT) = IPMarket(market)
|
|
42
|
-
.readTokens();
|
|
43
|
-
|
|
44
|
-
MarketState memory state = IPMarket(market).readState(false);
|
|
45
|
-
(, netLpOut, scyUsed, ptUsed) = state.addLiquidity(
|
|
46
|
-
YT.newIndex(),
|
|
47
|
-
scyDesired,
|
|
48
|
-
ptDesired,
|
|
49
|
-
block.timestamp
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
// early-check
|
|
53
|
-
require(netLpOut >= minLpOut, "insufficient lp out");
|
|
54
|
-
|
|
55
|
-
if (doPull) {
|
|
56
|
-
IERC20(SCY).safeTransferFrom(msg.sender, market, scyUsed);
|
|
57
|
-
IERC20(PT).safeTransferFrom(msg.sender, market, ptUsed);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
netLpOut = IPMarket(market).mint(receiver);
|
|
61
|
-
|
|
62
|
-
// fail-safe
|
|
63
|
-
require(netLpOut >= minLpOut, "FS insufficient lp out");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _addLiquidityDualTokenAndPt(
|
|
67
|
-
address receiver,
|
|
68
|
-
address market,
|
|
69
|
-
address tokenIn,
|
|
70
|
-
uint256 tokenDesired,
|
|
71
|
-
uint256 ptDesired,
|
|
72
|
-
uint256 minLpOut
|
|
73
|
-
)
|
|
74
|
-
internal
|
|
75
|
-
returns (
|
|
76
|
-
uint256 netLpOut,
|
|
77
|
-
uint256 tokenUsed,
|
|
78
|
-
uint256 ptUsed
|
|
79
|
-
)
|
|
80
|
-
{
|
|
81
|
-
(ISuperComposableYield SCY, IPPrincipalToken PT, IPYieldToken YT) = IPMarket(market)
|
|
82
|
-
.readTokens();
|
|
83
|
-
|
|
84
|
-
uint256 scyDesired = SCY.previewDeposit(tokenIn, tokenDesired);
|
|
85
|
-
uint256 scyUsed;
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
MarketState memory state = IPMarket(market).readState(false);
|
|
89
|
-
(, netLpOut, scyUsed, ptUsed) = state.addLiquidity(
|
|
90
|
-
YT.newIndex(),
|
|
91
|
-
scyDesired,
|
|
92
|
-
ptDesired,
|
|
93
|
-
block.timestamp
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// early-check
|
|
98
|
-
require(netLpOut >= minLpOut, "insufficient lp out");
|
|
99
|
-
|
|
100
|
-
IERC20(PT).safeTransferFrom(msg.sender, market, ptUsed);
|
|
101
|
-
|
|
102
|
-
// convert tokenIn to SCY to deposit
|
|
103
|
-
tokenUsed = (tokenDesired * scyUsed).rawDivUp(scyDesired);
|
|
104
|
-
|
|
105
|
-
IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), tokenUsed);
|
|
106
|
-
|
|
107
|
-
_safeApproveInf(tokenIn, address(SCY));
|
|
108
|
-
|
|
109
|
-
SCY.deposit(market, tokenIn, tokenUsed, scyUsed);
|
|
110
|
-
|
|
111
|
-
netLpOut = IPMarket(market).mint(receiver);
|
|
112
|
-
// fail-safe
|
|
113
|
-
require(netLpOut >= minLpOut, "FS insufficient lp out");
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function _removeLiquidityDualScyAndPt(
|
|
117
|
-
address receiver,
|
|
118
|
-
address market,
|
|
119
|
-
uint256 lpToRemove,
|
|
120
|
-
uint256 scyOutMin,
|
|
121
|
-
uint256 ptOutMin
|
|
122
|
-
) internal returns (uint256 netScyOut, uint256 netPtOut) {
|
|
123
|
-
IERC20(market).safeTransferFrom(msg.sender, market, lpToRemove);
|
|
124
|
-
|
|
125
|
-
(netScyOut, netPtOut) = IPMarket(market).burn(receiver, receiver);
|
|
126
|
-
|
|
127
|
-
require(netScyOut >= scyOutMin, "insufficient SCY out");
|
|
128
|
-
require(netPtOut >= ptOutMin, "insufficient PT out");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function _removeLiquidityDualTokenAndPt(
|
|
132
|
-
address receiver,
|
|
133
|
-
address market,
|
|
134
|
-
uint256 lpToRemove,
|
|
135
|
-
address tokenOut,
|
|
136
|
-
uint256 tokenOutMin,
|
|
137
|
-
uint256 ptOutMin
|
|
138
|
-
) internal returns (uint256 netTokenOut, uint256 netPtOut) {
|
|
139
|
-
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
140
|
-
|
|
141
|
-
IERC20(market).safeTransferFrom(msg.sender, market, lpToRemove);
|
|
142
|
-
|
|
143
|
-
(, netPtOut) = IPMarket(market).burn(address(SCY), receiver);
|
|
144
|
-
|
|
145
|
-
netTokenOut = SCY.redeemAfterTransfer(receiver, tokenOut, tokenOutMin);
|
|
146
|
-
|
|
147
|
-
require(netPtOut >= ptOutMin, "insufficient PT out");
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function _swapExactPtForScy(
|
|
151
|
-
address receiver,
|
|
152
|
-
address market,
|
|
153
|
-
uint256 exactPtIn,
|
|
154
|
-
uint256 minScyOut,
|
|
155
|
-
bool doPull
|
|
156
|
-
) internal returns (uint256 netScyOut) {
|
|
157
|
-
if (doPull) {
|
|
158
|
-
(, IPPrincipalToken PT, ) = IPMarket(market).readTokens();
|
|
159
|
-
IERC20(address(PT)).safeTransferFrom(msg.sender, market, exactPtIn);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
(netScyOut, ) = IPMarket(market).swapExactPtForScy(receiver, exactPtIn, EMPTY_BYTES);
|
|
163
|
-
|
|
164
|
-
require(netScyOut >= minScyOut, "insufficient SCY out");
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @notice Note that the amount of SCY out will be a bit more than `exactScyOut`, since an approximation is used. It's
|
|
169
|
-
guaranteed that the `netScyOut` is at least `exactScyOut`
|
|
170
|
-
*/
|
|
171
|
-
function _swapPtForExactScy(
|
|
172
|
-
address receiver,
|
|
173
|
-
address market,
|
|
174
|
-
uint256 exactScyOut,
|
|
175
|
-
uint256 maxPtIn,
|
|
176
|
-
ApproxParams memory guessPtIn,
|
|
177
|
-
bool doPull
|
|
178
|
-
) internal returns (uint256 netPtIn) {
|
|
179
|
-
MarketState memory state = IPMarket(market).readState(false);
|
|
180
|
-
(, IPPrincipalToken PT, IPYieldToken YT) = IPMarket(market).readTokens();
|
|
181
|
-
|
|
182
|
-
(netPtIn, , ) = state.approxSwapPtForExactScy(
|
|
183
|
-
YT.newIndex(),
|
|
184
|
-
exactScyOut,
|
|
185
|
-
block.timestamp,
|
|
186
|
-
guessPtIn
|
|
187
|
-
);
|
|
188
|
-
require(netPtIn <= maxPtIn, "exceed limit PT in");
|
|
189
|
-
|
|
190
|
-
if (doPull) {
|
|
191
|
-
IERC20(PT).safeTransferFrom(msg.sender, market, netPtIn);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
(uint256 netScyOut, ) = IPMarket(market).swapExactPtForScy(receiver, netPtIn, EMPTY_BYTES);
|
|
195
|
-
|
|
196
|
-
// fail-safe
|
|
197
|
-
require(netScyOut >= exactScyOut, "FS insufficient SCY out");
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function _swapScyForExactPt(
|
|
201
|
-
address receiver,
|
|
202
|
-
address market,
|
|
203
|
-
uint256 exactPtOut,
|
|
204
|
-
uint256 maxScyIn,
|
|
205
|
-
bool doPull
|
|
206
|
-
) internal returns (uint256 netScyIn) {
|
|
207
|
-
MarketState memory state = IPMarket(market).readState(false);
|
|
208
|
-
(ISuperComposableYield SCY, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
209
|
-
|
|
210
|
-
(netScyIn, ) = state.swapScyForExactPt(YT.newIndex(), exactPtOut, block.timestamp);
|
|
211
|
-
|
|
212
|
-
require(netScyIn <= maxScyIn, "exceed limit SCY in");
|
|
213
|
-
|
|
214
|
-
if (doPull) {
|
|
215
|
-
IERC20(SCY).safeTransferFrom(msg.sender, market, netScyIn);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
IPMarket(market).swapScyForExactPt(receiver, exactPtOut, EMPTY_BYTES); // ignore return
|
|
219
|
-
|
|
220
|
-
// no fail-safe since exactly netScyIn will go into the market
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* @notice Note that although we will only use almost all of the `exactScyIn`, we will still transfer all in so that
|
|
225
|
-
not to leave dust behind
|
|
226
|
-
*/
|
|
227
|
-
function _swapExactScyForPt(
|
|
228
|
-
address receiver,
|
|
229
|
-
address market,
|
|
230
|
-
uint256 exactScyIn,
|
|
231
|
-
uint256 minPtOut,
|
|
232
|
-
ApproxParams memory guessPtOut,
|
|
233
|
-
bool doPull
|
|
234
|
-
) internal returns (uint256 netPtOut) {
|
|
235
|
-
MarketState memory state = IPMarket(market).readState(false);
|
|
236
|
-
(ISuperComposableYield SCY, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
237
|
-
|
|
238
|
-
(netPtOut, , ) = state.approxSwapExactScyForPt(
|
|
239
|
-
YT.newIndex(),
|
|
240
|
-
exactScyIn,
|
|
241
|
-
block.timestamp,
|
|
242
|
-
guessPtOut
|
|
243
|
-
);
|
|
244
|
-
|
|
245
|
-
require(netPtOut >= minPtOut, "insufficient PT out");
|
|
246
|
-
|
|
247
|
-
if (doPull) {
|
|
248
|
-
IERC20(SCY).safeTransferFrom(msg.sender, market, exactScyIn);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
IPMarket(market).swapScyForExactPt(receiver, netPtOut, EMPTY_BYTES); // ignore return
|
|
252
|
-
|
|
253
|
-
// no fail-safe since exactly netPtOut >= minPtOut will be out
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* @notice swap from any ERC20 tokens, through Uniswap's forks, to get baseTokens to make SCY, then swap
|
|
258
|
-
from SCY to PT
|
|
259
|
-
* @dev simply a combination of _mintScyFromToken & _swapExactScyForPt
|
|
260
|
-
*/
|
|
261
|
-
function _swapExactTokenForPt(
|
|
262
|
-
address receiver,
|
|
263
|
-
address market,
|
|
264
|
-
uint256 minPtOut,
|
|
265
|
-
ApproxParams memory guessPtOut,
|
|
266
|
-
TokenInput calldata input
|
|
267
|
-
) internal returns (uint256 netPtOut) {
|
|
268
|
-
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
269
|
-
|
|
270
|
-
// all output SCY is transferred directly to the market
|
|
271
|
-
uint256 netScyUseToBuyPt = _mintScyFromToken(address(market), address(SCY), 1, input);
|
|
272
|
-
|
|
273
|
-
// SCY is already in the market, hence doPull = false
|
|
274
|
-
netPtOut = _swapExactScyForPt(
|
|
275
|
-
receiver,
|
|
276
|
-
market,
|
|
277
|
-
netScyUseToBuyPt,
|
|
278
|
-
minPtOut,
|
|
279
|
-
guessPtOut,
|
|
280
|
-
false
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* @notice swap from PT to SCY, then redeem SCY to baseToken & swap through Uniswap's forks to get tokenOut
|
|
286
|
-
* @dev simply a combination of _swapExactPtForScy & _redeemScyToToken
|
|
287
|
-
*/
|
|
288
|
-
function _swapExactPtForToken(
|
|
289
|
-
address receiver,
|
|
290
|
-
address market,
|
|
291
|
-
uint256 exactPtIn,
|
|
292
|
-
TokenOutput calldata output,
|
|
293
|
-
bool doPull
|
|
294
|
-
) internal returns (uint256 netTokenOut) {
|
|
295
|
-
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
296
|
-
|
|
297
|
-
// all output SCY is directly transferred to the SCY contract
|
|
298
|
-
uint256 netScyReceived = _swapExactPtForScy(address(SCY), market, exactPtIn, 1, doPull);
|
|
299
|
-
|
|
300
|
-
// since all SCY is already at the SCY contract, doPull = false
|
|
301
|
-
netTokenOut = _redeemScyToToken(receiver, address(SCY), netScyReceived, output, false);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.15;
|
|
3
|
-
|
|
4
|
-
import "../libraries/math/MarketApproxLib.sol";
|
|
5
|
-
import "../libraries/kyberswap/KyberSwapHelper.sol";
|
|
6
|
-
|
|
7
|
-
interface IPActionCore {
|
|
8
|
-
event AddLiquidityDualScyAndPt(
|
|
9
|
-
address indexed caller,
|
|
10
|
-
address indexed market,
|
|
11
|
-
address indexed receiver,
|
|
12
|
-
uint256 scyUsed,
|
|
13
|
-
uint256 ptUsed,
|
|
14
|
-
uint256 lpOut
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
event AddLiquidityDualTokenAndPt(
|
|
18
|
-
address indexed caller,
|
|
19
|
-
address indexed market,
|
|
20
|
-
address indexed receiver,
|
|
21
|
-
address tokenIn,
|
|
22
|
-
uint256 tokenUsed,
|
|
23
|
-
uint256 ptUsed,
|
|
24
|
-
uint256 lpOut
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
event RemoveLiquidityDualScyAndPt(
|
|
28
|
-
address indexed caller,
|
|
29
|
-
address indexed market,
|
|
30
|
-
address receiver,
|
|
31
|
-
uint256 netlpIn,
|
|
32
|
-
uint256 amountPTOut,
|
|
33
|
-
uint256 amountSCYOut
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
event RemoveLiquidityDualIbTokenAndPt(
|
|
37
|
-
address indexed caller,
|
|
38
|
-
address indexed market,
|
|
39
|
-
address receiver,
|
|
40
|
-
uint256 lpIn,
|
|
41
|
-
uint256 amountPTOut,
|
|
42
|
-
uint256 amountIbTokenOut
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
event SwapPtAndScy(
|
|
46
|
-
address indexed caller,
|
|
47
|
-
address indexed market,
|
|
48
|
-
address indexed receiver,
|
|
49
|
-
int256 amountPtToAccount,
|
|
50
|
-
int256 amountScyToAccount
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
event SwapPtAndToken(
|
|
54
|
-
address indexed caller,
|
|
55
|
-
address indexed market,
|
|
56
|
-
address indexed token,
|
|
57
|
-
address receiver,
|
|
58
|
-
int256 amountPtToAccount,
|
|
59
|
-
int256 amountTokenToAccount
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
event MintScyFromToken(
|
|
63
|
-
address indexed caller,
|
|
64
|
-
address indexed receiver,
|
|
65
|
-
address indexed SCY,
|
|
66
|
-
address tokenIn,
|
|
67
|
-
uint256 netTokenIn,
|
|
68
|
-
uint256 netScyOut
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
event RedeemScyToToken(
|
|
72
|
-
address indexed caller,
|
|
73
|
-
address indexed receiver,
|
|
74
|
-
address indexed SCY,
|
|
75
|
-
uint256 netScyIn,
|
|
76
|
-
address tokenOut,
|
|
77
|
-
uint256 netTokenOut
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
event MintPyFromScy(
|
|
81
|
-
address indexed caller,
|
|
82
|
-
address indexed receiver,
|
|
83
|
-
address indexed YT,
|
|
84
|
-
uint256 netScyIn,
|
|
85
|
-
uint256 netPyOut
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
event RedeemPyToScy(
|
|
89
|
-
address indexed caller,
|
|
90
|
-
address indexed receiver,
|
|
91
|
-
address indexed YT,
|
|
92
|
-
uint256 netPyIn,
|
|
93
|
-
uint256 netScyOut
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
event MintPyFromToken(
|
|
97
|
-
address indexed caller,
|
|
98
|
-
address indexed receiver,
|
|
99
|
-
address indexed YT,
|
|
100
|
-
address tokenIn,
|
|
101
|
-
uint256 netTokenIn,
|
|
102
|
-
uint256 netPyOut
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
event RedeemPyToToken(
|
|
106
|
-
address indexed caller,
|
|
107
|
-
address indexed receiver,
|
|
108
|
-
address indexed YT,
|
|
109
|
-
uint256 netPyIn,
|
|
110
|
-
address tokenOut,
|
|
111
|
-
uint256 netTokenOut
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
function addLiquidityDualScyAndPt(
|
|
115
|
-
address receiver,
|
|
116
|
-
address market,
|
|
117
|
-
uint256 scyDesired,
|
|
118
|
-
uint256 ptDesired,
|
|
119
|
-
uint256 minLpOut
|
|
120
|
-
)
|
|
121
|
-
external
|
|
122
|
-
returns (
|
|
123
|
-
uint256 netLpOut,
|
|
124
|
-
uint256 scyUsed,
|
|
125
|
-
uint256 ptUsed
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
function addLiquidityDualTokenAndPt(
|
|
129
|
-
address receiver,
|
|
130
|
-
address market,
|
|
131
|
-
address tokenIn,
|
|
132
|
-
uint256 tokenDesired,
|
|
133
|
-
uint256 ptDesired,
|
|
134
|
-
uint256 minLpOut
|
|
135
|
-
)
|
|
136
|
-
external
|
|
137
|
-
returns (
|
|
138
|
-
uint256 netLpOut,
|
|
139
|
-
uint256 tokenUsed,
|
|
140
|
-
uint256 ptUsed
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
function addLiquiditySinglePt(
|
|
144
|
-
address receiver,
|
|
145
|
-
address market,
|
|
146
|
-
uint256 netPtIn,
|
|
147
|
-
uint256 minLpOut,
|
|
148
|
-
ApproxParams calldata guessPtSwapToScy
|
|
149
|
-
) external returns (uint256 netLpOut);
|
|
150
|
-
|
|
151
|
-
function addLiquiditySingleScy(
|
|
152
|
-
address receiver,
|
|
153
|
-
address market,
|
|
154
|
-
uint256 netScyIn,
|
|
155
|
-
uint256 minLpOut,
|
|
156
|
-
ApproxParams calldata guessPtReceivedFromScy
|
|
157
|
-
) external returns (uint256 netLpOut);
|
|
158
|
-
|
|
159
|
-
function addLiquiditySingleToken(
|
|
160
|
-
address receiver,
|
|
161
|
-
address market,
|
|
162
|
-
uint256 minLpOut,
|
|
163
|
-
ApproxParams calldata guessPtReceivedFromScy,
|
|
164
|
-
TokenInput calldata input
|
|
165
|
-
) external returns (uint256 netLpOut);
|
|
166
|
-
|
|
167
|
-
function removeLiquidityDualScyAndPt(
|
|
168
|
-
address receiver,
|
|
169
|
-
address market,
|
|
170
|
-
uint256 lpToRemove,
|
|
171
|
-
uint256 scyOutMin,
|
|
172
|
-
uint256 ptOutMin
|
|
173
|
-
) external returns (uint256 netScyOut, uint256 netPtOut);
|
|
174
|
-
|
|
175
|
-
function removeLiquidityDualTokenAndPt(
|
|
176
|
-
address receiver,
|
|
177
|
-
address market,
|
|
178
|
-
uint256 lpToRemove,
|
|
179
|
-
address tokenOut,
|
|
180
|
-
uint256 tokenOutMin,
|
|
181
|
-
uint256 ptOutMin
|
|
182
|
-
) external returns (uint256 netTokenOut, uint256 netPtOut);
|
|
183
|
-
|
|
184
|
-
function removeLiquiditySinglePt(
|
|
185
|
-
address receiver,
|
|
186
|
-
address market,
|
|
187
|
-
uint256 lpToRemove,
|
|
188
|
-
uint256 minPtOut,
|
|
189
|
-
ApproxParams calldata guessPtOut
|
|
190
|
-
) external returns (uint256 netPtOut);
|
|
191
|
-
|
|
192
|
-
function removeLiquiditySingleScy(
|
|
193
|
-
address receiver,
|
|
194
|
-
address market,
|
|
195
|
-
uint256 lpToRemove,
|
|
196
|
-
uint256 minScyOut
|
|
197
|
-
) external returns (uint256 netScyOut);
|
|
198
|
-
|
|
199
|
-
function removeLiquiditySingleToken(
|
|
200
|
-
address receiver,
|
|
201
|
-
address market,
|
|
202
|
-
uint256 lpToRemove,
|
|
203
|
-
TokenOutput calldata output
|
|
204
|
-
) external returns (uint256 netTokenOut);
|
|
205
|
-
|
|
206
|
-
function swapExactPtForScy(
|
|
207
|
-
address receiver,
|
|
208
|
-
address market,
|
|
209
|
-
uint256 exactPtIn,
|
|
210
|
-
uint256 minScyOut
|
|
211
|
-
) external returns (uint256 netScyOut);
|
|
212
|
-
|
|
213
|
-
function swapPtForExactScy(
|
|
214
|
-
address receiver,
|
|
215
|
-
address market,
|
|
216
|
-
uint256 exactScyOut,
|
|
217
|
-
uint256 maxPtIn,
|
|
218
|
-
ApproxParams calldata guessPtIn
|
|
219
|
-
) external returns (uint256 netPtIn);
|
|
220
|
-
|
|
221
|
-
function swapScyForExactPt(
|
|
222
|
-
address receiver,
|
|
223
|
-
address market,
|
|
224
|
-
uint256 exactPtOut,
|
|
225
|
-
uint256 maxScyIn
|
|
226
|
-
) external returns (uint256 netScyIn);
|
|
227
|
-
|
|
228
|
-
function swapExactScyForPt(
|
|
229
|
-
address receiver,
|
|
230
|
-
address market,
|
|
231
|
-
uint256 exactScyIn,
|
|
232
|
-
uint256 minPtOut,
|
|
233
|
-
ApproxParams calldata guessPtOut
|
|
234
|
-
) external returns (uint256 netPtOut);
|
|
235
|
-
|
|
236
|
-
function mintScyFromToken(
|
|
237
|
-
address receiver,
|
|
238
|
-
address SCY,
|
|
239
|
-
uint256 minScyOut,
|
|
240
|
-
TokenInput calldata input
|
|
241
|
-
) external returns (uint256 netScyOut);
|
|
242
|
-
|
|
243
|
-
function redeemScyToToken(
|
|
244
|
-
address receiver,
|
|
245
|
-
address SCY,
|
|
246
|
-
uint256 netScyIn,
|
|
247
|
-
TokenOutput calldata output
|
|
248
|
-
) external returns (uint256 netTokenOut);
|
|
249
|
-
|
|
250
|
-
function mintPyFromToken(
|
|
251
|
-
address receiver,
|
|
252
|
-
address YT,
|
|
253
|
-
uint256 minPyOut,
|
|
254
|
-
TokenInput calldata input
|
|
255
|
-
) external returns (uint256 netPyOut);
|
|
256
|
-
|
|
257
|
-
function redeemPyToToken(
|
|
258
|
-
address receiver,
|
|
259
|
-
address YT,
|
|
260
|
-
uint256 netPyIn,
|
|
261
|
-
TokenOutput calldata output
|
|
262
|
-
) external returns (uint256 netTokenOut);
|
|
263
|
-
|
|
264
|
-
function mintPyFromScy(
|
|
265
|
-
address receiver,
|
|
266
|
-
address YT,
|
|
267
|
-
uint256 netScyIn,
|
|
268
|
-
uint256 minPyOut
|
|
269
|
-
) external returns (uint256 netPyOut);
|
|
270
|
-
|
|
271
|
-
function redeemPyToScy(
|
|
272
|
-
address receiver,
|
|
273
|
-
address YT,
|
|
274
|
-
uint256 netPyIn,
|
|
275
|
-
uint256 minScyOut
|
|
276
|
-
) external returns (uint256 netScyOut);
|
|
277
|
-
|
|
278
|
-
function swapExactTokenForPt(
|
|
279
|
-
address receiver,
|
|
280
|
-
address market,
|
|
281
|
-
uint256 minPtOut,
|
|
282
|
-
ApproxParams calldata guessPtOut,
|
|
283
|
-
TokenInput calldata input
|
|
284
|
-
) external returns (uint256 netPtOut);
|
|
285
|
-
|
|
286
|
-
function swapExactPtForToken(
|
|
287
|
-
address receiver,
|
|
288
|
-
address market,
|
|
289
|
-
uint256 exactPtIn,
|
|
290
|
-
TokenOutput calldata output
|
|
291
|
-
) external returns (uint256 netTokenOut);
|
|
292
|
-
|
|
293
|
-
function redeemDueInterestAndRewards(
|
|
294
|
-
address user,
|
|
295
|
-
address[] calldata scys,
|
|
296
|
-
address[] calldata yts,
|
|
297
|
-
address[] calldata markets
|
|
298
|
-
)
|
|
299
|
-
external
|
|
300
|
-
returns (
|
|
301
|
-
uint256[][] memory scyRewards,
|
|
302
|
-
uint256[] memory ytInterests,
|
|
303
|
-
uint256[][] memory ytRewards,
|
|
304
|
-
uint256[][] memory marketRewards
|
|
305
|
-
);
|
|
306
|
-
}
|