@pendle/core-v2 6.3.2-swaphubtest2 → 6.3.2-swaphubtest4
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/DepositBox.sol/DepositBox.json +10 -41
- 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 +170 -475
- 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 +128 -442
- 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 +101 -428
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.json +7 -33
- 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/DepositBox.sol +11 -17
- package/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol +98 -126
- package/contracts/cross-chain/swap-hub/SwapHubBase.sol +54 -52
- package/contracts/interfaces/IPCrossChainSwapHub.sol +20 -41
- package/contracts/interfaces/IPDepositBox.sol +3 -6
- package/package.json +1 -1
- package/typechain-types/DepositBox.ts +20 -64
- package/typechain-types/IPCrossChainSwapHub.ts +143 -304
- package/typechain-types/IPDepositBox.ts +20 -64
- package/typechain-types/PendleCrossChainSwapHub.ts +151 -299
- package/typechain-types/SwapHubBase.ts +151 -299
- package/typechain-types/factories/DepositBox__factory.ts +13 -50
- package/typechain-types/factories/IPCrossChainSwapHub__factory.ts +101 -428
- package/typechain-types/factories/IPDepositBox__factory.ts +7 -33
- package/typechain-types/factories/PendleCrossChainSwapHub__factory.ts +173 -474
- package/typechain-types/factories/SwapHubBase__factory.ts +128 -442
- package/typechain-types/hardhat.d.ts +0 -18
- package/typechain-types/index.ts +0 -4
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/IPSwapExecutor.sol/IPSwapExecutor.dbg.json +0 -4
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/IPSwapExecutor.sol/IPSwapExecutor.json +0 -56
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol/SwapExecutor.dbg.json +0 -4
- package/build/artifacts/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol/SwapExecutor.json +0 -60
- package/contracts/cross-chain/swap-hub/swap/IPSwapExecutor.sol +0 -14
- package/contracts/cross-chain/swap-hub/swap/SwapExecutor.sol +0 -33
- package/typechain-types/IPSwapExecutor.ts +0 -129
- package/typechain-types/SwapExecutor.ts +0 -129
- package/typechain-types/factories/IPSwapExecutor__factory.ts +0 -71
- package/typechain-types/factories/SwapExecutor__factory.ts +0 -110
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
OFTReceipt,
|
|
9
9
|
SendParam
|
|
10
10
|
} from "@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol";
|
|
11
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
11
12
|
import {ApprovedCall, IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
12
|
-
import {SwapData} from "./swap/IPSwapExecutor.sol";
|
|
13
13
|
import {SwapHubBase} from "./SwapHubBase.sol";
|
|
14
14
|
|
|
15
15
|
contract PendleCrossChainSwapHub is SwapHubBase {
|
|
16
|
-
constructor(address beaconProxyCodeContract_, address depositBoxBeacon_)
|
|
17
|
-
SwapHubBase(beaconProxyCodeContract_, depositBoxBeacon_)
|
|
16
|
+
constructor(address treasury_, address beaconProxyCodeContract_, address depositBoxBeacon_)
|
|
17
|
+
SwapHubBase(treasury_, beaconProxyCodeContract_, depositBoxBeacon_)
|
|
18
18
|
{
|
|
19
19
|
_disableInitializers();
|
|
20
20
|
}
|
|
@@ -25,163 +25,132 @@ contract PendleCrossChainSwapHub is SwapHubBase {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function withdrawToken(WithdrawTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function bridgeToken(BridgeTokenMessage memory ms, bytes memory sig) external payable onlyExecutor {
|
|
32
|
-
_handleBridgeToken({ms: ms, sig: sig, claimFailed: false});
|
|
33
|
-
}
|
|
28
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function buyCrossChainPt(BuyCrossChainPtMessage memory ms, bytes memory sig) external payable onlyExecutor {
|
|
40
|
-
_handleBuyCrossChainPt({ms: ms, sig: sig, claimFailed: false});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function claimFee(WithdrawTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
44
|
-
_handleWithdrawToken({ms: ms, sig: sig, claimFailed: true});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function claimFee(BridgeTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
48
|
-
_handleBridgeToken({ms: ms, sig: sig, claimFailed: true});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function claimFee(SwapTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
52
|
-
_handleSwapToken({ms: ms, sig: sig, claimFailed: true});
|
|
53
|
-
}
|
|
30
|
+
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
31
|
+
_payTreasury(box, ms.token, ms.amountFee);
|
|
32
|
+
_withdrawToken(ms, box);
|
|
54
33
|
|
|
55
|
-
|
|
56
|
-
_handleBuyCrossChainPt({ms: ms, sig: sig, claimFailed: true});
|
|
34
|
+
emit WithdrawToken(ms.owner, ms.boxId, ms.token, ms.amountWithdraw, ms.amountFee);
|
|
57
35
|
}
|
|
58
36
|
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, actionHash, sig, !claimFailed);
|
|
37
|
+
function bridgeToken(BridgeTokenMessage memory ms, bytes memory sig) external payable onlyExecutor {
|
|
38
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
62
39
|
|
|
63
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);
|
|
64
44
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} else {
|
|
69
|
-
box.withdrawTo(ms.receiver, ms.token, ms.amountWithdraw);
|
|
70
|
-
|
|
71
|
-
_markSucceededAndTakeFee(actionHash, box, ms.token, ms.amountFee);
|
|
72
|
-
emit WithdrawToken(ms.owner, ms.boxId, actionHash, ms.receiver, ms.token, ms.amountWithdraw, ms.amountFee);
|
|
73
|
-
}
|
|
45
|
+
emit BridgeToken(
|
|
46
|
+
ms.owner, ms.boxId, ms.bridgeExtRouter, ms.token, ms.amountBridge, ms.amountFee, ms.pullFromOwner
|
|
47
|
+
);
|
|
74
48
|
}
|
|
75
49
|
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, actionHash, sig, !claimFailed);
|
|
50
|
+
function swapToken(SwapTokenMessage memory ms, bytes memory sig) external onlyExecutor {
|
|
51
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
79
52
|
|
|
80
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);
|
|
81
56
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
emit ClaimFeeForFailedAction(ms.owner, ms.boxId, actionHash, ms.token, ms.amountFee);
|
|
85
|
-
} else {
|
|
86
|
-
_bridgeToken(ms, box, msg.value);
|
|
57
|
+
uint256 netTokenReceived = _swapToken(ms, box);
|
|
58
|
+
require(netTokenReceived >= ms.minReceived, InsufficientTokenReceived());
|
|
87
59
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
+
);
|
|
93
71
|
}
|
|
94
72
|
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, actionHash, sig, !claimFailed);
|
|
73
|
+
function buyCrossChainPt(BuyCrossChainPtMessage memory ms, bytes memory sig) external payable onlyExecutor {
|
|
74
|
+
_verifyOwnerSig(ms.owner, ms.expiry, ms.nonce, hashTypedData(ms), sig);
|
|
98
75
|
|
|
99
76
|
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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);
|
|
119
100
|
}
|
|
120
101
|
}
|
|
121
102
|
|
|
122
|
-
function
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
IPDepositBox box = _checkAndDeployBox(ms.owner, ms.boxId);
|
|
103
|
+
function _payTreasury(IPDepositBox box, address token, uint256 amount) internal {
|
|
104
|
+
box.withdrawTo(TREASURY, token, amount);
|
|
105
|
+
}
|
|
127
106
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
emit ClaimFeeForFailedAction(ms.owner, ms.boxId, actionHash, ms.tokenSpent, ms.amountFee);
|
|
131
|
-
} else {
|
|
132
|
-
address pt = IOFT(ms.ptAdapter).token();
|
|
133
|
-
uint256 netPtReceived = _buyPtAndBridge(ms, box, pt, msg.value);
|
|
134
|
-
require(netPtReceived >= ms.minPtReceived, InsufficientTokenReceived());
|
|
135
|
-
|
|
136
|
-
_markSucceededAndTakeFee(actionHash, box, ms.tokenSpent, ms.amountFee);
|
|
137
|
-
emit BuyCrossChainPt(
|
|
138
|
-
ms.owner,
|
|
139
|
-
ms.boxId,
|
|
140
|
-
actionHash,
|
|
141
|
-
ms.tokenSpent,
|
|
142
|
-
ms.amountSpent,
|
|
143
|
-
ms.amountFee,
|
|
144
|
-
ms.ptAdapter,
|
|
145
|
-
pt,
|
|
146
|
-
netPtReceived
|
|
147
|
-
);
|
|
148
|
-
}
|
|
107
|
+
function _withdrawToken(WithdrawTokenMessage memory ms, IPDepositBox box) internal {
|
|
108
|
+
box.withdrawTo(ms.owner, ms.token, ms.amountWithdraw);
|
|
149
109
|
}
|
|
150
110
|
|
|
151
111
|
function _bridgeToken(BridgeTokenMessage memory ms, IPDepositBox box, uint256 nativeFee) internal {
|
|
152
|
-
// forgefmt: disable-next-item
|
|
153
112
|
ApprovedCall memory call = ApprovedCall({
|
|
154
113
|
token: ms.token,
|
|
155
114
|
amount: ms.amountBridge,
|
|
156
|
-
|
|
115
|
+
approveTo: ms.bridgeApprove,
|
|
116
|
+
callTo: ms.bridgeExtRouter,
|
|
157
117
|
data: ms.bridgeCalldata
|
|
158
118
|
});
|
|
159
119
|
box.approveAndCall{value: nativeFee}(call, msg.sender);
|
|
160
120
|
}
|
|
161
121
|
|
|
162
122
|
function _swapToken(SwapTokenMessage memory ms, IPDepositBox box) internal returns (uint256 rawTokenReceived) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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)
|
|
169
132
|
});
|
|
170
|
-
rawTokenReceived = _swapFromBox(box, ms.swapExecutor, swapData, ms.receiver);
|
|
171
133
|
}
|
|
172
134
|
|
|
173
|
-
function _buyPtAndBridge(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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)
|
|
183
153
|
});
|
|
184
|
-
uint256 rawPtReceived = _swapFromBox(box, ms.swapExecutor, swapData, address(box));
|
|
185
154
|
|
|
186
155
|
SendParam memory sendParam = SendParam({
|
|
187
156
|
dstEid: ms.dstEid,
|
|
@@ -196,11 +165,14 @@ contract PendleCrossChainSwapHub is SwapHubBase {
|
|
|
196
165
|
ApprovedCall memory call = ApprovedCall({
|
|
197
166
|
token: pt,
|
|
198
167
|
amount: rawPtReceived,
|
|
199
|
-
|
|
200
|
-
|
|
168
|
+
approveTo: ms.ptAdapter,
|
|
169
|
+
callTo: ms.ptAdapter,
|
|
170
|
+
data: abi.encodeCall(IOFT.send, (sendParam, sendFee, nativeRefund))
|
|
201
171
|
});
|
|
202
172
|
(, OFTReceipt memory oftReceipt) =
|
|
203
|
-
abi.decode(box.approveAndCall{value: nativeFee}(call,
|
|
173
|
+
abi.decode(box.approveAndCall{value: nativeFee}(call, nativeRefund), (MessagingReceipt, OFTReceipt));
|
|
204
174
|
netPtReceived = oftReceipt.amountReceivedLD;
|
|
205
175
|
}
|
|
176
|
+
|
|
177
|
+
receive() external payable {}
|
|
206
178
|
}
|
|
@@ -8,8 +8,7 @@ import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/crypt
|
|
|
8
8
|
import {BoringOwnableUpgradeableV2} from "../../core/libraries/BoringOwnableUpgradeableV2.sol";
|
|
9
9
|
import {TokenHelper} from "../../core/libraries/TokenHelper.sol";
|
|
10
10
|
import {IPCrossChainSwapHub} from "../../interfaces/IPCrossChainSwapHub.sol";
|
|
11
|
-
import {IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
12
|
-
import {IPSwapExecutor, SwapData} from "./swap/IPSwapExecutor.sol";
|
|
11
|
+
import {ApprovedCall, IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
13
12
|
import {DepositBox} from "./DepositBox.sol";
|
|
14
13
|
|
|
15
14
|
abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringOwnableUpgradeableV2, TokenHelper {
|
|
@@ -21,7 +20,6 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
21
20
|
"uint256 expiry,"
|
|
22
21
|
"uint256 nonce,"
|
|
23
22
|
//
|
|
24
|
-
"address receiver,"
|
|
25
23
|
"address token,"
|
|
26
24
|
"uint256 amountWithdraw,"
|
|
27
25
|
"uint256 amountFee"
|
|
@@ -39,8 +37,10 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
39
37
|
"address token,"
|
|
40
38
|
"uint256 amountBridge,"
|
|
41
39
|
"uint256 amountFee,"
|
|
40
|
+
"bool pullFromOwner,"
|
|
42
41
|
//
|
|
43
42
|
"address bridgeExtRouter,"
|
|
43
|
+
"address bridgeApprove,"
|
|
44
44
|
"bytes bridgeCalldata"
|
|
45
45
|
")"
|
|
46
46
|
);
|
|
@@ -58,10 +58,11 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
58
58
|
"uint256 amountFee,"
|
|
59
59
|
"address tokenReceived,"
|
|
60
60
|
"uint256 minReceived,"
|
|
61
|
-
"
|
|
61
|
+
"bool pullFromOwner,"
|
|
62
|
+
"bool sendToOwner,"
|
|
62
63
|
//
|
|
63
|
-
"address swapExecutor,"
|
|
64
64
|
"address swapExtRouter,"
|
|
65
|
+
"address swapApprove,"
|
|
65
66
|
"bytes swapCalldata"
|
|
66
67
|
")"
|
|
67
68
|
);
|
|
@@ -81,23 +82,26 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
81
82
|
"uint256 minPtReceived,"
|
|
82
83
|
"uint32 dstEid,"
|
|
83
84
|
"bytes32 receiver,"
|
|
85
|
+
"bool pullFromOwner,"
|
|
84
86
|
//
|
|
85
|
-
"address swapExecutor,"
|
|
86
87
|
"address swapExtRouter,"
|
|
88
|
+
"address swapApprove,"
|
|
87
89
|
"bytes swapCalldata"
|
|
88
90
|
")"
|
|
89
91
|
);
|
|
90
92
|
|
|
93
|
+
address public immutable TREASURY;
|
|
94
|
+
|
|
91
95
|
/// @dev creation code of OpenZeppelin's BeaconProxy
|
|
92
96
|
address public immutable BEACON_PROXY_CODE_CONTRACT;
|
|
93
97
|
address public immutable DEPOSIT_BOX_BEACON;
|
|
94
98
|
bytes32 public immutable DEPOSIT_BOX_CODE_HASH;
|
|
95
99
|
|
|
96
100
|
mapping(address owner => uint256 nonce) public ownerNonce;
|
|
97
|
-
mapping(bytes32 actionStatus => ActionStatus) public actionStatus;
|
|
98
101
|
mapping(address executor => bool) public isExecutor;
|
|
99
102
|
|
|
100
|
-
constructor(address beaconProxyCodeContract_, address depositBoxBeacon_) {
|
|
103
|
+
constructor(address treasury_, address beaconProxyCodeContract_, address depositBoxBeacon_) {
|
|
104
|
+
TREASURY = treasury_;
|
|
101
105
|
BEACON_PROXY_CODE_CONTRACT = beaconProxyCodeContract_;
|
|
102
106
|
DEPOSIT_BOX_BEACON = depositBoxBeacon_;
|
|
103
107
|
DEPOSIT_BOX_CODE_HASH =
|
|
@@ -114,14 +118,19 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
114
118
|
emit SetExecutor(executor, isExecutor_);
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
function computeDepositBox(address owner, uint32 boxId)
|
|
121
|
+
function computeDepositBox(address owner, uint32 boxId)
|
|
122
|
+
public
|
|
123
|
+
view
|
|
124
|
+
returns (address box, bytes32 salt, bool deployed)
|
|
125
|
+
{
|
|
118
126
|
salt = keccak256(abi.encode(owner, boxId));
|
|
119
127
|
box = Create2.computeAddress(salt, DEPOSIT_BOX_CODE_HASH);
|
|
128
|
+
deployed = box.code.length > 0;
|
|
120
129
|
}
|
|
121
130
|
|
|
122
131
|
function _checkAndDeployBox(address owner, uint32 boxId) internal returns (IPDepositBox) {
|
|
123
|
-
(address box, bytes32 salt) = computeDepositBox(owner, boxId);
|
|
124
|
-
if (
|
|
132
|
+
(address box, bytes32 salt, bool deployed) = computeDepositBox(owner, boxId);
|
|
133
|
+
if (deployed) {
|
|
125
134
|
return IPDepositBox(box);
|
|
126
135
|
}
|
|
127
136
|
|
|
@@ -141,7 +150,6 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
141
150
|
message.expiry,
|
|
142
151
|
message.nonce,
|
|
143
152
|
//
|
|
144
|
-
message.receiver,
|
|
145
153
|
message.token,
|
|
146
154
|
message.amountWithdraw,
|
|
147
155
|
message.amountFee
|
|
@@ -163,8 +171,10 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
163
171
|
message.token,
|
|
164
172
|
message.amountBridge,
|
|
165
173
|
message.amountFee,
|
|
174
|
+
message.pullFromOwner,
|
|
166
175
|
//
|
|
167
176
|
message.bridgeExtRouter,
|
|
177
|
+
message.bridgeApprove,
|
|
168
178
|
keccak256(message.bridgeCalldata)
|
|
169
179
|
)
|
|
170
180
|
)
|
|
@@ -186,10 +196,11 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
186
196
|
message.amountFee,
|
|
187
197
|
message.tokenReceived,
|
|
188
198
|
message.minReceived,
|
|
189
|
-
message.
|
|
199
|
+
message.pullFromOwner,
|
|
200
|
+
message.sendToOwner,
|
|
190
201
|
//
|
|
191
|
-
message.swapExecutor,
|
|
192
202
|
message.swapExtRouter,
|
|
203
|
+
message.swapApprove,
|
|
193
204
|
keccak256(message.swapCalldata)
|
|
194
205
|
)
|
|
195
206
|
)
|
|
@@ -213,61 +224,52 @@ abstract contract SwapHubBase is IPCrossChainSwapHub, EIP712Upgradeable, BoringO
|
|
|
213
224
|
message.minPtReceived,
|
|
214
225
|
message.dstEid,
|
|
215
226
|
message.receiver,
|
|
227
|
+
message.pullFromOwner,
|
|
216
228
|
//
|
|
217
|
-
message.swapExecutor,
|
|
218
229
|
message.swapExtRouter,
|
|
230
|
+
message.swapApprove,
|
|
219
231
|
keccak256(message.swapCalldata)
|
|
220
232
|
)
|
|
221
233
|
)
|
|
222
234
|
);
|
|
223
235
|
}
|
|
224
236
|
|
|
225
|
-
function _verifyOwnerSig(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
uint256 nonce,
|
|
229
|
-
bytes32 messageHash,
|
|
230
|
-
bytes memory signature,
|
|
231
|
-
bool verifyNonce
|
|
232
|
-
) internal {
|
|
233
|
-
_verifyOwnerSig(owner, expiry, messageHash, signature);
|
|
234
|
-
if (verifyNonce) _verifyAndIncreaseNonce(owner, nonce);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function _verifyOwnerSig(address owner, uint256 expiry, bytes32 messageHash, bytes memory signature) internal view {
|
|
237
|
+
function _verifyOwnerSig(address owner, uint256 expiry, uint256 nonce, bytes32 messageHash, bytes memory signature)
|
|
238
|
+
internal
|
|
239
|
+
{
|
|
238
240
|
require(SignatureChecker.isValidSignatureNow(owner, messageHash, signature), InvalidSignature());
|
|
239
241
|
require(expiry > block.timestamp, MessageExpired());
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function _verifyAndIncreaseNonce(address owner, uint256 nonce) internal {
|
|
243
242
|
require(ownerNonce[owner] < nonce, InvalidNonce());
|
|
244
243
|
ownerNonce[owner] = nonce;
|
|
245
244
|
}
|
|
246
245
|
|
|
247
|
-
function
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
function _swapFromBox(
|
|
247
|
+
IPDepositBox box,
|
|
248
|
+
address tokenSpent,
|
|
249
|
+
uint256 amountSpent,
|
|
250
|
+
address tokenReceived,
|
|
251
|
+
address swapExtRouter,
|
|
252
|
+
address swapApprove,
|
|
253
|
+
bytes memory swapCalldata,
|
|
254
|
+
address receiver
|
|
255
|
+
) internal returns (uint256 rawTokenReceived) {
|
|
256
|
+
// forgefmt: disable-next-item
|
|
257
|
+
ApprovedCall memory call = ApprovedCall({
|
|
258
|
+
token: tokenSpent,
|
|
259
|
+
amount: amountSpent,
|
|
260
|
+
approveTo: swapApprove,
|
|
261
|
+
callTo: swapExtRouter,
|
|
262
|
+
data: swapCalldata
|
|
263
|
+
});
|
|
250
264
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
box.payTreasury(token, amount);
|
|
255
|
-
}
|
|
265
|
+
uint256 preBalance = _selfBalance(tokenReceived);
|
|
266
|
+
box.approveAndCall(call, address(box));
|
|
267
|
+
rawTokenReceived = _selfBalance(tokenReceived) - preBalance;
|
|
256
268
|
|
|
257
|
-
|
|
258
|
-
require(actionStatus[actionHash] == ActionStatus.NOT_EXECUTED, ActionExecuted());
|
|
259
|
-
actionStatus[actionHash] = ActionStatus.FAILED;
|
|
260
|
-
box.payTreasury(token, amount);
|
|
269
|
+
_transferOut(tokenReceived, receiver, rawTokenReceived);
|
|
261
270
|
}
|
|
262
271
|
|
|
263
|
-
function
|
|
264
|
-
|
|
265
|
-
returns (uint256 rawTokenOut)
|
|
266
|
-
{
|
|
267
|
-
box.withdrawTo(swapExecutor, swapData.tokenIn, swapData.amountIn);
|
|
268
|
-
|
|
269
|
-
uint256 preBalance = _balanceOf(receiver, swapData.tokenOut);
|
|
270
|
-
IPSwapExecutor(swapExecutor).swap(receiver, swapData);
|
|
271
|
-
rawTokenOut = _balanceOf(receiver, swapData.tokenOut) - preBalance;
|
|
272
|
+
function _addressToBytes32(address addr) internal pure returns (bytes32) {
|
|
273
|
+
return bytes32(uint256(uint160(addr)));
|
|
272
274
|
}
|
|
273
275
|
}
|
|
@@ -2,25 +2,18 @@
|
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
4
|
interface IPCrossChainSwapHub {
|
|
5
|
-
error ActionExecuted();
|
|
6
5
|
error InsufficientTokenReceived();
|
|
7
6
|
error InvalidNonce();
|
|
8
7
|
error InvalidSignature();
|
|
8
|
+
error InvalidReceiver();
|
|
9
9
|
error MessageExpired();
|
|
10
10
|
|
|
11
|
-
enum ActionStatus {
|
|
12
|
-
NOT_EXECUTED,
|
|
13
|
-
SUCCEEDED,
|
|
14
|
-
FAILED
|
|
15
|
-
}
|
|
16
|
-
|
|
17
11
|
struct WithdrawTokenMessage {
|
|
18
12
|
address owner;
|
|
19
13
|
uint32 boxId;
|
|
20
14
|
uint256 expiry;
|
|
21
15
|
uint256 nonce;
|
|
22
16
|
//
|
|
23
|
-
address receiver;
|
|
24
17
|
address token;
|
|
25
18
|
uint256 amountWithdraw;
|
|
26
19
|
uint256 amountFee;
|
|
@@ -35,8 +28,10 @@ interface IPCrossChainSwapHub {
|
|
|
35
28
|
address token;
|
|
36
29
|
uint256 amountBridge;
|
|
37
30
|
uint256 amountFee;
|
|
31
|
+
bool pullFromOwner;
|
|
38
32
|
//
|
|
39
33
|
address bridgeExtRouter;
|
|
34
|
+
address bridgeApprove;
|
|
40
35
|
bytes bridgeCalldata;
|
|
41
36
|
}
|
|
42
37
|
|
|
@@ -51,10 +46,11 @@ interface IPCrossChainSwapHub {
|
|
|
51
46
|
uint256 amountFee;
|
|
52
47
|
address tokenReceived;
|
|
53
48
|
uint256 minReceived;
|
|
54
|
-
|
|
49
|
+
bool pullFromOwner;
|
|
50
|
+
bool sendToOwner;
|
|
55
51
|
//
|
|
56
|
-
address swapExecutor;
|
|
57
52
|
address swapExtRouter;
|
|
53
|
+
address swapApprove;
|
|
58
54
|
bytes swapCalldata;
|
|
59
55
|
}
|
|
60
56
|
|
|
@@ -71,57 +67,47 @@ interface IPCrossChainSwapHub {
|
|
|
71
67
|
uint256 minPtReceived;
|
|
72
68
|
uint32 dstEid;
|
|
73
69
|
bytes32 receiver;
|
|
70
|
+
bool pullFromOwner;
|
|
74
71
|
//
|
|
75
|
-
address swapExecutor;
|
|
76
72
|
address swapExtRouter;
|
|
73
|
+
address swapApprove;
|
|
77
74
|
bytes swapCalldata;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
|
-
event WithdrawToken(
|
|
81
|
-
address indexed owner,
|
|
82
|
-
uint32 boxId,
|
|
83
|
-
bytes32 actionHash,
|
|
84
|
-
address receiver,
|
|
85
|
-
address token,
|
|
86
|
-
uint256 amountWithdraw,
|
|
87
|
-
uint256 amountFee
|
|
88
|
-
);
|
|
77
|
+
event WithdrawToken(address indexed owner, uint32 boxId, address token, uint256 amountWithdraw, uint256 amountFee);
|
|
89
78
|
|
|
90
79
|
event BridgeToken(
|
|
91
80
|
address indexed owner,
|
|
92
81
|
uint32 boxId,
|
|
93
|
-
bytes32 actionHash,
|
|
94
82
|
address bridgeExtRouter,
|
|
95
83
|
address token,
|
|
96
84
|
uint256 amountBridge,
|
|
97
|
-
uint256 amountFee
|
|
85
|
+
uint256 amountFee,
|
|
86
|
+
bool pullFromOwner
|
|
98
87
|
);
|
|
99
88
|
|
|
100
89
|
event SwapToken(
|
|
101
90
|
address indexed owner,
|
|
102
91
|
uint32 boxId,
|
|
103
|
-
bytes32 actionHash,
|
|
104
92
|
address tokenSpent,
|
|
105
93
|
uint256 amountSpent,
|
|
106
94
|
uint256 amountFee,
|
|
107
95
|
address tokenReceived,
|
|
108
|
-
uint256 netTokenReceived
|
|
96
|
+
uint256 netTokenReceived,
|
|
97
|
+
bool pullFromOwner,
|
|
98
|
+
bool sendToOwner
|
|
109
99
|
);
|
|
110
100
|
|
|
111
101
|
event BuyCrossChainPt(
|
|
112
102
|
address indexed owner,
|
|
113
103
|
uint32 boxId,
|
|
114
|
-
bytes32 actionHash,
|
|
115
104
|
address tokenSpent,
|
|
116
105
|
uint256 amountSpent,
|
|
117
106
|
uint256 amountFee,
|
|
118
107
|
address ptAdapter,
|
|
119
108
|
address pt,
|
|
120
|
-
uint256 netPtReceived
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
event ClaimFeeForFailedAction(
|
|
124
|
-
address indexed owner, uint32 boxId, bytes32 actionHash, address token, uint256 amount
|
|
109
|
+
uint256 netPtReceived,
|
|
110
|
+
bool pullFromOwner
|
|
125
111
|
);
|
|
126
112
|
|
|
127
113
|
event SetExecutor(address indexed executor, bool isExecutor);
|
|
@@ -134,11 +120,12 @@ interface IPCrossChainSwapHub {
|
|
|
134
120
|
|
|
135
121
|
function ownerNonce(address owner) external view returns (uint256);
|
|
136
122
|
|
|
137
|
-
function actionStatus(bytes32 actionHash) external view returns (ActionStatus);
|
|
138
|
-
|
|
139
123
|
function isExecutor(address executor) external view returns (bool);
|
|
140
124
|
|
|
141
|
-
function computeDepositBox(address owner, uint32 boxId)
|
|
125
|
+
function computeDepositBox(address owner, uint32 boxId)
|
|
126
|
+
external
|
|
127
|
+
view
|
|
128
|
+
returns (address box, bytes32 salt, bool deployed);
|
|
142
129
|
|
|
143
130
|
function hashTypedData(WithdrawTokenMessage memory message) external view returns (bytes32);
|
|
144
131
|
|
|
@@ -156,13 +143,5 @@ interface IPCrossChainSwapHub {
|
|
|
156
143
|
|
|
157
144
|
function buyCrossChainPt(BuyCrossChainPtMessage memory message, bytes memory signature) external payable;
|
|
158
145
|
|
|
159
|
-
function claimFee(WithdrawTokenMessage memory message, bytes memory signature) external;
|
|
160
|
-
|
|
161
|
-
function claimFee(BridgeTokenMessage memory message, bytes memory signature) external;
|
|
162
|
-
|
|
163
|
-
function claimFee(SwapTokenMessage memory message, bytes memory signature) external;
|
|
164
|
-
|
|
165
|
-
function claimFee(BuyCrossChainPtMessage memory message, bytes memory signature) external;
|
|
166
|
-
|
|
167
146
|
function setExecutor(address executor, bool isExecutor) external;
|
|
168
147
|
}
|