@pendle/core-v2 6.3.1 → 6.3.2-swaphubtest
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/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/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
- 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/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/PendleMerkleDistributor.sol/PendleMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol/PendleMultiTokenMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- 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/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- 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/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactoryV6Upg.sol/PendleMarketFactoryV6Upg.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketV6.sol/PendleMarketV6.dbg.json +1 -1
- 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/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYUtils.sol/SYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactoryUpg.sol/PendleYieldContractFactoryUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeableV2.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeableV2.sol/BoringOwnableUpgradeableV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/StringLib.sol/StringLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/PMath.sol/PMath.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/FixedPricePTAMM.sol/FixedPricePTAMM.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/factory/hub/PendlePTOFTAdapterFactory.sol/PendlePTOFTAdapterFactory.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/oftImpl/hub/OFTAdapterImpl.sol/OFTAdapterImpl.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/PendleBridgedPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/swap-hub/DepositBox.sol/DepositBox.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/DepositBox.sol/DepositBox.json +201 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol/PendleCrossChainSwapHub.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol/PendleCrossChainSwapHub.json +1301 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/SwapHubBase.sol/SwapHubBase.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/SwapHubBase.sol/SwapHubBase.json +1272 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/IPSwapExecutor.sol/IPSwapExecutor.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/IPSwapExecutor.sol/IPSwapExecutor.json +56 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol/SwapExecutor.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol/SwapExecutor.json +60 -0
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAddressProvider.sol/IAddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILPWrapper.sol/ILPWrapper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IMarketSweed.sol/IMarketSweed.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IMarketSweed.sol/IMarketSweed.json +141 -0
- package/build/artifacts/contracts/interfaces/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiqV3.sol/IPActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCallbackV3.sol/IPActionCallbackV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionInfoStatic.sol/IPActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSimple.sol/IPActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageV4.sol/IPActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTV3.sol/IPActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYTV3.sol/IPActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionVePendleStatic.sol/IPActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionAddRemoveLiqV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionMiscV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionStorageEvents.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapPTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapYTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPAllEventsV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBridgedPrincipalToken.sol/IPBridgedPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracle.sol/IPChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleEssential.sol/IPChainlinkOracleEssential.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleFactory.sol/IPChainlinkOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleWithQuote.sol/IPChainlinkOracleWithQuote.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPCommonPoolDeployHelperV2.sol/IPCommonPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPCommonSYFactory.sol/IPCommonSYFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPCrossChainSwapHub.sol/IPCrossChainSwapHub.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPCrossChainSwapHub.sol/IPCrossChainSwapHub.json +1135 -0
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.json +150 -0
- package/build/artifacts/contracts/interfaces/IPExchangeRateOracle.sol/IPExchangeRateOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPExchangeRateOracleApp.sol/IPExchangeRateOracleApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributorV2.sol/IPFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMM.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMMSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGovernanceProxy.sol/IPGovernanceProxy.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYTV2.sol/IPInterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLPWrapperFactory.sol/IPLPWrapperFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitOrderType.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitRouterCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMerkleDistributor.sol/IPMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMiniDiamond.sol/IPMiniDiamond.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMultiTokenMerkleDistributor.sol/IPMultiTokenMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPOffchainStorage.sol/IPOffchainStorage.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPOracleForSy.sol/IPOracleForSy.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPTOFTAdapterFactory.sol/IPPTOFTAdapterFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPYLpOracle.sol/IPPYLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPausingInterface.sol/IPPausingInterface.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPoolDeployHelperV2.sol/IPPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPriceFeed.sol/IPPriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPReflector.sol/IPReflector.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPTokenWithSupplyCap.sol/IPTokenWithSupplyCap.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldTokenV2.sol/IPYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRedstonePriceFeed.sol/IRedstonePriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/limit/LimitMathCore.sol/LimitMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/limit/LimitRouterBase.sol/LimitRouterBase.dbg.json +1 -1
- package/build/artifacts/contracts/limit/helpers/NonceManager.sol/NonceManager.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AddressProvider.sol/AddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AutomateReady.sol/AutomateReady.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AutomateReady.sol/IAutomate.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AutomateReady.sol/IOpsProxyFactory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AutomateReady.sol/ITaskTreasuryUpgradable.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BalanceReader.sol/BalanceReader.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BytesLib.sol/BytesLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/EmptyUUPS.sol/EmptyUUPS.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/ExpiredLpPtRedeemer.sol/ExpiredLpPtRedeemer.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/LegacyNFTHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/StarNFTV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LimitBackendHelperV2.sol/LimitBackendHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketSweed.sol/MarketSweed.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/MarketSweed.sol/MarketSweed.json +314 -0
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleExchangeRateOracle.sol/PendleExchangeRateOracle.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleFeeSetter.sol/PendleFeeSetter.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleGovernanceProxy.sol/PendleGovernanceProxy.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleLPWrapper.sol/PendleLPWrapper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleLPWrapperFactory.sol/PendleLPWrapperFactory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallOwnerV1.sol/PendleMulticallOwnerV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallV1.sol/PendleMulticallV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallV2.sol/PendleMulticallV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleOffchainStorage.sol/PendleOffchainStorage.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleWstETHPriceFeed.sol/PendleWstETHPriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/SimulateHelper.sol/SimulateHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/SupplyCapReader.sol/IPossibleSupplyCapInterface.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/SupplyCapReader.sol/SupplyCapReader.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonSYFactory.sol/PendleCommonSYFactory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/lib/MarketDeployLib.sol/MarketDeployLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol/SDKErrorsDirectory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtInLibV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtOutLibV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/base/PendleCrossChainOracleBaseApp_Init.sol/PendleCrossChainOracleBaseApp_Init.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/exchangeRate/PendleExchangeRateOracleApp.sol/PendleExchangeRateOracleApp.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/exchangeRate/PendleExchangeRateOracleV2.sol/PendleExchangeRateOracleV2.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/libraries/ExchangeRateMsgCodec.sol/ExchangeRateMsgCodec.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol/PendlePYLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol/PendlePYOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol/PendleChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringLpSeller.sol/BoringLpSeller.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkAssetOracle.sol/BoringPYUsdChainlinkAssetOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkSYOracle.sol/BoringPYUsdChainlinkSYOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/StatelessWrapper/PendleLinearDiscountOracleWrapper.sol/PendleLinearDiscountOracleWrapper.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/StatelessWrapper/PendleSparkLinearDiscountOracleFactoryWrapper.sol/PendleSparkLinearDiscountOracleFactoryWrapper.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleBoringOneracle.sol/PendleBoringOneracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleBoringSolvBTCOneracle.sol/PendleBoringSolvBTCOneracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleLpLinearDiscountOracle.sol/LPExpiry.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleLpLinearDiscountOracle.sol/PendleLpLinearDiscountOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleLpLinearDiscountOracleFactory.sol/PendleLpLinearDiscountOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleRedStoneRateOracleAdapter.sol/PendleRedStoneRateOracleAdapter.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PTExpiry.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PendleSparkLinearDiscountOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracleFactory.sol/PendleSparkLinearDiscountOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.dbg.json +1 -1
- package/build/artifacts/contracts/router/RouterStorage.sol/RouterStorage.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBase.sol/ActionBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxEstimateLib.sol/MarketApproxEstimateLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtInLibV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtOutLibV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/OKXScaleHelper.sol/IOKXDexRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/OKXScaleHelper.sol/OKXScaleHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/ParaswapScaleHelper.sol/IAugustusV6.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/ParaswapScaleHelper.sol/ParaswapScaleHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IKyberScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IOdosRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.json +2 -2
- package/contracts/cross-chain/swap-hub/DepositBox.sol +72 -0
- package/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol +162 -0
- package/contracts/cross-chain/swap-hub/SwapHubBase.sol +303 -0
- package/contracts/cross-chain/swap-hub/swap/IPSwapExecutor.sol +14 -0
- package/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol +33 -0
- package/contracts/interfaces/IMarketSweed.sol +23 -0
- package/contracts/interfaces/IPCrossChainSwapHub.sol +163 -0
- package/contracts/interfaces/IPDepositBox.sol +25 -0
- package/contracts/offchain-helpers/MarketSweed.sol +250 -0
- package/contracts/router/swap-aggregator/OKXScaleHelper.sol +25 -90
- package/deployments/1-core.json +2 -1
- package/deployments/10-core.json +2 -1
- package/deployments/146-core.json +2 -1
- package/deployments/42161-core.json +2 -1
- package/deployments/5000-core.json +2 -1
- package/deployments/56-core.json +2 -1
- package/deployments/80094-core.json +2 -1
- package/deployments/8453-core.json +2 -1
- package/deployments/9745-core.json +2 -1
- package/deployments/999-core.json +2 -1
- package/package.json +2 -2
- package/typechain-types/DepositBox.ts +304 -0
- package/typechain-types/IMarketSweed.ts +203 -0
- package/typechain-types/IPCrossChainSwapHub.ts +1002 -0
- package/typechain-types/IPDepositBox.ts +257 -0
- package/typechain-types/IPSwapExecutor.ts +129 -0
- package/typechain-types/MarketSweed.ts +242 -0
- package/typechain-types/PendleCrossChainSwapHub.ts +1226 -0
- package/typechain-types/SwapExecutor.ts +129 -0
- package/typechain-types/SwapHubBase.ts +1201 -0
- package/typechain-types/factories/DepositBox__factory.ts +259 -0
- package/typechain-types/factories/{IPActionCrossChain__factory.ts → IMarketSweed__factory.ts} +61 -22
- package/typechain-types/factories/IPCrossChainSwapHub__factory.ts +1152 -0
- package/typechain-types/factories/IPDepositBox__factory.ts +162 -0
- package/typechain-types/factories/IPSwapExecutor__factory.ts +71 -0
- package/typechain-types/factories/MarketSweed__factory.ts +364 -0
- package/typechain-types/factories/PendleCrossChainSwapHub__factory.ts +1372 -0
- package/typechain-types/factories/PendleSwap__factory.ts +1 -1
- package/typechain-types/factories/SwapExecutor__factory.ts +110 -0
- package/typechain-types/factories/{BasePendleBridgedPrincipalToken__factory.ts → SwapHubBase__factory.ts} +693 -955
- package/typechain-types/hardhat.d.ts +90 -54
- package/typechain-types/index.ts +18 -12
- package/typechain-types/ActionCrossChain.ts +0 -161
- package/typechain-types/ActionDelegateBase.ts +0 -57
- package/typechain-types/BasePendleBridgedPrincipalToken.ts +0 -1689
- package/typechain-types/EIP712.ts +0 -135
- package/typechain-types/ERC20Permit.ts +0 -586
- package/typechain-types/IERC5267.ts +0 -135
- package/typechain-types/IPActionCrossChain.ts +0 -161
- package/typechain-types/IPMarketFactoryV3.ts +0 -321
- package/typechain-types/IPMarketV3.ts +0 -1068
- package/typechain-types/LimitBackendHelper.ts +0 -287
- package/typechain-types/OverfillMathLib.ts +0 -81
- package/typechain-types/PendleBridgedPrincipalToken_18Decimals.ts +0 -1689
- package/typechain-types/PendleBridgedPrincipalToken_6Decimals.ts +0 -1689
- package/typechain-types/PendleBridgedPrincipalToken_8Decimals.ts +0 -1689
- package/typechain-types/PendleERC20Permit.ts +0 -508
- package/typechain-types/PendleERC20PermitUpg.ts +0 -517
- package/typechain-types/PendleERC20Upg.ts +0 -348
- package/typechain-types/PendleMarketFactoryV3.ts +0 -719
- package/typechain-types/PendleMarketV3.ts +0 -1195
- package/typechain-types/PendleYieldContractFactory.ts +0 -801
- package/typechain-types/ShortStrings.ts +0 -57
- package/typechain-types/factories/ActionCrossChain__factory.ts +0 -152
- package/typechain-types/factories/ActionDelegateBase__factory.ts +0 -80
- package/typechain-types/factories/EIP712__factory.ts +0 -85
- package/typechain-types/factories/ERC20Permit__factory.ts +0 -433
- package/typechain-types/factories/IERC5267__factory.ts +0 -72
- package/typechain-types/factories/IPMarketFactoryV3__factory.ts +0 -217
- package/typechain-types/factories/IPMarketV3__factory.ts +0 -845
- package/typechain-types/factories/LimitBackendHelper__factory.ts +0 -232
- package/typechain-types/factories/OverfillMathLib__factory.ts +0 -77
- package/typechain-types/factories/PendleBridgedPrincipalToken_18Decimals__factory.ts +0 -1652
- package/typechain-types/factories/PendleBridgedPrincipalToken_6Decimals__factory.ts +0 -1650
- package/typechain-types/factories/PendleBridgedPrincipalToken_8Decimals__factory.ts +0 -1650
- package/typechain-types/factories/PendleERC20PermitUpg__factory.ts +0 -389
- package/typechain-types/factories/PendleERC20Permit__factory.ts +0 -470
- package/typechain-types/factories/PendleERC20Upg__factory.ts +0 -261
- package/typechain-types/factories/PendleMarketFactoryV3__factory.ts +0 -714
- package/typechain-types/factories/PendleMarketV3__factory.ts +0 -1211
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +0 -674
- package/typechain-types/factories/ShortStrings__factory.ts +0 -77
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.30;
|
|
3
|
+
|
|
4
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
|
+
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
|
|
6
|
+
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
|
|
7
|
+
import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
|
|
8
|
+
import {BoringOwnableUpgradeableV2} from "../../core/libraries/BoringOwnableUpgradeableV2.sol";
|
|
9
|
+
import {TokenHelper} from "../../core/libraries/TokenHelper.sol";
|
|
10
|
+
import {IPCrossChainSwapHub} from "../../interfaces/IPCrossChainSwapHub.sol";
|
|
11
|
+
import {IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
12
|
+
import {IPSwapExecutor, SwapData} from "./swap/IPSwapExecutor.sol";
|
|
13
|
+
import {DepositBox} from "./DepositBox.sol";
|
|
14
|
+
|
|
15
|
+
abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringOwnableUpgradeableV2, TokenHelper {
|
|
16
|
+
// forgefmt: disable-next-item
|
|
17
|
+
bytes32 internal constant WITHDRAW_TOKEN_MESSAGE_TYPEHASH = keccak256(
|
|
18
|
+
"WithdrawTokenMessage("
|
|
19
|
+
"address owner,"
|
|
20
|
+
"uint32 boxId,"
|
|
21
|
+
"uint256 expiry,"
|
|
22
|
+
"uint256 nonce,"
|
|
23
|
+
//
|
|
24
|
+
"address receiver,"
|
|
25
|
+
"address token,"
|
|
26
|
+
"uint256 withdrawAmount,"
|
|
27
|
+
"uint256 feeAmount"
|
|
28
|
+
")"
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
// forgefmt: disable-next-item
|
|
32
|
+
bytes32 internal constant BRIDGE_TOKEN_MESSAGE_TYPEHASH = keccak256(
|
|
33
|
+
"BridgeTokenMessage("
|
|
34
|
+
"address owner,"
|
|
35
|
+
"uint32 boxId,"
|
|
36
|
+
"uint256 expiry,"
|
|
37
|
+
"uint256 nonce,"
|
|
38
|
+
//
|
|
39
|
+
"address token,"
|
|
40
|
+
"uint256 bridgeAmount,"
|
|
41
|
+
"uint256 feeAmount,"
|
|
42
|
+
//
|
|
43
|
+
"address bridgeExtRouter,"
|
|
44
|
+
"bytes bridgeCalldata"
|
|
45
|
+
")"
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// forgefmt: disable-next-item
|
|
49
|
+
bytes32 internal constant SWAP_TOKEN_MESSAGE_TYPEHASH = keccak256(
|
|
50
|
+
"SwapTokenMessage("
|
|
51
|
+
"address owner,"
|
|
52
|
+
"uint32 boxId,"
|
|
53
|
+
"uint256 expiry,"
|
|
54
|
+
"uint256 nonce,"
|
|
55
|
+
//
|
|
56
|
+
"address tokenSpent,"
|
|
57
|
+
"uint256 amountSpent,"
|
|
58
|
+
"address tokenReceived,"
|
|
59
|
+
"uint256 minReceived,"
|
|
60
|
+
"uint256 feeAmount,"
|
|
61
|
+
//
|
|
62
|
+
"address swapExecutor,"
|
|
63
|
+
"address swapExtRouter,"
|
|
64
|
+
"bytes swapCalldata"
|
|
65
|
+
")"
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// forgefmt: disable-next-item
|
|
69
|
+
bytes32 internal constant BUY_CROSS_CHAIN_PT_INTENT_TYPEHASH = keccak256(
|
|
70
|
+
"BuyCrossChainPtIntent("
|
|
71
|
+
"address owner,"
|
|
72
|
+
"uint32 boxId,"
|
|
73
|
+
"uint256 salt,"
|
|
74
|
+
"uint256 expiry,"
|
|
75
|
+
//
|
|
76
|
+
"address tokenSpent,"
|
|
77
|
+
"uint256 maxAmountSpent,"
|
|
78
|
+
"address pt,"
|
|
79
|
+
"address ptAdapter,"
|
|
80
|
+
"uint256 minPtReceived,"
|
|
81
|
+
"uint32 dstLzEid,"
|
|
82
|
+
"bytes32 receiver"
|
|
83
|
+
")"
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
// forgefmt: disable-next-item
|
|
87
|
+
bytes32 internal constant EXECUTE_BUY_CROSS_CHAIN_PT_MESSAGE_TYPEHASH = keccak256(
|
|
88
|
+
"ExecuteBuyCrossChainPtMessage("
|
|
89
|
+
"address validator,"
|
|
90
|
+
"bytes32 intentHash,"
|
|
91
|
+
"uint256 amountSpent,"
|
|
92
|
+
"uint256 feeAmount,"
|
|
93
|
+
"address swapExecutor,"
|
|
94
|
+
"address swapExtRouter,"
|
|
95
|
+
"bytes swapCalldata,"
|
|
96
|
+
"uint256 expiry"
|
|
97
|
+
")"
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
/// @dev creation code of OpenZeppelin's BeaconProxy
|
|
101
|
+
address public immutable BEACON_PROXY_CODE_CONTRACT;
|
|
102
|
+
address public immutable DEPOSIT_BOX_BEACON;
|
|
103
|
+
bytes32 public immutable DEPOSIT_BOX_CODE_HASH;
|
|
104
|
+
|
|
105
|
+
mapping(address owner => uint256 nonce) public ownerNonce;
|
|
106
|
+
mapping(bytes32 intentHash => bool) public isIntentExecuted;
|
|
107
|
+
mapping(address executor => bool) public isExecutor;
|
|
108
|
+
mapping(address validator => bool) public isValidator;
|
|
109
|
+
|
|
110
|
+
constructor(address beaconProxyCodeContract_, address depositBoxBeacon_) {
|
|
111
|
+
BEACON_PROXY_CODE_CONTRACT = beaconProxyCodeContract_;
|
|
112
|
+
DEPOSIT_BOX_BEACON = depositBoxBeacon_;
|
|
113
|
+
DEPOSIT_BOX_CODE_HASH =
|
|
114
|
+
keccak256(abi.encodePacked(beaconProxyCodeContract_.code, abi.encode(depositBoxBeacon_, "")));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
modifier onlyExecutor() {
|
|
118
|
+
require(isExecutor[msg.sender], "SwapHub: caller is not executor");
|
|
119
|
+
_;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function setExecutor(address executor, bool isExecutor_) external onlyOwner {
|
|
123
|
+
isExecutor[executor] = isExecutor_;
|
|
124
|
+
emit SetExecutor(executor, isExecutor_);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function setValidator(address validator, bool isValidator_) external onlyOwner {
|
|
128
|
+
isValidator[validator] = isValidator_;
|
|
129
|
+
emit SetValidator(validator, isValidator_);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function computeDepositBox(address owner, uint32 boxId) public view returns (address box, bytes32 salt) {
|
|
133
|
+
salt = keccak256(abi.encode(owner, boxId));
|
|
134
|
+
box = Create2.computeAddress(salt, DEPOSIT_BOX_CODE_HASH);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function _checkAndDeployBox(address owner, uint32 boxId) internal returns (IPDepositBox) {
|
|
138
|
+
(address box, bytes32 salt) = computeDepositBox(owner, boxId);
|
|
139
|
+
if (box.code.length > 0) {
|
|
140
|
+
return IPDepositBox(box);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
bytes memory bytecode = abi.encodePacked(BEACON_PROXY_CODE_CONTRACT.code, abi.encode(DEPOSIT_BOX_BEACON, ""));
|
|
144
|
+
assert(Create2.deploy(0, salt, bytecode) == box);
|
|
145
|
+
DepositBox(payable(box)).initialize(owner, boxId);
|
|
146
|
+
return IPDepositBox(box);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function hashTypedData(WithdrawTokenMessage memory message) public view returns (bytes32) {
|
|
150
|
+
return _hashTypedDataV4(
|
|
151
|
+
keccak256(
|
|
152
|
+
abi.encode(
|
|
153
|
+
WITHDRAW_TOKEN_MESSAGE_TYPEHASH,
|
|
154
|
+
message.owner,
|
|
155
|
+
message.boxId,
|
|
156
|
+
message.expiry,
|
|
157
|
+
message.nonce,
|
|
158
|
+
//
|
|
159
|
+
message.receiver,
|
|
160
|
+
message.token,
|
|
161
|
+
message.withdrawAmount,
|
|
162
|
+
message.feeAmount
|
|
163
|
+
)
|
|
164
|
+
)
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function hashTypedData(BridgeTokenMessage memory message) public view returns (bytes32) {
|
|
169
|
+
return _hashTypedDataV4(
|
|
170
|
+
keccak256(
|
|
171
|
+
abi.encode(
|
|
172
|
+
BRIDGE_TOKEN_MESSAGE_TYPEHASH,
|
|
173
|
+
message.owner,
|
|
174
|
+
message.boxId,
|
|
175
|
+
message.expiry,
|
|
176
|
+
message.nonce,
|
|
177
|
+
//
|
|
178
|
+
message.token,
|
|
179
|
+
message.bridgeAmount,
|
|
180
|
+
message.feeAmount,
|
|
181
|
+
//
|
|
182
|
+
message.bridgeExtRouter,
|
|
183
|
+
keccak256(message.bridgeCalldata)
|
|
184
|
+
)
|
|
185
|
+
)
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function hashTypedData(SwapTokenMessage memory message) public view returns (bytes32) {
|
|
190
|
+
return _hashTypedDataV4(
|
|
191
|
+
keccak256(
|
|
192
|
+
abi.encode(
|
|
193
|
+
SWAP_TOKEN_MESSAGE_TYPEHASH,
|
|
194
|
+
message.owner,
|
|
195
|
+
message.boxId,
|
|
196
|
+
message.expiry,
|
|
197
|
+
message.nonce,
|
|
198
|
+
//
|
|
199
|
+
message.tokenSpent,
|
|
200
|
+
message.amountSpent,
|
|
201
|
+
message.tokenReceived,
|
|
202
|
+
message.minReceived,
|
|
203
|
+
message.feeAmount,
|
|
204
|
+
//
|
|
205
|
+
message.swapExecutor,
|
|
206
|
+
message.swapExtRouter,
|
|
207
|
+
keccak256(message.swapCalldata)
|
|
208
|
+
)
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function hashTypedData(BuyCrossChainPtIntent memory intent) public view returns (bytes32) {
|
|
214
|
+
return _hashTypedDataV4(
|
|
215
|
+
keccak256(
|
|
216
|
+
abi.encode(
|
|
217
|
+
BUY_CROSS_CHAIN_PT_INTENT_TYPEHASH,
|
|
218
|
+
intent.owner,
|
|
219
|
+
intent.boxId,
|
|
220
|
+
intent.salt,
|
|
221
|
+
intent.expiry,
|
|
222
|
+
//
|
|
223
|
+
intent.tokenSpent,
|
|
224
|
+
intent.maxAmountSpent,
|
|
225
|
+
intent.pt,
|
|
226
|
+
intent.ptAdapter,
|
|
227
|
+
intent.minPtReceived,
|
|
228
|
+
intent.dstLzEid,
|
|
229
|
+
intent.receiver
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function hashTypedData(ExecuteBuyCrossChainPtMessage memory message) public view returns (bytes32) {
|
|
236
|
+
return _hashTypedDataV4(
|
|
237
|
+
keccak256(
|
|
238
|
+
abi.encode(
|
|
239
|
+
EXECUTE_BUY_CROSS_CHAIN_PT_MESSAGE_TYPEHASH,
|
|
240
|
+
message.validator,
|
|
241
|
+
message.intentHash,
|
|
242
|
+
message.amountSpent,
|
|
243
|
+
message.feeAmount,
|
|
244
|
+
message.swapExecutor,
|
|
245
|
+
message.swapExtRouter,
|
|
246
|
+
keccak256(message.swapCalldata),
|
|
247
|
+
message.expiry
|
|
248
|
+
)
|
|
249
|
+
)
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function _verifyOwnerSigAndNonce(
|
|
254
|
+
address owner,
|
|
255
|
+
uint256 expiry,
|
|
256
|
+
uint256 nonce,
|
|
257
|
+
bytes32 messageHash,
|
|
258
|
+
bytes memory signature
|
|
259
|
+
) internal {
|
|
260
|
+
_verifyOwnerSig(owner, expiry, messageHash, signature);
|
|
261
|
+
_verifyAndIncreaseNonce(owner, nonce);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function _verifyOwnerSig(address owner, uint256 expiry, bytes32 messageHash, bytes memory signature) internal view {
|
|
265
|
+
require(SignatureChecker.isValidSignatureNow(owner, messageHash, signature), InvalidSignature());
|
|
266
|
+
require(expiry > block.timestamp, MessageExpired());
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function _verifyAndIncreaseNonce(address owner, uint256 nonce) internal {
|
|
270
|
+
require(ownerNonce[owner] < nonce, InvalidNonce());
|
|
271
|
+
ownerNonce[owner] = nonce;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function _verifyValidatorSig(address validator, uint256 expiry, bytes32 messageHash, bytes memory signature)
|
|
275
|
+
internal
|
|
276
|
+
view
|
|
277
|
+
{
|
|
278
|
+
require(SignatureChecker.isValidSignatureNow(validator, messageHash, signature), InvalidSignature());
|
|
279
|
+
require(isValidator[validator], InvalidValidator());
|
|
280
|
+
require(expiry > block.timestamp, MessageExpired());
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function _verifyIntentHashAndMarkExecuted(bytes32 expectedHash, bytes32 actualHash) internal {
|
|
284
|
+
require(expectedHash == actualHash, IntentHashMismatch());
|
|
285
|
+
require(!isIntentExecuted[actualHash], IntentExecuted());
|
|
286
|
+
isIntentExecuted[actualHash] = true;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function _balanceOf(address addr, address token) internal view returns (uint256) {
|
|
290
|
+
return (token == NATIVE) ? addr.balance : IERC20(token).balanceOf(addr);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function _swapFromBox(IPDepositBox box, address swapExecutor, SwapData memory swapData)
|
|
294
|
+
internal
|
|
295
|
+
returns (uint256 rawTokenOut)
|
|
296
|
+
{
|
|
297
|
+
box.withdrawTo(swapExecutor, swapData.tokenIn, swapData.amountIn);
|
|
298
|
+
|
|
299
|
+
uint256 preBalance = _balanceOf(address(box), swapData.tokenOut);
|
|
300
|
+
IPSwapExecutor(swapExecutor).swap(address(box), swapData);
|
|
301
|
+
rawTokenOut = _balanceOf(address(box), swapData.tokenOut) - preBalance;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
struct SwapData {
|
|
5
|
+
address tokenIn;
|
|
6
|
+
uint256 amountIn;
|
|
7
|
+
address tokenOut;
|
|
8
|
+
address extRouter;
|
|
9
|
+
bytes extCalldata;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface IPSwapExecutor {
|
|
13
|
+
function swap(address receiver, SwapData memory swapData) external payable;
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.30;
|
|
3
|
+
|
|
4
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
|
+
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
6
|
+
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
7
|
+
import {TokenHelper} from "../../../core/libraries/TokenHelper.sol";
|
|
8
|
+
import {IPSwapExecutor, SwapData} from "./IPSwapExecutor.sol";
|
|
9
|
+
|
|
10
|
+
contract SwapExecutor is IPSwapExecutor, TokenHelper {
|
|
11
|
+
using Address for address;
|
|
12
|
+
using SafeERC20 for IERC20;
|
|
13
|
+
|
|
14
|
+
function swap(address receiver, SwapData memory $) external payable {
|
|
15
|
+
_approveForExtRouter($.tokenIn, $.extRouter);
|
|
16
|
+
$.extRouter.functionCallWithValue($.extCalldata, $.tokenIn == NATIVE ? $.amountIn : 0);
|
|
17
|
+
_transferOut($.tokenOut, receiver, _selfBalance($.tokenOut));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function _approveForExtRouter(address token, address extRouter) internal {
|
|
21
|
+
if (token == NATIVE) return;
|
|
22
|
+
|
|
23
|
+
_safeApproveInfV2(IERC20(token), extRouter);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function _safeApproveInfV2(IERC20 token, address spender) internal {
|
|
27
|
+
if (token.allowance(address(this), spender) < type(uint256).max) {
|
|
28
|
+
token.forceApprove(spender, type(uint256).max);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
receive() external payable {}
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "./IPAllActionV3.sol";
|
|
5
|
+
|
|
6
|
+
interface IMarketSweed {
|
|
7
|
+
struct ApproxSweedParams {
|
|
8
|
+
uint256 targetLnImpliedRate;
|
|
9
|
+
uint256 eps;
|
|
10
|
+
uint256 maxPtToSwap;
|
|
11
|
+
int256 guessOffchain;
|
|
12
|
+
uint256 maxIteration;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function seedAtImpliedRate(
|
|
16
|
+
address receiver,
|
|
17
|
+
address market,
|
|
18
|
+
uint256 minLpOut,
|
|
19
|
+
uint256 minYtOut,
|
|
20
|
+
TokenInput calldata input,
|
|
21
|
+
ApproxSweedParams calldata sweedParams
|
|
22
|
+
) external payable returns (uint256 netLpOut, uint256 netYtOut, int256 guessedAmountPtToSwap);
|
|
23
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
interface IPCrossChainSwapHub {
|
|
5
|
+
error ExcessiveNativeFee();
|
|
6
|
+
error InsufficientTokenReceived();
|
|
7
|
+
error InvalidAmountIn();
|
|
8
|
+
error InvalidNonce();
|
|
9
|
+
error InvalidSignature();
|
|
10
|
+
error InvalidValidator();
|
|
11
|
+
error IntentExecuted();
|
|
12
|
+
error IntentHashMismatch();
|
|
13
|
+
error MessageExpired();
|
|
14
|
+
|
|
15
|
+
struct WithdrawTokenMessage {
|
|
16
|
+
address owner;
|
|
17
|
+
uint32 boxId;
|
|
18
|
+
uint256 expiry;
|
|
19
|
+
uint256 nonce;
|
|
20
|
+
//
|
|
21
|
+
address receiver;
|
|
22
|
+
address token;
|
|
23
|
+
uint256 withdrawAmount;
|
|
24
|
+
uint256 feeAmount;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
struct BridgeTokenMessage {
|
|
28
|
+
address owner;
|
|
29
|
+
uint32 boxId;
|
|
30
|
+
uint256 expiry;
|
|
31
|
+
uint256 nonce;
|
|
32
|
+
//
|
|
33
|
+
address token;
|
|
34
|
+
uint256 bridgeAmount;
|
|
35
|
+
uint256 feeAmount;
|
|
36
|
+
//
|
|
37
|
+
address bridgeExtRouter;
|
|
38
|
+
bytes bridgeCalldata;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
struct SwapTokenMessage {
|
|
42
|
+
address owner;
|
|
43
|
+
uint32 boxId;
|
|
44
|
+
uint256 expiry;
|
|
45
|
+
uint256 nonce;
|
|
46
|
+
//
|
|
47
|
+
address tokenSpent;
|
|
48
|
+
uint256 amountSpent;
|
|
49
|
+
address tokenReceived;
|
|
50
|
+
uint256 minReceived;
|
|
51
|
+
uint256 feeAmount;
|
|
52
|
+
//
|
|
53
|
+
address swapExecutor;
|
|
54
|
+
address swapExtRouter;
|
|
55
|
+
bytes swapCalldata;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
struct BuyCrossChainPtIntent {
|
|
59
|
+
address owner;
|
|
60
|
+
uint32 boxId;
|
|
61
|
+
uint256 salt;
|
|
62
|
+
uint256 expiry;
|
|
63
|
+
//
|
|
64
|
+
address tokenSpent;
|
|
65
|
+
uint256 maxAmountSpent;
|
|
66
|
+
address pt;
|
|
67
|
+
address ptAdapter;
|
|
68
|
+
uint256 minPtReceived;
|
|
69
|
+
uint32 dstLzEid;
|
|
70
|
+
bytes32 receiver;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
struct ExecuteBuyCrossChainPtMessage {
|
|
74
|
+
address validator;
|
|
75
|
+
bytes32 intentHash;
|
|
76
|
+
uint256 amountSpent;
|
|
77
|
+
uint256 feeAmount;
|
|
78
|
+
address swapExecutor;
|
|
79
|
+
address swapExtRouter;
|
|
80
|
+
bytes swapCalldata;
|
|
81
|
+
uint256 expiry;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
event WithdrawToken(
|
|
85
|
+
address indexed owner, uint32 boxId, address receiver, address token, uint256 withdrawAmount, uint256 feeAmount
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
event BridgeToken(
|
|
89
|
+
address indexed owner,
|
|
90
|
+
uint32 boxId,
|
|
91
|
+
address bridgeExtRouter,
|
|
92
|
+
address token,
|
|
93
|
+
uint256 bridgeAmount,
|
|
94
|
+
uint256 feeAmount
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
event SwapToken(
|
|
98
|
+
address indexed owner,
|
|
99
|
+
uint32 boxId,
|
|
100
|
+
address tokenSpent,
|
|
101
|
+
uint256 amountSpent,
|
|
102
|
+
address tokenReceived,
|
|
103
|
+
uint256 netTokenReceived
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
event BuyCrossChainPt(
|
|
107
|
+
address indexed owner,
|
|
108
|
+
uint32 boxId,
|
|
109
|
+
bytes32 intentHash,
|
|
110
|
+
address tokenSpent,
|
|
111
|
+
uint256 amountSpent,
|
|
112
|
+
address pt,
|
|
113
|
+
address ptAdapter,
|
|
114
|
+
uint256 netPtReceived
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
event SetExecutor(address indexed executor, bool isExecutor);
|
|
118
|
+
|
|
119
|
+
event SetValidator(address indexed validator, bool isValidator);
|
|
120
|
+
|
|
121
|
+
function BEACON_PROXY_CODE_CONTRACT() external view returns (address);
|
|
122
|
+
|
|
123
|
+
function DEPOSIT_BOX_BEACON() external view returns (address);
|
|
124
|
+
|
|
125
|
+
function DEPOSIT_BOX_CODE_HASH() external view returns (bytes32);
|
|
126
|
+
|
|
127
|
+
function ownerNonce(address owner) external view returns (uint256);
|
|
128
|
+
|
|
129
|
+
function isIntentExecuted(bytes32 intentHash) external view returns (bool);
|
|
130
|
+
|
|
131
|
+
function isExecutor(address executor) external view returns (bool);
|
|
132
|
+
|
|
133
|
+
function isValidator(address validator) external view returns (bool);
|
|
134
|
+
|
|
135
|
+
function computeDepositBox(address owner, uint32 boxId) external view returns (address box, bytes32 salt);
|
|
136
|
+
|
|
137
|
+
function hashTypedData(WithdrawTokenMessage memory message) external view returns (bytes32);
|
|
138
|
+
|
|
139
|
+
function hashTypedData(BridgeTokenMessage memory message) external view returns (bytes32);
|
|
140
|
+
|
|
141
|
+
function hashTypedData(SwapTokenMessage memory message) external view returns (bytes32);
|
|
142
|
+
|
|
143
|
+
function hashTypedData(BuyCrossChainPtIntent memory intent) external view returns (bytes32);
|
|
144
|
+
|
|
145
|
+
function hashTypedData(ExecuteBuyCrossChainPtMessage memory message) external view returns (bytes32);
|
|
146
|
+
|
|
147
|
+
function withdrawToken(WithdrawTokenMessage memory message, bytes memory signature) external;
|
|
148
|
+
|
|
149
|
+
function bridgeToken(BridgeTokenMessage memory message, bytes memory signature) external payable;
|
|
150
|
+
|
|
151
|
+
function swapToken(SwapTokenMessage memory message, bytes memory signature) external;
|
|
152
|
+
|
|
153
|
+
function buyCrossChainPt(
|
|
154
|
+
BuyCrossChainPtIntent memory intent,
|
|
155
|
+
bytes memory intentSig,
|
|
156
|
+
ExecuteBuyCrossChainPtMessage memory execMsg,
|
|
157
|
+
bytes memory execSig
|
|
158
|
+
) external payable;
|
|
159
|
+
|
|
160
|
+
function setExecutor(address executor, bool isExecutor) external;
|
|
161
|
+
|
|
162
|
+
function setValidator(address validator, bool isValidator) external;
|
|
163
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
struct ApprovedCall {
|
|
5
|
+
address token;
|
|
6
|
+
uint256 amount;
|
|
7
|
+
address spender;
|
|
8
|
+
bytes data;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface IPDepositBox {
|
|
12
|
+
function HUB() external view returns (address);
|
|
13
|
+
|
|
14
|
+
function TREASURY() external view returns (address);
|
|
15
|
+
|
|
16
|
+
function OWNER() external view returns (address);
|
|
17
|
+
|
|
18
|
+
function BOX_ID() external view returns (uint32);
|
|
19
|
+
|
|
20
|
+
function payTreasury(address token, uint256 amount) external;
|
|
21
|
+
|
|
22
|
+
function withdrawTo(address to, address token, uint256 amount) external;
|
|
23
|
+
|
|
24
|
+
function approveAndCall(ApprovedCall memory call, address nativeRefund) external payable returns (bytes memory);
|
|
25
|
+
}
|