This commit is contained in:
Danil Kovtonyuk 2021-06-23 15:18:14 +03:00
parent 2bcadbb351
commit 2517b3eac8
No known key found for this signature in database
GPG Key ID: E72A919BF08C3746
14 changed files with 94 additions and 92 deletions

View File

@ -6,11 +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">
href="https://medium.com/@tornado-cash/tornado-cash-bsc-deployment-proposal-96dfc06055f8"
target="_blank"
class="decorate"
>
{{ $t('info') }} {{ $t('info') }}
</b-navbar-item> </b-navbar-item>
</template> </template>

View File

@ -9,7 +9,7 @@
<h4>{{ data.title }}</h4> <h4>{{ data.title }}</h4>
<h5 v-if="data.domain" class="deployed"> <h5 v-if="data.domain" class="deployed">
ENS: ENS:
<a :href="domainUrl(data.expectedAddress)" target="_blank">{{ <a :href="addressExplorerUrl(data.expectedAddress)" target="_blank">{{
data.domain data.domain
}}</a> }}</a>
</h5> </h5>
@ -80,7 +80,7 @@
:row-class="(row) => row.address === getAccount && 'is-selected'" :row-class="(row) => row.address === getAccount && 'is-selected'"
> >
<b-table-column v-slot="props" field="address" label="Address"> <b-table-column v-slot="props" field="address" label="Address">
<a :href="domainUrl(props.row.address)" target="_blank">{{ <a :href="addressExplorerUrl(props.row.address)" target="_blank">{{
props.row.address props.row.address
}}</a> }}</a>
</b-table-column> </b-table-column>
@ -117,7 +117,7 @@ export default {
computed: { computed: {
...mapGetters('provider', ['getProviderName', 'getAccount']), ...mapGetters('provider', ['getProviderName', 'getAccount']),
...mapGetters('steps', ['canDeploy']), ...mapGetters('steps', ['canDeploy']),
...mapGetters('txStorage', ['txExplorerUrl']), ...mapGetters('txStorage', ['txExplorerUrl', 'addressExplorerUrl']),
isNotLoggedIn() { isNotLoggedIn() {
return !this.getProviderName return !this.getProviderName
}, },
@ -127,9 +127,6 @@ export default {
onDeploy() { onDeploy() {
this.deployContract({ action: this.data, index: this.$vnode.key }) this.deployContract({ action: this.data, index: this.$vnode.key })
}, },
domainUrl(address) {
return `https://bscscan.com/address/${address}`
},
}, },
} }
</script> </script>

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 BSC chain.", "pageSubtitle": "Follow these simple steps to become part of deployment of Tornado.Cash protocol on Polygon (Matic) network.",
"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}",
"bscOnly": "Please switch your wallet to BSC network", "polygonOnly": "Please switch your wallet to Polygon network",
"switchNetwork": "Switch to BSC" "switchNetwork": "Switch to Polygon"
} }

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,21 +1,21 @@
const networkConfig = { const networkConfig = {
netId56: { netId137: {
rpcCallRetryAttempt: 15, rpcCallRetryAttempt: 15,
gasPrices: { instant: 21, fast: 5, standard: 5, low: 5 }, gasPrices: { instant: 7.5, fast: 5, standard: 1, low: 1 },
currencyName: 'BNB', currencyName: 'MATIC',
explorerUrl: { explorerUrl: {
tx: 'https://bscscan.com/tx/', tx: 'https://polygonscan.com/tx/',
address: 'https://bscscan.com/address/', address: 'https://polygonscan.com/address/',
}, },
networkName: 'bsc', networkName: 'polygon',
rpcUrls: { rpcUrls: {
Infura: { Infura: {
name: 'Infura', name: 'Infura',
url: url:
'https://wandering-sparkling-shadow.bsc.quiknode.pro/00115b17f97c1f4c374ac309858015da1cab3e02/', 'https://polygon-mainnet.infura.io/v3/da564f81919d40c9a3bcaee4ff44438d',
}, },
}, },
pollInterval: 200, pollInterval: 60,
}, },
} }

View File

@ -14,7 +14,7 @@
"dependencies": { "dependencies": {
"nuxt-web3-provider": "^0.1.1", "nuxt-web3-provider": "^0.1.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"gas-price-oracle": "^0.2.2", "gas-price-oracle": "^0.3.2",
"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",

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>BSC</span> Deployment Tornado.cash <span>Polygon</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

@ -3,12 +3,11 @@ 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.netId137.gasPrices
export const state = () => { export const state = () => {
return { return {
instant: networkConfig.netId56.gasPrices.instant, ...GAS_PRICES,
fast: networkConfig.netId56.gasPrices.fast,
standard: networkConfig.netId56.gasPrices.standard,
low: networkConfig.netId56.gasPrices.low,
custom: null, custom: null,
} }
} }
@ -17,7 +16,11 @@ export const getters = {
oracle: (state, getters, rootState, rootGetters) => { oracle: (state, getters, rootState, rootGetters) => {
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({ defaultRpc: currentRpc }) return new GasPriceOracle({
chainId: 137,
defaultRpc: currentRpc,
defaultFallbackGasPrices: GAS_PRICES,
})
}, },
fastGasPrice: (state) => { fastGasPrice: (state) => {
return toHex(toWei(state.fast.toString(), 'gwei')) return toHex(toWei(state.fast.toString(), 'gwei'))

View File

@ -13,20 +13,20 @@ 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 !== '0x38') { if (window.ethereum.chainId !== '0x89') {
await dispatch( await dispatch(
'notice/addNotice', 'notice/addNotice',
{ {
notice: { notice: {
title: 'bscOnly', title: 'polygonOnly',
type: 'danger', type: 'danger',
callback: () => dispatch('addNetwork', { netId: 56 }), callback: () => dispatch('addNetwork', { netId: 137 }),
message: 'switchNetwork', message: 'switchNetwork',
}, },
}, },
{ root: true } { root: true }
) )
throw new Error('Connect to BSC') throw new Error('Connect to Polygon')
} }
commit(SET_PROVIDER_NAME, name) commit(SET_PROVIDER_NAME, name)
@ -97,16 +97,16 @@ export default {
}, },
async addNetwork(_, { netId }) { async addNetwork(_, { netId }) {
const METAMASK_LIST = { const METAMASK_LIST = {
56: { 137: {
chainId: '0x38', chainId: '0x89',
chainName: 'Binance Smart Chain', chainName: 'Matic Mainnet',
rpcUrls: ['https://bsc-dataseed1.ninicoin.io'], rpcUrls: ['https://rpc-mainnet.matic.network'],
nativeCurrency: { nativeCurrency: {
name: 'Binance Chain Native Token', name: 'Matic',
symbol: 'BNB', symbol: 'MATIC',
decimals: 18, decimals: 18,
}, },
blockExplorerUrls: ['https://bscscan.com'], blockExplorerUrls: ['https://explorer.matic.network'],
}, },
} }

View File

@ -1,8 +1,8 @@
export default () => ({ export default () => ({
account: null, account: null,
network: { network: {
name: 'binance', name: 'polygon',
id: 56, id: 137,
}, },
provider: { provider: {
name: '', name: '',

View File

@ -51,7 +51,7 @@ const actions = {
let number = latestBlock.number let number = latestBlock.number
let events = [] let events = []
while (true) { while (true) {
const fromBlock = number - 4500 const fromBlock = number - 99500
events = await deployContract.getPastEvents('Deployed', { events = await deployContract.getPastEvents('Deployed', {
fromBlock, fromBlock,
toBlock: number, toBlock: number,

View File

@ -7,6 +7,10 @@ export const getters = {
const { explorerUrl } = rootGetters['provider/getNetwork'] const { explorerUrl } = rootGetters['provider/getNetwork']
return explorerUrl.tx + txHash return explorerUrl.tx + txHash
}, },
addressExplorerUrl: (state, getters, rootState, rootGetters) => (address) => {
const { explorerUrl } = rootGetters['provider/getNetwork']
return explorerUrl.address + address
},
} }
export const actions = { export const actions = {

View File

@ -5020,10 +5020,10 @@ functional-red-black-tree@^1.0.1:
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
gas-price-oracle@^0.2.2: gas-price-oracle@^0.3.2:
version "0.2.2" version "0.3.3"
resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.2.2.tgz#32c57a9aa6bc69152be96812880232efebfecbc6" resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.3.3.tgz#25a478d406263961af740dbfa314e053d334ed0f"
integrity sha512-I4+rLbc7C1vgYXV+cYY0MKeqdZVna2hXpNfD2fcIvf/wIgvtIYmG9gsmhiaYGSgOE2RSPUs2xf/W4K2nJOoNuQ== integrity sha512-euMl8Q42pigzpNvl95XvsRE41huNmTcFaGR7FO2fI0Kutu51c2Toh78B6sPrKhgOHQmoCyokj+jb0gDmxMxOwA==
dependencies: dependencies:
axios "^0.19.2" axios "^0.19.2"
bignumber.js "^9.0.0" bignumber.js "^9.0.0"