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

V4 candidate 4 remove create template and ask question #135

Open
wants to merge 2 commits into
base: v4-candidate-5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion packages/contracts/abi/solc-0.8.20/RealityETH-4.0.abi.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contracts/bytecode/RealityETH-4.0.bin

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contracts/bytecode/RealityETH_ERC20-4.0.bin

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion packages/contracts/development/contracts/IRealityETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
pragma solidity 0.8.20;

import {IRealityETHCore} from "./IRealityETHCore.sol";

// Features removed in v4
import {IRealityETHCommitReveal} from "./IRealityETHCommitReveal.sol";
import {IRealityETHCreateTemplateAndAskQuestion} from "./IRealityETHCreateTemplateAndAskQuestion.sol";

/* solhint-disable func-name-mixedcase */

interface IRealityETH is IRealityETHCore, IRealityETHCommitReveal {}
interface IRealityETH is IRealityETHCore, IRealityETHCommitReveal, IRealityETHCreateTemplateAndAskQuestion {}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ interface IRealityETHCore is IBalanceHolder, IRealityETHErrors {
function submitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address answerer) external;
function askQuestion(uint256 template_id, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) external payable returns (bytes32);
function askQuestionWithMinBond(uint256 template_id, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 min_bond) external payable returns (bytes32);
function createTemplateAndAskQuestion(string calldata content, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) external payable returns (bytes32);
function fundAnswerBounty(bytes32 question_id) external payable;
function reopenQuestion(
uint256 template_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ interface IRealityETHCore_ERC20 is IBalanceHolder_ERC20, IRealityETHErrors_ERC20
) external;
function claimWinnings(bytes32 question_id, bytes32[] calldata history_hashes, address[] calldata addrs, uint256[] calldata bonds, bytes32[] calldata answers) external;
function createTemplate(string calldata content) external returns (uint256);
function createTemplateAndAskQuestion(string calldata content, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) external returns (bytes32);
function fundAnswerBountyERC20(bytes32 question_id, uint256 tokens) external;
function notifyOfArbitrationRequest(bytes32 question_id, address requester, uint256 max_previous) external;
function reopenQuestionERC20(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.20;

// This function was removed from reality.eth in version 4.
interface IRealityETHCreateTemplateAndAskQuestion {
function createTemplateAndAskQuestion(string calldata content, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) external payable returns (bytes32);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

pragma solidity 0.8.20;

// Features removed in v4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment might not be clear after reading it later. It could be clearer if one really says waht was removed. Or maybe its not needed at all?

import {IRealityETHCore_ERC20} from "./IRealityETHCore_ERC20.sol";
import {IRealityETHCommitReveal_ERC20} from "./IRealityETHCommitReveal_ERC20.sol";
import {IRealityETHCreateTemplateAndAskQuestion} from "./IRealityETHCreateTemplateAndAskQuestion.sol";

/* solhint-disable func-name-mixedcase */

interface IRealityETH_ERC20 is IRealityETHCore_ERC20, IRealityETHCommitReveal_ERC20 {}
interface IRealityETH_ERC20 is IRealityETHCore_ERC20, IRealityETHCommitReveal_ERC20, IRealityETHCreateTemplateAndAskQuestion {}
28 changes: 0 additions & 28 deletions packages/contracts/development/contracts/RealityETH-4.0.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,34 +127,6 @@ contract RealityETH_v4_0 is BalanceHolder, IRealityETHCore, IRealityETHHistoryVe
return id;
}

/// @notice Create a new reusable template and use it to ask a question
/// @dev Template data is only stored in the event logs, but its block number is kept in contract storage.
/// @param content The template content
/// @param question A string containing the parameters that will be passed into the template to make the question
/// @param arbitrator The arbitration contract that will have the final word on the answer if there is a dispute
/// @param timeout How long the contract should wait after the answer is changed before finalizing on that answer
/// @param opening_ts If set, the earliest time it should be possible to answer the question.
/// @param nonce A user-specified nonce used in the question ID. Change it to repeat a question.
/// @return The ID of the newly-created template, which is created sequentially.
function createTemplateAndAskQuestion(
string memory content,
string memory question,
address arbitrator,
uint32 timeout,
uint32 opening_ts,
uint256 nonce
)
public
payable
returns (
// stateNotCreated is enforced by the internal _askQuestion
bytes32
)
{
uint256 template_id = createTemplate(content);
return askQuestion(template_id, question, arbitrator, timeout, opening_ts, nonce);
}

/// @notice Ask a new question and return the ID
/// @dev Template data is only stored in the event logs, but its block number is kept in contract storage.
/// @param template_id The ID number of the template the question will use
Expand Down
27 changes: 0 additions & 27 deletions packages/contracts/development/contracts/RealityETH_ERC20-4.0.sol
Original file line number Diff line number Diff line change
Expand Up @@ -136,33 +136,6 @@ contract RealityETH_ERC20_v4_0 is BalanceHolder_ERC20, IRealityETHCore_ERC20, IR
return id;
}

/// @notice Create a new reusable template and use it to ask a question
/// @dev Template data is only stored in the event logs, but its block number is kept in contract storage.
/// @param content The template content
/// @param question A string containing the parameters that will be passed into the template to make the question
/// @param arbitrator The arbitration contract that will have the final word on the answer if there is a dispute
/// @param timeout How long the contract should wait after the answer is changed before finalizing on that answer
/// @param opening_ts If set, the earliest time it should be possible to answer the question.
/// @param nonce A user-specified nonce used in the question ID. Change it to repeat a question.
/// @return The ID of the newly-created template, which is created sequentially.
function createTemplateAndAskQuestion(
string memory content,
string memory question,
address arbitrator,
uint32 timeout,
uint32 opening_ts,
uint256 nonce
)
public
returns (
// stateNotCreated is enforced by the internal _askQuestion
bytes32
)
{
uint256 template_id = createTemplate(content);
return askQuestion(template_id, question, arbitrator, timeout, opening_ts, nonce);
}

/// @notice Ask a new question without a bounty and return the ID
/// @dev Template data is only stored in the event logs, but its block number is kept in contract storage.
/// @dev Calling without the token param will only work if there is no arbitrator-set question fee.
Expand Down