EventEmitter.sol 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. pragma solidity ^0.5.2;
  2. contract EventEmitter {
  3. event Argumentless();
  4. event ShortUint(uint8 value);
  5. event ShortInt(int8 value);
  6. event LongUint(uint256 value);
  7. event LongInt(int256 value);
  8. event Address(address value);
  9. event Boolean(bool value);
  10. event String(string value);
  11. event LongUintBooleanString(uint256 uintValue, bool booleanValue, string stringValue);
  12. constructor (uint8 uintValue, bool booleanValue, string memory stringValue) public {
  13. emit ShortUint(uintValue);
  14. emit Boolean(booleanValue);
  15. emit String(stringValue);
  16. }
  17. function emitArgumentless() public {
  18. emit Argumentless();
  19. }
  20. function emitShortUint(uint8 value) public {
  21. emit ShortUint(value);
  22. }
  23. function emitShortInt(int8 value) public {
  24. emit ShortInt(value);
  25. }
  26. function emitLongUint(uint256 value) public {
  27. emit LongUint(value);
  28. }
  29. function emitLongInt(int256 value) public {
  30. emit LongInt(value);
  31. }
  32. function emitAddress(address value) public {
  33. emit Address(value);
  34. }
  35. function emitBoolean(bool value) public {
  36. emit Boolean(value);
  37. }
  38. function emitString(string memory value) public {
  39. emit String(value);
  40. }
  41. function emitLongUintBooleanString(uint256 uintValue, bool booleanValue, string memory stringValue) public {
  42. emit LongUintBooleanString(uintValue, booleanValue, stringValue);
  43. }
  44. function emitLongUintAndBoolean(uint256 uintValue, bool boolValue) public {
  45. emit LongUint(uintValue);
  46. emit Boolean(boolValue);
  47. }
  48. function emitStringAndEmitIndirectly(string memory value, IndirectEventEmitter emitter) public {
  49. emit String(value);
  50. emitter.emitStringIndirectly(value);
  51. }
  52. }
  53. contract IndirectEventEmitter {
  54. event IndirectString(string value);
  55. function emitStringIndirectly(string memory value) public {
  56. emit IndirectString(value);
  57. }
  58. }