@pendle/core-v2 0.12.2-testnet → 0.13.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 +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +4 -0
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.json +48 -0
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/FeeDistributor/EpochResultManager.sol/EpochResultManager.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +4 -0
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +1084 -0
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +32 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +4 -0
- package/build/artifacts/contracts/{core/LiquidityMining → LiquidityMining}/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → LiquidityMining/libraries}/VeBalanceLib.sol/VeBalanceLib.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → LiquidityMining/libraries}/VeHistoryLib.sol/CheckpointHelper.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → LiquidityMining/libraries}/VeHistoryLib.sol/Checkpoints.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/math → LiquidityMining/libraries}/WeekMath.sol/WeekMath.json +3 -3
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/math → core/Market}/MarketMathCore.sol/MarketMathCore.json +3 -3
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → core/Market}/OracleLib.sol/OracleLib.json +3 -3
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +4 -0
- package/build/artifacts/contracts/core/{LiquidityMining → Market}/PendleGauge.sol/PendleGauge.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 +4 -4
- 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 +4 -0
- package/build/artifacts/contracts/{libraries → core/RewardManager}/RewardManager.sol/RewardManager.json +1 -1
- package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → core/RewardManager}/RewardManagerAbstract.sol/RewardManagerAbstract.json +1 -1
- package/build/artifacts/contracts/core/SuperComposableYield/PYIndex.sol/PYIndexLib.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/helpers → core/SuperComposableYield}/PYIndex.sol/PYIndexLib.json +3 -3
- package/build/artifacts/contracts/core/SuperComposableYield/SCYBase.sol/SCYBase.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/base-implementations → core/SuperComposableYield}/SCYBase.sol/SCYBase.json +1 -1
- package/build/artifacts/contracts/core/SuperComposableYield/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/base-implementations → core/SuperComposableYield}/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +1 -1
- package/build/artifacts/contracts/core/SuperComposableYield/SCYUtils.sol/SCYUtils.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/SCY → core/SuperComposableYield}/SCYUtils.sol/SCYUtils.json +3 -3
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +3 -3
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +4 -0
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +1007 -0
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.dbg.json +4 -0
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.json +1030 -0
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.dbg.json +4 -0
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.json +1025 -0
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.json +1 -1
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +3 -3
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +4 -0
- package/build/artifacts/contracts/core/SuperComposableYield/implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +851 -0
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
- package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +4 -0
- package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.json +254 -0
- package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +4 -0
- package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +329 -0
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/helpers → core/libraries}/ArrayLib.sol/ArrayLib.json +3 -3
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/helpers → core/libraries}/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +3 -3
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/helpers → core/libraries}/BaseSplitCodeFactory.sol/CodeDeployer.json +3 -3
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +4 -0
- package/build/artifacts/contracts/{periphery → core/libraries}/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +4 -0
- package/build/artifacts/contracts/{periphery → core/libraries}/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +3 -3
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → core/libraries}/Errors.sol/Errors.json +9 -4
- package/build/artifacts/contracts/core/libraries/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/helpers → core/libraries}/ExpiryUtilsLib.sol/ExpiryUtils.json +3 -3
- package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/helpers → core/libraries}/MiniHelpers.sol/MiniHelpers.json +3 -3
- package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/helpers → core/libraries}/TokenHelper.sol/TokenHelper.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → core/libraries}/math/LogExpMath.sol/LogExpMath.json +3 -3
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → core/libraries}/math/Math.sol/Math.json +3 -3
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.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/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.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/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +31 -0
- 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/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +8 -3
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +60 -89
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +4 -0
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +1237 -0
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions → router}/ActionCallback.sol/ActionCallback.json +3 -3
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions → router}/ActionMintRedeem.sol/ActionMintRedeem.json +5 -5
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions → router}/ActionMisc.sol/ActionMisc.json +3 -3
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +4 -0
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +698 -0
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +4 -0
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +317 -0
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +4 -0
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +645 -0
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +4 -0
- package/build/artifacts/contracts/{core → router}/PendleRouter.sol/PendleRouter.json +3 -3
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions → router}/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions → router}/base/CallbackHelper.sol/CallbackHelper.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/math → router/base}/MarketApproxLib.sol/MarketApproxPtInLib.json +3 -3
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries/math → router/base}/MarketApproxLib.sol/MarketApproxPtOutLib.json +3 -3
- package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +35 -0
- package/build/artifacts/contracts/router/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → router}/kyberswap/IMultihopRouter.sol/IMultihopRouter.json +1 -1
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{libraries → router}/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.json +1 -1
- package/contracts/{core/LiquidityMining → LiquidityMining}/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +6 -6
- package/contracts/{core/LiquidityMining → LiquidityMining}/CrossChainMsg/PendleMsgReceiverAppUpg.sol +5 -5
- package/contracts/{core/LiquidityMining → LiquidityMining}/CrossChainMsg/PendleMsgSendEndpointUpg.sol +5 -5
- package/contracts/{core/LiquidityMining → LiquidityMining}/CrossChainMsg/PendleMsgSenderAppUpg.sol +4 -4
- package/contracts/{core/LiquidityMining → LiquidityMining}/FeeDistributor/EpochResultManager.sol +7 -7
- package/contracts/{core/LiquidityMining → LiquidityMining}/FeeDistributor/PendleFeeDistributor.sol +14 -11
- package/contracts/{core/LiquidityMining → LiquidityMining}/FeeDistributor/PendleFeeDistributorFactory.sol +6 -4
- package/contracts/{core/LiquidityMining → LiquidityMining}/GaugeController/PendleGaugeControllerBaseUpg.sol +14 -11
- package/contracts/{core/LiquidityMining → LiquidityMining}/GaugeController/PendleGaugeControllerMainchainUpg.sol +2 -2
- package/contracts/{core/LiquidityMining → LiquidityMining}/GaugeController/PendleGaugeControllerSidechainUpg.sol +1 -1
- package/contracts/{core/LiquidityMining → LiquidityMining}/README.md +0 -0
- package/contracts/{core/LiquidityMining → LiquidityMining}/VotingController/PendleVotingControllerUpg.sol +6 -5
- package/contracts/{core/LiquidityMining → LiquidityMining}/VotingController/VotingControllerStorageUpg.sol +16 -12
- package/contracts/{core/LiquidityMining → LiquidityMining}/VotingEscrow/VotingEscrowPendleMainchain.sol +11 -7
- package/contracts/{core/LiquidityMining → LiquidityMining}/VotingEscrow/VotingEscrowPendleSidechain.sol +9 -4
- package/contracts/{core/LiquidityMining → LiquidityMining}/VotingEscrow/VotingEscrowTokenBase.sol +9 -7
- package/contracts/{libraries → LiquidityMining/libraries}/VeBalanceLib.sol +3 -3
- package/contracts/{libraries → LiquidityMining/libraries}/VeHistoryLib.sol +2 -2
- package/contracts/{libraries/math → LiquidityMining/libraries}/WeekMath.sol +2 -2
- package/contracts/{libraries/math → core/Market}/MarketMathCore.sol +17 -19
- package/contracts/{libraries → core/Market}/OracleLib.sol +2 -2
- package/contracts/core/{LiquidityMining → Market}/PendleGauge.sol +4 -6
- package/contracts/core/Market/PendleMarket.sol +4 -12
- package/contracts/core/Market/PendleMarketFactory.sol +5 -5
- package/contracts/{libraries → core/RewardManager}/RewardManager.sol +2 -4
- package/contracts/{libraries → core/RewardManager}/RewardManagerAbstract.sol +9 -4
- package/contracts/{libraries/helpers → core/SuperComposableYield}/PYIndex.sol +4 -3
- package/contracts/{SuperComposableYield/base-implementations → core/SuperComposableYield}/SCYBase.sol +11 -8
- package/contracts/{SuperComposableYield/base-implementations → core/SuperComposableYield}/SCYBaseWithRewards.sol +5 -4
- package/contracts/{libraries/SCY → core/SuperComposableYield}/SCYUtils.sol +1 -1
- package/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/BenQi/PendleQiTokenHelper.sol +2 -2
- package/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/BenQi/PendleQiTokenSCY.sol +6 -6
- package/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol +2 -2
- package/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol +1 -1
- package/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol +5 -5
- package/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/Convex/Pendle3CrvHelper.sol +2 -2
- package/contracts/{SuperComposableYield/SCY-implementations → core/SuperComposableYield/implementations}/PendleWstEthSCY.sol +6 -5
- package/contracts/core/YieldContracts/InterestManagerYT.sol +5 -5
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +6 -4
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +6 -7
- package/contracts/core/YieldContracts/PendleYieldToken.sol +11 -10
- package/contracts/core/{PendleERC20.sol → erc20/PendleERC20.sol} +0 -0
- package/contracts/core/{PendleERC20Permit.sol → erc20/PendleERC20Permit.sol} +0 -0
- package/contracts/{libraries/helpers → core/libraries}/ArrayLib.sol +0 -0
- package/contracts/{libraries/helpers → core/libraries}/BaseSplitCodeFactory.sol +1 -1
- package/contracts/{periphery → core/libraries}/BoringOwnableUpgradeable.sol +1 -1
- package/contracts/{libraries → core/libraries}/Errors.sol +2 -2
- package/contracts/{libraries/helpers → core/libraries}/ExpiryUtilsLib.sol +1 -1
- package/contracts/{libraries/helpers → core/libraries}/MiniHelpers.sol +1 -1
- package/contracts/{libraries/helpers → core/libraries}/TokenHelper.sol +1 -16
- package/contracts/{libraries → core/libraries}/math/LogExpMath.sol +1 -1
- package/contracts/{libraries → core/libraries}/math/Math.sol +2 -2
- package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -1
- package/contracts/interfaces/ConvexCurve/ICrvDepositor.sol +1 -1
- package/contracts/interfaces/ConvexCurve/ICvxCrv.sol +1 -1
- package/contracts/interfaces/ConvexCurve/IRewards.sol +1 -1
- package/contracts/interfaces/Curve/ICrvPool.sol +1 -1
- package/contracts/interfaces/IAToken.sol +1 -1
- package/contracts/interfaces/IAavePool.sol +1 -1
- package/contracts/interfaces/IAaveRewardsController.sol +1 -1
- package/contracts/interfaces/IBenQiComptroller.sol +1 -1
- package/contracts/interfaces/IBenQiInterestRateModel.sol +1 -1
- package/contracts/interfaces/IBoringOwnableUpgradeable.sol +1 -1
- package/contracts/interfaces/IERC4626.sol +1 -1
- package/contracts/interfaces/IEulerEToken.sol +1 -1
- package/contracts/interfaces/IEulerMarkets.sol +1 -1
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +3 -3
- package/contracts/interfaces/IPActionMintRedeem.sol +3 -3
- package/contracts/interfaces/IPActionMisc.sol +1 -1
- package/contracts/interfaces/IPActionSwapPT.sol +3 -3
- package/contracts/interfaces/IPActionSwapPTYT.sol +3 -3
- package/contracts/interfaces/IPActionSwapYT.sol +3 -3
- package/contracts/interfaces/IPAllAction.sol +1 -1
- package/contracts/interfaces/IPFeeDistributor.sol +1 -1
- package/contracts/interfaces/IPFeeDistributorFactory.sol +1 -1
- package/contracts/interfaces/IPGauge.sol +1 -1
- package/contracts/interfaces/IPGaugeController.sol +1 -1
- package/contracts/interfaces/IPGaugeControllerMainchain.sol +1 -1
- package/contracts/interfaces/IPGovernanceManager.sol +1 -1
- package/contracts/interfaces/IPInterestManagerYT.sol +1 -1
- package/contracts/interfaces/IPMarket.sol +2 -2
- package/contracts/interfaces/IPMarketFactory.sol +1 -1
- package/contracts/interfaces/IPMarketSwapCallback.sol +1 -1
- package/contracts/interfaces/IPPermissionsV2Upg.sol +1 -1
- package/contracts/interfaces/IPPrincipalToken.sol +1 -1
- package/contracts/interfaces/IPVeToken.sol +1 -1
- package/contracts/interfaces/IPVotingController.sol +5 -3
- package/contracts/interfaces/IPVotingEscrowMainchain.sol +3 -3
- package/contracts/interfaces/IPYieldContractFactory.sol +1 -1
- package/contracts/interfaces/IPYieldToken.sol +1 -1
- package/contracts/interfaces/IQiAvax.sol +1 -1
- package/contracts/interfaces/IQiErc20.sol +1 -1
- package/contracts/interfaces/IQiToken.sol +1 -1
- package/contracts/interfaces/IREDACTEDStaking.sol +1 -1
- package/contracts/interfaces/IRewardManager.sol +1 -1
- package/contracts/interfaces/ISAvax.sol +1 -1
- package/contracts/interfaces/ISJoe.sol +1 -1
- package/contracts/interfaces/IStETH.sol +1 -1
- package/contracts/interfaces/IStargateLPStaking.sol +1 -1
- package/contracts/interfaces/IStargatePool.sol +1 -1
- package/contracts/interfaces/IStargateRouter.sol +1 -1
- package/contracts/interfaces/ISuperComposableYield.sol +1 -1
- package/contracts/interfaces/IWAvax.sol +1 -1
- package/contracts/interfaces/IWETH.sol +1 -1
- package/contracts/interfaces/IWXBTRFLY.sol +1 -1
- package/contracts/interfaces/IWstETH.sol +1 -1
- package/contracts/interfaces/IYearnVault.sol +1 -1
- package/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol +4 -3
- package/contracts/offchain-helpers/MarketMathStatic.sol +7 -7
- package/contracts/offchain-helpers/RouterStatic.sol +7 -14
- package/contracts/{core/actions → router}/ActionAddRemoveLiq.sol +5 -5
- package/contracts/{core/actions → router}/ActionCallback.sol +7 -7
- package/contracts/{core/actions → router}/ActionMintRedeem.sol +4 -4
- package/contracts/{core/actions → router}/ActionMisc.sol +4 -4
- package/contracts/{core/actions → router}/ActionSwapPT.sol +5 -5
- package/contracts/{core/actions → router}/ActionSwapPTYT.sol +5 -5
- package/contracts/{core/actions → router}/ActionSwapYT.sol +5 -5
- package/contracts/{core → router}/PendleRouter.sol +3 -3
- package/contracts/{core/actions → router}/base/ActionBaseMintRedeem.sol +6 -6
- package/contracts/{core/actions → router}/base/CallbackHelper.sol +1 -1
- package/contracts/{libraries/math → router/base}/MarketApproxLib.sol +180 -219
- package/contracts/{libraries → router}/kyberswap/AggregationRouterHelper.sol +1 -1
- package/contracts/{libraries → router}/kyberswap/IMultihopRouter.sol +0 -0
- package/contracts/{libraries → router}/kyberswap/KyberSwapHelper.sol +3 -4
- package/deployments/kovan.json +31 -0
- package/package.json +4 -4
- package/typechain-types/IPVotingController.ts +18 -0
- package/typechain-types/PendleMsgReceiverAppUpg.ts +3 -128
- package/typechain-types/PendleVotingControllerUpg.ts +18 -0
- package/typechain-types/RouterStatic.ts +0 -45
- package/typechain-types/VotingControllerStorageUpg.ts +18 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +10 -5
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +4 -4
- package/typechain-types/factories/ActionMisc__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +7 -2
- package/typechain-types/factories/ActionSwapPT__factory.ts +10 -5
- package/typechain-types/factories/ActionSwapYT__factory.ts +10 -5
- package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +1 -1
- package/typechain-types/factories/BaseSplitCodeFactory__factory.ts +1 -1
- package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/Errors__factory.ts +7 -2
- package/typechain-types/factories/IPVotingController__factory.ts +31 -0
- package/typechain-types/factories/MarketMathStatic__factory.ts +7 -2
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/Pendle3CrvAndTokenSCY__factory.ts +1 -1
- package/typechain-types/factories/Pendle3CrvHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleConvexCurveLP2PoolSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +4 -4
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgReceiverAppUpg__factory.ts +0 -75
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +32 -1
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +1 -30
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +31 -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 +232 -232
- package/typechain-types/index.ts +90 -90
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +0 -1007
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.json +0 -1030
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.json +0 -1025
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +0 -851
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.json +0 -123
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +0 -1053
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +0 -254
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +0 -329
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +0 -1232
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.json +0 -693
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.json +0 -312
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.json +0 -640
- package/build/artifacts/contracts/core/actions/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/Errors.sol/Errors.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +0 -35
- package/build/artifacts/contracts/libraries/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +0 -4
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +0 -4
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +0 -4
- package/deployments/43113-core.json +0 -16
- package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
- package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
- package/deployments/43113-testenv.json +0 -22
- package/deployments/80001-core.json +0 -15
- package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
- package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
- package/deployments/80001-testenv.json +0 -22
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
4
|
+
import "../../core/libraries/math/Math.sol";
|
|
5
|
+
import "../../core/Market/MarketMathCore.sol";
|
|
6
6
|
|
|
7
7
|
struct ApproxParams {
|
|
8
8
|
uint256 guessMin;
|
|
@@ -63,7 +63,7 @@ library MarketApproxPtInLib {
|
|
|
63
63
|
returns (
|
|
64
64
|
uint256, /*netPtIn*/
|
|
65
65
|
uint256, /*netScyOut*/
|
|
66
|
-
uint256 /*
|
|
66
|
+
uint256 /*netScyFee*/
|
|
67
67
|
)
|
|
68
68
|
{
|
|
69
69
|
/*
|
|
@@ -72,35 +72,24 @@ library MarketApproxPtInLib {
|
|
|
72
72
|
2. if netScyOut is greater & approx minScyOut => answer found
|
|
73
73
|
*/
|
|
74
74
|
|
|
75
|
-
Args1 memory
|
|
76
|
-
MarketPreCompute memory comp =
|
|
77
|
-
ApproxParamsPtIn memory p = newApproxParamsPtIn(_approx, comp.totalAsset);
|
|
78
|
-
|
|
79
|
-
uint256 minAssetOut = arg.index.scyToAssetUp(arg.minScyOut);
|
|
75
|
+
Args1 memory a = Args1(_market, _index, _minScyOut, _blockTime);
|
|
76
|
+
MarketPreCompute memory comp = a.market.getMarketPreCompute(a.index, a.blockTime);
|
|
77
|
+
ApproxParamsPtIn memory p = newApproxParamsPtIn(_approx, 0, calcMaxPtIn(comp.totalAsset));
|
|
80
78
|
|
|
81
79
|
for (uint256 iter = 0; iter < p.maxIteration; ++iter) {
|
|
82
|
-
(bool isGoodSlope, uint256 guess) = nextGuess(p, comp,
|
|
83
|
-
|
|
80
|
+
(bool isGoodSlope, uint256 guess) = nextGuess(p, comp, a.market.totalPt, iter);
|
|
84
81
|
if (!isGoodSlope) {
|
|
85
82
|
p.guessMax = guess;
|
|
86
83
|
continue;
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
(uint256
|
|
90
|
-
arg.market,
|
|
91
|
-
comp,
|
|
92
|
-
guess
|
|
93
|
-
);
|
|
86
|
+
(uint256 netScyOut, uint256 netScyFee) = calcScyOut(a.market, comp, a.index, guess);
|
|
94
87
|
|
|
95
|
-
if (
|
|
88
|
+
if (netScyOut >= a.minScyOut) {
|
|
96
89
|
p.guessMax = guess;
|
|
97
|
-
bool isAnswerAccepted = Math.isAGreaterApproxB(
|
|
90
|
+
bool isAnswerAccepted = Math.isAGreaterApproxB(netScyOut, a.minScyOut, p.eps);
|
|
98
91
|
if (isAnswerAccepted) {
|
|
99
|
-
return (
|
|
100
|
-
guess,
|
|
101
|
-
arg.index.assetToScy(netAssetOut),
|
|
102
|
-
arg.index.assetToScy(netAssetToReserve)
|
|
103
|
-
);
|
|
92
|
+
return (guess, netScyOut, netScyFee);
|
|
104
93
|
}
|
|
105
94
|
} else {
|
|
106
95
|
p.guessMin = guess;
|
|
@@ -112,14 +101,14 @@ library MarketApproxPtInLib {
|
|
|
112
101
|
struct Args2 {
|
|
113
102
|
MarketState market;
|
|
114
103
|
PYIndex index;
|
|
115
|
-
uint256
|
|
104
|
+
uint256 exactScyIn;
|
|
116
105
|
uint256 blockTime;
|
|
117
106
|
}
|
|
118
107
|
|
|
119
108
|
function approxSwapExactScyForYt(
|
|
120
109
|
MarketState memory _market,
|
|
121
110
|
PYIndex _index,
|
|
122
|
-
uint256
|
|
111
|
+
uint256 _exactScyIn,
|
|
123
112
|
uint256 _blockTime,
|
|
124
113
|
ApproxParams memory _approx
|
|
125
114
|
)
|
|
@@ -127,54 +116,35 @@ library MarketApproxPtInLib {
|
|
|
127
116
|
pure
|
|
128
117
|
returns (
|
|
129
118
|
uint256, /*netYtOut*/
|
|
130
|
-
uint256
|
|
131
|
-
uint256 /*netScyToReserve*/
|
|
119
|
+
uint256 /*netScyFee*/
|
|
132
120
|
)
|
|
133
121
|
{
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Args2 memory arg = Args2(_market, _index, _maxScyIn, _blockTime);
|
|
145
|
-
MarketPreCompute memory comp = arg.market.getMarketPreCompute(arg.index, arg.blockTime);
|
|
146
|
-
ApproxParamsPtIn memory p = newApproxParamsPtIn(_approx, comp.totalAsset);
|
|
147
|
-
|
|
148
|
-
uint256 maxAssetIn = arg.index.scyToAsset(arg.maxScyIn);
|
|
149
|
-
|
|
150
|
-
// at minimum we will flashswap maxAssetIn since we have enough SCY to payback the PT loan
|
|
151
|
-
if (p.guessMin == 0) p.guessMin = maxAssetIn;
|
|
122
|
+
Args2 memory a = Args2(_market, _index, _exactScyIn, _blockTime);
|
|
123
|
+
MarketPreCompute memory comp = a.market.getMarketPreCompute(a.index, a.blockTime);
|
|
124
|
+
|
|
125
|
+
// at minimum we will flashswap exactScyIn since we have enough SCY to payback the PT loan
|
|
126
|
+
ApproxParamsPtIn memory p = newApproxParamsPtIn(
|
|
127
|
+
_approx,
|
|
128
|
+
a.index.scyToAsset(a.exactScyIn),
|
|
129
|
+
calcMaxPtIn(comp.totalAsset)
|
|
130
|
+
);
|
|
152
131
|
|
|
153
132
|
for (uint256 iter = 0; iter < p.maxIteration; ++iter) {
|
|
154
133
|
// ytOutGuess = ptInGuess
|
|
155
|
-
(bool isGoodSlope, uint256 guess) = nextGuess(p, comp,
|
|
134
|
+
(bool isGoodSlope, uint256 guess) = nextGuess(p, comp, a.market.totalPt, iter);
|
|
156
135
|
if (!isGoodSlope) {
|
|
157
136
|
p.guessMax = guess;
|
|
158
137
|
continue;
|
|
159
138
|
}
|
|
160
139
|
|
|
161
|
-
(uint256
|
|
162
|
-
arg.market,
|
|
163
|
-
comp,
|
|
164
|
-
guess
|
|
165
|
-
);
|
|
140
|
+
(uint256 netScyOut, uint256 netScyFee) = calcScyOut(a.market, comp, a.index, guess);
|
|
166
141
|
|
|
167
|
-
uint256
|
|
142
|
+
uint256 maxPtPayable = a.index.scyToAsset(netScyOut + a.exactScyIn);
|
|
168
143
|
|
|
169
|
-
if (
|
|
144
|
+
if (guess <= maxPtPayable) {
|
|
170
145
|
p.guessMin = guess;
|
|
171
|
-
bool isAnswerAccepted = Math.isASmallerApproxB(
|
|
172
|
-
if (isAnswerAccepted)
|
|
173
|
-
return (
|
|
174
|
-
guess,
|
|
175
|
-
arg.index.assetToScy(netAssetToPull),
|
|
176
|
-
arg.index.assetToScy(netAssetToReserve)
|
|
177
|
-
);
|
|
146
|
+
bool isAnswerAccepted = Math.isASmallerApproxB(guess, maxPtPayable, p.eps);
|
|
147
|
+
if (isAnswerAccepted) return (guess, netScyFee);
|
|
178
148
|
} else {
|
|
179
149
|
p.guessMax = guess;
|
|
180
150
|
}
|
|
@@ -201,7 +171,7 @@ library MarketApproxPtInLib {
|
|
|
201
171
|
returns (
|
|
202
172
|
uint256, /*netPtSwap*/
|
|
203
173
|
uint256, /*netScyFromSwap*/
|
|
204
|
-
uint256 /*
|
|
174
|
+
uint256 /*netScyFee*/
|
|
205
175
|
)
|
|
206
176
|
{
|
|
207
177
|
/*
|
|
@@ -215,53 +185,49 @@ library MarketApproxPtInLib {
|
|
|
215
185
|
Note that market maintains PT/SCY ratio, but here PT/asset is used instead
|
|
216
186
|
*/
|
|
217
187
|
|
|
218
|
-
Args6 memory
|
|
219
|
-
require(
|
|
188
|
+
Args6 memory a = Args6(_market, _index, _totalPtIn, _blockTime);
|
|
189
|
+
require(a.market.totalLp != 0, "no existing lp");
|
|
220
190
|
|
|
221
|
-
MarketPreCompute memory comp =
|
|
222
|
-
ApproxParamsPtIn memory p = newApproxParamsPtIn(
|
|
191
|
+
MarketPreCompute memory comp = a.market.getMarketPreCompute(a.index, a.blockTime);
|
|
192
|
+
ApproxParamsPtIn memory p = newApproxParamsPtIn(
|
|
193
|
+
_approx,
|
|
194
|
+
0,
|
|
195
|
+
Math.min(a.totalPtIn, calcMaxPtIn(comp.totalAsset))
|
|
196
|
+
);
|
|
223
197
|
|
|
224
|
-
p.guessMax = Math.min(p.guessMax,
|
|
198
|
+
p.guessMax = Math.min(p.guessMax, a.totalPtIn);
|
|
225
199
|
|
|
226
200
|
for (uint256 iter = 0; iter < p.maxIteration; ++iter) {
|
|
227
|
-
(bool isGoodSlope, uint256 guess) = nextGuess(p, comp,
|
|
201
|
+
(bool isGoodSlope, uint256 guess) = nextGuess(p, comp, a.market.totalPt, iter);
|
|
228
202
|
|
|
229
203
|
if (!isGoodSlope) {
|
|
230
204
|
p.guessMax = guess;
|
|
231
205
|
continue;
|
|
232
206
|
}
|
|
233
207
|
|
|
234
|
-
(uint256
|
|
235
|
-
arg.market,
|
|
236
|
-
comp,
|
|
237
|
-
guess
|
|
238
|
-
);
|
|
208
|
+
(uint256 netScyOut, uint256 netScyFee) = calcScyOut(a.market, comp, a.index, guess);
|
|
239
209
|
|
|
240
|
-
uint256
|
|
210
|
+
uint256 scyNumerator;
|
|
241
211
|
uint256 ptNumerator;
|
|
242
212
|
{
|
|
243
|
-
uint256 newTotalPt =
|
|
244
|
-
uint256 netPtRemaining =
|
|
245
|
-
uint256
|
|
213
|
+
uint256 newTotalPt = a.market.totalPt.Uint() + guess;
|
|
214
|
+
uint256 netPtRemaining = a.totalPtIn - guess;
|
|
215
|
+
uint256 newTotalScy = (a.market.totalScy.Uint() - netScyOut - netScyFee);
|
|
246
216
|
|
|
247
217
|
// it is desired that
|
|
248
|
-
// netAssetOut /
|
|
218
|
+
// netAssetOut / newTotalScy = netPtRemaining / newTotalPt
|
|
249
219
|
// which is equivalent to
|
|
250
|
-
// netAssetOut * newTotalPt = netPtRemaining *
|
|
220
|
+
// netAssetOut * newTotalPt = netPtRemaining * newTotalScy
|
|
251
221
|
|
|
252
|
-
|
|
253
|
-
ptNumerator = netPtRemaining *
|
|
222
|
+
scyNumerator = netScyOut * newTotalPt;
|
|
223
|
+
ptNumerator = netPtRemaining * newTotalScy;
|
|
254
224
|
}
|
|
255
225
|
|
|
256
|
-
if (Math.isAApproxB(
|
|
257
|
-
return (
|
|
258
|
-
guess,
|
|
259
|
-
arg.index.assetToScy(netAssetOut),
|
|
260
|
-
arg.index.assetToScy(netAssetToReserve)
|
|
261
|
-
);
|
|
226
|
+
if (Math.isAApproxB(scyNumerator, ptNumerator, p.eps)) {
|
|
227
|
+
return (guess, netScyOut, netScyFee);
|
|
262
228
|
}
|
|
263
229
|
|
|
264
|
-
if (
|
|
230
|
+
if (scyNumerator <= ptNumerator) {
|
|
265
231
|
// needs more asset --> swap more PT
|
|
266
232
|
p.guessMin = guess + 1;
|
|
267
233
|
} else {
|
|
@@ -275,14 +241,14 @@ library MarketApproxPtInLib {
|
|
|
275
241
|
struct Args7 {
|
|
276
242
|
MarketState market;
|
|
277
243
|
PYIndex index;
|
|
278
|
-
uint256
|
|
244
|
+
uint256 exactPtIn;
|
|
279
245
|
uint256 blockTime;
|
|
280
246
|
}
|
|
281
247
|
|
|
282
248
|
function approxSwapExactPtForYt(
|
|
283
249
|
MarketState memory _market,
|
|
284
250
|
PYIndex _index,
|
|
285
|
-
uint256
|
|
251
|
+
uint256 _exactPtIn,
|
|
286
252
|
uint256 _blockTime,
|
|
287
253
|
ApproxParams memory _approx // approx for totalPtToSwap
|
|
288
254
|
)
|
|
@@ -290,38 +256,36 @@ library MarketApproxPtInLib {
|
|
|
290
256
|
pure
|
|
291
257
|
returns (
|
|
292
258
|
uint256, /*netYtOut*/
|
|
293
|
-
uint256, /*netPtIn*/
|
|
294
259
|
uint256, /*totalPtToSwap*/
|
|
295
|
-
uint256 /*
|
|
260
|
+
uint256 /*netScyFee*/
|
|
296
261
|
)
|
|
297
262
|
{
|
|
298
|
-
Args7 memory
|
|
263
|
+
Args7 memory a = Args7(_market, _index, _exactPtIn, _blockTime);
|
|
299
264
|
|
|
300
|
-
MarketPreCompute memory comp =
|
|
301
|
-
ApproxParamsPtIn memory p = newApproxParamsPtIn(
|
|
302
|
-
|
|
303
|
-
|
|
265
|
+
MarketPreCompute memory comp = a.market.getMarketPreCompute(a.index, a.blockTime);
|
|
266
|
+
ApproxParamsPtIn memory p = newApproxParamsPtIn(
|
|
267
|
+
_approx,
|
|
268
|
+
a.exactPtIn,
|
|
269
|
+
calcMaxPtIn(comp.totalAsset)
|
|
270
|
+
);
|
|
304
271
|
|
|
305
272
|
for (uint256 iter = 0; iter < p.maxIteration; ++iter) {
|
|
306
|
-
(bool isGoodSlope, uint256 guess) = nextGuess(p, comp,
|
|
273
|
+
(bool isGoodSlope, uint256 guess) = nextGuess(p, comp, a.market.totalPt, iter);
|
|
307
274
|
|
|
308
275
|
if (!isGoodSlope) {
|
|
309
276
|
p.guessMax = guess;
|
|
310
277
|
continue;
|
|
311
278
|
}
|
|
312
279
|
|
|
313
|
-
(uint256
|
|
314
|
-
arg.market,
|
|
315
|
-
comp,
|
|
316
|
-
guess
|
|
317
|
-
);
|
|
280
|
+
(uint256 netScyOut, uint256 netScyFee) = calcScyOut(a.market, comp, a.index, guess);
|
|
318
281
|
|
|
319
|
-
uint256
|
|
320
|
-
|
|
282
|
+
uint256 netAssetOut = a.index.scyToAsset(netScyOut);
|
|
283
|
+
|
|
284
|
+
uint256 maxPtPayable = netAssetOut + a.exactPtIn;
|
|
285
|
+
if (guess <= maxPtPayable) {
|
|
321
286
|
p.guessMin = guess;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
return (netAssetOut, netPtIn, guess, arg.index.assetToScy(netAssetToReserve));
|
|
287
|
+
if (Math.isASmallerApproxB(guess, maxPtPayable, p.eps)) {
|
|
288
|
+
return (netAssetOut, guess, netScyFee);
|
|
325
289
|
}
|
|
326
290
|
} else {
|
|
327
291
|
p.guessMax = guess - 1;
|
|
@@ -332,29 +296,31 @@ library MarketApproxPtInLib {
|
|
|
332
296
|
|
|
333
297
|
////////////////////////////////////////////////////////////////////////////////
|
|
334
298
|
|
|
335
|
-
function
|
|
299
|
+
function calcScyOut(
|
|
336
300
|
MarketState memory market,
|
|
337
301
|
MarketPreCompute memory comp,
|
|
302
|
+
PYIndex index,
|
|
338
303
|
uint256 netPtIn
|
|
339
|
-
) internal pure returns (uint256
|
|
340
|
-
(int256
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
netAssetToReserve = assetToReserve.Uint();
|
|
304
|
+
) internal pure returns (uint256 netScyOut, uint256 netScyFee) {
|
|
305
|
+
(int256 _netScyOut, int256 _netScyFee) = market.calcTrade(comp, index, netPtIn.neg());
|
|
306
|
+
netScyOut = _netScyOut.Uint();
|
|
307
|
+
netScyFee = _netScyFee.Uint();
|
|
344
308
|
}
|
|
345
309
|
|
|
346
|
-
function newApproxParamsPtIn(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
{
|
|
351
|
-
res.guessMin = _approx.guessMin;
|
|
352
|
-
res.guessMax = Math.min(_approx.guessMax,
|
|
310
|
+
function newApproxParamsPtIn(
|
|
311
|
+
ApproxParams memory _approx,
|
|
312
|
+
uint256 minGuessMin,
|
|
313
|
+
uint256 maxGuessMax
|
|
314
|
+
) internal pure returns (ApproxParamsPtIn memory res) {
|
|
315
|
+
res.guessMin = Math.max(_approx.guessMin, minGuessMin);
|
|
316
|
+
res.guessMax = Math.min(_approx.guessMax, maxGuessMax);
|
|
317
|
+
|
|
318
|
+
if (res.guessMin > res.guessMax || _approx.eps > Math.ONE)
|
|
319
|
+
revert Errors.ApproxParamsInvalid(_approx.guessMin, _approx.guessMax, _approx.eps);
|
|
320
|
+
|
|
353
321
|
res.guessOffchain = _approx.guessOffchain;
|
|
354
322
|
res.maxIteration = _approx.maxIteration;
|
|
355
323
|
res.eps = _approx.eps;
|
|
356
|
-
|
|
357
|
-
require(res.guessMin <= res.guessMax && res.eps <= Math.ONE, "invalid approx params");
|
|
358
324
|
}
|
|
359
325
|
|
|
360
326
|
function calcMaxPtIn(int256 totalAsset) internal pure returns (uint256) {
|
|
@@ -377,6 +343,10 @@ library MarketApproxPtInLib {
|
|
|
377
343
|
return (true, guess);
|
|
378
344
|
}
|
|
379
345
|
|
|
346
|
+
/**
|
|
347
|
+
* @dev it is safe to assume that p.guessMin <= p.guessMax from the initialization of p
|
|
348
|
+
* So once guessMin becomes larger, it should always be the case of ApproxFail
|
|
349
|
+
*/
|
|
380
350
|
function _nextGuessPrivate(ApproxParamsPtIn memory p, uint256 iter)
|
|
381
351
|
private
|
|
382
352
|
pure
|
|
@@ -384,7 +354,7 @@ library MarketApproxPtInLib {
|
|
|
384
354
|
{
|
|
385
355
|
if (iter == 0 && p.guessOffchain != 0) return p.guessOffchain;
|
|
386
356
|
if (p.guessMin <= p.guessMax) return (p.guessMin + p.guessMax) / 2;
|
|
387
|
-
revert Errors.
|
|
357
|
+
revert Errors.ApproxFail();
|
|
388
358
|
}
|
|
389
359
|
|
|
390
360
|
function calcSlope(
|
|
@@ -426,14 +396,14 @@ library MarketApproxPtOutLib {
|
|
|
426
396
|
struct Args4 {
|
|
427
397
|
MarketState market;
|
|
428
398
|
PYIndex index;
|
|
429
|
-
uint256
|
|
399
|
+
uint256 exactScyIn;
|
|
430
400
|
uint256 blockTime;
|
|
431
401
|
}
|
|
432
402
|
|
|
433
403
|
function approxSwapExactScyForPt(
|
|
434
404
|
MarketState memory _market,
|
|
435
405
|
PYIndex _index,
|
|
436
|
-
uint256
|
|
406
|
+
uint256 _exactScyIn,
|
|
437
407
|
uint256 _blockTime,
|
|
438
408
|
ApproxParams memory _approx
|
|
439
409
|
)
|
|
@@ -441,36 +411,32 @@ library MarketApproxPtOutLib {
|
|
|
441
411
|
pure
|
|
442
412
|
returns (
|
|
443
413
|
uint256, /*netPtOut*/
|
|
444
|
-
uint256
|
|
445
|
-
uint256 /*netScyToReserve*/
|
|
414
|
+
uint256 /*netScyFee*/
|
|
446
415
|
)
|
|
447
416
|
{
|
|
448
417
|
/*
|
|
449
418
|
1. Binary search netPtOut
|
|
450
419
|
2. Calc netScyIn to swap to receive netPtOut
|
|
451
|
-
2. If netScyIn <
|
|
420
|
+
2. If netScyIn < exactScyIn && netScyIn ~ exactScyIn => answer found
|
|
452
421
|
*/
|
|
453
422
|
|
|
454
|
-
Args4 memory
|
|
455
|
-
MarketPreCompute memory comp =
|
|
456
|
-
ApproxParamsPtOut memory p = newApproxParamsPtOut(
|
|
457
|
-
|
|
458
|
-
|
|
423
|
+
Args4 memory a = Args4(_market, _index, _exactScyIn, _blockTime);
|
|
424
|
+
MarketPreCompute memory comp = a.market.getMarketPreCompute(a.index, a.blockTime);
|
|
425
|
+
ApproxParamsPtOut memory p = newApproxParamsPtOut(
|
|
426
|
+
_approx,
|
|
427
|
+
0,
|
|
428
|
+
calcMaxPtOut(comp, a.market.totalPt)
|
|
429
|
+
);
|
|
459
430
|
|
|
460
431
|
for (uint256 iter = 0; iter < p.maxIteration; ++iter) {
|
|
461
432
|
uint256 guess = nextGuess(p, iter);
|
|
462
433
|
|
|
463
|
-
(uint256
|
|
434
|
+
(uint256 netScyIn, uint256 netScyFee) = calcScyIn(a.market, comp, a.index, guess);
|
|
464
435
|
|
|
465
|
-
if (
|
|
436
|
+
if (netScyIn <= a.exactScyIn) {
|
|
466
437
|
p.guessMin = guess;
|
|
467
|
-
bool isAnswerAccepted = Math.isASmallerApproxB(
|
|
468
|
-
if (isAnswerAccepted)
|
|
469
|
-
return (
|
|
470
|
-
guess,
|
|
471
|
-
arg.index.assetToScy(netAssetIn),
|
|
472
|
-
arg.index.assetToScy(netAssetToReserve)
|
|
473
|
-
);
|
|
438
|
+
bool isAnswerAccepted = Math.isASmallerApproxB(netScyIn, a.exactScyIn, p.eps);
|
|
439
|
+
if (isAnswerAccepted) return (guess, netScyFee);
|
|
474
440
|
} else {
|
|
475
441
|
p.guessMax = guess - 1;
|
|
476
442
|
}
|
|
@@ -498,7 +464,7 @@ library MarketApproxPtOutLib {
|
|
|
498
464
|
returns (
|
|
499
465
|
uint256, /*netYtIn*/
|
|
500
466
|
uint256, /*netScyOut*/
|
|
501
|
-
uint256 /*
|
|
467
|
+
uint256 /*netScyFee*/
|
|
502
468
|
)
|
|
503
469
|
{
|
|
504
470
|
/*
|
|
@@ -509,31 +475,26 @@ library MarketApproxPtOutLib {
|
|
|
509
475
|
5. If netScyOut > minScyOut && netScyOut ~ minScyOut => answer found
|
|
510
476
|
*/
|
|
511
477
|
|
|
512
|
-
Args5 memory
|
|
513
|
-
MarketPreCompute memory comp =
|
|
514
|
-
ApproxParamsPtOut memory p = newApproxParamsPtOut(
|
|
515
|
-
|
|
516
|
-
|
|
478
|
+
Args5 memory a = Args5(_market, _index, _minScyOut, _blockTime);
|
|
479
|
+
MarketPreCompute memory comp = a.market.getMarketPreCompute(a.index, a.blockTime);
|
|
480
|
+
ApproxParamsPtOut memory p = newApproxParamsPtOut(
|
|
481
|
+
_approx,
|
|
482
|
+
0,
|
|
483
|
+
calcMaxPtOut(comp, a.market.totalPt)
|
|
484
|
+
);
|
|
517
485
|
|
|
518
486
|
for (uint256 iter = 0; iter < p.maxIteration; ++iter) {
|
|
519
487
|
uint256 guess = nextGuess(p, iter);
|
|
520
488
|
|
|
521
|
-
(uint256
|
|
522
|
-
arg.market,
|
|
523
|
-
comp,
|
|
524
|
-
guess
|
|
525
|
-
);
|
|
489
|
+
(uint256 netScyOwed, uint256 netScyFee) = calcScyIn(a.market, comp, a.index, guess);
|
|
526
490
|
|
|
527
|
-
uint256
|
|
491
|
+
uint256 netAssetToRepay = a.index.scyToAssetUp(netScyOwed);
|
|
492
|
+
uint256 netScyOut = a.index.assetToScy(guess - netAssetToRepay);
|
|
528
493
|
|
|
529
|
-
if (
|
|
494
|
+
if (netScyOut >= a.minScyOut) {
|
|
530
495
|
p.guessMax = guess;
|
|
531
|
-
if (Math.isAGreaterApproxB(
|
|
532
|
-
return (
|
|
533
|
-
guess,
|
|
534
|
-
arg.index.assetToScy(netAssetOut),
|
|
535
|
-
arg.index.assetToScy(netAssetToReserve)
|
|
536
|
-
);
|
|
496
|
+
if (Math.isAGreaterApproxB(netScyOut, a.minScyOut, p.eps)) {
|
|
497
|
+
return (guess, netScyOut, netScyFee);
|
|
537
498
|
}
|
|
538
499
|
} else {
|
|
539
500
|
p.guessMin = guess + 1;
|
|
@@ -561,7 +522,7 @@ library MarketApproxPtOutLib {
|
|
|
561
522
|
returns (
|
|
562
523
|
uint256, /*netPtFromSwap*/
|
|
563
524
|
uint256, /*netScySwap*/
|
|
564
|
-
uint256 /*
|
|
525
|
+
uint256 /*netScyFee*/
|
|
565
526
|
)
|
|
566
527
|
{
|
|
567
528
|
/*
|
|
@@ -574,50 +535,48 @@ library MarketApproxPtOutLib {
|
|
|
574
535
|
Note that market maintains PT/SCY ratio, but here PT/asset is used instead
|
|
575
536
|
*/
|
|
576
537
|
|
|
577
|
-
Args6 memory
|
|
578
|
-
require(
|
|
579
|
-
|
|
580
|
-
MarketPreCompute memory comp = arg.market.getMarketPreCompute(arg.index, arg.blockTime);
|
|
581
|
-
ApproxParamsPtOut memory p = newApproxParamsPtOut(_approx, comp, arg.market.totalPt);
|
|
538
|
+
Args6 memory a = Args6(_market, _index, _totalScyIn, _blockTime);
|
|
539
|
+
require(a.market.totalLp != 0, "no existing lp");
|
|
582
540
|
|
|
583
|
-
|
|
541
|
+
MarketPreCompute memory comp = a.market.getMarketPreCompute(a.index, a.blockTime);
|
|
542
|
+
ApproxParamsPtOut memory p = newApproxParamsPtOut(
|
|
543
|
+
_approx,
|
|
544
|
+
0,
|
|
545
|
+
calcMaxPtOut(comp, a.market.totalPt)
|
|
546
|
+
);
|
|
584
547
|
|
|
585
548
|
for (uint256 iter = 0; iter < p.maxIteration; ++iter) {
|
|
586
549
|
uint256 guess = nextGuess(p, iter);
|
|
587
550
|
|
|
588
|
-
(uint256
|
|
551
|
+
(uint256 netScyIn, uint256 netScyFee) = calcScyIn(a.market, comp, a.index, guess);
|
|
589
552
|
|
|
590
|
-
if (
|
|
553
|
+
if (netScyIn > a.totalScyIn) {
|
|
591
554
|
p.guessMax = guess - 1;
|
|
592
555
|
continue;
|
|
593
556
|
}
|
|
594
557
|
|
|
558
|
+
uint256 scyNumerator;
|
|
595
559
|
uint256 ptNumerator;
|
|
596
|
-
uint256 assetNumerator;
|
|
597
560
|
|
|
598
561
|
{
|
|
599
|
-
uint256
|
|
600
|
-
uint256 newTotalPt =
|
|
601
|
-
uint256
|
|
562
|
+
uint256 netScyRemaining = a.totalScyIn - netScyIn;
|
|
563
|
+
uint256 newTotalPt = a.market.totalPt.Uint() - guess;
|
|
564
|
+
uint256 netTotalScy = comp.totalAsset.Uint() + netScyIn - netScyFee;
|
|
602
565
|
|
|
603
566
|
// it is desired that
|
|
604
|
-
// guess / newTotalPt =
|
|
567
|
+
// guess / newTotalPt = netScyRemaining / netTotalScy
|
|
605
568
|
// which is equivalent to
|
|
606
|
-
// guess *
|
|
569
|
+
// guess * netTotalScy = netScyRemaining * newTotalPt
|
|
607
570
|
|
|
608
|
-
ptNumerator = guess *
|
|
609
|
-
|
|
571
|
+
ptNumerator = guess * netTotalScy;
|
|
572
|
+
scyNumerator = netScyRemaining * newTotalPt;
|
|
610
573
|
}
|
|
611
574
|
|
|
612
|
-
if (Math.isAApproxB(ptNumerator,
|
|
613
|
-
return (
|
|
614
|
-
guess,
|
|
615
|
-
arg.index.assetToScy(netAssetIn),
|
|
616
|
-
arg.index.assetToScy(netAssetToReserve)
|
|
617
|
-
);
|
|
575
|
+
if (Math.isAApproxB(ptNumerator, scyNumerator, p.eps)) {
|
|
576
|
+
return (guess, netScyIn, netScyFee);
|
|
618
577
|
}
|
|
619
578
|
|
|
620
|
-
if (ptNumerator <=
|
|
579
|
+
if (ptNumerator <= scyNumerator) {
|
|
621
580
|
// needs more PT
|
|
622
581
|
p.guessMin = guess + 1;
|
|
623
582
|
} else {
|
|
@@ -631,15 +590,15 @@ library MarketApproxPtOutLib {
|
|
|
631
590
|
struct Args8 {
|
|
632
591
|
MarketState market;
|
|
633
592
|
PYIndex index;
|
|
634
|
-
uint256
|
|
593
|
+
uint256 exactYtIn;
|
|
635
594
|
uint256 blockTime;
|
|
636
|
-
uint256
|
|
595
|
+
uint256 maxScyPayable;
|
|
637
596
|
}
|
|
638
597
|
|
|
639
598
|
function approxSwapExactYtForPt(
|
|
640
599
|
MarketState memory _market,
|
|
641
600
|
PYIndex _index,
|
|
642
|
-
uint256
|
|
601
|
+
uint256 _exactYtIn,
|
|
643
602
|
uint256 _blockTime,
|
|
644
603
|
ApproxParams memory _approx
|
|
645
604
|
)
|
|
@@ -647,38 +606,33 @@ library MarketApproxPtOutLib {
|
|
|
647
606
|
pure
|
|
648
607
|
returns (
|
|
649
608
|
uint256, /*netPtOut*/
|
|
650
|
-
uint256, /*netYtIn*/
|
|
651
609
|
uint256, /*totalPtSwapped*/
|
|
652
|
-
uint256 /*
|
|
610
|
+
uint256 /*netScyFee*/
|
|
653
611
|
)
|
|
654
612
|
{
|
|
655
|
-
Args8 memory
|
|
613
|
+
Args8 memory a = Args8(
|
|
656
614
|
_market,
|
|
657
615
|
_index,
|
|
658
|
-
|
|
616
|
+
_exactYtIn,
|
|
659
617
|
_blockTime,
|
|
660
|
-
_index.assetToScy(
|
|
618
|
+
_index.assetToScy(_exactYtIn)
|
|
619
|
+
);
|
|
620
|
+
MarketPreCompute memory comp = a.market.getMarketPreCompute(a.index, a.blockTime);
|
|
621
|
+
ApproxParamsPtOut memory p = newApproxParamsPtOut(
|
|
622
|
+
_approx,
|
|
623
|
+
a.exactYtIn,
|
|
624
|
+
calcMaxPtOut(comp, a.market.totalPt)
|
|
661
625
|
);
|
|
662
|
-
MarketPreCompute memory comp = arg.market.getMarketPreCompute(arg.index, arg.blockTime);
|
|
663
|
-
ApproxParamsPtOut memory p = newApproxParamsPtOut(_approx, comp, arg.market.totalPt);
|
|
664
|
-
|
|
665
|
-
p.guessMin = Math.max(p.guessMin, arg.maxYtIn);
|
|
666
626
|
|
|
667
627
|
for (uint256 iter = 0; iter < p.maxIteration; ++iter) {
|
|
668
628
|
uint256 guess = nextGuess(p, iter);
|
|
669
629
|
|
|
670
|
-
(uint256
|
|
671
|
-
uint256 netScyIn = arg.index.assetToScyUp(netAssetIn);
|
|
630
|
+
(uint256 netScyOwed, uint256 netScyFee) = calcScyIn(a.market, comp, a.index, guess);
|
|
672
631
|
|
|
673
|
-
if (
|
|
632
|
+
if (netScyOwed <= a.maxScyPayable) {
|
|
674
633
|
p.guessMin = guess;
|
|
675
|
-
if (Math.isASmallerApproxB(
|
|
676
|
-
return (
|
|
677
|
-
guess - arg.maxYtIn,
|
|
678
|
-
arg.maxYtIn,
|
|
679
|
-
guess,
|
|
680
|
-
arg.index.assetToScy(netAssetToReserve)
|
|
681
|
-
);
|
|
634
|
+
if (Math.isASmallerApproxB(netScyOwed, a.maxScyPayable, p.eps)) {
|
|
635
|
+
return (guess - a.exactYtIn, guess, netScyFee);
|
|
682
636
|
}
|
|
683
637
|
} else {
|
|
684
638
|
p.guessMax = guess - 1;
|
|
@@ -689,29 +643,32 @@ library MarketApproxPtOutLib {
|
|
|
689
643
|
|
|
690
644
|
////////////////////////////////////////////////////////////////////////////////
|
|
691
645
|
|
|
692
|
-
function
|
|
646
|
+
function calcScyIn(
|
|
693
647
|
MarketState memory market,
|
|
694
648
|
MarketPreCompute memory comp,
|
|
649
|
+
PYIndex index,
|
|
695
650
|
uint256 netPtOut
|
|
696
|
-
) internal pure returns (uint256
|
|
697
|
-
(int256
|
|
651
|
+
) internal pure returns (uint256 netScyIn, uint256 netScyFee) {
|
|
652
|
+
(int256 _netScyIn, int256 _netScyFee) = market.calcTrade(comp, index, netPtOut.Int());
|
|
698
653
|
|
|
699
|
-
|
|
700
|
-
|
|
654
|
+
netScyIn = _netScyIn.abs();
|
|
655
|
+
netScyFee = _netScyFee.Uint();
|
|
701
656
|
}
|
|
702
657
|
|
|
703
658
|
function newApproxParamsPtOut(
|
|
704
659
|
ApproxParams memory _approx,
|
|
705
|
-
|
|
706
|
-
|
|
660
|
+
uint256 minGuessMin,
|
|
661
|
+
uint256 maxGuessMax
|
|
707
662
|
) internal pure returns (ApproxParamsPtOut memory res) {
|
|
708
|
-
res.guessMin = _approx.guessMin;
|
|
709
|
-
res.guessMax = Math.min(_approx.guessMax,
|
|
663
|
+
res.guessMin = Math.max(_approx.guessMin, minGuessMin);
|
|
664
|
+
res.guessMax = Math.min(_approx.guessMax, maxGuessMax);
|
|
665
|
+
|
|
666
|
+
if (res.guessMin > res.guessMax || _approx.eps > Math.ONE)
|
|
667
|
+
revert Errors.ApproxParamsInvalid(_approx.guessMin, _approx.guessMax, _approx.eps);
|
|
668
|
+
|
|
710
669
|
res.guessOffchain = _approx.guessOffchain;
|
|
711
670
|
res.maxIteration = _approx.maxIteration;
|
|
712
671
|
res.eps = _approx.eps;
|
|
713
|
-
|
|
714
|
-
require(res.guessMin <= res.guessMax && res.eps <= Math.ONE, "invalid approx params");
|
|
715
672
|
}
|
|
716
673
|
|
|
717
674
|
function calcMaxPtOut(MarketPreCompute memory comp, int256 totalPt)
|
|
@@ -727,9 +684,13 @@ library MarketApproxPtOutLib {
|
|
|
727
684
|
return (maxPtOut.Uint() * 999) / 1000;
|
|
728
685
|
}
|
|
729
686
|
|
|
687
|
+
/**
|
|
688
|
+
* @dev it is safe to assume that p.guessMin <= p.guessMax from the initialization of p
|
|
689
|
+
* So once guessMin becomes larger, it should always be the case of ApproxFail
|
|
690
|
+
*/
|
|
730
691
|
function nextGuess(ApproxParamsPtOut memory p, uint256 iter) private pure returns (uint256) {
|
|
731
692
|
if (iter == 0 && p.guessOffchain != 0) return p.guessOffchain;
|
|
732
693
|
if (p.guessMin <= p.guessMax) return (p.guessMin + p.guessMax) / 2;
|
|
733
|
-
revert Errors.
|
|
694
|
+
revert Errors.ApproxFail();
|
|
734
695
|
}
|
|
735
696
|
}
|