EntropyEventsV2.sol 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // SPDX-License-Identifier: Apache-2.0
  2. pragma solidity ^0.8.0;
  3. import "./EntropyStructs.sol";
  4. /**
  5. * @title EntropyEventsV2
  6. * @notice Interface defining events for the Entropy V2 system, which handles random number generation
  7. * and provider management on Ethereum.
  8. * @dev This interface is used to emit events that track the lifecycle of random number requests,
  9. * provider registrations, and system configurations.
  10. */
  11. interface EntropyEventsV2 {
  12. /**
  13. * @notice Emitted when a new provider registers with the Entropy system
  14. * @param provider The address of the registered provider
  15. * @param extraArgs A field for extra data for forward compatibility.
  16. */
  17. event Registered(address indexed provider, bytes extraArgs);
  18. /**
  19. * @notice Emitted when a user requests a random number from a provider
  20. * @param provider The address of the provider handling the request
  21. * @param caller The address of the user requesting the random number
  22. * @param sequenceNumber A unique identifier for this request
  23. * @param userRandomNumber A random number provided by the user for additional entropy
  24. * @param gasLimit The gas limit for the callback.
  25. * @param extraArgs A field for extra data for forward compatibility.
  26. */
  27. event Requested(
  28. address indexed provider,
  29. address indexed caller,
  30. uint64 indexed sequenceNumber,
  31. bytes32 userRandomNumber,
  32. uint32 gasLimit,
  33. bytes extraArgs
  34. );
  35. /**
  36. * @notice Emitted when a provider reveals the generated random number
  37. * @param provider The address of the provider that generated the random number
  38. * @param caller The address of the user who requested the random number (and who receives a callback)
  39. * @param sequenceNumber The unique identifier of the request
  40. * @param randomNumber The generated random number
  41. * @param callbackFailed Whether the callback to the caller failed
  42. * @param callbackReturnValue Return value from the callback. If the callback failed, this field contains
  43. * the error code and any additional returned data. Note that "" often indicates an out-of-gas error.
  44. * If the callback returns more than 256 bytes, only the first 256 bytes of the callback return value are included.
  45. * @param callbackGasUsed How much gas the callback used.
  46. * @param extraArgs A field for extra data for forward compatibility.
  47. */
  48. event Revealed(
  49. address indexed provider,
  50. address indexed caller,
  51. uint64 indexed sequenceNumber,
  52. bytes32 randomNumber,
  53. bool callbackFailed,
  54. bytes callbackReturnValue,
  55. uint32 callbackGasUsed,
  56. bytes extraArgs
  57. );
  58. /**
  59. * @notice Emitted when a provider updates their fee
  60. * @param provider The address of the provider updating their fee
  61. * @param oldFee The previous fee amount
  62. * @param newFee The new fee amount
  63. * @param extraArgs A field for extra data for forward compatibility.
  64. */
  65. event ProviderFeeUpdated(
  66. address indexed provider,
  67. uint128 oldFee,
  68. uint128 newFee,
  69. bytes extraArgs
  70. );
  71. /**
  72. * @notice Emitted when a provider updates their default gas limit
  73. * @param provider The address of the provider updating their gas limit
  74. * @param oldDefaultGasLimit The previous default gas limit
  75. * @param newDefaultGasLimit The new default gas limit
  76. * @param extraArgs A field for extra data for forward compatibility.
  77. */
  78. event ProviderDefaultGasLimitUpdated(
  79. address indexed provider,
  80. uint32 oldDefaultGasLimit,
  81. uint32 newDefaultGasLimit,
  82. bytes extraArgs
  83. );
  84. /**
  85. * @notice Emitted when a provider updates their URI
  86. * @param provider The address of the provider updating their URI
  87. * @param oldUri The previous URI
  88. * @param newUri The new URI
  89. * @param extraArgs A field for extra data for forward compatibility.
  90. */
  91. event ProviderUriUpdated(
  92. address indexed provider,
  93. bytes oldUri,
  94. bytes newUri,
  95. bytes extraArgs
  96. );
  97. /**
  98. * @notice Emitted when a provider updates their fee manager address
  99. * @param provider The address of the provider updating their fee manager
  100. * @param oldFeeManager The previous fee manager address
  101. * @param newFeeManager The new fee manager address
  102. * @param extraArgs A field for extra data for forward compatibility.
  103. */
  104. event ProviderFeeManagerUpdated(
  105. address indexed provider,
  106. address oldFeeManager,
  107. address newFeeManager,
  108. bytes extraArgs
  109. );
  110. /**
  111. * @notice Emitted when a provider updates their maximum number of hashes that can be advanced
  112. * @param provider The address of the provider updating their max hashes
  113. * @param oldMaxNumHashes The previous maximum number of hashes
  114. * @param newMaxNumHashes The new maximum number of hashes
  115. * @param extraArgs A field for extra data for forward compatibility.
  116. */
  117. event ProviderMaxNumHashesAdvanced(
  118. address indexed provider,
  119. uint32 oldMaxNumHashes,
  120. uint32 newMaxNumHashes,
  121. bytes extraArgs
  122. );
  123. /**
  124. * @notice Emitted when a provider withdraws their accumulated fees
  125. * @param provider The address of the provider withdrawing fees
  126. * @param recipient The address receiving the withdrawn fees
  127. * @param withdrawnAmount The amount of fees withdrawn
  128. * @param extraArgs A field for extra data for forward compatibility.
  129. */
  130. event Withdrawal(
  131. address indexed provider,
  132. address indexed recipient,
  133. uint128 withdrawnAmount,
  134. bytes extraArgs
  135. );
  136. }