CrossChainEnabledAMB.sol 1.9 KB

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