EntropyEventsV2.sol 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 userContribution The user's contribution to the random number
  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 userContribution,
  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 userContribution The user's contribution to the random number
  42. * @param providerContribution The provider's contribution to the random number
  43. * @param callbackFailed Whether the callback to the caller failed
  44. * @param callbackReturnValue Return value from the callback. If the callback failed, this field contains
  45. * the error code and any additional returned data. Note that "" often indicates an out-of-gas error.
  46. * If the callback returns more than 256 bytes, only the first 256 bytes of the callback return value are included.
  47. * @param callbackGasUsed How much gas the callback used.
  48. * @param extraArgs A field for extra data for forward compatibility.
  49. */
  50. event Revealed(
  51. address indexed provider,
  52. address indexed caller,
  53. uint64 indexed sequenceNumber,
  54. bytes32 randomNumber,
  55. bytes32 userContribution,
  56. bytes32 providerContribution,
  57. bool callbackFailed,
  58. bytes callbackReturnValue,
  59. uint32 callbackGasUsed,
  60. bytes extraArgs
  61. );
  62. /**
  63. * @notice Emitted when a provider updates their fee
  64. * @param provider The address of the provider updating their fee
  65. * @param oldFee The previous fee amount
  66. * @param newFee The new fee amount
  67. * @param extraArgs A field for extra data for forward compatibility.
  68. */
  69. event ProviderFeeUpdated(
  70. address indexed provider,
  71. uint128 oldFee,
  72. uint128 newFee,
  73. bytes extraArgs
  74. );
  75. /**
  76. * @notice Emitted when a provider updates their default gas limit
  77. * @param provider The address of the provider updating their gas limit
  78. * @param oldDefaultGasLimit The previous default gas limit
  79. * @param newDefaultGasLimit The new default gas limit
  80. * @param extraArgs A field for extra data for forward compatibility.
  81. */
  82. event ProviderDefaultGasLimitUpdated(
  83. address indexed provider,
  84. uint32 oldDefaultGasLimit,
  85. uint32 newDefaultGasLimit,
  86. bytes extraArgs
  87. );
  88. /**
  89. * @notice Emitted when a provider updates their URI
  90. * @param provider The address of the provider updating their URI
  91. * @param oldUri The previous URI
  92. * @param newUri The new URI
  93. * @param extraArgs A field for extra data for forward compatibility.
  94. */
  95. event ProviderUriUpdated(
  96. address indexed provider,
  97. bytes oldUri,
  98. bytes newUri,
  99. bytes extraArgs
  100. );
  101. /**
  102. * @notice Emitted when a provider updates their fee manager address
  103. * @param provider The address of the provider updating their fee manager
  104. * @param oldFeeManager The previous fee manager address
  105. * @param newFeeManager The new fee manager address
  106. * @param extraArgs A field for extra data for forward compatibility.
  107. */
  108. event ProviderFeeManagerUpdated(
  109. address indexed provider,
  110. address oldFeeManager,
  111. address newFeeManager,
  112. bytes extraArgs
  113. );
  114. /**
  115. * @notice Emitted when a provider updates their maximum number of hashes that can be advanced
  116. * @param provider The address of the provider updating their max hashes
  117. * @param oldMaxNumHashes The previous maximum number of hashes
  118. * @param newMaxNumHashes The new maximum number of hashes
  119. * @param extraArgs A field for extra data for forward compatibility.
  120. */
  121. event ProviderMaxNumHashesAdvanced(
  122. address indexed provider,
  123. uint32 oldMaxNumHashes,
  124. uint32 newMaxNumHashes,
  125. bytes extraArgs
  126. );
  127. /**
  128. * @notice Emitted when a provider withdraws their accumulated fees
  129. * @param provider The address of the provider withdrawing fees
  130. * @param recipient The address receiving the withdrawn fees
  131. * @param withdrawnAmount The amount of fees withdrawn
  132. * @param extraArgs A field for extra data for forward compatibility.
  133. */
  134. event Withdrawal(
  135. address indexed provider,
  136. address indexed recipient,
  137. uint128 withdrawnAmount,
  138. bytes extraArgs
  139. );
  140. }