@reality.eth/contracts 3.0.79 → 3.0.80

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.
@@ -3,7 +3,8 @@
3
3
  "block": 13194676,
4
4
  "notes": null,
5
5
  "arbitrators": {
6
- "0x728cba71a3723caab33ea416cb46e2cc9215a596": "Kleros (General Court)",
7
- "0xf72cfd1b34a91a64f9a98537fe63fbab7530adca": "Kleros DAO Governance (Technical Court)"
6
+ "0xFf32eff53459485074b4Db14633252C9dcA3791A": "Kleros General Court",
7
+ "0xf72cfd1b34a91a64f9a98537fe63fbab7530adca": "Kleros DAO Governance (Technical Court)",
8
+ "0x728cba71a3723caab33ea416cb46e2cc9215a596": "Kleros (Old General Court, deprecated)"
8
9
  }
9
10
  }
@@ -17,8 +17,9 @@
17
17
  "block": 13194676,
18
18
  "notes": null,
19
19
  "arbitrators": {
20
- "0x728cba71a3723caab33ea416cb46e2cc9215a596": "Kleros (General Court)",
21
- "0xf72cfd1b34a91a64f9a98537fe63fbab7530adca": "Kleros DAO Governance (Technical Court)"
20
+ "0xFf32eff53459485074b4Db14633252C9dcA3791A": "Kleros General Court",
21
+ "0xf72cfd1b34a91a64f9a98537fe63fbab7530adca": "Kleros DAO Governance (Technical Court)",
22
+ "0x728cba71a3723caab33ea416cb46e2cc9215a596": "Kleros (Old General Court, deprecated)"
22
23
  }
23
24
  }
24
25
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reality.eth/contracts",
3
- "version": "3.0.79",
3
+ "version": "3.0.80",
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",
@@ -34,7 +34,7 @@
34
34
  "url": "https://github.com/RealityETH/monorepo/issues"
35
35
  },
36
36
  "homepage": "https://reality.eth.link",
37
- "gitHead": "1207db24b4b352ec046820a58b4705bba70f3458",
37
+ "gitHead": "4a690cfacbd1d55ccda7f5c26686853cc5c8cb0f",
38
38
  "dependencies": {
39
39
  "ethers": "^5.8.0"
40
40
  }
@@ -0,0 +1,95 @@
1
+ const fs = require('fs');
2
+ const ethers = require('ethers');
3
+ const project_base = './../';
4
+ const rc = require('../index.js');
5
+ const { join } = require('path');
6
+ const chain_configs = require('./../generated/chains.json');
7
+
8
+ let secrets_dir = join(__dirname, '../secrets');
9
+ if (process.env.SECRETS) {
10
+ secrets_dir = process.env.SECRETS;
11
+ }
12
+
13
+ const deployed_at = null;
14
+
15
+ var undef;
16
+
17
+ console.log(process.argv);
18
+ if (process.argv.length > 6 || process.argv.length < 6) {
19
+ usage_error();
20
+ }
21
+
22
+ const version = process.argv[2]
23
+ const chain = process.argv[3]
24
+ const token = process.argv[4]
25
+ const template_files = process.argv[5].split(',');
26
+
27
+ function usage_error(msg) {
28
+ msg = msg + "\n";
29
+ msg += "Usage: node create_template.js <version> <chain_name> <token> <template_files>";
30
+ throw msg;
31
+ }
32
+
33
+
34
+ let chain_id;
35
+ let rpc;
36
+ for (const c in chain_configs) {
37
+ const cn = chain_configs[c].chainName.toLowerCase().replace(' ', '-');
38
+ if (cn == chain || ""+c == ""+chain) {
39
+ rpc = chain_configs[c].hostedRPC;
40
+ chain_id = c;
41
+ break;
42
+ }
43
+ if (chain_configs[c].network_name) {
44
+ const cn2 = chain_configs[c].network_name.toLowerCase();
45
+ if (cn2 == chain) {
46
+ rpc = chain_configs[c].hostedRPC;
47
+ chain_id = c;
48
+ break;
49
+ }
50
+ }
51
+ }
52
+
53
+ if (!chain_id) {
54
+ usage_error("Network unknown");
55
+ }
56
+
57
+ if (token == undef) {
58
+ usage_error("token_name not supplied");
59
+ }
60
+
61
+ const priv = fs.readFileSync(secrets_dir + '/' + chain + '.sec', 'utf8').replace(/\n/, '')
62
+
63
+ const config = rc.realityETHConfig(chain_id, token, version)
64
+ const contract = rc.realityETHInstance(config);
65
+ console.log('using rpc', rpc);
66
+ const provider = new ethers.providers.JsonRpcProvider(rpc);
67
+ const signer = new ethers.Wallet(priv, provider);
68
+ const ethers_instance = new ethers.Contract(contract.address, contract.abi, signer);
69
+
70
+ createMultiple(template_files);
71
+
72
+ async function createMultiple(template_files) {
73
+ const latest = await provider.getBlock('latest');
74
+ console.log('starting at block', latest.number);
75
+ for (let ti=0; ti<template_files.length; ti++) {
76
+ const template_file = template_files[ti];
77
+ console.log('template is', template_file)
78
+ const template_content = fs.readFileSync(template_file, 'utf8');
79
+ await createTemplate(template_content.trim());
80
+ }
81
+ }
82
+
83
+ /*
84
+ function store_deployed_template(template, chain_id, token_name, out_json) {
85
+ const file = project_base + '/chains/deployments/' + chain_id + '/' + token_name + '/' + template + '.json';
86
+ fs.writeFileSync(file, JSON.stringify(out_json, null, 4));
87
+ console.log('wrote file', file);
88
+ }
89
+ */
90
+
91
+ async function createTemplate(template_content) {
92
+ // console.log('creating template', template_content);
93
+ const tx = await ethers_instance.createTemplate(template_content);
94
+ // console.log('tx was', tx);
95
+ }
@@ -0,0 +1 @@
1
+ {"title": "%s", "description": "%s", "type": "bool", "category": "%s", "lang": "%s"}
@@ -0,0 +1 @@
1
+ {"title": "%s", "description": "%s", "type": "uint", "decimals": 18, "category": "%s", "lang": "%s"}
@@ -0,0 +1 @@
1
+ {"title": "%s", "description": "%s", "type": "single-select", "outcomes": [%s], "category": "%s", "lang": "%s"}
@@ -0,0 +1 @@
1
+ {"title": "%s", "description": "%s", "type": "multiple-select", "outcomes": [%s], "category": "%s", "lang": "%s"}
@@ -0,0 +1 @@
1
+ {"title": "%s", "description": "%s", "type": "datetime", "category": "%s", "lang": "%s"}
@@ -20,7 +20,8 @@ const settings = require(deployment_json);
20
20
  const address = settings.address;
21
21
  const chain_data = rc.chainData(chain_id);
22
22
  const rpc = chain_data.hostedRPC ? chain_data.hostedRPC : chain_data.rpcUrls[0];
23
- const start_block = config.block-1;
23
+ const deployment_start_block = config.block-1;
24
+ const start_block = process.argv[3] ? parseInt(process.argv[3]) : deployment_start_block;
24
25
 
25
26
  const provider = new ethers.providers.JsonRpcProvider(rpc);
26
27
  const abi = JSON.parse(fs.readFileSync('../abi/solc-0.8.6/RealityETH-all.abi.json'));