CrossChainEnabledAMB.sol 1.8 KB

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