This commit is contained in:
Danil Kovtonyuk 2021-12-29 21:53:05 +10:00
parent ad02c432a3
commit 8bf66cbc7a
No known key found for this signature in database
GPG Key ID: E72A919BF08C3746
8 changed files with 44 additions and 57 deletions

View File

@ -5,16 +5,6 @@
<Logo />
</b-navbar-item>
</template>
<template slot="start">
<b-navbar-item
href="https://medium.com/@tornado-cash/tornado-cash-deployment-proposal-on-arbitrum-fb02e508fe74"
target="_blank"
class="decorate"
rel="noreferrer"
>
{{ $t('info') }}
</b-navbar-item>
</template>
<template slot="end">
<b-navbar-item tag="div">
<div class="buttons">

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 Aribtrum One.",
"pageSubtitle": "Follow these simple steps to become part of deployment of Tornado.Cash protocol on Optimism.",
"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}",
"arbitrumOnly": "Please switch your wallet to Arbitrum One",
"switchNetwork": "Switch to Arbitrum"
"optimismOnly": "Please switch your wallet to Optimism",
"switchNetwork": "Switch to Optimism"
}

View File

@ -1,5 +1,5 @@
const networkConfig = {
netId42161: {
netId10: {
rpcCallRetryAttempt: 15,
gasPrices: {
instant: 4,
@ -9,15 +9,15 @@ const networkConfig = {
},
currencyName: 'ETH',
explorerUrl: {
tx: 'https://arbiscan.io/tx/',
address: 'https://arbiscan.io/address/',
tx: 'https://optimistic.etherscan.io/tx/',
address: 'https://optimistic.etherscan.io/address/',
},
networkName: 'arbitrum',
networkName: 'optimism',
rpcUrls: {
Infura: {
name: 'Arbitrum Public RPC',
name: 'Optimism RPC',
url:
'https://arb-mainnet.g.alchemy.com/v2/_82R9fXSpgWH9iv_oKdwKww7qMyJ6OpR',
'https://opt-mainnet.g.alchemy.com/v2/6gdxilsHZ0gV2da6mV7grCHRrZAa0jms',
},
},
pollInterval: 15,

View File

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

View File

@ -55,38 +55,35 @@ const actions = {
.deployerContract(isProxy)
.methods.deploy(action.bytecode, deploymentActions.salt)
.encodeABI()
const callParamsEstimate = {
method: 'eth_estimateGas',
params: [
{
from: ethAccount,
to: getters.deployerContract(isProxy)._address,
// gas: numberToHex(6e6),
gasPrice,
value: `0x0`,
data,
},
],
const params = {
from: ethAccount,
to: getters.deployerContract(isProxy)._address,
value: '0x0',
data,
}
const gasEstimate = await dispatch(
'provider/sendRequest',
callParamsEstimate,
{
root: true,
}
)
const gasEstimate = isProxy
? numberToHex(363636)
: await dispatch(
'provider/sendRequest',
{
method: 'eth_estimateGas',
params: [params],
from: ethAccount,
},
{
root: true,
}
)
const gasWithBuffer = Math.ceil(hexToNumber(gasEstimate) * 1.1)
const callParams = {
method: 'eth_sendTransaction',
params: [
{
from: ethAccount,
to: getters.deployerContract(isProxy)._address,
...params,
gas: numberToHex(gasWithBuffer),
gasPrice,
value: 0,
data,
},
],
from: ethAccount,

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.netId42161.gasPrices
const GAS_PRICES = networkConfig.netId10.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: 42161,
chainId: 10,
defaultRpc: currentRpc,
defaultFallbackGasPrices: GAS_PRICES,
})

View File

@ -14,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 !== '0xa4b1') {
if (window.ethereum.chainId !== '0xa') {
await dispatch(
'notice/addNotice',
{
notice: {
title: 'arbitrumOnly',
title: 'optimismOnly',
type: 'danger',
callback: () => dispatch('switchNetwork', { netId: 42161 }),
callback: () => dispatch('switchNetwork', { netId: 10 }),
message: 'switchNetwork',
},
},
{ root: true }
)
throw new Error('Connect to Arbitrum')
throw new Error('Connect to Optimism')
}
commit(SET_PROVIDER_NAME, name)
@ -119,16 +119,16 @@ export default {
},
async addNetwork(_, { netId }) {
const METAMASK_LIST = {
42161: {
chainId: '0xA4B1',
chainName: 'Arbitrum One',
rpcUrls: ['https://arb1.arbitrum.io/rpc'],
10: {
chainId: '0xa',
chainName: 'Optimistic Ethereum',
rpcUrls: ['https://mainnet.optimism.io/'],
nativeCurrency: {
name: 'Ether',
symbol: 'AETH',
symbol: 'OETH',
decimals: 18,
},
blockExplorerUrls: ['https://arbiscan.io'],
blockExplorerUrls: ['https://optimistic.etherscan.io'],
},
}

View File

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