@across-protocol/contracts 5.0.26 → 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 +606 -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 +18 -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,161 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
|
|
4
|
-
|
|
5
|
-
import "./Ovm_SpokePool.sol";
|
|
6
|
-
import "../external/interfaces/CCTPInterfaces.sol";
|
|
7
|
-
|
|
8
|
-
// USDB and WETH on Blast accrue yield that can be claimed by any account holding the token. So for the length of
|
|
9
|
-
// time that the SpokePool holds on to these assets, it can claim interest.
|
|
10
|
-
interface IERC20Rebasing {
|
|
11
|
-
enum YieldMode {
|
|
12
|
-
AUTOMATIC,
|
|
13
|
-
VOID,
|
|
14
|
-
CLAIMABLE
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function claim(address recipient, uint256 amount) external returns (uint256);
|
|
18
|
-
|
|
19
|
-
function getClaimableAmount(address account) external view returns (uint256);
|
|
20
|
-
|
|
21
|
-
function configure(YieldMode yieldMode) external returns (uint256);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Interface for blast yield contract on L2.
|
|
25
|
-
interface IBlast {
|
|
26
|
-
function configureClaimableYield() external;
|
|
27
|
-
|
|
28
|
-
function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256);
|
|
29
|
-
|
|
30
|
-
function configureClaimableGas() external;
|
|
31
|
-
|
|
32
|
-
function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface IUSDBL2Bridge {
|
|
36
|
-
function bridgeERC20To(
|
|
37
|
-
address _localToken,
|
|
38
|
-
address _remoteToken,
|
|
39
|
-
address _to,
|
|
40
|
-
uint256 _amount,
|
|
41
|
-
uint32 _minGasLimit,
|
|
42
|
-
bytes calldata _extraData
|
|
43
|
-
) external;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @notice Blast Spoke pool.
|
|
48
|
-
* @custom:security-contact bugs@across.to
|
|
49
|
-
*/
|
|
50
|
-
contract Blast_SpokePool is Ovm_SpokePool {
|
|
51
|
-
// This is the yield-accruing stablecoin on Blast that USDC/DAI/USDT all bridge into. It can be withdrawn
|
|
52
|
-
// from L2 into DAI.
|
|
53
|
-
address public immutable USDB; // 0x4300000000000000000000000000000000000003 on blast mainnet.
|
|
54
|
-
// Token that is received when withdrawing USDB, aka DAI.
|
|
55
|
-
address public immutable L1_USDB; // 0x6B175474E89094C44Da98b954EedeAC495271d0F on mainnet.
|
|
56
|
-
|
|
57
|
-
// Address that this contract's yield and gas fees accrue to.
|
|
58
|
-
address public immutable YIELD_RECIPIENT;
|
|
59
|
-
|
|
60
|
-
// Address which receives DAI from USDB withdrawals on mainnet. USDB withdrawals are a two step finalization process where the recipient of the withdrawals must claim, so we set this address to a contract that claims on behalf of the HubPool
|
|
61
|
-
address public immutable BLAST_RETRIEVER;
|
|
62
|
-
address public constant L2_BLAST_BRIDGE = 0x4300000000000000000000000000000000000005;
|
|
63
|
-
IBlast public constant BLAST_YIELD_CONTRACT = IBlast(0x4300000000000000000000000000000000000002);
|
|
64
|
-
|
|
65
|
-
error InvalidClaimedAmount(address token);
|
|
66
|
-
event YieldClaimed(address indexed recipient, address indexed token, uint256 amount);
|
|
67
|
-
|
|
68
|
-
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
69
|
-
constructor(
|
|
70
|
-
address _wrappedNativeTokenAddress,
|
|
71
|
-
uint32 _depositQuoteTimeBuffer,
|
|
72
|
-
uint32 _fillDeadlineBuffer,
|
|
73
|
-
IERC20 _l2Usdc,
|
|
74
|
-
ITokenMessenger _cctpTokenMessenger,
|
|
75
|
-
address usdb,
|
|
76
|
-
address l1Usdb,
|
|
77
|
-
address yieldRecipient,
|
|
78
|
-
address blastRetriever
|
|
79
|
-
)
|
|
80
|
-
Ovm_SpokePool(
|
|
81
|
-
_wrappedNativeTokenAddress,
|
|
82
|
-
_depositQuoteTimeBuffer,
|
|
83
|
-
_fillDeadlineBuffer,
|
|
84
|
-
_l2Usdc,
|
|
85
|
-
_cctpTokenMessenger
|
|
86
|
-
)
|
|
87
|
-
{
|
|
88
|
-
USDB = usdb;
|
|
89
|
-
L1_USDB = l1Usdb;
|
|
90
|
-
YIELD_RECIPIENT = yieldRecipient;
|
|
91
|
-
BLAST_RETRIEVER = blastRetriever;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @notice Construct the OVM Blast SpokePool.
|
|
96
|
-
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
|
|
97
|
-
* relay hash collisions.
|
|
98
|
-
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
|
|
99
|
-
* @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
|
|
100
|
-
* likely be the hub pool.
|
|
101
|
-
* @dev this method also sets yield settings for the Blast SpokePool.
|
|
102
|
-
*/
|
|
103
|
-
function initialize(
|
|
104
|
-
uint32 _initialDepositId,
|
|
105
|
-
address _crossDomainAdmin,
|
|
106
|
-
address _withdrawalRecipient
|
|
107
|
-
) public initializer {
|
|
108
|
-
__OvmSpokePool_init(_initialDepositId, _crossDomainAdmin, _withdrawalRecipient, Lib_PredeployAddresses.OVM_ETH);
|
|
109
|
-
|
|
110
|
-
// Sets native yield to be claimable manually.
|
|
111
|
-
BLAST_YIELD_CONTRACT.configureClaimableYield();
|
|
112
|
-
BLAST_YIELD_CONTRACT.configureClaimableGas();
|
|
113
|
-
|
|
114
|
-
// Set USDB and WETH to claimable.
|
|
115
|
-
IERC20Rebasing(USDB).configure(IERC20Rebasing.YieldMode.CLAIMABLE);
|
|
116
|
-
IERC20Rebasing(address(wrappedNativeToken)).configure(IERC20Rebasing.YieldMode.CLAIMABLE);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @notice Claim interest for token to a predefined recipient. This should be called before _bridgeTokensToHubPool
|
|
121
|
-
* as a way to regularly claim yield and distribute it to the recipient.
|
|
122
|
-
*/
|
|
123
|
-
function _claimYield(IERC20Rebasing token) internal {
|
|
124
|
-
uint256 claimableAmount = token.getClaimableAmount(address(this));
|
|
125
|
-
uint256 claimedAmount = token.claim(YIELD_RECIPIENT, claimableAmount);
|
|
126
|
-
if (claimableAmount != claimedAmount) {
|
|
127
|
-
revert InvalidClaimedAmount(address(token));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (claimedAmount > 0) {
|
|
131
|
-
emit YieldClaimed(YIELD_RECIPIENT, address(token), claimedAmount);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// If sending WETH back, also claim any native yield and send it directly to the yield recipient.
|
|
135
|
-
if (address(token) == address(wrappedNativeToken)) {
|
|
136
|
-
uint256 nativeClaimAmount = BLAST_YIELD_CONTRACT.claimAllYield(address(this), YIELD_RECIPIENT);
|
|
137
|
-
nativeClaimAmount += BLAST_YIELD_CONTRACT.claimMaxGas(address(this), YIELD_RECIPIENT);
|
|
138
|
-
if (nativeClaimAmount > 0) {
|
|
139
|
-
emit YieldClaimed(YIELD_RECIPIENT, address(0), nativeClaimAmount);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Claims any yield for tokens that accrue yield before bridging.
|
|
145
|
-
function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal override {
|
|
146
|
-
if (l2TokenAddress == USDB || l2TokenAddress == address(wrappedNativeToken)) {
|
|
147
|
-
_claimYield(IERC20Rebasing(l2TokenAddress));
|
|
148
|
-
}
|
|
149
|
-
// If the token is USDB then send to the blast retriever
|
|
150
|
-
if (l2TokenAddress == USDB) {
|
|
151
|
-
IUSDBL2Bridge(L2_BLAST_BRIDGE).bridgeERC20To(
|
|
152
|
-
l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.
|
|
153
|
-
L1_USDB,
|
|
154
|
-
BLAST_RETRIEVER, // _to. Withdraw, over the bridge, to the l1 receiver contract.
|
|
155
|
-
amountToReturn,
|
|
156
|
-
l1Gas,
|
|
157
|
-
""
|
|
158
|
-
);
|
|
159
|
-
} else super._bridgeTokensToHubPool(amountToReturn, l2TokenAddress);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "./Ovm_SpokePool.sol";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @notice Boba Spoke pool. Note that the l2ETH and l2WETH are the opposite as that in Optimism.
|
|
8
|
-
*/
|
|
9
|
-
contract Boba_SpokePool is Ovm_SpokePool {
|
|
10
|
-
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
11
|
-
constructor(
|
|
12
|
-
address _wrappedNativeTokenAddress,
|
|
13
|
-
uint32 _depositQuoteTimeBuffer,
|
|
14
|
-
uint32 _fillDeadlineBuffer
|
|
15
|
-
)
|
|
16
|
-
Ovm_SpokePool(
|
|
17
|
-
_wrappedNativeTokenAddress,
|
|
18
|
-
_depositQuoteTimeBuffer,
|
|
19
|
-
_fillDeadlineBuffer,
|
|
20
|
-
IERC20(address(0)),
|
|
21
|
-
ITokenMessenger(address(0))
|
|
22
|
-
)
|
|
23
|
-
{} // solhint-disable-line no-empty-blocks
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @notice Construct the OVM Boba SpokePool.
|
|
27
|
-
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
|
|
28
|
-
* relay hash collisions.
|
|
29
|
-
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
|
|
30
|
-
* @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
|
|
31
|
-
* likely be the hub pool.
|
|
32
|
-
*/
|
|
33
|
-
function initialize(
|
|
34
|
-
uint32 _initialDepositId,
|
|
35
|
-
address _crossDomainAdmin,
|
|
36
|
-
address _withdrawalRecipient
|
|
37
|
-
) public initializer {
|
|
38
|
-
__OvmSpokePool_init(
|
|
39
|
-
_initialDepositId,
|
|
40
|
-
_crossDomainAdmin,
|
|
41
|
-
_withdrawalRecipient,
|
|
42
|
-
0x4200000000000000000000000000000000000006
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
|
|
4
|
-
|
|
5
|
-
import "./Ovm_SpokePool.sol";
|
|
6
|
-
import "../external/interfaces/CCTPInterfaces.sol";
|
|
7
|
-
import { IOpUSDCBridgeAdapter } from "../external/interfaces/IOpUSDCBridgeAdapter.sol";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @notice Ink Spoke pool.
|
|
11
|
-
* @custom:security-contact bugs@across.to
|
|
12
|
-
*/
|
|
13
|
-
contract Ink_SpokePool is Ovm_SpokePool {
|
|
14
|
-
using SafeERC20 for IERC20;
|
|
15
|
-
|
|
16
|
-
// Address of the custom L2 USDC bridge.
|
|
17
|
-
address private constant USDC_BRIDGE = address(0);
|
|
18
|
-
|
|
19
|
-
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
20
|
-
constructor(
|
|
21
|
-
address _wrappedNativeTokenAddress,
|
|
22
|
-
uint32 _depositQuoteTimeBuffer,
|
|
23
|
-
uint32 _fillDeadlineBuffer,
|
|
24
|
-
IERC20 _l2Usdc,
|
|
25
|
-
ITokenMessenger _cctpTokenMessenger
|
|
26
|
-
)
|
|
27
|
-
Ovm_SpokePool(
|
|
28
|
-
_wrappedNativeTokenAddress,
|
|
29
|
-
_depositQuoteTimeBuffer,
|
|
30
|
-
_fillDeadlineBuffer,
|
|
31
|
-
_l2Usdc,
|
|
32
|
-
_cctpTokenMessenger
|
|
33
|
-
)
|
|
34
|
-
{} // solhint-disable-line no-empty-blocks
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @notice Construct the OVM World Chain SpokePool.
|
|
38
|
-
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
|
|
39
|
-
* relay hash collisions.
|
|
40
|
-
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
|
|
41
|
-
* @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
|
|
42
|
-
*/
|
|
43
|
-
function initialize(
|
|
44
|
-
uint32 _initialDepositId,
|
|
45
|
-
address _crossDomainAdmin,
|
|
46
|
-
address _withdrawalRecipient
|
|
47
|
-
) public initializer {
|
|
48
|
-
__OvmSpokePool_init(_initialDepositId, _crossDomainAdmin, _withdrawalRecipient, Lib_PredeployAddresses.OVM_ETH);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @notice Ink-specific logic to bridge tokens back to the hub pool contract on L1.
|
|
53
|
-
* @param amountToReturn Amount of the token to bridge back.
|
|
54
|
-
* @param l2TokenAddress Address of the l2 Token to bridge back. This token will either be bridged back to the token defined in the mapping `remoteL1Tokens`,
|
|
55
|
-
* or via the canonical mapping defined in the bridge contract retrieved from `tokenBridges`.
|
|
56
|
-
* @dev This implementation deviates slightly from `_bridgeTokensToHubPool` in the `Ovm_SpokePool` contract since World Chain has a USDC bridge which uses
|
|
57
|
-
* a custom interface. This is because the USDC token on World Chain is meant to be upgraded to a native, CCTP supported version in the future.
|
|
58
|
-
*/
|
|
59
|
-
function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal virtual override {
|
|
60
|
-
// Handle custom USDC bridge which doesn't conform to the standard bridge interface. In the future, CCTP may be used to bridge USDC to mainnet, in which
|
|
61
|
-
// case bridging logic is handled by the Ovm_SpokePool code. In the meantime, if CCTP is not enabled, then use the USDC bridge. Once CCTP is activated on
|
|
62
|
-
// WorldChain, this block of code will be unused.
|
|
63
|
-
if (l2TokenAddress == address(usdcToken) && !_isCCTPEnabled()) {
|
|
64
|
-
usdcToken.safeIncreaseAllowance(USDC_BRIDGE, amountToReturn);
|
|
65
|
-
IOpUSDCBridgeAdapter(USDC_BRIDGE).sendMessage(
|
|
66
|
-
withdrawalRecipient, // _to. Withdraw, over the bridge, to the l1 hub pool contract.
|
|
67
|
-
amountToReturn, // _amount.
|
|
68
|
-
l1Gas // _minGasLimit. Same value used in other OpStack bridges.
|
|
69
|
-
);
|
|
70
|
-
} else super._bridgeTokensToHubPool(amountToReturn, l2TokenAddress);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
|
|
4
|
-
|
|
5
|
-
import "./Ovm_SpokePool.sol";
|
|
6
|
-
import "../external/interfaces/CCTPInterfaces.sol";
|
|
7
|
-
|
|
8
|
-
// https://github.com/Synthetixio/synthetix/blob/5ca27785fad8237fb0710eac01421cafbbd69647/contracts/SynthetixBridgeToBase.sol#L50
|
|
9
|
-
interface SynthetixBridgeToBase {
|
|
10
|
-
function withdrawTo(address to, uint256 amount) external;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @notice Optimism Spoke pool.
|
|
15
|
-
* @custom:security-contact bugs@across.to
|
|
16
|
-
*/
|
|
17
|
-
contract Optimism_SpokePool is Ovm_SpokePool {
|
|
18
|
-
// Address of custom bridge used to bridge Synthetix-related assets like SNX.
|
|
19
|
-
address private constant SYNTHETIX_BRIDGE = 0x136b1EC699c62b0606854056f02dC7Bb80482d63;
|
|
20
|
-
|
|
21
|
-
// Address of SNX ERC20
|
|
22
|
-
address private constant SNX = 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4;
|
|
23
|
-
|
|
24
|
-
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
25
|
-
constructor(
|
|
26
|
-
address _wrappedNativeTokenAddress,
|
|
27
|
-
uint32 _depositQuoteTimeBuffer,
|
|
28
|
-
uint32 _fillDeadlineBuffer,
|
|
29
|
-
IERC20 _l2Usdc,
|
|
30
|
-
ITokenMessenger _cctpTokenMessenger
|
|
31
|
-
)
|
|
32
|
-
Ovm_SpokePool(
|
|
33
|
-
_wrappedNativeTokenAddress,
|
|
34
|
-
_depositQuoteTimeBuffer,
|
|
35
|
-
_fillDeadlineBuffer,
|
|
36
|
-
_l2Usdc,
|
|
37
|
-
_cctpTokenMessenger
|
|
38
|
-
)
|
|
39
|
-
{} // solhint-disable-line no-empty-blocks
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @notice Construct the OVM Optimism SpokePool.
|
|
43
|
-
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
|
|
44
|
-
* relay hash collisions.
|
|
45
|
-
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
|
|
46
|
-
* @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
|
|
47
|
-
* likely be the hub pool.
|
|
48
|
-
*/
|
|
49
|
-
function initialize(
|
|
50
|
-
uint32 _initialDepositId,
|
|
51
|
-
address _crossDomainAdmin,
|
|
52
|
-
address _withdrawalRecipient
|
|
53
|
-
) public initializer {
|
|
54
|
-
__OvmSpokePool_init(_initialDepositId, _crossDomainAdmin, _withdrawalRecipient, Lib_PredeployAddresses.OVM_ETH);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal virtual override {
|
|
58
|
-
// Handle custom SNX bridge which doesn't conform to the standard bridge interface.
|
|
59
|
-
if (l2TokenAddress == SNX)
|
|
60
|
-
SynthetixBridgeToBase(SYNTHETIX_BRIDGE).withdrawTo(
|
|
61
|
-
withdrawalRecipient, // _to. Withdraw, over the bridge, to the l1 pool contract.
|
|
62
|
-
amountToReturn // _amount.
|
|
63
|
-
);
|
|
64
|
-
else super._bridgeTokensToHubPool(amountToReturn, l2TokenAddress);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "./SpokePool.sol";
|
|
5
|
-
import "../external/interfaces/IPolygonZkEVMBridge.sol";
|
|
6
|
-
|
|
7
|
-
import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
|
|
8
|
-
import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @notice Define interface for PolygonZkEVM Bridge message receiver
|
|
12
|
-
* See https://github.com/0xPolygonHermez/zkevm-contracts/blob/53e95f3a236d8bea87c27cb8714a5d21496a3b20/contracts/interfaces/IBridgeMessageReceiver.sol
|
|
13
|
-
*/
|
|
14
|
-
interface IBridgeMessageReceiver {
|
|
15
|
-
/**
|
|
16
|
-
* @notice This will be called by the Polygon zkEVM Bridge on L2 to relay a message sent from the HubPool.
|
|
17
|
-
* @param originAddress Address of the original message sender on L1.
|
|
18
|
-
* @param originNetwork Polygon zkEVM's internal network id of source chain.
|
|
19
|
-
* @param data Data to be received and executed on this contract.
|
|
20
|
-
*/
|
|
21
|
-
function onMessageReceived(address originAddress, uint32 originNetwork, bytes memory data) external payable;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @notice Polygon zkEVM Spoke pool.
|
|
26
|
-
* @custom:security-contact bugs@across.to
|
|
27
|
-
*/
|
|
28
|
-
contract PolygonZkEVM_SpokePool is SpokePool, IBridgeMessageReceiver {
|
|
29
|
-
using SafeERC20 for IERC20;
|
|
30
|
-
|
|
31
|
-
// Address of Polygon zkEVM's Canonical Bridge on L2.
|
|
32
|
-
IPolygonZkEVMBridge public l2PolygonZkEVMBridge;
|
|
33
|
-
|
|
34
|
-
// Polygon zkEVM's internal network id for L1.
|
|
35
|
-
uint32 public constant POLYGON_ZKEVM_L1_NETWORK_ID = 0;
|
|
36
|
-
|
|
37
|
-
// Warning: this variable should _never_ be touched outside of this contract. It is intentionally set to be
|
|
38
|
-
// private. Leaving it set to true can permanently disable admin calls.
|
|
39
|
-
bool private adminCallValidated;
|
|
40
|
-
|
|
41
|
-
/**************************************
|
|
42
|
-
* ERRORS *
|
|
43
|
-
**************************************/
|
|
44
|
-
error AdminCallValidatedAlreadySet();
|
|
45
|
-
error CallerNotBridge();
|
|
46
|
-
error OriginSenderNotCrossDomain();
|
|
47
|
-
error SourceChainNotHubChain();
|
|
48
|
-
error AdminCallNotValidated();
|
|
49
|
-
|
|
50
|
-
/**************************************
|
|
51
|
-
* EVENTS *
|
|
52
|
-
**************************************/
|
|
53
|
-
event SetPolygonZkEVMBridge(address indexed newPolygonZkEVMBridge, address indexed oldPolygonZkEVMBridge);
|
|
54
|
-
event ReceivedMessageFromL1(address indexed caller, address indexed originAddress);
|
|
55
|
-
|
|
56
|
-
// Note: validating calls this way ensures that strange calls coming from the onMessageReceived won't be
|
|
57
|
-
// misinterpreted. Put differently, just checking that originAddress == crossDomainAdmint is not sufficient.
|
|
58
|
-
// All calls that have admin privileges must be fired from within the onMessageReceived method that's gone
|
|
59
|
-
// through validation where the sender is checked and the sender from the other chain is also validated.
|
|
60
|
-
// This modifier sets the adminCallValidated variable so this condition can be checked in _requireAdminSender().
|
|
61
|
-
modifier validateInternalCalls() {
|
|
62
|
-
// Make sure adminCallValidated is set to True only once at beginning of onMessageReceived, which prevents
|
|
63
|
-
// onMessageReceived from being re-entered.
|
|
64
|
-
if (adminCallValidated) {
|
|
65
|
-
revert AdminCallValidatedAlreadySet();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// This sets a variable indicating that we're now inside a validated call.
|
|
69
|
-
// Note: this is used by other methods to ensure that this call has been validated by this method and is not
|
|
70
|
-
// spoofed.
|
|
71
|
-
adminCallValidated = true;
|
|
72
|
-
|
|
73
|
-
_;
|
|
74
|
-
|
|
75
|
-
// Reset adminCallValidated to false to disallow admin calls after this method exits.
|
|
76
|
-
adminCallValidated = false;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @notice Construct Polygon zkEVM specific SpokePool.
|
|
81
|
-
* @param _wrappedNativeTokenAddress Address of WETH on Polygon zkEVM.
|
|
82
|
-
* @param _depositQuoteTimeBuffer Quote timestamps can't be set more than this amount
|
|
83
|
-
* into the past from the block time of the deposit.
|
|
84
|
-
* @param _fillDeadlineBuffer Fill deadlines can't be set more than this amount
|
|
85
|
-
* into the future from the block time of the deposit.
|
|
86
|
-
*/
|
|
87
|
-
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
88
|
-
constructor(
|
|
89
|
-
address _wrappedNativeTokenAddress,
|
|
90
|
-
uint32 _depositQuoteTimeBuffer,
|
|
91
|
-
uint32 _fillDeadlineBuffer
|
|
92
|
-
)
|
|
93
|
-
SpokePool(
|
|
94
|
-
_wrappedNativeTokenAddress,
|
|
95
|
-
_depositQuoteTimeBuffer,
|
|
96
|
-
_fillDeadlineBuffer,
|
|
97
|
-
// PolygonZkEVM_SpokePool does not use OFT messaging; setting destination eid and fee cap to 0
|
|
98
|
-
0,
|
|
99
|
-
0
|
|
100
|
-
)
|
|
101
|
-
{} // solhint-disable-line no-empty-blocks
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* @notice Construct the Polygon zkEVM SpokePool.
|
|
105
|
-
* @param _l2PolygonZkEVMBridge Address of Polygon zkEVM's canonical bridge contract on L2.
|
|
106
|
-
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
|
|
107
|
-
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
|
|
108
|
-
* @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
|
|
109
|
-
* likely be the hub pool.
|
|
110
|
-
*/
|
|
111
|
-
function initialize(
|
|
112
|
-
IPolygonZkEVMBridge _l2PolygonZkEVMBridge,
|
|
113
|
-
uint32 _initialDepositId,
|
|
114
|
-
address _crossDomainAdmin,
|
|
115
|
-
address _withdrawalRecipient
|
|
116
|
-
) public initializer {
|
|
117
|
-
__SpokePool_init(_initialDepositId, _crossDomainAdmin, _withdrawalRecipient);
|
|
118
|
-
_setL2PolygonZkEVMBridge(_l2PolygonZkEVMBridge);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @notice Admin can reset the Polygon zkEVM bridge contract address.
|
|
123
|
-
* @param _l2PolygonZkEVMBridge Address of the new canonical bridge.
|
|
124
|
-
*/
|
|
125
|
-
function setL2PolygonZkEVMBridge(IPolygonZkEVMBridge _l2PolygonZkEVMBridge) external onlyAdmin {
|
|
126
|
-
_setL2PolygonZkEVMBridge(_l2PolygonZkEVMBridge);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @notice This will be called by the Polygon zkEVM Bridge on L2 to relay a message sent from the HubPool.
|
|
131
|
-
* @param _originAddress Address of the original message sender on L1.
|
|
132
|
-
* @param _originNetwork Polygon zkEVM's internal network id of source chain.
|
|
133
|
-
* @param _data Data to be received and executed on this contract.
|
|
134
|
-
*/
|
|
135
|
-
function onMessageReceived(
|
|
136
|
-
address _originAddress,
|
|
137
|
-
uint32 _originNetwork,
|
|
138
|
-
bytes memory _data
|
|
139
|
-
) external payable override validateInternalCalls {
|
|
140
|
-
if (msg.sender != address(l2PolygonZkEVMBridge)) {
|
|
141
|
-
revert CallerNotBridge();
|
|
142
|
-
}
|
|
143
|
-
if (_originAddress != crossDomainAdmin) {
|
|
144
|
-
revert OriginSenderNotCrossDomain();
|
|
145
|
-
}
|
|
146
|
-
if (_originNetwork != POLYGON_ZKEVM_L1_NETWORK_ID) {
|
|
147
|
-
revert SourceChainNotHubChain();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/// @custom:oz-upgrades-unsafe-allow delegatecall
|
|
151
|
-
(bool success, ) = address(this).delegatecall(_data);
|
|
152
|
-
require(success, "delegatecall failed");
|
|
153
|
-
|
|
154
|
-
emit ReceivedMessageFromL1(msg.sender, _originAddress);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**************************************
|
|
158
|
-
* INTERNAL FUNCTIONS *
|
|
159
|
-
**************************************/
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives
|
|
163
|
-
* ETH over the canonical token bridge instead of WETH.
|
|
164
|
-
*/
|
|
165
|
-
function _preExecuteLeafHook(address l2TokenAddress) internal override {
|
|
166
|
-
if (l2TokenAddress == address(wrappedNativeToken)) _depositEthToWeth();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because
|
|
170
|
-
// this SpokePool will receive ETH from the canonical token bridge instead of WETH. This may not be neccessary
|
|
171
|
-
// if ETH on Polygon zkEVM is treated as ETH and the fallback() function is triggered when this contract receives
|
|
172
|
-
// ETH. We will have to test this but this function for now allows the contract to safely convert all of its
|
|
173
|
-
// held ETH into WETH at the cost of higher gas costs.
|
|
174
|
-
function _depositEthToWeth() internal {
|
|
175
|
-
//slither-disable-next-line arbitrary-send-eth
|
|
176
|
-
if (address(this).balance > 0) wrappedNativeToken.deposit{ value: address(this).balance }();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal override {
|
|
180
|
-
// SpokePool is expected to receive ETH from the L1 HubPool, then we need to first unwrap it to ETH and then
|
|
181
|
-
// send ETH directly via the native L2 bridge.
|
|
182
|
-
if (l2TokenAddress == address(wrappedNativeToken)) {
|
|
183
|
-
WETH9Interface(l2TokenAddress).withdraw(amountToReturn); // Unwrap into ETH.
|
|
184
|
-
l2PolygonZkEVMBridge.bridgeAsset{ value: amountToReturn }(
|
|
185
|
-
POLYGON_ZKEVM_L1_NETWORK_ID,
|
|
186
|
-
withdrawalRecipient,
|
|
187
|
-
amountToReturn,
|
|
188
|
-
address(0),
|
|
189
|
-
true, // Indicates if the new global exit root is updated or not, which is true for asset bridges
|
|
190
|
-
""
|
|
191
|
-
);
|
|
192
|
-
} else {
|
|
193
|
-
IERC20(l2TokenAddress).safeIncreaseAllowance(address(l2PolygonZkEVMBridge), amountToReturn);
|
|
194
|
-
l2PolygonZkEVMBridge.bridgeAsset(
|
|
195
|
-
POLYGON_ZKEVM_L1_NETWORK_ID,
|
|
196
|
-
withdrawalRecipient,
|
|
197
|
-
amountToReturn,
|
|
198
|
-
l2TokenAddress,
|
|
199
|
-
true, // Indicates if the new global exit root is updated or not, which is true for asset bridges
|
|
200
|
-
""
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Check that the onMessageReceived method has validated the method to ensure the sender is authenticated.
|
|
206
|
-
function _requireAdminSender() internal view override {
|
|
207
|
-
if (!adminCallValidated) {
|
|
208
|
-
revert AdminCallNotValidated();
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function _setL2PolygonZkEVMBridge(IPolygonZkEVMBridge _newL2PolygonZkEVMBridge) internal {
|
|
213
|
-
address oldL2PolygonZkEVMBridge = address(l2PolygonZkEVMBridge);
|
|
214
|
-
l2PolygonZkEVMBridge = _newL2PolygonZkEVMBridge;
|
|
215
|
-
emit SetPolygonZkEVMBridge(address(_newL2PolygonZkEVMBridge), oldL2PolygonZkEVMBridge);
|
|
216
|
-
}
|
|
217
|
-
}
|