CrossChainEnabledArbitrumL1.sol 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.4;
  3. import "../CrossChainEnabled.sol";
  4. import "./LibArbitrumL1.sol";
  5. /**
  6. * @dev [Arbitrum](https://arbitrum.io/) specialization or the
  7. * {CrossChainEnabled} abstraction the L1 side (mainnet).
  8. *
  9. * This version should only be deployed on L1 to process cross-chain messages
  10. * originating from L2. For the other side, use {CrossChainEnabledArbitrumL2}.
  11. *
  12. * The bridge contract is provided and maintained by the arbitrum team. You can
  13. * find the address of this contract on the rinkeby testnet in
  14. * [Arbitrum's developer documentation](https://developer.offchainlabs.com/docs/useful_addresses).
  15. *
  16. * _Available since v4.6._
  17. */
  18. abstract contract CrossChainEnabledArbitrumL1 is CrossChainEnabled {
  19. /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
  20. address private immutable _bridge;
  21. /// @custom:oz-upgrades-unsafe-allow constructor
  22. constructor(address bridge) {
  23. _bridge = bridge;
  24. }
  25. /**
  26. * @dev see {CrossChainEnabled-_isCrossChain}
  27. */
  28. function _isCrossChain() internal view virtual override returns (bool) {
  29. return LibArbitrumL1.isCrossChain(_bridge);
  30. }
  31. /**
  32. * @dev see {CrossChainEnabled-_crossChainSender}
  33. */
  34. function _crossChainSender() internal view virtual override onlyCrossChain returns (address) {
  35. return LibArbitrumL1.crossChainSender(_bridge);
  36. }
  37. }