@reality.eth/contracts 3.0.79 → 3.1.0
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 +1 -1
- package/abi/solc-0.4.25/RealityETH-2.2.abi.json +1 -0
- package/abi/solc-0.8.6/RealityETH-3.2.abi.json +1 -0
- package/abi/solc-0.8.6/RealityETH_ERC20-3.2.abi.json +1 -0
- package/bytecode/RealityETH-2.2.bin +1 -0
- package/bytecode/RealityETH-3.2.bin +1 -0
- package/bytecode/RealityETH_ERC20-3.2.bin +1 -0
- package/chains/deployments/1/ETH/RealityETH-3.0.json +3 -2
- package/chains/deployments/100/XDAI/RealityETH-3.2.json +6 -0
- package/chains/deployments/10200/XDAI/RealityETH-3.2.json +6 -0
- package/chains/deployments/11155111/ETH/RealityETH-3.2.json +6 -0
- package/chains/deployments/88558801/ZBS/RealityETH-3.2.json +6 -0
- package/config/templates_3.2.json +18 -0
- package/flat/RealityETH-2.2.sol +895 -0
- package/flat/RealityETH-3.2.sol +990 -0
- package/flat/RealityETH_ERC20-3.2.sol +1097 -0
- package/generated/contracts.json +27 -2
- package/index.js +29 -6
- package/package.json +2 -2
- package/scripts/create_templates.js +95 -0
- package/scripts/deploy.js +2 -2
- package/scripts/description_templates/1.json +1 -0
- package/scripts/description_templates/2.json +1 -0
- package/scripts/description_templates/3.json +1 -0
- package/scripts/description_templates/4.json +1 -0
- package/scripts/description_templates/5.json +1 -0
- package/scripts/store_template_ids.js +2 -1
package/generated/contracts.json
CHANGED
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
"block": 13194676,
|
|
18
18
|
"notes": null,
|
|
19
19
|
"arbitrators": {
|
|
20
|
-
"
|
|
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
|
},
|
|
@@ -323,6 +324,12 @@
|
|
|
323
324
|
"arbitrators": {
|
|
324
325
|
"0x29f39de98d750eb77b5fafb31b2837f079fce222": "Kleros"
|
|
325
326
|
}
|
|
327
|
+
},
|
|
328
|
+
"RealityETH-3.2": {
|
|
329
|
+
"address": "0xEb51d9d9717906c981C57af09C4a3449eF30705b",
|
|
330
|
+
"block": 39142627,
|
|
331
|
+
"notes": null,
|
|
332
|
+
"arbitrators": {}
|
|
326
333
|
}
|
|
327
334
|
}
|
|
328
335
|
},
|
|
@@ -476,6 +483,12 @@
|
|
|
476
483
|
"block": 10438389,
|
|
477
484
|
"notes": null,
|
|
478
485
|
"arbitrators": {}
|
|
486
|
+
},
|
|
487
|
+
"RealityETH-3.2": {
|
|
488
|
+
"address": "0x012fb3aDce7D60672cF634e730927Fa5822b3cAb",
|
|
489
|
+
"block": 14880291,
|
|
490
|
+
"notes": null,
|
|
491
|
+
"arbitrators": {}
|
|
479
492
|
}
|
|
480
493
|
}
|
|
481
494
|
},
|
|
@@ -625,6 +638,12 @@
|
|
|
625
638
|
"arbitrators": {
|
|
626
639
|
"0x05b942faecfb3924970e3a28e0f230910cedff45": "Kleros"
|
|
627
640
|
}
|
|
641
|
+
},
|
|
642
|
+
"RealityETH-3.2": {
|
|
643
|
+
"address": "0xB7982f20CC159a40eba4b0eA86fd6cbA6Ff810e1",
|
|
644
|
+
"block": 7898415,
|
|
645
|
+
"notes": null,
|
|
646
|
+
"arbitrators": {}
|
|
628
647
|
}
|
|
629
648
|
}
|
|
630
649
|
},
|
|
@@ -651,6 +670,12 @@
|
|
|
651
670
|
"notes": null,
|
|
652
671
|
"arbitrators": {}
|
|
653
672
|
},
|
|
673
|
+
"RealityETH-3.2": {
|
|
674
|
+
"address": "0x3a9Ef99956021d545214B7021D449ACb20fCF2b3",
|
|
675
|
+
"block": 240,
|
|
676
|
+
"notes": null,
|
|
677
|
+
"arbitrators": {}
|
|
678
|
+
},
|
|
654
679
|
"RealityETH-4.0": {
|
|
655
680
|
"address": "0x74549fdf4e00C7c564bB193a911887d8C291b13C",
|
|
656
681
|
"block": 2,
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
let all_config = require('./generated/contracts.json');
|
|
2
2
|
let token_info = require('./generated/tokens.json');
|
|
3
3
|
const chain_info = require('./generated/chains.json');
|
|
4
|
-
const template_config = require('./config/templates.json');
|
|
5
4
|
const factory_config = require('./generated/factories.json');
|
|
6
5
|
|
|
7
6
|
function populateImports(imported_contracts, chain_id) {
|
|
@@ -28,6 +27,7 @@ function realityETHInstance(config) {
|
|
|
28
27
|
'RealityETH-2.1': require('./abi/solc-0.8.6/RealityETH-2.1.abi.json'),
|
|
29
28
|
'RealityETH-2.1-rc1': require('./abi/solc-0.8.6/RealityETH-2.1.abi.json'),
|
|
30
29
|
'RealityETH-3.0': require('./abi/solc-0.8.6/RealityETH-3.0.abi.json'),
|
|
30
|
+
'RealityETH-3.2': require('./abi/solc-0.8.6/RealityETH-3.2.abi.json'),
|
|
31
31
|
'RealityETH_ERC20-2.0': require('./abi/solc-0.8.6/RealityETH_ERC20-2.0.abi.json'),
|
|
32
32
|
'RealityETH_ERC20-3.0': require('./abi/solc-0.8.6/RealityETH_ERC20-3.0.abi.json')
|
|
33
33
|
}
|
|
@@ -97,7 +97,7 @@ function tokenConfig(token, chain_id) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function realityETHConfig(chain_id, token, version) {
|
|
100
|
-
const versions = ['3.0', '2.1', '2.1-rc1', '2.0'];
|
|
100
|
+
const versions = ['3.0', '3.2', '2.1', '2.1-rc1', '2.0'];
|
|
101
101
|
const token_info = chainTokenList(chain_id);
|
|
102
102
|
if (!token_info[token]) {
|
|
103
103
|
console.log("Token not found for chain");
|
|
@@ -138,7 +138,7 @@ function realityETHConfig(chain_id, token, version) {
|
|
|
138
138
|
|
|
139
139
|
function realityETHConfigs(chain_id, token) {
|
|
140
140
|
let configs = {};
|
|
141
|
-
const versions = ['3.0', '2.1', '2.1-rc1', '2.0'];
|
|
141
|
+
const versions = ['3.2', '3.0', '2.1', '2.1-rc1', '2.0'];
|
|
142
142
|
const token_info = chainTokenList(chain_id);
|
|
143
143
|
if (!token_info[token]) {
|
|
144
144
|
console.log("Token not found for network");
|
|
@@ -204,8 +204,19 @@ function walletAddParameters(chain_id) {
|
|
|
204
204
|
return ret;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
function templateConfig() {
|
|
208
|
-
|
|
207
|
+
function templateConfig(vernum) {
|
|
208
|
+
const old_templates = require('./config/templates.json');
|
|
209
|
+
const new_templates = require('./config/templates_3.2.json'); // This is also backported to 2.2
|
|
210
|
+
if (vernum == 2.2 || vernum < 3.2) {
|
|
211
|
+
return old_templates;
|
|
212
|
+
} else {
|
|
213
|
+
return new_templates;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function defaultTemplateIDForType(template_type, vernum) {
|
|
218
|
+
const tc = templateConfig(vernum);
|
|
219
|
+
return tc.base_ids[template_type];
|
|
209
220
|
}
|
|
210
221
|
|
|
211
222
|
function defaultTokenForChain(chain_id) {
|
|
@@ -229,11 +240,22 @@ function defaultTokenForChain(chain_id) {
|
|
|
229
240
|
}
|
|
230
241
|
|
|
231
242
|
function versionHasFeature(vernum, feature_name) {
|
|
243
|
+
vernum = ""+vernum;
|
|
232
244
|
if (feature_name == 'min-bond' || feature_name == 'reopen-question') {
|
|
233
245
|
const min_maj = 3;
|
|
234
|
-
const bits = vernum
|
|
246
|
+
const bits = vernum.split('.');
|
|
235
247
|
const maj = parseInt(bits[0]);
|
|
236
248
|
return (maj >= min_maj);
|
|
249
|
+
} else if (feature_name == 'description' || feature_name == 'hash-type') {
|
|
250
|
+
const min_min = 2;
|
|
251
|
+
const bits = vernum.split('.');
|
|
252
|
+
const min = parseInt(bits[1]);
|
|
253
|
+
return (min >= min_min);
|
|
254
|
+
} else if (feature_name == 'category') {
|
|
255
|
+
const min_min = 2;
|
|
256
|
+
const bits = vernum.split('.');
|
|
257
|
+
const min = parseInt(bits[1]);
|
|
258
|
+
return (min < min_min);
|
|
237
259
|
} else {
|
|
238
260
|
throw new Error('Feature not known: '+feature_name);
|
|
239
261
|
}
|
|
@@ -369,6 +391,7 @@ module.exports.tokenConfig = tokenConfig
|
|
|
369
391
|
module.exports.chainData = chainData;
|
|
370
392
|
module.exports.walletAddParameters = walletAddParameters;
|
|
371
393
|
module.exports.templateConfig = templateConfig;
|
|
394
|
+
module.exports.defaultTemplateIDForType = defaultTemplateIDForType;
|
|
372
395
|
module.exports.defaultTokenForChain = defaultTokenForChain;
|
|
373
396
|
module.exports.versionHasFeature = versionHasFeature;
|
|
374
397
|
module.exports.isChainSupported = isChainSupported;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reality.eth/contracts",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
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": "
|
|
37
|
+
"gitHead": "a2085e2003e071267ec59b80da9bc7e52356b5f4",
|
|
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
|
+
}
|
package/scripts/deploy.js
CHANGED
|
@@ -72,7 +72,7 @@ const chains = {
|
|
|
72
72
|
'backstopTestnet1': 88558801
|
|
73
73
|
}
|
|
74
74
|
const non_infura_chains = {
|
|
75
|
-
'gnosis': 'https://
|
|
75
|
+
'gnosis': 'https://gnosis.oat.farm',
|
|
76
76
|
'scroll-alpha-testnet': 'https://alpha-rpc.scroll.io/l2',
|
|
77
77
|
'sokol': 'https://sokol.poa.network',
|
|
78
78
|
'bsc': 'https://bsc-dataseed.binance.org',
|
|
@@ -90,7 +90,7 @@ const non_infura_chains = {
|
|
|
90
90
|
'optimism': 'https://mainnet.optimism.io',
|
|
91
91
|
'kintsugi': 'https://rpc.kintsugi.themerge.dev',
|
|
92
92
|
'mumbai': 'https://matic-mumbai.chainstacklabs.com',
|
|
93
|
-
'sepolia': 'https://rpc.sepolia.org',
|
|
93
|
+
'sepolia': 'https://sepolia.backstop.technology/', // 'https://rpc.sepolia.org',
|
|
94
94
|
'holesky': 'https://ethereum-holesky.publicnode.com',
|
|
95
95
|
'telosevm': 'https://mainnet.telos.net/evm',
|
|
96
96
|
'unichain': 'https://mainnet.unichain.org',
|
|
@@ -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
|
|
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'));
|