@reality.eth/contracts 3.0.48 → 4.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/abi/solc-0.8.20/RealityETH-4.0.abi.json +1 -1
  2. package/abi/solc-0.8.20/RealityETHFreezableExample_ERC20-4.0.abi.json +1 -0
  3. package/abi/solc-0.8.20/RealityETHReopenable-4.0.abi.json +1 -0
  4. package/abi/solc-0.8.20/RealityETHReopenable_ERC20-4.0.abi.json +1 -0
  5. package/abi/solc-0.8.20/RealityETH_ERC20-4.0.abi.json +1 -1
  6. package/bytecode/RealityETH-4.0.bin +1 -1
  7. package/bytecode/RealityETHFreezableExample_ERC20-4.0.bin +1 -0
  8. package/bytecode/RealityETHReopenable-4.0.bin +1 -0
  9. package/bytecode/RealityETHReopenable_ERC20-4.0.bin +1 -0
  10. package/bytecode/RealityETH_ERC20-4.0.bin +1 -1
  11. package/chains/supported.json +1 -1
  12. package/development/contracts/IBalanceHolder.sol +1 -0
  13. package/development/contracts/IRealityETH.sol +6 -2
  14. package/development/contracts/{IRealityETHCore.sol → IRealityETHCore_Common.sol} +4 -23
  15. package/development/contracts/IRealityETHCore_ERC20.sol +3 -124
  16. package/development/contracts/IRealityETHCore_Native.sol +12 -0
  17. package/development/contracts/IRealityETHCreateTemplateAndAskQuestion.sol +8 -0
  18. package/development/contracts/IRealityETHHistoryVerification.sol +8 -0
  19. package/development/contracts/IRealityETHReopenable.sol +22 -0
  20. package/development/contracts/IRealityETHReopenable_ERC20.sol +23 -0
  21. package/development/contracts/IRealityETH_ERC20.sol +5 -1
  22. package/development/contracts/RealityETH-4.0.sol +12 -614
  23. package/development/contracts/RealityETHCore_Common.sol +535 -0
  24. package/development/contracts/RealityETHFreezableExample_ERC20-4.0.sol +17 -0
  25. package/development/contracts/RealityETHFreezable_ERC20.sol +39 -0
  26. package/development/contracts/RealityETHReopenable-4.0.sol +119 -0
  27. package/development/contracts/RealityETHReopenable_ERC20-4.0.sol +122 -0
  28. package/development/contracts/RealityETH_ERC20-4.0.sol +13 -614
  29. package/generated/chains.json +1 -1
  30. package/package.json +2 -2
  31. package/tests/python/test.py +186 -5
  32. package/development/contracts/BalanceHolder_ERC20.sol +0 -21
  33. package/development/contracts/IBalanceHolder_ERC20.sol +0 -11
@@ -2,59 +2,13 @@
2
2
 
3
3
  pragma solidity 0.8.20;
4
4
 
5
- import {IBalanceHolder_ERC20} from "./IBalanceHolder_ERC20.sol";
6
- import {IERC20} from "./IERC20.sol";
7
5
  import {IRealityETHErrors_ERC20} from "./IRealityETHErrors_ERC20.sol";
6
+ import {IERC20} from "./IERC20.sol";
8
7
 
9
8
  /* solhint-disable func-name-mixedcase */
10
9
 
11
10
  // solhint-disable-next-line contract-name-camelcase
12
- interface IRealityETHCore_ERC20 is IBalanceHolder_ERC20, IRealityETHErrors_ERC20 {
13
- event LogCancelArbitration(bytes32 indexed question_id);
14
- event LogClaim(bytes32 indexed question_id, address indexed user, uint256 amount);
15
- event LogFinalize(bytes32 indexed question_id, bytes32 indexed answer);
16
- event LogFundAnswerBounty(bytes32 indexed question_id, uint256 bounty_added, uint256 bounty, address indexed user);
17
- event LogMinimumBond(bytes32 indexed question_id, uint256 min_bond);
18
- event LogNewAnswer(bytes32 answer, bytes32 indexed question_id, bytes32 history_hash, address indexed user, uint256 bond, uint256 ts, bool is_commitment);
19
- event LogNewQuestion(
20
- bytes32 indexed question_id,
21
- address indexed user,
22
- uint256 template_id,
23
- string question,
24
- bytes32 indexed content_hash,
25
- address arbitrator,
26
- uint32 timeout,
27
- uint32 opening_ts,
28
- uint256 nonce,
29
- uint256 created
30
- );
31
- event LogNewTemplate(uint256 indexed template_id, address indexed user, string question_text);
32
- event LogNotifyOfArbitrationRequest(bytes32 indexed question_id, address indexed user);
33
- event LogReopenQuestion(bytes32 indexed question_id, bytes32 indexed reopened_question_id);
34
- event LogSetQuestionFee(address arbitrator, uint256 amount);
35
-
36
- struct Question {
37
- bytes32 content_hash;
38
- address arbitrator;
39
- uint32 opening_ts;
40
- uint32 timeout;
41
- uint32 finalize_ts;
42
- bool is_pending_arbitration;
43
- uint256 bounty;
44
- bytes32 best_answer;
45
- bytes32 history_hash;
46
- uint256 bond;
47
- uint256 min_bond;
48
- }
49
-
50
- // Only used when claiming more bonds than fits into a transaction
51
- // Stored in a mapping indexed by question_id.
52
- struct Claim {
53
- address payee;
54
- uint256 last_bond;
55
- uint256 queued_funds; // Only used on v3 or lower (related to commit-reveal)
56
- }
57
-
11
+ interface IRealityETHCore_ERC20 is IRealityETHErrors_ERC20 {
58
12
  function askQuestion(uint256 template_id, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) external returns (bytes32);
59
13
  function askQuestionERC20(uint256 template_id, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 tokens) external returns (bytes32);
60
14
  function askQuestionWithMinBondERC20(
@@ -67,83 +21,8 @@ interface IRealityETHCore_ERC20 is IBalanceHolder_ERC20, IRealityETHErrors_ERC20
67
21
  uint256 min_bond,
68
22
  uint256 tokens
69
23
  ) external returns (bytes32);
70
- function assignWinnerAndSubmitAnswerByArbitrator(
71
- bytes32 question_id,
72
- bytes32 answer,
73
- address payee_if_wrong,
74
- bytes32 last_history_hash,
75
- bytes32 last_answer_or_commitment_id,
76
- address last_answerer
77
- ) external;
78
- function cancelArbitration(bytes32 question_id) external;
79
- function claimMultipleAndWithdrawBalance(
80
- bytes32[] calldata question_ids,
81
- uint256[] calldata lengths,
82
- bytes32[] calldata hist_hashes,
83
- address[] calldata addrs,
84
- uint256[] calldata bonds,
85
- bytes32[] calldata answers
86
- ) external;
87
- function claimWinnings(bytes32 question_id, bytes32[] calldata history_hashes, address[] calldata addrs, uint256[] calldata bonds, bytes32[] calldata answers) external;
88
- function createTemplate(string calldata content) external returns (uint256);
89
- function createTemplateAndAskQuestion(string calldata content, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) external returns (bytes32);
90
24
  function fundAnswerBountyERC20(bytes32 question_id, uint256 tokens) external;
91
- function notifyOfArbitrationRequest(bytes32 question_id, address requester, uint256 max_previous) external;
92
- function reopenQuestionERC20(
93
- uint256 template_id,
94
- string calldata question,
95
- address arbitrator,
96
- uint32 timeout,
97
- uint32 opening_ts,
98
- uint256 nonce,
99
- uint256 min_bond,
100
- bytes32 reopens_question_id,
101
- uint256 tokens
102
- ) external returns (bytes32);
103
- function setQuestionFee(uint256 fee) external;
104
- function setToken(IERC20 _token) external;
105
- function submitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address answerer) external;
106
25
  function submitAnswerERC20(bytes32 question_id, bytes32 answer, uint256 max_previous, uint256 tokens) external;
107
26
  function submitAnswerForERC20(bytes32 question_id, bytes32 answer, uint256 max_previous, address answerer, uint256 tokens) external;
108
- function arbitrator_question_fees(address) external view returns (uint256);
109
- function getArbitrator(bytes32 question_id) external view returns (address);
110
- function getBestAnswer(bytes32 question_id) external view returns (bytes32);
111
- function getBond(bytes32 question_id) external view returns (uint256);
112
- function getBounty(bytes32 question_id) external view returns (uint256);
113
- function getContentHash(bytes32 question_id) external view returns (bytes32);
114
- function getFinalAnswer(bytes32 question_id) external view returns (bytes32);
115
- function getFinalAnswerIfMatches(bytes32 question_id, bytes32 content_hash, address arbitrator, uint32 min_timeout, uint256 min_bond) external view returns (bytes32);
116
- function getFinalizeTS(bytes32 question_id) external view returns (uint32);
117
- function getHistoryHash(bytes32 question_id) external view returns (bytes32);
118
- function getMinBond(bytes32 question_id) external view returns (uint256);
119
- function getOpeningTS(bytes32 question_id) external view returns (uint32);
120
- function getTimeout(bytes32 question_id) external view returns (uint32);
121
- function isFinalized(bytes32 question_id) external view returns (bool);
122
- function isPendingArbitration(bytes32 question_id) external view returns (bool);
123
- function isSettledTooSoon(bytes32 question_id) external view returns (bool);
124
- function question_claims(bytes32) external view returns (address payee, uint256 last_bond, uint256 queued_funds);
125
- function questions(
126
- bytes32
127
- )
128
- external
129
- view
130
- returns (
131
- bytes32 content_hash,
132
- address arbitrator,
133
- uint32 opening_ts,
134
- uint32 timeout,
135
- uint32 finalize_ts,
136
- bool is_pending_arbitration,
137
- uint256 bounty,
138
- bytes32 best_answer,
139
- bytes32 history_hash,
140
- uint256 bond,
141
- uint256 min_bond
142
- );
143
- function reopened_questions(bytes32) external view returns (bytes32);
144
- function reopener_questions(bytes32) external view returns (bool);
145
- function resultFor(bytes32 question_id) external view returns (bytes32);
146
- function resultForOnceSettled(bytes32 question_id) external view returns (bytes32);
147
- function template_hashes(uint256) external view returns (bytes32);
148
- function templates(uint256) external view returns (uint256);
27
+ function token() external view returns (IERC20);
149
28
  }
@@ -0,0 +1,12 @@
1
+ // SPDX-License-Identifier: GPL-3.0-only
2
+
3
+ pragma solidity 0.8.20;
4
+
5
+ /* solhint-disable func-name-mixedcase */
6
+ interface IRealityETHCore_Native {
7
+ function askQuestion(uint256 template_id, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) external payable returns (bytes32);
8
+ function askQuestionWithMinBond(uint256 template_id, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 min_bond) external payable returns (bytes32);
9
+ function fundAnswerBounty(bytes32 question_id) external payable;
10
+ function submitAnswer(bytes32 question_id, bytes32 answer, uint256 max_previous) external payable;
11
+ function submitAnswerFor(bytes32 question_id, bytes32 answer, uint256 max_previous, address answerer) external payable;
12
+ }
@@ -0,0 +1,8 @@
1
+ // SPDX-License-Identifier: GPL-3.0-only
2
+
3
+ pragma solidity 0.8.20;
4
+
5
+ // This function was removed from reality.eth in version 4.
6
+ interface IRealityETHCreateTemplateAndAskQuestion {
7
+ function createTemplateAndAskQuestion(string calldata content, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) external payable returns (bytes32);
8
+ }
@@ -0,0 +1,8 @@
1
+ // SPDX-License-Identifier: GPL-3.0-only
2
+
3
+ pragma solidity 0.8.20;
4
+
5
+ // These functions were removed added to reality.eth in version 4.
6
+ interface IRealityETHHistoryVerification {
7
+ function isHistoryOfUnfinalizedQuestionValid(bytes32 question_id, bytes32[] memory history_hashes, address[] memory addrs, uint256[] memory bonds, bytes32[] memory answers) external view returns (bool);
8
+ }
@@ -0,0 +1,22 @@
1
+ // SPDX-License-Identifier: GPL-3.0-only
2
+
3
+ pragma solidity 0.8.20;
4
+
5
+ // These functions were removed from IRealityETH in version 4.
6
+ interface IRealityETHReopenable {
7
+ event LogReopenQuestion(bytes32 indexed question_id, bytes32 indexed reopened_question_id);
8
+ function isSettledTooSoon(bytes32 question_id) external view returns (bool);
9
+ function resultForOnceSettled(bytes32 question_id) external view returns (bytes32);
10
+ function reopened_questions(bytes32) external view returns (bytes32);
11
+ function reopener_questions(bytes32) external view returns (bool);
12
+ function reopenQuestion(
13
+ uint256 template_id,
14
+ string calldata question,
15
+ address arbitrator,
16
+ uint32 timeout,
17
+ uint32 opening_ts,
18
+ uint256 nonce,
19
+ uint256 min_bond,
20
+ bytes32 reopens_question_id
21
+ ) external payable returns (bytes32);
22
+ }
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: GPL-3.0-only
2
+
3
+ pragma solidity 0.8.20;
4
+
5
+ // These functions were removed from IRealityETH in version 4.
6
+ interface IRealityETHReopenable_ERC20 {
7
+ event LogReopenQuestion(bytes32 indexed question_id, bytes32 indexed reopened_question_id);
8
+ function isSettledTooSoon(bytes32 question_id) external view returns (bool);
9
+ function resultForOnceSettled(bytes32 question_id) external view returns (bytes32);
10
+ function reopened_questions(bytes32) external view returns (bytes32);
11
+ function reopener_questions(bytes32) external view returns (bool);
12
+ function reopenQuestionERC20(
13
+ uint256 template_id,
14
+ string calldata question,
15
+ address arbitrator,
16
+ uint32 timeout,
17
+ uint32 opening_ts,
18
+ uint256 nonce,
19
+ uint256 min_bond,
20
+ bytes32 reopens_question_id,
21
+ uint256 tokens
22
+ ) external returns (bytes32);
23
+ }
@@ -2,9 +2,13 @@
2
2
 
3
3
  pragma solidity 0.8.20;
4
4
 
5
+ // Features removed in v4
6
+ import {IERC20} from "./IERC20.sol";
7
+ import {IRealityETHCore_Common} from "./IRealityETHCore_Common.sol";
5
8
  import {IRealityETHCore_ERC20} from "./IRealityETHCore_ERC20.sol";
6
9
  import {IRealityETHCommitReveal_ERC20} from "./IRealityETHCommitReveal_ERC20.sol";
10
+ import {IRealityETHCreateTemplateAndAskQuestion} from "./IRealityETHCreateTemplateAndAskQuestion.sol";
7
11
 
8
12
  /* solhint-disable func-name-mixedcase */
9
13
 
10
- interface IRealityETH_ERC20 is IRealityETHCore_ERC20, IRealityETHCommitReveal_ERC20 {}
14
+ interface IRealityETH_ERC20 is IRealityETHCore_Common, IRealityETHCore_ERC20, IRealityETHCommitReveal_ERC20, IRealityETHCreateTemplateAndAskQuestion {}