UpgradeableBeaconMock.sol 807 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.20;
  3. import {IBeacon} from "../proxy/beacon/IBeacon.sol";
  4. contract UpgradeableBeaconMock is IBeacon {
  5. address public implementation;
  6. constructor(address impl) {
  7. implementation = impl;
  8. }
  9. }
  10. interface IProxyExposed {
  11. // solhint-disable-next-line func-name-mixedcase
  12. function $getBeacon() external view returns (address);
  13. }
  14. contract UpgradeableBeaconReentrantMock is IBeacon {
  15. error BeaconProxyBeaconSlotAddress(address beacon);
  16. function implementation() external view override returns (address) {
  17. // Revert with the beacon seen in the proxy at the moment of calling to check if it's
  18. // set before the call.
  19. revert BeaconProxyBeaconSlotAddress(IProxyExposed(msg.sender).$getBeacon());
  20. }
  21. }