1+
2+ pragma solidity ^ 0.5.4 ;
3+
4+ /**
5+ * @title Keep Random Beacon
6+ *
7+ * @notice Keep Random Beacon generates verifiable randomness that is resistant
8+ * to bad actors both in the relay network and on the anchoring blockchain.
9+ */
10+ interface IRandomBeacon {
11+
12+ /**
13+ * @notice Provides the customer with an estimated entry fee in wei to use
14+ * in the request. The fee estimate is only valid for the transaction it is
15+ * called in, so the customer must make the request immediately after
16+ * obtaining the estimate. Insufficient payment will lead to the request
17+ * being rejected and the transaction reverted.
18+ *
19+ * The customer may decide to provide more ether for an entry fee than
20+ * estimated by this function. This is especially heplful when callback gas
21+ * cost fluctuates. Any surplus between the passed fee and the actual cost
22+ * of producing an entry and executing a callback is returned back to the
23+ * customer.
24+ * @param callbackGas Gas required for the callback.
25+ */
26+ function entryFeeEstimate (uint256 callbackGas ) external view returns (uint256 );
27+
28+ /**
29+ * @notice Submits a request to generate a new relay entry. Executes the
30+ * provided callback with the generated entry and emits
31+ * `RelayEntryGenerated(uint256 requestId, uint256 entry)` event.
32+ *
33+ * @dev Beacon does not support concurrent relay requests. No new requests
34+ * should be made while the beacon is already processing another request.
35+ * Requests made while the beacon is busy will be rejected and the
36+ * transaction reverted.
37+
38+ * @param callbackContract Callback contract address. Callback is called
39+ * once a new relay entry has been generated.
40+ * @param callbackMethod Callback contract method signature. String
41+ * representation of your method with a single
42+ * uint256 input parameter i.e. "relayEntryCallback(uint256)".
43+ * @param callbackGas Gas required for the callback.
44+ * The customer needs to ensure they provide a sufficient callback gas
45+ * to cover the gas fee of executing the callback. Any surplus is returned
46+ * to the customer. If the callback gas amount turns to be not enough to
47+ * execute the callback, callback execution is skipped.
48+ * @return An uint256 representing uniquely generated relay request ID
49+ */
50+ function requestRelayEntry (
51+ address callbackContract ,
52+ string calldata callbackMethod ,
53+ uint256 callbackGas
54+ ) external payable returns (uint256 );
55+
56+ /**
57+ * @notice Submits a request to generate a new relay entry. Emits
58+ * `RelayEntryGenerated(uint256 requestId, uint256 entry)` event for the
59+ * generated entry.
60+ *
61+ * @dev Beacon does not support concurrent relay requests. No new requests
62+ * should be made while the beacon is already processing another request.
63+ * Requests made while the beacon is busy will be rejected and the
64+ * transaction reverted.
65+ *
66+ * @return An uint256 representing uniquely generated relay request ID
67+ */
68+ function requestRelayEntry () external payable returns (uint256 );
69+ }
0 commit comments