CrossChainEnabledArbitrumL2.sol 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.8.0-rc.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol)
  3. pragma solidity ^0.8.4;
  4. import "../CrossChainEnabled.sol";
  5. import "./LibArbitrumL2.sol";
  6. /**
  7. * @dev https://arbitrum.io/[Arbitrum] specialization or the
  8. * {CrossChainEnabled} abstraction the L2 side (arbitrum).
  9. *
  10. * This version should only be deployed on L2 to process cross-chain messages
  11. * originating from L1. For the other side, use {CrossChainEnabledArbitrumL1}.
  12. *
  13. * Arbitrum L2 includes the `ArbSys` contract at a fixed address. Therefore,
  14. * this specialization of {CrossChainEnabled} does not include a constructor.
  15. *
  16. * _Available since v4.6._
  17. *
  18. * WARNING: There is currently a bug in Arbitrum that causes this contract to
  19. * fail to detect cross-chain calls when deployed behind a proxy. This will be
  20. * fixed when the network is upgraded to Arbitrum Nitro, currently scheduled for
  21. * August 31st 2022.
  22. */
  23. abstract contract CrossChainEnabledArbitrumL2 is CrossChainEnabled {
  24. /**
  25. * @dev see {CrossChainEnabled-_isCrossChain}
  26. */
  27. function _isCrossChain() internal view virtual override returns (bool) {
  28. return LibArbitrumL2.isCrossChain(LibArbitrumL2.ARBSYS);
  29. }
  30. /**
  31. * @dev see {CrossChainEnabled-_crossChainSender}
  32. */
  33. function _crossChainSender() internal view virtual override onlyCrossChain returns (address) {
  34. return LibArbitrumL2.crossChainSender(LibArbitrumL2.ARBSYS);
  35. }
  36. }