Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/upgrade mainnets #410

Merged
merged 21 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions contracts/data/WitnetBoardData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ abstract contract WitnetBoardData {
_;
}

modifier onlyRequester(uint256 _queryId) {
require(__query(_queryId).from == msg.sender, "WitnetRequestBoard: only the requester");
_;
}

/// Asserts the give query was actually posted before calling this method.
modifier wasPosted(uint256 _queryId) {
require(_queryId > 0 && _queryId <= __storage().numQueries, "WitnetRequestBoard: not yet posted");
Expand Down
4 changes: 2 additions & 2 deletions contracts/impls/apps/WitnetPriceFeedsUpgradable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ contract WitnetPriceFeedsUpgradable
if (__storage().defaultSlaHash == 0) {
settleDefaultRadonSLA(WitnetV2.RadonSLA({
numWitnesses: 5,
witnessCollateral: 15 * 10 ** 9,
witnessReward: 15 * 10 ** 7,
witnessCollateral: 20 * 10 ** 9,
witnessReward: 2 * 10 ** 8,
minerCommitRevealFee: 10 ** 7,
minConsensusPercentage: 51
}));
Expand Down
4 changes: 2 additions & 2 deletions contracts/impls/apps/WitnetRandomnessProxiable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ contract WitnetRandomnessProxiable
settleWitnetRandomnessSLA(WitnetV2.RadonSLA({
numWitnesses: 5,
minConsensusPercentage: 51,
witnessReward: 10 ** 8,
witnessCollateral: 10 ** 9,
witnessReward: 2 * 10 ** 8,
witnessCollateral: 2 * 10 ** 9,
minerCommitRevealFee: 10 ** 7
}));
}
Expand Down
12 changes: 6 additions & 6 deletions contracts/impls/core/customs/WitnetRequestBoardTrustableBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,8 @@ abstract contract WitnetRequestBoardTrustableBase
/// @dev or deleted.
/// @param _queryId The unique identifier of a previously posted query.
function readRequest(uint256 _queryId)
external view
override
public view
virtual override
inStatus(_queryId, Witnet.QueryStatus.Posted)
returns (Witnet.Request memory _request)
{
Expand Down Expand Up @@ -684,8 +684,8 @@ abstract contract WitnetRequestBoardTrustableBase
/// @dev Fails if the `_queryId` is not in 'Reported' status.
/// @param _queryId The unique query identifier
function readResponse(uint256 _queryId)
external view
override
public view
virtual override
inStatus(_queryId, Witnet.QueryStatus.Reported)
returns (Witnet.Response memory _response)
{
Expand Down Expand Up @@ -720,8 +720,8 @@ abstract contract WitnetRequestBoardTrustableBase
/// @dev Fails if the `_queryId` is not in 'Reported' status.
/// @param _queryId The unique query identifier
function readResponseResult(uint256 _queryId)
external view
override
public view
virtual override
inStatus(_queryId, Witnet.QueryStatus.Reported)
returns (Witnet.Result memory)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// SPDX-License-Identifier: MIT

/* solhint-disable var-name-mixedcase */

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

import "../WitnetRequestBoardTrustableDefault.sol";

/// @title Witnet Request Board "trustable" implementation contract.
/// @notice Contract to bridge requests to Witnet Decentralized Oracle Network.
/// @dev This contract enables posting requests that Witnet bridges will insert into the Witnet network.
/// The result of the requests will be posted back to this contract by the bridge nodes too.
/// @author The Witnet Foundation
contract WitnetRequestBoardTrustableObscuro
is
WitnetRequestBoardTrustableDefault
{
constructor(
WitnetRequestFactory _factory,
bool _upgradable,
bytes32 _versionTag,
uint256 _reportResultGasLimit
)
WitnetRequestBoardTrustableDefault(
_factory,
_upgradable,
_versionTag,
_reportResultGasLimit
)
{}

// ================================================================================================================
// --- Overrides implementation of 'IWitnetRequestBoardView' ------------------------------------------------------

/// @notice Retrieves the whole Request record posted to the Witnet Request Board.
/// @dev Fails if the `_queryId` is not valid or, if it has already been reported
/// @dev or deleted, or if `msg.sender` is not the actual requester.
/// @param _queryId The unique identifier of a previously posted query.
function readRequest(uint256 _queryId)
public view
virtual override
onlyRequester(_queryId)
returns (Witnet.Request memory)
{
return WitnetRequestBoardTrustableBase.readRequest(_queryId);
}

/// Retrieves the Witnet-provided result, and metadata, to a previously posted request.
/// @dev Fails if the `_queryId` is not in 'Reported' status, or if `msg.sender` is not the actual requester.
/// @param _queryId The unique query identifier
function readResponse(uint256 _queryId)
public view
virtual override
onlyRequester(_queryId)
returns (Witnet.Response memory _response)
{
return WitnetRequestBoardTrustableBase.readResponse(_queryId);
}

/// Retrieves the Witnet-provided CBOR-bytes result of a previously posted request.
/// @dev Fails if the `_queryId` is not in 'Reported' status, or if `msg.sender` is not the actual requester.
/// @param _queryId The unique query identifier
function readResponseResult(uint256 _queryId)
public view
virtual override
onlyRequester(_queryId)
returns (Witnet.Result memory)
{
return WitnetRequestBoardTrustableBase.readResponseResult(_queryId);
}

}
Loading
Loading