From a2d667b7bdd0734d830b4dc80a2cca8960831a6d Mon Sep 17 00:00:00 2001 From: Danil Kovtonyuk Date: Mon, 22 Nov 2021 23:43:14 +1000 Subject: [PATCH] feat: add Arbitrum --- mustache/templates/echoer/contracts.js | 6 + mustache/templates/instance/contracts.js | 33 ++++++ mustache/templates/proxy/contracts.js | 6 + package.json | 7 +- src/contractsToInstances.ts | 12 ++ subgraphs/tornado-subgraph-arbitrum.yaml | 138 +++++++++++++++++++++++ 6 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 subgraphs/tornado-subgraph-arbitrum.yaml diff --git a/mustache/templates/echoer/contracts.js b/mustache/templates/echoer/contracts.js index 54e20ae..6364693 100644 --- a/mustache/templates/echoer/contracts.js +++ b/mustache/templates/echoer/contracts.js @@ -35,6 +35,12 @@ const contracts = [ name: 'Echoer', address: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', }, + { + prod: 3430605, + network: 'arbitrum-one', + name: 'Echoer', + address: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', + }, ]; module.exports = contracts; diff --git a/mustache/templates/instance/contracts.js b/mustache/templates/instance/contracts.js index 23201c0..b7049a1 100644 --- a/mustache/templates/instance/contracts.js +++ b/mustache/templates/instance/contracts.js @@ -4,6 +4,7 @@ const deployedBlocks = { matic: 16257962, goerli: 3781595, mainnet: 9116966, + arbitrum: 3430648, avalanche: 4429818, }; @@ -432,6 +433,38 @@ const contracts = [ name: 'Instance', address: '0xaf8d1839c3c67cf571aa74B5c12398d4901147B3', }, + { + prod: deployedBlocks.arbitrum, + amount: '0.1', + network: 'arbitrum-one', + currency: 'eth', + name: 'Instance', + address: '0x84443CFd09A48AF6eF360C6976C5392aC5023a1F', + }, + { + prod: deployedBlocks.arbitrum, + amount: '1', + network: 'arbitrum-one', + currency: 'eth', + name: 'Instance', + address: '0xd47438C816c9E7f2E2888E060936a499Af9582b3', + }, + { + prod: deployedBlocks.arbitrum, + amount: '10', + network: 'arbitrum-one', + currency: 'eth', + name: 'Instance', + address: '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', + }, + { + prod: deployedBlocks.arbitrum, + amount: '100', + network: 'arbitrum-one', + currency: 'eth', + name: 'Instance', + address: '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + }, ]; module.exports = contracts; diff --git a/mustache/templates/proxy/contracts.js b/mustache/templates/proxy/contracts.js index 0174019..df5a59f 100644 --- a/mustache/templates/proxy/contracts.js +++ b/mustache/templates/proxy/contracts.js @@ -35,6 +35,12 @@ const contracts = [ network: 'avalanche', address: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', }, + { + prod: 3430648, + name: 'Proxy', + network: 'arbitrum-one', + address: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', + }, ]; module.exports = contracts; diff --git a/package.json b/package.json index 378a599..386f3cd 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,14 @@ "generate-mainnet": "yarn codegen:tornado-mainnet && yarn build:tornado-mainnet", "generate-goerli": "yarn codegen:tornado-goerli && yarn build:tornado-goerli", "generate-avalanche": "yarn codegen:tornado-avalanche && yarn build:tornado-avalanche", + "generate-arbitrum": "yarn codegen:tornado-arbitrum && yarn build:tornado-arbitrum", "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", "yaml:tornado-avalanche": "node ./create-yaml-file create-yaml -e avalanche | mustache - mustache/yaml.mustache > subgraphs/tornado-subgraph-avalanche.yaml", + "yaml:tornado-arbitrum": "node ./create-yaml-file create-yaml -e arbitrum-one | mustache - mustache/yaml.mustache > subgraphs/tornado-subgraph-arbitrum.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", @@ -22,6 +24,7 @@ "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", "codegen:tornado-avalanche": "yarn yaml:tornado-avalanche && yarn codegen -- subgraphs/tornado-subgraph-avalanche.yaml", + "codegen:tornado-arbitrum": "yarn yaml:tornado-arbitrum && yarn codegen -- subgraphs/tornado-subgraph-arbitrum.yaml", "build": "graph build", "build:tornado-bsc": "graph build subgraphs/tornado-subgraph-bsc.yaml", "build:tornado-xdai": "graph build subgraphs/tornado-subgraph-xdai.yaml", @@ -29,13 +32,15 @@ "build:tornado-mainnet": "graph build subgraphs/tornado-subgraph-mainnet.yaml", "build:tornado-goerli": "graph build subgraphs/tornado-subgraph-goerli.yaml", "build:tornado-avalanche": "graph build subgraphs/tornado-subgraph-avalanche.yaml", + "build:tornado-arbitrum": "graph build subgraphs/tornado-subgraph-arbitrum.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", - "deploy:tornado-avalanche": "yarn deploy -- tornadocash/avalanche-tornado-subgraph subgraphs/tornado-subgraph-avalanche.yaml" + "deploy:tornado-avalanche": "yarn deploy -- tornadocash/avalanche-tornado-subgraph subgraphs/tornado-subgraph-avalanche.yaml", + "deploy:tornado-arbitrum": "yarn deploy -- tornadocash/arbitrum-tornado-subgraph subgraphs/tornado-subgraph-arbitrum.yaml" }, "dependencies": { "@graphprotocol/graph-cli": "0.20.0", diff --git a/src/contractsToInstances.ts b/src/contractsToInstances.ts index 9e1d21f..cf33e1e 100644 --- a/src/contractsToInstances.ts +++ b/src/contractsToInstances.ts @@ -159,4 +159,16 @@ contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd", // Inst contractsToInstances.set("0xaf8d1839c3c67cf571aa74b5c12398d4901147b3", // Instance-avax-500   "avax-500" ); +contractsToInstances.set("0x84443cfd09a48af6ef360c6976c5392ac5023a1f", // Instance-eth-0.1 +  "eth-0.1" +); +contractsToInstances.set("0xd47438c816c9e7f2e2888e060936a499af9582b3", // Instance-eth-1 +  "eth-1" +); +contractsToInstances.set("0x330bdfade01ee9bf63c209ee33102dd334618e0a", // Instance-eth-10 +  "eth-10" +); +contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd", // Instance-eth-100 +  "eth-100" +); // this is a read only file generated by manual inputs to file mustache/templates/rates/contracts.js. diff --git a/subgraphs/tornado-subgraph-arbitrum.yaml b/subgraphs/tornado-subgraph-arbitrum.yaml new file mode 100644 index 0000000..2adf674 --- /dev/null +++ b/subgraphs/tornado-subgraph-arbitrum.yaml @@ -0,0 +1,138 @@ + specVersion: 0.0.2 + description: Proxy + repository: https://github.com/tornadocash/tornado-subgraph + schema: + file: ../schema.graphql + dataSources: + - kind: ethereum/contract + name: Echoer + network: arbitrum-one + source: + address: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4" + abi: Echoer + startBlock: 3430605 + 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-0.1-eth + network: arbitrum-one + source: + address: "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F" + abi: Instance + startBlock: 3430648 + 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: Instance-1-eth + network: arbitrum-one + source: + address: "0xd47438C816c9E7f2E2888E060936a499Af9582b3" + abi: Instance + startBlock: 3430648 + 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: Instance-10-eth + network: arbitrum-one + source: + address: "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a" + abi: Instance + startBlock: 3430648 + 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: Instance-100-eth + network: arbitrum-one + source: + address: "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" + abi: Instance + startBlock: 3430648 + 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: arbitrum-one + source: + address: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17" + abi: Proxy + startBlock: 3430648 + 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