generated from GenerationSoftware/foundry-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RngWitnet_20240215162637.sol
68 lines (55 loc) · 2.78 KB
/
RngWitnet_20240215162637.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import { RNGInterface } from "rng-contracts/RNGInterface.sol";
contract RngWitnet is RNGInterface {
/**
* @notice Emitted when a new request for a random number has been submitted
* @param requestId The indexed ID of the request used to get the results of the RNG service
* @param sender The indexed address of the sender of the request
*/
event RandomNumberRequested(uint32 indexed requestId, address indexed sender);
/**
* @notice Emitted when an existing request for a random number has been completed
* @param requestId The indexed ID of the request used to get the results of the RNG service
* @param randomNumber The random number produced by the 3rd-party service
*/
event RandomNumberCompleted(uint32 indexed requestId, uint256 randomNumber);
/**
* @notice Gets the last request id used by the RNG service
* @return requestId The last request id used in the last request
*/
function getLastRequestId() external view returns (uint32 requestId) {
}
/**
* @notice Gets the Fee for making a Request against an RNG service
* @return feeToken The address of the token that is used to pay fees
* @return requestFee The fee required to be paid to make a request
*/
function getRequestFee() external view returns (address feeToken, uint256 requestFee) {
}
/**
* @notice Sends a request for a random number to the 3rd-party service
* @dev Some services will complete the request immediately, others may have a time-delay
* @dev Some services require payment in the form of a token, such as $LINK for Chainlink VRF
* @return requestId The ID of the request used to get the results of the RNG service
* @return lockBlock The block number at which the RNG service will start generating time-delayed randomness.
* The calling contract should "lock" all activity until the result is available via the `requestId`
*/
function requestRandomNumber() external returns (uint32 requestId, uint32 lockBlock) {
}
/**
* @notice Checks if the request for randomness from the 3rd-party service has completed
* @dev For time-delayed requests, this function is used to check/confirm completion
* @param requestId The ID of the request used to get the results of the RNG service
* @return isCompleted True if the request has completed and a random number is available, false otherwise
*/
function isRequestComplete(uint32 requestId) external view returns (bool isCompleted) {
}
/**
* @notice Gets the random number produced by the 3rd-party service
* @param requestId The ID of the request used to get the results of the RNG service
* @return randomNum The random number
*/
function randomNumber(uint32 requestId) external returns (uint256 randomNum) {
}
}