@reality.eth/contracts 3.0.0 → 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.
- package/README.md +28 -6
- package/chains/chainid.network.json +2708 -174
- package/chains/deployments/1/ETH/RealityETH-3.0.json +4 -1
- package/chains/deployments/1/SWISE/RealityETH_ERC20-3.0.json +7 -0
- package/chains/deployments/10/OETH/RealityETH-3.0.json +6 -0
- package/chains/deployments/100/GNO/RealityETH_ERC20-3.0.json +7 -0
- package/chains/deployments/100/SWISE/RealityETH_ERC20-3.0.json +7 -0
- package/chains/deployments/100/XDAI/RealityETH-3.0.json +3 -1
- package/chains/deployments/1337702/ETH/RealityETH-3.0.json +6 -0
- package/chains/deployments/4/ETH/RealityETH-3.0.json +3 -1
- package/chains/deployments/42/ETH/RealityETH-3.0.json +4 -1
- package/chains/deployments/56/DEXE/RealityETH_ERC20-3.0.json +7 -0
- package/chains/deployments/69/OETH/RealityETH-3.0.json +6 -0
- package/chains/deployments/77/XDAI/RealityETH-2.1-rc1.json +1 -3
- package/chains/deployments/777/CTH/RealityETH-3.0.json +6 -0
- package/chains/supported.json +25 -4
- package/development/contracts/Arbitrator.sol +7 -6
- package/development/contracts/BalanceHolder.sol +4 -2
- package/development/contracts/{BalanceHolderERC20.sol → BalanceHolder_ERC20.sol} +3 -2
- package/development/contracts/IArbitrator.sol +4 -7
- package/development/contracts/IArbitratorForeignProxy.sol +12 -0
- package/development/contracts/IBalanceHolder.sol +3 -1
- package/development/contracts/IBalanceHolder_ERC20.sol +11 -0
- package/development/contracts/IERC20.sol +1 -1
- package/development/contracts/IOwned.sol +1 -1
- package/development/contracts/IRealityETH.sol +63 -0
- package/development/contracts/IRealityETH_ERC20.sol +67 -0
- package/development/contracts/Owned.sol +4 -2
- package/development/contracts/RealityETH-3.0.sol +4 -82
- package/development/contracts/RealityETH_ERC20-3.0.sol +3 -3
- package/example.js +66 -0
- package/generated/chains.json +103 -12
- package/generated/contracts.json +91 -7
- package/generated/tokens.json +34 -2
- package/index.js +9 -3
- package/meta/RealityETH-2.0.json +1 -0
- package/meta/RealityETH-2.1.json +1 -0
- package/meta/RealityETH-3.0.json +7 -0
- package/meta/RealityETH_ERC20-2.0.json +1 -0
- package/meta/RealityETH_ERC20-3.0.json +7 -0
- package/package.json +3 -3
- package/scripts/deploy.js +14 -3
- package/scripts/fetch_and_reformat_chains_json.js +31 -0
- package/scripts/{format_abi.js → format_json.js} +0 -0
- package/scripts/generate_chains_json.js +3 -0
- package/tokens/CTH.json +7 -0
- package/tokens/DEXE.json +7 -0
- package/tokens/ETH.json +2 -1
- package/tokens/GNO.json +1 -0
- package/tokens/OETH.json +8 -0
- package/tokens/SWISE.json +8 -0
- package/development/contracts/IRealitio.sol +0 -44
- package/development/contracts/MultiSigWallet.sol +0 -391
- package/development/contracts/Realitio.sol +0 -756
- package/development/contracts/RealitioERC20.sol +0 -825
- package/development/contracts/RealitioSafeMath256.sol +0 -36
- package/development/contracts/RealitioSafeMath32.sol +0 -17
- package/development/contracts/Realitio_v2_1.sol +0 -819
- package/development/contracts/SplitterWallet.sol +0 -142
- package/tests/python/test_wallet.py +0 -185
package/README.md
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
# @reality.eth/contracts
|
|
2
2
|
Contracts for Reality.eth, including source code, ABI and addresses of contracts on mainnet and test networks.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
## Using the contracts
|
|
5
|
+
|
|
6
|
+
### Quick example:
|
|
7
|
+
|
|
8
|
+
const realityeth_contracts = require('@reality.eth/contracts')
|
|
9
|
+
const chain_id = 4; // eg rinkeby
|
|
10
|
+
const provider = ...;
|
|
11
|
+
|
|
12
|
+
const config = realityeth_contracts.realityETHConfig(chain_id, 'ETH', '3.0')
|
|
13
|
+
const contract = realityeth_contracts.realityETHInstance(config);
|
|
14
|
+
const ethers_instance = new ethers.Contract(contract.address, contract.abi, provider);
|
|
15
|
+
|
|
16
|
+
This module also contains support for checking which tokens are available on the given chain, checking which features it has etc.
|
|
17
|
+
|
|
18
|
+
See [example.js](example.js) for more examples.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## File layout
|
|
5
22
|
|
|
6
23
|
*tokens/* contains a file describing each supported token.
|
|
7
24
|
|
|
8
25
|
*chains/* contains the full raw data from https://chainid.network/chains.json, and a file listing chains we specifically support, and adding useful configuration information not supplied by chainid.network.
|
|
9
26
|
|
|
10
|
-
|
|
27
|
+
*chains/deployments/* contains a directory hierarchy with a file for the deployed version of each live contract on the specified network for the specified token. Each file also lists any whitelisted arbitrators. It may also contain additional post-deployment files for arbitrators we deployed.
|
|
28
|
+
|
|
29
|
+
The above are combined into JSON files under *generated/* using `npm run-script generate`.
|
|
11
30
|
|
|
12
31
|
|
|
13
32
|
*development/contracts/* contains source files and build files for contracts from the original build, as laid out by truffle. These files are no longer supported as a way of managing contract addresses.
|
|
14
33
|
|
|
15
|
-
*config/templates* contains information about templates deployed by the constructor to save fetching them from the event logs.
|
|
34
|
+
*config/templates.json* contains information about templates deployed by the constructor to save fetching them from the event logs.
|
|
16
35
|
|
|
17
36
|
## Compilation
|
|
18
37
|
|
|
@@ -20,6 +39,7 @@ The above are combined into JSON files under generated/ using `npm run-script ge
|
|
|
20
39
|
|
|
21
40
|
`$ ./compile.py RealityETH-3.0
|
|
22
41
|
|
|
42
|
+
Bytecode and ABIs will be stored under *bytecode/* and *abi/* respectively.
|
|
23
43
|
|
|
24
44
|
## Tests
|
|
25
45
|
|
|
@@ -33,9 +53,11 @@ You can then test the version in question with, eg
|
|
|
33
53
|
|
|
34
54
|
`$ REALITYETH=RealityETH-3.0 python test.py`
|
|
35
55
|
|
|
56
|
+
These tests test the bytecode not the source code, so you need to compile before testing source code changes.
|
|
57
|
+
|
|
36
58
|
## Deployment
|
|
37
59
|
|
|
38
|
-
You will need the private key of an account with funds to deploy on the relevant network. It should be in hex, beginning "0x", in a file called `mainnet.sec` or `rinkeby.sec` or the equivalent for the network you will deploy to.
|
|
60
|
+
You will need the private key of an account with funds to deploy on the relevant network. It should be in hex, beginning "0x", in a file called `mainnet.sec` or `rinkeby.sec` or the equivalent for the network you will deploy to. A different key should be used for each network to avoid clashing contract addresses.
|
|
39
61
|
|
|
40
62
|
`$ mkdir packages/contracts/secrets`
|
|
41
63
|
|
|
@@ -45,9 +67,9 @@ To deploy contracts using the code compiled under contracts/bytecode, use
|
|
|
45
67
|
|
|
46
68
|
`$ cd packages/contracts/scripts`
|
|
47
69
|
|
|
48
|
-
`$ node deploy.js <
|
|
70
|
+
`$ node deploy.js <RealityETH|Arbitrator|ERC20> <network> <token_name> [<dispute_fee>] [<arbitrator_owner>]`
|
|
49
71
|
|
|
50
|
-
This will add contract addresses to the existing deployed contract .json definitions, and deploy per-token versions in the format expected by the
|
|
72
|
+
This will add contract addresses to the existing deployed contract .json definitions, and deploy per-token versions in the format expected by the `@reality.eth/dapp` ui.
|
|
51
73
|
|
|
52
74
|
If the token or network was not previously supported, you will need to add its configuration files and run `npm run-script generate`.
|
|
53
75
|
|