feat: codegen for instance & proxy

This commit is contained in:
nikdementev 2021-06-09 17:20:37 +03:00 committed by 0xZick 地方分権化
parent 693e81fdff
commit 9289f456d9
5 changed files with 8 additions and 5 deletions

@ -2,7 +2,7 @@ module.exports = {
yaml: [ yaml: [
{ {
specVersion: '0.0.2', specVersion: '0.0.2',
repository: 'https://github.com/Synthetixio/synthetix-subgraph', repository: 'https://github.com/tornadocash/tornado-subgraph',
dataSourceKind: 'ethereum/contract', dataSourceKind: 'ethereum/contract',
mapping: { mapping: {
kind: 'ethereum/events', kind: 'ethereum/events',

@ -6,8 +6,9 @@ const Contracts = require('./contracts');
module.exports = { module.exports = {
createYaml: (env) => { createYaml: (env) => {
const createInstanceBlock = ({ name, startBlocks, address }) => ({ const createInstanceBlock = ({ name, network, startBlocks, address }) => ({
name, name,
network,
mappingFile: '../src/mapping-instance.ts', mappingFile: '../src/mapping-instance.ts',
startBlock: startBlocks.prod, startBlock: startBlocks.prod,
address, address,
@ -16,7 +17,7 @@ module.exports = {
abis: [ abis: [
{ {
name: 'Instance', name: 'Instance',
file: '../abis/Instance.json' path: '../abis/Instance.json'
} }
], ],
events: [ events: [

@ -1,4 +1,4 @@
module.exports = { module.exports = {
description: 'Instance', description: 'Instance',
schemaFile: './schema.graphql', schemaFile: '../schema.graphql',
}; };

@ -1,4 +1,4 @@
module.exports = { module.exports = {
description: 'Proxy', description: 'Proxy',
schemaFile: './schema.graphql', schemaFile: '../schema.graphql',
}; };

@ -6,6 +6,8 @@
"build": "graph build", "build": "graph build",
"yaml:proxy": "node ./create-yaml-file create-yaml -s proxy -e bsc | mustache - mustache/yaml.mustache > subgraphs/proxy-tornado-subgraph.yaml", "yaml:proxy": "node ./create-yaml-file create-yaml -s proxy -e bsc | mustache - mustache/yaml.mustache > subgraphs/proxy-tornado-subgraph.yaml",
"yaml:instance": "node ./create-yaml-file create-yaml -s instance -e bsc | mustache - mustache/yaml.mustache > subgraphs/instance-tornado-subgraph.yaml", "yaml:instance": "node ./create-yaml-file create-yaml -s instance -e bsc | mustache - mustache/yaml.mustache > subgraphs/instance-tornado-subgraph.yaml",
"codegen:proxy": "yarn yaml:proxy && yarn codegen -- subgraphs/proxy-tornado-subgraph.yaml",
"codegen:instance": "yarn yaml:instance && yarn codegen -- subgraphs/instance-tornado-subgraph.yaml",
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ tornadocash/bsc-tornado-subgraph" "deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ tornadocash/bsc-tornado-subgraph"
}, },
"dependencies": { "dependencies": {