mirror of
https://github.com/tornadocash/tornado-initiation-ui.git
synced 2024-11-22 01:26:51 +01:00
xDai
This commit is contained in:
parent
2bcadbb351
commit
953bced312
@ -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" rel="noreferrer">
|
||||
{{ $t('info') }}
|
||||
</b-navbar-item>
|
||||
</template>
|
||||
|
@ -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>
|
||||
|
@ -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 xDAI Chain.",
|
||||
"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"
|
||||
"xDaiOnly": "Please switch your wallet to xDAI Chain",
|
||||
"switchNetwork": "Switch to xDAI"
|
||||
}
|
||||
|
@ -1,18 +1,22 @@
|
||||
const networkConfig = {
|
||||
netId56: {
|
||||
netId100: {
|
||||
rpcCallRetryAttempt: 15,
|
||||
gasPrices: { instant: 21, fast: 5, standard: 5, low: 5 },
|
||||
currencyName: 'BNB',
|
||||
explorerUrl: {
|
||||
tx: 'https://bscscan.com/tx/',
|
||||
address: 'https://bscscan.com/address/',
|
||||
gasPrices: {
|
||||
instant: 5,
|
||||
fast: 4,
|
||||
standard: 3,
|
||||
low: 1,
|
||||
},
|
||||
networkName: 'bsc',
|
||||
currencyName: 'xDAI',
|
||||
explorerUrl: {
|
||||
tx: 'https://blockscout.com/xdai/mainnet/tx/',
|
||||
address: 'https://blockscout.com/xdai/mainnet/address/',
|
||||
},
|
||||
networkName: 'xdai',
|
||||
rpcUrls: {
|
||||
Infura: {
|
||||
name: 'Infura',
|
||||
url:
|
||||
'https://wandering-sparkling-shadow.bsc.quiknode.pro/00115b17f97c1f4c374ac309858015da1cab3e02/',
|
||||
name: 'xDAI Chain RPC',
|
||||
url: 'https://rpc.xdaichain.com/tornado',
|
||||
},
|
||||
},
|
||||
pollInterval: 200,
|
||||
|
@ -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.4",
|
||||
"node-sass": "^4.14.1",
|
||||
"nuxt": "^2.14.6",
|
||||
"nuxt-buefy": "^0.4.4",
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1 class="title has-text-centered">
|
||||
Tornado.cash <span>BSC</span> Deployment
|
||||
Tornado.cash <span>xDAI</span> Deployment
|
||||
</h1>
|
||||
<h2 class="subtitle has-text-centered">{{ $t('pageSubtitle') }}</h2>
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -3,12 +3,11 @@ import { GasPriceOracle } from 'gas-price-oracle'
|
||||
import networkConfig from '@/networkConfig'
|
||||
const { toHex, toWei } = require('web3-utils')
|
||||
|
||||
const GAS_PRICES = networkConfig.netId100.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: 100,
|
||||
defaultRpc: currentRpc,
|
||||
defaultFallbackGasPrices: GAS_PRICES,
|
||||
})
|
||||
},
|
||||
fastGasPrice: (state) => {
|
||||
return toHex(toWei(state.fast.toString(), 'gwei'))
|
||||
|
@ -1,5 +1,6 @@
|
||||
import networkConfig from '@/networkConfig'
|
||||
import { localStorage } from '@/utillites'
|
||||
import { numberToHex } from 'web3-utils'
|
||||
import {
|
||||
SET_ACCOUNT,
|
||||
SET_NETWORK,
|
||||
@ -13,20 +14,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 !== '0x64') {
|
||||
await dispatch(
|
||||
'notice/addNotice',
|
||||
{
|
||||
notice: {
|
||||
title: 'bscOnly',
|
||||
title: 'xDaiOnly',
|
||||
type: 'danger',
|
||||
callback: () => dispatch('addNetwork', { netId: 56 }),
|
||||
callback: () => dispatch('switchNetwork', { netId: 100 }),
|
||||
message: 'switchNetwork',
|
||||
},
|
||||
},
|
||||
{ root: true }
|
||||
)
|
||||
throw new Error('Connect to BSC')
|
||||
throw new Error('Connect to xDai')
|
||||
}
|
||||
|
||||
commit(SET_PROVIDER_NAME, name)
|
||||
@ -95,18 +96,33 @@ export default {
|
||||
throw new Error(err.message)
|
||||
}
|
||||
},
|
||||
async switchNetwork({ dispatch }, { netId }) {
|
||||
try {
|
||||
await this.$provider.sendRequest({
|
||||
method: 'wallet_switchEthereumChain',
|
||||
params: [{ chainId: numberToHex(netId) }],
|
||||
})
|
||||
} catch (err) {
|
||||
// This error indicates that the chain has not been added to MetaMask.
|
||||
if (err.message.includes('wallet_addEthereumChain')) {
|
||||
return dispatch('addNetwork', { netId })
|
||||
}
|
||||
|
||||
throw new Error(err.message)
|
||||
}
|
||||
},
|
||||
async addNetwork(_, { netId }) {
|
||||
const METAMASK_LIST = {
|
||||
56: {
|
||||
chainId: '0x38',
|
||||
chainName: 'Binance Smart Chain',
|
||||
rpcUrls: ['https://bsc-dataseed1.ninicoin.io'],
|
||||
100: {
|
||||
chainId: '0x64',
|
||||
chainName: 'xDAI Chain',
|
||||
rpcUrls: ['https://rpc.xdaichain.com'],
|
||||
nativeCurrency: {
|
||||
name: 'Binance Chain Native Token',
|
||||
symbol: 'BNB',
|
||||
name: 'xDAI',
|
||||
symbol: 'xDAI',
|
||||
decimals: 18,
|
||||
},
|
||||
blockExplorerUrls: ['https://bscscan.com'],
|
||||
blockExplorerUrls: ['https://blockscout.com/xdai/mainnet'],
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
export default () => ({
|
||||
account: null,
|
||||
network: {
|
||||
name: 'binance',
|
||||
id: 56,
|
||||
name: 'xdai',
|
||||
id: 100,
|
||||
},
|
||||
provider: {
|
||||
name: '',
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
import Web3 from 'web3'
|
||||
import deploymentActions from '../static/deploymentActions.json'
|
||||
|
||||
const state = () => {
|
||||
@ -41,41 +40,24 @@ const mutations = {
|
||||
const actions = {
|
||||
async fetchDeploymentStatus({ state, dispatch, commit, rootGetters }) {
|
||||
const deployContract = rootGetters['deploy/deployerContract'](false)
|
||||
const web3 = new Web3(rootGetters['provider/getNetwork'].rpcUrls.Infura.url)
|
||||
const code = await web3.eth.getCode(deployContract._address)
|
||||
if (code === '0x') {
|
||||
return
|
||||
}
|
||||
const events = await deployContract.getPastEvents('Deployed', {
|
||||
fromBlock: 0,
|
||||
toBlock: 'latest',
|
||||
})
|
||||
|
||||
const latestBlock = await web3.eth.getBlock('latest')
|
||||
let number = latestBlock.number
|
||||
let events = []
|
||||
while (true) {
|
||||
const fromBlock = number - 4500
|
||||
events = await deployContract.getPastEvents('Deployed', {
|
||||
fromBlock,
|
||||
toBlock: number,
|
||||
})
|
||||
number = fromBlock
|
||||
if (events.length > 0) {
|
||||
for (const event of events) {
|
||||
const step = state.steps.find(
|
||||
(s) => s.expectedAddress === event.returnValues.addr
|
||||
)
|
||||
for (const event of events) {
|
||||
const step = state.steps.find(
|
||||
(s) => s.expectedAddress === event.returnValues.addr
|
||||
)
|
||||
|
||||
if (!step) {
|
||||
continue
|
||||
}
|
||||
commit(SET_DEPLOYER, {
|
||||
stepIndex: state.steps.indexOf(step),
|
||||
deployerAddress: event.returnValues.sender,
|
||||
deployTransaction: event.transactionHash,
|
||||
})
|
||||
}
|
||||
if (events[0].returnValues.addr === deployContract._address) {
|
||||
break
|
||||
}
|
||||
if (!step) {
|
||||
continue
|
||||
}
|
||||
commit(SET_DEPLOYER, {
|
||||
stepIndex: state.steps.indexOf(step),
|
||||
deployerAddress: event.returnValues.sender,
|
||||
deployTransaction: event.transactionHash,
|
||||
})
|
||||
}
|
||||
},
|
||||
statusPooling({ dispatch }) {
|
||||
|
@ -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 = {
|
||||
|
@ -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.4:
|
||||
version "0.3.4"
|
||||
resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.3.4.tgz#c98f6e24cf4bea96be2fe85383d53601b2ab5761"
|
||||
integrity sha512-bba9zWd2hQ32AuPFDzL8E5QxAzXNfGKR1UZCa14fSYJWc9yo3k7wabITMkGEv0cbKpHmyK/kHhhDTBtugI6eAg==
|
||||
dependencies:
|
||||
axios "^0.19.2"
|
||||
bignumber.js "^9.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user