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

View File

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

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

View File

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

View File

@ -1,21 +1,21 @@
const networkConfig = {
netId56: {
netId137: {
rpcCallRetryAttempt: 15,
gasPrices: { instant: 21, fast: 5, standard: 5, low: 5 },
currencyName: 'BNB',
gasPrices: { instant: 7.5, fast: 5, standard: 1, low: 1 },
currencyName: 'MATIC',
explorerUrl: {
tx: 'https://bscscan.com/tx/',
address: 'https://bscscan.com/address/',
tx: 'https://polygonscan.com/tx/',
address: 'https://polygonscan.com/address/',
},
networkName: 'bsc',
networkName: 'polygon',
rpcUrls: {
Infura: {
name: 'Infura',
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": {
"nuxt-web3-provider": "^0.1.1",
"core-js": "^3.6.5",
"gas-price-oracle": "^0.2.2",
"gas-price-oracle": "^0.3.2",
"node-sass": "^4.14.1",
"nuxt": "^2.14.6",
"nuxt-buefy": "^0.4.4",

View File

@ -1,7 +1,7 @@
<template>
<div>
<h1 class="title has-text-centered">
Tornado.cash <span>BSC</span> Deployment
Tornado.cash <span>Polygon</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,12 +3,11 @@ import { GasPriceOracle } from 'gas-price-oracle'
import networkConfig from '@/networkConfig'
const { toHex, toWei } = require('web3-utils')
const GAS_PRICES = networkConfig.netId137.gasPrices
export const state = () => {
return {
instant: networkConfig.netId56.gasPrices.instant,
fast: networkConfig.netId56.gasPrices.fast,
standard: networkConfig.netId56.gasPrices.standard,
low: networkConfig.netId56.gasPrices.low,
...GAS_PRICES,
custom: null,
}
}
@ -17,7 +16,11 @@ export const getters = {
oracle: (state, getters, rootState, rootGetters) => {
const currentRpc = rootGetters['provider/getNetwork'].rpcUrls.Infura.url
console.log('currentRpc', currentRpc)
return new GasPriceOracle({ defaultRpc: currentRpc })
return new GasPriceOracle({
chainId: 137,
defaultRpc: currentRpc,
defaultFallbackGasPrices: GAS_PRICES,
})
},
fastGasPrice: (state) => {
return toHex(toWei(state.fast.toString(), 'gwei'))

View File

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

View File

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

View File

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

View File

@ -7,6 +7,10 @@ export const getters = {
const { explorerUrl } = rootGetters['provider/getNetwork']
return explorerUrl.tx + txHash
},
addressExplorerUrl: (state, getters, rootState, rootGetters) => (address) => {
const { explorerUrl } = rootGetters['provider/getNetwork']
return explorerUrl.address + address
},
}
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"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
gas-price-oracle@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.2.2.tgz#32c57a9aa6bc69152be96812880232efebfecbc6"
integrity sha512-I4+rLbc7C1vgYXV+cYY0MKeqdZVna2hXpNfD2fcIvf/wIgvtIYmG9gsmhiaYGSgOE2RSPUs2xf/W4K2nJOoNuQ==
gas-price-oracle@^0.3.2:
version "0.3.3"
resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.3.3.tgz#25a478d406263961af740dbfa314e053d334ed0f"
integrity sha512-euMl8Q42pigzpNvl95XvsRE41huNmTcFaGR7FO2fI0Kutu51c2Toh78B6sPrKhgOHQmoCyokj+jb0gDmxMxOwA==
dependencies:
axios "^0.19.2"
bignumber.js "^9.0.0"