File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @authors: [@shalzz
3+ * @reviewers: []
4+ * @auditors: []
5+ * @bounties: []
6+ * @deployments: []
7+ */
8+
9+ pragma solidity ^ 0.4.15 ;
10+
11+ import "./RNG.sol " ;
12+
13+ /**
14+ * @title Random Number Generator using beacon chain random opcode
15+ */
16+ contract BeaconRNG is RNG {
17+
18+ /**
19+ * @dev Since we don't really need to incentivise requesting the beacon chain randomness,
20+ * this is a stub implementation required for backwards compatibility with the
21+ * RNG interface.
22+ * @notice All the ETH sent here will be lost forever.
23+ * @param _block Block the random number is linked to.
24+ */
25+ function contribute (uint _block ) public payable {}
26+
27+
28+ /** @dev Return the random number from the PoS randomness beacon.
29+ * @param _block Block the random number is linked to.
30+ * @return RN Random Number. If the PoS upgrade defined by EIP-3675
31+ * has not yet executed 0 instead.
32+ */
33+ function getRN (uint _block ) public returns (uint RN ) {
34+ if (block .difficulty <= 2 ** 64 )
35+ return 0 ;
36+ return block .difficulty ;
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments