@reality.eth/graph 0.4.12 → 0.4.15
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/package.json +5 -3
- package/render-templates.js +35 -1
- package/src/mapping.ts +11 -0
- package/subgraph.factory.template.yaml +20 -0
- package/subgraph.template.template.yaml +39 -0
- package/subgraph.template.yaml +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reality.eth/graph",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"create-local": "graph create realityeth/realityeth --node http://127.0.0.1:8020",
|
|
6
6
|
"remove-local": "graph remove realityeth/realityeth --node http://127.0.0.1:8020",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"deploy:ava": "yarn prepare:ava && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ realityeth/realityeth-ava",
|
|
13
13
|
"deploy:bsc": "yarn prepare:bsc && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ realityeth/realityeth-bsc",
|
|
14
14
|
"deploy:kovan": "yarn prepare:kovan && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ realityeth/realityeth-kovan",
|
|
15
|
+
"deploy:goerli": "yarn prepare:goerli && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ realityeth/realityeth-goerli",
|
|
15
16
|
"deploy:mainnet": "yarn prepare:mainnet && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ realityeth/realityeth",
|
|
16
17
|
"deploy:optimism": "yarn prepare:optimism && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ realityeth/realityeth-optimism",
|
|
17
18
|
"deploy:polygon": "yarn prepare:polygon && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ realityeth/realityeth-polygon",
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
"prepare:ava": "yarn clean && node render-templates.js 43114 && graph codegen",
|
|
25
26
|
"prepare:bsc": "yarn clean && node render-templates.js 56 && graph codegen",
|
|
26
27
|
"prepare:kovan": "yarn clean && node render-templates.js 42 && graph codegen",
|
|
28
|
+
"prepare:goerli": "yarn clean && node render-templates.js 5 && graph codegen",
|
|
27
29
|
"prepare:mainnet": "yarn clean && node render-templates.js 1 && graph codegen",
|
|
28
30
|
"prepare:optimism": "yarn clean && node render-templates.js 10 && graph codegen",
|
|
29
31
|
"prepare:polygon": "yarn clean && node render-templates.js 137 && graph codegen",
|
|
@@ -42,11 +44,11 @@
|
|
|
42
44
|
"@graphprotocol/graph-ts": "^0.20.0"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
|
-
"@reality.eth/contracts": "^3.0.
|
|
47
|
+
"@reality.eth/contracts": "^3.0.14",
|
|
46
48
|
"babel-polyfill": "^6.26.0",
|
|
47
49
|
"babel-register": "^6.26.0",
|
|
48
50
|
"mustache": "^4.2.0",
|
|
49
51
|
"truffle-hdwallet-provider": "^1.0.4"
|
|
50
52
|
},
|
|
51
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "a6967162fe1addfaa727cb3d3bac37fcabb2c7bb"
|
|
52
54
|
}
|
package/render-templates.js
CHANGED
|
@@ -9,9 +9,12 @@ const net_config = rc_contracts.chainData(net_id);
|
|
|
9
9
|
const network = net_config.network_name;
|
|
10
10
|
|
|
11
11
|
const token_list = rc_contracts.chainTokenList(net_id)
|
|
12
|
+
const factory_list = rc_contracts.factoryList(net_id)
|
|
12
13
|
|
|
13
14
|
const template = fs.readFileSync('subgraph.template.yaml').toString();
|
|
14
15
|
const ds_template = fs.readFileSync('subgraph.datasource.template.yaml').toString();
|
|
16
|
+
const factory_template = fs.readFileSync('subgraph.factory.template.yaml').toString();
|
|
17
|
+
const template_template = fs.readFileSync('subgraph.template.template.yaml').toString();
|
|
15
18
|
|
|
16
19
|
let dses = [];
|
|
17
20
|
|
|
@@ -19,6 +22,10 @@ for(var token in token_list) {
|
|
|
19
22
|
const configs = rc_contracts.realityETHConfigs(net_id, token);
|
|
20
23
|
for (var config_addr in configs) {
|
|
21
24
|
const config = configs[config_addr];
|
|
25
|
+
if ('factory_address' in config && config.factory_address) {
|
|
26
|
+
// console.log('skipping config that was deployed by a factory')
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
22
29
|
const dsData = {
|
|
23
30
|
"network": network,
|
|
24
31
|
"address": config.address,
|
|
@@ -31,8 +38,35 @@ for(var token in token_list) {
|
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
|
|
41
|
+
let facs = [];
|
|
42
|
+
|
|
43
|
+
let found = false;
|
|
44
|
+
for(var ver in factory_list) {
|
|
45
|
+
const f = factory_list[ver];
|
|
46
|
+
const fData = {
|
|
47
|
+
"network": network,
|
|
48
|
+
"address": f.address,
|
|
49
|
+
"block": f.block,
|
|
50
|
+
"contract-name-with-version": ver
|
|
51
|
+
}
|
|
52
|
+
const f_section = mustache.render(factory_template, fData);
|
|
53
|
+
facs.push(f_section);
|
|
54
|
+
found = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let templates = [];
|
|
58
|
+
if (found) {
|
|
59
|
+
const tData = {
|
|
60
|
+
"network": network
|
|
61
|
+
}
|
|
62
|
+
const t_section = mustache.render(template_template, tData);
|
|
63
|
+
templates.push(t_section);
|
|
64
|
+
}
|
|
65
|
+
|
|
34
66
|
const templateData = {
|
|
35
|
-
"datasources": dses.join("\n")
|
|
67
|
+
"datasources": dses.join("\n"),
|
|
68
|
+
"factories": facs.join("\n"),
|
|
69
|
+
"templates": templates.join("\n")
|
|
36
70
|
}
|
|
37
71
|
|
|
38
72
|
fs.writeFileSync(
|
package/src/mapping.ts
CHANGED
|
@@ -32,6 +32,14 @@ import {
|
|
|
32
32
|
LogReopenQuestion
|
|
33
33
|
} from '../generated/RealityETH/RealityETH'
|
|
34
34
|
|
|
35
|
+
import {
|
|
36
|
+
RealityETH_ERC20_deployed
|
|
37
|
+
} from '../generated/RealityETH_ERC20_Factory/RealityETH_ERC20_Factory'
|
|
38
|
+
|
|
39
|
+
import {
|
|
40
|
+
FactoryCreatedRealityETH,
|
|
41
|
+
} from '../generated/templates'
|
|
42
|
+
|
|
35
43
|
export function handleNewTemplate(event: LogNewTemplate): void {
|
|
36
44
|
let contractTemplateId = event.address.toHexString() + '-' + event.params.template_id.toHexString();
|
|
37
45
|
let tmpl = new Template(contractTemplateId);
|
|
@@ -420,3 +428,6 @@ function saveAnswer(contractQuestionId: string, answer: Bytes, bond: BigInt, ts:
|
|
|
420
428
|
}
|
|
421
429
|
}
|
|
422
430
|
|
|
431
|
+
export function handleFactoryRealityETHDeploy(event: RealityETH_ERC20_deployed): void {
|
|
432
|
+
FactoryCreatedRealityETH.create(event.params.reality_eth)
|
|
433
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
- kind: ethereum/contract
|
|
2
|
+
name: RealityETH_ERC20_Factory
|
|
3
|
+
network: {{network}}
|
|
4
|
+
source:
|
|
5
|
+
startBlock: {{block}}
|
|
6
|
+
address: '{{address}}'
|
|
7
|
+
abi: RealityETH_ERC20_Factory
|
|
8
|
+
mapping:
|
|
9
|
+
kind: ethereum/events
|
|
10
|
+
apiVersion: 0.0.4
|
|
11
|
+
language: wasm/assemblyscript
|
|
12
|
+
entities:
|
|
13
|
+
- Directory
|
|
14
|
+
abis:
|
|
15
|
+
- name: RealityETH_ERC20_Factory
|
|
16
|
+
file: ./node_modules/@reality.eth/contracts/abi/solc-0.8.10/RealityETH_ERC20_Factory.abi.json
|
|
17
|
+
eventHandlers:
|
|
18
|
+
- event: RealityETH_ERC20_deployed(address,address,uint8,string)
|
|
19
|
+
handler: handleFactoryRealityETHDeploy
|
|
20
|
+
file: ./src/mapping.ts
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
templates:
|
|
2
|
+
- kind: ethereum/contract
|
|
3
|
+
name: FactoryCreatedRealityETH
|
|
4
|
+
network: {{network}}
|
|
5
|
+
source:
|
|
6
|
+
abi: FactoryCreatedRealityETH
|
|
7
|
+
mapping:
|
|
8
|
+
kind: ethereum/events
|
|
9
|
+
apiVersion: 0.0.4
|
|
10
|
+
language: wasm/assemblyscript
|
|
11
|
+
entities:
|
|
12
|
+
- Question
|
|
13
|
+
abis:
|
|
14
|
+
- name: FactoryCreatedRealityETH
|
|
15
|
+
file: ./node_modules/@reality.eth/contracts/abi/solc-0.8.6/RealityETH-all.abi.json
|
|
16
|
+
eventHandlers:
|
|
17
|
+
- event: LogNewTemplate(indexed uint256,indexed address,string)
|
|
18
|
+
handler: handleNewTemplate
|
|
19
|
+
- event: LogNewQuestion(indexed bytes32,indexed address,uint256,string,indexed bytes32,address,uint32,uint32,uint256,uint256)
|
|
20
|
+
handler: handleNewQuestion
|
|
21
|
+
- event: LogNewAnswer(bytes32,indexed bytes32,bytes32,indexed address,uint256,uint256,bool)
|
|
22
|
+
handler: handleNewAnswer
|
|
23
|
+
- event: LogAnswerReveal(indexed bytes32,indexed address,indexed bytes32,bytes32,uint256,uint256)
|
|
24
|
+
handler: handleAnswerReveal
|
|
25
|
+
- event: LogNotifyOfArbitrationRequest(indexed bytes32,indexed address)
|
|
26
|
+
handler: handleArbitrationRequest
|
|
27
|
+
- event: LogFinalize(indexed bytes32,indexed bytes32)
|
|
28
|
+
handler: handleFinalize
|
|
29
|
+
- event: LogFundAnswerBounty(indexed bytes32,uint256,uint256,indexed address)
|
|
30
|
+
handler: handleFundAnswerBounty
|
|
31
|
+
- event: LogClaim(indexed bytes32,indexed address,uint256)
|
|
32
|
+
handler: handleLogClaim
|
|
33
|
+
- event: LogWithdraw(indexed address,uint256)
|
|
34
|
+
handler: handleLogWithdraw
|
|
35
|
+
- event: LogMinimumBond(indexed bytes32,uint256)
|
|
36
|
+
handler: handleLogMinimumBond
|
|
37
|
+
- event: LogReopenQuestion(indexed bytes32,indexed bytes32)
|
|
38
|
+
handler: handleLogReopenQuestion
|
|
39
|
+
file: ./src/mapping.ts
|