@reality.eth/contracts 3.0.36 → 3.0.38
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/generated/contracts.json
CHANGED
|
@@ -327,6 +327,15 @@
|
|
|
327
327
|
"0x5AFa42b30955f137e10f89dfb5EF1542a186F90e": "Kleros"
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
+
},
|
|
331
|
+
"POLK": {
|
|
332
|
+
"RealityETH_ERC20-3.0": {
|
|
333
|
+
"address": "0x83d3f4769a19f1b43337888b0290f5473cf508b2",
|
|
334
|
+
"block": 42899867,
|
|
335
|
+
"token_address": "0x996F19d4b1cE6D5AD72CEaaa53152CEB1B187fD0",
|
|
336
|
+
"notes": null,
|
|
337
|
+
"arbitrators": {}
|
|
338
|
+
}
|
|
330
339
|
}
|
|
331
340
|
},
|
|
332
341
|
"280": {
|
package/generated/tokens.json
CHANGED
package/index.js
CHANGED
|
@@ -132,6 +132,7 @@ function realityETHConfig(chain_id, token, version) {
|
|
|
132
132
|
config.chain_id = chain_id;
|
|
133
133
|
config.contract_name = contract_name;
|
|
134
134
|
config.contract_version = contract_version;
|
|
135
|
+
config.token_ticker = token;
|
|
135
136
|
return config;
|
|
136
137
|
}
|
|
137
138
|
|
|
@@ -262,6 +263,7 @@ function configForAddress(addr, chain_id) {
|
|
|
262
263
|
config.chain_id = cid;
|
|
263
264
|
config.contract_name = contract_name;
|
|
264
265
|
config.contract_version = contract_version;
|
|
266
|
+
config.token_ticker = ticker;
|
|
265
267
|
return config;
|
|
266
268
|
}
|
|
267
269
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reality.eth/contracts",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.38",
|
|
4
4
|
"description": "Collection of smart contracts for the Realitio fact verification platform",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"generate-chains": "node scripts/generate_chains_json.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"url": "https://github.com/RealityETH/monorepo/issues"
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://reality.eth.link",
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "a47ec2ab40f9ff4a8cbc65894f50c21b2f7b7f51",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"ethers": "^5.6.8"
|
|
36
36
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
if (process.argv.length < 3) {
|
|
2
|
+
throw new Error("Usage: node add_chain_token.js <chain_id> <chain_name> [<token_ticker>] [<token_address_or_native>] [<small_amount_of_token>]");
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
const project_base = __dirname + '/../';
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
|
|
9
|
+
const chain_id = process.argv[2];
|
|
10
|
+
|
|
11
|
+
// These may be empty
|
|
12
|
+
const chain_name = process.argv[3];
|
|
13
|
+
const token_ticker = process.argv[4];
|
|
14
|
+
const token_address = process.argv[5];
|
|
15
|
+
const small_number = process.argv[6];
|
|
16
|
+
|
|
17
|
+
console.log('chain id is', chain_id);
|
|
18
|
+
|
|
19
|
+
const supported_file = 'chains/supported.json'
|
|
20
|
+
|
|
21
|
+
const chains_file = 'chains/chainid.network.json';
|
|
22
|
+
const chains_local_file = 'chains/chainid.network.local.json';
|
|
23
|
+
|
|
24
|
+
const chain_id_list = require(project_base + chains_file);
|
|
25
|
+
const chain_id_list_local = require(project_base + chains_local_file);
|
|
26
|
+
|
|
27
|
+
let supported_data = require(project_base + supported_file);
|
|
28
|
+
|
|
29
|
+
for(var cl = 0; cl<chain_id_list_local.length; cl++) {
|
|
30
|
+
chain_id_list.push(chain_id_list_local[cl]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let found = false;
|
|
34
|
+
for(var cl = 0; cl<chain_id_list.length; cl++) {
|
|
35
|
+
if (chain_id == chain_id_list[cl].chainId) {
|
|
36
|
+
found = true;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!found) {
|
|
42
|
+
throw new Error("The chain ID "+chain_id+" was not found in the chainid list. Run node fetch_and_reformat_chains_json.js to update the list, or add your settings to chainid.network.local.json.");
|
|
43
|
+
}
|
|
44
|
+
if (""+chain_id in supported_data) {
|
|
45
|
+
console.log('Using existing config for chain '+chain_id);
|
|
46
|
+
console.log(supported_data[""+chain_id]);
|
|
47
|
+
} else {
|
|
48
|
+
console.log('Creating new supported entry for chain '+chain_id);
|
|
49
|
+
supported_data[""+chain_id] = {"network_name": chain_name};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const out = JSON.stringify(supported_data, null, 4);
|
|
53
|
+
fs.writeFileSync(project_base+supported_file, out);
|
|
54
|
+
|
|
55
|
+
if (token_ticker != '') {
|
|
56
|
+
|
|
57
|
+
let token_config = {};
|
|
58
|
+
const token_file = project_base + 'tokens/' + token_ticker + '.json';
|
|
59
|
+
try {
|
|
60
|
+
token_config = JSON.parse(fs.readFileSync(token_file));
|
|
61
|
+
console.log(token_config);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
token_config = {
|
|
64
|
+
"decimals": 18,
|
|
65
|
+
"small_number": small_number ? small_number : 10000000000000000
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (token_address == 'native') {
|
|
69
|
+
token_config['native_chains'] = 'native_chains' in token_config ? token_config['native_chains'] : {};
|
|
70
|
+
token_config['native_chains'][""+chain_id] = true;
|
|
71
|
+
} else {
|
|
72
|
+
token_config['erc20_chains'] = 'erc20_chains' in token_config ? token_config['erc20_chains'] : {};
|
|
73
|
+
token_config['erc20_chains'][""+chain_id] = token_address;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
console.log(token_config);
|
|
77
|
+
|
|
78
|
+
const out2 = JSON.stringify(token_config, null, 4);
|
|
79
|
+
fs.writeFileSync(token_file, out2);
|
|
80
|
+
|
|
81
|
+
}
|