@reality.eth/contracts 3.0.2 → 3.0.3

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 (53) hide show
  1. package/chains/chainid.network.json +2708 -174
  2. package/chains/deployments/1/ETH/RealityETH-3.0.json +2 -1
  3. package/chains/deployments/1/SWISE/RealityETH_ERC20-3.0.json +7 -0
  4. package/chains/deployments/10/OETH/RealityETH-3.0.json +6 -0
  5. package/chains/deployments/100/GNO/RealityETH_ERC20-3.0.json +7 -0
  6. package/chains/deployments/100/SWISE/RealityETH_ERC20-3.0.json +7 -0
  7. package/chains/deployments/100/XDAI/RealityETH-3.0.json +3 -1
  8. package/chains/deployments/1337702/ETH/RealityETH-3.0.json +6 -0
  9. package/chains/deployments/4/ETH/RealityETH-3.0.json +3 -1
  10. package/chains/deployments/42/ETH/RealityETH-3.0.json +2 -1
  11. package/chains/deployments/56/DEXE/RealityETH_ERC20-3.0.json +7 -0
  12. package/chains/deployments/69/OETH/RealityETH-3.0.json +6 -0
  13. package/chains/deployments/77/XDAI/RealityETH-2.1-rc1.json +1 -3
  14. package/chains/deployments/777/CTH/RealityETH-3.0.json +6 -0
  15. package/chains/supported.json +16 -0
  16. package/development/contracts/Arbitrator.sol +7 -6
  17. package/development/contracts/BalanceHolder.sol +4 -2
  18. package/development/contracts/{BalanceHolderERC20.sol → BalanceHolder_ERC20.sol} +3 -2
  19. package/development/contracts/IArbitrator.sol +4 -7
  20. package/development/contracts/IArbitratorForeignProxy.sol +12 -0
  21. package/development/contracts/IBalanceHolder.sol +3 -1
  22. package/development/contracts/IBalanceHolder_ERC20.sol +11 -0
  23. package/development/contracts/IERC20.sol +1 -1
  24. package/development/contracts/IOwned.sol +1 -1
  25. package/development/contracts/IRealityETH.sol +63 -0
  26. package/development/contracts/IRealityETH_ERC20.sol +67 -0
  27. package/development/contracts/Owned.sol +4 -2
  28. package/development/contracts/RealityETH-3.0.sol +4 -82
  29. package/development/contracts/RealityETH_ERC20-3.0.sol +3 -3
  30. package/generated/chains.json +81 -8
  31. package/generated/contracts.json +87 -7
  32. package/generated/tokens.json +34 -2
  33. package/index.js +7 -1
  34. package/package.json +3 -3
  35. package/scripts/deploy.js +14 -3
  36. package/scripts/fetch_and_reformat_chains_json.js +31 -0
  37. package/scripts/{format_abi.js → format_json.js} +0 -0
  38. package/scripts/generate_chains_json.js +3 -0
  39. package/tokens/CTH.json +7 -0
  40. package/tokens/DEXE.json +7 -0
  41. package/tokens/ETH.json +2 -1
  42. package/tokens/GNO.json +1 -0
  43. package/tokens/OETH.json +8 -0
  44. package/tokens/SWISE.json +8 -0
  45. package/development/contracts/IRealitio.sol +0 -44
  46. package/development/contracts/MultiSigWallet.sol +0 -391
  47. package/development/contracts/Realitio.sol +0 -756
  48. package/development/contracts/RealitioERC20.sol +0 -825
  49. package/development/contracts/RealitioSafeMath256.sol +0 -36
  50. package/development/contracts/RealitioSafeMath32.sol +0 -17
  51. package/development/contracts/Realitio_v2_1.sol +0 -819
  52. package/development/contracts/SplitterWallet.sol +0 -142
  53. package/tests/python/test_wallet.py +0 -185
@@ -1,391 +0,0 @@
1
- pragma solidity ^0.4.25;
2
-
3
-
4
- /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
5
- /// @author Stefan George - <stefan.george@consensys.net>
6
- contract MultiSigWallet {
7
-
8
- /*
9
- * Events
10
- */
11
- event Confirmation(address indexed sender, uint indexed transactionId);
12
- event Revocation(address indexed sender, uint indexed transactionId);
13
- event Submission(uint indexed transactionId);
14
- event Execution(uint indexed transactionId);
15
- event ExecutionFailure(uint indexed transactionId);
16
- event Deposit(address indexed sender, uint value);
17
- event OwnerAddition(address indexed owner);
18
- event OwnerRemoval(address indexed owner);
19
- event RequirementChange(uint required);
20
-
21
- /*
22
- * Constants
23
- */
24
- uint constant public MAX_OWNER_COUNT = 50;
25
-
26
- /*
27
- * Storage
28
- */
29
- mapping (uint => Transaction) public transactions;
30
- mapping (uint => mapping (address => bool)) public confirmations;
31
- mapping (address => bool) public isOwner;
32
- address[] public owners;
33
- uint public required;
34
- uint public transactionCount;
35
-
36
- struct Transaction {
37
- address destination;
38
- uint value;
39
- bytes data;
40
- bool executed;
41
- }
42
-
43
- /*
44
- * Modifiers
45
- */
46
- modifier onlyWallet() {
47
- require(msg.sender == address(this));
48
- _;
49
- }
50
-
51
- modifier ownerDoesNotExist(address owner) {
52
- require(!isOwner[owner]);
53
- _;
54
- }
55
-
56
- modifier ownerExists(address owner) {
57
- require(isOwner[owner]);
58
- _;
59
- }
60
-
61
- modifier transactionExists(uint transactionId) {
62
- require(transactions[transactionId].destination != 0);
63
- _;
64
- }
65
-
66
- modifier confirmed(uint transactionId, address owner) {
67
- require(confirmations[transactionId][owner]);
68
- _;
69
- }
70
-
71
- modifier notConfirmed(uint transactionId, address owner) {
72
- require(!confirmations[transactionId][owner]);
73
- _;
74
- }
75
-
76
- modifier notExecuted(uint transactionId) {
77
- require(!transactions[transactionId].executed);
78
- _;
79
- }
80
-
81
- modifier notNull(address _address) {
82
- require(_address != 0);
83
- _;
84
- }
85
-
86
- modifier validRequirement(uint ownerCount, uint _required) {
87
- require(ownerCount <= MAX_OWNER_COUNT
88
- && _required <= ownerCount
89
- && _required != 0
90
- && ownerCount != 0);
91
- _;
92
- }
93
-
94
- /// @dev Fallback function allows to deposit ether.
95
- function()
96
- public payable
97
- {
98
- if (msg.value > 0)
99
- emit Deposit(msg.sender, msg.value);
100
- }
101
-
102
- /*
103
- * Public functions
104
- */
105
- /// @dev Contract constructor sets initial owners and required number of confirmations.
106
- /// @param _owners List of initial owners.
107
- /// @param _required Number of required confirmations.
108
- constructor(address[] _owners, uint _required)
109
- public
110
- validRequirement(_owners.length, _required)
111
- {
112
- for (uint i=0; i<_owners.length; i++) {
113
- require(!isOwner[_owners[i]] && _owners[i] != 0);
114
- isOwner[_owners[i]] = true;
115
- }
116
- owners = _owners;
117
- required = _required;
118
- }
119
-
120
- /// @dev Allows to add a new owner. Transaction has to be sent by wallet.
121
- /// @param owner Address of new owner.
122
- function addOwner(address owner)
123
- public
124
- onlyWallet
125
- ownerDoesNotExist(owner)
126
- notNull(owner)
127
- validRequirement(owners.length + 1, required)
128
- {
129
- isOwner[owner] = true;
130
- owners.push(owner);
131
- emit OwnerAddition(owner);
132
- }
133
-
134
- /// @dev Allows to remove an owner. Transaction has to be sent by wallet.
135
- /// @param owner Address of owner.
136
- function removeOwner(address owner)
137
- public
138
- onlyWallet
139
- ownerExists(owner)
140
- {
141
- isOwner[owner] = false;
142
- for (uint i=0; i<owners.length - 1; i++)
143
- if (owners[i] == owner) {
144
- owners[i] = owners[owners.length - 1];
145
- break;
146
- }
147
- owners.length -= 1;
148
- if (required > owners.length)
149
- changeRequirement(owners.length);
150
- emit OwnerRemoval(owner);
151
- }
152
-
153
- /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
154
- /// @param owner Address of owner to be replaced.
155
- /// @param newOwner Address of new owner.
156
- function replaceOwner(address owner, address newOwner)
157
- public
158
- onlyWallet
159
- ownerExists(owner)
160
- ownerDoesNotExist(newOwner)
161
- {
162
- for (uint i=0; i<owners.length; i++)
163
- if (owners[i] == owner) {
164
- owners[i] = newOwner;
165
- break;
166
- }
167
- isOwner[owner] = false;
168
- isOwner[newOwner] = true;
169
- emit OwnerRemoval(owner);
170
- emit OwnerAddition(newOwner);
171
- }
172
-
173
- /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
174
- /// @param _required Number of required confirmations.
175
- function changeRequirement(uint _required)
176
- public
177
- onlyWallet
178
- validRequirement(owners.length, _required)
179
- {
180
- required = _required;
181
- emit RequirementChange(_required);
182
- }
183
-
184
- /// @dev Allows an owner to submit and confirm a transaction.
185
- /// @param destination Transaction target address.
186
- /// @param value Transaction ether value.
187
- /// @param data Transaction data payload.
188
- /// @return Returns transaction ID.
189
- function submitTransaction(address destination, uint value, bytes data)
190
- public
191
- returns (uint transactionId)
192
- {
193
- transactionId = addTransaction(destination, value, data);
194
- //confirmTransaction(transactionId);
195
- }
196
-
197
- /// @dev Allows an owner to confirm a transaction.
198
- /// @param transactionId Transaction ID.
199
- function confirmTransaction(uint transactionId)
200
- public
201
- ownerExists(msg.sender)
202
- transactionExists(transactionId)
203
- notConfirmed(transactionId, msg.sender)
204
- {
205
- confirmations[transactionId][msg.sender] = true;
206
- emit Confirmation(msg.sender, transactionId);
207
- executeTransaction(transactionId);
208
- }
209
-
210
- /// @dev Allows an owner to revoke a confirmation for a transaction.
211
- /// @param transactionId Transaction ID.
212
- function revokeConfirmation(uint transactionId)
213
- public
214
- ownerExists(msg.sender)
215
- confirmed(transactionId, msg.sender)
216
- notExecuted(transactionId)
217
- {
218
- confirmations[transactionId][msg.sender] = false;
219
- emit Revocation(msg.sender, transactionId);
220
- }
221
-
222
- /// @dev Allows anyone to execute a confirmed transaction.
223
- /// @param transactionId Transaction ID.
224
- function executeTransaction(uint transactionId)
225
- public
226
- ownerExists(msg.sender)
227
- confirmed(transactionId, msg.sender)
228
- notExecuted(transactionId)
229
- {
230
- if (isConfirmed(transactionId)) {
231
- Transaction storage txn = transactions[transactionId];
232
- txn.executed = true;
233
- if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
234
- emit Execution(transactionId);
235
- else {
236
- emit ExecutionFailure(transactionId);
237
- txn.executed = false;
238
- }
239
- }
240
- }
241
-
242
- // call has been separated into its own function in order to take advantage
243
- // of the Solidity's code generator to produce a loop that copies tx.data into memory.
244
- function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
245
- bool result;
246
- assembly {
247
- let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
248
- let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
249
- result := call(
250
- sub(gas, 34710), // 34710 is the value that solidity is currently emitting
251
- // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
252
- // callNewAccountGas (25000, in case the destination address does not exist and needs creating)
253
- destination,
254
- value,
255
- d,
256
- dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
257
- x,
258
- 0 // Output is ignored, therefore the output size is zero
259
- )
260
- }
261
- return result;
262
- }
263
-
264
- /// @dev Returns the confirmation status of a transaction.
265
- /// @param transactionId Transaction ID.
266
- /// @return Confirmation status.
267
- function isConfirmed(uint transactionId)
268
- public
269
- constant
270
- returns (bool)
271
- {
272
- uint count = 0;
273
- for (uint i=0; i<owners.length; i++) {
274
- if (confirmations[transactionId][owners[i]])
275
- count += 1;
276
- if (count == required)
277
- return true;
278
- }
279
- }
280
-
281
- /*
282
- * Internal functions
283
- */
284
- /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
285
- /// @param destination Transaction target address.
286
- /// @param value Transaction ether value.
287
- /// @param data Transaction data payload.
288
- /// @return Returns transaction ID.
289
- function addTransaction(address destination, uint value, bytes data)
290
- internal
291
- returns (uint transactionId)
292
- {
293
- transactionId = transactionCount;
294
- transactions[transactionId] = Transaction({
295
- destination: destination,
296
- value: value,
297
- data: data,
298
- executed: false
299
- });
300
- transactionCount += 1;
301
- emit Submission(transactionId);
302
- }
303
-
304
- /*
305
- * Web3 call functions
306
- */
307
- /// @dev Returns number of confirmations of a transaction.
308
- /// @param transactionId Transaction ID.
309
- /// @return Number of confirmations.
310
- function getConfirmationCount(uint transactionId)
311
- public
312
- constant
313
- returns (uint count)
314
- {
315
- for (uint i=0; i<owners.length; i++)
316
- if (confirmations[transactionId][owners[i]])
317
- count += 1;
318
- }
319
-
320
- /// @dev Returns total number of transactions after filers are applied.
321
- /// @param pending Include pending transactions.
322
- /// @param executed Include executed transactions.
323
- /// @return Total number of transactions after filters are applied.
324
- function getTransactionCount(bool pending, bool executed)
325
- public
326
- constant
327
- returns (uint count)
328
- {
329
- for (uint i=0; i<transactionCount; i++)
330
- if ( pending && !transactions[i].executed
331
- || executed && transactions[i].executed)
332
- count += 1;
333
- }
334
-
335
- /// @dev Returns list of owners.
336
- /// @return List of owner addresses.
337
- function getOwners()
338
- public
339
- constant
340
- returns (address[])
341
- {
342
- return owners;
343
- }
344
-
345
- /// @dev Returns array with owner addresses, which confirmed transaction.
346
- /// @param transactionId Transaction ID.
347
- /// @return Returns array of owner addresses.
348
- function getConfirmations(uint transactionId)
349
- public
350
- constant
351
- returns (address[] _confirmations)
352
- {
353
- address[] memory confirmationsTemp = new address[](owners.length);
354
- uint count = 0;
355
- uint i;
356
- for (i=0; i<owners.length; i++)
357
- if (confirmations[transactionId][owners[i]]) {
358
- confirmationsTemp[count] = owners[i];
359
- count += 1;
360
- }
361
- _confirmations = new address[](count);
362
- for (i=0; i<count; i++)
363
- _confirmations[i] = confirmationsTemp[i];
364
- }
365
-
366
- /// @dev Returns list of transaction IDs in defined range.
367
- /// @param from Index start position of transaction array.
368
- /// @param to Index end position of transaction array.
369
- /// @param pending Include pending transactions.
370
- /// @param executed Include executed transactions.
371
- /// @return Returns array of transaction IDs.
372
- function getTransactionIds(uint from, uint to, bool pending, bool executed)
373
- public
374
- constant
375
- returns (uint[] _transactionIds)
376
- {
377
- uint[] memory transactionIdsTemp = new uint[](transactionCount);
378
- uint count = 0;
379
- uint i;
380
- for (i=0; i<transactionCount; i++)
381
- if ( pending && !transactions[i].executed
382
- || executed && transactions[i].executed)
383
- {
384
- transactionIdsTemp[count] = i;
385
- count += 1;
386
- }
387
- _transactionIds = new uint[](to - from);
388
- for (i=from; i<to; i++)
389
- _transactionIds[i - from] = transactionIdsTemp[i];
390
- }
391
- }