@pendle/core-v2 0.13.1-testnet → 0.14.0-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/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +89 -0
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +91 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +91 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.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 +26 -26
- 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/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield → StandardizedYield}/PYIndex.sol/PYIndexLib.json +3 -3
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/SCYBase.sol/SCYBase.json → StandardizedYield/SYBase.sol/SYBase.json} +11 -11
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/SCYBaseWithRewards.sol/SCYBaseWithRewards.json → StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.json} +11 -11
- package/build/artifacts/contracts/core/StandardizedYield/SYUtils.sol/SYUtils.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/SCYUtils.sol/SCYUtils.json → StandardizedYield/SYUtils.sol/SYUtils.json} +4 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield → StandardizedYield}/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +3 -3
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json → StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json} +17 -17
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.json +1028 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.json → StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.json} +47 -47
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield → StandardizedYield}/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +5 -5
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/{SuperComposableYield/implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json → StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json} +13 -13
- 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 +4 -4
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +4 -4
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +24 -24
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +28 -28
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +30 -30
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +34 -34
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +20 -20
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.json +2 -2
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +20 -20
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +106 -106
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +18 -18
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.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 +3 -3
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +6 -6
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{ISuperComposableYield.sol/ISuperComposableYield.json → IStandardizedYield.sol/IStandardizedYield.json} +5 -5
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +7 -7
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +116 -116
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +35 -35
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +12 -12
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +41 -41
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +28 -28
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +4 -4
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +22 -22
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +96 -27
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +40 -12
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +24 -5
- package/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol +133 -0
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +33 -0
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +8 -1
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +3 -3
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +2 -7
- package/contracts/core/Market/MarketMathCore.sol +50 -53
- package/contracts/core/Market/PendleGauge.sol +8 -8
- package/contracts/core/Market/PendleMarket.sol +49 -49
- package/contracts/core/Market/PendleMarketFactory.sol +1 -1
- package/contracts/core/RewardManager/RewardManager.sol +1 -1
- package/contracts/core/{SuperComposableYield → StandardizedYield}/PYIndex.sol +16 -16
- package/contracts/core/{SuperComposableYield/SCYBase.sol → StandardizedYield/SYBase.sol} +17 -17
- package/contracts/core/{SuperComposableYield/SCYBaseWithRewards.sol → StandardizedYield/SYBaseWithRewards.sol} +9 -9
- package/contracts/core/StandardizedYield/SYUtils.sol +26 -0
- package/contracts/core/{SuperComposableYield → StandardizedYield}/implementations/BenQi/PendleQiTokenHelper.sol +1 -1
- package/contracts/core/{SuperComposableYield/implementations/BenQi/PendleQiTokenSCY.sol → StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol} +10 -10
- package/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol +167 -0
- package/contracts/core/{SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol → StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol} +51 -70
- package/contracts/core/{SuperComposableYield → StandardizedYield}/implementations/Convex/Pendle3CrvHelper.sol +7 -7
- package/contracts/core/{SuperComposableYield/implementations/PendleWstEthSCY.sol → StandardizedYield/implementations/PendleWstEthSY.sol} +5 -5
- package/contracts/core/YieldContracts/InterestManagerYT.sol +7 -7
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +15 -15
- package/contracts/core/YieldContracts/PendleYieldToken.sol +71 -71
- package/contracts/core/libraries/Errors.sol +23 -21
- package/contracts/core/libraries/TokenHelper.sol +0 -33
- package/contracts/interfaces/Curve/ICrvPool.sol +2 -0
- package/contracts/interfaces/ILayerZeroEndpoint.sol +39 -0
- package/contracts/interfaces/ILayerZeroReceiver.sol +12 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +27 -27
- package/contracts/interfaces/IPActionMintRedeem.sol +30 -30
- package/contracts/interfaces/IPActionSwapPT.sol +16 -16
- package/contracts/interfaces/IPActionSwapPTYT.sol +2 -2
- package/contracts/interfaces/IPActionSwapYT.sol +16 -16
- package/contracts/interfaces/IPMarket.sol +14 -19
- package/contracts/interfaces/IPMarketSwapCallback.sol +1 -1
- package/contracts/interfaces/IPMsgSendEndpoint.sol +4 -2
- package/contracts/interfaces/IPPrincipalToken.sol +1 -1
- package/contracts/interfaces/IPYieldContractFactory.sol +3 -3
- package/contracts/interfaces/IPYieldToken.sol +7 -9
- package/contracts/interfaces/{ISuperComposableYield.sol → IStandardizedYield.sol} +6 -6
- package/contracts/offchain-helpers/MarketMathStatic.sol +116 -131
- package/contracts/offchain-helpers/RouterStatic.sol +80 -93
- package/contracts/router/ActionAddRemoveLiq.sol +99 -111
- package/contracts/router/ActionCallback.sol +46 -46
- package/contracts/router/ActionMintRedeem.sol +58 -58
- package/contracts/router/ActionSwapPT.sol +61 -69
- package/contracts/router/ActionSwapPTYT.sol +7 -7
- package/contracts/router/ActionSwapYT.sol +72 -79
- package/contracts/router/PendleRouter.sol +16 -16
- package/contracts/router/base/ActionBaseMintRedeem.sol +43 -43
- package/contracts/router/base/CallbackHelper.sol +20 -20
- package/contracts/router/base/MarketApproxLib.sol +166 -143
- package/contracts/router/kyberswap/KyberSwapHelper.sol +2 -2
- package/deployments/43113-core.json +16 -0
- package/{contracts/deployments → deployments}/43113-helper.json +0 -0
- package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
- package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
- package/{contracts/deployments → deployments}/43113-testenv.json +0 -0
- package/deployments/80001-core.json +15 -0
- package/{contracts/deployments → deployments}/80001-testenv.json +0 -0
- package/package.json +2 -2
- package/typechain-types/ActionAddRemoveLiq.ts +127 -129
- package/typechain-types/ActionCallback.ts +5 -5
- package/typechain-types/ActionMintRedeem.ts +139 -141
- package/typechain-types/ActionSwapPT.ts +73 -73
- package/typechain-types/ActionSwapPTYT.ts +2 -2
- package/typechain-types/ActionSwapYT.ts +73 -73
- package/typechain-types/IPActionAddRemoveLiq.ts +127 -129
- package/typechain-types/IPActionMintRedeem.ts +139 -141
- package/typechain-types/IPActionSwapPT.ts +73 -73
- package/typechain-types/IPActionSwapPTYT.ts +2 -2
- package/typechain-types/IPActionSwapYT.ts +73 -73
- package/typechain-types/IPAllAction.ts +402 -406
- package/typechain-types/IPMarket.ts +51 -54
- package/typechain-types/IPMarketSwapCallback.ts +5 -5
- package/typechain-types/IPPrincipalToken.ts +8 -8
- package/typechain-types/IPYieldContractFactory.ts +13 -13
- package/typechain-types/IPYieldToken.ts +17 -17
- package/typechain-types/IStandardizedYield.ts +895 -0
- package/typechain-types/MarketMathStatic.ts +27 -27
- package/typechain-types/Pendle3CrvAndTokenSY.ts +1243 -0
- package/typechain-types/Pendle3CrvHelper.ts +13 -13
- package/typechain-types/PendleConvexLPSY.ts +1189 -0
- package/typechain-types/PendleGaugeControllerBaseUpg.ts +125 -0
- package/typechain-types/PendleGaugeControllerMainchainUpg.ts +125 -0
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +124 -0
- package/typechain-types/PendleMarket.ts +54 -57
- package/typechain-types/PendlePrincipalToken.ts +8 -8
- package/typechain-types/PendleQiTokenSY.ts +1166 -0
- package/typechain-types/PendleWstEthSY.ts +1040 -0
- package/typechain-types/PendleYieldContractFactory.ts +8 -8
- package/typechain-types/PendleYieldToken.ts +41 -44
- package/typechain-types/RouterStatic.ts +196 -196
- package/typechain-types/SYBase.ts +1001 -0
- package/typechain-types/SYBaseWithRewards.ts +1094 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +34 -34
- package/typechain-types/factories/ActionCallback__factory.ts +11 -11
- package/typechain-types/factories/ActionMintRedeem__factory.ts +38 -38
- package/typechain-types/factories/ActionMisc__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +3 -3
- package/typechain-types/factories/ActionSwapPT__factory.ts +27 -27
- package/typechain-types/factories/ActionSwapYT__factory.ts +21 -21
- package/typechain-types/factories/Errors__factory.ts +27 -27
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +30 -30
- package/typechain-types/factories/IPActionMintRedeem__factory.ts +34 -34
- package/typechain-types/factories/IPActionSwapPTYT__factory.ts +2 -2
- package/typechain-types/factories/IPActionSwapPT__factory.ts +20 -20
- package/typechain-types/factories/IPActionSwapYT__factory.ts +20 -20
- package/typechain-types/factories/IPAllAction__factory.ts +106 -106
- package/typechain-types/factories/IPMarketSwapCallback__factory.ts +1 -1
- package/typechain-types/factories/IPMarket__factory.ts +18 -18
- package/typechain-types/factories/IPPrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/IPYieldContractFactory__factory.ts +3 -3
- package/typechain-types/factories/IPYieldToken__factory.ts +6 -6
- package/typechain-types/factories/IStandardizedYield__factory.ts +658 -0
- package/typechain-types/factories/MarketMathStatic__factory.ts +6 -6
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/Pendle3CrvAndTokenSY__factory.ts +1124 -0
- package/typechain-types/factories/Pendle3CrvHelper__factory.ts +3 -3
- package/typechain-types/factories/PendleConvexLPSY__factory.ts +963 -0
- package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +89 -0
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +90 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +90 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +21 -21
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +7 -7
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +1095 -0
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleWstEthSY__factory.ts +924 -0
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +3 -3
- package/typechain-types/factories/PendleYieldToken__factory.ts +27 -27
- package/typechain-types/factories/RouterStatic__factory.ts +57 -57
- package/typechain-types/factories/SYBaseWithRewards__factory.ts +867 -0
- package/typechain-types/factories/SYBase__factory.ts +795 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +33 -51
- package/typechain-types/index.ts +14 -18
- package/build/artifacts/contracts/core/SuperComposableYield/PYIndex.sol/PYIndexLib.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/SCYBase.sol/SCYBase.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/SCYUtils.sol/SCYUtils.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.json +0 -1030
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.json +0 -1025
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +0 -4
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.json +0 -190
- package/contracts/core/SuperComposableYield/SCYUtils.sol +0 -34
- package/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol +0 -135
- package/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol +0 -96
- package/contracts/deployments/43113-core.json +0 -16
- package/contracts/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
- package/contracts/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
- package/contracts/deployments/80001-core.json +0 -15
- package/contracts/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
- package/contracts/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
- package/contracts/interfaces/ICelerMessageBus.sol +0 -28
- package/contracts/interfaces/ICelerMessageReceiverApp.sol +0 -25
- package/contracts/offchain-helpers/ImplicitSwapfeeContract.sol +0 -26
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
pragma solidity 0.8.17;
|
|
25
25
|
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
26
26
|
|
|
27
|
-
interface
|
|
27
|
+
interface IStandardizedYield is IERC20Metadata {
|
|
28
28
|
/// @dev Emitted when any base tokens is deposited to mint shares
|
|
29
29
|
event Deposit(
|
|
30
30
|
address indexed caller,
|
|
31
31
|
address indexed receiver,
|
|
32
32
|
address indexed tokenIn,
|
|
33
33
|
uint256 amountDeposited,
|
|
34
|
-
uint256
|
|
34
|
+
uint256 amountSyOut
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
/// @dev Emitted when any shares are redeemed for base tokens
|
|
@@ -39,7 +39,7 @@ interface ISuperComposableYield is IERC20Metadata {
|
|
|
39
39
|
address indexed caller,
|
|
40
40
|
address indexed receiver,
|
|
41
41
|
address indexed tokenOut,
|
|
42
|
-
uint256
|
|
42
|
+
uint256 amountSyToRedeem,
|
|
43
43
|
uint256 amountTokenOut
|
|
44
44
|
);
|
|
45
45
|
|
|
@@ -92,10 +92,10 @@ interface ISuperComposableYield is IERC20Metadata {
|
|
|
92
92
|
) external returns (uint256 amountTokenOut);
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* @notice exchangeRate *
|
|
96
|
-
* @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of
|
|
95
|
+
* @notice exchangeRate * syBalance / 1e18 must return the asset balance of the account
|
|
96
|
+
* @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of sy
|
|
97
97
|
he can mint must be X * exchangeRate / 1e18
|
|
98
|
-
* @dev
|
|
98
|
+
* @dev SYUtils's assetToSy & syToAsset should be used instead of raw multiplication
|
|
99
99
|
& division
|
|
100
100
|
*/
|
|
101
101
|
function exchangeRate() external view returns (uint256 res);
|
|
@@ -14,22 +14,22 @@ library MarketMathStatic {
|
|
|
14
14
|
using PYIndexLib for PYIndex;
|
|
15
15
|
using PYIndexLib for IPYieldToken;
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function addLiquidityDualSyAndPtStatic(
|
|
18
18
|
address market,
|
|
19
|
-
uint256
|
|
19
|
+
uint256 netSyDesired,
|
|
20
20
|
uint256 netPtDesired
|
|
21
21
|
)
|
|
22
22
|
external
|
|
23
23
|
view
|
|
24
24
|
returns (
|
|
25
25
|
uint256 netLpOut,
|
|
26
|
-
uint256
|
|
26
|
+
uint256 netSyUsed,
|
|
27
27
|
uint256 netPtUsed
|
|
28
28
|
)
|
|
29
29
|
{
|
|
30
30
|
MarketState memory state = IPMarket(market).readState();
|
|
31
|
-
(, netLpOut,
|
|
32
|
-
|
|
31
|
+
(, netLpOut, netSyUsed, netPtUsed) = state.addLiquidity(
|
|
32
|
+
netSyDesired,
|
|
33
33
|
netPtDesired,
|
|
34
34
|
block.timestamp
|
|
35
35
|
);
|
|
@@ -49,19 +49,19 @@ library MarketMathStatic {
|
|
|
49
49
|
uint256 netPtUsed
|
|
50
50
|
)
|
|
51
51
|
{
|
|
52
|
-
(
|
|
52
|
+
(IStandardizedYield SY, , ) = IPMarket(market).readTokens();
|
|
53
53
|
|
|
54
|
-
uint256
|
|
55
|
-
uint256
|
|
54
|
+
uint256 syDesired = SY.previewDeposit(tokenIn, netTokenDesired);
|
|
55
|
+
uint256 syUsed;
|
|
56
56
|
|
|
57
57
|
MarketState memory state = IPMarket(market).readState();
|
|
58
|
-
(, netLpOut,
|
|
59
|
-
|
|
58
|
+
(, netLpOut, syUsed, netPtUsed) = state.addLiquidity(
|
|
59
|
+
syDesired,
|
|
60
60
|
netPtDesired,
|
|
61
61
|
block.timestamp
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
netTokenUsed = (netTokenDesired *
|
|
64
|
+
netTokenUsed = (netTokenDesired * syUsed).rawDivUp(syDesired);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/// @dev netPtToSwap is the parameter to approx
|
|
@@ -74,7 +74,7 @@ library MarketMathStatic {
|
|
|
74
74
|
returns (
|
|
75
75
|
uint256 netLpOut,
|
|
76
76
|
uint256 netPtToSwap,
|
|
77
|
-
uint256
|
|
77
|
+
uint256 netSyFee,
|
|
78
78
|
uint256 priceImpact
|
|
79
79
|
)
|
|
80
80
|
{
|
|
@@ -89,14 +89,14 @@ library MarketMathStatic {
|
|
|
89
89
|
|
|
90
90
|
state = IPMarket(market).readState(); // re-read
|
|
91
91
|
|
|
92
|
-
uint256
|
|
93
|
-
(
|
|
92
|
+
uint256 netSyReceived;
|
|
93
|
+
(netSyReceived, netSyFee) = state.swapExactPtForSy(
|
|
94
94
|
pyIndex(market),
|
|
95
95
|
netPtToSwap,
|
|
96
96
|
block.timestamp
|
|
97
97
|
);
|
|
98
98
|
(, netLpOut, , ) = state.addLiquidity(
|
|
99
|
-
|
|
99
|
+
netSyReceived,
|
|
100
100
|
netPtIn - netPtToSwap,
|
|
101
101
|
block.timestamp
|
|
102
102
|
);
|
|
@@ -105,41 +105,37 @@ library MarketMathStatic {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/// @dev netPtFromSwap is the parameter to approx
|
|
108
|
-
function
|
|
108
|
+
function addLiquiditySingleSyStatic(
|
|
109
109
|
address market,
|
|
110
|
-
uint256
|
|
110
|
+
uint256 netSyIn,
|
|
111
111
|
ApproxParams memory approxParams
|
|
112
112
|
)
|
|
113
113
|
public
|
|
114
114
|
returns (
|
|
115
115
|
uint256 netLpOut,
|
|
116
116
|
uint256 netPtFromSwap,
|
|
117
|
-
uint256
|
|
117
|
+
uint256 netSyFee,
|
|
118
118
|
uint256 priceImpact
|
|
119
119
|
)
|
|
120
120
|
{
|
|
121
121
|
MarketState memory state = IPMarket(market).readState();
|
|
122
122
|
|
|
123
|
-
(netPtFromSwap, , ) = state.
|
|
123
|
+
(netPtFromSwap, , ) = state.approxSwapSyToAddLiquidity(
|
|
124
124
|
pyIndex(market),
|
|
125
|
-
|
|
125
|
+
netSyIn,
|
|
126
126
|
block.timestamp,
|
|
127
127
|
approxParams
|
|
128
128
|
);
|
|
129
129
|
|
|
130
130
|
state = IPMarket(market).readState(); // re-read
|
|
131
131
|
|
|
132
|
-
uint256
|
|
133
|
-
(
|
|
132
|
+
uint256 netSySwap;
|
|
133
|
+
(netSySwap, netSyFee) = state.swapSyForExactPt(
|
|
134
134
|
pyIndex(market),
|
|
135
135
|
netPtFromSwap,
|
|
136
136
|
block.timestamp
|
|
137
137
|
);
|
|
138
|
-
(, netLpOut, , ) = state.addLiquidity(
|
|
139
|
-
netScyIn - netScySwap,
|
|
140
|
-
netPtFromSwap,
|
|
141
|
-
block.timestamp
|
|
142
|
-
);
|
|
138
|
+
(, netLpOut, , ) = state.addLiquidity(netSyIn - netSySwap, netPtFromSwap, block.timestamp);
|
|
143
139
|
|
|
144
140
|
priceImpact = calcPriceImpact(market, netPtFromSwap.Int());
|
|
145
141
|
}
|
|
@@ -155,27 +151,27 @@ library MarketMathStatic {
|
|
|
155
151
|
returns (
|
|
156
152
|
uint256 netLpOut,
|
|
157
153
|
uint256 netPtFromSwap,
|
|
158
|
-
uint256
|
|
154
|
+
uint256 netSyFee,
|
|
159
155
|
uint256 priceImpact
|
|
160
156
|
)
|
|
161
157
|
{
|
|
162
|
-
(
|
|
158
|
+
(IStandardizedYield SY, , ) = IPMarket(market).readTokens();
|
|
163
159
|
|
|
164
160
|
return
|
|
165
|
-
|
|
161
|
+
addLiquiditySingleSyStatic(
|
|
166
162
|
market,
|
|
167
|
-
|
|
163
|
+
SY.previewDeposit(baseToken, netBaseTokenIn),
|
|
168
164
|
approxParams
|
|
169
165
|
);
|
|
170
166
|
}
|
|
171
167
|
|
|
172
|
-
function
|
|
168
|
+
function removeLiquidityDualSyAndPtStatic(address market, uint256 netLpToRemove)
|
|
173
169
|
external
|
|
174
170
|
view
|
|
175
|
-
returns (uint256
|
|
171
|
+
returns (uint256 netSyOut, uint256 netPtOut)
|
|
176
172
|
{
|
|
177
173
|
MarketState memory state = IPMarket(market).readState();
|
|
178
|
-
(
|
|
174
|
+
(netSyOut, netPtOut) = state.removeLiquidity(netLpToRemove);
|
|
179
175
|
}
|
|
180
176
|
|
|
181
177
|
function removeLiquidityDualTokenAndPtStatic(
|
|
@@ -183,13 +179,13 @@ library MarketMathStatic {
|
|
|
183
179
|
uint256 metLpToRemove,
|
|
184
180
|
address tokenOut
|
|
185
181
|
) external view returns (uint256 netTokenOut, uint256 netPtOut) {
|
|
186
|
-
(
|
|
182
|
+
(IStandardizedYield SY, , ) = IPMarket(market).readTokens();
|
|
187
183
|
|
|
188
|
-
uint256
|
|
184
|
+
uint256 netSyOut;
|
|
189
185
|
MarketState memory state = IPMarket(market).readState();
|
|
190
|
-
(
|
|
186
|
+
(netSyOut, netPtOut) = state.removeLiquidity(metLpToRemove);
|
|
191
187
|
|
|
192
|
-
netTokenOut =
|
|
188
|
+
netTokenOut = SY.previewRedeem(tokenOut, netSyOut);
|
|
193
189
|
}
|
|
194
190
|
|
|
195
191
|
/// @dev netPtFromSwap is the parameter to approx
|
|
@@ -202,16 +198,16 @@ library MarketMathStatic {
|
|
|
202
198
|
returns (
|
|
203
199
|
uint256 netPtOut,
|
|
204
200
|
uint256 netPtFromSwap,
|
|
205
|
-
uint256
|
|
201
|
+
uint256 netSyFee,
|
|
206
202
|
uint256 priceImpact
|
|
207
203
|
)
|
|
208
204
|
{
|
|
209
205
|
MarketState memory state = IPMarket(market).readState();
|
|
210
206
|
|
|
211
|
-
(uint256
|
|
212
|
-
(netPtFromSwap,
|
|
207
|
+
(uint256 syFromBurn, uint256 ptFromBurn) = state.removeLiquidity(netLpToRemove);
|
|
208
|
+
(netPtFromSwap, netSyFee) = state.approxSwapExactSyForPt(
|
|
213
209
|
pyIndex(market),
|
|
214
|
-
|
|
210
|
+
syFromBurn,
|
|
215
211
|
block.timestamp,
|
|
216
212
|
approxParams
|
|
217
213
|
);
|
|
@@ -220,29 +216,29 @@ library MarketMathStatic {
|
|
|
220
216
|
priceImpact = calcPriceImpact(market, netPtFromSwap.Int());
|
|
221
217
|
}
|
|
222
218
|
|
|
223
|
-
function
|
|
219
|
+
function removeLiquiditySingleSyStatic(address market, uint256 netLpToRemove)
|
|
224
220
|
public
|
|
225
221
|
returns (
|
|
226
|
-
uint256
|
|
227
|
-
uint256
|
|
222
|
+
uint256 netSyOut,
|
|
223
|
+
uint256 netSyFee,
|
|
228
224
|
uint256 priceImpact
|
|
229
225
|
)
|
|
230
226
|
{
|
|
231
227
|
MarketState memory state = IPMarket(market).readState();
|
|
232
228
|
|
|
233
|
-
(uint256
|
|
229
|
+
(uint256 syFromBurn, uint256 ptFromBurn) = state.removeLiquidity(netLpToRemove);
|
|
234
230
|
|
|
235
231
|
if (IPMarket(market).isExpired()) {
|
|
236
|
-
|
|
232
|
+
netSyOut = syFromBurn + pyIndex(market).assetToSy(ptFromBurn);
|
|
237
233
|
} else {
|
|
238
|
-
uint256
|
|
239
|
-
(
|
|
234
|
+
uint256 syFromSwap;
|
|
235
|
+
(syFromSwap, netSyFee) = state.swapExactPtForSy(
|
|
240
236
|
pyIndex(market),
|
|
241
237
|
ptFromBurn,
|
|
242
238
|
block.timestamp
|
|
243
239
|
);
|
|
244
240
|
|
|
245
|
-
|
|
241
|
+
netSyOut = syFromBurn + syFromSwap;
|
|
246
242
|
priceImpact = calcPriceImpact(market, ptFromBurn.neg());
|
|
247
243
|
}
|
|
248
244
|
}
|
|
@@ -255,71 +251,60 @@ library MarketMathStatic {
|
|
|
255
251
|
external
|
|
256
252
|
returns (
|
|
257
253
|
uint256 netBaseTokenOut,
|
|
258
|
-
uint256
|
|
254
|
+
uint256 netSyFee,
|
|
259
255
|
uint256 priceImpact
|
|
260
256
|
)
|
|
261
257
|
{
|
|
262
|
-
uint256
|
|
263
|
-
(
|
|
264
|
-
market,
|
|
265
|
-
netLpToRemove
|
|
266
|
-
);
|
|
258
|
+
uint256 netSyOut;
|
|
259
|
+
(netSyOut, netSyFee, priceImpact) = removeLiquiditySingleSyStatic(market, netLpToRemove);
|
|
267
260
|
|
|
268
|
-
(
|
|
269
|
-
netBaseTokenOut =
|
|
261
|
+
(IStandardizedYield SY, , ) = IPMarket(market).readTokens();
|
|
262
|
+
netBaseTokenOut = SY.previewRedeem(baseToken, netSyOut);
|
|
270
263
|
}
|
|
271
264
|
|
|
272
|
-
function
|
|
265
|
+
function swapExactPtForSyStatic(address market, uint256 exactPtIn)
|
|
273
266
|
public
|
|
274
267
|
returns (
|
|
275
|
-
uint256
|
|
276
|
-
uint256
|
|
268
|
+
uint256 netSyOut,
|
|
269
|
+
uint256 netSyFee,
|
|
277
270
|
uint256 priceImpact
|
|
278
271
|
)
|
|
279
272
|
{
|
|
280
273
|
MarketState memory state = IPMarket(market).readState();
|
|
281
|
-
(
|
|
282
|
-
pyIndex(market),
|
|
283
|
-
exactPtIn,
|
|
284
|
-
block.timestamp
|
|
285
|
-
);
|
|
274
|
+
(netSyOut, netSyFee) = state.swapExactPtForSy(pyIndex(market), exactPtIn, block.timestamp);
|
|
286
275
|
priceImpact = calcPriceImpact(market, exactPtIn.neg());
|
|
287
276
|
}
|
|
288
277
|
|
|
289
|
-
function
|
|
278
|
+
function swapSyForExactPtStatic(address market, uint256 exactPtOut)
|
|
290
279
|
external
|
|
291
280
|
returns (
|
|
292
|
-
uint256
|
|
293
|
-
uint256
|
|
281
|
+
uint256 netSyIn,
|
|
282
|
+
uint256 netSyFee,
|
|
294
283
|
uint256 priceImpact
|
|
295
284
|
)
|
|
296
285
|
{
|
|
297
286
|
MarketState memory state = IPMarket(market).readState();
|
|
298
|
-
(
|
|
299
|
-
pyIndex(market),
|
|
300
|
-
exactPtOut,
|
|
301
|
-
block.timestamp
|
|
302
|
-
);
|
|
287
|
+
(netSyIn, netSyFee) = state.swapSyForExactPt(pyIndex(market), exactPtOut, block.timestamp);
|
|
303
288
|
priceImpact = calcPriceImpact(market, exactPtOut.Int());
|
|
304
289
|
}
|
|
305
290
|
|
|
306
291
|
/// @dev netPtOut is the parameter to approx
|
|
307
|
-
function
|
|
292
|
+
function swapExactSyForPtStatic(
|
|
308
293
|
address market,
|
|
309
|
-
uint256
|
|
294
|
+
uint256 exactSyIn,
|
|
310
295
|
ApproxParams memory approxParams
|
|
311
296
|
)
|
|
312
297
|
public
|
|
313
298
|
returns (
|
|
314
299
|
uint256 netPtOut,
|
|
315
|
-
uint256
|
|
300
|
+
uint256 netSyFee,
|
|
316
301
|
uint256 priceImpact
|
|
317
302
|
)
|
|
318
303
|
{
|
|
319
304
|
MarketState memory state = IPMarket(market).readState();
|
|
320
|
-
(netPtOut,
|
|
305
|
+
(netPtOut, netSyFee) = state.approxSwapExactSyForPt(
|
|
321
306
|
pyIndex(market),
|
|
322
|
-
|
|
307
|
+
exactSyIn,
|
|
323
308
|
block.timestamp,
|
|
324
309
|
approxParams
|
|
325
310
|
);
|
|
@@ -327,23 +312,23 @@ library MarketMathStatic {
|
|
|
327
312
|
}
|
|
328
313
|
|
|
329
314
|
/// @dev netPtIn is the parameter to approx
|
|
330
|
-
function
|
|
315
|
+
function swapPtForExactSyStatic(
|
|
331
316
|
address market,
|
|
332
|
-
uint256
|
|
317
|
+
uint256 exactSyOut,
|
|
333
318
|
ApproxParams memory approxParams
|
|
334
319
|
)
|
|
335
320
|
public
|
|
336
321
|
returns (
|
|
337
322
|
uint256 netPtIn,
|
|
338
|
-
uint256
|
|
323
|
+
uint256 netSyFee,
|
|
339
324
|
uint256 priceImpact
|
|
340
325
|
)
|
|
341
326
|
{
|
|
342
327
|
MarketState memory state = IPMarket(market).readState();
|
|
343
328
|
|
|
344
|
-
(netPtIn, ,
|
|
329
|
+
(netPtIn, , netSyFee) = state.approxSwapPtForExactSy(
|
|
345
330
|
pyIndex(market),
|
|
346
|
-
|
|
331
|
+
exactSyOut,
|
|
347
332
|
block.timestamp,
|
|
348
333
|
approxParams
|
|
349
334
|
);
|
|
@@ -360,16 +345,16 @@ library MarketMathStatic {
|
|
|
360
345
|
external
|
|
361
346
|
returns (
|
|
362
347
|
uint256 netPtOut,
|
|
363
|
-
uint256
|
|
348
|
+
uint256 netSyFee,
|
|
364
349
|
uint256 priceImpact
|
|
365
350
|
)
|
|
366
351
|
{
|
|
367
|
-
(
|
|
352
|
+
(IStandardizedYield SY, , ) = IPMarket(market).readTokens();
|
|
368
353
|
|
|
369
354
|
return
|
|
370
|
-
|
|
355
|
+
swapExactSyForPtStatic(
|
|
371
356
|
market,
|
|
372
|
-
|
|
357
|
+
SY.previewDeposit(baseToken, amountBaseToken),
|
|
373
358
|
approxParams
|
|
374
359
|
);
|
|
375
360
|
}
|
|
@@ -382,22 +367,22 @@ library MarketMathStatic {
|
|
|
382
367
|
external
|
|
383
368
|
returns (
|
|
384
369
|
uint256 netBaseTokenOut,
|
|
385
|
-
uint256
|
|
370
|
+
uint256 netSyFee,
|
|
386
371
|
uint256 priceImpact
|
|
387
372
|
)
|
|
388
373
|
{
|
|
389
|
-
uint256
|
|
390
|
-
(
|
|
374
|
+
uint256 netSyOut;
|
|
375
|
+
(netSyOut, netSyFee, priceImpact) = swapExactPtForSyStatic(market, exactPtIn);
|
|
391
376
|
|
|
392
|
-
(
|
|
393
|
-
netBaseTokenOut =
|
|
377
|
+
(IStandardizedYield SY, , ) = IPMarket(market).readTokens();
|
|
378
|
+
netBaseTokenOut = SY.previewRedeem(baseToken, netSyOut);
|
|
394
379
|
}
|
|
395
380
|
|
|
396
|
-
function
|
|
381
|
+
function swapSyForExactYtStatic(address market, uint256 exactYtOut)
|
|
397
382
|
external
|
|
398
383
|
returns (
|
|
399
|
-
uint256
|
|
400
|
-
uint256
|
|
384
|
+
uint256 netSyIn,
|
|
385
|
+
uint256 netSyFee,
|
|
401
386
|
uint256 priceImpact
|
|
402
387
|
)
|
|
403
388
|
{
|
|
@@ -405,38 +390,38 @@ library MarketMathStatic {
|
|
|
405
390
|
|
|
406
391
|
PYIndex index = pyIndex(market);
|
|
407
392
|
|
|
408
|
-
uint256
|
|
409
|
-
(
|
|
393
|
+
uint256 syReceived;
|
|
394
|
+
(syReceived, netSyFee) = state.swapExactPtForSy(
|
|
410
395
|
pyIndex(market),
|
|
411
396
|
exactYtOut,
|
|
412
397
|
block.timestamp
|
|
413
398
|
);
|
|
414
399
|
|
|
415
|
-
uint256
|
|
416
|
-
|
|
400
|
+
uint256 totalSyNeed = index.assetToSyUp(exactYtOut);
|
|
401
|
+
netSyIn = totalSyNeed.subMax0(syReceived);
|
|
417
402
|
|
|
418
403
|
priceImpact = calcPriceImpact(market, exactYtOut.neg());
|
|
419
404
|
}
|
|
420
405
|
|
|
421
406
|
/// @dev netYtOut is the parameter to approx
|
|
422
|
-
function
|
|
407
|
+
function swapExactSyForYtStatic(
|
|
423
408
|
address market,
|
|
424
|
-
uint256
|
|
409
|
+
uint256 exactSyIn,
|
|
425
410
|
ApproxParams memory approxParams
|
|
426
411
|
)
|
|
427
412
|
public
|
|
428
413
|
returns (
|
|
429
414
|
uint256 netYtOut,
|
|
430
|
-
uint256
|
|
415
|
+
uint256 netSyFee,
|
|
431
416
|
uint256 priceImpact
|
|
432
417
|
)
|
|
433
418
|
{
|
|
434
419
|
MarketState memory state = IPMarket(market).readState();
|
|
435
420
|
PYIndex index = pyIndex(market);
|
|
436
421
|
|
|
437
|
-
(netYtOut,
|
|
422
|
+
(netYtOut, netSyFee) = state.approxSwapExactSyForYt(
|
|
438
423
|
index,
|
|
439
|
-
|
|
424
|
+
exactSyIn,
|
|
440
425
|
block.timestamp,
|
|
441
426
|
approxParams
|
|
442
427
|
);
|
|
@@ -444,11 +429,11 @@ library MarketMathStatic {
|
|
|
444
429
|
priceImpact = calcPriceImpact(market, netYtOut.neg());
|
|
445
430
|
}
|
|
446
431
|
|
|
447
|
-
function
|
|
432
|
+
function swapExactYtForSyStatic(address market, uint256 exactYtIn)
|
|
448
433
|
public
|
|
449
434
|
returns (
|
|
450
|
-
uint256
|
|
451
|
-
uint256
|
|
435
|
+
uint256 netSyOut,
|
|
436
|
+
uint256 netSyFee,
|
|
452
437
|
uint256 priceImpact
|
|
453
438
|
)
|
|
454
439
|
{
|
|
@@ -456,26 +441,26 @@ library MarketMathStatic {
|
|
|
456
441
|
|
|
457
442
|
PYIndex index = pyIndex(market);
|
|
458
443
|
|
|
459
|
-
uint256
|
|
460
|
-
(
|
|
444
|
+
uint256 syOwed;
|
|
445
|
+
(syOwed, netSyFee) = state.swapSyForExactPt(index, exactYtIn, block.timestamp);
|
|
461
446
|
|
|
462
|
-
uint256
|
|
463
|
-
uint256
|
|
447
|
+
uint256 amountPYToRepaySyOwed = index.syToAssetUp(syOwed);
|
|
448
|
+
uint256 amountPYToRedeemSyOut = exactYtIn - amountPYToRepaySyOwed;
|
|
464
449
|
|
|
465
|
-
|
|
450
|
+
netSyOut = index.assetToSy(amountPYToRedeemSyOut);
|
|
466
451
|
priceImpact = calcPriceImpact(market, exactYtIn.Int());
|
|
467
452
|
}
|
|
468
453
|
|
|
469
454
|
/// @dev netYtIn is the parameter to approx
|
|
470
|
-
function
|
|
455
|
+
function swapYtForExactSyStatic(
|
|
471
456
|
address market,
|
|
472
|
-
uint256
|
|
457
|
+
uint256 exactSyOut,
|
|
473
458
|
ApproxParams memory approxParams
|
|
474
459
|
)
|
|
475
460
|
external
|
|
476
461
|
returns (
|
|
477
462
|
uint256 netYtIn,
|
|
478
|
-
uint256
|
|
463
|
+
uint256 netSyFee,
|
|
479
464
|
uint256 priceImpact
|
|
480
465
|
)
|
|
481
466
|
{
|
|
@@ -483,9 +468,9 @@ library MarketMathStatic {
|
|
|
483
468
|
|
|
484
469
|
PYIndex index = pyIndex(market);
|
|
485
470
|
|
|
486
|
-
(netYtIn, ,
|
|
471
|
+
(netYtIn, , netSyFee) = state.approxSwapYtForExactSy(
|
|
487
472
|
index,
|
|
488
|
-
|
|
473
|
+
exactSyOut,
|
|
489
474
|
block.timestamp,
|
|
490
475
|
approxParams
|
|
491
476
|
);
|
|
@@ -500,15 +485,15 @@ library MarketMathStatic {
|
|
|
500
485
|
external
|
|
501
486
|
returns (
|
|
502
487
|
uint256 netBaseTokenOut,
|
|
503
|
-
uint256
|
|
488
|
+
uint256 netSyFee,
|
|
504
489
|
uint256 priceImpact
|
|
505
490
|
)
|
|
506
491
|
{
|
|
507
|
-
uint256
|
|
508
|
-
(
|
|
492
|
+
uint256 netSyOut;
|
|
493
|
+
(netSyOut, netSyFee, priceImpact) = swapExactYtForSyStatic(market, exactYtIn);
|
|
509
494
|
|
|
510
|
-
(
|
|
511
|
-
netBaseTokenOut =
|
|
495
|
+
(IStandardizedYield SY, , ) = IPMarket(market).readTokens();
|
|
496
|
+
netBaseTokenOut = SY.previewRedeem(baseToken, netSyOut);
|
|
512
497
|
}
|
|
513
498
|
|
|
514
499
|
/// @dev netYtOut is the parameter to approx
|
|
@@ -521,16 +506,16 @@ library MarketMathStatic {
|
|
|
521
506
|
external
|
|
522
507
|
returns (
|
|
523
508
|
uint256 netYtOut,
|
|
524
|
-
uint256
|
|
509
|
+
uint256 netSyFee,
|
|
525
510
|
uint256 priceImpact
|
|
526
511
|
)
|
|
527
512
|
{
|
|
528
|
-
(
|
|
513
|
+
(IStandardizedYield SY, , ) = IPMarket(market).readTokens();
|
|
529
514
|
|
|
530
515
|
return
|
|
531
|
-
|
|
516
|
+
swapExactSyForYtStatic(
|
|
532
517
|
market,
|
|
533
|
-
|
|
518
|
+
SY.previewDeposit(baseToken, amountBaseToken),
|
|
534
519
|
approxParams
|
|
535
520
|
);
|
|
536
521
|
}
|
|
@@ -545,14 +530,14 @@ library MarketMathStatic {
|
|
|
545
530
|
returns (
|
|
546
531
|
uint256 netYtOut,
|
|
547
532
|
uint256 totalPtToSwap,
|
|
548
|
-
uint256
|
|
533
|
+
uint256 netSyFee,
|
|
549
534
|
uint256 priceImpact
|
|
550
535
|
)
|
|
551
536
|
{
|
|
552
537
|
MarketState memory state = IPMarket(market).readState();
|
|
553
538
|
PYIndex index = pyIndex(market);
|
|
554
539
|
|
|
555
|
-
(netYtOut, totalPtToSwap,
|
|
540
|
+
(netYtOut, totalPtToSwap, netSyFee) = state.approxSwapExactPtForYt(
|
|
556
541
|
index,
|
|
557
542
|
exactPtIn,
|
|
558
543
|
block.timestamp,
|
|
@@ -571,14 +556,14 @@ library MarketMathStatic {
|
|
|
571
556
|
returns (
|
|
572
557
|
uint256 netPtOut,
|
|
573
558
|
uint256 totalPtSwapped,
|
|
574
|
-
uint256
|
|
559
|
+
uint256 netSyFee,
|
|
575
560
|
uint256 priceImpact
|
|
576
561
|
)
|
|
577
562
|
{
|
|
578
563
|
MarketState memory state = IPMarket(market).readState();
|
|
579
564
|
PYIndex index = pyIndex(market);
|
|
580
565
|
|
|
581
|
-
(netPtOut, totalPtSwapped,
|
|
566
|
+
(netPtOut, totalPtSwapped, netSyFee) = state.approxSwapExactYtForPt(
|
|
582
567
|
index,
|
|
583
568
|
exactYtIn,
|
|
584
569
|
block.timestamp,
|