diff --git a/mustache/templates/echoer/contracts.js b/mustache/templates/echoer/contracts.js index 697a5e0..d2b3813 100644 --- a/mustache/templates/echoer/contracts.js +++ b/mustache/templates/echoer/contracts.js @@ -1,6 +1,6 @@ const contracts = [ { - prod: 8159269, + prod: 8158799, network: 'bsc', name: 'Echoer', address: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', diff --git a/mustache/templates/instance/contracts.js b/mustache/templates/instance/contracts.js index b15aae3..3b29b6c 100644 --- a/mustache/templates/instance/contracts.js +++ b/mustache/templates/instance/contracts.js @@ -1,5 +1,5 @@ const deployedBlocks = { - bsc: 8159290, + bsc: 8158799, xdai: 17754561, matic: 16257962, goerli: 3781595, diff --git a/mustache/templates/instance/create-yaml.js b/mustache/templates/instance/create-yaml.js index 6701b71..1a14421 100644 --- a/mustache/templates/instance/create-yaml.js +++ b/mustache/templates/instance/create-yaml.js @@ -39,14 +39,10 @@ module.exports = { let reExportContent = ''; Contracts.forEach(({ address, name, network, amount, currency }) => { - if (network === env && address != null) { - contractsToInstancesContent += `contractsToInstances.set("${address.toLowerCase()}",${space}//${space}${name}-${currency}-${amount}${newLine}${doubleSpace}"${currency}${'-'}${amount}"${newLine});${newLine}`; - contractsToInstancesContent += `contractsToInstances.set("0x${address - .replace('0x', '') - .toUpperCase()}",${space}//${space}${name}-${currency}-${amount}${newLine}${doubleSpace}"${currency}${'-'}${amount}"${newLine});${newLine}`; - contractsToInstancesContent += `contractsToInstances.set("${address}",${space}//${space}${name}-${currency}-${amount}${newLine}${doubleSpace}"${currency}${'-'}${amount}"${newLine});${newLine}`; + if (address != null) { + contractsToInstancesContent += `contractsToInstances.set("${address.toLowerCase()}_${network}",${space}//${space}${name}-${currency}-${amount}${newLine}${doubleSpace}"${currency}${'-'}${amount}"${newLine});${newLine}`; } - if (network === env) { + if (network === env && reExportContent === '') { reExportContent += `${readOnlyComment}${newLine}export * from "./${name}-${amount}-${currency}/Instance";${newLine}`; } }); diff --git a/src/contractsToInstances.ts b/src/contractsToInstances.ts index f56cd64..842e199 100644 --- a/src/contractsToInstances.ts +++ b/src/contractsToInstances.ts @@ -1,60 +1,186 @@ // this is a read only file generated by manual inputs to file mustache/templates/rates/contracts.js. export let contractsToInstances = new Map(); -contractsToInstances.set("0x12d66f87a04a9e220743712ce6d9bb1b5616b8fc", // Instance-eth-0.1 +contractsToInstances.set("0x84443cfd09a48af6ef360c6976c5392ac5023a1f_bsc", // Instance-bnb-0.1 +  "bnb-0.1" +); +contractsToInstances.set("0xd47438c816c9e7f2e2888e060936a499af9582b3_bsc", // Instance-bnb-1 +  "bnb-1" +); +contractsToInstances.set("0x330bdfade01ee9bf63c209ee33102dd334618e0a_bsc", // Instance-bnb-10 +  "bnb-10" +); +contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd_bsc", // Instance-bnb-100 +  "bnb-100" +); +contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd_xdai", // Instance-xdai-100 +  "xdai-100" +); +contractsToInstances.set("0xdf231d99ff8b6c6cbf4e9b9a945cbacef9339178_xdai", // Instance-xdai-1000 +  "xdai-1000" +); +contractsToInstances.set("0xaf4c0b70b2ea9fb7487c7cbb37ada259579fe040_xdai", // Instance-xdai-10000 +  "xdai-10000" +); +contractsToInstances.set("0xa5c2254e4253490c54cef0a4347fddb8f75a4998_xdai", // Instance-xdai-100000 +  "xdai-100000" +); +contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd_matic", // Instance-matic-100 +  "matic-100" +); +contractsToInstances.set("0xdf231d99ff8b6c6cbf4e9b9a945cbacef9339178_matic", // Instance-matic-1000 +  "matic-1000" +); +contractsToInstances.set("0xaf4c0b70b2ea9fb7487c7cbb37ada259579fe040_matic", // Instance-matic-10000 +  "matic-10000" +); +contractsToInstances.set("0xa5c2254e4253490c54cef0a4347fddb8f75a4998_matic", // Instance-matic-100000 +  "matic-100000" +); +contractsToInstances.set("0x12d66f87a04a9e220743712ce6d9bb1b5616b8fc_mainnet", // Instance-eth-0.1   "eth-0.1" ); -contractsToInstances.set("0x47ce0c6ed5b0ce3d3a51fdb1c52dc66a7c3c2936", // Instance-eth-1 +contractsToInstances.set("0x47ce0c6ed5b0ce3d3a51fdb1c52dc66a7c3c2936_mainnet", // Instance-eth-1   "eth-1" ); -contractsToInstances.set("0x910cbd523d972eb0a6f4cae4618ad62622b39dbf", // Instance-eth-10 +contractsToInstances.set("0x910cbd523d972eb0a6f4cae4618ad62622b39dbf_mainnet", // Instance-eth-10   "eth-10" ); -contractsToInstances.set("0xa160cdab225685da1d56aa342ad8841c3b53f291", // Instance-eth-100 +contractsToInstances.set("0xa160cdab225685da1d56aa342ad8841c3b53f291_mainnet", // Instance-eth-100   "eth-100" ); -contractsToInstances.set("0xd4b88df4d29f5cedd6857912842cff3b20c8cfa3", // Instance-dai-100 +contractsToInstances.set("0x76d85b4c0fc497eecc38902397ac608000a06607_goerli", // Instance-dai-100   "dai-100" ); -contractsToInstances.set("0xfd8610d20aa15b7b2e3be39b396a1bc3516c7144", // Instance-dai-1000 +contractsToInstances.set("0xd4b88df4d29f5cedd6857912842cff3b20c8cfa3_mainnet", // Instance-dai-100 +  "dai-100" +); +contractsToInstances.set("0xfd8610d20aa15b7b2e3be39b396a1bc3516c7144_mainnet", // Instance-dai-1000   "dai-1000" ); -contractsToInstances.set("0x07687e702b410fa43f4cb4af7fa097918ffd2730", // Instance-dai-10000 +contractsToInstances.set("0x07687e702b410fa43f4cb4af7fa097918ffd2730_mainnet", // Instance-dai-10000   "dai-10000" ); -contractsToInstances.set("0x23773e65ed146a459791799d01336db287f25334", // Instance-dai-100000 +contractsToInstances.set("0x23773e65ed146a459791799d01336db287f25334_mainnet", // Instance-dai-100000   "dai-100000" ); -contractsToInstances.set("0x22aaa7720ddd5388a3c0a3333430953c68f1849b", // Instance-cdai-5000 +contractsToInstances.set("0x22aaa7720ddd5388a3c0a3333430953c68f1849b_mainnet", // Instance-cdai-5000   "cdai-5000" ); -contractsToInstances.set("0x03893a7c7463ae47d46bc7f091665f1893656003", // Instance-cdai-50000 +contractsToInstances.set("0x03893a7c7463ae47d46bc7f091665f1893656003_mainnet", // Instance-cdai-50000   "cdai-50000" ); -contractsToInstances.set("0x2717c5e28cf931547b621a5dddb772ab6a35b701", // Instance-cdai-500000 +contractsToInstances.set("0x2717c5e28cf931547b621a5dddb772ab6a35b701_mainnet", // Instance-cdai-500000   "cdai-500000" ); -contractsToInstances.set("0xd21be7248e0197ee08e0c20d4a96debdac3d20af", // Instance-cdai-5000000 +contractsToInstances.set("0xd21be7248e0197ee08e0c20d4a96debdac3d20af_mainnet", // Instance-cdai-5000000   "cdai-5000000" ); -contractsToInstances.set("0xd96f2b1c14db8458374d9aca76e26c3d18364307", // Instance-usdc-100 +contractsToInstances.set("0xd96f2b1c14db8458374d9aca76e26c3d18364307_mainnet", // Instance-usdc-100   "usdc-100" ); -contractsToInstances.set("0x4736dcf1b7a3d580672cce6e7c65cd5cc9cfba9d", // Instance-usdc-1000 +contractsToInstances.set("0x4736dcf1b7a3d580672cce6e7c65cd5cc9cfba9d_mainnet", // Instance-usdc-1000   "usdc-1000" ); -contractsToInstances.set("0x169ad27a470d064dede56a2d3ff727986b15d52b", // Instance-usdt-100 +contractsToInstances.set("0x169ad27a470d064dede56a2d3ff727986b15d52b_mainnet", // Instance-usdt-100   "usdt-100" ); -contractsToInstances.set("0x0836222f2b2b24a3f36f98668ed8f0b38d1a872f", // Instance-usdt-1000 +contractsToInstances.set("0x0836222f2b2b24a3f36f98668ed8f0b38d1a872f_mainnet", // Instance-usdt-1000   "usdt-1000" ); -contractsToInstances.set("0x178169b423a011fff22b9e3f3abea13414ddd0f1", // Instance-wbtc-0.1 +contractsToInstances.set("0x178169b423a011fff22b9e3f3abea13414ddd0f1_mainnet", // Instance-wbtc-0.1   "wbtc-0.1" ); -contractsToInstances.set("0x610b717796ad172b316836ac95a2ffad065ceab4", // Instance-wbtc-1 +contractsToInstances.set("0x610b717796ad172b316836ac95a2ffad065ceab4_mainnet", // Instance-wbtc-1   "wbtc-1" ); -contractsToInstances.set("0xbb93e510bbcd0b7beb5a853875f9ec60275cf498", // Instance-wbtc-10 +contractsToInstances.set("0xbb93e510bbcd0b7beb5a853875f9ec60275cf498_mainnet", // Instance-wbtc-10   "wbtc-10" ); -// this is a read only file generated by manual inputs to file mustache/templates/rates/contracts.js. +contractsToInstances.set("0xcc84179ffd19a1627e79f8648d09e095252bc418_goerli", // Instance-dai-1000 +  "dai-1000" +); +contractsToInstances.set("0xd5d6f8d9e784d0e26222ad3834500801a68d027d_goerli", // Instance-dai-10000 +  "dai-10000" +); +contractsToInstances.set("0x407cceeaa7c95d2fe2250bf9f2c105aa7aafb512_goerli", // Instance-dai-100000 +  "dai-100000" +); +contractsToInstances.set("0x833481186f16cece3f1eeea1a694c42034c3a0db_goerli", // Instance-cdai-5000 +  "cdai-5000" +); +contractsToInstances.set("0xd8d7de3349ccaa0fde6298fe6d7b7d0d34586193_goerli", // Instance-cdai-50000 +  "cdai-50000" +); +contractsToInstances.set("0x8281aa6795ade17c8973e1aedca380258bc124f9_goerli", // Instance-cdai-500000 +  "cdai-500000" +); +contractsToInstances.set("0x57b2b8c82f065de8ef5573f9730fc1449b403c9f_goerli", // Instance-cdai-5000000 +  "cdai-5000000" +); +contractsToInstances.set("0x05e0b5b40b7b66098c2161a5ee11c5740a3a7c45_goerli", // Instance-usdc-100 +  "usdc-100" +); +contractsToInstances.set("0x23173fe8b96a4ad8d2e17fb83ea5dcccdca1ae52_goerli", // Instance-usdc-1000 +  "usdc-1000" +); +contractsToInstances.set("0x538ab61e8a9fc1b2f93b3dd9011d662d89be6fe6_goerli", // Instance-usdt-100 +  "usdt-100" +); +contractsToInstances.set("0x94be88213a387e992dd87de56950a9aef34b9448_goerli", // Instance-usdt-1000 +  "usdt-1000" +); +contractsToInstances.set("0x242654336ca2205714071898f67e254eb49acdce_goerli", // Instance-wbtc-0.1 +  "wbtc-0.1" +); +contractsToInstances.set("0x776198ccf446dfa168347089d7338879273172cf_goerli", // Instance-wbtc-1 +  "wbtc-1" +); +contractsToInstances.set("0xedc5d01286f99a066559f60a585406f3878a033e_goerli", // Instance-wbtc-10 +  "wbtc-10" +); +contractsToInstances.set("0x6bf694a291df3fec1f7e69701e3ab6c592435ae7_goerli", // Instance-eth-0.1 +  "eth-0.1" +); +contractsToInstances.set("0x3aac1cc67c2ec5db4ea850957b967ba153ad6279_goerli", // Instance-eth-1 +  "eth-1" +); +contractsToInstances.set("0x723b78e67497e85279cb204544566f4dc5d2aca0_goerli", // Instance-eth-10 +  "eth-10" +); +contractsToInstances.set("0x0e3a09dda6b20afbb34ac7cd4a6881493f3e7bf7_goerli", // Instance-eth-100 +  "eth-100" +); +contractsToInstances.set("0x330bdfade01ee9bf63c209ee33102dd334618e0a_avalanche", // Instance-avax-10 +  "avax-10" +); +contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd_avalanche", // Instance-avax-100 +  "avax-100" +); +contractsToInstances.set("0xaf8d1839c3c67cf571aa74b5c12398d4901147b3_avalanche", // Instance-avax-500 +  "avax-500" +); +contractsToInstances.set("0x84443cfd09a48af6ef360c6976c5392ac5023a1f_arbitrum-one", // Instance-eth-0.1 +  "eth-0.1" +); +contractsToInstances.set("0xd47438c816c9e7f2e2888e060936a499af9582b3_arbitrum-one", // Instance-eth-1 +  "eth-1" +); +contractsToInstances.set("0x330bdfade01ee9bf63c209ee33102dd334618e0a_arbitrum-one", // Instance-eth-10 +  "eth-10" +); +contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd_arbitrum-one", // Instance-eth-100 +  "eth-100" +); +contractsToInstances.set("0x84443cfd09a48af6ef360c6976c5392ac5023a1f_optimism", // Instance-eth-0.1 +  "eth-0.1" +); +contractsToInstances.set("0xd47438c816c9e7f2e2888e060936a499af9582b3_optimism", // Instance-eth-1 +  "eth-1" +); +contractsToInstances.set("0x330bdfade01ee9bf63c209ee33102dd334618e0a_optimism", // Instance-eth-10 +  "eth-10" +); +contractsToInstances.set("0x1e34a77868e19a6647b1f2f47b51ed72dede95dd_optimism", // Instance-eth-100 +  "eth-100" +); +// this is a read only file generated by manual inputs to file mustache/templates/rates/contracts.js. \ No newline at end of file diff --git a/src/mapping-instance.ts b/src/mapping-instance.ts index e2b85ae..a6ebc15 100644 --- a/src/mapping-instance.ts +++ b/src/mapping-instance.ts @@ -1,3 +1,4 @@ +import { dataSource } from "@graphprotocol/graph-ts"; import { Withdrawal, Deposit } from '../generated'; import { Withdrawal as WithdrawalEntity, Deposit as DepositEntity } from '../generated/schema'; @@ -6,7 +7,7 @@ import { contractsToInstances } from './contractsToInstances'; export function handleWithdrawal(event: Withdrawal): void { let entity = new WithdrawalEntity(event.transaction.hash.toHex() + '-' + event.logIndex.toString()); - let result = contractsToInstances.get(event.address.toHexString()).split('-'); + let result = contractsToInstances.get(event.address.toHexString() + '_' + dataSource.network()).split('-'); entity.amount = result[1]; entity.currency = result[0]; @@ -25,7 +26,7 @@ export function handleWithdrawal(event: Withdrawal): void { export function handleDeposit(event: Deposit): void { let entity = new DepositEntity(event.transaction.hash.toHex() + '-' + event.logIndex.toString()); - let result = contractsToInstances.get(event.address.toHexString()).split('-'); + let result = contractsToInstances.get(event.address.toHexString() + '_' + dataSource.network()).split('-'); entity.amount = result[1]; entity.currency = result[0]; diff --git a/subgraphs/tornado-subgraph-bsc.yaml b/subgraphs/tornado-subgraph-bsc.yaml index 6117c6f..10e3c56 100644 --- a/subgraphs/tornado-subgraph-bsc.yaml +++ b/subgraphs/tornado-subgraph-bsc.yaml @@ -10,7 +10,7 @@ source: address: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4" abi: Echoer - startBlock: 8159269 + startBlock: 8158799 mapping: kind: ethereum/events apiVersion: 0.0.4 @@ -30,7 +30,7 @@ source: address: "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F" abi: Instance - startBlock: 8159279 + startBlock: 8158799 mapping: kind: ethereum/events apiVersion: 0.0.4 @@ -53,7 +53,7 @@ source: address: "0xd47438C816c9E7f2E2888E060936a499Af9582b3" abi: Instance - startBlock: 8159286 + startBlock: 8158799 mapping: kind: ethereum/events apiVersion: 0.0.4 @@ -76,7 +76,7 @@ source: address: "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a" abi: Instance - startBlock: 8159290 + startBlock: 8158799 mapping: kind: ethereum/events apiVersion: 0.0.4 @@ -99,7 +99,7 @@ source: address: "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" abi: Instance - startBlock: 8159296 + startBlock: 8158799 mapping: kind: ethereum/events apiVersion: 0.0.4