@across-protocol/contracts 5.0.25 → 5.0.27
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/README.md +4 -0
- package/contracts/chain-adapters/CrossDomainEnabled.sol +1 -1
- package/contracts/external/interfaces/IAcrossV5Executor.sol +14 -0
- package/contracts/external/interfaces/IAcrossV5ExecutorAdapter.sol +14 -0
- package/contracts/external/interfaces/IGateway.sol +25 -0
- package/contracts/interfaces/ICounterfactualBeacon.sol +25 -16
- package/contracts/interfaces/ICounterfactualBeaconBase.sol +30 -0
- package/contracts/interfaces/ICounterfactualDeposit.sol +30 -0
- package/contracts/interfaces/ICounterfactualDepositFactory.sol +33 -54
- package/contracts/interfaces/SpokePoolPeripheryInterface.sol +16 -4
- package/contracts/interfaces/V5SpokePoolInterface.sol +71 -0
- package/contracts/libraries/HyperCoreLib.sol +114 -30
- package/contracts/libraries/PeripherySigningLib.sol +56 -0
- package/contracts/libraries/SafeTransferERC20.sol +4 -0
- package/contracts/periphery/SpokePoolPeriphery.sol +81 -19
- package/contracts/periphery/Tron_SpokePoolPeriphery.sol +52 -0
- package/contracts/periphery/counterfactual/AdminWithdrawManager.sol +12 -4
- package/contracts/periphery/counterfactual/CounterfactualBeacon.sol +28 -1
- package/contracts/periphery/counterfactual/CounterfactualBeaconBase.sol +11 -11
- package/contracts/periphery/counterfactual/CounterfactualDeposit.sol +6 -16
- package/contracts/periphery/counterfactual/CounterfactualDepositCCTP.sol +9 -5
- package/contracts/periphery/counterfactual/CounterfactualDepositFactory.sol +3 -5
- package/contracts/periphery/counterfactual/CounterfactualDepositOFT.sol +6 -3
- package/contracts/periphery/counterfactual/CounterfactualDepositSpokePool.sol +24 -8
- package/contracts/periphery/counterfactual/CounterfactualDepositVanillaCCTP.sol +28 -12
- package/contracts/periphery/counterfactual/CounterfactualImplementationBase.sol +8 -7
- package/contracts/periphery/counterfactual/CounterfactualNonces.sol +52 -0
- package/contracts/periphery/mintburn/HyperCoreFlowExecutor.sol +7 -1
- package/contracts/periphery/mintburn/SwapHandler.sol +8 -7
- package/contracts/spoke-pools/Arbitrum_SpokePool.sol +10 -2
- package/contracts/spoke-pools/Cher_SpokePool.sol +4 -2
- package/contracts/spoke-pools/Ethereum_SpokePool.sol +4 -2
- package/contracts/spoke-pools/Lens_SpokePool.sol +7 -2
- package/contracts/spoke-pools/Linea_SpokePool.sol +4 -2
- package/contracts/spoke-pools/Lisk_SpokePool.sol +4 -2
- package/contracts/spoke-pools/OP_SpokePool.sol +4 -2
- package/contracts/spoke-pools/Ovm_SpokePool.sol +7 -5
- package/contracts/spoke-pools/Polygon_SpokePool.sol +10 -2
- package/contracts/spoke-pools/SpokePool.sol +181 -25
- package/contracts/spoke-pools/Tron_SpokePool.sol +4 -2
- package/contracts/spoke-pools/Universal_SpokePool.sol +10 -2
- package/contracts/spoke-pools/ZkSync_SpokePool.sol +7 -2
- package/contracts/test/MockGateway.sol +33 -0
- package/contracts/test/MockSpokePool.sol +4 -1
- package/contracts/test/MockSpokePoolV2.sol +1 -1
- package/contracts/tron/TronCounterfactualImports.sol +2 -0
- package/contracts/tron/TronPeripheryImports.sol +5 -2
- package/dist/broadcast/deployed-addresses.json +611 -447
- package/dist/evm/artifacts/AcrossConfigStore.sol/AcrossConfigStore.json +1 -1
- package/dist/evm/artifacts/AcrossEventEmitter.sol/AcrossEventEmitter.json +1 -1
- package/dist/evm/artifacts/AcrossMerkleDistributor.sol/AcrossMerkleDistributor.json +1 -1
- package/dist/evm/artifacts/AcrossMessageHandlerMock.sol/AcrossMessageHandlerMock.json +1 -1
- package/dist/evm/artifacts/AdapterStore.sol/AdapterStore.json +1 -1
- package/dist/evm/artifacts/AdapterStore.sol/MessengerTypes.json +1 -1
- package/dist/evm/artifacts/Address.sol/Address.json +1 -1
- package/dist/evm/artifacts/AddressConverters.sol/Bytes32ToAddress.json +1 -1
- package/dist/evm/artifacts/AdminRelayTokensAdapter.sol/AdminRelayTokensAdapter.json +1 -1
- package/dist/evm/artifacts/AdminWithdrawManager.sol/AdminWithdrawManager.json +1 -1
- package/dist/evm/artifacts/ArbitrumMocks.sol/ArbitrumMockErc20GatewayRouter.json +1 -1
- package/dist/evm/artifacts/ArbitrumMocks.sol/Inbox.json +1 -1
- package/dist/evm/artifacts/ArbitrumMocks.sol/L2GatewayRouter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_Adapter.sol/Arbitrum_Adapter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_CustomGasToken_Adapter.sol/Arbitrum_CustomGasToken_Adapter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_Forwarder.sol/Arbitrum_Forwarder.json +1 -1
- package/dist/evm/artifacts/Arbitrum_RescueAdapter.sol/Arbitrum_RescueAdapter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_SendTokensAdapter.sol/Arbitrum_SendTokensAdapter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_SpokePool.sol/Arbitrum_SpokePool.json +1 -1
- package/dist/evm/artifacts/Arbitrum_WithdrawalHelper.sol/Arbitrum_WithdrawalHelper.json +1 -1
- package/dist/evm/artifacts/Base_Adapter.sol/Base_Adapter.json +1 -1
- package/dist/evm/artifacts/BeaconProxy.sol/BeaconProxy.json +1 -1
- package/dist/evm/artifacts/BondToken.sol/BondToken.json +1 -1
- package/dist/evm/artifacts/BytesLib.sol/BytesLib.json +1 -1
- package/dist/evm/artifacts/Cher_SpokePool.sol/Cher_SpokePool.json +1 -1
- package/dist/evm/artifacts/CircleCCTPAdapter.sol/CircleDomainIds.json +1 -1
- package/dist/evm/artifacts/Constants.sol/Constants.json +1 -1
- package/dist/evm/artifacts/Constants.sol/OptimisticOracleConstraints.json +1 -1
- package/dist/evm/artifacts/Constants.sol/OracleInterfaces.json +1 -1
- package/dist/evm/artifacts/CoreExecution.sol/CoreExecution.json +1 -1
- package/dist/evm/artifacts/CoreSimulatorLib.sol/HypeSystemContract.json +1 -1
- package/dist/evm/artifacts/CoreState.sol/CoreState.json +1 -1
- package/dist/evm/artifacts/CoreView.sol/CoreView.json +1 -1
- package/dist/evm/artifacts/CoreWriterLib.sol/CoreWriterLib.json +1 -1
- package/dist/evm/artifacts/CoreWriterSim.sol/CoreWriterSim.json +1 -1
- package/dist/evm/artifacts/CounterfactualBeacon.sol/CounterfactualBeacon.json +1 -1
- package/dist/evm/artifacts/CounterfactualBeaconBase.sol/CounterfactualBeaconBase.json +1 -1
- package/dist/evm/artifacts/CounterfactualBeaconBootstrap.sol/CounterfactualBeaconBootstrap.json +1 -1
- package/dist/evm/artifacts/CounterfactualConfig.sol/CounterfactualConfig.json +1 -1
- package/dist/evm/artifacts/CounterfactualDeposit.sol/CounterfactualDeposit.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositCCTP.sol/CounterfactualDepositCCTP.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositFactory.sol/CounterfactualDepositFactory.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositFactoryTron.sol/CounterfactualDepositFactoryTron.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositOFT.sol/CounterfactualDepositOFT.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositSpokePool.sol/CounterfactualDepositSpokePool.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositSpokePoolTr.sol/CounterfactualDepositSpokePoolTr.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositVanillaCCTP.sol/CounterfactualDepositVanillaCCTP.json +1 -1
- package/dist/evm/artifacts/CounterfactualNonces.sol/CounterfactualNonces.json +1 -0
- package/dist/evm/artifacts/Create2.sol/Create2.json +1 -1
- package/dist/evm/artifacts/CrossDomainEnabled.sol/CrossDomainEnabled.json +1 -1
- package/dist/evm/artifacts/DeployedAddresses.sol/DeployedAddresses.json +1 -1
- package/dist/evm/artifacts/DeploymentUtils.sol/DeploymentUtils.json +1 -1
- package/dist/evm/artifacts/DoctorWho_Adapter.sol/DoctorWho_Adapter.json +1 -1
- package/dist/evm/artifacts/DonationBox.sol/DonationBox.json +1 -1
- package/dist/evm/artifacts/DstOFTHandler.sol/DstOFTHandler.json +1 -1
- package/dist/evm/artifacts/ECDSA.sol/ECDSA.json +1 -1
- package/dist/evm/artifacts/ERC1155.sol/ERC1155.json +1 -1
- package/dist/evm/artifacts/ERC1967Proxy.sol/ERC1967Proxy.json +1 -1
- package/dist/evm/artifacts/ERC1967Utils.sol/ERC1967Utils.json +1 -1
- package/dist/evm/artifacts/ERC20.sol/ERC20.json +1 -1
- package/dist/evm/artifacts/Errors.sol/Errors.json +1 -1
- package/dist/evm/artifacts/Ethereum_Adapter.sol/Ethereum_Adapter.json +1 -1
- package/dist/evm/artifacts/Ethereum_RescueAdapter.sol/Ethereum_RescueAdapter.json +1 -1
- package/dist/evm/artifacts/Ethereum_SpokePool.sol/Ethereum_SpokePool.json +1 -1
- package/dist/evm/artifacts/ExpandedERC20.sol/ExpandedERC20.json +1 -1
- package/dist/evm/artifacts/ExpandedERC20WithBlacklist.sol/ExpandedERC20WithBlacklist.json +1 -1
- package/dist/evm/artifacts/HLConstants.sol/HLConstants.json +1 -1
- package/dist/evm/artifacts/HLConversions.sol/HLConversions.json +1 -1
- package/dist/evm/artifacts/HubPool.sol/HubPool.json +1 -1
- package/dist/evm/artifacts/HubPoolStore.sol/HubPoolStore.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/HubPoolTestBase.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockAddressWhitelist.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockFinder.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockIdentifierWhitelist.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockLpTokenFactory.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockOptimisticOracle.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockStore.json +1 -1
- package/dist/evm/artifacts/HyperCore.sol/HyperCore.json +1 -1
- package/dist/evm/artifacts/HyperCoreFlowExecutor.sol/HyperCoreFlowExecutor.json +1 -1
- package/dist/evm/artifacts/HyperCoreLib.sol/HyperCoreLib.json +1 -1
- package/dist/evm/artifacts/HyperliquidDepositHandler.sol/HyperliquidDepositHandler.json +1 -1
- package/dist/evm/artifacts/IAcrossV5Executor.sol/IAcrossV5Executor.json +1 -0
- package/dist/evm/artifacts/IAcrossV5ExecutorAdapter.sol/IAcrossV5ExecutorAdapter.json +1 -0
- package/dist/evm/artifacts/ICounterfactualBeacon.sol/ICounterfactualBeacon.json +1 -1
- package/dist/evm/artifacts/ICounterfactualBeaconBase.sol/ICounterfactualBeaconBase.json +1 -0
- package/dist/evm/artifacts/ICounterfactualDeposit.sol/ICounterfactualDeposit.json +1 -1
- package/dist/evm/artifacts/ICounterfactualDepositFactory.sol/ICounterfactualDepositFactory.json +1 -1
- package/dist/evm/artifacts/IGateway.sol/IGateway.json +1 -0
- package/dist/evm/artifacts/Lens_SpokePool.sol/Lens_SpokePool.json +1 -1
- package/dist/evm/artifacts/LibVariable.sol/LibVariable.json +1 -1
- package/dist/evm/artifacts/LineaMocks.sol/MockL2MessageService.json +1 -1
- package/dist/evm/artifacts/LineaMocks.sol/MockL2TokenBridge.json +1 -1
- package/dist/evm/artifacts/Linea_Adapter.sol/Linea_Adapter.json +1 -1
- package/dist/evm/artifacts/Linea_SpokePool.sol/Linea_SpokePool.json +1 -1
- package/dist/evm/artifacts/Lisk_Adapter.sol/Lisk_Adapter.json +1 -1
- package/dist/evm/artifacts/Lisk_SpokePool.sol/Lisk_SpokePool.json +1 -1
- package/dist/evm/artifacts/Lockable.sol/Lockable.json +1 -1
- package/dist/evm/artifacts/LpTokenFactory.sol/LpTokenFactory.json +1 -1
- package/dist/evm/artifacts/Merkle.sol/Merkle.json +1 -1
- package/dist/evm/artifacts/MerkleDistributor.sol/MerkleDistributor.json +1 -1
- package/dist/evm/artifacts/MerkleLibTest.sol/MerkleLibTest.json +1 -1
- package/dist/evm/artifacts/MerkleProof.sol/MerkleProof.json +1 -1
- package/dist/evm/artifacts/MinimalLZOptions.sol/MinimalLZOptions.json +1 -1
- package/dist/evm/artifacts/MintableERC1155.sol/MintableERC1155.json +1 -1
- package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockCrossDomainMessenger.json +1 -1
- package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockL1StandardBridge.json +1 -1
- package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockL2StandardBridge.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessageTransmitter.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessenger.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessengerV2.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMinter.json +1 -1
- package/dist/evm/artifacts/MockCaller.sol/MockCaller.json +1 -1
- package/dist/evm/artifacts/MockERC1271.sol/MockERC1271.json +1 -1
- package/dist/evm/artifacts/MockERC20.sol/MintableERC20.json +1 -1
- package/dist/evm/artifacts/MockERC20.sol/MockERC20.json +1 -1
- package/dist/evm/artifacts/MockEndpoint.sol/MockEndpoint.json +1 -1
- package/dist/evm/artifacts/MockGateway.sol/MockGateway.json +1 -0
- package/dist/evm/artifacts/MockHubPool.sol/MockHubPool.json +1 -1
- package/dist/evm/artifacts/MockOFTMessenger.sol/MockOFTMessenger.json +1 -1
- package/dist/evm/artifacts/MockPermit2.sol/MockPermit2.json +1 -1
- package/dist/evm/artifacts/MockPermit2.sol/Permit2EIP712.json +1 -1
- package/dist/evm/artifacts/MockPermit2.sol/SignatureVerification.json +1 -1
- package/dist/evm/artifacts/MockSpokePool.sol/MockSpokePool.json +1 -1
- package/dist/evm/artifacts/MockSpokePoolV2.sol/MockSpokePoolV2.json +1 -1
- package/dist/evm/artifacts/MockTronUSDT.sol/MockTronUSDT.json +1 -1
- package/dist/evm/artifacts/MockZkStackBridgeHub.sol/MockBridgeHub.json +1 -1
- package/dist/evm/artifacts/Mock_Adapter.sol/Mock_Adapter.json +1 -1
- package/dist/evm/artifacts/Mock_Adapter.sol/Mock_Bridge.json +1 -1
- package/dist/evm/artifacts/Mode_Adapter.sol/Mode_Adapter.json +1 -1
- package/dist/evm/artifacts/MultiCaller.sol/MultiCaller.json +1 -1
- package/dist/evm/artifacts/MultiCallerUpgradeable.sol/MultiCallerUpgradeable.json +1 -1
- package/dist/evm/artifacts/Multicall3.sol/Multicall3.json +1 -1
- package/dist/evm/artifacts/MulticallHandler.sol/MulticallHandler.json +1 -1
- package/dist/evm/artifacts/OFTTransportAdapter.sol/OFTTransportAdapter.json +1 -1
- package/dist/evm/artifacts/OFTTransportAdapterWithStore.sol/OFTTransportAdapterWithStore.json +1 -1
- package/dist/evm/artifacts/OP_Adapter.sol/OP_Adapter.json +1 -1
- package/dist/evm/artifacts/OP_SpokePool.sol/OP_SpokePool.json +1 -1
- package/dist/evm/artifacts/Ovm_Forwarder.sol/Ovm_Forwarder.json +1 -1
- package/dist/evm/artifacts/Ovm_SpokePool.sol/Ovm_SpokePool.json +1 -1
- package/dist/evm/artifacts/Ovm_WithdrawalHelper.sol/Ovm_WithdrawalHelper.json +1 -1
- package/dist/evm/artifacts/PeripherySigningLib.sol/PeripherySigningLib.json +1 -1
- package/dist/evm/artifacts/PermissionedMulticallHandler.sol/PermissionedMulticallHandler.json +1 -1
- package/dist/evm/artifacts/PolygonERC20Test.sol/PolygonERC20Test.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/DepositManagerMock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/FxStateSenderMock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/PolygonERC20Mock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/PolygonERC20PredicateMock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/PolygonRegistryMock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/RootChainManagerMock.json +1 -1
- package/dist/evm/artifacts/PolygonTokenBridger.sol/PolygonTokenBridger.json +1 -1
- package/dist/evm/artifacts/Polygon_Adapter.sol/Polygon_Adapter.json +1 -1
- package/dist/evm/artifacts/Polygon_SpokePool.sol/Polygon_SpokePool.json +1 -1
- package/dist/evm/artifacts/PrecompileLib.sol/PrecompileLib.json +1 -1
- package/dist/evm/artifacts/PrecompileSim.sol/PrecompileSim.json +1 -1
- package/dist/evm/artifacts/ProxyAdmin.sol/ProxyAdmin.json +1 -1
- package/dist/evm/artifacts/Router_Adapter.sol/Router_Adapter.json +1 -1
- package/dist/evm/artifacts/SP1AutoVerifier.sol/SP1AutoVerifier.json +1 -1
- package/dist/evm/artifacts/SP1Helios.sol/SP1Helios.json +1 -1
- package/dist/evm/artifacts/SP1MockVerifier.sol/SP1MockVerifier.json +1 -1
- package/dist/evm/artifacts/SafeCast.sol/SafeCast.json +1 -1
- package/dist/evm/artifacts/SafeERC20.sol/SafeERC20.json +1 -1
- package/dist/evm/artifacts/ShortStrings.sol/ShortStrings.json +1 -1
- package/dist/evm/artifacts/Solana_Adapter.sol/Solana_Adapter.json +1 -1
- package/dist/evm/artifacts/SpokePool.sol/SpokePool.json +1 -1
- package/dist/evm/artifacts/SpokePoolPeriphery.sol/SpokePoolPeriphery.json +1 -1
- package/dist/evm/artifacts/SpokePoolPeriphery.sol/SwapProxy.json +1 -1
- package/dist/evm/artifacts/SpokePoolVerifier.sol/SpokePoolVerifier.json +1 -1
- package/dist/evm/artifacts/SponsoredCCTPDstPeriphery.sol/SponsoredCCTPDstPeriphery.json +1 -1
- package/dist/evm/artifacts/SponsoredCCTPSrcPeriphery.sol/SponsoredCCTPSrcPeriphery.json +1 -1
- package/dist/evm/artifacts/SponsoredOFTSrcPeriphery.sol/SponsoredOFTSrcPeriphery.json +1 -1
- package/dist/evm/artifacts/StdConfig.sol/StdConfig.json +1 -1
- package/dist/evm/artifacts/Strings.sol/Strings.json +1 -1
- package/dist/evm/artifacts/SwapHandler.sol/SwapHandler.json +1 -1
- package/dist/evm/artifacts/Timer.sol/Timer.json +1 -1
- package/dist/evm/artifacts/TransferProxy.sol/TransferProxy.json +1 -1
- package/dist/evm/artifacts/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +1 -1
- package/dist/evm/artifacts/TronMulticallHandler.sol/TronMulticallHandler.json +1 -1
- package/dist/evm/artifacts/TronTransferLib.sol/TronTransferLib.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePool.sol/Tron_SpokePool.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SpokePoolPeriphery.json +1 -0
- package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SwapProxy.json +1 -0
- package/dist/evm/artifacts/Universal_Adapter.sol/Universal_Adapter.json +1 -1
- package/dist/evm/artifacts/Universal_SpokePool.sol/Universal_SpokePool.json +1 -1
- package/dist/evm/artifacts/UpgradeableBeacon.sol/UpgradeableBeacon.json +1 -1
- package/dist/evm/artifacts/V5SpokePoolInterface.sol/V5SpokePoolInterface.json +1 -0
- package/dist/evm/artifacts/WETH9.sol/WETH9.json +1 -1
- package/dist/evm/artifacts/WithdrawImplementation.sol/WithdrawImplementation.json +1 -1
- package/dist/evm/artifacts/WithdrawImplementationTron.sol/WithdrawImplementationTron.json +1 -1
- package/dist/evm/artifacts/ZkStack_Adapter.sol/ZkStack_Adapter.json +1 -1
- package/dist/evm/artifacts/ZkStack_CustomGasToken_Adapter.sol/ZkStack_CustomGasToken_Adapter.json +1 -1
- package/dist/evm/artifacts/ZkSyncMocks.sol/MockL2Eth.json +1 -1
- package/dist/evm/artifacts/ZkSyncMocks.sol/MockZkBridge.json +1 -1
- package/dist/evm/artifacts/ZkSync_SpokePool.sol/ZkSync_SpokePool.json +1 -1
- package/dist/evm/artifacts/Zora_Adapter.sol/Zora_Adapter.json +1 -1
- package/dist/evm/artifacts/eraVM_EIP7702.sol/SimpleContract.json +1 -1
- package/dist/evm/artifacts/eraVM_EIP7702.sol/SpokePoolEIP7702Test.json +1 -1
- package/dist/evm/artifacts/eraVM_EIP7702.sol/TestableMockSpokePool.json +1 -1
- package/dist/src/consts.d.ts +2 -0
- package/dist/src/consts.js +21 -47
- package/dist/src/svm/assets/idl/svm_spoke.json +9 -4
- package/dist/src/svm/assets/svm_spoke.d.ts +9 -4
- package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.d.ts +3 -1
- package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.js +4 -1
- package/dist/src/types/svm.d.ts +44 -0
- package/dist/target/types/svm_spoke.d.ts +9 -4
- package/package.json +12 -6
- package/contracts/chain-adapters/Blast_Adapter.sol +0 -127
- package/contracts/chain-adapters/Blast_RescueAdapter.sol +0 -47
- package/contracts/chain-adapters/Boba_Adapter.sol +0 -78
- package/contracts/chain-adapters/Optimism_Adapter.sol +0 -118
- package/contracts/chain-adapters/PolygonZkEVM_Adapter.sol +0 -75
- package/contracts/chain-adapters/Scroll_Adapter.sol +0 -144
- package/contracts/external/interfaces/IPolygonZkEVMBridge.sol +0 -40
- package/contracts/hub-pool/Blast_DaiRetriever.sol +0 -59
- package/contracts/hub-pool/PermissionSplitterProxy.sol +0 -128
- package/contracts/spoke-pools/Blast_SpokePool.sol +0 -161
- package/contracts/spoke-pools/Boba_SpokePool.sol +0 -45
- package/contracts/spoke-pools/Ink_SpokePool.sol +0 -72
- package/contracts/spoke-pools/Optimism_SpokePool.sol +0 -66
- package/contracts/spoke-pools/PolygonZkEVM_SpokePool.sol +0 -217
- package/contracts/spoke-pools/Scroll_SpokePool.sol +0 -153
- package/contracts/spoke-pools/WorldChain_SpokePool.sol +0 -72
- package/contracts/test/MockBlastUsdYieldManager.sol +0 -20
- package/contracts/test/MockOptimism_SpokePool.sol +0 -22
- package/contracts/test/PolygonZkEVMMocks.sol +0 -72
- package/contracts/test/ScrollMocks.sol +0 -109
- package/dist/evm/artifacts/Blast_Adapter.sol/Blast_Adapter.json +0 -1
- package/dist/evm/artifacts/Blast_Adapter.sol/IL1ERC20Bridge.json +0 -1
- package/dist/evm/artifacts/Blast_DaiRetriever.sol/Blast_DaiRetriever.json +0 -1
- package/dist/evm/artifacts/Blast_DaiRetriever.sol/USDYieldManager.json +0 -1
- package/dist/evm/artifacts/Blast_RescueAdapter.sol/Blast_RescueAdapter.json +0 -1
- package/dist/evm/artifacts/Blast_SpokePool.sol/Blast_SpokePool.json +0 -1
- package/dist/evm/artifacts/Blast_SpokePool.sol/IBlast.json +0 -1
- package/dist/evm/artifacts/Blast_SpokePool.sol/IERC20Rebasing.json +0 -1
- package/dist/evm/artifacts/Blast_SpokePool.sol/IUSDBL2Bridge.json +0 -1
- package/dist/evm/artifacts/Boba_Adapter.sol/Boba_Adapter.json +0 -1
- package/dist/evm/artifacts/Boba_SpokePool.sol/Boba_SpokePool.json +0 -1
- package/dist/evm/artifacts/IL1ERC20Gateway.sol/IL1ERC20Gateway.json +0 -1
- package/dist/evm/artifacts/IL1ETHGateway.sol/IL1ETHGateway.json +0 -1
- package/dist/evm/artifacts/IL1GatewayRouter.sol/IL1GatewayRouter.json +0 -1
- package/dist/evm/artifacts/IL1ScrollMessenger.sol/IL1ScrollMessenger.json +0 -1
- package/dist/evm/artifacts/IL2ERC20Gateway.sol/IL2ERC20Gateway.json +0 -1
- package/dist/evm/artifacts/IL2ETHGateway.sol/IL2ETHGateway.json +0 -1
- package/dist/evm/artifacts/IL2GasPriceOracle.sol/IL2GasPriceOracle.json +0 -1
- package/dist/evm/artifacts/IL2GatewayRouter.sol/IL2GatewayRouter.json +0 -1
- package/dist/evm/artifacts/IPolygonZkEVMBridge.sol/IPolygonZkEVMBridge.json +0 -1
- package/dist/evm/artifacts/IScrollMessenger.sol/IScrollMessenger.json +0 -1
- package/dist/evm/artifacts/Ink_SpokePool.sol/Ink_SpokePool.json +0 -1
- package/dist/evm/artifacts/MockBlastUsdYieldManager.sol/MockBlastUsdYieldManager.json +0 -1
- package/dist/evm/artifacts/MockOptimism_SpokePool.sol/MockOptimism_SpokePool.json +0 -1
- package/dist/evm/artifacts/Optimism_Adapter.sol/Optimism_Adapter.json +0 -1
- package/dist/evm/artifacts/Optimism_Adapter.sol/SynthetixBridgeToOptimism.json +0 -1
- package/dist/evm/artifacts/Optimism_SpokePool.sol/Optimism_SpokePool.json +0 -1
- package/dist/evm/artifacts/Optimism_SpokePool.sol/SynthetixBridgeToBase.json +0 -1
- package/dist/evm/artifacts/PermissionSplitterProxy.sol/PermissionSplitterProxy.json +0 -1
- package/dist/evm/artifacts/PolygonZkEVMMocks.sol/MockPolygonZkEVMBridge.json +0 -1
- package/dist/evm/artifacts/PolygonZkEVM_Adapter.sol/PolygonZkEVM_Adapter.json +0 -1
- package/dist/evm/artifacts/PolygonZkEVM_SpokePool.sol/IBridgeMessageReceiver.json +0 -1
- package/dist/evm/artifacts/PolygonZkEVM_SpokePool.sol/PolygonZkEVM_SpokePool.json +0 -1
- package/dist/evm/artifacts/ScrollMocks.sol/MockScrollL2GatewayRouter.json +0 -1
- package/dist/evm/artifacts/ScrollMocks.sol/MockScrollMessenger.json +0 -1
- package/dist/evm/artifacts/Scroll_Adapter.sol/Scroll_Adapter.json +0 -1
- package/dist/evm/artifacts/Scroll_SpokePool.sol/IL2GatewayRouterExtended.json +0 -1
- package/dist/evm/artifacts/Scroll_SpokePool.sol/Scroll_SpokePool.json +0 -1
- package/dist/evm/artifacts/WorldChain_SpokePool.sol/WorldChain_SpokePool.json +0 -1
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "./interfaces/AdapterInterface.sol";
|
|
5
|
-
import "../external/interfaces/WETH9Interface.sol";
|
|
6
|
-
|
|
7
|
-
// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need
|
|
8
|
-
// this contract's state variables to be `immutable` because of the delegateCall call.
|
|
9
|
-
import "./CrossDomainEnabled.sol";
|
|
10
|
-
import "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol";
|
|
11
|
-
|
|
12
|
-
import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
|
|
13
|
-
import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @notice Contract containing logic to send messages from L1 to Boba. This is a modified version of the Optimism adapter
|
|
17
|
-
* that excludes the custom bridging logic.
|
|
18
|
-
* @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be
|
|
19
|
-
* called via delegatecall, which will execute this contract's logic within the context of the originating contract.
|
|
20
|
-
* For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods
|
|
21
|
-
* that call this contract's logic guard against reentrancy.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
// solhint-disable-next-line contract-name-camelcase
|
|
25
|
-
contract Boba_Adapter is CrossDomainEnabled, AdapterInterface {
|
|
26
|
-
using SafeERC20 for IERC20;
|
|
27
|
-
uint32 public immutable L2_GAS_LIMIT = 2_000_000;
|
|
28
|
-
|
|
29
|
-
WETH9Interface public immutable L1_WETH;
|
|
30
|
-
|
|
31
|
-
IL1StandardBridge public immutable L1_STANDARD_BRIDGE;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @notice Constructs new Adapter.
|
|
35
|
-
* @param _l1Weth WETH address on L1.
|
|
36
|
-
* @param _crossDomainMessenger XDomainMessenger Boba system contract.
|
|
37
|
-
* @param _l1StandardBridge Standard bridge contract.
|
|
38
|
-
*/
|
|
39
|
-
constructor(
|
|
40
|
-
WETH9Interface _l1Weth,
|
|
41
|
-
address _crossDomainMessenger,
|
|
42
|
-
IL1StandardBridge _l1StandardBridge
|
|
43
|
-
) CrossDomainEnabled(_crossDomainMessenger) {
|
|
44
|
-
L1_WETH = _l1Weth;
|
|
45
|
-
L1_STANDARD_BRIDGE = _l1StandardBridge;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @notice Send cross-chain message to target on Boba.
|
|
50
|
-
* @param target Contract on Boba that will receive message.
|
|
51
|
-
* @param message Data to send to target.
|
|
52
|
-
*/
|
|
53
|
-
function relayMessage(address target, bytes calldata message) external payable override {
|
|
54
|
-
sendCrossDomainMessage(target, uint32(L2_GAS_LIMIT), message);
|
|
55
|
-
emit MessageRelayed(target, message);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @notice Bridge tokens to Boba.
|
|
60
|
-
* @param l1Token L1 token to deposit.
|
|
61
|
-
* @param l2Token L2 token to receive.
|
|
62
|
-
* @param amount Amount of L1 tokens to deposit and L2 tokens to receive.
|
|
63
|
-
* @param to Bridge recipient.
|
|
64
|
-
*/
|
|
65
|
-
function relayTokens(address l1Token, address l2Token, uint256 amount, address to) external payable override {
|
|
66
|
-
// If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.
|
|
67
|
-
if (l1Token == address(L1_WETH)) {
|
|
68
|
-
L1_WETH.withdraw(amount);
|
|
69
|
-
L1_STANDARD_BRIDGE.depositETHTo{ value: amount }(to, L2_GAS_LIMIT, "");
|
|
70
|
-
} else {
|
|
71
|
-
IL1StandardBridge _l1StandardBridge = L1_STANDARD_BRIDGE;
|
|
72
|
-
|
|
73
|
-
IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);
|
|
74
|
-
_l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, L2_GAS_LIMIT, "");
|
|
75
|
-
}
|
|
76
|
-
emit TokensRelayed(l1Token, l2Token, amount, to);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "./interfaces/AdapterInterface.sol";
|
|
5
|
-
import "../external/interfaces/WETH9Interface.sol";
|
|
6
|
-
import "../libraries/CircleCCTPAdapter.sol";
|
|
7
|
-
import "../external/interfaces/CCTPInterfaces.sol";
|
|
8
|
-
|
|
9
|
-
// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need
|
|
10
|
-
// this contract's state variables to be `immutable` because of the delegateCall call.
|
|
11
|
-
import "./CrossDomainEnabled.sol";
|
|
12
|
-
import "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol";
|
|
13
|
-
|
|
14
|
-
import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
|
|
15
|
-
import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @notice Interface for Synthetix custom bridge to Optimism.
|
|
19
|
-
*/
|
|
20
|
-
interface SynthetixBridgeToOptimism is IL1StandardBridge {
|
|
21
|
-
/**
|
|
22
|
-
* @notice Send tokens to Optimism.
|
|
23
|
-
* @param to Address to send tokens to on L2.
|
|
24
|
-
* @param amount Amount of tokens to send.
|
|
25
|
-
*/
|
|
26
|
-
function depositTo(address to, uint256 amount) external;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @notice Contract containing logic to send messages from L1 to Optimism.
|
|
31
|
-
* @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be
|
|
32
|
-
* called via delegatecall, which will execute this contract's logic within the context of the originating contract.
|
|
33
|
-
* For example, the HubPool will delegatecall these functions, therefore it's only necessary that the HubPool's methods
|
|
34
|
-
* that call this contract's logic guard against reentrancy.
|
|
35
|
-
* @custom:security-contact bugs@across.to
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
// solhint-disable-next-line contract-name-camelcase
|
|
39
|
-
contract Optimism_Adapter is CrossDomainEnabled, AdapterInterface, CircleCCTPAdapter {
|
|
40
|
-
using SafeERC20 for IERC20;
|
|
41
|
-
uint32 public constant L2_GAS_LIMIT = 200_000;
|
|
42
|
-
|
|
43
|
-
WETH9Interface public immutable L1_WETH;
|
|
44
|
-
|
|
45
|
-
IL1StandardBridge public immutable L1_STANDARD_BRIDGE;
|
|
46
|
-
|
|
47
|
-
// Optimism has the ability to support "custom" bridges. These bridges are not supported by the canonical bridge
|
|
48
|
-
// and so we need to store the address of the custom token and the associated bridge. In the event we want to
|
|
49
|
-
// support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the
|
|
50
|
-
// adapter. A full list of custom optimism tokens and their associated bridges can be found here:
|
|
51
|
-
// https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json
|
|
52
|
-
address public constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
|
|
53
|
-
address public constant DAI_OPTIMISM_BRIDGE = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;
|
|
54
|
-
address public constant SNX = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;
|
|
55
|
-
address public constant SNX_OPTIMISM_BRIDGE = 0x39Ea01a0298C315d149a490E34B59Dbf2EC7e48F;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @notice Constructs new Adapter.
|
|
59
|
-
* @param _l1Weth WETH address on L1.
|
|
60
|
-
* @param _crossDomainMessenger XDomainMessenger Optimism system contract.
|
|
61
|
-
* @param _l1StandardBridge Standard bridge contract.
|
|
62
|
-
* @param _l1Usdc USDC address on L1.
|
|
63
|
-
* @param _cctpTokenMessenger TokenMessenger contract to bridge via CCTP.
|
|
64
|
-
*/
|
|
65
|
-
constructor(
|
|
66
|
-
WETH9Interface _l1Weth,
|
|
67
|
-
address _crossDomainMessenger,
|
|
68
|
-
IL1StandardBridge _l1StandardBridge,
|
|
69
|
-
IERC20 _l1Usdc,
|
|
70
|
-
ITokenMessenger _cctpTokenMessenger
|
|
71
|
-
)
|
|
72
|
-
CrossDomainEnabled(_crossDomainMessenger)
|
|
73
|
-
CircleCCTPAdapter(_l1Usdc, _cctpTokenMessenger, CircleDomainIds.Optimism)
|
|
74
|
-
{
|
|
75
|
-
L1_WETH = _l1Weth;
|
|
76
|
-
L1_STANDARD_BRIDGE = _l1StandardBridge;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @notice Send cross-chain message to target on Optimism.
|
|
81
|
-
* @param target Contract on Optimism that will receive message.
|
|
82
|
-
* @param message Data to send to target.
|
|
83
|
-
*/
|
|
84
|
-
function relayMessage(address target, bytes calldata message) external payable override {
|
|
85
|
-
sendCrossDomainMessage(target, L2_GAS_LIMIT, message);
|
|
86
|
-
emit MessageRelayed(target, message);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @notice Bridge tokens to Optimism.
|
|
91
|
-
* @param l1Token L1 token to deposit.
|
|
92
|
-
* @param l2Token L2 token to receive.
|
|
93
|
-
* @param amount Amount of L1 tokens to deposit and L2 tokens to receive.
|
|
94
|
-
* @param to Bridge recipient.
|
|
95
|
-
*/
|
|
96
|
-
function relayTokens(address l1Token, address l2Token, uint256 amount, address to) external payable override {
|
|
97
|
-
// If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.
|
|
98
|
-
if (l1Token == address(L1_WETH)) {
|
|
99
|
-
L1_WETH.withdraw(amount);
|
|
100
|
-
L1_STANDARD_BRIDGE.depositETHTo{ value: amount }(to, L2_GAS_LIMIT, "");
|
|
101
|
-
}
|
|
102
|
-
// If the l1Token is USDC, then we send it to the CCTP bridge
|
|
103
|
-
else if (_isCCTPEnabled() && l1Token == address(usdcToken)) {
|
|
104
|
-
_transferUsdc(to, amount);
|
|
105
|
-
} else {
|
|
106
|
-
address bridgeToUse = address(L1_STANDARD_BRIDGE);
|
|
107
|
-
|
|
108
|
-
// Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.
|
|
109
|
-
if (l1Token == DAI) bridgeToUse = DAI_OPTIMISM_BRIDGE; // 1. DAI
|
|
110
|
-
if (l1Token == SNX) bridgeToUse = SNX_OPTIMISM_BRIDGE; // 2. SNX
|
|
111
|
-
|
|
112
|
-
IERC20(l1Token).safeIncreaseAllowance(bridgeToUse, amount);
|
|
113
|
-
if (l1Token == SNX) SynthetixBridgeToOptimism(bridgeToUse).depositTo(to, amount);
|
|
114
|
-
else IL1StandardBridge(bridgeToUse).depositERC20To(l1Token, l2Token, to, amount, L2_GAS_LIMIT, "");
|
|
115
|
-
}
|
|
116
|
-
emit TokensRelayed(l1Token, l2Token, amount, to);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "./interfaces/AdapterInterface.sol";
|
|
5
|
-
import "../external/interfaces/WETH9Interface.sol";
|
|
6
|
-
import "../external/interfaces/IPolygonZkEVMBridge.sol";
|
|
7
|
-
|
|
8
|
-
import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
|
|
9
|
-
import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @notice Supports sending messages and tokens from L1 to PolygonZkEVM.
|
|
13
|
-
* @custom:security-contact bugs@across.to
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
// solhint-disable-next-line contract-name-camelcase
|
|
17
|
-
contract PolygonZkEVM_Adapter is AdapterInterface {
|
|
18
|
-
using SafeERC20 for IERC20;
|
|
19
|
-
|
|
20
|
-
WETH9Interface public immutable L1_WETH;
|
|
21
|
-
// Address of Polygon zkEVM's Canonical Bridge on L1.
|
|
22
|
-
IPolygonZkEVMBridge public immutable L1_POLYGON_ZKEVM_BRIDGE;
|
|
23
|
-
|
|
24
|
-
// Polygon's internal network id for zkEVM.
|
|
25
|
-
uint32 public constant POLYGON_ZKEVM_L2_NETWORK_ID = 1;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @notice Constructs new Adapter.
|
|
29
|
-
* @param _l1Weth WETH address on L1.
|
|
30
|
-
* @param _l1PolygonZkEVMBridge Canonical token bridge contract on L1.
|
|
31
|
-
*/
|
|
32
|
-
constructor(WETH9Interface _l1Weth, IPolygonZkEVMBridge _l1PolygonZkEVMBridge) {
|
|
33
|
-
L1_WETH = _l1Weth;
|
|
34
|
-
L1_POLYGON_ZKEVM_BRIDGE = _l1PolygonZkEVMBridge;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @notice Send cross-chain message to target on Polygon zkEVM.
|
|
39
|
-
* @param target Contract on Polygon zkEVM that will receive message.
|
|
40
|
-
* @param message Data to send to target.
|
|
41
|
-
*/
|
|
42
|
-
function relayMessage(address target, bytes calldata message) external payable override {
|
|
43
|
-
L1_POLYGON_ZKEVM_BRIDGE.bridgeMessage(POLYGON_ZKEVM_L2_NETWORK_ID, target, true, message);
|
|
44
|
-
emit MessageRelayed(target, message);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @notice Bridge tokens to Polygon zkEVM.
|
|
49
|
-
* @param l1Token L1 token to deposit.
|
|
50
|
-
* @param l2Token L2 token to receive.
|
|
51
|
-
* @param amount Amount of L1 tokens to deposit and L2 tokens to receive.
|
|
52
|
-
* @param to Bridge recipient.
|
|
53
|
-
*/
|
|
54
|
-
function relayTokens(address l1Token, address l2Token, uint256 amount, address to) external payable override {
|
|
55
|
-
// The mapped WETH address in the native Polygon zkEVM bridge contract does not match
|
|
56
|
-
// the official WETH address. Therefore, if the l1Token is WETH then unwrap it to ETH
|
|
57
|
-
// and send the ETH directly via as msg.value.
|
|
58
|
-
if (l1Token == address(L1_WETH)) {
|
|
59
|
-
L1_WETH.withdraw(amount);
|
|
60
|
-
L1_POLYGON_ZKEVM_BRIDGE.bridgeAsset{ value: amount }(
|
|
61
|
-
POLYGON_ZKEVM_L2_NETWORK_ID,
|
|
62
|
-
to,
|
|
63
|
-
amount,
|
|
64
|
-
address(0),
|
|
65
|
-
true,
|
|
66
|
-
""
|
|
67
|
-
);
|
|
68
|
-
} else {
|
|
69
|
-
IERC20(l1Token).safeIncreaseAllowance(address(L1_POLYGON_ZKEVM_BRIDGE), amount);
|
|
70
|
-
L1_POLYGON_ZKEVM_BRIDGE.bridgeAsset(POLYGON_ZKEVM_L2_NETWORK_ID, to, amount, l1Token, true, "");
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
emit TokensRelayed(l1Token, l2Token, amount, to);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
|
|
5
|
-
import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
|
|
6
|
-
import "@scroll-tech/contracts/L1/gateways/IL1GatewayRouter.sol";
|
|
7
|
-
import "@scroll-tech/contracts/L1/rollup/IL2GasPriceOracle.sol";
|
|
8
|
-
import "@scroll-tech/contracts/L1/IL1ScrollMessenger.sol";
|
|
9
|
-
import "./interfaces/AdapterInterface.sol";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @title Scroll_Adapter
|
|
13
|
-
* @notice Adapter contract deployed on L1 alongside the HubPool to facilitate token transfers
|
|
14
|
-
* and arbitrary message relaying from L1 to L2.
|
|
15
|
-
* @custom:security-contact bugs@across.to
|
|
16
|
-
*/
|
|
17
|
-
contract Scroll_Adapter is AdapterInterface {
|
|
18
|
-
using SafeERC20 for IERC20;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @notice Used as the gas limit for relaying messages to L2.
|
|
22
|
-
*/
|
|
23
|
-
uint32 public immutable L2_MESSAGE_RELAY_GAS_LIMIT;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @notice Use as the gas limit for relaying tokens to L2.
|
|
27
|
-
*/
|
|
28
|
-
uint32 public immutable L2_TOKEN_RELAY_GAS_LIMIT;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @notice The address of the official l1GatewayRouter contract for Scroll for bridging tokens from L1 -> L2
|
|
32
|
-
* @dev We can find these (main/test)net deployments here: https://docs.scroll.io/en/developers/scroll-contracts/#scroll-contracts
|
|
33
|
-
*/
|
|
34
|
-
IL1GatewayRouter public immutable L1_GATEWAY_ROUTER;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @notice The address of the official messenger contract for Scroll from L1 -> L2
|
|
38
|
-
* @dev We can find these (main/test)net deployments here: https://docs.scroll.io/en/developers/scroll-contracts/#scroll-contracts
|
|
39
|
-
*/
|
|
40
|
-
IL1ScrollMessenger public immutable L1_SCROLL_MESSENGER;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @notice The address of the official gas price oracle contract for Scroll for estimating the relayer fee
|
|
44
|
-
* @dev We can find these (main/test)net deployments here: https://docs.scroll.io/en/developers/scroll-contracts/#scroll-contracts
|
|
45
|
-
*/
|
|
46
|
-
IL2GasPriceOracle public immutable L2_GAS_PRICE_ORACLE;
|
|
47
|
-
|
|
48
|
-
/**************************************
|
|
49
|
-
* PUBLIC FUNCTIONS *
|
|
50
|
-
**************************************/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @notice Constructs new Adapter.
|
|
54
|
-
* @param _l1GatewayRouter Standard bridge contract.
|
|
55
|
-
* @param _l1ScrollMessenger Scroll Messenger contract.
|
|
56
|
-
* @param _l2GasPriceOracle Gas price oracle contract.
|
|
57
|
-
* @param _l2MessageRelayGasLimit Gas limit for relaying messages to L2.
|
|
58
|
-
* @param _l2TokenRelayGasLimit Gas limit for relaying tokens to L2.
|
|
59
|
-
*/
|
|
60
|
-
constructor(
|
|
61
|
-
IL1GatewayRouter _l1GatewayRouter,
|
|
62
|
-
IL1ScrollMessenger _l1ScrollMessenger,
|
|
63
|
-
IL2GasPriceOracle _l2GasPriceOracle,
|
|
64
|
-
uint32 _l2MessageRelayGasLimit,
|
|
65
|
-
uint32 _l2TokenRelayGasLimit
|
|
66
|
-
) {
|
|
67
|
-
L1_GATEWAY_ROUTER = _l1GatewayRouter;
|
|
68
|
-
L1_SCROLL_MESSENGER = _l1ScrollMessenger;
|
|
69
|
-
L2_GAS_PRICE_ORACLE = _l2GasPriceOracle;
|
|
70
|
-
L2_MESSAGE_RELAY_GAS_LIMIT = _l2MessageRelayGasLimit;
|
|
71
|
-
L2_TOKEN_RELAY_GAS_LIMIT = _l2TokenRelayGasLimit;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @notice Send message to `target` on Scroll.
|
|
76
|
-
* @dev This message is marked payable because relaying the message will require
|
|
77
|
-
* a fee that needs to be propagated to the Scroll Bridge. It will not send msg.value
|
|
78
|
-
* to the target contract on L2.
|
|
79
|
-
* @param target L2 address to send message to.
|
|
80
|
-
* @param message Message to send to `target`.
|
|
81
|
-
*/
|
|
82
|
-
function relayMessage(address target, bytes calldata message) external payable {
|
|
83
|
-
// We can specifically send a message with 0 value to the Scroll Bridge
|
|
84
|
-
// and it will not forward any ETH to the target contract on L2. However,
|
|
85
|
-
// we need to set the payable value to msg.value to ensure that the Scroll
|
|
86
|
-
// Bridge has enough gas to forward the message to L2.
|
|
87
|
-
L1_SCROLL_MESSENGER.sendMessage{ value: _generateRelayerFee(L2_MESSAGE_RELAY_GAS_LIMIT) }(
|
|
88
|
-
target,
|
|
89
|
-
0,
|
|
90
|
-
message,
|
|
91
|
-
L2_MESSAGE_RELAY_GAS_LIMIT
|
|
92
|
-
);
|
|
93
|
-
emit MessageRelayed(target, message);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @notice Send `amount` of `l1Token` to `to` on Scroll. `l2Token` is the Scroll address equivalent of `l1Token`.
|
|
98
|
-
* @dev This method is marked payable because relaying the message might require a fee
|
|
99
|
-
* to be paid by the sender to forward the message to L2. However, it will not send msg.value
|
|
100
|
-
* to the target contract on L2.
|
|
101
|
-
* @param l1Token L1 token to bridge.
|
|
102
|
-
* @param l2Token L2 token to receive.
|
|
103
|
-
* @param amount Amount of `l1Token` to bridge.
|
|
104
|
-
* @param to Bridge recipient.
|
|
105
|
-
*/
|
|
106
|
-
function relayTokens(address l1Token, address l2Token, uint256 amount, address to) external payable {
|
|
107
|
-
IL1GatewayRouter _l1GatewayRouter = L1_GATEWAY_ROUTER;
|
|
108
|
-
|
|
109
|
-
// Confirm that the l2Token that we're trying to send is the correct counterpart
|
|
110
|
-
// address
|
|
111
|
-
address _l2Token = _l1GatewayRouter.getL2ERC20Address(l1Token);
|
|
112
|
-
require(_l2Token == l2Token, "l2Token Mismatch");
|
|
113
|
-
|
|
114
|
-
IERC20(l1Token).safeIncreaseAllowance(address(_l1GatewayRouter), amount);
|
|
115
|
-
|
|
116
|
-
// The scroll bridge handles arbitrary ERC20 tokens and is mindful of
|
|
117
|
-
// the official WETH address on-chain. We don't need to do anything specific
|
|
118
|
-
// to differentiate between WETH and a separate ERC20.
|
|
119
|
-
// Note: This happens due to the L1GatewayRouter.getERC20Gateway() call
|
|
120
|
-
// Note: dev docs: https://docs.scroll.io/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge/
|
|
121
|
-
_l1GatewayRouter.depositERC20{ value: _generateRelayerFee(L2_TOKEN_RELAY_GAS_LIMIT) }(
|
|
122
|
-
l1Token,
|
|
123
|
-
to,
|
|
124
|
-
amount,
|
|
125
|
-
L2_TOKEN_RELAY_GAS_LIMIT
|
|
126
|
-
);
|
|
127
|
-
emit TokensRelayed(l1Token, l2Token, amount, to);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**************************************
|
|
131
|
-
* INTERNAL FUNCTIONS *
|
|
132
|
-
**************************************/
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @notice Generates the relayer fee for a message to be sent to L2.
|
|
136
|
-
* @dev Function will revert if the contract does not have enough ETH to pay the fee.
|
|
137
|
-
* @param _l2GasLimit Gas limit for relaying message to L2.
|
|
138
|
-
* @return l2Fee The relayer fee for the message.
|
|
139
|
-
*/
|
|
140
|
-
function _generateRelayerFee(uint32 _l2GasLimit) internal view returns (uint256 l2Fee) {
|
|
141
|
-
l2Fee = L2_GAS_PRICE_ORACLE.estimateCrossDomainMessageFee(_l2GasLimit);
|
|
142
|
-
require(address(this).balance >= l2Fee, "Insufficient ETH balance");
|
|
143
|
-
}
|
|
144
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @notice Interface of Polygon zkEVM's Canonical Bridge
|
|
6
|
-
* See https://github.com/0xPolygonHermez/zkevm-contracts/blob/53e95f3a236d8bea87c27cb8714a5d21496a3b20/contracts/interfaces/IPolygonZkEVMBridge.sol
|
|
7
|
-
*/
|
|
8
|
-
interface IPolygonZkEVMBridge {
|
|
9
|
-
/**
|
|
10
|
-
* @notice Deposit add a new leaf to the merkle tree
|
|
11
|
-
* @param destinationNetwork Network destination
|
|
12
|
-
* @param destinationAddress Address destination
|
|
13
|
-
* @param amount Amount of tokens
|
|
14
|
-
* @param token Token address, 0 address is reserved for ether
|
|
15
|
-
* @param forceUpdateGlobalExitRoot Indicates if the new global exit root is updated or not
|
|
16
|
-
* @param permitData Raw data of the call `permit` of the token
|
|
17
|
-
*/
|
|
18
|
-
function bridgeAsset(
|
|
19
|
-
uint32 destinationNetwork,
|
|
20
|
-
address destinationAddress,
|
|
21
|
-
uint256 amount,
|
|
22
|
-
address token,
|
|
23
|
-
bool forceUpdateGlobalExitRoot,
|
|
24
|
-
bytes calldata permitData
|
|
25
|
-
) external payable;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @notice Bridge message and send ETH value
|
|
29
|
-
* @param destinationNetwork Network destination
|
|
30
|
-
* @param destinationAddress Address destination
|
|
31
|
-
* @param forceUpdateGlobalExitRoot Indicates if the new global exit root is updated or not
|
|
32
|
-
* @param metadata Message metadata
|
|
33
|
-
*/
|
|
34
|
-
function bridgeMessage(
|
|
35
|
-
uint32 destinationNetwork,
|
|
36
|
-
address destinationAddress,
|
|
37
|
-
bool forceUpdateGlobalExitRoot,
|
|
38
|
-
bytes calldata metadata
|
|
39
|
-
) external payable;
|
|
40
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "../libraries/Lockable.sol";
|
|
5
|
-
|
|
6
|
-
import "@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol";
|
|
7
|
-
import "@openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
8
|
-
import "contracts/external/uma/core/contracts/common/implementation/MultiCaller.sol";
|
|
9
|
-
|
|
10
|
-
interface USDYieldManager {
|
|
11
|
-
function claimWithdrawal(uint256 _requestId, uint256 _hintId) external returns (bool success);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @notice Contract deployed on Ethereum to facilitate DAI transfers from Blast to the HubPool.
|
|
16
|
-
* @dev Blast USDB withdrawals are a two step process where the L2 to L1 withdrawal must first be finalized via
|
|
17
|
-
* the typical OP Stack mechanism, and then a claim from the withdrawal's *recipient* must be made against a
|
|
18
|
-
* USDBYieldManager contract. This means that the Blast_SpokePool must set its recipient to this contract's address
|
|
19
|
-
* and then an EOA can call this contract to retrieve the DAI.
|
|
20
|
-
*/
|
|
21
|
-
contract Blast_DaiRetriever is Lockable, MultiCaller {
|
|
22
|
-
using SafeERC20Upgradeable for IERC20Upgradeable;
|
|
23
|
-
|
|
24
|
-
// Should be set to HubPool on Ethereum
|
|
25
|
-
address public immutable hubPool;
|
|
26
|
-
|
|
27
|
-
// USDCYieldManager contract on Ethereum which releases DAI to the hubPool.
|
|
28
|
-
USDYieldManager public immutable usdYieldManager;
|
|
29
|
-
|
|
30
|
-
// Token to be retrieved.
|
|
31
|
-
IERC20Upgradeable public immutable dai;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @notice Constructs USDB Retriever
|
|
35
|
-
* @param _hubPool Where to send DAI to.
|
|
36
|
-
* @param _usdYieldManager USDCYieldManager contract on Ethereum.
|
|
37
|
-
* @param _dai DAI token to be retrieved.
|
|
38
|
-
*/
|
|
39
|
-
constructor(address _hubPool, USDYieldManager _usdYieldManager, IERC20Upgradeable _dai) {
|
|
40
|
-
//slither-disable-next-line missing-zero-check
|
|
41
|
-
hubPool = _hubPool;
|
|
42
|
-
usdYieldManager = _usdYieldManager;
|
|
43
|
-
dai = _dai;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @notice Calls USDCYieldManager contract to release DAI and send to the hubPool. Required to use this function
|
|
48
|
-
* to retrieve DAI since only the L2 withdrawal recipient can make this call.
|
|
49
|
-
* @notice This can revert if the claim is not ready yet. It takes ~12 hours for a Blast admin to make the DAI
|
|
50
|
-
* available for retrieval following withdrawal finalization.
|
|
51
|
-
* @param _requestId L2 withdrawal request ID. Emitted in L1 WithdrawalRequested event when the L2 to L1
|
|
52
|
-
* withdrawal is first "finalized" but still awaiting the recipient to claim the DAI.
|
|
53
|
-
* @param _hintId Checkpoint hint ID. Can be found by querying USDYieldManager.findCheckpointHint.
|
|
54
|
-
*/
|
|
55
|
-
function retrieve(uint256 _requestId, uint256 _hintId) public nonReentrant {
|
|
56
|
-
require(usdYieldManager.claimWithdrawal(_requestId, _hintId), "claim failed");
|
|
57
|
-
dai.safeTransfer(hubPool, dai.balanceOf(address(this)));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "contracts/external/uma/core/contracts/common/implementation/MultiCaller.sol";
|
|
5
|
-
import "@openzeppelin/contracts-v4/access/AccessControl.sol";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @notice This contract is designed to own an Ownable "target" contract and gate access to specific
|
|
9
|
-
* function selectors based on specific roles. Practically, this contract should own the HubPool contract.
|
|
10
|
-
* All ownable function calls to target should be sent through this contract's fallback function.
|
|
11
|
-
* @custom:security-contact bugs@across.to
|
|
12
|
-
*/
|
|
13
|
-
contract PermissionSplitterProxy is AccessControl, MultiCaller {
|
|
14
|
-
// Inherited admin role from AccessControl. Should be assigned to Across DAO Safe.
|
|
15
|
-
// bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
|
|
16
|
-
|
|
17
|
-
// Maps function signatures to role identifiers, which gatekeeps access to these functions to
|
|
18
|
-
// only role holders.
|
|
19
|
-
mapping(bytes4 => bytes32) public roleForSelector;
|
|
20
|
-
|
|
21
|
-
// The contract that should be owned by this contract and whose function selectors will be gated
|
|
22
|
-
// by roleForSelector.
|
|
23
|
-
address public target;
|
|
24
|
-
|
|
25
|
-
event TargetUpdated(address indexed newTarget);
|
|
26
|
-
event RoleForSelectorSet(bytes4 indexed selector, bytes32 indexed role);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @notice constructs PermissionSplitterProxy
|
|
30
|
-
*/
|
|
31
|
-
constructor(address _target) {
|
|
32
|
-
_init(_target);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @notice Change target contract.
|
|
37
|
-
* @dev Public function! This has two underscores in front to prevent any collisions with the target contract.
|
|
38
|
-
* @dev Only callable by default admin role holder.
|
|
39
|
-
* @param _target New target contract.
|
|
40
|
-
*/
|
|
41
|
-
function __setTarget(address _target) public onlyRole(DEFAULT_ADMIN_ROLE) {
|
|
42
|
-
target = _target;
|
|
43
|
-
emit TargetUpdated(_target);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @notice Change role ID for function selector. Only role holder can call function selector
|
|
48
|
-
* on target.
|
|
49
|
-
* @dev Public function! This has two underscores in front to prevent any collisions with the target contract.
|
|
50
|
-
* @dev Only callable by default admin role holder.
|
|
51
|
-
* @param selector Function selector to map to role.
|
|
52
|
-
* @param role Only this role holder can call function selector on the target
|
|
53
|
-
*/
|
|
54
|
-
function __setRoleForSelector(bytes4 selector, bytes32 role) public onlyRole(DEFAULT_ADMIN_ROLE) {
|
|
55
|
-
roleForSelector[selector] = role;
|
|
56
|
-
emit RoleForSelectorSet(selector, role);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _init(address _target) internal virtual {
|
|
60
|
-
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
|
61
|
-
__setTarget(_target);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function _isAllowedToCall(address caller, bytes calldata callData) internal view virtual returns (bool) {
|
|
65
|
-
bytes4 selector;
|
|
66
|
-
if (callData.length < 4) {
|
|
67
|
-
// This handles any empty callData, which is a call to the fallback function.
|
|
68
|
-
selector = bytes4(0);
|
|
69
|
-
} else {
|
|
70
|
-
selector = bytes4(callData[:4]);
|
|
71
|
-
}
|
|
72
|
-
return hasRole(DEFAULT_ADMIN_ROLE, caller) || hasRole(roleForSelector[selector], caller);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @dev Forwards the current call to `implementation`.
|
|
77
|
-
*
|
|
78
|
-
* This function does not return to its internal call site, it will return directly to the external caller.
|
|
79
|
-
* Note: this function is a modified _delegate function here:
|
|
80
|
-
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/002a7c8812e73c282b91e14541ce9b93a6de1172/contracts/proxy/Proxy.sol#L22-L45
|
|
81
|
-
*/
|
|
82
|
-
function _forward(address _target) internal {
|
|
83
|
-
assembly {
|
|
84
|
-
// Copy msg.data. We take full control of memory in this inline assembly
|
|
85
|
-
// block because it will not return to Solidity code. We overwrite the
|
|
86
|
-
// Solidity scratch pad at memory position 0.
|
|
87
|
-
calldatacopy(0, 0, calldatasize())
|
|
88
|
-
|
|
89
|
-
// Call the implementation.
|
|
90
|
-
// out and outsize are 0 because we don't know the size yet.
|
|
91
|
-
let result := call(gas(), _target, callvalue(), 0, calldatasize(), 0, 0)
|
|
92
|
-
|
|
93
|
-
// Copy the returned data.
|
|
94
|
-
returndatacopy(0, 0, returndatasize())
|
|
95
|
-
|
|
96
|
-
switch result
|
|
97
|
-
// call returns 0 on error.
|
|
98
|
-
case 0 {
|
|
99
|
-
revert(0, returndatasize())
|
|
100
|
-
}
|
|
101
|
-
default {
|
|
102
|
-
return(0, returndatasize())
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Executes an action on the target.
|
|
108
|
-
function _executeAction() internal virtual {
|
|
109
|
-
require(_isAllowedToCall(msg.sender, msg.data), "Not allowed to call");
|
|
110
|
-
_forward(target);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @dev Fallback function that forwards calls to the target. Will run if no other
|
|
115
|
-
* function in the contract matches the call data.
|
|
116
|
-
*/
|
|
117
|
-
fallback() external payable virtual {
|
|
118
|
-
_executeAction();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @dev Fallback function that delegates calls to the target. Will run if call data
|
|
123
|
-
* is empty.
|
|
124
|
-
*/
|
|
125
|
-
receive() external payable virtual {
|
|
126
|
-
_executeAction();
|
|
127
|
-
}
|
|
128
|
-
}
|