avalanche

This commit is contained in:
Danil Kovtonyuk 2021-09-15 18:08:19 +10:00
parent 201267a0ae
commit 1dc3cf8ca8
No known key found for this signature in database
GPG Key ID: E72A919BF08C3746
8 changed files with 59 additions and 71 deletions

View File

@ -7,7 +7,7 @@
</template>
<template slot="start">
<b-navbar-item
href="https://medium.com/@tornado-cash/tornado-cash-deployment-proposal-on-xdai-216903df898c"
href="https://medium.com/@tornado-cash/tornado-cash-deployment-proposal-on-avalanche-ee5d69f9e4b0"
target="_blank"
class="decorate"
rel="noreferrer"

View File

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

View File

@ -1,22 +1,17 @@
const networkConfig = {
netId100: {
netId43114: {
rpcCallRetryAttempt: 15,
gasPrices: {
instant: 5,
fast: 4,
standard: 3,
low: 1,
},
currencyName: 'xDAI',
gasPrices: { fast: 225, low: 225, custom: 225, standard: 225 },
currencyName: 'AVAX',
explorerUrl: {
tx: 'https://blockscout.com/xdai/mainnet/tx/',
address: 'https://blockscout.com/xdai/mainnet/address/',
tx: 'https://cchain.explorer.avax.network/tx/',
address: 'https://cchain.explorer.avax.network/address/',
},
networkName: 'xdai',
networkName: 'avalanche',
rpcUrls: {
Infura: {
name: 'xDAI Chain RPC',
url: 'https://rpc.xdaichain.com/tornado',
name: 'Avalanche RPC',
url: 'https://api.avax.network/ext/bc/C/rpc',
},
},
pollInterval: 200,

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

@ -14,20 +14,21 @@ export default {
async initProvider({ commit, state, getters, dispatch }, { name, network }) {
try {
const account = await this.$provider.initProvider(getters.getProvider)
if (window.ethereum.chainId !== '0x64') {
if (window.ethereum.chainId !== '0xa86a') {
await dispatch(
'notice/addNotice',
{
notice: {
title: 'xDaiOnly',
title: 'avalancheOnly',
type: 'danger',
callback: () => dispatch('switchNetwork', { netId: 100 }),
callback: () => dispatch('switchNetwork', { netId: 43114 }),
message: 'switchNetwork',
},
},
{ root: true }
)
throw new Error('Connect to xDai')
throw new Error('Connect to Avalanche')
}
commit(SET_PROVIDER_NAME, name)
@ -49,7 +50,13 @@ export default {
},
async checkNetworkVersion({ commit, state, dispatch }) {
try {
const id = await this.$provider.checkNetworkVersion()
const id = Number(
await this.$provider.sendRequest({
method: 'eth_chainId',
params: [],
})
)
commit(SET_NETWORK, { ...networkConfig[`netId${id}`], id: Number(id) })
return id
} catch (err) {
@ -113,16 +120,16 @@ export default {
},
async addNetwork(_, { netId }) {
const METAMASK_LIST = {
100: {
chainId: '0x64',
chainName: 'xDAI Chain',
rpcUrls: ['https://rpc.xdaichain.com'],
43114: {
chainId: '0xA86A',
chainName: 'Avalanche Mainnet',
rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'],
nativeCurrency: {
name: 'xDAI',
symbol: 'xDAI',
name: 'Avalanche',
symbol: 'AVAX',
decimals: 18,
},
blockExplorerUrls: ['https://blockscout.com/xdai/mainnet'],
blockExplorerUrls: ['https://cchain.explorer.avax.network'],
},
}

View File

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