@pendle/core-v2 0.20.1-testnet → 0.20.2-testnet
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/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/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +34 -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/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.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 +2 -2
- 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/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.json +141 -0
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.json +141 -0
- package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.json +50 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAura3EthSY.sol/PendleAura3EthSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAura3EthSY.sol/PendleAura3EthSY.json +1296 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraCbethWstethSY.sol/PendleAuraCbethWstethSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraCbethWstethSY.sol/PendleAuraCbethWstethSY.json +1283 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol/PendleAuraWethRethSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol/PendleAuraWethRethSY.json +1218 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol/PendleAuraWethWstethSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol/PendleAuraWethWstethSY.json +1231 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.json +133 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.json +40 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.json +322 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol/PendleAuraBalancerStableLPSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol/PendleAuraBalancerStableLPSY.json +1171 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.json +133 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.json +141 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +143 -2
- 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/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.json +2 -2
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +76 -2
- package/build/artifacts/contracts/interfaces/Balancer/IAsset.sol/IAsset.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IAsset.sol/IAsset.json +10 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.json +24 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.json +133 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.json +328 -0
- package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.json +467 -0
- package/build/artifacts/contracts/interfaces/Balancer/IGauge.sol/IGauge.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IGauge.sol/IGauge.json +61 -0
- package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.json +30 -0
- package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.json +398 -0
- package/build/artifacts/contracts/interfaces/Balancer/IRateProvider.sol/IRateProvider.dbg.json +4 -0
- package/build/artifacts/contracts/{router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.json → interfaces/Balancer/IRateProvider.sol/IRateProvider.json} +5 -5
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.json +278 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.json +18 -0
- package/build/artifacts/contracts/interfaces/IApeStaking.sol/IApeStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +80 -32
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +100 -40
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +40 -16
- 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/IPActionSwapYT.sol/IPActionSwapYT.json +40 -16
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +260 -104
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.json +19 -0
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.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/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.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 +2 -2
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.json +322 -0
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +2 -2
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +96 -53
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +116 -61
- 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 +44 -25
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +44 -25
- 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/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.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/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.json +160 -0
- package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.json +10 -0
- package/build/artifacts/contracts/router/swap-aggregator/ISwapAggregator.sol/ISwapAggregator.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/ISwapAggregator.sol/ISwapAggregator.json +51 -0
- package/build/artifacts/contracts/router/swap-aggregator/SwapAggregator.sol/SwapAggregator.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/SwapAggregator.sol/SwapAggregator.json +256 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol/KyberAggregationRouterHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol/KyberAggregationRouterHelper.json +10 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol/ScaleDataHelperEthereum1.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol/ScaleDataHelperEthereum1.json +10 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol/IAggregationExecutor.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol/IAggregationExecutor.json +65 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol/IExecutorHelperEthereum1.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol/IExecutorHelperEthereum1.json +359 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol/IHashflow.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol/IHashflow.json +101 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouter.sol/IMetaAggregationRouter.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouter.sol/IMetaAggregationRouter.json +183 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.json +215 -0
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +7 -9
- package/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol +10 -0
- package/contracts/core/StandardizedYield/SYBase.sol +23 -5
- package/contracts/core/StandardizedYield/StEthHelper.sol +71 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAura3EthSY.sol +170 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraCbethWstethSY.sol +162 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol +134 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol +154 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol +289 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol +618 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol +68 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol +322 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol +390 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol +329 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol +30 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol +189 -0
- package/contracts/core/libraries/ArrayLib.sol +6 -3
- package/contracts/core/libraries/Errors.sol +8 -0
- package/contracts/interfaces/Balancer/IAsset.sol +4 -0
- package/contracts/interfaces/Balancer/IBalancerFees.sol +6 -0
- package/contracts/interfaces/Balancer/IBalancerStablePreview.sol +22 -0
- package/contracts/interfaces/Balancer/IBasePool.sol +30 -0
- package/contracts/interfaces/Balancer/IComposableStable.sol +39 -0
- package/contracts/interfaces/Balancer/IGauge.sol +10 -0
- package/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol +6 -0
- package/contracts/interfaces/Balancer/IMetaStablePool.sol +31 -0
- package/contracts/interfaces/Balancer/IRateProvider.sol +6 -0
- package/contracts/interfaces/Balancer/IVault.sol +78 -0
- package/contracts/interfaces/ConvexCurve/IRewards.sol +5 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +1 -1
- package/contracts/interfaces/IPActionMintRedeem.sol +2 -3
- package/contracts/interfaces/IPActionSwapPT.sol +1 -1
- package/contracts/interfaces/IPActionSwapPTYT.sol +1 -1
- package/contracts/interfaces/IPActionSwapYT.sol +1 -1
- package/contracts/interfaces/IPFeeDistributor.sol +2 -0
- package/contracts/offchain-helpers/Multicall2.sol +103 -0
- package/contracts/router/ActionAddRemoveLiq.sol +2 -2
- package/contracts/router/ActionMintRedeem.sol +7 -9
- package/contracts/router/ActionSwapPT.sol +2 -2
- package/contracts/router/ActionSwapYT.sol +2 -2
- package/contracts/router/base/ActionBaseMintRedeem.sol +51 -14
- package/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol +45 -0
- package/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol +71 -0
- package/contracts/router/swap-aggregator/ISwapAggregator.sol +21 -0
- package/contracts/router/swap-aggregator/SwapAggregator.sol +62 -0
- package/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol +302 -0
- package/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol +134 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol +17 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol +185 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol +30 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouter.sol +33 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol +42 -0
- package/deployments/43113-core.json +1 -1
- package/deployments/80001-core.json +1 -1
- package/package.json +6 -6
- package/typechain-types/ActionAddRemoveLiq.ts +41 -35
- package/typechain-types/ActionBaseMintRedeem.ts +8 -8
- package/typechain-types/ActionMintRedeem.ts +45 -42
- package/typechain-types/ActionSwapPT.ts +28 -22
- package/typechain-types/ActionSwapYT.ts +28 -22
- package/typechain-types/I1inchAggregationRouterV5.ts +257 -0
- package/typechain-types/IAggregationExecutor.ts +182 -0
- package/typechain-types/IExecutorHelperEthereum1.ts +599 -0
- package/typechain-types/IHashflow.ts +159 -0
- package/typechain-types/IKyberSwapAggregationRouterHelper.ts +109 -0
- package/typechain-types/IMetaAggregationRouter.ts +213 -0
- package/typechain-types/IMetaAggregationRouterV2.ts +221 -0
- package/typechain-types/IPActionAddRemoveLiq.ts +22 -16
- package/typechain-types/IPActionMintRedeem.ts +26 -23
- package/typechain-types/IPActionSwapPT.ts +20 -14
- package/typechain-types/IPActionSwapYT.ts +20 -14
- package/typechain-types/IPAllAction.ts +34 -31
- package/typechain-types/IPFeeDistributor.ts +18 -0
- package/typechain-types/IRewards.ts +35 -5
- package/typechain-types/ISwapAggregator.ts +124 -0
- package/typechain-types/PendleConvexLPSY.ts +204 -0
- package/typechain-types/PendleCurveFraxUsdcSY.ts +204 -0
- package/typechain-types/PendleCurveUsdd3CrvSY.ts +204 -0
- package/typechain-types/PendleFeeDistributor.ts +37 -0
- package/typechain-types/PendleLooksStakingSY.ts +204 -0
- package/typechain-types/PendleQiTokenSY.ts +204 -0
- package/typechain-types/PendleWstEthSY.ts +204 -0
- package/typechain-types/SAPE.ts +204 -0
- package/typechain-types/SYBase.ts +204 -0
- package/typechain-types/SYBaseWithRewards.ts +204 -0
- package/typechain-types/SwapAggregator.ts +406 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +99 -56
- package/typechain-types/factories/ActionBaseMintRedeem__factory.ts +1 -1
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +119 -64
- package/typechain-types/factories/ActionMisc__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +47 -28
- package/typechain-types/factories/ActionSwapYT__factory.ts +47 -28
- package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
- package/typechain-types/factories/BulkSeller__factory.ts +1 -1
- package/typechain-types/factories/Errors__factory.ts +75 -1
- package/typechain-types/factories/I1inchAggregationRouterV5__factory.ts +179 -0
- package/typechain-types/factories/IAggregationExecutor__factory.ts +84 -0
- package/typechain-types/factories/IExecutorHelperEthereum1__factory.ts +378 -0
- package/typechain-types/factories/IHashflow__factory.ts +113 -0
- package/typechain-types/factories/IKyberSwapAggregationRouterHelper__factory.ts +56 -0
- package/typechain-types/factories/IMetaAggregationRouterV2__factory.ts +234 -0
- package/typechain-types/factories/IMetaAggregationRouter__factory.ts +202 -0
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +80 -32
- package/typechain-types/factories/IPActionMintRedeem__factory.ts +100 -40
- package/typechain-types/factories/IPActionSwapPT__factory.ts +40 -16
- package/typechain-types/factories/IPActionSwapYT__factory.ts +40 -16
- package/typechain-types/factories/IPAllAction__factory.ts +260 -104
- package/typechain-types/factories/IPFeeDistributor__factory.ts +19 -0
- package/typechain-types/factories/IRewards__factory.ts +18 -0
- package/typechain-types/factories/ISwapAggregator__factory.ts +66 -0
- package/typechain-types/factories/MarketMathStatic__factory.ts +1 -1
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleAura3EthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraCbethWstethSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethRethSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethWstethSY__factory.ts +1 -1
- package/typechain-types/factories/PendleConvexLPSY__factory.ts +141 -0
- package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +142 -1
- package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +142 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +33 -1
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleLooksStakingSY__factory.ts +142 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- 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 +1 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +142 -1
- 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 +142 -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 -1
- package/typechain-types/factories/SAPE__factory.ts +142 -1
- package/typechain-types/factories/SYBaseWithRewards__factory.ts +141 -0
- package/typechain-types/factories/SYBase__factory.ts +141 -0
- package/typechain-types/factories/SwapAggregator__factory.ts +309 -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 +56 -20
- package/typechain-types/index.ts +16 -8
- package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +0 -4
- package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +0 -224
- package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +0 -4
- package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.json +0 -35
- package/build/artifacts/contracts/router/kyberswap/IMultihopRouterEthereum.sol/IMultihopRouterEthereum.dbg.json +0 -4
- package/build/artifacts/contracts/router/kyberswap/IMultihopRouterEthereum.sol/IMultihopRouterEthereum.json +0 -136
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +0 -4
- package/contracts/router/kyberswap/AggregationRouterHelper.sol +0 -331
- package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +0 -10
- package/contracts/router/kyberswap/IMultihopRouterEthereum.sol +0 -141
- package/contracts/router/kyberswap/KyberSwapHelper.sol +0 -79
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
|
|
3
|
-
pragma solidity 0.8.17;
|
|
4
|
-
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
|
-
import "./IMultihopRouterEthereum.sol";
|
|
6
|
-
import "./IAggregatorRouterHelper.sol";
|
|
7
|
-
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
8
|
-
import "../../core/libraries/BoringOwnableUpgradeable.sol";
|
|
9
|
-
|
|
10
|
-
contract AggregationRouterHelper is
|
|
11
|
-
IAggregationRouterHelper,
|
|
12
|
-
Initializable,
|
|
13
|
-
UUPSUpgradeable,
|
|
14
|
-
BoringOwnableUpgradeable
|
|
15
|
-
{
|
|
16
|
-
uint256 private constant _PARTIAL_FILL = 0x01;
|
|
17
|
-
uint256 private constant _REQUIRES_EXTRA_ETH = 0x02;
|
|
18
|
-
uint256 private constant _SHOULD_CLAIM = 0x04;
|
|
19
|
-
uint256 private constant _BURN_FROM_MSG_SENDER = 0x08;
|
|
20
|
-
uint256 private constant _BURN_FROM_TX_ORIGIN = 0x10;
|
|
21
|
-
uint256 private constant _SIMPLE_SWAP = 0x20;
|
|
22
|
-
|
|
23
|
-
uint256 private constant SLIPPAGE_RANGE = 10; // over 100
|
|
24
|
-
|
|
25
|
-
constructor() initializer {}
|
|
26
|
-
|
|
27
|
-
function initialize() external initializer {
|
|
28
|
-
__BoringOwnable_init();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
|
32
|
-
|
|
33
|
-
enum DexType {
|
|
34
|
-
UNI,
|
|
35
|
-
STABLESWAP,
|
|
36
|
-
CURVE,
|
|
37
|
-
KYBERDMM,
|
|
38
|
-
SADDLE,
|
|
39
|
-
UNIV3PROMM,
|
|
40
|
-
BALANCERV2,
|
|
41
|
-
KYBERRFQ,
|
|
42
|
-
DODO,
|
|
43
|
-
WSTETH
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
struct SwapDescription {
|
|
47
|
-
IERC20 srcToken;
|
|
48
|
-
IERC20 dstToken;
|
|
49
|
-
address[] srcReceivers;
|
|
50
|
-
uint256[] srcAmounts;
|
|
51
|
-
address dstReceiver;
|
|
52
|
-
uint256 amount;
|
|
53
|
-
uint256 minReturnAmount;
|
|
54
|
-
uint256 flags;
|
|
55
|
-
bytes permit;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
struct SimpleSwapData {
|
|
59
|
-
address[] firstPools;
|
|
60
|
-
uint256[] firstSwapAmounts;
|
|
61
|
-
bytes[] swapDatas;
|
|
62
|
-
uint256 deadline;
|
|
63
|
-
bytes destTokenFeeData;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
struct SwapExecutorDescription {
|
|
67
|
-
IMultihopRouterEthereum.Swap[][] swapSequences;
|
|
68
|
-
address tokenIn;
|
|
69
|
-
address tokenOut;
|
|
70
|
-
uint256 minTotalAmountOut;
|
|
71
|
-
address to;
|
|
72
|
-
uint256 deadline;
|
|
73
|
-
bytes destTokenFeeData;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function getScaledInputData(bytes calldata kybercall, uint256 newAmount)
|
|
77
|
-
external
|
|
78
|
-
pure
|
|
79
|
-
returns (bytes memory)
|
|
80
|
-
{
|
|
81
|
-
bytes4 selector = bytes4(kybercall[:4]);
|
|
82
|
-
(
|
|
83
|
-
address caller,
|
|
84
|
-
SwapDescription memory desc,
|
|
85
|
-
bytes memory executorData,
|
|
86
|
-
bytes memory clientData
|
|
87
|
-
) = abi.decode(kybercall[4:], (address, SwapDescription, bytes, bytes));
|
|
88
|
-
|
|
89
|
-
(desc, executorData) = _getScaledInputData(desc, executorData, newAmount);
|
|
90
|
-
return abi.encodeWithSelector(selector, caller, desc, executorData, clientData);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function _getScaledInputData(
|
|
94
|
-
SwapDescription memory desc,
|
|
95
|
-
bytes memory executorData,
|
|
96
|
-
uint256 newAmount
|
|
97
|
-
) internal pure returns (SwapDescription memory, bytes memory) {
|
|
98
|
-
uint256 flags = desc.flags;
|
|
99
|
-
uint256 oldAmount = desc.amount;
|
|
100
|
-
if (oldAmount == newAmount) {
|
|
101
|
-
return (desc, executorData);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// simple mode swap
|
|
105
|
-
if (flags & _SIMPLE_SWAP != 0) {
|
|
106
|
-
require(desc.srcReceivers.length == 0, "kyber: can't scale if take fee");
|
|
107
|
-
return (
|
|
108
|
-
_getNewDescription(desc, oldAmount, newAmount),
|
|
109
|
-
_getNewSimpleSwapData(executorData, oldAmount, newAmount)
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
//normal mode swap
|
|
114
|
-
bytes memory newExecutorData = _getNewExecutorData(executorData, oldAmount, newAmount);
|
|
115
|
-
return (_getNewDescription(desc, oldAmount, newAmount), newExecutorData);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function _getNewDescription(
|
|
119
|
-
SwapDescription memory desc,
|
|
120
|
-
uint256 oldAmount,
|
|
121
|
-
uint256 newAmount
|
|
122
|
-
) internal pure returns (SwapDescription memory) {
|
|
123
|
-
uint256 oldMinReturnAmount = desc.minReturnAmount;
|
|
124
|
-
desc.minReturnAmount = (desc.minReturnAmount * newAmount) / oldAmount;
|
|
125
|
-
//newMinReturnAmount should no be 0 if oldMinReturnAmount > 0
|
|
126
|
-
if (oldMinReturnAmount > 0 && desc.minReturnAmount == 0) desc.minReturnAmount = 1;
|
|
127
|
-
desc.amount = newAmount;
|
|
128
|
-
if (desc.srcReceivers.length == 0) {
|
|
129
|
-
return desc;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
uint256 newTotal;
|
|
133
|
-
for (uint256 i = 0; i < desc.srcReceivers.length; i++) {
|
|
134
|
-
if (i == desc.srcReceivers.length - 1) {
|
|
135
|
-
desc.srcAmounts[i] = newAmount - newTotal;
|
|
136
|
-
} else {
|
|
137
|
-
desc.srcAmounts[i] = (desc.srcAmounts[i] * newAmount) / oldAmount;
|
|
138
|
-
}
|
|
139
|
-
newTotal += desc.srcAmounts[i];
|
|
140
|
-
}
|
|
141
|
-
return desc;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function _getNewSimpleSwapData(
|
|
145
|
-
bytes memory data,
|
|
146
|
-
uint256 oldAmount,
|
|
147
|
-
uint256 newAmount
|
|
148
|
-
) internal pure returns (bytes memory) {
|
|
149
|
-
SimpleSwapData memory swapData = abi.decode(data, (SimpleSwapData));
|
|
150
|
-
uint256 numberSeq = swapData.firstPools.length;
|
|
151
|
-
uint256 newTotalSwapAmount;
|
|
152
|
-
for (uint256 i = 0; i < numberSeq; i++) {
|
|
153
|
-
if (i == numberSeq - 1) {
|
|
154
|
-
swapData.firstSwapAmounts[i] = newAmount - newTotalSwapAmount;
|
|
155
|
-
} else {
|
|
156
|
-
swapData.firstSwapAmounts[i] =
|
|
157
|
-
(swapData.firstSwapAmounts[i] * newAmount) /
|
|
158
|
-
oldAmount;
|
|
159
|
-
}
|
|
160
|
-
newTotalSwapAmount += swapData.firstSwapAmounts[i];
|
|
161
|
-
}
|
|
162
|
-
return abi.encode(swapData);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function _getNewExecutorData(
|
|
166
|
-
bytes memory data,
|
|
167
|
-
uint256 oldAmount,
|
|
168
|
-
uint256 newAmount
|
|
169
|
-
) internal pure returns (bytes memory) {
|
|
170
|
-
SwapExecutorDescription memory swapExecutorDescription = abi.decode(
|
|
171
|
-
data,
|
|
172
|
-
(SwapExecutorDescription)
|
|
173
|
-
);
|
|
174
|
-
swapExecutorDescription.minTotalAmountOut =
|
|
175
|
-
(swapExecutorDescription.minTotalAmountOut * newAmount) /
|
|
176
|
-
oldAmount;
|
|
177
|
-
|
|
178
|
-
uint256 newTotalSwapAmount;
|
|
179
|
-
for (uint256 i = 0; i < swapExecutorDescription.swapSequences.length; i++) {
|
|
180
|
-
IMultihopRouterEthereum.Swap memory swap = swapExecutorDescription.swapSequences[i][0];
|
|
181
|
-
uint8 dexType = uint8(swap.dexOption >> 8);
|
|
182
|
-
uint256 value;
|
|
183
|
-
if (i == swapExecutorDescription.swapSequences.length - 1)
|
|
184
|
-
value = newAmount - newTotalSwapAmount;
|
|
185
|
-
|
|
186
|
-
if (dexType == uint8(DexType.UNI)) {
|
|
187
|
-
(swap.data, value) = _newUniSwap(swap.data, value, oldAmount, newAmount);
|
|
188
|
-
} else if (dexType == uint8(DexType.STABLESWAP) || dexType == uint8(DexType.SADDLE)) {
|
|
189
|
-
(swap.data, value) = _newStableSwap(swap.data, value, oldAmount, newAmount);
|
|
190
|
-
} else if (dexType == uint8(DexType.CURVE)) {
|
|
191
|
-
(swap.data, value) = _newCurveSwap(swap.data, value, oldAmount, newAmount);
|
|
192
|
-
} else if (dexType == uint8(DexType.KYBERDMM)) {
|
|
193
|
-
(swap.data, value) = _newKyberDMMSwap(swap.data, value, oldAmount, newAmount);
|
|
194
|
-
} else if (dexType == uint8(DexType.UNIV3PROMM)) {
|
|
195
|
-
(swap.data, value) = _newUniV3ProMMSwap(swap.data, value, oldAmount, newAmount);
|
|
196
|
-
} else if (dexType == uint8(DexType.BALANCERV2)) {
|
|
197
|
-
(swap.data, value) = _newBalancerV2Swap(swap.data, value, oldAmount, newAmount);
|
|
198
|
-
} else if (dexType == uint8(DexType.KYBERRFQ)) {
|
|
199
|
-
revert("kyber: can't scale kyberrfq");
|
|
200
|
-
} else if (dexType == uint8(DexType.DODO)) {
|
|
201
|
-
(swap.data, value) = _newDODOSwap(swap.data, value, oldAmount, newAmount);
|
|
202
|
-
} else if (dexType == uint8(DexType.WSTETH)) {
|
|
203
|
-
(swap.data, value) = _newWrappedstETHSwap(swap.data, value, oldAmount, newAmount);
|
|
204
|
-
} else {
|
|
205
|
-
revert("AggregationExecutor: Dex type not supported");
|
|
206
|
-
}
|
|
207
|
-
newTotalSwapAmount += value;
|
|
208
|
-
}
|
|
209
|
-
return abi.encode(swapExecutorDescription);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function _newUniSwap(
|
|
213
|
-
bytes memory data,
|
|
214
|
-
uint256 value,
|
|
215
|
-
uint256 oldAmount,
|
|
216
|
-
uint256 newAmount
|
|
217
|
-
) internal pure returns (bytes memory, uint256) {
|
|
218
|
-
IMultihopRouterEthereum.UniSwap memory uniSwap = abi.decode(
|
|
219
|
-
data,
|
|
220
|
-
(IMultihopRouterEthereum.UniSwap)
|
|
221
|
-
);
|
|
222
|
-
if (value > 0) uniSwap.collectAmount = value;
|
|
223
|
-
else uniSwap.collectAmount = (uniSwap.collectAmount * newAmount) / oldAmount;
|
|
224
|
-
return (abi.encode(uniSwap), uniSwap.collectAmount);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function _newStableSwap(
|
|
228
|
-
bytes memory data,
|
|
229
|
-
uint256 value,
|
|
230
|
-
uint256 oldAmount,
|
|
231
|
-
uint256 newAmount
|
|
232
|
-
) internal pure returns (bytes memory, uint256) {
|
|
233
|
-
IMultihopRouterEthereum.StableSwap memory stableSwap = abi.decode(
|
|
234
|
-
data,
|
|
235
|
-
(IMultihopRouterEthereum.StableSwap)
|
|
236
|
-
);
|
|
237
|
-
if (value > 0) stableSwap.dx = value;
|
|
238
|
-
else stableSwap.dx = (stableSwap.dx * newAmount) / oldAmount;
|
|
239
|
-
return (abi.encode(stableSwap), stableSwap.dx);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function _newCurveSwap(
|
|
243
|
-
bytes memory data,
|
|
244
|
-
uint256 value,
|
|
245
|
-
uint256 oldAmount,
|
|
246
|
-
uint256 newAmount
|
|
247
|
-
) internal pure returns (bytes memory, uint256) {
|
|
248
|
-
IMultihopRouterEthereum.CurveSwap memory curveSwap = abi.decode(
|
|
249
|
-
data,
|
|
250
|
-
(IMultihopRouterEthereum.CurveSwap)
|
|
251
|
-
);
|
|
252
|
-
if (value > 0) curveSwap.dx = value;
|
|
253
|
-
else curveSwap.dx = (curveSwap.dx * newAmount) / oldAmount;
|
|
254
|
-
return (abi.encode(curveSwap), curveSwap.dx);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function _newKyberDMMSwap(
|
|
258
|
-
bytes memory data,
|
|
259
|
-
uint256 value,
|
|
260
|
-
uint256 oldAmount,
|
|
261
|
-
uint256 newAmount
|
|
262
|
-
) internal pure returns (bytes memory, uint256) {
|
|
263
|
-
IMultihopRouterEthereum.UniSwap memory kyberDMMSwap = abi.decode(
|
|
264
|
-
data,
|
|
265
|
-
(IMultihopRouterEthereum.UniSwap)
|
|
266
|
-
);
|
|
267
|
-
if (value > 0) kyberDMMSwap.collectAmount = value;
|
|
268
|
-
else kyberDMMSwap.collectAmount = (kyberDMMSwap.collectAmount * newAmount) / oldAmount;
|
|
269
|
-
return (abi.encode(kyberDMMSwap), kyberDMMSwap.collectAmount);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function _newUniV3ProMMSwap(
|
|
273
|
-
bytes memory data,
|
|
274
|
-
uint256 value,
|
|
275
|
-
uint256 oldAmount,
|
|
276
|
-
uint256 newAmount
|
|
277
|
-
) internal pure returns (bytes memory, uint256) {
|
|
278
|
-
IMultihopRouterEthereum.UniSwapV3ProMM memory uniSwapV3ProMM = abi.decode(
|
|
279
|
-
data,
|
|
280
|
-
(IMultihopRouterEthereum.UniSwapV3ProMM)
|
|
281
|
-
);
|
|
282
|
-
if (value > 0) uniSwapV3ProMM.swapAmount = value;
|
|
283
|
-
else uniSwapV3ProMM.swapAmount = (uniSwapV3ProMM.swapAmount * newAmount) / oldAmount;
|
|
284
|
-
return (abi.encode(uniSwapV3ProMM), uniSwapV3ProMM.swapAmount);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function _newBalancerV2Swap(
|
|
288
|
-
bytes memory data,
|
|
289
|
-
uint256 value,
|
|
290
|
-
uint256 oldAmount,
|
|
291
|
-
uint256 newAmount
|
|
292
|
-
) internal pure returns (bytes memory, uint256) {
|
|
293
|
-
IMultihopRouterEthereum.BalancerV2 memory balancerV2 = abi.decode(
|
|
294
|
-
data,
|
|
295
|
-
(IMultihopRouterEthereum.BalancerV2)
|
|
296
|
-
);
|
|
297
|
-
if (value > 0) balancerV2.amount = value;
|
|
298
|
-
else balancerV2.amount = (balancerV2.amount * newAmount) / oldAmount;
|
|
299
|
-
return (abi.encode(balancerV2, balancerV2.amount), balancerV2.amount);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function _newDODOSwap(
|
|
303
|
-
bytes memory data,
|
|
304
|
-
uint256 value,
|
|
305
|
-
uint256 oldAmount,
|
|
306
|
-
uint256 newAmount
|
|
307
|
-
) internal pure returns (bytes memory, uint256) {
|
|
308
|
-
IMultihopRouterEthereum.DODO memory dodo = abi.decode(
|
|
309
|
-
data,
|
|
310
|
-
(IMultihopRouterEthereum.DODO)
|
|
311
|
-
);
|
|
312
|
-
if (value > 0) dodo.amount = value;
|
|
313
|
-
else dodo.amount = (dodo.amount * newAmount) / oldAmount;
|
|
314
|
-
return (abi.encode(dodo), dodo.amount);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function _newWrappedstETHSwap(
|
|
318
|
-
bytes memory data,
|
|
319
|
-
uint256 value,
|
|
320
|
-
uint256 oldAmount,
|
|
321
|
-
uint256 newAmount
|
|
322
|
-
) internal pure returns (bytes memory, uint256) {
|
|
323
|
-
IMultihopRouterEthereum.WSTETH memory wstEthData = abi.decode(
|
|
324
|
-
data,
|
|
325
|
-
(IMultihopRouterEthereum.WSTETH)
|
|
326
|
-
);
|
|
327
|
-
if (value > 0) wstEthData.amount = value;
|
|
328
|
-
else wstEthData.amount = (wstEthData.amount * newAmount) / oldAmount;
|
|
329
|
-
return (abi.encode(wstEthData), wstEthData.amount);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
|
|
3
|
-
pragma solidity 0.8.17;
|
|
4
|
-
|
|
5
|
-
interface IMultihopRouterEthereum {
|
|
6
|
-
enum DexType {
|
|
7
|
-
UNI,
|
|
8
|
-
STABLESWAP,
|
|
9
|
-
CURVE,
|
|
10
|
-
KYBERDMM,
|
|
11
|
-
SADDLE,
|
|
12
|
-
UNIV3PROMM,
|
|
13
|
-
BALANCERV2,
|
|
14
|
-
KYBERRFQ,
|
|
15
|
-
DODO,
|
|
16
|
-
WSTETH
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
event Exchange(address pair, uint256 amountOut, address output);
|
|
20
|
-
struct Swap {
|
|
21
|
-
bytes data;
|
|
22
|
-
//dexType:
|
|
23
|
-
// 0: uni
|
|
24
|
-
// 1: stable swap
|
|
25
|
-
// 2: curve
|
|
26
|
-
// 3: kyber dmm
|
|
27
|
-
// 4: saddle
|
|
28
|
-
// 5: univ3 or kyber ProMM
|
|
29
|
-
// 6: balancerv2
|
|
30
|
-
// 7: kyber RFQ
|
|
31
|
-
// 8: dodo
|
|
32
|
-
// 9: wstETH: Lido wrapped stETH
|
|
33
|
-
//dexId:
|
|
34
|
-
// 0: firebird
|
|
35
|
-
uint16 dexOption; //dexType(8bit) + dexId(8bit)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
struct WSTETH {
|
|
39
|
-
address pool;
|
|
40
|
-
uint256 amount;
|
|
41
|
-
bool isWrapping;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
struct UniSwap {
|
|
45
|
-
address pool;
|
|
46
|
-
address tokenIn;
|
|
47
|
-
address tokenOut;
|
|
48
|
-
address recipient;
|
|
49
|
-
uint256 collectAmount; // amount that should be transferred to the pool
|
|
50
|
-
uint256 limitReturnAmount;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
struct StableSwap {
|
|
54
|
-
address pool;
|
|
55
|
-
address tokenFrom;
|
|
56
|
-
address tokenTo;
|
|
57
|
-
uint8 tokenIndexFrom;
|
|
58
|
-
uint8 tokenIndexTo;
|
|
59
|
-
uint256 dx;
|
|
60
|
-
uint256 minDy;
|
|
61
|
-
uint256 poolLength;
|
|
62
|
-
address poolLp;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
struct CurveSwap {
|
|
66
|
-
address pool;
|
|
67
|
-
address tokenFrom;
|
|
68
|
-
address tokenTo;
|
|
69
|
-
int128 tokenIndexFrom;
|
|
70
|
-
int128 tokenIndexTo;
|
|
71
|
-
uint256 dx;
|
|
72
|
-
uint256 minDy;
|
|
73
|
-
bool usePoolUnderlying;
|
|
74
|
-
bool useTriCrypto;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
struct UniSwapV3ProMM {
|
|
78
|
-
address recipient;
|
|
79
|
-
address pool;
|
|
80
|
-
address tokenIn;
|
|
81
|
-
address tokenOut;
|
|
82
|
-
uint256 swapAmount;
|
|
83
|
-
uint256 limitReturnAmount;
|
|
84
|
-
uint160 sqrtPriceLimitX96;
|
|
85
|
-
bool isUniV3; // true = UniV3, false = ProMM
|
|
86
|
-
}
|
|
87
|
-
struct SwapCallbackData {
|
|
88
|
-
bytes path;
|
|
89
|
-
address payer;
|
|
90
|
-
}
|
|
91
|
-
struct SwapCallbackDataPath {
|
|
92
|
-
address pool;
|
|
93
|
-
address tokenIn;
|
|
94
|
-
address tokenOut;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
struct BalancerV2 {
|
|
98
|
-
address vault;
|
|
99
|
-
bytes32 poolId;
|
|
100
|
-
address assetIn;
|
|
101
|
-
address assetOut;
|
|
102
|
-
uint256 amount;
|
|
103
|
-
uint256 limit;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
struct KyberRFQ {
|
|
107
|
-
address rfq;
|
|
108
|
-
bytes order;
|
|
109
|
-
bytes signature;
|
|
110
|
-
uint256 amount;
|
|
111
|
-
address payable target;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
struct DODO {
|
|
115
|
-
address recipient;
|
|
116
|
-
address pool;
|
|
117
|
-
address tokenFrom;
|
|
118
|
-
address tokenTo;
|
|
119
|
-
uint256 amount;
|
|
120
|
-
uint256 minReceiveQuote;
|
|
121
|
-
address sellHelper;
|
|
122
|
-
bool isSellBase;
|
|
123
|
-
bool isVersion2;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function factory() external view returns (address);
|
|
127
|
-
|
|
128
|
-
function formula() external view returns (address);
|
|
129
|
-
|
|
130
|
-
function WETH() external view returns (address);
|
|
131
|
-
|
|
132
|
-
function multihopBatchSwapExactIn(
|
|
133
|
-
Swap[][] memory swapSequences,
|
|
134
|
-
address tokenIn,
|
|
135
|
-
address tokenOut,
|
|
136
|
-
uint256 minTotalAmountOut,
|
|
137
|
-
address to,
|
|
138
|
-
uint256 deadline,
|
|
139
|
-
bytes memory destTokenFeeData
|
|
140
|
-
) external payable returns (uint256 totalAmountOut);
|
|
141
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
/*
|
|
3
|
-
* MIT License
|
|
4
|
-
* ===========
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
pragma solidity 0.8.17;
|
|
25
|
-
|
|
26
|
-
import "@openzeppelin/contracts/utils/Address.sol";
|
|
27
|
-
import "../../core/libraries/TokenHelper.sol";
|
|
28
|
-
import "./IAggregatorRouterHelper.sol";
|
|
29
|
-
import "../../core/libraries/Errors.sol";
|
|
30
|
-
|
|
31
|
-
struct TokenInput {
|
|
32
|
-
// Token/Sy data
|
|
33
|
-
address tokenIn;
|
|
34
|
-
uint256 netTokenIn;
|
|
35
|
-
address tokenMintSy;
|
|
36
|
-
address bulk;
|
|
37
|
-
// Kyber data
|
|
38
|
-
address kyberRouter;
|
|
39
|
-
bytes kybercall;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
struct TokenOutput {
|
|
43
|
-
// Token/Sy data
|
|
44
|
-
address tokenOut;
|
|
45
|
-
uint256 minTokenOut;
|
|
46
|
-
address tokenRedeemSy;
|
|
47
|
-
address bulk;
|
|
48
|
-
// Kyber data
|
|
49
|
-
address kyberRouter;
|
|
50
|
-
bytes kybercall;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
abstract contract KyberSwapHelper is TokenHelper {
|
|
54
|
-
using Address for address;
|
|
55
|
-
|
|
56
|
-
address public immutable kyberScalingLib;
|
|
57
|
-
|
|
58
|
-
constructor(address _kyberScalingLib) {
|
|
59
|
-
kyberScalingLib = _kyberScalingLib;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _kyberswap(
|
|
63
|
-
address tokenIn,
|
|
64
|
-
uint256 amountIn,
|
|
65
|
-
address kyberRouter,
|
|
66
|
-
bytes memory rawKybercall
|
|
67
|
-
) internal {
|
|
68
|
-
if (kyberRouter == address(0) || rawKybercall.length == 0)
|
|
69
|
-
revert Errors.RouterKyberSwapDataZero();
|
|
70
|
-
|
|
71
|
-
_safeApproveInf(tokenIn, kyberRouter);
|
|
72
|
-
|
|
73
|
-
bytes memory kybercall = IAggregationRouterHelper(kyberScalingLib).getScaledInputData(
|
|
74
|
-
rawKybercall,
|
|
75
|
-
amountIn
|
|
76
|
-
);
|
|
77
|
-
kyberRouter.functionCallWithValue(kybercall, tokenIn == NATIVE ? amountIn : 0);
|
|
78
|
-
}
|
|
79
|
-
}
|