ContextMockUpgradeable.sol 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/ContextUpgradeable.sol";
  4. import "../proxy/utils/Initializable.sol";
  5. contract ContextMockUpgradeable is Initializable, ContextUpgradeable {
  6. function __ContextMock_init() internal onlyInitializing {
  7. }
  8. function __ContextMock_init_unchained() internal onlyInitializing {
  9. }
  10. event Sender(address sender);
  11. function msgSender() public {
  12. emit Sender(_msgSender());
  13. }
  14. event Data(bytes data, uint256 integerValue, string stringValue);
  15. function msgData(uint256 integerValue, string memory stringValue) public {
  16. emit Data(_msgData(), integerValue, stringValue);
  17. }
  18. /**
  19. * @dev This empty reserved space is put in place to allow future versions to add new
  20. * variables without shifting down storage in the inheritance chain.
  21. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  22. */
  23. uint256[50] private __gap;
  24. }
  25. contract ContextMockCallerUpgradeable is Initializable {
  26. function __ContextMockCaller_init() internal onlyInitializing {
  27. }
  28. function __ContextMockCaller_init_unchained() internal onlyInitializing {
  29. }
  30. function callSender(ContextMockUpgradeable context) public {
  31. context.msgSender();
  32. }
  33. function callData(
  34. ContextMockUpgradeable context,
  35. uint256 integerValue,
  36. string memory stringValue
  37. ) public {
  38. context.msgData(integerValue, stringValue);
  39. }
  40. /**
  41. * @dev This empty reserved space is put in place to allow future versions to add new
  42. * variables without shifting down storage in the inheritance chain.
  43. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  44. */
  45. uint256[50] private __gap;
  46. }