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 /> <Logo />
</b-navbar-item> </b-navbar-item>
</template> </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"> <template slot="end">
<b-navbar-item tag="div"> <b-navbar-item tag="div">
<div class="buttons"> <div class="buttons">

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

View File

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

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>Arbitrum</span> Deployment Tornado.cash <span>Optimism</span> Deployment
</h1> </h1>
<h2 class="subtitle has-text-centered">{{ $t('pageSubtitle') }}</h2> <h2 class="subtitle has-text-centered">{{ $t('pageSubtitle') }}</h2>

View File

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

View File

@ -3,7 +3,7 @@ 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.netId42161.gasPrices const GAS_PRICES = networkConfig.netId10.gasPrices
export const state = () => { export const state = () => {
return { return {
@ -17,7 +17,7 @@ export const getters = {
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({ return new GasPriceOracle({
chainId: 42161, chainId: 10,
defaultRpc: currentRpc, defaultRpc: currentRpc,
defaultFallbackGasPrices: GAS_PRICES, defaultFallbackGasPrices: GAS_PRICES,
}) })

View File

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

View File

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