Compare commits

...

16 Commits

Author SHA1 Message Date
Tornado Contrib 6886d81823
Disable Tornado Nova Ad 2024-06-29 21:44:06 -07:00
Tornado Contrib 33e3026cd1
Remove chainnodes rpc 2024-06-29 16:45:02 -07:00
Tornado Contrib 039006c42c
Revert "added progress percentage"
This reverts commit 551bf1a98e.
2024-06-29 16:43:15 -07:00
Theo 57d3ba5ac5 Merge pull request 'Move latest node.js flags to :lts command' (#34) from tornadocontrib/classic-ui:light-3 into development
Reviewed-on: #34
2024-05-06 20:22:01 +03:00
Tornado Contrib 2fcf0cb443
Remove goerli testnet and comment out frozen instances 2024-05-06 16:05:16 +00:00
Tornado Contrib 1221aad973
Added script to patch old vuex package 2024-05-06 15:55:57 +00:00
Tornado Contrib bf3d37dad6
Move latest node.js flags to :lts command 2024-05-06 15:32:41 +00:00
Theo 5de0210127 Merge pull request 'Minor fix for Windows Build and add Sepolia Testnet' (#33) from tornadocontrib/classic-ui:light-2 into development
Reviewed-on: #33
2024-05-06 18:10:50 +03:00
Tornado Contrib 63e770cf12
Replace thegraph endpoint to ours 2024-05-06 08:12:42 +00:00
Tornado Contrib 340d32b2ad
Added sepolia testnet 2024-05-06 08:12:42 +00:00
Tornado Contrib aaa4205145
Added Telegram link 2024-05-06 08:12:42 +00:00
Tornado Contrib ca946343d2
Fixed windows build with latest node.js lts 2024-05-06 08:12:42 +00:00
Theo 780ccdc44c Add self-hosted RPC endpoints for some chains 2024-05-05 10:46:58 -07:00
Theo 5ebf55204d Merge pull request 'Use subgraph to fetch deposit events and registry events' (#31) from tornadocontrib/classic-ui:light into development
Reviewed-on: #31
2024-05-05 20:24:24 +03:00
Tornado Contrib 2cf3b33b62
Use subgraph to fetch deposit events and registry events 2024-05-05 12:31:55 +00:00
ButterflyEffect b288ce9356 Merge pull request 'master' (#30) from master into development
Reviewed-on: #30
2024-01-11 12:51:35 +01:00
21 changed files with 146 additions and 161 deletions

View File

@ -1,8 +1,6 @@
PINATA_API_KEY= PINATA_API_KEY=
PINATA_SECRET_API_KEY= PINATA_SECRET_API_KEY=
CHAINNODES_KEY=
WC_BRIDGE= WC_BRIDGE=
STORE_NAME= STORE_NAME=

View File

@ -32,7 +32,6 @@ jobs:
- name: Build - name: Build
run: yarn generate run: yarn generate
env: env:
CHAINNODES_KEY: ${{ secrets.CHAINNODES_KEY }}
WC_BRIDGE: ${{ secrets.WC_BRIDGE }} WC_BRIDGE: ${{ secrets.WC_BRIDGE }}
OLD_STORE_NAME: ${{ secrets.OLD_STORE_NAME }} OLD_STORE_NAME: ${{ secrets.OLD_STORE_NAME }}
STORE_NAME: ${{ secrets.STORE_NAME }} STORE_NAME: ${{ secrets.STORE_NAME }}

View File

@ -317,8 +317,8 @@
mask-image: url('../img/icons/ethereum.svg'); mask-image: url('../img/icons/ethereum.svg');
} }
&-ethereum-goerli { &-ethereum-sepolia {
mask-image: url('../img/icons/goerli.svg'); mask-image: url('../img/icons/ethereum.svg');
} }
&-optimism { &-optimism {

View File

@ -34,6 +34,14 @@
rel="noopener noreferrer" rel="noopener noreferrer"
icon-right="stats" icon-right="stats"
></b-button> ></b-button>
<b-button
tag="a"
type="is-icon"
href="https://t.me/tornadoofficial"
target="_blank"
rel="noopener noreferrer"
icon-right="telegram"
></b-button>
<b-button <b-button
tag="a" tag="a"
type="is-icon" type="is-icon"
@ -101,7 +109,7 @@ export default {
...mapGetters('metamask', ['networkConfig', 'netId']), ...mapGetters('metamask', ['networkConfig', 'netId']),
...mapGetters('txHashKeeper', ['addressExplorerUrl']), ...mapGetters('txHashKeeper', ['addressExplorerUrl']),
duneLink() { duneLink() {
const mainnetNetworks = [1, 5] const mainnetNetworks = [1]
if (mainnetNetworks.includes(Number(this.netId))) { if (mainnetNetworks.includes(Number(this.netId))) {
return 'https://dune.xyz/poma/tornado-cash_1' return 'https://dune.xyz/poma/tornado-cash_1'

View File

@ -3,14 +3,15 @@
<div class="loading-container"> <div class="loading-container">
<div class="loading-tornado" data-test="tornado_loader"></div> <div class="loading-tornado" data-test="tornado_loader"></div>
<div class="loading-message">{{ message }}...</div> <div class="loading-message">{{ message }}...</div>
<div v-if="progress >= 0" class="loading-message">{{ progress }}%</div>
<approve-loader v-if="isApprove" /> <approve-loader v-if="isApprove" />
</div> </div>
</b-loading> </b-loading>
</template> </template>
<script> <script>
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
import ApproveLoader from './ApproveLoader' import ApproveLoader from './ApproveLoader'
export default { export default {
components: { components: {
ApproveLoader ApproveLoader
@ -18,7 +19,7 @@ export default {
computed: { computed: {
...mapGetters('metamask', ['isWalletConnect']), ...mapGetters('metamask', ['isWalletConnect']),
...mapState('metamask', ['providerName']), ...mapState('metamask', ['providerName']),
...mapState('loading', ['enabled', 'message', 'progress', 'type']), ...mapState('loading', ['enabled', 'message', 'type']),
isApprove() { isApprove() {
return this.type === 'approve' return this.type === 'approve'
} }

View File

@ -17,8 +17,6 @@ export default {
switch (this.netId) { switch (this.netId) {
case 1: case 1:
return 'Ethereum' return 'Ethereum'
case 5:
return 'Goerli'
case 56: case 56:
return 'BSC Mainnet' return 'BSC Mainnet'
case 137: case 137:
@ -27,6 +25,8 @@ export default {
return 'Arbitrum' return 'Arbitrum'
case 43114: case 43114:
return 'Avalanche' return 'Avalanche'
case 11155111:
return 'Sepolia'
default: default:
return this.networkName return this.networkName
} }

View File

@ -18,9 +18,9 @@
</template> </template>
<template v-slot:description>{{ notice.description }}</template> <template v-slot:description>{{ notice.description }}</template>
</i18n> </i18n>
<a v-if="notice.nova" href="https://nova.tornado.ws/" target="_blank" rel="noopener noreferrer"> <!-- a v-if="notice.nova" href="https://nova.tornado.ws/" target="_blank" rel="noopener noreferrer">
Tornado Cash Nova Tornado Cash Nova
</a> </a -->
<a <a
v-if="notice.txHash" v-if="notice.txHash"
:href="txExplorerUrl(notice.txHash)" :href="txExplorerUrl(notice.txHash)"

View File

@ -52,7 +52,7 @@ export default {
}), }),
...mapState('relayer', ['isLoadingRelayers', 'validRelayers']), ...mapState('relayer', ['isLoadingRelayers', 'validRelayers']),
isRelayersAvailable() { isRelayersAvailable() {
return !this.isLoadingRelayers && this.validRelayers.length > 0; return !this.isLoadingRelayers && this.validRelayers.length > 0
} }
}, },
created() { created() {

View File

@ -338,7 +338,6 @@ export default {
} }
this.$store.dispatch('application/setAndUpdateStatistic', { currency, amount: Number(amount) }) this.$store.dispatch('application/setAndUpdateStatistic', { currency, amount: Number(amount) })
this.$store.dispatch('fees/calculateWithdrawalFeeViaRelayer', {}) this.$store.dispatch('fees/calculateWithdrawalFeeViaRelayer', {})
this.$store.dispatch('loading/updateProgress', { progress: -1 })
this.depositsPast = Number(depositsPast) <= 0 ? 0 : depositsPast this.depositsPast = Number(depositsPast) <= 0 ? 0 : depositsPast
this.depositTxHash = txHash this.depositTxHash = txHash
this.depositTimestamp = timestamp this.depositTimestamp = timestamp

View File

@ -52,9 +52,6 @@ export const cachedEventsLength = {
mainnet: { mainnet: {
ENCRYPTED_NOTES: 16898 ENCRYPTED_NOTES: 16898
}, },
goerli: {
ENCRYPTED_NOTES: 1662
},
bsc: { bsc: {
ENCRYPTED_NOTES: 11333 ENCRYPTED_NOTES: 11333
} }

View File

@ -64,7 +64,7 @@ export default {
}, },
created() { created() {
this.checkRecoveryKey() this.checkRecoveryKey()
this.newNotify() // this.newNotify()
this.$store.dispatch('fees/setDefaultGasPrice') this.$store.dispatch('fees/setDefaultGasPrice')
}, },
mounted() { mounted() {
@ -125,6 +125,7 @@ export default {
width: 440 width: 440
}) })
}, },
/**
newNotify() { newNotify() {
const hasNotify = window.localStorage.getItem('hasNotify') const hasNotify = window.localStorage.getItem('hasNotify')
@ -144,6 +145,7 @@ export default {
window.localStorage.setItem('hasNotify', true) window.localStorage.setItem('hasNotify', true)
} }
}, },
**/
handleOpenModal() { handleOpenModal() {
const recoveryKey = this.$sessionStorage.getItem(this.accounts.encrypt) const recoveryKey = this.$sessionStorage.getItem(this.accounts.encrypt)
if (recoveryKey) { if (recoveryKey) {

View File

@ -1,5 +1,5 @@
export const blockSyncInterval = 10000 export const blockSyncInterval = 10000
export const enabledChains = ['1', '5', '10', '56', '100', '137', '42161', '43114'] export const enabledChains = ['1', '10', '56', '100', '137', '42161', '43114', '11155111']
export default { export default {
netId1: { netId1: {
rpcCallRetryAttempt: 15, rpcCallRetryAttempt: 15,
@ -21,9 +21,9 @@ export default {
networkName: 'Ethereum Mainnet', networkName: 'Ethereum Mainnet',
deployedBlock: 9116966, deployedBlock: 9116966,
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://tornadocash-rpc.com/mainnet'
}, },
mevblockerRPC: { mevblockerRPC: {
name: 'MevblockerRPC', name: 'MevblockerRPC',
@ -74,6 +74,8 @@ export default {
decimals: 8, decimals: 8,
gasLimit: '425000' gasLimit: '425000'
}, },
/**
* Instances frozen due to sanctions
usdc: { usdc: {
instanceAddress: { instanceAddress: {
'100': '0xd96f2B1c14Db8458374d9Aca76E26c3D18364307', '100': '0xd96f2B1c14Db8458374d9Aca76E26c3D18364307',
@ -94,6 +96,7 @@ export default {
decimals: 6, decimals: 6,
gasLimit: '100000' gasLimit: '100000'
}, },
**/
wbtc: { wbtc: {
instanceAddress: { instanceAddress: {
'0.1': '0x178169B423a011fff22B9e3F3abeA13414dDD0F1', '0.1': '0x178169B423a011fff22B9e3F3abeA13414dDD0F1',
@ -141,9 +144,9 @@ export default {
multicall: '0x41263cba59eb80dc200f3e2544eda4ed6a90e76c', multicall: '0x41263cba59eb80dc200f3e2544eda4ed6a90e76c',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://tornadocash-rpc.com/bsc'
}, },
oneRPC: { oneRPC: {
name: '1RPC', name: '1RPC',
@ -192,10 +195,6 @@ export default {
multicall: '0x11ce4B23bD875D7F5C6a31084f55fDe1e9A87507', multicall: '0x11ce4B23bD875D7F5C6a31084f55fDe1e9A87507',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: {
name: 'Tornado RPC',
url: 'https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
},
oneRpc: { oneRpc: {
name: '1RPC', name: '1RPC',
url: 'https://1rpc.io/matic' url: 'https://1rpc.io/matic'
@ -244,9 +243,9 @@ export default {
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
ovmGasPriceOracleContract: '0x420000000000000000000000000000000000000F', ovmGasPriceOracleContract: '0x420000000000000000000000000000000000000F',
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://tornadocash-rpc.com/op'
}, },
oneRpc: { oneRpc: {
name: '1RPC', name: '1RPC',
@ -295,10 +294,6 @@ export default {
multicall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2', multicall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: {
name: 'Tornado RPC',
url: 'https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
},
oneRpc: { oneRpc: {
name: '1rpc', name: '1rpc',
url: 'https://1rpc.io/arb' url: 'https://1rpc.io/arb'
@ -350,9 +345,9 @@ export default {
multicall: '0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a', multicall: '0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://tornadocash-rpc.com/gnosis'
}, },
blockPi: { blockPi: {
name: 'BlockPi', name: 'BlockPi',
@ -433,115 +428,72 @@ export default {
}, },
'tornado-proxy-light.contract.tornadocash.eth': '0x0D5550d52428E7e3175bfc9550207e4ad3859b17' 'tornado-proxy-light.contract.tornadocash.eth': '0x0D5550d52428E7e3175bfc9550207e4ad3859b17'
}, },
netId5: { netId11155111: {
rpcCallRetryAttempt: 15, rpcCallRetryAttempt: 15,
gasPrices: { gasPrices: {
instant: 80, instant: 2,
fast: 50, fast: 2,
standard: 25, standard: 2,
low: 8 low: 2
}, },
nativeCurrency: 'eth', nativeCurrency: 'eth',
currencyName: 'gETH', currencyName: 'ETH',
explorerUrl: { explorerUrl: {
tx: 'https://goerli.etherscan.io/tx/', tx: 'https://sepolia.etherscan.io/tx/',
address: 'https://goerli.etherscan.io/address/', address: 'https://sepolia.etherscan.io/address/',
block: 'https://goerli.etherscan.io/block/' block: 'https://sepolia.etherscan.io/block/'
}, },
merkleTreeHeight: 20, merkleTreeHeight: 20,
emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292',
networkName: 'Ethereum Goerli', networkName: 'Ethereum Sepolia',
deployedBlock: 3781595, deployedBlock: 5594395,
multicall: '0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e', multicall: '0xcA11bde05977b3631167028862bE2a173976CA11',
echoContractAccount: '0x37e6859804b6499d1e4a86d70a5fdd5de6a0ac65', echoContractAccount: '0xcDD1fc3F5ac2782D83449d3AbE80D6b7B273B0e5',
aggregatorContract: '0x8cb1436F64a3c33aD17bb42F94e255c4c0E871b2', aggregatorContract: '0x4088712AC9fad39ea133cdb9130E465d235e9642',
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://goerli.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://tornadocash-rpc.com/sepolia'
}, },
gatewayRPC: { sepolia: {
name: 'Gateway RPC', name: 'Sepolia RPC',
url: 'https://rpc.goerli.eth.gateway.fm' url: 'https://rpc.sepolia.org'
} }
}, },
tokens: { tokens: {
eth: { eth: {
instanceAddress: { instanceAddress: {
'0.1': '0x6Bf694a291DF3FeC1f7e69701E3ab6c592435Ae7', '0.1': '0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b',
'1': '0x3aac1cC67c2ec5Db4eA850957b967Ba153aD6279', '1': '0x8cc930096B4Df705A007c4A039BDFA1320Ed2508',
'10': '0x723B78e67497E85279CB204544566F4dC5d2acA0', '10': '0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585',
'100': '0x0E3A09dDA6B20aFbB34aC7cD4A6881493f3E7bf7' '100': '0x44c5C92ed73dB43888210264f0C8b36Fd68D8379'
}, },
symbol: 'ETH', symbol: 'ETH',
decimals: 18 decimals: 18
}, },
dai: { dai: {
instanceAddress: { instanceAddress: {
'100': '0x76D85B4C0Fc497EeCc38902397aC608000A06607', '100': '0x6921fd1a97441dd603a997ED6DDF388658daf754',
'1000': '0xCC84179FFD19A1627E79F8648d09e095252Bc418', '1000': '0x50a637770F5d161999420F7d70d888DE47207145',
'10000': '0xD5d6f8D9e784d0e26222ad3834500801a68D027D', '10000': '0xecD649870407cD43923A816Cc6334a5bdf113621',
'100000': '0x407CcEeaA7c95d2FE2250Bf9F2c105aA7AAFB512' '100000': '0x73B4BD04bF83206B6e979BE2507098F92EDf4F90'
}, },
tokenAddress: '0xdc31Ee1784292379Fbb2964b3B9C4124D8F89C60', tokenAddress: '0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357',
symbol: 'DAI', symbol: 'DAI',
decimals: 18, decimals: 18,
gasLimit: '55000' gasLimit: '55000'
},
cdai: {
instanceAddress: {
'5000': '0x833481186f16Cece3f1Eeea1a694c42034c3a0dB',
'50000': '0xd8D7DE3349ccaA0Fde6298fe6D7b7d0d34586193',
'500000': '0x8281Aa6795aDE17C8973e1aedcA380258Bc124F9',
'5000000': '0x57b2B8c82F065de8Ef5573f9730fC1449B403C9f'
},
tokenAddress: '0x822397d9a55d0fefd20F5c4bCaB33C5F65bd28Eb',
symbol: 'cDAI',
decimals: 8,
gasLimit: '425000'
},
usdc: {
instanceAddress: {
'100': '0x05E0b5B40B7b66098C2161A5EE11C5740A3A7C45',
'1000': '0x23173fE8b96A4Ad8d2E17fB83EA5dcccdCa1Ae52'
},
tokenAddress: '0xD87Ba7A50B2E7E660f678A895E4B72E7CB4CCd9C',
symbol: 'USDC',
decimals: 6,
gasLimit: '80000'
},
usdt: {
instanceAddress: {
'100': '0x538Ab61E8A9fc1b2f93b3dd9011d662d89bE6FE6',
'1000': '0x94Be88213a387E992Dd87DE56950a9aef34b9448'
},
tokenAddress: '0xb7FC2023D96AEa94Ba0254AA5Aeb93141e4aad66',
symbol: 'USDT',
decimals: 6,
gasLimit: '100000'
},
wbtc: {
instanceAddress: {
'0.1': '0x242654336ca2205714071898f67E254EB49ACdCe',
'1': '0x776198CCF446DFa168347089d7338879273172cF',
'10': '0xeDC5d01286f99A066559F60a585406f3878a033e'
},
tokenAddress: '0xC04B0d3107736C32e19F1c62b2aF67BE61d63a05',
symbol: 'WBTC',
decimals: 8,
gasLimit: '85000'
} }
}, },
ensSubdomainKey: 'goerli-tornado', ensSubdomainKey: 'sepolia-tornado',
pollInterval: 15, pollInterval: 15,
constants: { constants: {
GOVERNANCE_BLOCK: 3945171, GOVERNANCE_BLOCK: 5594395,
NOTE_ACCOUNT_BLOCK: 4131375, NOTE_ACCOUNT_BLOCK: 5594395,
ENCRYPTED_NOTES_BLOCK: 4131375, ENCRYPTED_NOTES_BLOCK: 5594395,
MINING_BLOCK_TIME: 15 MINING_BLOCK_TIME: 15
}, },
'torn.contract.tornadocash.eth': '0x77777FeDdddFfC19Ff86DB637967013e6C6A116C', 'torn.contract.tornadocash.eth': '0x3AE6667167C0f44394106E197904519D808323cA',
'governance.contract.tornadocash.eth': '0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce', 'governance.contract.tornadocash.eth': '0xe5324cD7602eeb387418e594B87aCADee08aeCAD',
'tornado-proxy.contract.tornadocash.eth': '0x454d870a72e29d5e5697f635128d18077bd04c60' 'tornado-router.contract.tornadocash.eth': '0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee'
} }
} }

View File

@ -187,7 +187,6 @@ export default {
new webpack.IgnorePlugin(/worker_threads/), new webpack.IgnorePlugin(/worker_threads/),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': JSON.stringify({ 'process.env': JSON.stringify({
CHAINNODES_KEY: process.env.CHAINNODES_KEY,
WC_BRIDGE: process.env.WC_BRIDGE, WC_BRIDGE: process.env.WC_BRIDGE,
OLD_STORE_NAME: process.env.OLD_STORE_NAME, OLD_STORE_NAME: process.env.OLD_STORE_NAME,
STORE_NAME: process.env.STORE_NAME, STORE_NAME: process.env.STORE_NAME,
@ -225,7 +224,7 @@ export default {
}, },
provider: { provider: {
rpcUrl: `https://mainnet.chainnodes.org/${process.env.CHAINNODES_KEY}` rpcUrl: 'https://tornadocash-rpc.com'
}, },
// todo make custom loading page // todo make custom loading page

View File

@ -7,14 +7,19 @@
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .", "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "yarn lint", "precommit": "yarn lint",
"test": "jest", "test": "jest",
"dev": "cross-env NODE_OPTIONS='--max-old-space-size=8192' nuxt", "fix:vuex": "node ./scripts/vuex.js",
"build": "nuxt build", "dev": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt",
"dev:lts": "yarn fix:vuex && cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt",
"build": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt build",
"build:lts": "yarn fix:vuex && cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt build",
"start": "nuxt start", "start": "nuxt start",
"update:zip": "node -r esm scripts/updateZip.js", "update:zip": "node -r esm scripts/updateZip.js",
"update:events": "node -r esm scripts/updateEvents.js --network", "update:events": "node -r esm scripts/updateEvents.js --network",
"update:encrypted": "node -r esm scripts/updateEncryptedEvents.js --network", "update:encrypted": "node -r esm scripts/updateEncryptedEvents.js --network",
"update:tree": "node -r esm scripts/updateTree.js --network", "update:tree": "node -r esm scripts/updateTree.js --network",
"generate": "cross-env NODE_OPTIONS='--max-old-space-size=8192' nuxt generate && cp dist/404.html dist/ipfs-404.html", "update:copy": "node -r esm scripts/copyFile.js dist/404.html dist/ipfs-404.html",
"generate": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt generate && yarn update:copy",
"generate:lts": "yarn fix:vuex && cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt generate && yarn update:copy",
"check:sync": "node -r esm scripts/checkEventsSync.js", "check:sync": "node -r esm scripts/checkEventsSync.js",
"ipfsUpload": "node scripts/ipfsUpload.js", "ipfsUpload": "node scripts/ipfsUpload.js",
"deploy:ipfs": "yarn generate && yarn ipfsUpload" "deploy:ipfs": "yarn generate && yarn ipfsUpload"

15
scripts/copyFile.js Normal file
View File

@ -0,0 +1,15 @@
import { argv } from 'process'
import { copyFile } from 'fs'
function copyFiles() {
const [, , inFile, outFile] = argv
copyFile(inFile, outFile, function(err) {
if (err) {
throw err
}
console.log(`Copied ${inFile} to ${outFile}`)
})
}
copyFiles()

24
scripts/vuex.js Normal file
View File

@ -0,0 +1,24 @@
/**
* Manually patch vuex to support Node.js >= 18.x
*
* See issue https://github.com/vuejs/vuex/issues/2160
* https://github.com/vuejs/vuex/commit/397e9fba45c8b4ec0c4a33d2578e34829bd348d7
*/
const fs = require('fs')
const pkgJson = JSON.parse(fs.readFileSync('./node_modules/vuex/package.json', { encoding: 'utf8' }))
const backupJson = JSON.stringify(pkgJson, null, 2)
let changes = false
if (!pkgJson.exports['./*']) {
pkgJson.exports['./*'] = './*'
changes = true
}
if (changes) {
fs.writeFileSync('./node_modules/vuex/package.backup.json', backupJson + '\n')
fs.writeFileSync('./node_modules/vuex/package.json', JSON.stringify(pkgJson, null, 2) + '\n')
}

View File

@ -7,13 +7,6 @@ import InstanceABI from '@/abis/Instance.abi.json'
import { CONTRACT_INSTANCES, eventsType, httpConfig } from '@/constants' import { CONTRACT_INSTANCES, eventsType, httpConfig } from '@/constants'
import { sleep, flattenNArray, formatEvents, capitalizeFirstLetter } from '@/utils' import { sleep, flattenNArray, formatEvents, capitalizeFirstLetter } from '@/utils'
let store
if (process.browser) {
window.onNuxtReady(({ $store }) => {
store = $store
})
}
class EventService { class EventService {
constructor({ netId, amount, currency, factoryMethods }) { constructor({ netId, amount, currency, factoryMethods }) {
this.idb = window.$nuxt.$indexedDB(netId) this.idb = window.$nuxt.$indexedDB(netId)
@ -36,15 +29,6 @@ class EventService {
return `${type}s_${this.netId}_${this.currency}_${this.amount}` return `${type}s_${this.netId}_${this.currency}_${this.amount}`
} }
updateEventProgress(percentage, type) {
if (store) {
store.dispatch('loading/updateProgress', {
message: `Fetching past ${type} events`,
progress: Math.ceil(percentage * 100)
})
}
}
async getEvents(type) { async getEvents(type) {
let cachedEvents = await this.getEventsFromDB(type) let cachedEvents = await this.getEventsFromDB(type)
@ -345,8 +329,6 @@ class EventService {
const batchCount = Math.ceil(batchDigest / batchSize) const batchCount = Math.ceil(batchDigest / batchSize)
if (fromBlock < currentBlockNumber) { if (fromBlock < currentBlockNumber) {
this.updateEventProgress(0, type)
for (let batchIndex = 0; batchIndex < batchCount; batchIndex++) { for (let batchIndex = 0; batchIndex < batchCount; batchIndex++) {
const isLastBatch = batchIndex === batchCount - 1 const isLastBatch = batchIndex === batchCount - 1
const params = new Array(batchSize).fill('').map((_, i) => { const params = new Array(batchSize).fill('').map((_, i) => {
@ -361,8 +343,6 @@ class EventService {
failed = failed.concat(requests.filter((e) => e.isFailedBatch)) failed = failed.concat(requests.filter((e) => e.isFailedBatch))
lastBlock = params[batchSize - 1].toBlock lastBlock = params[batchSize - 1].toBlock
const progressIndex = batchIndex - failed.length / batchSize
if (isLastBatch && failed.length !== 0) { if (isLastBatch && failed.length !== 0) {
const failedBatch = await Promise.all(this.createBatchRequest(failed)) const failedBatch = await Promise.all(this.createBatchRequest(failed))
const failedReqs = flattenNArray(failedBatch) const failedReqs = flattenNArray(failedBatch)
@ -374,7 +354,6 @@ class EventService {
throw new Error('Failed to batch events') throw new Error('Failed to batch events')
} }
} }
this.updateEventProgress(progressIndex / batchCount, type)
} }
return { return {
@ -412,10 +391,11 @@ class EventService {
async getEventsFromBlock({ fromBlock, graphMethod, type }) { async getEventsFromBlock({ fromBlock, graphMethod, type }) {
try { try {
// ToDo think about undefined // ToDo think about undefined
const rpcEvents = await this.getEventsFromRpc({ fromBlock, type }) const graphEvents = await this.getEventsFromGraph({ fromBlock, methodName: graphMethod })
const lastSyncBlock = fromBlock > graphEvents?.lastBlock ? fromBlock : graphEvents?.lastBlock
const allEvents = [].concat(rpcEvents || []) const rpcEvents = await this.getEventsFromRpc({ fromBlock: lastSyncBlock, type })
const allEvents = [].concat(graphEvents?.events || [], rpcEvents || [])
if (allEvents.length) { if (allEvents.length) {
return { return {
events: allEvents, events: allEvents,

View File

@ -20,14 +20,14 @@ const link = ({ getContext }) => {
} }
const CHAIN_GRAPH_URLS = { const CHAIN_GRAPH_URLS = {
1: 'https://api.thegraph.com/subgraphs/name/tornadocash/mainnet-tornado-subgraph', 1: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/mainnet-tornado-subgraph',
5: 'https://api.thegraph.com/subgraphs/name/tornadocash/goerli-tornado-subgraph', 10: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/optimism-tornado-subgraph',
10: 'https://api.thegraph.com/subgraphs/name/tornadocash/optimism-tornado-subgraph', 56: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/bsc-tornado-subgraph',
56: 'https://api.thegraph.com/subgraphs/name/tornadocash/bsc-tornado-subgraph', 100: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/xdai-tornado-subgraph',
100: 'https://api.thegraph.com/subgraphs/name/tornadocash/xdai-tornado-subgraph', 137: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/matic-tornado-subgraph',
137: 'https://api.thegraph.com/subgraphs/name/tornadocash/matic-tornado-subgraph', 42161: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/arbitrum-tornado-subgraph',
42161: 'https://api.thegraph.com/subgraphs/name/tornadocash/arbitrum-tornado-subgraph', 43114: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/avalanche-tornado-subgraph',
43114: 'https://api.thegraph.com/subgraphs/name/tornadocash/avalanche-tornado-subgraph' 11155111: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/sepolia-tornado-subgraph'
} }
const defaultOptions = { const defaultOptions = {
@ -45,7 +45,7 @@ const client = new ApolloClient({
}) })
const registryClient = new ApolloClient({ const registryClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/tornadocash/tornado-relayer-registry', uri: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/tornado-relayer-registry',
cache: new InMemoryCache(), cache: new InMemoryCache(),
credentials: 'omit', credentials: 'omit',
defaultOptions defaultOptions

View File

@ -3,6 +3,7 @@ import namehash from 'eth-ens-namehash'
import { BigNumber as BN } from 'bignumber.js' import { BigNumber as BN } from 'bignumber.js'
import { toChecksumAddress, isAddress } from 'web3-utils' import { toChecksumAddress, isAddress } from 'web3-utils'
import { graph } from '@/services'
import networkConfig from '@/networkConfig' import networkConfig from '@/networkConfig'
import { REGISTRY_DEPLOYED_BLOCK } from '@/constants' import { REGISTRY_DEPLOYED_BLOCK } from '@/constants'
import { sleep, flattenNArray } from '@/utils' import { sleep, flattenNArray } from '@/utils'
@ -169,9 +170,21 @@ class RelayerRegister {
fetchRelayers = async () => { fetchRelayers = async () => {
const blockRange = 10000 const blockRange = 10000
// eslint-disable-next-line prefer-const // eslint-disable-next-line prefer-const
let { blockTo, cachedEvents } = await this.getCachedData() let { blockFrom, blockTo, cachedEvents } = await this.getCachedData()
let allRelayers = cachedEvents let allRelayers = cachedEvents
if (!cachedEvents || !cachedEvents.length) {
const { lastSyncBlock, events } = await graph.getAllRegisters(blockFrom)
if (events.length) {
blockTo = lastSyncBlock + 1
cachedEvents = events.map((el) => ({
ensName: el.ensName,
relayerAddress: toChecksumAddress(el.address)
}))
}
}
const currentBlockNumber = await this.provider.getBlockNumber() const currentBlockNumber = await this.provider.getBlockNumber()
const fromBlock = cachedEvents.length === 0 ? REGISTRY_DEPLOYED_BLOCK[1] : blockTo const fromBlock = cachedEvents.length === 0 ? REGISTRY_DEPLOYED_BLOCK[1] : blockTo
const blockDifference = currentBlockNumber - fromBlock const blockDifference = currentBlockNumber - fromBlock
@ -181,7 +194,7 @@ class RelayerRegister {
let registerRelayerEvents let registerRelayerEvents
let lastSyncBlock = blockTo let lastSyncBlock = blockTo
if (cachedEvents.length > 0 || blockDifference === 0) { if (blockDifference <= 0) {
return cachedEvents return cachedEvents
} else if (blockDifference >= blockRange) { } else if (blockDifference >= blockRange) {
toBlock = currentBlockNumber toBlock = currentBlockNumber

View File

@ -410,7 +410,6 @@ const actions = {
const networksWithCache = { const networksWithCache = {
1: cachedEventsLength.mainnet.ENCRYPTED_NOTES, 1: cachedEventsLength.mainnet.ENCRYPTED_NOTES,
5: cachedEventsLength.goerli.ENCRYPTED_NOTES,
56: cachedEventsLength.bsc.ENCRYPTED_NOTES 56: cachedEventsLength.bsc.ENCRYPTED_NOTES
} }

View File

@ -1,7 +1,6 @@
export const state = () => { export const state = () => {
return { return {
message: '', message: '',
progress: -1,
enabled: false, enabled: false,
type: null type: null
} }
@ -10,16 +9,14 @@ export const state = () => {
export const getters = {} export const getters = {}
export const mutations = { export const mutations = {
ENABLE(state, { message, progress, type }) { ENABLE(state, { message, type }) {
state.message = message state.message = message
state.enabled = true state.enabled = true
state.progress = progress
state.type = type state.type = type
}, },
DISABLE(state) { DISABLE(state) {
state.message = '' state.message = ''
state.enabled = false state.enabled = false
state.progress = -1
state.type = null state.type = null
} }
} }
@ -31,9 +28,6 @@ export const actions = {
changeText({ commit }, { message, type }) { changeText({ commit }, { message, type }) {
commit('ENABLE', { message, type }) commit('ENABLE', { message, type })
}, },
updateProgress({ commit }, { message, progress }) {
commit('ENABLE', { message, progress })
},
disable({ commit }) { disable({ commit }) {
commit('DISABLE') commit('DISABLE')
}, },