Skip to content

Commit

Permalink
feat: UsingWitnetRandomness abstract contract
Browse files Browse the repository at this point in the history
  • Loading branch information
guidiaz committed Mar 22, 2024
1 parent 7e65127 commit b69481f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions contracts/apps/UsingWitnetRandomness.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../WitnetRandomness.sol";

/// @title The UsingWitnetRandomness contract
/// @dev Contracts willing to interact with WitnetRandomness appliance should just inherit from this contract.
/// @author The Witnet Foundation.
abstract contract UsingWitnetRandomness
is
IWitnetOracleEvents,
IWitnetRandomnessEvents
{
WitnetOracle immutable public witnet;
WitnetRandomness immutable public _RNG;

constructor(WitnetRandomness _witnetRandomness) {
require(
address(_witnetRandomness).code.length > 0
&& _witnetRandomness.specs() == type(WitnetRandomness).interfaceId,
"UsingWitnetRandomness: uncompliant WitnetRandomness appliance"
);
_RNG = _witnetRandomness;
witnet = _RNG.witnet();
}

}

0 comments on commit b69481f

Please sign in to comment.