AddressImplUpgradeable.sol 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/AddressUpgradeable.sol";
  4. import "../proxy/utils/Initializable.sol";
  5. contract AddressImplUpgradeable is Initializable {
  6. function __AddressImpl_init() internal onlyInitializing {
  7. }
  8. function __AddressImpl_init_unchained() internal onlyInitializing {
  9. }
  10. string public sharedAnswer;
  11. event CallReturnValue(string data);
  12. function isContract(address account) external view returns (bool) {
  13. return AddressUpgradeable.isContract(account);
  14. }
  15. function sendValue(address payable receiver, uint256 amount) external {
  16. AddressUpgradeable.sendValue(receiver, amount);
  17. }
  18. function functionCall(address target, bytes calldata data) external {
  19. bytes memory returnData = AddressUpgradeable.functionCall(target, data);
  20. emit CallReturnValue(abi.decode(returnData, (string)));
  21. }
  22. function functionCallWithValue(
  23. address target,
  24. bytes calldata data,
  25. uint256 value
  26. ) external payable {
  27. bytes memory returnData = AddressUpgradeable.functionCallWithValue(target, data, value);
  28. emit CallReturnValue(abi.decode(returnData, (string)));
  29. }
  30. function functionStaticCall(address target, bytes calldata data) external {
  31. bytes memory returnData = AddressUpgradeable.functionStaticCall(target, data);
  32. emit CallReturnValue(abi.decode(returnData, (string)));
  33. }
  34. // sendValue's tests require the contract to hold Ether
  35. receive() external payable {}
  36. /**
  37. * @dev This empty reserved space is put in place to allow future versions to add new
  38. * variables without shifting down storage in the inheritance chain.
  39. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  40. */
  41. uint256[49] private __gap;
  42. }