@pendle/core-v2 3.0.0-beta-11 → 3.0.0-beta-12
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/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +5 -23
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +2 -5
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +6 -20
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +6 -27
- package/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol +1 -2
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +1 -1
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +16 -17
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +6 -7
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +7 -8
- package/contracts/LiquidityMining/PendleMerkleDistributor.sol +2 -11
- package/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol +14 -37
- package/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol +19 -34
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +4 -14
- package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +4 -16
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +11 -39
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +3 -10
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +1 -1
- package/contracts/LiquidityMining/libraries/VeBalanceLib.sol +5 -20
- package/contracts/LiquidityMining/libraries/VeHistoryLib.sol +1 -3
- package/contracts/core/Market/MarketMathCore.sol +12 -37
- package/contracts/core/Market/OracleLib.sol +6 -24
- package/contracts/core/Market/PendleExternalRewardDistributor.sol +4 -10
- package/contracts/core/Market/PendleGauge.sol +3 -9
- package/contracts/core/Market/PendleMarket.sol +14 -39
- package/contracts/core/Market/PendleMarketFactory.sol +14 -21
- package/contracts/core/Market/v2/PendleGaugeV2.sol +8 -24
- package/contracts/core/Market/v2/PendleMarketFactoryV2.sol +7 -27
- package/contracts/core/Market/v2/PendleMarketV2.sol +13 -36
- package/contracts/core/Market/v3/PendleMarketFactoryV3.sol +137 -0
- package/contracts/core/Market/v3/PendleMarketV3.sol +360 -0
- package/contracts/core/RewardManager/PendleLinearDistributor.sol +143 -0
- package/contracts/core/RewardManager/RewardManager.sol +14 -7
- package/contracts/core/RewardManager/RewardManagerAbstract.sol +5 -17
- package/contracts/core/StandardizedYield/SYBase.sol +10 -40
- package/contracts/core/StandardizedYield/SYBaseUpg.sol +197 -0
- package/contracts/core/StandardizedYield/SYBaseWithRewards.sol +9 -41
- package/contracts/core/StandardizedYield/SYBaseWithRewardsUpg.sol +88 -0
- package/contracts/core/StandardizedYield/SYUtils.sol +1 -4
- package/contracts/core/StandardizedYield/StEthHelper.sol +3 -9
- package/contracts/core/StandardizedYield/implementations/AaveV3/PendleAaveV3SY.sol +94 -0
- package/contracts/core/StandardizedYield/implementations/AaveV3/libraries/AaveAdapterLib.sol +19 -0
- package/contracts/core/StandardizedYield/implementations/AaveV3/libraries/WadRayMath.sol +126 -0
- package/contracts/core/StandardizedYield/implementations/Ankr/PendleAnkrBNBSY.sol +4 -12
- package/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol +5 -19
- package/contracts/core/StandardizedYield/implementations/BalancerStable/AuraEthxBbAWethSY.sol +4 -14
- package/contracts/core/StandardizedYield/implementations/BalancerStable/AuraSwEthBbAWethSYV2.sol +4 -14
- package/contracts/core/StandardizedYield/implementations/BalancerStable/{PendleAuraWethVethSY.sol → AuraWethVethSYUpg.sol} +13 -20
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol +3 -7
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol +12 -29
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol +12 -29
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol +12 -29
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol +14 -39
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWstethAnkreth.sol +7 -28
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol +13 -30
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewProxy.sol +1 -1
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewV4.sol +50 -153
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewV5.sol +50 -157
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol +4 -16
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearMath.sol +6 -25
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearPreview.sol +36 -34
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol +4 -13
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol +20 -58
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol +28 -79
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV3Upg.sol +310 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol +1 -3
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol +2 -6
- package/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol +5 -13
- package/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol +9 -29
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol +2 -8
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol +1 -5
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol +8 -19
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol +7 -25
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol +8 -27
- package/contracts/core/StandardizedYield/implementations/ChainlinkRelayer/PendleChainlinkReceiver.sol +2 -2
- package/contracts/core/StandardizedYield/implementations/ChainlinkRelayer/PendleChainlinkRelayer.sol +4 -9
- package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol +3 -15
- package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol +5 -23
- package/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol +10 -40
- package/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol +2 -8
- package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +2 -7
- package/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol +5 -20
- package/contracts/core/StandardizedYield/implementations/Flux/FluxTokenLib.sol +6 -4
- package/contracts/core/StandardizedYield/implementations/Flux/PendleFluxLendingSY.sol +3 -11
- package/contracts/core/StandardizedYield/implementations/GLP/GLPPreviewHelper.sol +3 -9
- package/contracts/core/StandardizedYield/implementations/GLP/GMTokenPricingHelper.sol +115 -0
- package/contracts/core/StandardizedYield/implementations/GLP/PendleGMV2TokenSY.sol +134 -0
- package/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol +5 -19
- package/contracts/core/StandardizedYield/implementations/HMX/HLPPricingHelper.sol +3 -4
- package/contracts/core/StandardizedYield/implementations/HMX/PendleHlpSY.sol +18 -25
- package/contracts/core/StandardizedYield/implementations/Kyber/KyberMathHelper.sol +425 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/KyberNftManagerBaseUpg.sol +438 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/PendleKyberElasticSYUpg.sol +155 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/FullMath.sol +123 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/LiqDeltaMath.sol +17 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/LiquidityMath.sol +74 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/MathConstants.sol +19 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/QtyDeltaMath.sol +103 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/QuadMath.sol +31 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/ReinvestmentMath.sol +26 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/SafeCast.sol +73 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/SwapMath.sol +272 -0
- package/contracts/core/StandardizedYield/implementations/Kyber/libraries/TickMath.sol +223 -0
- package/contracts/core/StandardizedYield/implementations/MUX/MlpPricingHelper.sol +26 -0
- package/contracts/core/StandardizedYield/implementations/MUX/PendleMlpSY.sol +195 -0
- package/contracts/core/StandardizedYield/implementations/MantleStakedEth/PendleMantleStakedEthSY.sol +12 -41
- package/contracts/core/StandardizedYield/implementations/MantleStakedEth/PendleOracleForSyProxy.sol +1 -1
- package/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol +13 -42
- package/contracts/core/StandardizedYield/implementations/PendleBridgedLSDSY.sol +4 -11
- package/contracts/core/StandardizedYield/implementations/PendleERC4626SY.sol +4 -16
- package/contracts/core/StandardizedYield/implementations/PendleEUSDSY.sol +3 -11
- package/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol +3 -11
- package/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol +5 -18
- package/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol +3 -7
- package/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol +5 -18
- package/contracts/core/StandardizedYield/implementations/PendleWbEthSY.sol +3 -10
- package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +4 -12
- package/contracts/core/StandardizedYield/implementations/Silo/PendleSiloWithIncentiveSY.sol +157 -0
- package/contracts/core/StandardizedYield/implementations/Stader/PendleETHXSY.sol +4 -12
- package/contracts/core/StandardizedYield/implementations/Swell/PendleSwETH.sol +4 -12
- package/contracts/core/StandardizedYield/implementations/Thena/PendleThenaSY.sol +9 -29
- package/contracts/core/StandardizedYield/implementations/Thena/ThenaLpHelper.sol +3 -10
- package/contracts/core/StandardizedYield/implementations/Thena/ThenaMath.sol +9 -30
- package/contracts/core/StandardizedYield/implementations/Thena/ThenaPreview.sol +10 -40
- package/contracts/core/YieldContracts/InterestManagerYT.sol +6 -8
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +1 -1
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +2 -3
- package/contracts/core/YieldContracts/PendleYieldToken.sol +17 -44
- package/contracts/core/YieldContractsV2/InterestManagerYTV2.sol +5 -14
- package/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol +1 -1
- package/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol +2 -3
- package/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol +13 -48
- package/contracts/core/erc20/PendleERC20.sol +2 -8
- package/contracts/core/erc20/PendleERC20Permit.sol +2 -6
- package/contracts/core/erc20/PendleERC20PermitUpg.sol +82 -0
- package/contracts/core/erc20/PendleERC20Upg.sol +334 -0
- package/contracts/core/libraries/ArrayLib.sol +7 -8
- package/contracts/core/libraries/BaseSplitCodeFactory.sol +1 -6
- package/contracts/core/libraries/Errors.sol +19 -1
- package/contracts/core/libraries/ExpiryUtilsLib.sol +3 -26
- package/contracts/core/libraries/StringLib.sol +5 -21
- package/contracts/core/libraries/TokenHelper.sol +3 -3
- package/contracts/core/libraries/math/LogExpMath.sol +1 -4
- package/contracts/core/libraries/math/PMath.sol +13 -15
- package/contracts/interfaces/AaveV3/IAaveV3AToken.sol +15 -0
- package/contracts/interfaces/AaveV3/IAaveV3Pool.sol +11 -0
- package/contracts/interfaces/Balancer/IComposableStable.sol +3 -4
- package/contracts/interfaces/Balancer/IERC4626LinearPool.sol +2 -10
- package/contracts/interfaces/Balancer/IMetaStablePool.sol +3 -11
- package/contracts/interfaces/Balancer/IVault.sol +3 -8
- package/contracts/interfaces/BinanceEth/IWBETH.sol +1 -1
- package/contracts/interfaces/Camelot/ICamelotNFTFactory.sol +1 -3
- package/contracts/interfaces/Camelot/ICamelotNFTHandler.sol +2 -10
- package/contracts/interfaces/Camelot/ICamelotNitroPool.sol +0 -1
- package/contracts/interfaces/Camelot/ICamelotNitroPoolFactory.sol +3 -12
- package/contracts/interfaces/Camelot/ICamelotPair.sol +5 -25
- package/contracts/interfaces/Camelot/ICamelotRouter.sol +1 -5
- package/contracts/interfaces/Camelot/IXGrail.sol +3 -11
- package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -3
- package/contracts/interfaces/Curve/ICrvPool.sol +3 -12
- package/contracts/interfaces/Curve/ITriCrvPool.sol +2 -9
- package/contracts/interfaces/Flux/IFluxErc20.sol +1 -1
- package/contracts/interfaces/Flux/IFluxInterestRateModel.sol +1 -5
- package/contracts/interfaces/GMX/IGMXPriceHelper.sol +6 -0
- package/contracts/interfaces/GMX/IGMXVault.sol +2 -9
- package/contracts/interfaces/GMX/IRewardRouterV2.sol +1 -4
- package/contracts/interfaces/HMX/IHLPStaking.sol +1 -1
- package/contracts/interfaces/HMX/IHMXCalculator.sol +1 -1
- package/contracts/interfaces/HMX/IHMXCompounder.sol +1 -1
- package/contracts/interfaces/HMX/IHMXStaking.sol +1 -1
- package/contracts/interfaces/HMX/IHMXVester.sol +1 -1
- package/contracts/interfaces/IApeStaking.sol +3 -9
- package/contracts/interfaces/IBenQiInterestRateModel.sol +1 -5
- package/contracts/interfaces/IDiamondCut.sol +1 -5
- package/contracts/interfaces/IDiamondLoupe.sol +1 -3
- package/contracts/interfaces/ILayerZeroReceiver.sol +1 -6
- package/contracts/interfaces/IPActionAddRemoveLiqV3.sol +10 -2
- package/contracts/interfaces/IPActionInfoStatic.sol +4 -7
- package/contracts/interfaces/IPActionMarketAuxStatic.sol +5 -9
- package/contracts/interfaces/IPActionMarketCoreStatic.sol +118 -58
- package/contracts/interfaces/IPActionMintRedeemStatic.sol +38 -21
- package/contracts/interfaces/IPActionMiscV3.sol +51 -26
- package/contracts/interfaces/IPActionStorageStatic.sol +5 -1
- package/contracts/interfaces/IPAllActionTypeV3.sol +1 -0
- package/contracts/interfaces/IPBulkSeller.sol +49 -0
- package/contracts/interfaces/IPBulkSellerFactory.sol +12 -0
- package/contracts/interfaces/IPBulkSellerSYCallback.sol +6 -0
- package/contracts/interfaces/IPFeeDistributor.sol +1 -3
- package/contracts/interfaces/IPFeeDistributorV2.sol +8 -7
- package/contracts/interfaces/IPGaugeController.sol +2 -8
- package/contracts/interfaces/IPGaugeControllerMainchain.sol +1 -5
- package/contracts/interfaces/IPInterestManagerYT.sol +3 -3
- package/contracts/interfaces/IPInterestManagerYTV2.sol +1 -4
- package/contracts/interfaces/IPLimitRouter.sol +24 -19
- package/contracts/interfaces/IPLinearDistributor.sol +21 -0
- package/contracts/interfaces/IPMarket.sol +4 -17
- package/contracts/interfaces/IPMarketFactory.sol +2 -13
- package/contracts/interfaces/IPMarketFactoryV3.sol +24 -0
- package/contracts/interfaces/IPMarketV3.sol +8 -0
- package/contracts/interfaces/IPOffchainStorage.sol +11 -0
- package/contracts/interfaces/IPPriceFeed.sol +6 -0
- package/contracts/interfaces/IPPtOracle.sol +2 -9
- package/contracts/interfaces/IPRouterHelper.sol +11 -7
- package/contracts/interfaces/IPRouterStatic.sol +1 -3
- package/contracts/interfaces/IPVotingController.sol +7 -19
- package/contracts/interfaces/IPVotingEscrowMainchain.sol +2 -8
- package/contracts/interfaces/IPYieldToken.sol +2 -8
- package/contracts/interfaces/IPYieldTokenV2.sol +1 -6
- package/contracts/interfaces/IPendlePreviewHelper.sol +2 -8
- package/contracts/interfaces/IRewardManager.sol +1 -4
- package/contracts/interfaces/IStETH.sol +1 -4
- package/contracts/interfaces/IStandardizedYield.sol +9 -16
- package/contracts/interfaces/IStargateLP.sol +0 -3
- package/contracts/interfaces/IStargateRouter.sol +1 -5
- package/contracts/interfaces/Kyber/IKyberElasticFactory.sol +157 -0
- package/contracts/interfaces/Kyber/IKyberElasticPool.sol +101 -0
- package/contracts/interfaces/Kyber/IKyberElasticRouter.sol +98 -0
- package/contracts/interfaces/Kyber/IKyberLiquidityMining.sol +209 -0
- package/contracts/interfaces/Kyber/IKyberMathHelper.sol +28 -0
- package/contracts/interfaces/Kyber/IKyberPositionManager.sol +179 -0
- package/contracts/interfaces/Lybra/IEUSD.sol +1 -1
- package/contracts/interfaces/MUX/IMUXRewardRouter.sol +139 -0
- package/contracts/interfaces/Silo/ISilo.sol +298 -0
- package/contracts/interfaces/Silo/ISiloIncentiveController.sol +16 -0
- package/contracts/interfaces/Silo/ISiloLens.sol +6 -0
- package/contracts/interfaces/Stader/IStaderStakeManager.sol +2 -2
- package/contracts/interfaces/Thena/IThenaFactory.sol +1 -5
- package/contracts/interfaces/Thena/IThenaGaugeV2.sol +1 -2
- package/contracts/interfaces/Thena/IThenaPair.sol +3 -5
- package/contracts/limit/LimitMathCore.sol +69 -60
- package/contracts/limit/{PendleOrderMixin.sol → LimitRouterBase.sol} +96 -79
- package/contracts/limit/PendleLimitRouter.sol +9 -13
- package/contracts/offchain-helpers/AutomateReady.sol +17 -32
- package/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol +6 -3
- package/contracts/offchain-helpers/BoringLpSeller.sol +4 -17
- package/contracts/offchain-helpers/BoringPtSeller.sol +2 -7
- package/contracts/offchain-helpers/Broadcaster.sol +1 -1
- package/contracts/offchain-helpers/BytesLib.sol +26 -14
- package/contracts/offchain-helpers/EmptyUUPS.sol +0 -1
- package/contracts/offchain-helpers/LegacyNFTHelper.sol +4 -23
- package/contracts/offchain-helpers/LimitBackendHelper.sol +25 -16
- package/contracts/offchain-helpers/MarketExchangeRateLib.sol +2 -13
- package/contracts/offchain-helpers/Multicall2.sol +2 -7
- package/contracts/offchain-helpers/PendleMulticallV1.sol +7 -7
- package/contracts/offchain-helpers/PendleMulticallV2.sol +12 -13
- package/contracts/offchain-helpers/PendleOffchainStorage.sol +59 -0
- package/contracts/offchain-helpers/SimulateHelper.sol +6 -7
- package/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol +15 -1
- package/contracts/oracles/PendleLpOracleLib.sol +9 -10
- package/contracts/oracles/PendlePtOracle.sol +8 -19
- package/contracts/oracles/PendlePtOracleLib.sol +8 -13
- package/contracts/oracles/samples/PendleLpGlpOracle.sol +6 -10
- package/contracts/oracles/samples/PendlePtGlpOracle.sol +6 -10
- package/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol +8 -15
- package/contracts/router/ActionAddRemoveLiqV3.sol +147 -52
- package/contracts/router/ActionCallbackV3.sol +11 -4
- package/contracts/router/ActionMiscV3.sol +43 -33
- package/contracts/router/ActionSwapPTV3.sol +18 -6
- package/contracts/router/ActionSwapYTV3.sol +42 -14
- package/contracts/router/PendleRouterHelper.sol +72 -40
- package/contracts/router/PendleRouterV3.sol +50 -50
- package/contracts/router/base/ActionBase.sol +86 -43
- package/contracts/router/base/CallbackHelper.sol +18 -20
- package/contracts/router/base/MarketApproxLib.sol +36 -32
- package/contracts/router/swap-aggregator/PendleSwap.sol +31 -7
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutorOptimistic.sol +63 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelper.sol +314 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperL2.sol +560 -0
- package/contracts/router/swap-aggregator/kyberswap/{IMetaAggregationRouterV2.sol → interfaces/IMetaAggregationRouterV2.sol} +11 -6
- package/contracts/router/swap-aggregator/kyberswap/{KyberInputScalingHelper.sol → l1-contracts/InputScalingHelper.sol} +70 -19
- package/contracts/router/swap-aggregator/kyberswap/{ScalingDataLib.sol → l1-contracts/ScalingDataLib.sol} +111 -53
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/BytesHelper.sol +29 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataReader.sol +149 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataWriter.sol +118 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/Common.sol +42 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/DexScaler.sol +382 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/ExecutorReader.sol +61 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/InputScalingHelperL2.sol +329 -0
- package/contracts/router/swap-aggregator/kyberswap/l2-contracts/ScalingDataL2Lib.sol +173 -0
- package/contracts/router/swap-aggregator/oneinch/I1inchAggregationRouterV5.sol +4 -10
- package/contracts/router/swap-aggregator/oneinch/OneInchAggregationRouterHelper.sol +20 -14
- package/deployments/1-core.json +5 -2
- package/deployments/1-markets/EPENDLE-SEP2024.json +12 -0
- package/deployments/1-markets/SFRAX-MARCH2024.json +10 -0
- package/deployments/1-markets/SILO-CRVUSD-MARCH2024.json +10 -0
- package/deployments/10-core.json +6 -3
- package/deployments/42161-core.json +5 -2
- package/deployments/42161-markets/AAVE-USDC-JUNE2024.json +11 -0
- package/deployments/42161-markets/ARBSILO-USDC-FEB2024.json +10 -0
- package/deployments/42161-markets/GM-ARB-USDC-MARCH2024.json +10 -0
- package/deployments/42161-markets/KYBER-AXLWSTETH-WSTETH-MARCH2024.json +10 -0
- package/deployments/42161-markets/MLP-MARCH2024.json +10 -0
- package/deployments/42161-markets/WSTETH-ARBITRUM-MARCH2024.json +11 -0
- package/deployments/42161-markets/WSTETHSILO-ETH-MARCH2024.json +11 -0
- package/deployments/56-core.json +5 -2
- package/deployments/merkle-distribution/2023-10-26.json +7300 -0
- package/deployments/merkle-distribution/2023-11-30.json +7730 -0
- package/package.json +8 -8
- package/contracts/limit/helpers/ArgumentsDecoder.sol +0 -47
- package/contracts/limit/helpers/Permitable.sol +0 -48
- package/contracts/limit/helpers/RevertReasonParser.sol +0 -75
- package/contracts/offchain-helpers/ChainlinkRelayerGelato.sol +0 -37
- package/contracts/offchain-helpers/PtAndLpToAsset.sol +0 -62
- package/contracts/offchain-helpers/router-static/PendleRouterStatic.sol +0 -19
- package/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol +0 -112
- package/contracts/offchain-helpers/router-static/base/ActionLimitOrdersStatic.sol +0 -145
- package/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol +0 -171
- package/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol +0 -582
- package/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol +0 -116
- package/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol +0 -64
- package/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol +0 -53
- package/contracts/offchain-helpers/router-static/base/StorageLayout.sol +0 -18
- package/contracts/router/swap-aggregator/kyberswap/IExecutorHelper.sol +0 -231
- package/deployments/1-markets/BALANCER-LP-AURA-VETH-WETH-SEP2024.json +0 -8
- /package/contracts/router/swap-aggregator/kyberswap/{IAggregationExecutor.sol → interfaces/IAggregationExecutor.sol} +0 -0
- /package/deployments/1-markets/{BALANCER-LP-AURA-BBAWETHSWETH-SEP-26-2024.json → deprecated/BALANCER-LP-AURA-BBAWETHSWETH-SEP-26-2024.json} +0 -0
- /package/deployments/1-markets/{BALANCER-LP-AURA-ETHX-BBAWETH-SEP-26-2024.json → deprecated/BALANCER-LP-AURA-ETHX-BBAWETH-SEP-26-2024.json} +0 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)
|
|
3
|
+
|
|
4
|
+
pragma solidity ^0.8.0;
|
|
5
|
+
|
|
6
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
7
|
+
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
8
|
+
import "@openzeppelin/contracts/utils/Context.sol";
|
|
9
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @dev Pendle's ERC20 implementation, modified from @openzeppelin implementation
|
|
13
|
+
* Changes are:
|
|
14
|
+
* - comes with built-in reentrancy protection, storage-packed with totalSupply variable
|
|
15
|
+
* - delete increaseAllowance / decreaseAllowance
|
|
16
|
+
* - add nonReentrancy protection to transfer / transferFrom functions
|
|
17
|
+
* - allow decimals to be passed in
|
|
18
|
+
* - block self-transfer by default
|
|
19
|
+
*/
|
|
20
|
+
// solhint-disable
|
|
21
|
+
abstract contract PendleERC20Upg is Context, Initializable, IERC20, IERC20Metadata {
|
|
22
|
+
uint8 private constant _NOT_ENTERED = 1;
|
|
23
|
+
uint8 private constant _ENTERED = 2;
|
|
24
|
+
|
|
25
|
+
mapping(address => uint256) private _balances;
|
|
26
|
+
|
|
27
|
+
mapping(address => mapping(address => uint256)) private _allowances;
|
|
28
|
+
|
|
29
|
+
uint248 private _totalSupply;
|
|
30
|
+
uint8 private _status;
|
|
31
|
+
|
|
32
|
+
string private _name;
|
|
33
|
+
string private _symbol;
|
|
34
|
+
uint8 public immutable decimals;
|
|
35
|
+
|
|
36
|
+
uint256[100] private __gap;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @dev Prevents a contract from calling itself, directly or indirectly.
|
|
40
|
+
* Calling a `nonReentrant` function from another `nonReentrant`
|
|
41
|
+
* function is not supported. It is possible to prevent this from happening
|
|
42
|
+
* by making the `nonReentrant` function external, and making it call a
|
|
43
|
+
* `private` function that does the actual work.
|
|
44
|
+
*/
|
|
45
|
+
modifier nonReentrant() {
|
|
46
|
+
// On the first call to nonReentrant, _notEntered will be true
|
|
47
|
+
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
|
|
48
|
+
|
|
49
|
+
// Any calls to nonReentrant after this point will fail
|
|
50
|
+
_status = _ENTERED;
|
|
51
|
+
|
|
52
|
+
_;
|
|
53
|
+
|
|
54
|
+
// By storing the original value once again, a refund is triggered (see
|
|
55
|
+
// https://eips.ethereum.org/EIPS/eip-2200)
|
|
56
|
+
_status = _NOT_ENTERED;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @dev Sets the values for {name}, {symbol} and {decimals}.
|
|
61
|
+
*
|
|
62
|
+
* All three of these values are immutable: they can only be set once during
|
|
63
|
+
* construction.
|
|
64
|
+
*/
|
|
65
|
+
constructor(uint8 decimals_) {
|
|
66
|
+
decimals = decimals_;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @dev Sets the values for {name} and {symbol}.
|
|
71
|
+
*
|
|
72
|
+
* The default value of {decimals} is 18. To select a different value for
|
|
73
|
+
* {decimals} you should overload it.
|
|
74
|
+
*
|
|
75
|
+
* All two of these values are immutable: they can only be set once during
|
|
76
|
+
* construction.
|
|
77
|
+
*/
|
|
78
|
+
function __ERC20Upg_init(string memory name_, string memory symbol_) internal onlyInitializing {
|
|
79
|
+
_name = name_;
|
|
80
|
+
_symbol = symbol_;
|
|
81
|
+
_status = _NOT_ENTERED;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @dev Returns the name of the token.
|
|
86
|
+
*/
|
|
87
|
+
function name() public view virtual override returns (string memory) {
|
|
88
|
+
return _name;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @dev Returns the symbol of the token, usually a shorter version of the
|
|
93
|
+
* name.
|
|
94
|
+
*/
|
|
95
|
+
function symbol() public view virtual override returns (string memory) {
|
|
96
|
+
return _symbol;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @dev See {IERC20-totalSupply}.
|
|
101
|
+
*/
|
|
102
|
+
function totalSupply() public view virtual override returns (uint256) {
|
|
103
|
+
return _totalSupply;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @dev See {IERC20-balanceOf}.
|
|
108
|
+
*/
|
|
109
|
+
function balanceOf(address account) public view virtual override returns (uint256) {
|
|
110
|
+
return _balances[account];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @dev See {IERC20-transfer}.
|
|
115
|
+
*
|
|
116
|
+
* Requirements:
|
|
117
|
+
*
|
|
118
|
+
* - `to` cannot be the zero address.
|
|
119
|
+
* - the caller must have a balance of at least `amount`.
|
|
120
|
+
*/
|
|
121
|
+
function transfer(address to, uint256 amount) external virtual override nonReentrant returns (bool) {
|
|
122
|
+
address owner = _msgSender();
|
|
123
|
+
_transfer(owner, to, amount);
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @dev See {IERC20-allowance}.
|
|
129
|
+
*/
|
|
130
|
+
function allowance(address owner, address spender) public view virtual override returns (uint256) {
|
|
131
|
+
return _allowances[owner][spender];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @dev See {IERC20-approve}.
|
|
136
|
+
*
|
|
137
|
+
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
|
|
138
|
+
* `transferFrom`. This is semantically equivalent to an infinite approval.
|
|
139
|
+
*
|
|
140
|
+
* Requirements:
|
|
141
|
+
*
|
|
142
|
+
* - `spender` cannot be the zero address.
|
|
143
|
+
*/
|
|
144
|
+
function approve(address spender, uint256 amount) external virtual override returns (bool) {
|
|
145
|
+
address owner = _msgSender();
|
|
146
|
+
_approve(owner, spender, amount);
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @dev See {IERC20-transferFrom}.
|
|
152
|
+
*
|
|
153
|
+
* Emits an {Approval} event indicating the updated allowance. This is not
|
|
154
|
+
* required by the EIP. See the note at the beginning of {ERC20}.
|
|
155
|
+
*
|
|
156
|
+
* NOTE: Does not update the allowance if the current allowance
|
|
157
|
+
* is the maximum `uint256`.
|
|
158
|
+
*
|
|
159
|
+
* Requirements:
|
|
160
|
+
*
|
|
161
|
+
* - `from` and `to` cannot be the zero address.
|
|
162
|
+
* - `from` must have a balance of at least `amount`.
|
|
163
|
+
* - the caller must have allowance for ``from``'s tokens of at least
|
|
164
|
+
* `amount`.
|
|
165
|
+
*/
|
|
166
|
+
function transferFrom(
|
|
167
|
+
address from,
|
|
168
|
+
address to,
|
|
169
|
+
uint256 amount
|
|
170
|
+
) external virtual override nonReentrant returns (bool) {
|
|
171
|
+
address spender = _msgSender();
|
|
172
|
+
_spendAllowance(from, spender, amount);
|
|
173
|
+
_transfer(from, to, amount);
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @dev Moves `amount` of tokens from `sender` to `recipient`.
|
|
179
|
+
*
|
|
180
|
+
* This internal function is equivalent to {transfer}, and can be used to
|
|
181
|
+
* e.g. implement automatic token fees, slashing mechanisms, etc.
|
|
182
|
+
*
|
|
183
|
+
* Emits a {Transfer} event.
|
|
184
|
+
*
|
|
185
|
+
* Requirements:
|
|
186
|
+
*
|
|
187
|
+
* - `from` cannot be the zero address.
|
|
188
|
+
* - `to` cannot be the zero address.
|
|
189
|
+
* - `from` must have a balance of at least `amount`.
|
|
190
|
+
*/
|
|
191
|
+
function _transfer(address from, address to, uint256 amount) internal virtual {
|
|
192
|
+
require(from != address(0), "ERC20: transfer from the zero address");
|
|
193
|
+
require(to != address(0), "ERC20: transfer to the zero address");
|
|
194
|
+
require(from != to, "ERC20: transfer to self");
|
|
195
|
+
|
|
196
|
+
_beforeTokenTransfer(from, to, amount);
|
|
197
|
+
|
|
198
|
+
uint256 fromBalance = _balances[from];
|
|
199
|
+
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
|
|
200
|
+
unchecked {
|
|
201
|
+
_balances[from] = fromBalance - amount;
|
|
202
|
+
}
|
|
203
|
+
_balances[to] += amount;
|
|
204
|
+
|
|
205
|
+
emit Transfer(from, to, amount);
|
|
206
|
+
|
|
207
|
+
_afterTokenTransfer(from, to, amount);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
|
|
211
|
+
* the total supply.
|
|
212
|
+
*
|
|
213
|
+
* Emits a {Transfer} event with `from` set to the zero address.
|
|
214
|
+
*
|
|
215
|
+
* Requirements:
|
|
216
|
+
*
|
|
217
|
+
* - `account` cannot be the zero address.
|
|
218
|
+
*/
|
|
219
|
+
function _mint(address account, uint256 amount) internal virtual {
|
|
220
|
+
require(account != address(0), "ERC20: mint to the zero address");
|
|
221
|
+
|
|
222
|
+
_beforeTokenTransfer(address(0), account, amount);
|
|
223
|
+
|
|
224
|
+
_totalSupply += toUint248(amount);
|
|
225
|
+
_balances[account] += amount;
|
|
226
|
+
emit Transfer(address(0), account, amount);
|
|
227
|
+
|
|
228
|
+
_afterTokenTransfer(address(0), account, amount);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @dev Destroys `amount` tokens from `account`, reducing the
|
|
233
|
+
* total supply.
|
|
234
|
+
*
|
|
235
|
+
* Emits a {Transfer} event with `to` set to the zero address.
|
|
236
|
+
*
|
|
237
|
+
* Requirements:
|
|
238
|
+
*
|
|
239
|
+
* - `account` cannot be the zero address.
|
|
240
|
+
* - `account` must have at least `amount` tokens.
|
|
241
|
+
*/
|
|
242
|
+
function _burn(address account, uint256 amount) internal virtual {
|
|
243
|
+
require(account != address(0), "ERC20: burn from the zero address");
|
|
244
|
+
|
|
245
|
+
_beforeTokenTransfer(account, address(0), amount);
|
|
246
|
+
|
|
247
|
+
uint256 accountBalance = _balances[account];
|
|
248
|
+
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
|
|
249
|
+
unchecked {
|
|
250
|
+
_balances[account] = accountBalance - amount;
|
|
251
|
+
}
|
|
252
|
+
_totalSupply -= toUint248(amount);
|
|
253
|
+
|
|
254
|
+
emit Transfer(account, address(0), amount);
|
|
255
|
+
|
|
256
|
+
_afterTokenTransfer(account, address(0), amount);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
|
|
261
|
+
*
|
|
262
|
+
* This internal function is equivalent to `approve`, and can be used to
|
|
263
|
+
* e.g. set automatic allowances for certain subsystems, etc.
|
|
264
|
+
*
|
|
265
|
+
* Emits an {Approval} event.
|
|
266
|
+
*
|
|
267
|
+
* Requirements:
|
|
268
|
+
*
|
|
269
|
+
* - `owner` cannot be the zero address.
|
|
270
|
+
* - `spender` cannot be the zero address.
|
|
271
|
+
*/
|
|
272
|
+
function _approve(address owner, address spender, uint256 amount) internal virtual {
|
|
273
|
+
require(owner != address(0), "ERC20: approve from the zero address");
|
|
274
|
+
require(spender != address(0), "ERC20: approve to the zero address");
|
|
275
|
+
|
|
276
|
+
_allowances[owner][spender] = amount;
|
|
277
|
+
emit Approval(owner, spender, amount);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
|
|
282
|
+
*
|
|
283
|
+
* Does not update the allowance amount in case of infinite allowance.
|
|
284
|
+
* Revert if not enough allowance is available.
|
|
285
|
+
*
|
|
286
|
+
* Might emit an {Approval} event.
|
|
287
|
+
*/
|
|
288
|
+
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
|
|
289
|
+
uint256 currentAllowance = allowance(owner, spender);
|
|
290
|
+
if (currentAllowance != type(uint256).max) {
|
|
291
|
+
require(currentAllowance >= amount, "ERC20: insufficient allowance");
|
|
292
|
+
unchecked {
|
|
293
|
+
_approve(owner, spender, currentAllowance - amount);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @dev Hook that is called before any transfer of tokens. This includes
|
|
300
|
+
* minting and burning.
|
|
301
|
+
*
|
|
302
|
+
* Calling conditions:
|
|
303
|
+
*
|
|
304
|
+
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
|
|
305
|
+
* will be transferred to `to`.
|
|
306
|
+
* - when `from` is zero, `amount` tokens will be minted for `to`.
|
|
307
|
+
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
|
|
308
|
+
* - `from` and `to` are never both zero.
|
|
309
|
+
*
|
|
310
|
+
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
|
|
311
|
+
*/
|
|
312
|
+
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* @dev Hook that is called after any transfer of tokens. This includes
|
|
316
|
+
* minting and burning.
|
|
317
|
+
*
|
|
318
|
+
* Calling conditions:
|
|
319
|
+
*
|
|
320
|
+
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
|
|
321
|
+
* has been transferred to `to`.
|
|
322
|
+
* - when `from` is zero, `amount` tokens have been minted for `to`.
|
|
323
|
+
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
|
|
324
|
+
* - `from` and `to` are never both zero.
|
|
325
|
+
*
|
|
326
|
+
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
|
|
327
|
+
*/
|
|
328
|
+
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
|
|
329
|
+
|
|
330
|
+
function toUint248(uint256 x) internal virtual returns (uint248) {
|
|
331
|
+
require(x <= type(uint248).max); // signed, lim = bit-1
|
|
332
|
+
return uint248(x);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
@@ -25,10 +25,7 @@ library ArrayLib {
|
|
|
25
25
|
return type(uint256).max;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function append(
|
|
29
|
-
address[] memory inp,
|
|
30
|
-
address element
|
|
31
|
-
) internal pure returns (address[] memory out) {
|
|
28
|
+
function append(address[] memory inp, address element) internal pure returns (address[] memory out) {
|
|
32
29
|
uint256 length = inp.length;
|
|
33
30
|
out = new address[](length + 1);
|
|
34
31
|
for (uint256 i = 0; i < length; ) {
|
|
@@ -46,10 +43,7 @@ library ArrayLib {
|
|
|
46
43
|
* @param b array of addresses b
|
|
47
44
|
* @return out Concatenation of a and b containing unidentical elements
|
|
48
45
|
*/
|
|
49
|
-
function merge(
|
|
50
|
-
address[] memory a,
|
|
51
|
-
address[] memory b
|
|
52
|
-
) internal pure returns (address[] memory out) {
|
|
46
|
+
function merge(address[] memory a, address[] memory b) internal pure returns (address[] memory out) {
|
|
53
47
|
unchecked {
|
|
54
48
|
uint256 countUnidenticalB = 0;
|
|
55
49
|
bool[] memory isUnidentical = new bool[](b.length);
|
|
@@ -106,4 +100,9 @@ library ArrayLib {
|
|
|
106
100
|
res[0] = a;
|
|
107
101
|
res[1] = b;
|
|
108
102
|
}
|
|
103
|
+
|
|
104
|
+
function create(uint256 a) internal pure returns (uint256[] memory res) {
|
|
105
|
+
res = new uint256[](1);
|
|
106
|
+
res[0] = a;
|
|
107
|
+
}
|
|
109
108
|
}
|
|
@@ -215,12 +215,7 @@ library BaseSplitCodeFactory {
|
|
|
215
215
|
// Next, we concatenate the creation code stored in A and B.
|
|
216
216
|
let dataStart := add(code, 32)
|
|
217
217
|
extcodecopy(creationCodeContractA, dataStart, 0, creationCodeSizeA)
|
|
218
|
-
extcodecopy(
|
|
219
|
-
creationCodeContractB,
|
|
220
|
-
add(dataStart, creationCodeSizeA),
|
|
221
|
-
0,
|
|
222
|
-
creationCodeSizeB
|
|
223
|
-
)
|
|
218
|
+
extcodecopy(creationCodeContractB, add(dataStart, creationCodeSizeA), 0, creationCodeSizeB)
|
|
224
219
|
}
|
|
225
220
|
|
|
226
221
|
// Finally, we copy the constructorArgs to the end of the array. Unfortunately there is no way to avoid this
|
|
@@ -2,11 +2,27 @@
|
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
4
|
library Errors {
|
|
5
|
+
// BulkSeller
|
|
6
|
+
error BulkInsufficientSyForTrade(uint256 currentAmount, uint256 requiredAmount);
|
|
7
|
+
error BulkInsufficientTokenForTrade(uint256 currentAmount, uint256 requiredAmount);
|
|
8
|
+
error BulkInSufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut);
|
|
9
|
+
error BulkInSufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut);
|
|
10
|
+
error BulkInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance);
|
|
11
|
+
error BulkNotMaintainer();
|
|
12
|
+
error BulkNotAdmin();
|
|
13
|
+
error BulkSellerAlreadyExisted(address token, address SY, address bulk);
|
|
14
|
+
error BulkSellerInvalidToken(address token, address SY);
|
|
15
|
+
error BulkBadRateTokenToSy(uint256 actualRate, uint256 currentRate, uint256 eps);
|
|
16
|
+
error BulkBadRateSyToToken(uint256 actualRate, uint256 currentRate, uint256 eps);
|
|
17
|
+
|
|
5
18
|
// APPROX
|
|
6
19
|
error ApproxFail();
|
|
7
20
|
error ApproxParamsInvalid(uint256 guessMin, uint256 guessMax, uint256 eps);
|
|
8
21
|
error ApproxBinarySearchInputInvalid(
|
|
9
|
-
uint256 approxGuessMin,
|
|
22
|
+
uint256 approxGuessMin,
|
|
23
|
+
uint256 approxGuessMax,
|
|
24
|
+
uint256 minGuessMin,
|
|
25
|
+
uint256 maxGuessMax
|
|
10
26
|
);
|
|
11
27
|
|
|
12
28
|
// MARKET + MARKET MATH CORE
|
|
@@ -33,9 +49,11 @@ library Errors {
|
|
|
33
49
|
error MarketFactoryMarketExists();
|
|
34
50
|
|
|
35
51
|
error MarketFactoryLnFeeRateRootTooHigh(uint80 lnFeeRateRoot, uint256 maxLnFeeRateRoot);
|
|
52
|
+
error MarketFactoryOverriddenFeeTooHigh(uint80 overriddenFee, uint256 marketLnFeeRateRoot);
|
|
36
53
|
error MarketFactoryReserveFeePercentTooHigh(uint8 reserveFeePercent, uint8 maxReserveFeePercent);
|
|
37
54
|
error MarketFactoryZeroTreasury();
|
|
38
55
|
error MarketFactoryInitialAnchorTooLow(int256 initialAnchor, int256 minInitialAnchor);
|
|
56
|
+
error MFNotPendleMarket(address addr);
|
|
39
57
|
|
|
40
58
|
// ROUTER
|
|
41
59
|
error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut);
|
|
@@ -28,9 +28,7 @@ library ExpiryUtils {
|
|
|
28
28
|
uint256 _expiry,
|
|
29
29
|
string memory _delimiter
|
|
30
30
|
) internal pure returns (string memory result) {
|
|
31
|
-
result = string(
|
|
32
|
-
abi.encodePacked(_bt, _delimiter, _yt, _delimiter, toRFC2822String(_expiry))
|
|
33
|
-
);
|
|
31
|
+
result = string(abi.encodePacked(_bt, _delimiter, _yt, _delimiter, toRFC2822String(_expiry)));
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
function toRFC2822String(uint256 _timestamp) internal pure returns (string memory s) {
|
|
@@ -42,15 +40,7 @@ library ExpiryUtils {
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
function getDaysInMonth(uint8 _month, uint16 _year) private pure returns (uint8) {
|
|
45
|
-
if (
|
|
46
|
-
_month == 1 ||
|
|
47
|
-
_month == 3 ||
|
|
48
|
-
_month == 5 ||
|
|
49
|
-
_month == 7 ||
|
|
50
|
-
_month == 8 ||
|
|
51
|
-
_month == 10 ||
|
|
52
|
-
_month == 12
|
|
53
|
-
) {
|
|
43
|
+
if (_month == 1 || _month == 3 || _month == 5 || _month == 7 || _month == 8 || _month == 10 || _month == 12) {
|
|
54
44
|
return 31;
|
|
55
45
|
} else if (_month == 4 || _month == 6 || _month == 9 || _month == 11) {
|
|
56
46
|
return 30;
|
|
@@ -94,20 +84,7 @@ library ExpiryUtils {
|
|
|
94
84
|
}
|
|
95
85
|
|
|
96
86
|
function monthName(Date memory d) private pure returns (string memory) {
|
|
97
|
-
string[12] memory months = [
|
|
98
|
-
"JAN",
|
|
99
|
-
"FEB",
|
|
100
|
-
"MAR",
|
|
101
|
-
"APR",
|
|
102
|
-
"MAY",
|
|
103
|
-
"JUN",
|
|
104
|
-
"JUL",
|
|
105
|
-
"AUG",
|
|
106
|
-
"SEP",
|
|
107
|
-
"OCT",
|
|
108
|
-
"NOV",
|
|
109
|
-
"DEC"
|
|
110
|
-
];
|
|
87
|
+
string[12] memory months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
|
|
111
88
|
return months[d.month - 1];
|
|
112
89
|
}
|
|
113
90
|
|
|
@@ -621,11 +621,7 @@ library StringLib {
|
|
|
621
621
|
* @param token An output parameter to which the first token is written.
|
|
622
622
|
* @return `token`.
|
|
623
623
|
*/
|
|
624
|
-
function split(
|
|
625
|
-
slice memory self,
|
|
626
|
-
slice memory needle,
|
|
627
|
-
slice memory token
|
|
628
|
-
) internal pure returns (slice memory) {
|
|
624
|
+
function split(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
|
|
629
625
|
uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
|
|
630
626
|
token._ptr = self._ptr;
|
|
631
627
|
token._len = ptr - self._ptr;
|
|
@@ -648,10 +644,7 @@ library StringLib {
|
|
|
648
644
|
* @param needle The text to search for in `self`.
|
|
649
645
|
* @return The part of `self` up to the first occurrence of `delim`.
|
|
650
646
|
*/
|
|
651
|
-
function split(
|
|
652
|
-
slice memory self,
|
|
653
|
-
slice memory needle
|
|
654
|
-
) internal pure returns (slice memory token) {
|
|
647
|
+
function split(slice memory self, slice memory needle) internal pure returns (slice memory token) {
|
|
655
648
|
split(self, needle, token);
|
|
656
649
|
}
|
|
657
650
|
|
|
@@ -665,11 +658,7 @@ library StringLib {
|
|
|
665
658
|
* @param token An output parameter to which the first token is written.
|
|
666
659
|
* @return `token`.
|
|
667
660
|
*/
|
|
668
|
-
function rsplit(
|
|
669
|
-
slice memory self,
|
|
670
|
-
slice memory needle,
|
|
671
|
-
slice memory token
|
|
672
|
-
) internal pure returns (slice memory) {
|
|
661
|
+
function rsplit(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
|
|
673
662
|
uint256 ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
|
|
674
663
|
token._ptr = ptr;
|
|
675
664
|
token._len = self._len - (ptr - self._ptr);
|
|
@@ -691,10 +680,7 @@ library StringLib {
|
|
|
691
680
|
* @param needle The text to search for in `self`.
|
|
692
681
|
* @return The part of `self` after the last occurrence of `delim`.
|
|
693
682
|
*/
|
|
694
|
-
function rsplit(
|
|
695
|
-
slice memory self,
|
|
696
|
-
slice memory needle
|
|
697
|
-
) internal pure returns (slice memory token) {
|
|
683
|
+
function rsplit(slice memory self, slice memory needle) internal pure returns (slice memory token) {
|
|
698
684
|
rsplit(self, needle, token);
|
|
699
685
|
}
|
|
700
686
|
|
|
@@ -708,9 +694,7 @@ library StringLib {
|
|
|
708
694
|
uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
|
|
709
695
|
while (ptr <= self._ptr + self._len) {
|
|
710
696
|
cnt++;
|
|
711
|
-
ptr =
|
|
712
|
-
findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) +
|
|
713
|
-
needle._len;
|
|
697
|
+
ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len;
|
|
714
698
|
}
|
|
715
699
|
}
|
|
716
700
|
|
|
@@ -17,13 +17,13 @@ abstract contract TokenHelper {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function _transferFrom(IERC20 token, address from, address to, uint256 amount) internal {
|
|
20
|
-
if (amount != 0
|
|
20
|
+
if (amount != 0) token.safeTransferFrom(from, to, amount);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function _transferOut(address token, address to, uint256 amount) internal {
|
|
24
24
|
if (amount == 0) return;
|
|
25
25
|
if (token == NATIVE) {
|
|
26
|
-
(bool success,) = to.call{value: amount}("");
|
|
26
|
+
(bool success, ) = to.call{value: amount}("");
|
|
27
27
|
require(success, "eth send failed");
|
|
28
28
|
} else {
|
|
29
29
|
IERC20(token).safeTransfer(to, amount);
|
|
@@ -33,7 +33,7 @@ abstract contract TokenHelper {
|
|
|
33
33
|
function _transferOut(address[] memory tokens, address to, uint256[] memory amounts) internal {
|
|
34
34
|
uint256 numTokens = tokens.length;
|
|
35
35
|
require(numTokens == amounts.length, "length mismatch");
|
|
36
|
-
for (uint256 i = 0; i < numTokens;) {
|
|
36
|
+
for (uint256 i = 0; i < numTokens; ) {
|
|
37
37
|
_transferOut(tokens[i], to, amounts[i]);
|
|
38
38
|
unchecked {
|
|
39
39
|
i++;
|
|
@@ -281,10 +281,7 @@ library LogExpMath {
|
|
|
281
281
|
// bring y_int256 to 36 decimal places, as it might overflow. Instead, we perform two 18 decimal
|
|
282
282
|
// multiplications and add the results: one with the first 18 decimals of ln_36_x, and one with the
|
|
283
283
|
// (downscaled) last 18 decimals.
|
|
284
|
-
logx_times_y = ((ln_36_x / ONE_18) *
|
|
285
|
-
y_int256 +
|
|
286
|
-
((ln_36_x % ONE_18) * y_int256) /
|
|
287
|
-
ONE_18);
|
|
284
|
+
logx_times_y = ((ln_36_x / ONE_18) * y_int256 + ((ln_36_x % ONE_18) * y_int256) / ONE_18);
|
|
288
285
|
} else {
|
|
289
286
|
logx_times_y = _ln(x_int256) * y_int256;
|
|
290
287
|
}
|
|
@@ -145,6 +145,11 @@ library PMath {
|
|
|
145
145
|
return uint32(x);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
function Uint64(uint256 x) internal pure returns (uint64) {
|
|
149
|
+
require(x <= type(uint64).max);
|
|
150
|
+
return uint64(x);
|
|
151
|
+
}
|
|
152
|
+
|
|
148
153
|
function Uint112(uint256 x) internal pure returns (uint112) {
|
|
149
154
|
require(x <= type(uint112).max);
|
|
150
155
|
return uint112(x);
|
|
@@ -160,27 +165,20 @@ library PMath {
|
|
|
160
165
|
return uint128(x);
|
|
161
166
|
}
|
|
162
167
|
|
|
163
|
-
function
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
function Uint192(uint256 x) internal pure returns (uint192) {
|
|
169
|
+
require(x <= type(uint192).max);
|
|
170
|
+
return uint192(x);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function isAApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
|
|
168
174
|
return mulDown(b, ONE - eps) <= a && a <= mulDown(b, ONE + eps);
|
|
169
175
|
}
|
|
170
176
|
|
|
171
|
-
function isAGreaterApproxB(
|
|
172
|
-
uint256 a,
|
|
173
|
-
uint256 b,
|
|
174
|
-
uint256 eps
|
|
175
|
-
) internal pure returns (bool) {
|
|
177
|
+
function isAGreaterApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
|
|
176
178
|
return a >= b && a <= mulDown(b, ONE + eps);
|
|
177
179
|
}
|
|
178
180
|
|
|
179
|
-
function isASmallerApproxB(
|
|
180
|
-
uint256 a,
|
|
181
|
-
uint256 b,
|
|
182
|
-
uint256 eps
|
|
183
|
-
) internal pure returns (bool) {
|
|
181
|
+
function isASmallerApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
|
|
184
182
|
return a <= b && a >= mulDown(b, ONE - eps);
|
|
185
183
|
}
|
|
186
184
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
interface IAaveV3AToken {
|
|
6
|
+
function UNDERLYING_ASSET_ADDRESS() external view returns (address);
|
|
7
|
+
|
|
8
|
+
function scaledBalanceOf(address user) external view returns (uint256);
|
|
9
|
+
|
|
10
|
+
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
|
|
11
|
+
|
|
12
|
+
function scaledTotalSupply() external view returns (uint256);
|
|
13
|
+
|
|
14
|
+
function getPreviousIndex(address user) external view returns (uint256);
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
interface IAaveV3Pool {
|
|
6
|
+
function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
|
|
7
|
+
|
|
8
|
+
function withdraw(address asset, uint256 amount, address to) external returns (uint256);
|
|
9
|
+
|
|
10
|
+
function getReserveNormalizedIncome(address asset) external view returns (uint256);
|
|
11
|
+
}
|
|
@@ -16,10 +16,9 @@ interface IComposableStable is IBasePool {
|
|
|
16
16
|
|
|
17
17
|
function isTokenExemptFromYieldProtocolFee(IERC20 token) external view returns (bool);
|
|
18
18
|
|
|
19
|
-
function getTokenRateCache(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
returns (uint256 rate, uint256 oldRate, uint256 duration, uint256 expires);
|
|
19
|
+
function getTokenRateCache(
|
|
20
|
+
IERC20 token
|
|
21
|
+
) external view returns (uint256 rate, uint256 oldRate, uint256 duration, uint256 expires);
|
|
23
22
|
|
|
24
23
|
function getRateProviders() external view returns (IRateProvider[] memory);
|
|
25
24
|
|