@pendle/core-v2 6.4.1 → 6.4.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 +170 -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 +1214 -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 +1176 -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 +1 -1
- 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/IPActionCrossChain.sol/IPActionCrossChain.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 +1026 -0
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.json +124 -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 +1 -1
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleAPIFeeDepositor.sol/PendleAPIFeeDepositor.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/PendleMerkleDepositor.sol/PendleMerkleDepositor.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/ActionCrossChain.sol/ActionCrossChain.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/contracts/cross-chain/swap-hub/DepositBox.sol +66 -0
- package/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol +178 -0
- package/contracts/cross-chain/swap-hub/SwapHubBase.sol +274 -0
- package/contracts/interfaces/IPCrossChainSwapHub.sol +147 -0
- package/contracts/interfaces/IPDepositBox.sol +22 -0
- package/deployments/999-core.json +5 -5
- package/package.json +2 -2
- package/typechain-types/DepositBox.ts +260 -0
- package/typechain-types/IPCrossChainSwapHub.ts +882 -0
- package/typechain-types/IPDepositBox.ts +213 -0
- package/typechain-types/PendleCrossChainSwapHub.ts +1119 -0
- package/typechain-types/SwapHubBase.ts +1094 -0
- package/typechain-types/factories/DepositBox__factory.ts +222 -0
- package/typechain-types/factories/IPCrossChainSwapHub__factory.ts +1041 -0
- package/typechain-types/factories/IPDepositBox__factory.ts +136 -0
- package/typechain-types/factories/PendleCrossChainSwapHub__factory.ts +1287 -0
- package/typechain-types/factories/SwapHubBase__factory.ts +1188 -0
- package/typechain-types/hardhat.d.ts +54 -36
- package/typechain-types/index.ts +10 -8
- 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/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/ActionDelegateBase__factory.ts +0 -80
- package/typechain-types/factories/BasePendleBridgedPrincipalToken__factory.ts +0 -1548
- 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,66 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.30;
|
|
3
|
+
|
|
4
|
+
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
|
5
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
6
|
+
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
7
|
+
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
8
|
+
import {TokenHelper} from "../../core/libraries/TokenHelper.sol";
|
|
9
|
+
import {ApprovedCall, IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
10
|
+
|
|
11
|
+
contract DepositBox is IPDepositBox, TokenHelper, Initializable {
|
|
12
|
+
using Address for address;
|
|
13
|
+
using SafeERC20 for IERC20;
|
|
14
|
+
|
|
15
|
+
address public immutable MANAGER;
|
|
16
|
+
address public OWNER;
|
|
17
|
+
uint32 public BOX_ID;
|
|
18
|
+
|
|
19
|
+
constructor(address manager_) {
|
|
20
|
+
_disableInitializers();
|
|
21
|
+
MANAGER = manager_;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
modifier onlyManager() {
|
|
25
|
+
require(msg.sender == MANAGER, "DepositBox: caller is not manager");
|
|
26
|
+
_;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function initialize(address owner_, uint32 boxId_) external initializer {
|
|
30
|
+
OWNER = owner_;
|
|
31
|
+
BOX_ID = boxId_;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function withdrawTo(address to, address token, uint256 amount) external onlyManager {
|
|
35
|
+
_transferOut(token, to, amount);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function approveAndCall(ApprovedCall memory call, address nativeRefund)
|
|
39
|
+
external
|
|
40
|
+
payable
|
|
41
|
+
onlyManager
|
|
42
|
+
returns (bytes memory result)
|
|
43
|
+
{
|
|
44
|
+
uint256 nativeAmount = call.token == NATIVE ? call.amount : 0;
|
|
45
|
+
uint256 nativeFee = msg.value;
|
|
46
|
+
|
|
47
|
+
uint256 initialNativeBalance = _selfBalance(NATIVE) - nativeAmount - nativeFee;
|
|
48
|
+
|
|
49
|
+
_approveForExtRouter(call.token, call.approveTo, call.amount);
|
|
50
|
+
result = call.callTo.functionCallWithValue(call.data, nativeAmount + nativeFee);
|
|
51
|
+
_approveForExtRouter(call.token, call.approveTo, 0);
|
|
52
|
+
|
|
53
|
+
uint256 finalNativeBalance = _selfBalance(NATIVE);
|
|
54
|
+
|
|
55
|
+
if (finalNativeBalance > initialNativeBalance) {
|
|
56
|
+
_transferOut(NATIVE, nativeRefund, finalNativeBalance - initialNativeBalance);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _approveForExtRouter(address token, address extRouter, uint256 amount) internal {
|
|
61
|
+
if (token == NATIVE) return;
|
|
62
|
+
IERC20(token).forceApprove(extRouter, amount);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
receive() external payable {}
|
|
66
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.30;
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
IOFT,
|
|
6
|
+
MessagingFee,
|
|
7
|
+
MessagingReceipt,
|
|
8
|
+
OFTReceipt,
|
|
9
|
+
SendParam
|
|
10
|
+
} from "@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol";
|
|
11
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
12
|
+
import {ApprovedCall, IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
13
|
+
import {SwapHubBase} from "./SwapHubBase.sol";
|
|
14
|
+
|
|
15
|
+
contract PendleCrossChainSwapHub is SwapHubBase {
|
|
16
|
+
constructor(address treasury_, address beaconProxyCodeContract_, address depositBoxBeacon_)
|
|
17
|
+
SwapHubBase(treasury_, beaconProxyCodeContract_, depositBoxBeacon_)
|
|
18
|
+
{
|
|
19
|
+
_disableInitializers();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function initialize(address _owner) external initializer {
|
|
23
|
+
__EIP712_init("Pendle Cross Chain Swap Hub", "1");
|
|
24
|
+
__BoringOwnableV2_init(_owner);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function withdrawToken(WithdrawTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
28
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
29
|
+
|
|
30
|
+
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
31
|
+
_payTreasury(box, ms.token, ms.amountFee);
|
|
32
|
+
_withdrawToken(ms, box);
|
|
33
|
+
|
|
34
|
+
emit WithdrawToken(ms.owner, ms.boxId, ms.token, ms.amountWithdraw, ms.amountFee);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function bridgeToken(BridgeTokenMessage memory ms, bytes memory sig) external payable onlyExecutor {
|
|
38
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
39
|
+
|
|
40
|
+
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
41
|
+
_pullToken(ms.pullFromOwner, box, ms.owner, ms.token, ms.amountBridge + ms.amountFee);
|
|
42
|
+
_payTreasury(box, ms.token, ms.amountFee);
|
|
43
|
+
_bridgeToken(ms, box, msg.value);
|
|
44
|
+
|
|
45
|
+
emit BridgeToken(
|
|
46
|
+
ms.owner, ms.boxId, ms.bridgeExtRouter, ms.token, ms.amountBridge, ms.amountFee, ms.pullFromOwner
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function swapToken(SwapTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
51
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
52
|
+
|
|
53
|
+
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
54
|
+
_pullToken(ms.pullFromOwner, box, ms.owner, ms.tokenSpent, ms.amountSpent + ms.amountFee);
|
|
55
|
+
_payTreasury(box, ms.tokenSpent, ms.amountFee);
|
|
56
|
+
|
|
57
|
+
uint256 netTokenReceived = _swapToken(ms, box);
|
|
58
|
+
require(netTokenReceived >= ms.minReceived, InsufficientTokenReceived());
|
|
59
|
+
|
|
60
|
+
emit SwapToken(
|
|
61
|
+
ms.owner,
|
|
62
|
+
ms.boxId,
|
|
63
|
+
ms.tokenSpent,
|
|
64
|
+
ms.amountSpent,
|
|
65
|
+
ms.amountFee,
|
|
66
|
+
ms.tokenReceived,
|
|
67
|
+
netTokenReceived,
|
|
68
|
+
ms.pullFromOwner,
|
|
69
|
+
ms.sendToOwner
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function buyCrossChainPt(BuyCrossChainPtMessage memory ms, bytes memory sig) external payable onlyExecutor {
|
|
74
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
75
|
+
|
|
76
|
+
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
77
|
+
_pullToken(ms.pullFromOwner, box, ms.owner, ms.tokenSpent, ms.amountSpent + ms.amountFee);
|
|
78
|
+
_payTreasury(box, ms.tokenSpent, ms.amountFee);
|
|
79
|
+
|
|
80
|
+
address pt = IOFT(ms.ptAdapter).token();
|
|
81
|
+
uint256 netPtReceived = _buyPtAndBridge(ms, box, pt, msg.value, msg.sender);
|
|
82
|
+
require(netPtReceived >= ms.minPtReceived, InsufficientTokenReceived());
|
|
83
|
+
|
|
84
|
+
emit BuyCrossChainPt(
|
|
85
|
+
ms.owner,
|
|
86
|
+
ms.boxId,
|
|
87
|
+
ms.tokenSpent,
|
|
88
|
+
ms.amountSpent,
|
|
89
|
+
ms.amountFee,
|
|
90
|
+
ms.ptAdapter,
|
|
91
|
+
pt,
|
|
92
|
+
netPtReceived,
|
|
93
|
+
ms.pullFromOwner
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function _pullToken(bool pullFromOwner, IPDepositBox box, address owner, address token, uint256 amount) internal {
|
|
98
|
+
if (pullFromOwner) {
|
|
99
|
+
_transferFrom(IERC20(token), owner, address(box), amount);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function _payTreasury(IPDepositBox box, address token, uint256 amount) internal {
|
|
104
|
+
box.withdrawTo(TREASURY, token, amount);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function _withdrawToken(WithdrawTokenMessage memory ms, IPDepositBox box) internal {
|
|
108
|
+
box.withdrawTo(ms.owner, ms.token, ms.amountWithdraw);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function _bridgeToken(BridgeTokenMessage memory ms, IPDepositBox box, uint256 nativeFee) internal {
|
|
112
|
+
ApprovedCall memory call = ApprovedCall({
|
|
113
|
+
token: ms.token,
|
|
114
|
+
amount: ms.amountBridge,
|
|
115
|
+
approveTo: ms.bridgeApprove,
|
|
116
|
+
callTo: ms.bridgeExtRouter,
|
|
117
|
+
data: ms.bridgeCalldata
|
|
118
|
+
});
|
|
119
|
+
box.approveAndCall{value: nativeFee}(call, msg.sender);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function _swapToken(SwapTokenMessage memory ms, IPDepositBox box) internal returns (uint256 rawTokenReceived) {
|
|
123
|
+
rawTokenReceived = _swapFromBox({
|
|
124
|
+
box: box,
|
|
125
|
+
tokenSpent: ms.tokenSpent,
|
|
126
|
+
amountSpent: ms.amountSpent,
|
|
127
|
+
tokenReceived: ms.tokenReceived,
|
|
128
|
+
swapExtRouter: ms.swapExtRouter,
|
|
129
|
+
swapApprove: ms.swapApprove,
|
|
130
|
+
swapCalldata: ms.swapCalldata,
|
|
131
|
+
receiver: ms.sendToOwner ? ms.owner : address(box)
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function _buyPtAndBridge(
|
|
136
|
+
BuyCrossChainPtMessage memory ms,
|
|
137
|
+
IPDepositBox box,
|
|
138
|
+
address pt,
|
|
139
|
+
uint256 nativeFee,
|
|
140
|
+
address nativeRefund
|
|
141
|
+
) internal returns (uint256 netPtReceived) {
|
|
142
|
+
require(ms.receiver == _addressToBytes32(ms.owner), InvalidReceiver());
|
|
143
|
+
|
|
144
|
+
uint256 rawPtReceived = _swapFromBox({
|
|
145
|
+
box: box,
|
|
146
|
+
tokenSpent: ms.tokenSpent,
|
|
147
|
+
amountSpent: ms.amountSpent,
|
|
148
|
+
tokenReceived: pt,
|
|
149
|
+
swapExtRouter: ms.swapExtRouter,
|
|
150
|
+
swapApprove: ms.swapApprove,
|
|
151
|
+
swapCalldata: ms.swapCalldata,
|
|
152
|
+
receiver: address(box)
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
SendParam memory sendParam = SendParam({
|
|
156
|
+
dstEid: ms.dstEid,
|
|
157
|
+
to: ms.receiver,
|
|
158
|
+
amountLD: rawPtReceived,
|
|
159
|
+
minAmountLD: 0,
|
|
160
|
+
extraOptions: "",
|
|
161
|
+
composeMsg: "",
|
|
162
|
+
oftCmd: ""
|
|
163
|
+
});
|
|
164
|
+
MessagingFee memory sendFee = MessagingFee({nativeFee: nativeFee, lzTokenFee: 0});
|
|
165
|
+
ApprovedCall memory call = ApprovedCall({
|
|
166
|
+
token: pt,
|
|
167
|
+
amount: rawPtReceived,
|
|
168
|
+
approveTo: ms.ptAdapter,
|
|
169
|
+
callTo: ms.ptAdapter,
|
|
170
|
+
data: abi.encodeCall(IOFT.send, (sendParam, sendFee, nativeRefund))
|
|
171
|
+
});
|
|
172
|
+
(, OFTReceipt memory oftReceipt) =
|
|
173
|
+
abi.decode(box.approveAndCall{value: nativeFee}(call, nativeRefund), (MessagingReceipt, OFTReceipt));
|
|
174
|
+
netPtReceived = oftReceipt.amountReceivedLD;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
receive() external payable {}
|
|
178
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.30;
|
|
3
|
+
|
|
4
|
+
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
|
|
5
|
+
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
|
|
6
|
+
import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
|
|
7
|
+
import {BoringOwnableUpgradeableV2} from "../../core/libraries/BoringOwnableUpgradeableV2.sol";
|
|
8
|
+
import {TokenHelper} from "../../core/libraries/TokenHelper.sol";
|
|
9
|
+
import {IPCrossChainSwapHub} from "../../interfaces/IPCrossChainSwapHub.sol";
|
|
10
|
+
import {ApprovedCall, IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
11
|
+
import {DepositBox} from "./DepositBox.sol";
|
|
12
|
+
|
|
13
|
+
abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringOwnableUpgradeableV2, TokenHelper {
|
|
14
|
+
// forgefmt: disable-next-item
|
|
15
|
+
bytes32 internal constant WITHDRAW_TOKEN_MESSAGE_TYPEHASH = keccak256(
|
|
16
|
+
"WithdrawTokenMessage("
|
|
17
|
+
"address owner,"
|
|
18
|
+
"uint32 boxId,"
|
|
19
|
+
"uint256 expiry,"
|
|
20
|
+
"uint256 nonce,"
|
|
21
|
+
//
|
|
22
|
+
"address token,"
|
|
23
|
+
"uint256 amountWithdraw,"
|
|
24
|
+
"uint256 amountFee"
|
|
25
|
+
")"
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
// forgefmt: disable-next-item
|
|
29
|
+
bytes32 internal constant BRIDGE_TOKEN_MESSAGE_TYPEHASH = keccak256(
|
|
30
|
+
"BridgeTokenMessage("
|
|
31
|
+
"address owner,"
|
|
32
|
+
"uint32 boxId,"
|
|
33
|
+
"uint256 expiry,"
|
|
34
|
+
"uint256 nonce,"
|
|
35
|
+
//
|
|
36
|
+
"address token,"
|
|
37
|
+
"uint256 amountBridge,"
|
|
38
|
+
"uint256 amountFee,"
|
|
39
|
+
"bool pullFromOwner,"
|
|
40
|
+
//
|
|
41
|
+
"address bridgeExtRouter,"
|
|
42
|
+
"address bridgeApprove,"
|
|
43
|
+
"bytes bridgeCalldata"
|
|
44
|
+
")"
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// forgefmt: disable-next-item
|
|
48
|
+
bytes32 internal constant SWAP_TOKEN_MESSAGE_TYPEHASH = keccak256(
|
|
49
|
+
"SwapTokenMessage("
|
|
50
|
+
"address owner,"
|
|
51
|
+
"uint32 boxId,"
|
|
52
|
+
"uint256 expiry,"
|
|
53
|
+
"uint256 nonce,"
|
|
54
|
+
//
|
|
55
|
+
"address tokenSpent,"
|
|
56
|
+
"uint256 amountSpent,"
|
|
57
|
+
"uint256 amountFee,"
|
|
58
|
+
"address tokenReceived,"
|
|
59
|
+
"uint256 minReceived,"
|
|
60
|
+
"bool pullFromOwner,"
|
|
61
|
+
"bool sendToOwner,"
|
|
62
|
+
//
|
|
63
|
+
"address swapExtRouter,"
|
|
64
|
+
"address swapApprove,"
|
|
65
|
+
"bytes swapCalldata"
|
|
66
|
+
")"
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// forgefmt: disable-next-item
|
|
70
|
+
bytes32 internal constant BUY_CROSS_CHAIN_PT_MESSAGE_TYPEHASH = keccak256(
|
|
71
|
+
"BuyCrossChainPtMessage("
|
|
72
|
+
"address owner,"
|
|
73
|
+
"uint32 boxId,"
|
|
74
|
+
"uint256 expiry,"
|
|
75
|
+
"uint256 nonce,"
|
|
76
|
+
//
|
|
77
|
+
"address tokenSpent,"
|
|
78
|
+
"uint256 amountSpent,"
|
|
79
|
+
"uint256 amountFee,"
|
|
80
|
+
"address ptAdapter,"
|
|
81
|
+
"uint256 minPtReceived,"
|
|
82
|
+
"uint32 dstEid,"
|
|
83
|
+
"bytes32 receiver,"
|
|
84
|
+
"bool pullFromOwner,"
|
|
85
|
+
//
|
|
86
|
+
"address swapExtRouter,"
|
|
87
|
+
"address swapApprove,"
|
|
88
|
+
"bytes swapCalldata"
|
|
89
|
+
")"
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
address public immutable TREASURY;
|
|
93
|
+
|
|
94
|
+
/// @dev creation code of OpenZeppelin's BeaconProxy
|
|
95
|
+
address public immutable BEACON_PROXY_CODE_CONTRACT;
|
|
96
|
+
address public immutable DEPOSIT_BOX_BEACON;
|
|
97
|
+
bytes32 public immutable DEPOSIT_BOX_CODE_HASH;
|
|
98
|
+
|
|
99
|
+
mapping(address owner => uint256 nonce) public ownerNonce;
|
|
100
|
+
mapping(address executor => bool) public isExecutor;
|
|
101
|
+
|
|
102
|
+
constructor(address treasury_, address beaconProxyCodeContract_, address depositBoxBeacon_) {
|
|
103
|
+
TREASURY = treasury_;
|
|
104
|
+
BEACON_PROXY_CODE_CONTRACT = beaconProxyCodeContract_;
|
|
105
|
+
DEPOSIT_BOX_BEACON = depositBoxBeacon_;
|
|
106
|
+
DEPOSIT_BOX_CODE_HASH =
|
|
107
|
+
keccak256(abi.encodePacked(beaconProxyCodeContract_.code, abi.encode(depositBoxBeacon_, "")));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
modifier onlyExecutor() {
|
|
111
|
+
require(isExecutor[msg.sender], "SwapHub: caller is not executor");
|
|
112
|
+
_;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function setExecutor(address executor, bool isExecutor_) external onlyOwner {
|
|
116
|
+
isExecutor[executor] = isExecutor_;
|
|
117
|
+
emit SetExecutor(executor, isExecutor_);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function computeDepositBox(address owner, uint32 boxId)
|
|
121
|
+
public
|
|
122
|
+
view
|
|
123
|
+
returns (address box, bytes32 salt, bool deployed)
|
|
124
|
+
{
|
|
125
|
+
salt = keccak256(abi.encode(owner, boxId));
|
|
126
|
+
box = Create2.computeAddress(salt, DEPOSIT_BOX_CODE_HASH);
|
|
127
|
+
deployed = box.code.length > 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function _checkAndDeployBox(address owner, uint32 boxId) internal returns (IPDepositBox) {
|
|
131
|
+
(address box, bytes32 salt, bool deployed) = computeDepositBox(owner, boxId);
|
|
132
|
+
if (deployed) {
|
|
133
|
+
return IPDepositBox(box);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
bytes memory bytecode = abi.encodePacked(BEACON_PROXY_CODE_CONTRACT.code, abi.encode(DEPOSIT_BOX_BEACON, ""));
|
|
137
|
+
assert(Create2.deploy(0, salt, bytecode) == box);
|
|
138
|
+
DepositBox(payable(box)).initialize(owner, boxId);
|
|
139
|
+
return IPDepositBox(box);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function hashTypedData(WithdrawTokenMessage memory message) public view returns (bytes32) {
|
|
143
|
+
return _hashTypedDataV4(
|
|
144
|
+
keccak256(
|
|
145
|
+
abi.encode(
|
|
146
|
+
WITHDRAW_TOKEN_MESSAGE_TYPEHASH,
|
|
147
|
+
message.owner,
|
|
148
|
+
message.boxId,
|
|
149
|
+
message.expiry,
|
|
150
|
+
message.nonce,
|
|
151
|
+
//
|
|
152
|
+
message.token,
|
|
153
|
+
message.amountWithdraw,
|
|
154
|
+
message.amountFee
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function hashTypedData(BridgeTokenMessage memory message) public view returns (bytes32) {
|
|
161
|
+
return _hashTypedDataV4(
|
|
162
|
+
keccak256(
|
|
163
|
+
abi.encode(
|
|
164
|
+
BRIDGE_TOKEN_MESSAGE_TYPEHASH,
|
|
165
|
+
message.owner,
|
|
166
|
+
message.boxId,
|
|
167
|
+
message.expiry,
|
|
168
|
+
message.nonce,
|
|
169
|
+
//
|
|
170
|
+
message.token,
|
|
171
|
+
message.amountBridge,
|
|
172
|
+
message.amountFee,
|
|
173
|
+
message.pullFromOwner,
|
|
174
|
+
//
|
|
175
|
+
message.bridgeExtRouter,
|
|
176
|
+
message.bridgeApprove,
|
|
177
|
+
keccak256(message.bridgeCalldata)
|
|
178
|
+
)
|
|
179
|
+
)
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function hashTypedData(SwapTokenMessage memory message) public view returns (bytes32) {
|
|
184
|
+
return _hashTypedDataV4(
|
|
185
|
+
keccak256(
|
|
186
|
+
abi.encode(
|
|
187
|
+
SWAP_TOKEN_MESSAGE_TYPEHASH,
|
|
188
|
+
message.owner,
|
|
189
|
+
message.boxId,
|
|
190
|
+
message.expiry,
|
|
191
|
+
message.nonce,
|
|
192
|
+
//
|
|
193
|
+
message.tokenSpent,
|
|
194
|
+
message.amountSpent,
|
|
195
|
+
message.amountFee,
|
|
196
|
+
message.tokenReceived,
|
|
197
|
+
message.minReceived,
|
|
198
|
+
message.pullFromOwner,
|
|
199
|
+
message.sendToOwner,
|
|
200
|
+
//
|
|
201
|
+
message.swapExtRouter,
|
|
202
|
+
message.swapApprove,
|
|
203
|
+
keccak256(message.swapCalldata)
|
|
204
|
+
)
|
|
205
|
+
)
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function hashTypedData(BuyCrossChainPtMessage memory message) public view returns (bytes32) {
|
|
210
|
+
return _hashTypedDataV4(
|
|
211
|
+
keccak256(
|
|
212
|
+
abi.encode(
|
|
213
|
+
BUY_CROSS_CHAIN_PT_MESSAGE_TYPEHASH,
|
|
214
|
+
message.owner,
|
|
215
|
+
message.boxId,
|
|
216
|
+
message.expiry,
|
|
217
|
+
message.nonce,
|
|
218
|
+
//
|
|
219
|
+
message.tokenSpent,
|
|
220
|
+
message.amountSpent,
|
|
221
|
+
message.amountFee,
|
|
222
|
+
message.ptAdapter,
|
|
223
|
+
message.minPtReceived,
|
|
224
|
+
message.dstEid,
|
|
225
|
+
message.receiver,
|
|
226
|
+
message.pullFromOwner,
|
|
227
|
+
//
|
|
228
|
+
message.swapExtRouter,
|
|
229
|
+
message.swapApprove,
|
|
230
|
+
keccak256(message.swapCalldata)
|
|
231
|
+
)
|
|
232
|
+
)
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function _verifyOwnerSig(address owner, uint256 expiry, uint256 nonce, bytes32 messageHash, bytes memory signature)
|
|
237
|
+
internal
|
|
238
|
+
{
|
|
239
|
+
require(SignatureChecker.isValidSignatureNow(owner, messageHash, signature), InvalidSignature());
|
|
240
|
+
require(expiry > block.timestamp, MessageExpired());
|
|
241
|
+
require(ownerNonce[owner] < nonce, InvalidNonce());
|
|
242
|
+
ownerNonce[owner] = nonce;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function _swapFromBox(
|
|
246
|
+
IPDepositBox box,
|
|
247
|
+
address tokenSpent,
|
|
248
|
+
uint256 amountSpent,
|
|
249
|
+
address tokenReceived,
|
|
250
|
+
address swapExtRouter,
|
|
251
|
+
address swapApprove,
|
|
252
|
+
bytes memory swapCalldata,
|
|
253
|
+
address receiver
|
|
254
|
+
) internal returns (uint256 rawTokenReceived) {
|
|
255
|
+
// forgefmt: disable-next-item
|
|
256
|
+
ApprovedCall memory call = ApprovedCall({
|
|
257
|
+
token: tokenSpent,
|
|
258
|
+
amount: amountSpent,
|
|
259
|
+
approveTo: swapApprove,
|
|
260
|
+
callTo: swapExtRouter,
|
|
261
|
+
data: swapCalldata
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
uint256 preBalance = _selfBalance(tokenReceived);
|
|
265
|
+
box.approveAndCall(call, address(box));
|
|
266
|
+
rawTokenReceived = _selfBalance(tokenReceived) - preBalance;
|
|
267
|
+
|
|
268
|
+
_transferOut(tokenReceived, receiver, rawTokenReceived);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function _addressToBytes32(address addr) internal pure returns (bytes32) {
|
|
272
|
+
return bytes32(uint256(uint160(addr)));
|
|
273
|
+
}
|
|
274
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
interface IPCrossChainSwapHub {
|
|
5
|
+
error InsufficientTokenReceived();
|
|
6
|
+
error InvalidNonce();
|
|
7
|
+
error InvalidSignature();
|
|
8
|
+
error InvalidReceiver();
|
|
9
|
+
error MessageExpired();
|
|
10
|
+
|
|
11
|
+
struct WithdrawTokenMessage {
|
|
12
|
+
address owner;
|
|
13
|
+
uint32 boxId;
|
|
14
|
+
uint256 expiry;
|
|
15
|
+
uint256 nonce;
|
|
16
|
+
//
|
|
17
|
+
address token;
|
|
18
|
+
uint256 amountWithdraw;
|
|
19
|
+
uint256 amountFee;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
struct BridgeTokenMessage {
|
|
23
|
+
address owner;
|
|
24
|
+
uint32 boxId;
|
|
25
|
+
uint256 expiry;
|
|
26
|
+
uint256 nonce;
|
|
27
|
+
//
|
|
28
|
+
address token;
|
|
29
|
+
uint256 amountBridge;
|
|
30
|
+
uint256 amountFee;
|
|
31
|
+
bool pullFromOwner;
|
|
32
|
+
//
|
|
33
|
+
address bridgeExtRouter;
|
|
34
|
+
address bridgeApprove;
|
|
35
|
+
bytes bridgeCalldata;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
struct SwapTokenMessage {
|
|
39
|
+
address owner;
|
|
40
|
+
uint32 boxId;
|
|
41
|
+
uint256 expiry;
|
|
42
|
+
uint256 nonce;
|
|
43
|
+
//
|
|
44
|
+
address tokenSpent;
|
|
45
|
+
uint256 amountSpent;
|
|
46
|
+
uint256 amountFee;
|
|
47
|
+
address tokenReceived;
|
|
48
|
+
uint256 minReceived;
|
|
49
|
+
bool pullFromOwner;
|
|
50
|
+
bool sendToOwner;
|
|
51
|
+
//
|
|
52
|
+
address swapExtRouter;
|
|
53
|
+
address swapApprove;
|
|
54
|
+
bytes swapCalldata;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
struct BuyCrossChainPtMessage {
|
|
58
|
+
address owner;
|
|
59
|
+
uint32 boxId;
|
|
60
|
+
uint256 expiry;
|
|
61
|
+
uint256 nonce;
|
|
62
|
+
//
|
|
63
|
+
address tokenSpent;
|
|
64
|
+
uint256 amountSpent;
|
|
65
|
+
uint256 amountFee;
|
|
66
|
+
address ptAdapter;
|
|
67
|
+
uint256 minPtReceived;
|
|
68
|
+
uint32 dstEid;
|
|
69
|
+
bytes32 receiver;
|
|
70
|
+
bool pullFromOwner;
|
|
71
|
+
//
|
|
72
|
+
address swapExtRouter;
|
|
73
|
+
address swapApprove;
|
|
74
|
+
bytes swapCalldata;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
event WithdrawToken(address indexed owner, uint32 boxId, address token, uint256 amountWithdraw, uint256 amountFee);
|
|
78
|
+
|
|
79
|
+
event BridgeToken(
|
|
80
|
+
address indexed owner,
|
|
81
|
+
uint32 boxId,
|
|
82
|
+
address bridgeExtRouter,
|
|
83
|
+
address token,
|
|
84
|
+
uint256 amountBridge,
|
|
85
|
+
uint256 amountFee,
|
|
86
|
+
bool pullFromOwner
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
event SwapToken(
|
|
90
|
+
address indexed owner,
|
|
91
|
+
uint32 boxId,
|
|
92
|
+
address tokenSpent,
|
|
93
|
+
uint256 amountSpent,
|
|
94
|
+
uint256 amountFee,
|
|
95
|
+
address tokenReceived,
|
|
96
|
+
uint256 netTokenReceived,
|
|
97
|
+
bool pullFromOwner,
|
|
98
|
+
bool sendToOwner
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
event BuyCrossChainPt(
|
|
102
|
+
address indexed owner,
|
|
103
|
+
uint32 boxId,
|
|
104
|
+
address tokenSpent,
|
|
105
|
+
uint256 amountSpent,
|
|
106
|
+
uint256 amountFee,
|
|
107
|
+
address ptAdapter,
|
|
108
|
+
address pt,
|
|
109
|
+
uint256 netPtReceived,
|
|
110
|
+
bool pullFromOwner
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
event SetExecutor(address indexed executor, bool isExecutor);
|
|
114
|
+
|
|
115
|
+
function BEACON_PROXY_CODE_CONTRACT() external view returns (address);
|
|
116
|
+
|
|
117
|
+
function DEPOSIT_BOX_BEACON() external view returns (address);
|
|
118
|
+
|
|
119
|
+
function DEPOSIT_BOX_CODE_HASH() external view returns (bytes32);
|
|
120
|
+
|
|
121
|
+
function ownerNonce(address owner) external view returns (uint256);
|
|
122
|
+
|
|
123
|
+
function isExecutor(address executor) external view returns (bool);
|
|
124
|
+
|
|
125
|
+
function computeDepositBox(address owner, uint32 boxId)
|
|
126
|
+
external
|
|
127
|
+
view
|
|
128
|
+
returns (address box, bytes32 salt, bool deployed);
|
|
129
|
+
|
|
130
|
+
function hashTypedData(WithdrawTokenMessage memory message) external view returns (bytes32);
|
|
131
|
+
|
|
132
|
+
function hashTypedData(BridgeTokenMessage memory message) external view returns (bytes32);
|
|
133
|
+
|
|
134
|
+
function hashTypedData(SwapTokenMessage memory message) external view returns (bytes32);
|
|
135
|
+
|
|
136
|
+
function hashTypedData(BuyCrossChainPtMessage memory message) external view returns (bytes32);
|
|
137
|
+
|
|
138
|
+
function withdrawToken(WithdrawTokenMessage memory message, bytes memory signature) external;
|
|
139
|
+
|
|
140
|
+
function bridgeToken(BridgeTokenMessage memory message, bytes memory signature) external payable;
|
|
141
|
+
|
|
142
|
+
function swapToken(SwapTokenMessage memory message, bytes memory signature) external;
|
|
143
|
+
|
|
144
|
+
function buyCrossChainPt(BuyCrossChainPtMessage memory message, bytes memory signature) external payable;
|
|
145
|
+
|
|
146
|
+
function setExecutor(address executor, bool isExecutor) external;
|
|
147
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
struct ApprovedCall {
|
|
5
|
+
address token;
|
|
6
|
+
uint256 amount;
|
|
7
|
+
address approveTo;
|
|
8
|
+
address callTo;
|
|
9
|
+
bytes data;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface IPDepositBox {
|
|
13
|
+
function MANAGER() external view returns (address);
|
|
14
|
+
|
|
15
|
+
function OWNER() external view returns (address);
|
|
16
|
+
|
|
17
|
+
function BOX_ID() external view returns (uint32);
|
|
18
|
+
|
|
19
|
+
function withdrawTo(address to, address token, uint256 amount) external;
|
|
20
|
+
|
|
21
|
+
function approveAndCall(ApprovedCall memory call, address nativeRefund) external payable returns (bytes memory);
|
|
22
|
+
}
|