@@ -6,6 +6,8 @@ import "./EntropyEventsV2.sol";
6
6
import "./EntropyStructsV2.sol " ;
7
7
import "./IEntropyV2.sol " ;
8
8
9
+ /// @notice DEPRECATED: This interface is deprecated. Please use IEntropyV2 instead for new implementations.
10
+ /// IEntropyV2 provides better callback handling and improved functionality.
9
11
interface IEntropy is EntropyEvents , EntropyEventsV2 , IEntropyV2 {
10
12
// Register msg.sender as a randomness provider. The arguments are the provider's configuration parameters
11
13
// and initial commitment. Re-registering the same provider rotates the provider's commitment (and updates
@@ -38,17 +40,22 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
38
40
// their chosen provider (the exact method for doing so will depend on the provider) to retrieve the provider's
39
41
// number. The user should then call fulfillRequest to construct the final random number.
40
42
//
43
+ // WARNING: This method does NOT invoke a user callback. If you need callback functionality,
44
+ // use requestV2 from the IEntropyV2 interface instead.
45
+ //
41
46
// This method will revert unless the caller provides a sufficient fee (at least getFee(provider)) as msg.value.
42
47
// Note that excess value is *not* refunded to the caller.
43
- function request (
44
- address provider ,
45
- bytes32 userCommitment ,
46
- bool useBlockHash
47
- ) external payable returns (uint64 assignedSequenceNumber );
48
+ function request (address provider , bytes32 userCommitment , bool useBlockHash )
49
+ external
50
+ payable
51
+ returns (uint64 assignedSequenceNumber );
48
52
49
53
// Request a random number. The method expects the provider address and a secret random number
50
54
// in the arguments. It returns a sequence number.
51
55
//
56
+ // DEPRECATED: This method is deprecated. Please use requestV2 from the IEntropyV2 interface instead,
57
+ // which provides better callback handling and gas limit control.
58
+ //
52
59
// The address calling this function should be a contract that inherits from the IEntropyConsumer interface.
53
60
// The `entropyCallback` method on that interface will receive a callback with the generated random number.
54
61
// `entropyCallback` will be run with the provider's default gas limit (see `getProviderInfo(provider).defaultGasLimit`).
@@ -57,10 +64,10 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
57
64
//
58
65
// This method will revert unless the caller provides a sufficient fee (at least `getFee(provider)`) as msg.value.
59
66
// Note that excess value is *not* refunded to the caller.
60
- function requestWithCallback (
61
- address provider ,
62
- bytes32 userRandomNumber
63
- ) external payable returns (uint64 assignedSequenceNumber );
67
+ function requestWithCallback (address provider , bytes32 userRandomNumber )
68
+ external
69
+ payable
70
+ returns (uint64 assignedSequenceNumber );
64
71
65
72
// Fulfill a request for a random number. This method validates the provided userRandomness and provider's proof
66
73
// against the corresponding commitments in the in-flight request. If both values are validated, this function returns
@@ -69,12 +76,9 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
69
76
// Note that this function can only be called once per in-flight request. Calling this function deletes the stored
70
77
// request information (so that the contract doesn't use a linear amount of storage in the number of requests).
71
78
// If you need to use the returned random number more than once, you are responsible for storing it.
72
- function reveal (
73
- address provider ,
74
- uint64 sequenceNumber ,
75
- bytes32 userRevelation ,
76
- bytes32 providerRevelation
77
- ) external returns (bytes32 randomNumber );
79
+ function reveal (address provider , uint64 sequenceNumber , bytes32 userRevelation , bytes32 providerRevelation )
80
+ external
81
+ returns (bytes32 randomNumber );
78
82
79
83
// Fulfill a request for a random number. This method validates the provided userRandomness
80
84
// and provider's revelation against the corresponding commitment in the in-flight request. If both values are validated
@@ -93,30 +97,22 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
93
97
bytes32 providerRevelation
94
98
) external ;
95
99
96
- function getProviderInfo (
97
- address provider
98
- ) external view returns (EntropyStructs.ProviderInfo memory info );
100
+ function getProviderInfo (address provider ) external view returns (EntropyStructs.ProviderInfo memory info );
99
101
100
- function getRequest (
101
- address provider ,
102
- uint64 sequenceNumber
103
- ) external view returns (EntropyStructs.Request memory req );
102
+ function getRequest (address provider , uint64 sequenceNumber )
103
+ external
104
+ view
105
+ returns (EntropyStructs.Request memory req );
104
106
105
107
// Get the fee charged by provider for a request with the default gasLimit (`request` or `requestWithCallback`).
106
108
// If you are calling any of the `requestV2` methods, please use `getFeeV2`.
107
109
function getFee (address provider ) external view returns (uint128 feeAmount );
108
110
109
- function getAccruedPythFees ()
110
- external
111
- view
112
- returns (uint128 accruedPythFeesInWei );
111
+ function getAccruedPythFees () external view returns (uint128 accruedPythFeesInWei );
113
112
114
113
function setProviderFee (uint128 newFeeInWei ) external ;
115
114
116
- function setProviderFeeAsFeeManager (
117
- address provider ,
118
- uint128 newFeeInWei
119
- ) external ;
115
+ function setProviderFeeAsFeeManager (address provider , uint128 newFeeInWei ) external ;
120
116
121
117
function setProviderUri (bytes calldata newUri ) external ;
122
118
@@ -135,19 +131,13 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
135
131
136
132
// Advance the provider commitment and increase the sequence number.
137
133
// This is used to reduce the `numHashes` required for future requests which leads to reduced gas usage.
138
- function advanceProviderCommitment (
139
- address provider ,
140
- uint64 advancedSequenceNumber ,
141
- bytes32 providerRevelation
142
- ) external ;
134
+ function advanceProviderCommitment (address provider , uint64 advancedSequenceNumber , bytes32 providerRevelation )
135
+ external ;
143
136
144
- function constructUserCommitment (
145
- bytes32 userRandomness
146
- ) external pure returns (bytes32 userCommitment );
137
+ function constructUserCommitment (bytes32 userRandomness ) external pure returns (bytes32 userCommitment );
147
138
148
- function combineRandomValues (
149
- bytes32 userRandomness ,
150
- bytes32 providerRandomness ,
151
- bytes32 blockHash
152
- ) external pure returns (bytes32 combinedRandomness );
139
+ function combineRandomValues (bytes32 userRandomness , bytes32 providerRandomness , bytes32 blockHash )
140
+ external
141
+ pure
142
+ returns (bytes32 combinedRandomness );
153
143
}
0 commit comments