CrossChainEnabledAMB.sol 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/amb/CrossChainEnabledAMB.sol)
  3. pragma solidity ^0.8.4;
  4. import "../CrossChainEnabled.sol";
  5. import "./LibAMB.sol";
  6. /**
  7. * @dev [AMB](https://docs.tokenbridge.net/amb-bridge/about-amb-bridge)
  8. * specialization or the {CrossChainEnabled} abstraction.
  9. *
  10. * As of february 2020, AMB bridges are available between the following chains:
  11. * - [ETH <> xDai](https://docs.tokenbridge.net/eth-xdai-amb-bridge/about-the-eth-xdai-amb)
  12. * - [ETH <> qDai](https://docs.tokenbridge.net/eth-qdai-bridge/about-the-eth-qdai-amb)
  13. * - [ETH <> ETC](https://docs.tokenbridge.net/eth-etc-amb-bridge/about-the-eth-etc-amb)
  14. * - [ETH <> BSC](https://docs.tokenbridge.net/eth-bsc-amb/about-the-eth-bsc-amb)
  15. * - [ETH <> POA](https://docs.tokenbridge.net/eth-poa-amb-bridge/about-the-eth-poa-amb)
  16. * - [BSC <> xDai](https://docs.tokenbridge.net/bsc-xdai-amb/about-the-bsc-xdai-amb)
  17. * - [POA <> xDai](https://docs.tokenbridge.net/poa-xdai-amb/about-the-poa-xdai-amb)
  18. * - [Rinkeby <> xDai](https://docs.tokenbridge.net/rinkeby-xdai-amb-bridge/about-the-rinkeby-xdai-amb)
  19. * - [Kovan <> Sokol](https://docs.tokenbridge.net/kovan-sokol-amb-bridge/about-the-kovan-sokol-amb)
  20. *
  21. * _Available since v4.6._
  22. */
  23. contract CrossChainEnabledAMB is CrossChainEnabled {
  24. /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
  25. address private immutable _bridge;
  26. /// @custom:oz-upgrades-unsafe-allow constructor
  27. constructor(address bridge) {
  28. _bridge = bridge;
  29. }
  30. /**
  31. * @dev see {CrossChainEnabled-_isCrossChain}
  32. */
  33. function _isCrossChain() internal view virtual override returns (bool) {
  34. return LibAMB.isCrossChain(_bridge);
  35. }
  36. /**
  37. * @dev see {CrossChainEnabled-_crossChainSender}
  38. */
  39. function _crossChainSender() internal view virtual override onlyCrossChain returns (address) {
  40. return LibAMB.crossChainSender(_bridge);
  41. }
  42. }