@pendle/core-v2 6.3.2-swaphubtest → 6.3.2-swaphubtest3
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 +1 -1
- package/build/artifacts/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol/PendleCrossChainSwapHub.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol/PendleCrossChainSwapHub.json +143 -262
- package/build/artifacts/contracts/cross-chain/swap-hub/SwapHubBase.sol/SwapHubBase.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/swap-hub/SwapHubBase.sol/SwapHubBase.json +141 -260
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/IPSwapExecutor.sol/IPSwapExecutor.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol/SwapExecutor.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol/SwapExecutor.json +2 -2
- 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/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 +1 -1
- package/build/artifacts/contracts/interfaces/IPCrossChainSwapHub.sol/IPCrossChainSwapHub.json +140 -259
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.dbg.json +1 -1
- 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/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/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol +81 -68
- package/contracts/cross-chain/swap-hub/SwapHubBase.sol +56 -95
- package/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol +2 -7
- package/contracts/interfaces/IPCrossChainSwapHub.sol +34 -51
- package/package.json +1 -1
- package/typechain-types/IPCrossChainSwapHub.ts +172 -295
- package/typechain-types/PendleCrossChainSwapHub.ts +172 -295
- package/typechain-types/SwapHubBase.ts +172 -295
- package/typechain-types/factories/IPCrossChainSwapHub__factory.ts +140 -261
- package/typechain-types/factories/PendleCrossChainSwapHub__factory.ts +142 -263
- package/typechain-types/factories/SwapExecutor__factory.ts +1 -1
- package/typechain-types/factories/SwapHubBase__factory.ts +141 -262
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
OFTReceipt,
|
|
9
9
|
SendParam
|
|
10
10
|
} from "@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol";
|
|
11
|
-
import {
|
|
11
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
12
12
|
import {ApprovedCall, IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
13
13
|
import {SwapData} from "./swap/IPSwapExecutor.sol";
|
|
14
14
|
import {SwapHubBase} from "./SwapHubBase.sol";
|
|
@@ -26,78 +26,94 @@ contract PendleCrossChainSwapHub is SwapHubBase {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function withdrawToken(WithdrawTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
29
|
-
|
|
29
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
30
30
|
|
|
31
31
|
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
32
|
-
box
|
|
33
|
-
|
|
32
|
+
_payTreasury(box, ms.token, ms.amountFee);
|
|
33
|
+
_withdrawToken(ms, box);
|
|
34
34
|
|
|
35
|
-
emit WithdrawToken(ms.owner, ms.boxId, ms.
|
|
35
|
+
emit WithdrawToken(ms.owner, ms.boxId, ms.token, ms.amountWithdraw, ms.amountFee);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function bridgeToken(BridgeTokenMessage memory ms, bytes memory sig) external payable onlyExecutor {
|
|
39
|
-
|
|
39
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
40
40
|
|
|
41
41
|
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
42
|
+
_pullToken(ms.pullFromOwner, box, ms.owner, ms.token, ms.amountBridge + ms.amountFee);
|
|
43
|
+
_payTreasury(box, ms.token, ms.amountFee);
|
|
42
44
|
_bridgeToken(ms, box, msg.value);
|
|
43
|
-
box.payTreasury(ms.token, ms.feeAmount);
|
|
44
45
|
|
|
45
|
-
emit BridgeToken(
|
|
46
|
+
emit BridgeToken(
|
|
47
|
+
ms.owner, ms.boxId, ms.bridgeExtRouter, ms.token, ms.amountBridge, ms.amountFee, ms.pullFromOwner
|
|
48
|
+
);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
function swapToken(SwapTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
49
|
-
|
|
52
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
50
53
|
|
|
51
54
|
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
52
|
-
|
|
53
|
-
box
|
|
55
|
+
_pullToken(ms.pullFromOwner, box, ms.owner, ms.tokenSpent, ms.amountSpent + ms.amountFee);
|
|
56
|
+
_payTreasury(box, ms.tokenSpent, ms.amountFee);
|
|
54
57
|
|
|
58
|
+
uint256 netTokenReceived = _swapToken(ms, box);
|
|
55
59
|
require(netTokenReceived >= ms.minReceived, InsufficientTokenReceived());
|
|
56
60
|
|
|
57
|
-
emit SwapToken(
|
|
61
|
+
emit SwapToken(
|
|
62
|
+
ms.owner,
|
|
63
|
+
ms.boxId,
|
|
64
|
+
ms.tokenSpent,
|
|
65
|
+
ms.amountSpent,
|
|
66
|
+
ms.amountFee,
|
|
67
|
+
ms.tokenReceived,
|
|
68
|
+
netTokenReceived,
|
|
69
|
+
ms.pullFromOwner,
|
|
70
|
+
ms.sendToOwner
|
|
71
|
+
);
|
|
58
72
|
}
|
|
59
73
|
|
|
60
|
-
function buyCrossChainPt(
|
|
61
|
-
|
|
62
|
-
bytes memory intentSig,
|
|
63
|
-
ExecuteBuyCrossChainPtMessage memory execMsg,
|
|
64
|
-
bytes memory execSig
|
|
65
|
-
) external payable onlyExecutor {
|
|
66
|
-
_verifyOwnerSig(intent.owner, intent.expiry, hashTypedData(intent), intentSig);
|
|
67
|
-
_verifyValidatorSig(execMsg.validator, execMsg.expiry, hashTypedData(execMsg), execSig);
|
|
68
|
-
|
|
69
|
-
bytes32 intentHash = keccak256(abi.encode(intent));
|
|
70
|
-
_verifyIntentHashAndMarkExecuted(execMsg.intentHash, intentHash);
|
|
71
|
-
|
|
72
|
-
IPDepositBox box = _checkAndDeployBox(intent.owner, intent.boxId);
|
|
73
|
-
uint256 netPtReceived = _buyPt(intent, execMsg, box) - execMsg.feeAmount;
|
|
74
|
-
box.payTreasury(intent.pt, execMsg.feeAmount);
|
|
75
|
-
|
|
76
|
-
if (intent.ptAdapter == address(0)) {
|
|
77
|
-
require(msg.value == 0, ExcessiveNativeFee());
|
|
78
|
-
} else {
|
|
79
|
-
netPtReceived = _bridgePt(intent, box, netPtReceived, msg.value);
|
|
80
|
-
}
|
|
74
|
+
function buyCrossChainPt(BuyCrossChainPtMessage memory ms, bytes memory sig) external payable onlyExecutor {
|
|
75
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
81
76
|
|
|
82
|
-
|
|
77
|
+
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
78
|
+
_pullToken(ms.pullFromOwner, box, ms.owner, ms.tokenSpent, ms.amountSpent + ms.amountFee);
|
|
79
|
+
_payTreasury(box, ms.tokenSpent, ms.amountFee);
|
|
80
|
+
|
|
81
|
+
address pt = IOFT(ms.ptAdapter).token();
|
|
82
|
+
uint256 netPtReceived = _buyPtAndBridge(ms, box, pt, msg.value);
|
|
83
|
+
require(netPtReceived >= ms.minPtReceived, InsufficientTokenReceived());
|
|
83
84
|
|
|
84
85
|
emit BuyCrossChainPt(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
netPtReceived
|
|
86
|
+
ms.owner,
|
|
87
|
+
ms.boxId,
|
|
88
|
+
ms.tokenSpent,
|
|
89
|
+
ms.amountSpent,
|
|
90
|
+
ms.amountFee,
|
|
91
|
+
ms.ptAdapter,
|
|
92
|
+
pt,
|
|
93
|
+
netPtReceived,
|
|
94
|
+
ms.pullFromOwner
|
|
93
95
|
);
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
function _pullToken(bool pullFromOwner, IPDepositBox box, address owner, address token, uint256 amount) internal {
|
|
99
|
+
if (pullFromOwner) {
|
|
100
|
+
_transferFrom(IERC20(token), owner, address(box), amount);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function _payTreasury(IPDepositBox box, address token, uint256 amount) internal {
|
|
105
|
+
box.payTreasury(token, amount);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function _withdrawToken(WithdrawTokenMessage memory ms, IPDepositBox box) internal {
|
|
109
|
+
box.withdrawTo(ms.owner, ms.token, ms.amountWithdraw);
|
|
110
|
+
}
|
|
111
|
+
|
|
96
112
|
function _bridgeToken(BridgeTokenMessage memory ms, IPDepositBox box, uint256 nativeFee) internal {
|
|
97
113
|
// forgefmt: disable-next-item
|
|
98
114
|
ApprovedCall memory call = ApprovedCall({
|
|
99
115
|
token: ms.token,
|
|
100
|
-
amount: ms.
|
|
116
|
+
amount: ms.amountBridge,
|
|
101
117
|
spender: ms.bridgeExtRouter,
|
|
102
118
|
data: ms.bridgeCalldata
|
|
103
119
|
});
|
|
@@ -112,36 +128,30 @@ contract PendleCrossChainSwapHub is SwapHubBase {
|
|
|
112
128
|
extRouter: ms.swapExtRouter,
|
|
113
129
|
extCalldata: ms.swapCalldata
|
|
114
130
|
});
|
|
115
|
-
|
|
131
|
+
|
|
132
|
+
address receiver = ms.sendToOwner ? ms.owner : address(box);
|
|
133
|
+
rawTokenReceived = _swapFromBox(box, ms.swapExecutor, swapData, receiver);
|
|
116
134
|
}
|
|
117
135
|
|
|
118
|
-
function
|
|
136
|
+
function _buyPtAndBridge(BuyCrossChainPtMessage memory ms, IPDepositBox box, address pt, uint256 nativeFee)
|
|
119
137
|
internal
|
|
120
|
-
returns (uint256
|
|
138
|
+
returns (uint256 netPtReceived)
|
|
121
139
|
{
|
|
122
|
-
require(
|
|
123
|
-
execMsg.amountSpent <= PMath.min(intent.maxAmountSpent, _balanceOf(address(box), intent.tokenSpent)),
|
|
124
|
-
InvalidAmountIn()
|
|
125
|
-
);
|
|
140
|
+
require(ms.receiver == _addressToBytes32(ms.owner), InvalidReceiver());
|
|
126
141
|
|
|
127
142
|
SwapData memory swapData = SwapData({
|
|
128
|
-
tokenIn:
|
|
129
|
-
amountIn:
|
|
130
|
-
tokenOut:
|
|
131
|
-
extRouter:
|
|
132
|
-
extCalldata:
|
|
143
|
+
tokenIn: ms.tokenSpent,
|
|
144
|
+
amountIn: ms.amountSpent,
|
|
145
|
+
tokenOut: pt,
|
|
146
|
+
extRouter: ms.swapExtRouter,
|
|
147
|
+
extCalldata: ms.swapCalldata
|
|
133
148
|
});
|
|
134
|
-
rawPtReceived = _swapFromBox(box,
|
|
135
|
-
}
|
|
149
|
+
uint256 rawPtReceived = _swapFromBox(box, ms.swapExecutor, swapData, address(box));
|
|
136
150
|
|
|
137
|
-
function _bridgePt(BuyCrossChainPtIntent memory intent, IPDepositBox box, uint256 amount, uint256 nativeFee)
|
|
138
|
-
internal
|
|
139
|
-
returns (uint256 netPtReceived)
|
|
140
|
-
{
|
|
141
151
|
SendParam memory sendParam = SendParam({
|
|
142
|
-
dstEid:
|
|
143
|
-
to:
|
|
144
|
-
amountLD:
|
|
152
|
+
dstEid: ms.dstEid,
|
|
153
|
+
to: ms.receiver,
|
|
154
|
+
amountLD: rawPtReceived,
|
|
145
155
|
minAmountLD: 0,
|
|
146
156
|
extraOptions: "",
|
|
147
157
|
composeMsg: "",
|
|
@@ -149,14 +159,17 @@ contract PendleCrossChainSwapHub is SwapHubBase {
|
|
|
149
159
|
});
|
|
150
160
|
MessagingFee memory sendFee = MessagingFee({nativeFee: nativeFee, lzTokenFee: 0});
|
|
151
161
|
ApprovedCall memory call = ApprovedCall({
|
|
152
|
-
token:
|
|
153
|
-
amount:
|
|
154
|
-
spender:
|
|
162
|
+
token: pt,
|
|
163
|
+
amount: rawPtReceived,
|
|
164
|
+
spender: ms.ptAdapter,
|
|
155
165
|
data: abi.encodeCall(IOFT.send, (sendParam, sendFee, msg.sender))
|
|
156
166
|
});
|
|
157
|
-
|
|
158
167
|
(, OFTReceipt memory oftReceipt) =
|
|
159
168
|
abi.decode(box.approveAndCall{value: nativeFee}(call, msg.sender), (MessagingReceipt, OFTReceipt));
|
|
160
169
|
netPtReceived = oftReceipt.amountReceivedLD;
|
|
161
170
|
}
|
|
171
|
+
|
|
172
|
+
function _addressToBytes32(address addr) internal pure returns (bytes32) {
|
|
173
|
+
return bytes32(uint256(uint160(addr)));
|
|
174
|
+
}
|
|
162
175
|
}
|
|
@@ -21,10 +21,9 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
21
21
|
"uint256 expiry,"
|
|
22
22
|
"uint256 nonce,"
|
|
23
23
|
//
|
|
24
|
-
"address receiver,"
|
|
25
24
|
"address token,"
|
|
26
|
-
"uint256
|
|
27
|
-
"uint256
|
|
25
|
+
"uint256 amountWithdraw,"
|
|
26
|
+
"uint256 amountFee"
|
|
28
27
|
")"
|
|
29
28
|
);
|
|
30
29
|
|
|
@@ -37,8 +36,9 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
37
36
|
"uint256 nonce,"
|
|
38
37
|
//
|
|
39
38
|
"address token,"
|
|
40
|
-
"uint256
|
|
41
|
-
"uint256
|
|
39
|
+
"uint256 amountBridge,"
|
|
40
|
+
"uint256 amountFee,"
|
|
41
|
+
"bool pullFromOwner,"
|
|
42
42
|
//
|
|
43
43
|
"address bridgeExtRouter,"
|
|
44
44
|
"bytes bridgeCalldata"
|
|
@@ -55,9 +55,11 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
55
55
|
//
|
|
56
56
|
"address tokenSpent,"
|
|
57
57
|
"uint256 amountSpent,"
|
|
58
|
+
"uint256 amountFee,"
|
|
58
59
|
"address tokenReceived,"
|
|
59
60
|
"uint256 minReceived,"
|
|
60
|
-
"
|
|
61
|
+
"bool pullFromOwner,"
|
|
62
|
+
"bool sendToOwner,"
|
|
61
63
|
//
|
|
62
64
|
"address swapExecutor,"
|
|
63
65
|
"address swapExtRouter,"
|
|
@@ -66,34 +68,25 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
66
68
|
);
|
|
67
69
|
|
|
68
70
|
// forgefmt: disable-next-item
|
|
69
|
-
bytes32 internal constant
|
|
70
|
-
"
|
|
71
|
+
bytes32 internal constant BUY_CROSS_CHAIN_PT_MESSAGE_TYPEHASH = keccak256(
|
|
72
|
+
"BuyCrossChainPtMessage("
|
|
71
73
|
"address owner,"
|
|
72
74
|
"uint32 boxId,"
|
|
73
|
-
"uint256 salt,"
|
|
74
75
|
"uint256 expiry,"
|
|
76
|
+
"uint256 nonce,"
|
|
75
77
|
//
|
|
76
78
|
"address tokenSpent,"
|
|
77
|
-
"uint256
|
|
78
|
-
"
|
|
79
|
+
"uint256 amountSpent,"
|
|
80
|
+
"uint256 amountFee,"
|
|
79
81
|
"address ptAdapter,"
|
|
80
82
|
"uint256 minPtReceived,"
|
|
81
|
-
"uint32
|
|
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,"
|
|
83
|
+
"uint32 dstEid,"
|
|
84
|
+
"bytes32 receiver,"
|
|
85
|
+
"bool pullFromOwner,"
|
|
86
|
+
//
|
|
93
87
|
"address swapExecutor,"
|
|
94
88
|
"address swapExtRouter,"
|
|
95
|
-
"bytes swapCalldata
|
|
96
|
-
"uint256 expiry"
|
|
89
|
+
"bytes swapCalldata"
|
|
97
90
|
")"
|
|
98
91
|
);
|
|
99
92
|
|
|
@@ -103,9 +96,7 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
103
96
|
bytes32 public immutable DEPOSIT_BOX_CODE_HASH;
|
|
104
97
|
|
|
105
98
|
mapping(address owner => uint256 nonce) public ownerNonce;
|
|
106
|
-
mapping(bytes32 intentHash => bool) public isIntentExecuted;
|
|
107
99
|
mapping(address executor => bool) public isExecutor;
|
|
108
|
-
mapping(address validator => bool) public isValidator;
|
|
109
100
|
|
|
110
101
|
constructor(address beaconProxyCodeContract_, address depositBoxBeacon_) {
|
|
111
102
|
BEACON_PROXY_CODE_CONTRACT = beaconProxyCodeContract_;
|
|
@@ -124,19 +115,19 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
124
115
|
emit SetExecutor(executor, isExecutor_);
|
|
125
116
|
}
|
|
126
117
|
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
function computeDepositBox(address owner, uint32 boxId) public view returns (address box, bytes32 salt) {
|
|
118
|
+
function computeDepositBox(address owner, uint32 boxId)
|
|
119
|
+
public
|
|
120
|
+
view
|
|
121
|
+
returns (address box, bytes32 salt, bool deployed)
|
|
122
|
+
{
|
|
133
123
|
salt = keccak256(abi.encode(owner, boxId));
|
|
134
124
|
box = Create2.computeAddress(salt, DEPOSIT_BOX_CODE_HASH);
|
|
125
|
+
deployed = box.code.length > 0;
|
|
135
126
|
}
|
|
136
127
|
|
|
137
128
|
function _checkAndDeployBox(address owner, uint32 boxId) internal returns (IPDepositBox) {
|
|
138
|
-
(address box, bytes32 salt) = computeDepositBox(owner, boxId);
|
|
139
|
-
if (
|
|
129
|
+
(address box, bytes32 salt, bool deployed) = computeDepositBox(owner, boxId);
|
|
130
|
+
if (deployed) {
|
|
140
131
|
return IPDepositBox(box);
|
|
141
132
|
}
|
|
142
133
|
|
|
@@ -156,10 +147,9 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
156
147
|
message.expiry,
|
|
157
148
|
message.nonce,
|
|
158
149
|
//
|
|
159
|
-
message.receiver,
|
|
160
150
|
message.token,
|
|
161
|
-
message.
|
|
162
|
-
message.
|
|
151
|
+
message.amountWithdraw,
|
|
152
|
+
message.amountFee
|
|
163
153
|
)
|
|
164
154
|
)
|
|
165
155
|
);
|
|
@@ -176,8 +166,9 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
176
166
|
message.nonce,
|
|
177
167
|
//
|
|
178
168
|
message.token,
|
|
179
|
-
message.
|
|
180
|
-
message.
|
|
169
|
+
message.amountBridge,
|
|
170
|
+
message.amountFee,
|
|
171
|
+
message.pullFromOwner,
|
|
181
172
|
//
|
|
182
173
|
message.bridgeExtRouter,
|
|
183
174
|
keccak256(message.bridgeCalldata)
|
|
@@ -198,9 +189,11 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
198
189
|
//
|
|
199
190
|
message.tokenSpent,
|
|
200
191
|
message.amountSpent,
|
|
192
|
+
message.amountFee,
|
|
201
193
|
message.tokenReceived,
|
|
202
194
|
message.minReceived,
|
|
203
|
-
message.
|
|
195
|
+
message.pullFromOwner,
|
|
196
|
+
message.sendToOwner,
|
|
204
197
|
//
|
|
205
198
|
message.swapExecutor,
|
|
206
199
|
message.swapExtRouter,
|
|
@@ -210,53 +203,36 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
210
203
|
);
|
|
211
204
|
}
|
|
212
205
|
|
|
213
|
-
function hashTypedData(
|
|
206
|
+
function hashTypedData(BuyCrossChainPtMessage memory message) public view returns (bytes32) {
|
|
214
207
|
return _hashTypedDataV4(
|
|
215
208
|
keccak256(
|
|
216
209
|
abi.encode(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
210
|
+
BUY_CROSS_CHAIN_PT_MESSAGE_TYPEHASH,
|
|
211
|
+
message.owner,
|
|
212
|
+
message.boxId,
|
|
213
|
+
message.expiry,
|
|
214
|
+
message.nonce,
|
|
222
215
|
//
|
|
223
|
-
|
|
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,
|
|
216
|
+
message.tokenSpent,
|
|
242
217
|
message.amountSpent,
|
|
243
|
-
message.
|
|
218
|
+
message.amountFee,
|
|
219
|
+
message.ptAdapter,
|
|
220
|
+
message.minPtReceived,
|
|
221
|
+
message.dstEid,
|
|
222
|
+
message.receiver,
|
|
223
|
+
message.pullFromOwner,
|
|
224
|
+
//
|
|
244
225
|
message.swapExecutor,
|
|
245
226
|
message.swapExtRouter,
|
|
246
|
-
keccak256(message.swapCalldata)
|
|
247
|
-
message.expiry
|
|
227
|
+
keccak256(message.swapCalldata)
|
|
248
228
|
)
|
|
249
229
|
)
|
|
250
230
|
);
|
|
251
231
|
}
|
|
252
232
|
|
|
253
|
-
function
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
uint256 nonce,
|
|
257
|
-
bytes32 messageHash,
|
|
258
|
-
bytes memory signature
|
|
259
|
-
) internal {
|
|
233
|
+
function _verifyOwnerSig(address owner, uint256 expiry, uint256 nonce, bytes32 messageHash, bytes memory signature)
|
|
234
|
+
internal
|
|
235
|
+
{
|
|
260
236
|
_verifyOwnerSig(owner, expiry, messageHash, signature);
|
|
261
237
|
_verifyAndIncreaseNonce(owner, nonce);
|
|
262
238
|
}
|
|
@@ -271,33 +247,18 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
271
247
|
ownerNonce[owner] = nonce;
|
|
272
248
|
}
|
|
273
249
|
|
|
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
250
|
function _balanceOf(address addr, address token) internal view returns (uint256) {
|
|
290
251
|
return (token == NATIVE) ? addr.balance : IERC20(token).balanceOf(addr);
|
|
291
252
|
}
|
|
292
253
|
|
|
293
|
-
function _swapFromBox(IPDepositBox box, address swapExecutor, SwapData memory swapData)
|
|
254
|
+
function _swapFromBox(IPDepositBox box, address swapExecutor, SwapData memory swapData, address receiver)
|
|
294
255
|
internal
|
|
295
256
|
returns (uint256 rawTokenOut)
|
|
296
257
|
{
|
|
297
258
|
box.withdrawTo(swapExecutor, swapData.tokenIn, swapData.amountIn);
|
|
298
259
|
|
|
299
|
-
uint256 preBalance = _balanceOf(
|
|
300
|
-
IPSwapExecutor(swapExecutor).swap(
|
|
301
|
-
rawTokenOut = _balanceOf(
|
|
260
|
+
uint256 preBalance = _balanceOf(receiver, swapData.tokenOut);
|
|
261
|
+
IPSwapExecutor(swapExecutor).swap(receiver, swapData);
|
|
262
|
+
rawTokenOut = _balanceOf(receiver, swapData.tokenOut) - preBalance;
|
|
302
263
|
}
|
|
303
264
|
}
|
|
@@ -19,13 +19,8 @@ contract SwapExecutor is IPSwapExecutor, TokenHelper {
|
|
|
19
19
|
|
|
20
20
|
function _approveForExtRouter(address token, address extRouter) internal {
|
|
21
21
|
if (token == NATIVE) return;
|
|
22
|
-
|
|
23
|
-
|
|
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);
|
|
22
|
+
if (IERC20(token).allowance(address(this), extRouter) < type(uint256).max) {
|
|
23
|
+
IERC20(token).forceApprove(extRouter, type(uint256).max);
|
|
29
24
|
}
|
|
30
25
|
}
|
|
31
26
|
|