@reality.eth/contracts 3.0.46 → 3.0.48
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.
- package/.prettierrc +16 -0
- package/abi/solc-0.8.20/RealityETH-4.0.abi.json +1 -0
- package/abi/solc-0.8.20/RealityETH_ERC20-4.0.abi.json +1 -0
- package/bytecode/Arbitrator.bin +1 -1
- package/bytecode/RealityETH-3.0.bin +1 -1
- package/bytecode/RealityETH-4.0.bin +1 -0
- package/bytecode/RealityETH_ERC20-3.0.bin +1 -1
- package/bytecode/RealityETH_ERC20-4.0.bin +1 -0
- package/chains/chainid.network.json +5033 -431
- package/chains/deployments/300/ETH/RealityETH-3.0.json +7 -0
- package/chains/supported.json +3 -0
- package/development/contracts/.solhint.json +9 -0
- package/development/contracts/Arbitrator.sol +32 -56
- package/development/contracts/BalanceHolder.sol +4 -10
- package/development/contracts/BalanceHolder_ERC20.sol +5 -11
- package/development/contracts/CallbackClient.sol +3 -10
- package/development/contracts/ERC20Token.sol +29 -30
- package/development/contracts/ExplodingCallbackClient.sol +1 -4
- package/development/contracts/IArbitrator.sol +10 -7
- package/development/contracts/IArbitratorCore.sol +7 -14
- package/development/contracts/IArbitratorCrowdFundable.sol +3 -2
- package/development/contracts/IArbitratorErrors.sol +10 -0
- package/development/contracts/IArbitratorForeignProxy.sol +1 -1
- package/development/contracts/IArbitratorLegacy.sol +3 -3
- package/development/contracts/IArbitratorManagement.sol +15 -27
- package/development/contracts/IBalanceHolder.sol +3 -3
- package/development/contracts/IBalanceHolder_ERC20.sol +5 -5
- package/development/contracts/IERC20.sol +4 -5
- package/development/contracts/IOwned.sol +3 -3
- package/development/contracts/IRealityETH.sol +5 -58
- package/development/contracts/IRealityETHCommitReveal.sol +17 -0
- package/development/contracts/IRealityETHCommitReveal_ERC20.sol +16 -0
- package/development/contracts/IRealityETHCore.sol +135 -0
- package/development/contracts/IRealityETHCore_ERC20.sol +149 -0
- package/development/contracts/IRealityETHErrors.sol +86 -0
- package/development/contracts/IRealityETHErrors_ERC20.sol +13 -0
- package/development/contracts/IRealityETH_ERC20.sol +5 -62
- package/development/contracts/Owned.sol +4 -6
- package/development/contracts/{RealityETH-3.0.sol → RealityETH-4.0.sol} +221 -383
- package/development/contracts/{RealityETH_ERC20-3.0.sol → RealityETH_ERC20-4.0.sol} +238 -474
- package/development/contracts/RealityETH_ERC20_Factory.sol +47 -42
- package/development/contracts/RegisteredWalletArbitrator.sol +8 -15
- package/development/contracts/compile.py +3 -0
- package/development/scripts/string_to_error.py +111 -0
- package/development/version_checksums/check_matches_flat.sh +20 -0
- package/development/version_checksums/check_matches_last.sh +37 -0
- package/development/version_checksums/log_bytecode_history.sh +41 -0
- package/generated/chains.json +33 -5
- package/generated/contracts.json +10 -0
- package/generated/tokens.json +1 -0
- package/non_standard_deployments/zksync/LICENSE +21 -0
- package/non_standard_deployments/zksync/README.md +51 -0
- package/non_standard_deployments/zksync/deploy/deploy.ts +11 -0
- package/non_standard_deployments/zksync/deploy/utils.ts +168 -0
- package/non_standard_deployments/zksync/hardhat.config.ts +55 -0
- package/non_standard_deployments/zksync/package-lock.json +6295 -0
- package/non_standard_deployments/zksync/package.json +34 -0
- package/package.json +7 -3
- package/scripts/transfer_arbitrator.js +60 -0
- package/tests/python/requirements.txt +55 -54
- package/tests/python/test.py +150 -50
- package/tests/python/test_erc20.py +15 -14
- package/tokens/ETH.json +3 -2
- package/non_standard_deployments/zksync2/README +0 -21
- package/non_standard_deployments/zksync2/contracts/RealityETH_ERC20-3.0.sol +0 -1096
- package/non_standard_deployments/zksync2/deploy/deploy.ts +0 -62
- package/non_standard_deployments/zksync2/deploy/deploy_erc20.ts +0 -56
- package/non_standard_deployments/zksync2/deploy/deploy_mainnet.ts +0 -46
- package/non_standard_deployments/zksync2/hardhat.config.ts +0 -27
- package/non_standard_deployments/zksync2/package.json +0 -15
- package/non_standard_deployments/zksync2/yarn.lock +0 -2898
- /package/non_standard_deployments/{zksync2 → zksync}/contracts/RealityETH-3.0.sol +0 -0
package/chains/supported.json
CHANGED
|
@@ -72,6 +72,9 @@
|
|
|
72
72
|
"explorerURL": "https://zksync2-testnet.zkscan.io",
|
|
73
73
|
"network_name": "zkSync2-testnet"
|
|
74
74
|
},
|
|
75
|
+
"300": {
|
|
76
|
+
"network_name": "zksync-era-sepolia"
|
|
77
|
+
},
|
|
75
78
|
"324": {
|
|
76
79
|
"explorerURL": "https://explorer.zksync.io/",
|
|
77
80
|
"graphURL": "https://api.thegraph.com/subgraphs/name/realityeth/realityeth-zksync-era",
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity ^0.8.
|
|
3
|
+
pragma solidity ^0.8.20;
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import {IArbitrator} from "./IArbitrator.sol";
|
|
6
|
+
import {IRealityETH} from "./IRealityETH.sol";
|
|
7
|
+
import {IERC20} from "./IERC20.sol";
|
|
8
|
+
import {Owned} from "./Owned.sol";
|
|
9
9
|
|
|
10
10
|
contract Arbitrator is Owned, IArbitrator {
|
|
11
|
-
|
|
12
11
|
IRealityETH public realitio;
|
|
13
12
|
|
|
14
13
|
mapping(bytes32 => uint256) public arbitration_bounties;
|
|
@@ -24,25 +23,20 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
/// @notice Returns the Realitio contract address - deprecated in favour of realitio()
|
|
27
|
-
function realitycheck()
|
|
28
|
-
external view returns(IRealityETH) {
|
|
26
|
+
function realitycheck() external view returns (IRealityETH) {
|
|
29
27
|
return realitio;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
/// @notice Set the Reality Check contract address
|
|
33
31
|
/// @param addr The address of the Reality Check contract
|
|
34
|
-
function setRealitio(address addr)
|
|
35
|
-
onlyOwner
|
|
36
|
-
public {
|
|
32
|
+
function setRealitio(address addr) public onlyOwner {
|
|
37
33
|
realitio = IRealityETH(addr);
|
|
38
34
|
emit LogSetRealitio(addr);
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
/// @notice Set the default fee
|
|
42
38
|
/// @param fee The default fee amount
|
|
43
|
-
function setDisputeFee(uint256 fee)
|
|
44
|
-
onlyOwner
|
|
45
|
-
public {
|
|
39
|
+
function setDisputeFee(uint256 fee) public onlyOwner {
|
|
46
40
|
dispute_fee = fee;
|
|
47
41
|
emit LogSetDisputeFee(fee);
|
|
48
42
|
}
|
|
@@ -50,9 +44,7 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
50
44
|
/// @notice Set a custom fee for this particular question
|
|
51
45
|
/// @param question_id The question in question
|
|
52
46
|
/// @param fee The fee amount
|
|
53
|
-
function setCustomDisputeFee(bytes32 question_id, uint256 fee)
|
|
54
|
-
onlyOwner
|
|
55
|
-
public {
|
|
47
|
+
function setCustomDisputeFee(bytes32 question_id, uint256 fee) public onlyOwner {
|
|
56
48
|
custom_dispute_fees[question_id] = fee;
|
|
57
49
|
emit LogSetCustomDisputeFee(question_id, fee);
|
|
58
50
|
}
|
|
@@ -60,8 +52,7 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
60
52
|
/// @notice Return the dispute fee for the specified question. 0 indicates that we won't arbitrate it.
|
|
61
53
|
/// @param question_id The question in question
|
|
62
54
|
/// @dev Uses a general default, but can be over-ridden on a question-by-question basis.
|
|
63
|
-
function getDisputeFee(bytes32 question_id)
|
|
64
|
-
public view returns (uint256) {
|
|
55
|
+
function getDisputeFee(bytes32 question_id) public view returns (uint256) {
|
|
65
56
|
return (custom_dispute_fees[question_id] > 0) ? custom_dispute_fees[question_id] : dispute_fee;
|
|
66
57
|
}
|
|
67
58
|
|
|
@@ -71,9 +62,7 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
71
62
|
/// You could set an impossibly high fee if you want to prevent us being used as arbitrator unless we submit the question.
|
|
72
63
|
/// (Submitting the question ourselves is not implemented here.)
|
|
73
64
|
/// This fee can be used as a revenue source, an anti-spam measure, or both.
|
|
74
|
-
function setQuestionFee(uint256 fee)
|
|
75
|
-
onlyOwner
|
|
76
|
-
public {
|
|
65
|
+
function setQuestionFee(uint256 fee) public onlyOwner {
|
|
77
66
|
realitio.setQuestionFee(fee);
|
|
78
67
|
emit LogSetQuestionFee(fee);
|
|
79
68
|
}
|
|
@@ -82,9 +71,7 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
82
71
|
/// @param question_id The question in question
|
|
83
72
|
/// @param answer The answer
|
|
84
73
|
/// @param answerer The answerer. If arbitration changed the answer, it should be the payer. If not, the old answerer.
|
|
85
|
-
function submitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address answerer)
|
|
86
|
-
onlyOwner
|
|
87
|
-
public {
|
|
74
|
+
function submitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address answerer) public onlyOwner {
|
|
88
75
|
delete arbitration_bounties[question_id];
|
|
89
76
|
realitio.submitAnswerByArbitrator(question_id, answer, answerer);
|
|
90
77
|
}
|
|
@@ -96,9 +83,14 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
96
83
|
/// @param last_history_hash The history hash before the final one
|
|
97
84
|
/// @param last_answer_or_commitment_id The last answer given, or the commitment ID if it was a commitment.
|
|
98
85
|
/// @param last_answerer The address that supplied the last answer
|
|
99
|
-
function assignWinnerAndSubmitAnswerByArbitrator(
|
|
100
|
-
|
|
101
|
-
|
|
86
|
+
function assignWinnerAndSubmitAnswerByArbitrator(
|
|
87
|
+
bytes32 question_id,
|
|
88
|
+
bytes32 answer,
|
|
89
|
+
address payee_if_wrong,
|
|
90
|
+
bytes32 last_history_hash,
|
|
91
|
+
bytes32 last_answer_or_commitment_id,
|
|
92
|
+
address last_answerer
|
|
93
|
+
) public onlyOwner {
|
|
102
94
|
delete arbitration_bounties[question_id];
|
|
103
95
|
realitio.assignWinnerAndSubmitAnswerByArbitrator(question_id, answer, payee_if_wrong, last_history_hash, last_answer_or_commitment_id, last_answerer);
|
|
104
96
|
}
|
|
@@ -106,9 +98,7 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
106
98
|
/// @notice Cancel a previous arbitration request
|
|
107
99
|
/// @dev This is intended for situations where the arbitration is happening non-atomically and the fee or something change.
|
|
108
100
|
/// @param question_id The question in question
|
|
109
|
-
function cancelArbitration(bytes32 question_id)
|
|
110
|
-
onlyOwner
|
|
111
|
-
public {
|
|
101
|
+
function cancelArbitration(bytes32 question_id) public onlyOwner {
|
|
112
102
|
realitio.cancelArbitration(question_id);
|
|
113
103
|
}
|
|
114
104
|
|
|
@@ -117,11 +107,9 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
117
107
|
/// Will trigger an error if the notification fails, eg because the question has already been finalized
|
|
118
108
|
/// @param question_id The question in question
|
|
119
109
|
/// @param max_previous If specified, reverts if a bond higher than this was submitted after you sent your transaction.
|
|
120
|
-
function requestArbitration(bytes32 question_id, uint256 max_previous)
|
|
121
|
-
external payable returns (bool) {
|
|
122
|
-
|
|
110
|
+
function requestArbitration(bytes32 question_id, uint256 max_previous) external payable returns (bool) {
|
|
123
111
|
uint256 arbitration_fee = getDisputeFee(question_id);
|
|
124
|
-
|
|
112
|
+
if (arbitration_fee == 0) revert TheArbitratorMustHaveSetANonZeroFeeForTheQuestion();
|
|
125
113
|
|
|
126
114
|
arbitration_bounties[question_id] += msg.value;
|
|
127
115
|
uint256 paid = arbitration_bounties[question_id];
|
|
@@ -131,50 +119,38 @@ contract Arbitrator is Owned, IArbitrator {
|
|
|
131
119
|
emit LogRequestArbitration(question_id, msg.value, msg.sender, 0);
|
|
132
120
|
return true;
|
|
133
121
|
} else {
|
|
134
|
-
|
|
122
|
+
if (realitio.isFinalized(question_id)) revert TheQuestionMustNotHaveBeenFinalized();
|
|
135
123
|
emit LogRequestArbitration(question_id, msg.value, msg.sender, arbitration_fee - paid);
|
|
136
124
|
return false;
|
|
137
125
|
}
|
|
138
|
-
|
|
139
126
|
}
|
|
140
127
|
|
|
141
128
|
/// @notice Withdraw any accumulated ETH fees to the specified address
|
|
142
129
|
/// @param addr The address to which the balance should be sent
|
|
143
|
-
function withdraw(address addr)
|
|
144
|
-
|
|
145
|
-
public {
|
|
146
|
-
payable(addr).transfer(address(this).balance);
|
|
130
|
+
function withdraw(address addr) public onlyOwner {
|
|
131
|
+
payable(addr).transfer(address(this).balance);
|
|
147
132
|
}
|
|
148
133
|
|
|
149
134
|
/// @notice Withdraw any accumulated token fees to the specified address
|
|
150
135
|
/// @param addr The address to which the balance should be sent
|
|
151
136
|
/// @dev Only needed if the Realitio contract used is using an ERC20 token
|
|
152
137
|
/// @dev Also only normally useful if a per-question fee is set, otherwise we only have ETH.
|
|
153
|
-
function withdrawERC20(IERC20 _token, address addr)
|
|
154
|
-
onlyOwner
|
|
155
|
-
public {
|
|
138
|
+
function withdrawERC20(IERC20 _token, address addr) public onlyOwner {
|
|
156
139
|
uint256 bal = _token.balanceOf(address(this));
|
|
157
|
-
IERC20(_token).transfer(addr, bal);
|
|
140
|
+
IERC20(_token).transfer(addr, bal);
|
|
158
141
|
}
|
|
159
142
|
|
|
160
|
-
receive()
|
|
161
|
-
external payable {
|
|
162
|
-
}
|
|
143
|
+
receive() external payable {}
|
|
163
144
|
|
|
164
145
|
/// @notice Withdraw any accumulated question fees from the specified address into this contract
|
|
165
146
|
/// @dev Funds can then be liberated from this contract with our withdraw() function
|
|
166
147
|
/// @dev This works in the same way whether the realitio contract is using ETH or an ERC20 token
|
|
167
|
-
function callWithdraw()
|
|
168
|
-
|
|
169
|
-
public {
|
|
170
|
-
realitio.withdraw();
|
|
148
|
+
function callWithdraw() public onlyOwner {
|
|
149
|
+
realitio.withdraw();
|
|
171
150
|
}
|
|
172
151
|
|
|
173
152
|
/// @notice Set a metadata string, expected to be JSON, containing things like arbitrator TOS address
|
|
174
|
-
function setMetaData(string memory _metadata)
|
|
175
|
-
onlyOwner
|
|
176
|
-
external {
|
|
153
|
+
function setMetaData(string memory _metadata) external onlyOwner {
|
|
177
154
|
metadata = _metadata;
|
|
178
155
|
}
|
|
179
|
-
|
|
180
156
|
}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity ^0.8.
|
|
3
|
+
pragma solidity ^0.8.20;
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import {IBalanceHolder} from "./IBalanceHolder.sol";
|
|
6
6
|
|
|
7
7
|
contract BalanceHolder is IBalanceHolder {
|
|
8
|
-
|
|
9
8
|
mapping(address => uint256) public balanceOf;
|
|
10
9
|
|
|
11
|
-
event LogWithdraw(
|
|
12
|
-
address indexed user,
|
|
13
|
-
uint256 amount
|
|
14
|
-
);
|
|
10
|
+
event LogWithdraw(address indexed user, uint256 amount);
|
|
15
11
|
|
|
16
|
-
function withdraw()
|
|
17
|
-
public {
|
|
12
|
+
function withdraw() public {
|
|
18
13
|
uint256 bal = balanceOf[msg.sender];
|
|
19
14
|
balanceOf[msg.sender] = 0;
|
|
20
15
|
payable(msg.sender).transfer(bal);
|
|
21
16
|
emit LogWithdraw(msg.sender, bal);
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity ^0.8.
|
|
3
|
+
pragma solidity ^0.8.20;
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import {IERC20} from "./IERC20.sol";
|
|
6
|
+
import {IBalanceHolder_ERC20} from "./IBalanceHolder_ERC20.sol";
|
|
7
7
|
|
|
8
8
|
contract BalanceHolder_ERC20 is IBalanceHolder_ERC20 {
|
|
9
|
-
|
|
10
9
|
IERC20 public token;
|
|
11
10
|
|
|
12
11
|
mapping(address => uint256) public balanceOf;
|
|
13
12
|
|
|
14
|
-
event LogWithdraw(
|
|
15
|
-
address indexed user,
|
|
16
|
-
uint256 amount
|
|
17
|
-
);
|
|
13
|
+
event LogWithdraw(address indexed user, uint256 amount);
|
|
18
14
|
|
|
19
|
-
function withdraw()
|
|
20
|
-
public {
|
|
15
|
+
function withdraw() public {
|
|
21
16
|
uint256 bal = balanceOf[msg.sender];
|
|
22
17
|
balanceOf[msg.sender] = 0;
|
|
23
18
|
require(token.transfer(msg.sender, bal));
|
|
24
19
|
emit LogWithdraw(msg.sender, bal);
|
|
25
20
|
}
|
|
26
|
-
|
|
27
21
|
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
pragma solidity ^0.4.25;
|
|
2
2
|
|
|
3
3
|
contract CallbackClient {
|
|
4
|
+
mapping(bytes32 => bytes32) public answers;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
event LogCallback(bytes32 question_id, bytes32 question_answer, address sender);
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
bytes32 question_id,
|
|
9
|
-
bytes32 question_answer,
|
|
10
|
-
address sender
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
function __realitycheck_callback(bytes32 question_id, bytes32 question_answer)
|
|
14
|
-
public {
|
|
8
|
+
function __realitycheck_callback(bytes32 question_id, bytes32 question_answer) public {
|
|
15
9
|
answers[question_id] = question_answer;
|
|
16
10
|
emit LogCallback(question_id, question_answer, msg.sender);
|
|
17
11
|
}
|
|
18
|
-
|
|
19
12
|
}
|
|
@@ -6,8 +6,8 @@ pragma solidity ^0.4.25;
|
|
|
6
6
|
*/
|
|
7
7
|
library SafeMath {
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* @dev Multiplies two numbers, reverts on overflow.
|
|
10
|
+
*/
|
|
11
11
|
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
12
12
|
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
|
|
13
13
|
// benefit is lost if 'b' is also tested.
|
|
@@ -23,8 +23,8 @@ library SafeMath {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
|
|
27
|
+
*/
|
|
28
28
|
function div(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
29
29
|
// Solidity only automatically asserts when dividing by 0
|
|
30
30
|
require(b > 0);
|
|
@@ -35,8 +35,8 @@ library SafeMath {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
|
|
39
|
+
*/
|
|
40
40
|
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
41
41
|
require(b <= a);
|
|
42
42
|
uint256 c = a - b;
|
|
@@ -45,8 +45,8 @@ library SafeMath {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
* @dev Adds two numbers, reverts on overflow.
|
|
49
|
+
*/
|
|
50
50
|
function add(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
51
51
|
uint256 c = a + b;
|
|
52
52
|
require(c >= a);
|
|
@@ -55,9 +55,9 @@ library SafeMath {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
|
|
59
|
+
* reverts when dividing by zero.
|
|
60
|
+
*/
|
|
61
61
|
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
62
62
|
require(b != 0);
|
|
63
63
|
return a % b;
|
|
@@ -96,29 +96,28 @@ interface IERC20 {
|
|
|
96
96
|
contract ERC20 is IERC20 {
|
|
97
97
|
using SafeMath for uint256;
|
|
98
98
|
|
|
99
|
-
mapping
|
|
99
|
+
mapping(address => uint256) private _balances;
|
|
100
100
|
|
|
101
|
-
mapping
|
|
101
|
+
mapping(address => mapping(address => uint256)) private _allowed;
|
|
102
102
|
|
|
103
103
|
uint256 private _totalSupply;
|
|
104
104
|
|
|
105
|
-
function mint(address to, uint256 val)
|
|
106
|
-
public {
|
|
105
|
+
function mint(address to, uint256 val) public {
|
|
107
106
|
_mint(to, val);
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
* @dev Total number of tokens in existence
|
|
111
|
+
*/
|
|
113
112
|
function totalSupply() public view returns (uint256) {
|
|
114
113
|
return _totalSupply;
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
* @dev Gets the balance of the specified address.
|
|
118
|
+
* @param owner The address to query the balance of.
|
|
119
|
+
* @return An uint256 representing the amount owned by the passed address.
|
|
120
|
+
*/
|
|
122
121
|
function balanceOf(address owner) public view returns (uint256) {
|
|
123
122
|
return _balances[owner];
|
|
124
123
|
}
|
|
@@ -134,10 +133,10 @@ contract ERC20 is IERC20 {
|
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
* @dev Transfer token for a specified address
|
|
137
|
+
* @param to The address to transfer to.
|
|
138
|
+
* @param value The amount to be transferred.
|
|
139
|
+
*/
|
|
141
140
|
function transfer(address to, uint256 value) public returns (bool) {
|
|
142
141
|
_transfer(msg.sender, to, value);
|
|
143
142
|
return true;
|
|
@@ -207,11 +206,11 @@ contract ERC20 is IERC20 {
|
|
|
207
206
|
}
|
|
208
207
|
|
|
209
208
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
* @dev Transfer token for a specified addresses
|
|
210
|
+
* @param from The address to transfer from.
|
|
211
|
+
* @param to The address to transfer to.
|
|
212
|
+
* @param value The amount to be transferred.
|
|
213
|
+
*/
|
|
215
214
|
function _transfer(address from, address to, uint256 value) internal {
|
|
216
215
|
require(to != address(0));
|
|
217
216
|
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
pragma solidity ^0.4.25;
|
|
2
2
|
|
|
3
3
|
contract ExplodingCallbackClient {
|
|
4
|
-
|
|
5
4
|
// Just write some state to avoid warnings that this could be pure
|
|
6
5
|
bool impurity;
|
|
7
6
|
|
|
8
|
-
function __realitycheck_callback(bytes32 question_id, bytes32 question_answer)
|
|
9
|
-
public {
|
|
7
|
+
function __realitycheck_callback(bytes32 question_id, bytes32 question_answer) public {
|
|
10
8
|
question_id == 0x0;
|
|
11
9
|
question_answer = 0x0;
|
|
12
10
|
impurity = true;
|
|
13
11
|
revert();
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity 0.8.
|
|
3
|
+
pragma solidity 0.8.20;
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
This interface describes the Arbitrator contract originally deployed and managed by the reality.eth team. See below for the various parts it comprises.
|
|
7
7
|
For the minimal interface that will be able to interact with the reality.eth UI as an arbitrator, use IArbitratorCore.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import {IArbitratorCore} from "./IArbitratorCore.sol";
|
|
11
11
|
|
|
12
12
|
// This provides management functionality to handle ownership, set fees etc.
|
|
13
|
-
import
|
|
13
|
+
import {IArbitratorManagement} from "./IArbitratorManagement.sol";
|
|
14
14
|
|
|
15
15
|
// This provides the old function realitycheck(), replaced by realitio().
|
|
16
|
-
import
|
|
16
|
+
import {IArbitratorLegacy} from "./IArbitratorLegacy.sol";
|
|
17
17
|
|
|
18
18
|
// This provides a function for querying the status of crowd-funded arbitration.
|
|
19
|
-
import
|
|
19
|
+
import {IArbitratorCrowdFundable} from "./IArbitratorCrowdFundable.sol";
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
}
|
|
21
|
+
// Errors (from v4)
|
|
22
|
+
import {IArbitratorErrors} from "./IArbitratorErrors.sol";
|
|
23
|
+
|
|
24
|
+
/* solhint-disable no-empty-blocks */
|
|
25
|
+
interface IArbitrator is IArbitratorCore, IArbitratorLegacy, IArbitratorManagement, IArbitratorCrowdFundable, IArbitratorErrors {}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity 0.8.
|
|
3
|
+
pragma solidity 0.8.20;
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import {IRealityETH} from "./IRealityETH.sol";
|
|
6
6
|
|
|
7
7
|
interface IArbitratorCore {
|
|
8
|
+
event LogRequestArbitration(bytes32 indexed question_id, uint256 fee_paid, address requester, uint256 remaining);
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
uint256 remaining
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
function getDisputeFee ( bytes32 question_id ) external view returns ( uint256 );
|
|
17
|
-
function metadata ( ) external view returns ( string memory );
|
|
18
|
-
function realitio ( ) external view returns ( IRealityETH );
|
|
19
|
-
function requestArbitration ( bytes32 question_id, uint256 max_previous ) external payable returns ( bool );
|
|
20
|
-
|
|
10
|
+
function getDisputeFee(bytes32 question_id) external view returns (uint256);
|
|
11
|
+
function metadata() external view returns (string memory);
|
|
12
|
+
function realitio() external view returns (IRealityETH);
|
|
13
|
+
function requestArbitration(bytes32 question_id, uint256 max_previous) external payable returns (bool);
|
|
21
14
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity 0.8.
|
|
3
|
+
pragma solidity 0.8.20;
|
|
4
4
|
|
|
5
5
|
interface IArbitratorCrowdFundable {
|
|
6
|
-
|
|
6
|
+
/* solhint-disable func-name-mixedcase */
|
|
7
|
+
function arbitration_bounties(bytes32) external view returns (uint256);
|
|
7
8
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
|
+
|
|
3
|
+
pragma solidity 0.8.20;
|
|
4
|
+
|
|
5
|
+
interface IArbitratorErrors {
|
|
6
|
+
/// @notice The arbitrator must have set a non-zero fee for the question
|
|
7
|
+
error TheArbitratorMustHaveSetANonZeroFeeForTheQuestion();
|
|
8
|
+
/// @notice The question must not have been finalized
|
|
9
|
+
error TheQuestionMustNotHaveBeenFinalized();
|
|
10
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity 0.8.
|
|
3
|
+
pragma solidity 0.8.20;
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import {IRealityETH} from "./IRealityETH.sol";
|
|
6
6
|
|
|
7
7
|
interface IArbitratorLegacy {
|
|
8
|
-
function realitycheck
|
|
8
|
+
function realitycheck() external view returns (IRealityETH);
|
|
9
9
|
}
|
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity 0.8.
|
|
3
|
+
pragma solidity 0.8.20;
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import './IOwned.sol';
|
|
5
|
+
import {IERC20} from "./IERC20.sol";
|
|
7
6
|
|
|
8
7
|
interface IArbitratorManagement {
|
|
8
|
+
event LogSetRealitio(address realitio);
|
|
9
9
|
|
|
10
|
-
event
|
|
11
|
-
address realitio
|
|
12
|
-
);
|
|
10
|
+
event LogSetQuestionFee(uint256 fee);
|
|
13
11
|
|
|
14
|
-
event
|
|
15
|
-
uint256 fee
|
|
16
|
-
);
|
|
12
|
+
event LogSetDisputeFee(uint256 fee);
|
|
17
13
|
|
|
18
|
-
event
|
|
19
|
-
uint256 fee
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
event LogSetCustomDisputeFee(
|
|
23
|
-
bytes32 indexed question_id,
|
|
24
|
-
uint256 fee
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
function setRealitio ( address addr ) external;
|
|
28
|
-
function setDisputeFee ( uint256 fee ) external;
|
|
29
|
-
function setCustomDisputeFee ( bytes32 question_id, uint256 fee ) external;
|
|
30
|
-
function setQuestionFee ( uint256 fee ) external;
|
|
31
|
-
function submitAnswerByArbitrator ( bytes32 question_id, bytes32 answer, address answerer ) external;
|
|
32
|
-
function withdraw ( address addr ) external;
|
|
33
|
-
function withdrawERC20 ( IERC20 _token, address addr ) external;
|
|
34
|
-
function callWithdraw ( ) external;
|
|
35
|
-
function setMetaData ( string memory _metadata ) external;
|
|
14
|
+
event LogSetCustomDisputeFee(bytes32 indexed question_id, uint256 fee);
|
|
36
15
|
|
|
16
|
+
function setRealitio(address addr) external;
|
|
17
|
+
function setDisputeFee(uint256 fee) external;
|
|
18
|
+
function setCustomDisputeFee(bytes32 question_id, uint256 fee) external;
|
|
19
|
+
function setQuestionFee(uint256 fee) external;
|
|
20
|
+
function submitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address answerer) external;
|
|
21
|
+
function withdraw(address addr) external;
|
|
22
|
+
function withdrawERC20(IERC20 _token, address addr) external;
|
|
23
|
+
function callWithdraw() external;
|
|
24
|
+
function setMetaData(string memory _metadata) external;
|
|
37
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity 0.8.
|
|
3
|
+
pragma solidity 0.8.20;
|
|
4
4
|
|
|
5
5
|
interface IBalanceHolder {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
function withdraw() external;
|
|
7
|
+
function balanceOf(address) external view returns (uint256);
|
|
8
8
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity 0.8.
|
|
3
|
+
pragma solidity 0.8.20;
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import "./IERC20.sol";
|
|
6
6
|
|
|
7
7
|
interface IBalanceHolder_ERC20 {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
function withdraw() external;
|
|
9
|
+
function balanceOf(address) external view returns (uint256);
|
|
10
|
+
function token() external view returns (IERC20);
|
|
11
11
|
}
|