CrossChainEnabledArbitrumL1.sol 1.5 KB

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