This commit is contained in:
Danil Kovtonyuk 2021-11-22 17:29:48 +10:00
parent 1dc3cf8ca8
commit 48863e4814
No known key found for this signature in database
GPG Key ID: E72A919BF08C3746
12 changed files with 731 additions and 919 deletions

View File

@ -6,12 +6,7 @@
</b-navbar-item> </b-navbar-item>
</template> </template>
<template slot="start"> <template slot="start">
<b-navbar-item <b-navbar-item href="#" target="_blank" class="decorate" rel="noreferrer">
href="https://medium.com/@tornado-cash/tornado-cash-deployment-proposal-on-avalanche-ee5d69f9e4b0"
target="_blank"
class="decorate"
rel="noreferrer"
>
{{ $t('info') }} {{ $t('info') }}
</b-navbar-item> </b-navbar-item>
</template> </template>

View File

@ -17,7 +17,7 @@
"deployedBy": "Deployed by: {link}", "deployedBy": "Deployed by: {link}",
"startNow": "Start now", "startNow": "Start now",
"completedTasks": "Completed Tasks: {progress}", "completedTasks": "Completed Tasks: {progress}",
"pageSubtitle": "Follow these simple steps to become part of deployment of Tornado.Cash protocol on Avalanche Mainnet.", "pageSubtitle": "Follow these simple steps to become part of deployment of Tornado.Cash protocol on Aribtrum One.",
"alreadyDeployed": "Already deployed", "alreadyDeployed": "Already deployed",
"contractDeployed": "Contract successfully deployed", "contractDeployed": "Contract successfully deployed",
"transactionFailed": "Transaction was failed", "transactionFailed": "Transaction was failed",
@ -26,6 +26,6 @@
"viewOnEtherscan": "View on Etherscan", "viewOnEtherscan": "View on Etherscan",
"pleaseConnectWallet": "Please connect your wallet first", "pleaseConnectWallet": "Please connect your wallet first",
"dependsOnEns": "This action depends on {ens}", "dependsOnEns": "This action depends on {ens}",
"avalancheOnly": "Please switch your wallet to Avalanche Mainnet", "arbitrumOnly": "Please switch your wallet to Arbitrum One",
"switchNetwork": "Switch to Avalanche" "switchNetwork": "Switch to Arbitrum"
} }

View File

@ -37,6 +37,7 @@ export default {
} }
this.fetchDeploymentStatus() this.fetchDeploymentStatus()
this.statusPooling() this.statusPooling()
this.fetchGasPrice()
this.setAirdropAddresses() this.setAirdropAddresses()
}, },
@ -44,6 +45,7 @@ export default {
...mapActions('provider', ['initProvider']), ...mapActions('provider', ['initProvider']),
...mapActions('airdrop', ['setAirdropAddresses']), ...mapActions('airdrop', ['setAirdropAddresses']),
...mapActions('steps', ['statusPooling', 'fetchDeploymentStatus']), ...mapActions('steps', ['statusPooling', 'fetchDeploymentStatus']),
...mapActions('gasPrice', ['fetchGasPrice']),
}, },
} }
</script> </script>

View File

@ -1,20 +1,26 @@
const networkConfig = { const networkConfig = {
netId43114: { netId42161: {
rpcCallRetryAttempt: 15, rpcCallRetryAttempt: 15,
gasPrices: { fast: 225, low: 225, custom: 225, standard: 225 }, gasPrices: {
currencyName: 'AVAX', instant: 4,
explorerUrl: { fast: 3,
tx: 'https://cchain.explorer.avax.network/tx/', standard: 2.52,
address: 'https://cchain.explorer.avax.network/address/', low: 2.29,
}, },
networkName: 'avalanche', currencyName: 'ETH',
explorerUrl: {
tx: 'https://arbiscan.io/tx/',
address: 'https://arbiscan.io/address/',
},
networkName: 'arbitrum',
rpcUrls: { rpcUrls: {
Infura: { Infura: {
name: 'Avalanche RPC', name: 'Arbitrum Public RPC',
url: 'https://api.avax.network/ext/bc/C/rpc', url:
'https://arb-mainnet.g.alchemy.com/v2/_82R9fXSpgWH9iv_oKdwKww7qMyJ6OpR',
}, },
}, },
pollInterval: 200, pollInterval: 15,
}, },
} }

View File

@ -12,16 +12,16 @@
"deploy-prod": "npm run generate && push-dir --allow-unclean --dir=dist --branch=gh-pages --cleanup --remote=temp" "deploy-prod": "npm run generate && push-dir --allow-unclean --dir=dist --branch=gh-pages --cleanup --remote=temp"
}, },
"dependencies": { "dependencies": {
"nuxt-web3-provider": "^0.1.1", "nuxt-web3-provider": "^0.1.4",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"gas-price-oracle": "^0.3.4", "gas-price-oracle": "^0.4.4",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"nuxt": "^2.14.6", "nuxt": "^2.14.6",
"nuxt-buefy": "^0.4.4", "nuxt-buefy": "^0.4.4",
"push-dir": "^0.4.1", "push-dir": "^0.4.1",
"sass-loader": "^10.0.3", "sass-loader": "^10.0.3",
"vue-i18n": "^8.22.1", "vue-i18n": "^8.22.1",
"web3": "1.2.6" "web3": "1.5.2"
}, },
"devDependencies": { "devDependencies": {
"@nuxtjs/eslint-config": "^3.1.0", "@nuxtjs/eslint-config": "^3.1.0",

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<h1 class="title has-text-centered"> <h1 class="title has-text-centered">
Tornado.cash <span>Avalanche</span> Deployment Tornado.cash <span>Arbitrum</span> Deployment
</h1> </h1>
<h2 class="subtitle has-text-centered">{{ $t('pageSubtitle') }}</h2> <h2 class="subtitle has-text-centered">{{ $t('pageSubtitle') }}</h2>

File diff suppressed because one or more lines are too long

View File

@ -69,12 +69,13 @@ const actions = {
], ],
from: ethAccount, from: ethAccount,
} }
const gasEstimate = const gasEstimate = await dispatch(
action.domain === 'deployer.contract.tornadocash.eth' 'provider/sendRequest',
? numberToHex(1e6) callParamsEstimate,
: await dispatch('provider/sendRequest', callParamsEstimate, { {
root: true, root: true,
}) }
)
const gasWithBuffer = Math.ceil(hexToNumber(gasEstimate) * 1.1) const gasWithBuffer = Math.ceil(hexToNumber(gasEstimate) * 1.1)
const callParams = { const callParams = {
method: 'eth_sendTransaction', method: 'eth_sendTransaction',

View File

@ -3,7 +3,7 @@ import { GasPriceOracle } from 'gas-price-oracle'
import networkConfig from '@/networkConfig' import networkConfig from '@/networkConfig'
const { toHex, toWei } = require('web3-utils') const { toHex, toWei } = require('web3-utils')
const GAS_PRICES = networkConfig.netId43114.gasPrices const GAS_PRICES = networkConfig.netId42161.gasPrices
export const state = () => { export const state = () => {
return { return {
@ -17,7 +17,7 @@ export const getters = {
const currentRpc = rootGetters['provider/getNetwork'].rpcUrls.Infura.url const currentRpc = rootGetters['provider/getNetwork'].rpcUrls.Infura.url
console.log('currentRpc', currentRpc) console.log('currentRpc', currentRpc)
return new GasPriceOracle({ return new GasPriceOracle({
chainId: 43114, chainId: 42161,
defaultRpc: currentRpc, defaultRpc: currentRpc,
defaultFallbackGasPrices: GAS_PRICES, defaultFallbackGasPrices: GAS_PRICES,
}) })

View File

@ -13,22 +13,21 @@ import {
export default { export default {
async initProvider({ commit, state, getters, dispatch }, { name, network }) { async initProvider({ commit, state, getters, dispatch }, { name, network }) {
try { try {
const account = await this.$provider.initProvider(getters.getProvider) const account = await this.$provider.initProvider(getters.getProvider, {})
if (window.ethereum.chainId !== '0xa4b1') {
if (window.ethereum.chainId !== '0xa86a') {
await dispatch( await dispatch(
'notice/addNotice', 'notice/addNotice',
{ {
notice: { notice: {
title: 'avalancheOnly', title: 'arbitrumOnly',
type: 'danger', type: 'danger',
callback: () => dispatch('switchNetwork', { netId: 43114 }), callback: () => dispatch('switchNetwork', { netId: 42161 }),
message: 'switchNetwork', message: 'switchNetwork',
}, },
}, },
{ root: true } { root: true }
) )
throw new Error('Connect to Avalanche') throw new Error('Connect to Arbitrum')
} }
commit(SET_PROVIDER_NAME, name) commit(SET_PROVIDER_NAME, name)
@ -120,16 +119,16 @@ export default {
}, },
async addNetwork(_, { netId }) { async addNetwork(_, { netId }) {
const METAMASK_LIST = { const METAMASK_LIST = {
43114: { 42161: {
chainId: '0xA86A', chainId: '0xA4B1',
chainName: 'Avalanche Mainnet', chainName: 'Arbitrum One',
rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'], rpcUrls: ['https://arb1.arbitrum.io/rpc'],
nativeCurrency: { nativeCurrency: {
name: 'Avalanche', name: 'Ether',
symbol: 'AVAX', symbol: 'AETH',
decimals: 18, decimals: 18,
}, },
blockExplorerUrls: ['https://cchain.explorer.avax.network'], blockExplorerUrls: ['https://arbiscan.io'],
}, },
} }

View File

@ -1,8 +1,8 @@
export default () => ({ export default () => ({
account: null, account: null,
network: { network: {
name: 'avalanche', name: 'arbitrum',
id: 43114, id: 42161,
}, },
provider: { provider: {
name: '', name: '',

1493
yarn.lock

File diff suppressed because it is too large Load Diff