From 23f85d7ea15f6e371e9f09ff539f87461f8fc3dd Mon Sep 17 00:00:00 2001 From: Danil Kovtonyuk Date: Tue, 17 Aug 2021 13:30:46 +1000 Subject: [PATCH] feat: add xDai --- mustache/templates/echoer/contracts.js | 6 +++ mustache/templates/instance/contracts.js | 9 ++++ mustache/templates/proxy/contracts.js | 6 +++ package.json | 5 ++ src/contractsToInstances.ts | 3 ++ subgraphs/tornado-subgraph-xdai.yaml | 69 ++++++++++++++++++++++++ 6 files changed, 98 insertions(+) create mode 100644 subgraphs/tornado-subgraph-xdai.yaml diff --git a/mustache/templates/echoer/contracts.js b/mustache/templates/echoer/contracts.js index 0f14d68..bef7a9e 100644 --- a/mustache/templates/echoer/contracts.js +++ b/mustache/templates/echoer/contracts.js @@ -5,6 +5,12 @@ const contracts = [ name: 'Echoer', address: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', }, + { + prod: 17626717, + network: 'xdai', + name: 'Echoer', + address: '0xEd2B6bf192cFAb45810FC06c5E44e4Df48Eef47d', + }, { prod: 16257996, network: 'matic', diff --git a/mustache/templates/instance/contracts.js b/mustache/templates/instance/contracts.js index c1cde7f..ab04753 100644 --- a/mustache/templates/instance/contracts.js +++ b/mustache/templates/instance/contracts.js @@ -2,6 +2,7 @@ const deployedBlocks = { goerli: 3781595, mainnet: 9116966, matic: 16257962, + xdai: 17626717, bsc: 8159290, }; @@ -38,6 +39,14 @@ const contracts = [ name: 'Instance', address: '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', }, + { + prod: deployedBlocks.xdai, + amount: '100', + network: 'xdai', + currency: 'xdai', + name: 'Instance', + address: '0x980C75f9b2A62d1206C2C146aE4aa1a19E4A21C0', + }, { prod: deployedBlocks.matic, amount: '100', diff --git a/mustache/templates/proxy/contracts.js b/mustache/templates/proxy/contracts.js index f692376..874f92d 100644 --- a/mustache/templates/proxy/contracts.js +++ b/mustache/templates/proxy/contracts.js @@ -5,6 +5,12 @@ const contracts = [ network: 'bsc', address: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', }, + { + prod: 17626717, + name: 'Proxy', + network: 'xdai', + address: '0xa77350E1a72bE5bC7634d359C5011b4E359f4320', + }, { prod: 16257989, name: 'Proxy', diff --git a/package.json b/package.json index cb605e7..7903ab2 100644 --- a/package.json +++ b/package.json @@ -4,25 +4,30 @@ "scripts": { "lint": "eslint .", "generate-bsc": "yarn codegen:tornado-bsc && yarn build:tornado-bsc", + "generate-xdai": "yarn codegen:tornado-xdai && yarn build:tornado-xdai", "generate-matic": "yarn codegen:tornado-matic && yarn build:tornado-matic", "generate-mainnet": "yarn codegen:tornado-mainnet && yarn build:tornado-mainnet", "generate-goerli": "yarn codegen:tornado-goerli && yarn build:tornado-goerli", "yaml:tornado-bsc": "node ./create-yaml-file create-yaml -e bsc | mustache - mustache/yaml.mustache > subgraphs/tornado-subgraph-bsc.yaml", + "yaml:tornado-xdai": "node ./create-yaml-file create-yaml -e xdai | mustache - mustache/yaml.mustache > subgraphs/tornado-subgraph-xdai.yaml", "yaml:tornado-matic": "node ./create-yaml-file create-yaml -e matic | mustache - mustache/yaml.mustache > subgraphs/tornado-subgraph-matic.yaml", "yaml:tornado-mainnet": "node ./create-yaml-file create-yaml -e mainnet | mustache - mustache/yaml.mustache > subgraphs/tornado-subgraph-mainnet.yaml", "yaml:tornado-goerli": "node ./create-yaml-file create-yaml -e goerli | mustache - mustache/yaml.mustache > subgraphs/tornado-subgraph-goerli.yaml", "codegen": "graph codegen", "codegen:tornado-bsc": "yarn yaml:tornado-bsc && yarn codegen -- subgraphs/tornado-subgraph-bsc.yaml", + "codegen:tornado-xdai": "yarn yaml:tornado-xdai && yarn codegen -- subgraphs/tornado-subgraph-xdai.yaml", "codegen:tornado-matic": "yarn yaml:tornado-matic && yarn codegen -- subgraphs/tornado-subgraph-matic.yaml", "codegen:tornado-mainnet": "yarn yaml:tornado-mainnet && yarn codegen -- subgraphs/tornado-subgraph-mainnet.yaml", "codegen:tornado-goerli": "yarn yaml:tornado-goerli && yarn codegen -- subgraphs/tornado-subgraph-goerli.yaml", "build": "graph build", "build:tornado-bsc": "graph build subgraphs/tornado-subgraph-bsc.yaml", + "build:tornado-xdai": "graph build subgraphs/tornado-subgraph-xdai.yaml", "build:tornado-matic": "graph build subgraphs/tornado-subgraph-matic.yaml", "build:tornado-mainnet": "graph build subgraphs/tornado-subgraph-mainnet.yaml", "build:tornado-goerli": "graph build subgraphs/tornado-subgraph-goerli.yaml", "deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ --access-token $TOKEN", "deploy:tornado-bsc": "yarn deploy -- tornadocash/bsc-tornado-subgraph subgraphs/tornado-subgraph-bsc.yaml", + "deploy:tornado-xdai": "yarn deploy -- tornadocash/xdai-tornado-subgraph subgraphs/tornado-subgraph-xdai.yaml", "deploy:tornado-matic": "yarn deploy -- tornadocash/matic-tornado-subgraph subgraphs/tornado-subgraph-matic.yaml", "deploy:tornado-mainnet": "yarn deploy -- tornadocash/mainnet-tornado-subgraph subgraphs/tornado-subgraph-mainnet.yaml", "deploy:tornado-goerli": "yarn deploy -- tornadocash/goerli-tornado-subgraph subgraphs/tornado-subgraph-goerli.yaml" diff --git a/src/contractsToInstances.ts b/src/contractsToInstances.ts index f3024a3..944ab55 100644 --- a/src/contractsToInstances.ts +++ b/src/contractsToInstances.ts @@ -12,6 +12,9 @@ contractsToInstances.set("0x330bdfade01ee9bf63c209ee33102dd334618e0a", // Inst contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd", // Instance-bnb-100   "bnb-100" ); +contractsToInstances.set("0x980c75f9b2a62d1206c2c146ae4aa1a19e4a21c0", // Instance-xdai-100 +  "xdai-100" +); contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd", // Instance-matic-100   "matic-100" ); diff --git a/subgraphs/tornado-subgraph-xdai.yaml b/subgraphs/tornado-subgraph-xdai.yaml new file mode 100644 index 0000000..ba84cf6 --- /dev/null +++ b/subgraphs/tornado-subgraph-xdai.yaml @@ -0,0 +1,69 @@ + specVersion: 0.0.2 + description: Proxy + repository: https://github.com/tornadocash/tornado-subgraph + schema: + file: ../schema.graphql + dataSources: + - kind: ethereum/contract + name: Echoer + network: xdai + source: + address: "0xEd2B6bf192cFAb45810FC06c5E44e4Df48Eef47d" + abi: Echoer + startBlock: 17626717 + mapping: + kind: ethereum/events + apiVersion: 0.0.4 + language: wasm/assemblyscript + file: ../src/mapping-echo-account.ts + entities: + - NoteAccount + abis: + - name: Echoer + file: ../abis/Echoer.json + eventHandlers: + - event: Echo(indexed address,bytes) + handler: handleEcho + - kind: ethereum/contract + name: Instance-100-xdai + network: xdai + source: + address: "0x980C75f9b2A62d1206C2C146aE4aa1a19E4A21C0" + abi: Instance + startBlock: 17626717 + mapping: + kind: ethereum/events + apiVersion: 0.0.4 + language: wasm/assemblyscript + file: ../src/mapping-instance.ts + entities: + - Deposit + - Withdrawal + abis: + - name: Instance + file: ../abis/Instance.json + eventHandlers: + - event: Deposit(indexed bytes32,uint32,uint256) + handler: handleDeposit + - event: Withdrawal(address,bytes32,indexed address,uint256) + handler: handleWithdrawal + - kind: ethereum/contract + name: Proxy + network: xdai + source: + address: "0xa77350E1a72bE5bC7634d359C5011b4E359f4320" + abi: Proxy + startBlock: 17626717 + mapping: + kind: ethereum/events + apiVersion: 0.0.4 + language: wasm/assemblyscript + file: ../src/mapping-encrypted-note.ts + entities: + - EncryptedNote + abis: + - name: Proxy + file: ../abis/Proxy.json + eventHandlers: + - event: EncryptedNote(indexed address,bytes) + handler: handleEncryptedNote