diff --git a/contracts/mockups/UsingWitPriceFeeds.sol b/contracts/mockups/UsingWitPriceFeeds.sol new file mode 100644 index 00000000..5fbc438c --- /dev/null +++ b/contracts/mockups/UsingWitPriceFeeds.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +import "../WitPriceFeeds.sol"; + +/// @title The UsingWitPriceFeeds contract +/// @dev Contracts willing to interact with a WitPriceFeeds appliance, freshly updated by a third-party. +/// @author The Witnet Foundation. +abstract contract UsingWitPriceFeeds + is + IWitFeedsEvents, + IWitOracleEvents +{ + WitPriceFeeds immutable public witPriceFeeds; + + constructor(WitPriceFeeds _witPriceFeeds) { + require( + address(_witPriceFeeds).code.length > 0 + && _witPriceFeeds.specs() == type(WitPriceFeeds).interfaceId, + "UsingWitPriceFeeds: uncompliant WitPriceFeeds appliance" + ); + witPriceFeeds = _witPriceFeeds; + } + + receive() external payable virtual {} +} diff --git a/contracts/mockups/UsingWitRandomness.sol b/contracts/mockups/UsingWitRandomness.sol index 7acbf6dc..11e98fc5 100644 --- a/contracts/mockups/UsingWitRandomness.sol +++ b/contracts/mockups/UsingWitRandomness.sol @@ -13,15 +13,15 @@ abstract contract UsingWitRandomness IWitOracleEvents, IWitRandomnessEvents { - WitRandomness immutable public witOracleRandomness; + WitRandomness immutable public witRandomness; - constructor(WitRandomness _witOracleRandomness) { + constructor(WitRandomness _witRandomness) { require( - address(_witOracleRandomness).code.length > 0 - && _witOracleRandomness.specs() == type(WitRandomness).interfaceId, + address(_witRandomness).code.length > 0 + && _witRandomness.specs() == type(WitRandomness).interfaceId, "UsingWitRandomness: uncompliant WitRandomness appliance" ); - witOracleRandomness = _witOracleRandomness; + witRandomness = _witRandomness; } receive() external payable virtual {}