@pendle/core-v2 0.7.1-beta-2 → 0.8.0-beta-2
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 +33 -17
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.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/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- 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 +33 -17
- 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 +33 -17
- 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 +33 -17
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.json +33 -17
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.json +31 -15
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +31 -15
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.json +0 -26
- 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 +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- 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 +2 -2
- 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 +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +125 -111
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +2 -2
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -2
- 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 +77 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +51 -20
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +72 -93
- 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 +3 -3
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +2 -2
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
- 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/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/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 +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +1 -1
- 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 +48 -83
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- 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/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- 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/IPYieldContractFactory.sol/IPYieldContractFactory.json +30 -4
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +8 -92
- 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/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +31 -2
- 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/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/SCYIndex.sol/SCYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.json +2 -2
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.json +2 -2
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- 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 +1 -1
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +2 -2
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.json +2 -2
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.json +2 -2
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +2 -2
- 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 +16 -12
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +3 -3
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +36 -5
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +64 -42
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +0 -7
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +1 -1
- package/contracts/core/LiquidityMining/PendleGauge.sol +24 -8
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +47 -96
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +86 -73
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +17 -16
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +1 -1
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +3 -4
- package/contracts/core/Market/PendleMarket.sol +34 -64
- package/contracts/core/PendleRouter.sol +1 -1
- package/contracts/core/YieldContracts/InterestManagerYT.sol +11 -8
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +18 -12
- package/contracts/core/YieldContracts/PendleYieldToken.sol +191 -138
- package/contracts/core/actions/ActionCallback.sol +12 -13
- package/contracts/core/actions/ActionCore.sol +84 -22
- package/contracts/core/actions/ActionYT.sol +33 -15
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +6 -17
- package/contracts/core/actions/base/ActionSCYAndPYBase.sol +20 -50
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +6 -13
- package/contracts/interfaces/IPActionCore.sol +72 -1
- package/contracts/interfaces/IPActionYT.sol +15 -0
- package/contracts/interfaces/IPMarket.sol +7 -26
- package/contracts/interfaces/IPRouterStatic.sol +7 -2
- package/contracts/interfaces/IPVeToken.sol +0 -2
- package/contracts/interfaces/IPVotingEscrow.sol +1 -1
- package/contracts/interfaces/IPYieldContractFactory.sol +6 -2
- package/contracts/interfaces/IPYieldToken.sol +21 -11
- package/contracts/interfaces/ISuperComposableYield.sol +22 -28
- package/contracts/interfaces/IYearnVault.sol +13 -1
- package/contracts/libraries/RewardManager.sol +9 -6
- package/contracts/libraries/RewardManagerAbstract.sol +6 -8
- package/contracts/libraries/SCY/SCYIndex.sol +17 -0
- package/contracts/libraries/SCY/SCYUtils.sol +16 -0
- package/contracts/libraries/VeBalanceLib.sol +0 -1
- package/contracts/libraries/helpers/ArrayLib.sol +11 -0
- package/contracts/libraries/helpers/TokenHelper.sol +6 -5
- package/contracts/libraries/math/MarketApproxLib.sol +91 -36
- package/contracts/libraries/math/MarketMathCore.sol +21 -25
- package/contracts/libraries/math/Math.sol +0 -7
- package/contracts/offchain-helpers/RouterStatic.sol +139 -7
- package/deployments/43113-core.json +11 -11
- package/deployments/43113-markets/benqi-market-0x9f080Af83E84099ED92b1b9b4B4BbE4400f2A3CB.json +7 -0
- package/deployments/80001-core.json +10 -10
- package/deployments/80001-markets/benqi-market-0x78699fa58C484e9867B8047A12E959ccB8BaD90E.json +7 -0
- package/package.json +2 -2
- package/typechain-types/ActionCore.ts +8 -8
- package/typechain-types/CelerReceiver.ts +267 -0
- package/typechain-types/CelerSender.ts +164 -0
- package/typechain-types/IPActionCore.ts +8 -8
- package/typechain-types/IPAllAction.ts +8 -8
- package/typechain-types/IPMarket.ts +66 -109
- package/typechain-types/IPVotingEscrowController.ts +154 -0
- package/typechain-types/IPYieldContractFactory.ts +34 -0
- package/typechain-types/IPYieldToken.ts +12 -112
- package/typechain-types/ISuperComposableYield.ts +54 -10
- package/typechain-types/PendleAaveV3SCY.ts +54 -29
- package/typechain-types/PendleBtrflyScy.ts +56 -58
- package/typechain-types/PendleERC4626SCY.ts +54 -29
- package/typechain-types/PendleGauge.ts +0 -32
- package/typechain-types/PendleGaugeController.ts +282 -0
- package/typechain-types/PendleGaugeControllerMainchain.ts +346 -0
- package/typechain-types/PendleGaugeControllerSidechain.ts +460 -0
- package/typechain-types/PendleJoeLpSCY.ts +56 -58
- package/typechain-types/PendleMarket.ts +169 -140
- package/typechain-types/PendlePrincipalToken.ts +104 -0
- package/typechain-types/PendleQiTokenSCY.ts +54 -29
- package/typechain-types/PendleVotingController.ts +865 -0
- package/typechain-types/PendleWstEthSCY.ts +54 -29
- package/typechain-types/PendleYearnVaultSCY.ts +54 -29
- package/typechain-types/PendleYieldContractFactory.ts +66 -19
- package/typechain-types/PendleYieldToken.ts +122 -158
- package/typechain-types/SCYBase.ts +54 -29
- package/typechain-types/SCYBaseWithRewards.ts +54 -29
- package/typechain-types/VotingControllerStorage.ts +410 -0
- package/typechain-types/VotingEscrowController.ts +154 -0
- package/typechain-types/VotingEscrowToken.ts +335 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +2 -2
- package/typechain-types/factories/ActionYT__factory.ts +1 -1
- package/typechain-types/factories/CelerReceiver__factory.ts +140 -0
- package/typechain-types/factories/CelerSender__factory.ts +67 -0
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IPActionCore__factory.ts +1 -1
- package/typechain-types/factories/IPAllAction__factory.ts +1 -1
- package/typechain-types/factories/IPMarket__factory.ts +48 -83
- package/typechain-types/factories/IPVotingEscrowController__factory.ts +80 -0
- package/typechain-types/factories/IPYieldContractFactory__factory.ts +30 -4
- package/typechain-types/factories/IPYieldToken__factory.ts +6 -90
- package/typechain-types/factories/ISuperComposableYield__factory.ts +31 -2
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +32 -16
- package/typechain-types/factories/PendleBtrflyScy__factory.ts +52 -28
- package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20__factory.ts +1 -1
- package/typechain-types/factories/PendleERC4626SCY__factory.ts +32 -16
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerMainchain__factory.ts +269 -0
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechain__factory.ts +328 -0
- package/typechain-types/factories/PendleGaugeController__factory.ts +149 -0
- package/typechain-types/factories/PendleGauge__factory.ts +0 -26
- package/typechain-types/factories/PendleGovernanceManager__factory.ts +1 -1
- package/typechain-types/factories/PendleJoeLpSCY__factory.ts +34 -28
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +124 -110
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +76 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingController__factory.ts +584 -0
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleYearnVaultSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +54 -19
- package/typechain-types/factories/PendleYieldToken__factory.ts +70 -91
- package/typechain-types/factories/RouterStatic__factory.ts +1 -1
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +31 -15
- package/typechain-types/factories/SCYBase__factory.ts +31 -15
- package/typechain-types/factories/VotingControllerStorage__factory.ts +298 -0
- package/typechain-types/factories/VotingEscrowController__factory.ts +80 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowToken__factory.ts +225 -0
- package/typechain-types/hardhat.d.ts +0 -27
- package/typechain-types/index.ts +0 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.json +0 -635
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.json +0 -653
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.json +0 -67
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.json +0 -10
- package/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol +0 -123
- package/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol +0 -245
- package/contracts/interfaces/IPMarketAddRemoveCallback.sol +0 -18
- package/contracts/libraries/solmate/Bytes32AddressLib.sol +0 -14
- package/deployments/43113-markets/benqi-market.json +0 -7
- package/deployments/80001-markets/benqi-market.json +0 -7
|
@@ -39,6 +39,7 @@ library MarketApproxLib {
|
|
|
39
39
|
struct VarsSwapPtForExactScy {
|
|
40
40
|
uint256 netPtInGuess;
|
|
41
41
|
int256 assetToAccount;
|
|
42
|
+
int256 assetToReserve;
|
|
42
43
|
uint256 netAssetOut;
|
|
43
44
|
uint256 minAssetOut;
|
|
44
45
|
uint256 largestGoodSlope;
|
|
@@ -58,7 +59,8 @@ library MarketApproxLib {
|
|
|
58
59
|
pure
|
|
59
60
|
returns (
|
|
60
61
|
uint256, /*netPtIn*/
|
|
61
|
-
uint256 /*netScyOut*/
|
|
62
|
+
uint256, /*netScyOut*/
|
|
63
|
+
uint256 /*netScyToReserve*/
|
|
62
64
|
)
|
|
63
65
|
{
|
|
64
66
|
/*
|
|
@@ -81,9 +83,8 @@ library MarketApproxLib {
|
|
|
81
83
|
VarsSwapPtForExactScy memory vars;
|
|
82
84
|
MarketPreCompute memory comp = market.getMarketPreCompute(index, blockTime);
|
|
83
85
|
|
|
84
|
-
if (approx.guessMax == type(uint256).max)
|
|
85
|
-
|
|
86
|
-
}
|
|
86
|
+
if (approx.guessMax == type(uint256).max) approx.guessMax = calcMaxPtIn(comp.totalAsset);
|
|
87
|
+
|
|
87
88
|
vars.minAssetOut = index.scyToAsset(minScyOut);
|
|
88
89
|
|
|
89
90
|
for (uint256 iter = 0; iter < approx.maxIteration; ) {
|
|
@@ -100,7 +101,10 @@ library MarketApproxLib {
|
|
|
100
101
|
continue;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
(vars.assetToAccount, ) = market.calcTrade(
|
|
104
|
+
(vars.assetToAccount, vars.assetToReserve) = market.calcTrade(
|
|
105
|
+
comp,
|
|
106
|
+
vars.netPtInGuess.neg()
|
|
107
|
+
);
|
|
104
108
|
vars.netAssetOut = vars.assetToAccount.Uint();
|
|
105
109
|
|
|
106
110
|
if (vars.netAssetOut >= vars.minAssetOut) {
|
|
@@ -111,7 +115,11 @@ library MarketApproxLib {
|
|
|
111
115
|
approx.eps
|
|
112
116
|
);
|
|
113
117
|
if (isAnswerAccepted)
|
|
114
|
-
return (
|
|
118
|
+
return (
|
|
119
|
+
vars.netPtInGuess,
|
|
120
|
+
index.assetToScy(vars.netAssetOut),
|
|
121
|
+
index.assetToScy(vars.assetToReserve.Uint())
|
|
122
|
+
);
|
|
115
123
|
} else {
|
|
116
124
|
approx.guessMin = vars.netPtInGuess;
|
|
117
125
|
}
|
|
@@ -126,6 +134,7 @@ library MarketApproxLib {
|
|
|
126
134
|
struct VarsSwapExactScyForYt {
|
|
127
135
|
uint256 ptInGuess;
|
|
128
136
|
int256 assetToAccount;
|
|
137
|
+
int256 assetToReserve;
|
|
129
138
|
uint256 netAssetOut;
|
|
130
139
|
uint256 amountAssetNeedMore;
|
|
131
140
|
uint256 largestGoodSlope;
|
|
@@ -145,7 +154,8 @@ library MarketApproxLib {
|
|
|
145
154
|
pure
|
|
146
155
|
returns (
|
|
147
156
|
uint256, /*netYtOut*/
|
|
148
|
-
uint256 /*netScyIn*/
|
|
157
|
+
uint256, /*netScyIn*/
|
|
158
|
+
uint256
|
|
149
159
|
)
|
|
150
160
|
{
|
|
151
161
|
/*
|
|
@@ -174,9 +184,7 @@ library MarketApproxLib {
|
|
|
174
184
|
VarsSwapExactScyForYt memory vars;
|
|
175
185
|
MarketPreCompute memory comp = market.getMarketPreCompute(index, blockTime);
|
|
176
186
|
|
|
177
|
-
if (approx.guessMax == type(uint256).max)
|
|
178
|
-
approx.guessMax = calcMaxPtIn(market.totalPt, comp.totalAsset);
|
|
179
|
-
}
|
|
187
|
+
if (approx.guessMax == type(uint256).max) approx.guessMax = calcMaxPtIn(comp.totalAsset);
|
|
180
188
|
|
|
181
189
|
vars.maxAssetIn = index.scyToAsset(maxScyIn);
|
|
182
190
|
|
|
@@ -195,7 +203,10 @@ library MarketApproxLib {
|
|
|
195
203
|
continue;
|
|
196
204
|
}
|
|
197
205
|
|
|
198
|
-
(vars.assetToAccount, ) = market.calcTrade(
|
|
206
|
+
(vars.assetToAccount, vars.assetToReserve) = market.calcTrade(
|
|
207
|
+
comp,
|
|
208
|
+
vars.ptInGuess.neg()
|
|
209
|
+
);
|
|
199
210
|
vars.netAssetOut = vars.assetToAccount.Uint();
|
|
200
211
|
vars.amountAssetNeedMore = vars.ptInGuess - vars.netAssetOut;
|
|
201
212
|
|
|
@@ -207,7 +218,11 @@ library MarketApproxLib {
|
|
|
207
218
|
approx.eps
|
|
208
219
|
);
|
|
209
220
|
if (isAnswerAccepted)
|
|
210
|
-
return (
|
|
221
|
+
return (
|
|
222
|
+
vars.ptInGuess,
|
|
223
|
+
index.assetToScy(vars.amountAssetNeedMore),
|
|
224
|
+
index.assetToScy(vars.assetToReserve.Uint())
|
|
225
|
+
);
|
|
211
226
|
} else {
|
|
212
227
|
approx.guessMax = vars.ptInGuess - 1;
|
|
213
228
|
}
|
|
@@ -219,6 +234,14 @@ library MarketApproxLib {
|
|
|
219
234
|
revert("approx fail");
|
|
220
235
|
}
|
|
221
236
|
|
|
237
|
+
struct VarsSwapExactScyForPt {
|
|
238
|
+
uint256 maxAssetIn;
|
|
239
|
+
uint256 ptOutGuess;
|
|
240
|
+
int256 assetToAccount;
|
|
241
|
+
int256 assetToReserve;
|
|
242
|
+
uint256 netAssetIn;
|
|
243
|
+
}
|
|
244
|
+
|
|
222
245
|
function approxSwapExactScyForPt(
|
|
223
246
|
MarketState memory market,
|
|
224
247
|
SCYIndex index,
|
|
@@ -230,7 +253,8 @@ library MarketApproxLib {
|
|
|
230
253
|
pure
|
|
231
254
|
returns (
|
|
232
255
|
uint256, /*netPtOut*/
|
|
233
|
-
uint256 /*netScyIn*/
|
|
256
|
+
uint256, /*netScyIn*/
|
|
257
|
+
uint256
|
|
234
258
|
)
|
|
235
259
|
{
|
|
236
260
|
/*
|
|
@@ -251,24 +275,37 @@ library MarketApproxLib {
|
|
|
251
275
|
|
|
252
276
|
require(isValidApproxParams(approx), "invalid approx approx");
|
|
253
277
|
|
|
278
|
+
VarsSwapExactScyForPt memory vars;
|
|
254
279
|
MarketPreCompute memory comp = market.getMarketPreCompute(index, blockTime);
|
|
255
280
|
if (approx.guessMax == type(uint256).max) {
|
|
256
281
|
approx.guessMax = calcMaxPtOut(market.totalPt, comp);
|
|
257
282
|
}
|
|
258
283
|
|
|
259
|
-
|
|
284
|
+
vars.maxAssetIn = index.scyToAsset(maxScyIn);
|
|
260
285
|
|
|
261
286
|
for (uint256 iter = 0; iter < approx.maxIteration; ) {
|
|
262
|
-
|
|
263
|
-
(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
287
|
+
vars.ptOutGuess = getCurrentGuess(iter, approx);
|
|
288
|
+
(vars.assetToAccount, vars.assetToReserve) = market.calcTrade(
|
|
289
|
+
comp,
|
|
290
|
+
vars.ptOutGuess.Int()
|
|
291
|
+
);
|
|
292
|
+
vars.netAssetIn = vars.assetToAccount.abs();
|
|
293
|
+
|
|
294
|
+
if (vars.netAssetIn <= vars.maxAssetIn) {
|
|
295
|
+
approx.guessMin = vars.ptOutGuess;
|
|
296
|
+
bool isAnswerAccepted = Math.isASmallerApproxB(
|
|
297
|
+
vars.netAssetIn,
|
|
298
|
+
vars.maxAssetIn,
|
|
299
|
+
approx.eps
|
|
300
|
+
);
|
|
301
|
+
if (isAnswerAccepted)
|
|
302
|
+
return (
|
|
303
|
+
vars.ptOutGuess,
|
|
304
|
+
index.assetToScy(vars.netAssetIn),
|
|
305
|
+
index.assetToScy(vars.assetToReserve.Uint())
|
|
306
|
+
);
|
|
270
307
|
} else {
|
|
271
|
-
approx.guessMax = ptOutGuess;
|
|
308
|
+
approx.guessMax = vars.ptOutGuess;
|
|
272
309
|
}
|
|
273
310
|
|
|
274
311
|
unchecked {
|
|
@@ -278,6 +315,15 @@ library MarketApproxLib {
|
|
|
278
315
|
revert("approx fail");
|
|
279
316
|
}
|
|
280
317
|
|
|
318
|
+
struct VarsSwapYtForExactScy {
|
|
319
|
+
uint256 minAssetOut;
|
|
320
|
+
uint256 ptOutGuess;
|
|
321
|
+
int256 assetToAccount;
|
|
322
|
+
int256 assetToReserve;
|
|
323
|
+
uint256 netAssetOwed;
|
|
324
|
+
uint256 netAssetOut;
|
|
325
|
+
}
|
|
326
|
+
|
|
281
327
|
function approxSwapYtForExactScy(
|
|
282
328
|
MarketState memory market,
|
|
283
329
|
SCYIndex index,
|
|
@@ -289,7 +335,8 @@ library MarketApproxLib {
|
|
|
289
335
|
pure
|
|
290
336
|
returns (
|
|
291
337
|
uint256, /*netYtIn*/
|
|
292
|
-
uint256 /*netScyOut*/
|
|
338
|
+
uint256, /*netScyOut*/
|
|
339
|
+
uint256
|
|
293
340
|
)
|
|
294
341
|
{
|
|
295
342
|
/*
|
|
@@ -315,32 +362,40 @@ library MarketApproxLib {
|
|
|
315
362
|
|
|
316
363
|
require(isValidApproxParams(approx), "invalid approx approx");
|
|
317
364
|
|
|
365
|
+
VarsSwapYtForExactScy memory vars;
|
|
318
366
|
MarketPreCompute memory comp = market.getMarketPreCompute(index, blockTime);
|
|
319
367
|
if (approx.guessMax == type(uint256).max) {
|
|
320
368
|
approx.guessMax = calcMaxPtOut(market.totalPt, comp);
|
|
321
369
|
}
|
|
322
370
|
|
|
323
|
-
|
|
371
|
+
vars.minAssetOut = index.scyToAsset(minScyOut);
|
|
324
372
|
|
|
325
373
|
for (uint256 iter = 0; iter < approx.maxIteration; ) {
|
|
326
374
|
// ytInGuess = ptOutGuess
|
|
327
|
-
|
|
375
|
+
vars.ptOutGuess = getCurrentGuess(iter, approx);
|
|
328
376
|
|
|
329
|
-
(
|
|
330
|
-
|
|
377
|
+
(vars.assetToAccount, vars.assetToReserve) = market.calcTrade(
|
|
378
|
+
comp,
|
|
379
|
+
vars.ptOutGuess.Int()
|
|
380
|
+
);
|
|
381
|
+
vars.netAssetOwed = vars.assetToAccount.abs();
|
|
331
382
|
|
|
332
383
|
// since ptOutGuess is between guessMin & guessMax, it's guaranteed that
|
|
333
384
|
// there are enough Yt to pair with ptOut
|
|
334
385
|
|
|
335
|
-
|
|
386
|
+
vars.netAssetOut = vars.ptOutGuess - vars.netAssetOwed;
|
|
336
387
|
|
|
337
|
-
if (netAssetOut >= minAssetOut) {
|
|
338
|
-
approx.guessMax = ptOutGuess;
|
|
339
|
-
if (Math.isAGreaterApproxB(netAssetOut, minAssetOut, approx.eps)) {
|
|
340
|
-
return (
|
|
388
|
+
if (vars.netAssetOut >= vars.minAssetOut) {
|
|
389
|
+
approx.guessMax = vars.ptOutGuess;
|
|
390
|
+
if (Math.isAGreaterApproxB(vars.netAssetOut, vars.minAssetOut, approx.eps)) {
|
|
391
|
+
return (
|
|
392
|
+
vars.ptOutGuess,
|
|
393
|
+
index.assetToScy(vars.netAssetOut),
|
|
394
|
+
index.assetToScy(vars.assetToReserve.Uint())
|
|
395
|
+
);
|
|
341
396
|
}
|
|
342
397
|
} else {
|
|
343
|
-
approx.guessMin = ptOutGuess + 1;
|
|
398
|
+
approx.guessMin = vars.ptOutGuess + 1;
|
|
344
399
|
}
|
|
345
400
|
|
|
346
401
|
unchecked {
|
|
@@ -403,8 +458,8 @@ library MarketApproxLib {
|
|
|
403
458
|
return (maxPtOut.Uint() * 999) / 1000;
|
|
404
459
|
}
|
|
405
460
|
|
|
406
|
-
function calcMaxPtIn(int256
|
|
407
|
-
return
|
|
461
|
+
function calcMaxPtIn(int256 totalAsset) internal pure returns (uint256) {
|
|
462
|
+
return totalAsset.Uint() - 1;
|
|
408
463
|
}
|
|
409
464
|
|
|
410
465
|
function isValidApproxParams(ApproxParams memory approx) internal pure returns (bool) {
|
|
@@ -57,7 +57,7 @@ library MarketMathCore {
|
|
|
57
57
|
SCYIndex index,
|
|
58
58
|
uint256 scyDesired,
|
|
59
59
|
uint256 ptDesired,
|
|
60
|
-
|
|
60
|
+
uint256 blockTime
|
|
61
61
|
)
|
|
62
62
|
internal
|
|
63
63
|
pure
|
|
@@ -73,7 +73,7 @@ library MarketMathCore {
|
|
|
73
73
|
int256 _lpToAccount,
|
|
74
74
|
int256 _scyUsed,
|
|
75
75
|
int256 _otUsed
|
|
76
|
-
) = addLiquidityCore(market, index, scyDesired.Int(), ptDesired.Int(),
|
|
76
|
+
) = addLiquidityCore(market, index, scyDesired.Int(), ptDesired.Int(), blockTime);
|
|
77
77
|
|
|
78
78
|
lpToReserve = _lpToReserve.Uint();
|
|
79
79
|
lpToAccount = _lpToAccount.Uint();
|
|
@@ -81,15 +81,14 @@ library MarketMathCore {
|
|
|
81
81
|
ptUsed = _otUsed.Uint();
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
function removeLiquidity(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
function removeLiquidity(MarketState memory market, uint256 lpToRemove)
|
|
85
|
+
internal
|
|
86
|
+
pure
|
|
87
|
+
returns (uint256 scyToAccount, uint256 netPtToAccount)
|
|
88
|
+
{
|
|
89
89
|
(int256 _scyToAccount, int256 _ptToAccount) = removeLiquidityCore(
|
|
90
90
|
market,
|
|
91
|
-
lpToRemove.Int()
|
|
92
|
-
updateState
|
|
91
|
+
lpToRemove.Int()
|
|
93
92
|
);
|
|
94
93
|
|
|
95
94
|
scyToAccount = _scyToAccount.Uint();
|
|
@@ -139,7 +138,7 @@ library MarketMathCore {
|
|
|
139
138
|
SCYIndex index,
|
|
140
139
|
int256 scyDesired,
|
|
141
140
|
int256 ptDesired,
|
|
142
|
-
|
|
141
|
+
uint256 blockTime
|
|
143
142
|
)
|
|
144
143
|
internal
|
|
145
144
|
pure
|
|
@@ -154,6 +153,7 @@ library MarketMathCore {
|
|
|
154
153
|
/// CHECKS
|
|
155
154
|
/// ------------------------------------------------------------
|
|
156
155
|
require(scyDesired > 0 && ptDesired > 0, "ZERO_AMOUNTS");
|
|
156
|
+
require(!MiniHelpers.isExpired(market.expiry, blockTime), "market expired");
|
|
157
157
|
|
|
158
158
|
/// ------------------------------------------------------------
|
|
159
159
|
/// MATH
|
|
@@ -182,18 +182,16 @@ library MarketMathCore {
|
|
|
182
182
|
/// ------------------------------------------------------------
|
|
183
183
|
/// WRITE
|
|
184
184
|
/// ------------------------------------------------------------
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
market.totalLp += lpToAccount + lpToReserve;
|
|
189
|
-
}
|
|
185
|
+
market.totalScy += scyUsed;
|
|
186
|
+
market.totalPt += ptUsed;
|
|
187
|
+
market.totalLp += lpToAccount + lpToReserve;
|
|
190
188
|
}
|
|
191
189
|
|
|
192
|
-
function removeLiquidityCore(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
function removeLiquidityCore(MarketState memory market, int256 lpToRemove)
|
|
191
|
+
internal
|
|
192
|
+
pure
|
|
193
|
+
returns (int256 netScyToAccount, int256 netPtToAccount)
|
|
194
|
+
{
|
|
197
195
|
/// ------------------------------------------------------------
|
|
198
196
|
/// CHECKS
|
|
199
197
|
/// ------------------------------------------------------------
|
|
@@ -209,11 +207,9 @@ library MarketMathCore {
|
|
|
209
207
|
/// ------------------------------------------------------------
|
|
210
208
|
/// WRITE
|
|
211
209
|
/// ------------------------------------------------------------
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
market.totalScy = market.totalScy.subNoNeg(netScyToAccount);
|
|
216
|
-
}
|
|
210
|
+
market.totalLp = market.totalLp.subNoNeg(lpToRemove);
|
|
211
|
+
market.totalPt = market.totalPt.subNoNeg(netPtToAccount);
|
|
212
|
+
market.totalScy = market.totalScy.subNoNeg(netScyToAccount);
|
|
217
213
|
}
|
|
218
214
|
|
|
219
215
|
function executeTradeCore(
|
|
@@ -59,13 +59,6 @@ library Math {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
function rawDivUp(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
63
|
-
if (a == 0) return 0;
|
|
64
|
-
else {
|
|
65
|
-
return (a + b - 1) / b;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
62
|
function abs(int256 x) internal pure returns (uint256) {
|
|
70
63
|
return uint256(x > 0 ? x : -x);
|
|
71
64
|
}
|
|
@@ -7,6 +7,7 @@ import "../interfaces/IPRouterStatic.sol";
|
|
|
7
7
|
import "../interfaces/IPMarket.sol";
|
|
8
8
|
import "../interfaces/IPYieldContractFactory.sol";
|
|
9
9
|
import "../interfaces/IPMarketFactory.sol";
|
|
10
|
+
import "../libraries/math/MarketApproxLib.sol";
|
|
10
11
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
11
12
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
12
13
|
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
@@ -14,12 +15,22 @@ import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
|
14
15
|
/// EXCLUDED FROM ALL AUDITS, TO BE CALLED ONLY BY PENDLE's SDK
|
|
15
16
|
contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
|
16
17
|
using MarketMathCore for MarketState;
|
|
18
|
+
using MarketApproxLib for MarketState;
|
|
17
19
|
using Math for uint256;
|
|
18
20
|
using Math for int256;
|
|
19
21
|
using LogExpMath for int256;
|
|
22
|
+
using SCYIndexLib for SCYIndex;
|
|
20
23
|
|
|
21
24
|
IPYieldContractFactory public immutable yieldContractFactory;
|
|
22
25
|
IPMarketFactory public immutable marketFactory;
|
|
26
|
+
ApproxParams public approxParams =
|
|
27
|
+
ApproxParams({
|
|
28
|
+
guessMin: 0,
|
|
29
|
+
guessMax: type(uint256).max,
|
|
30
|
+
guessOffchain: 0,
|
|
31
|
+
maxIteration: 256,
|
|
32
|
+
eps: 1e15
|
|
33
|
+
});
|
|
23
34
|
|
|
24
35
|
constructor(IPYieldContractFactory _yieldContractFactory, IPMarketFactory _marketFactory)
|
|
25
36
|
initializer
|
|
@@ -43,7 +54,7 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
43
54
|
RewardIndex[] memory rewardIndexes
|
|
44
55
|
)
|
|
45
56
|
{
|
|
46
|
-
(address yt
|
|
57
|
+
(, address yt) = getPY(py);
|
|
47
58
|
IPYieldToken YT = IPYieldToken(yt);
|
|
48
59
|
exchangeRate = YT.scyIndexCurrent();
|
|
49
60
|
totalSupply = YT.totalSupply();
|
|
@@ -151,7 +162,7 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
151
162
|
scyIndex(market),
|
|
152
163
|
scyDesired,
|
|
153
164
|
ptDesired,
|
|
154
|
-
|
|
165
|
+
block.timestamp
|
|
155
166
|
);
|
|
156
167
|
}
|
|
157
168
|
|
|
@@ -161,10 +172,10 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
161
172
|
returns (uint256 netScyOut, uint256 netPtOut)
|
|
162
173
|
{
|
|
163
174
|
MarketState memory state = IPMarket(market).readState(false);
|
|
164
|
-
(netScyOut, netPtOut) = state.removeLiquidity(lpToRemove
|
|
175
|
+
(netScyOut, netPtOut) = state.removeLiquidity(lpToRemove);
|
|
165
176
|
}
|
|
166
177
|
|
|
167
|
-
function
|
|
178
|
+
function swapExactPtForScyStatic(address market, uint256 exactPtIn)
|
|
168
179
|
external
|
|
169
180
|
view
|
|
170
181
|
returns (uint256 netScyOut, uint256 netScyFee)
|
|
@@ -177,7 +188,7 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
177
188
|
);
|
|
178
189
|
}
|
|
179
190
|
|
|
180
|
-
function
|
|
191
|
+
function swapScyForExactPtStatic(address market, uint256 exactPtOut)
|
|
181
192
|
external
|
|
182
193
|
view
|
|
183
194
|
returns (uint256 netScyIn, uint256 netScyFee)
|
|
@@ -190,8 +201,110 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
190
201
|
);
|
|
191
202
|
}
|
|
192
203
|
|
|
204
|
+
function swapExactScyForPtStatic(address market, uint256 exactScyIn)
|
|
205
|
+
external
|
|
206
|
+
view
|
|
207
|
+
returns (uint256 netPtOut, uint256 netScyFee)
|
|
208
|
+
{
|
|
209
|
+
MarketState memory state = IPMarket(market).readState(false);
|
|
210
|
+
(netPtOut, , netScyFee) = state.approxSwapExactScyForPt(
|
|
211
|
+
scyIndex(market),
|
|
212
|
+
exactScyIn,
|
|
213
|
+
block.timestamp,
|
|
214
|
+
approxParams
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function swapScyForExactYtStatic(address market, uint256 exactYtOut)
|
|
219
|
+
external
|
|
220
|
+
view
|
|
221
|
+
returns (uint256 netScyIn, uint256 netScyFee)
|
|
222
|
+
{
|
|
223
|
+
MarketState memory state = IPMarket(market).readState(false);
|
|
224
|
+
|
|
225
|
+
SCYIndex index = scyIndex(market);
|
|
226
|
+
|
|
227
|
+
uint256 scyReceived;
|
|
228
|
+
(scyReceived, netScyFee) = state.swapExactPtForScy(
|
|
229
|
+
scyIndex(market),
|
|
230
|
+
exactYtOut,
|
|
231
|
+
block.timestamp
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
uint256 totalScyNeed = index.assetToScyUp(exactYtOut);
|
|
235
|
+
netScyIn = totalScyNeed.subMax0(scyReceived);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function swapExactScyForYtStatic(address market, uint256 exactScyIn)
|
|
239
|
+
external
|
|
240
|
+
view
|
|
241
|
+
returns (uint256 netYtOut, uint256 netScyFee)
|
|
242
|
+
{
|
|
243
|
+
MarketState memory state = IPMarket(market).readState(false);
|
|
244
|
+
SCYIndex index = scyIndex(market);
|
|
245
|
+
|
|
246
|
+
(netYtOut, , netScyFee) = state.approxSwapExactScyForYt(
|
|
247
|
+
index,
|
|
248
|
+
exactScyIn,
|
|
249
|
+
block.timestamp,
|
|
250
|
+
approxParams
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function swapExactYtForScyStatic(address market, uint256 exactYtIn)
|
|
255
|
+
external
|
|
256
|
+
view
|
|
257
|
+
returns (uint256 netScyOut, uint256 netScyFee)
|
|
258
|
+
{
|
|
259
|
+
MarketState memory state = IPMarket(market).readState(false);
|
|
260
|
+
|
|
261
|
+
SCYIndex index = scyIndex(market);
|
|
262
|
+
|
|
263
|
+
uint256 scyOwed;
|
|
264
|
+
(scyOwed, netScyFee) = state.swapScyForExactPt(index, exactYtIn, block.timestamp);
|
|
265
|
+
|
|
266
|
+
uint256 amountPYToRepayScyOwed = index.scyToAssetUp(scyOwed);
|
|
267
|
+
uint256 amountPYToRedeemScyOut = exactYtIn - amountPYToRepayScyOwed;
|
|
268
|
+
|
|
269
|
+
netScyOut = index.assetToScy(amountPYToRedeemScyOut);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function swapYtForExactScyStatic(address market, uint256 exactScyOut)
|
|
273
|
+
external
|
|
274
|
+
view
|
|
275
|
+
returns (uint256 netYtIn, uint256 netScyFee)
|
|
276
|
+
{
|
|
277
|
+
MarketState memory state = IPMarket(market).readState(false);
|
|
278
|
+
|
|
279
|
+
SCYIndex index = scyIndex(market);
|
|
280
|
+
|
|
281
|
+
(netYtIn, , netScyFee) = state.approxSwapYtForExactScy(
|
|
282
|
+
index,
|
|
283
|
+
exactScyOut,
|
|
284
|
+
block.timestamp,
|
|
285
|
+
approxParams
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
193
289
|
// ============= OTHER HELPERS =============
|
|
194
290
|
|
|
291
|
+
function previewMintPY(address YT, uint256 amountScyToMint)
|
|
292
|
+
external
|
|
293
|
+
returns (uint256 amountPY)
|
|
294
|
+
{
|
|
295
|
+
IPYieldToken _YT = IPYieldToken(YT);
|
|
296
|
+
require(!_YT.isExpired(), "YT is expired");
|
|
297
|
+
return amountScyToMint.mulDown(_YT.scyIndexCurrent());
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function previewRedeemPY(address YT, uint256 amountPYToRedeem)
|
|
301
|
+
external
|
|
302
|
+
returns (uint256 amountPY)
|
|
303
|
+
{
|
|
304
|
+
IPYieldToken _YT = IPYieldToken(YT);
|
|
305
|
+
return amountPYToRedeem.divDown(_YT.scyIndexCurrent());
|
|
306
|
+
}
|
|
307
|
+
|
|
195
308
|
function scyIndex(address market) public view returns (SCYIndex index) {
|
|
196
309
|
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
197
310
|
|
|
@@ -215,12 +328,31 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
215
328
|
return lnImpliedRate.exp();
|
|
216
329
|
}
|
|
217
330
|
|
|
331
|
+
function getExchangeRate(address market) public view returns (uint256) {
|
|
332
|
+
MarketState memory state = IPMarket(market).readState(false);
|
|
333
|
+
MarketPreCompute memory comp = state.getMarketPreCompute(
|
|
334
|
+
scyIndex(market),
|
|
335
|
+
block.timestamp
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
return
|
|
339
|
+
MarketMathCore
|
|
340
|
+
._getExchangeRate(
|
|
341
|
+
state.totalPt,
|
|
342
|
+
comp.totalAsset,
|
|
343
|
+
comp.rateScalar,
|
|
344
|
+
comp.rateAnchor,
|
|
345
|
+
0
|
|
346
|
+
)
|
|
347
|
+
.Uint();
|
|
348
|
+
}
|
|
349
|
+
|
|
218
350
|
function getUserPYInfo(address py, address user)
|
|
219
351
|
public
|
|
220
352
|
view
|
|
221
353
|
returns (UserPYInfo memory userPYInfo)
|
|
222
354
|
{
|
|
223
|
-
(userPYInfo.
|
|
355
|
+
(userPYInfo.pt, userPYInfo.yt) = getPY(py);
|
|
224
356
|
IPYieldToken YT = IPYieldToken(userPYInfo.yt);
|
|
225
357
|
userPYInfo.ytBalance = YT.balanceOf(user);
|
|
226
358
|
userPYInfo.ptBalance = IPPrincipalToken(userPYInfo.pt).balanceOf(user);
|
|
@@ -255,7 +387,7 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
255
387
|
userMarketInfo.market = market;
|
|
256
388
|
userMarketInfo.lpBalance = userLp;
|
|
257
389
|
|
|
258
|
-
MarketState memory state = _market.readState(
|
|
390
|
+
MarketState memory state = _market.readState(false);
|
|
259
391
|
uint256 totalLp = uint256(state.totalLp);
|
|
260
392
|
uint256 userPt = (userLp * uint256(state.totalPt)) / totalLp;
|
|
261
393
|
uint256 userScy = (userLp * uint256(state.totalScy)) / totalLp;
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"deployer": "0x1FcCC097db89A86Bfc474A1028F93958295b1Fb7",
|
|
3
3
|
"network": 43113,
|
|
4
4
|
"celerBus": "0xE9533976C590200E32d95C53f06AE12d292cFc47",
|
|
5
|
-
"treasury": "
|
|
6
|
-
"governanceManager": "
|
|
7
|
-
"PENDLE": "
|
|
8
|
-
"yieldContractFactory": "
|
|
9
|
-
"marketFactory": "
|
|
10
|
-
"router": "
|
|
11
|
-
"routerStatic": "
|
|
12
|
-
"startTime":
|
|
13
|
-
"vePendle": "
|
|
14
|
-
"votingController": "
|
|
15
|
-
"gaugeController": "
|
|
5
|
+
"treasury": "0xf176fB51F4eB826136a54FDc71C50fCd2202E272",
|
|
6
|
+
"governanceManager": "0x0A60B5D39b27E18F63aa937aD09Acc2B3d46d2a1",
|
|
7
|
+
"PENDLE": "0x519f3907379491c291Cf7b98425F35036a698080",
|
|
8
|
+
"yieldContractFactory": "0x2ff0de5593c85e0609675d07A6a33093A3838b17",
|
|
9
|
+
"marketFactory": "0x30340f337C27768e84CA5E957Fb22dcBF95857cD",
|
|
10
|
+
"router": "0xFEdBED4682D136925d30FFb9B8977CC9b3a6c406",
|
|
11
|
+
"routerStatic": "0xc49d8fdA920a46B21E1821780238f9E7A0de68df",
|
|
12
|
+
"startTime": 1657756800,
|
|
13
|
+
"vePendle": "0x7786729eEe8b9d30fE7d91fDFf23A0f1D0C615D9",
|
|
14
|
+
"votingController": "0x1001940C59e87AdfdB9f3b50aec5232c59d40Bc4",
|
|
15
|
+
"gaugeController": "0x3d47dBfB525cf8869B8c266a4c42E2c128F5639C"
|
|
16
16
|
}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"deployer": "0x1FcCC097db89A86Bfc474A1028F93958295b1Fb7",
|
|
3
3
|
"network": 80001,
|
|
4
4
|
"celerBus": "0x7d43AABC515C356145049227CeE54B608342c0ad",
|
|
5
|
-
"treasury": "
|
|
6
|
-
"governanceManager": "
|
|
7
|
-
"PENDLE": "
|
|
8
|
-
"yieldContractFactory": "
|
|
9
|
-
"marketFactory": "
|
|
10
|
-
"router": "
|
|
11
|
-
"routerStatic": "
|
|
12
|
-
"startTime":
|
|
13
|
-
"vePendle": "
|
|
14
|
-
"gaugeController": "
|
|
5
|
+
"treasury": "0xFF4a4515888AEf82C9557A56E37A55a5dDe6EFF1",
|
|
6
|
+
"governanceManager": "0xE4a112A028D93e9E9b207eBedB1e1D6Cf5FdCEe9",
|
|
7
|
+
"PENDLE": "0x6D998d832b82f6307c5a2592d59A4cba7f15167f",
|
|
8
|
+
"yieldContractFactory": "0x058Ceec78EB7F854daBfdDd894e841423Ca344c3",
|
|
9
|
+
"marketFactory": "0xD33F62424acC95704D43E725B11b9e770505B425",
|
|
10
|
+
"router": "0x24d7CEaFBA7c7b32BE200aD6dA38C03797F0611f",
|
|
11
|
+
"routerStatic": "0x9902C57F6bc1e7737238777Fc52dA8A2161759f7",
|
|
12
|
+
"startTime": 1657756800,
|
|
13
|
+
"vePendle": "0x1b615005157B9B0DDc7c0Af817f4A570cE3b591e",
|
|
14
|
+
"gaugeController": "0x3663E54bf1334B60FC97d3781460Bcf73d008116"
|
|
15
15
|
}
|