steps data

This commit is contained in:
Alexey 2020-10-21 22:45:22 +03:00
parent db5f1b42fa
commit b6335e0579
6 changed files with 166 additions and 77 deletions

View File

@ -1,14 +1,14 @@
<template>
<div class="step">
<diamond :active="!!data.deployAddress" />
<diamond :active="!!data.deployerAddress" />
<div class="step-body">
<h4>{{ data.title }}</h4>
<div v-if="data.deployAddress" class="deployed">
Deployed by: <a href="#">{{ data.deployAddress }}</a>
<div v-if="data.deployerAddress" class="deployed">
Deployed by: <a href="#">{{ data.deployerAddress }}</a>
</div>
</div>
<div class="step-tail">
<div v-if="data.deployAddress" class="completed">
<div v-if="data.deployerAddress" class="completed">
<b-icon icon="check" />
<span>Completed</span>
</div>

View File

@ -6,58 +6,14 @@
<script>
import Step from '@/components/Step'
import { mapState } from 'vuex'
export default {
components: {
Step,
},
data() {
return {
steps: [
{ title: 'But I must explain to you how all this mistaken idea' },
{
title:
'Nor again is there anyone who loves or pursues or desires to obtain',
deployAddress: '0xf7a526d8642f6c6cb98bcda9919209d3c1ce359e',
},
{ title: 'But I must explain to you how all this mistaken idea' },
{
title:
'Nor again is there anyone who loves or pursues or desires to obtain',
deployAddress: '0xf7a526d8642f6c6cb98bcda9919209d3c1ce359e',
},
{ title: 'But I must explain to you how all this mistaken idea' },
{
title:
'Nor again is there anyone who loves or pursues or desires to obtain',
deployAddress: '0xf7a526d8642f6c6cb98bcda9919209d3c1ce359e',
},
{ title: 'But I must explain to you how all this mistaken idea' },
{
title:
'Nor again is there anyone who loves or pursues or desires to obtain',
deployAddress: '0xf7a526d8642f6c6cb98bcda9919209d3c1ce359e',
},
{ title: 'But I must explain to you how all this mistaken idea' },
{
title:
'Nor again is there anyone who loves or pursues or desires to obtain',
deployAddress: '0xf7a526d8642f6c6cb98bcda9919209d3c1ce359e',
},
{ title: 'But I must explain to you how all this mistaken idea' },
{
title:
'Nor again is there anyone who loves or pursues or desires to obtain',
deployAddress: '0xf7a526d8642f6c6cb98bcda9919209d3c1ce359e',
},
{ title: 'But I must explain to you how all this mistaken idea' },
{
title:
'Nor again is there anyone who loves or pursues or desires to obtain',
deployAddress: '0xf7a526d8642f6c6cb98bcda9919209d3c1ce359e',
},
],
}
computed: {
...mapState('steps', ['steps']),
},
}
</script>

View File

@ -19,9 +19,11 @@ export default {
},
mounted() {
this.initProvider()
this.fetchDeploymentStatus()
},
methods: {
...mapActions('provider', ['initProvider']),
...mapActions('steps', ['fetchDeploymentStatus']),
},
}
</script>

File diff suppressed because one or more lines are too long

View File

@ -25,24 +25,30 @@ const actions = {
) {
try {
const ethAccount = rootGetters['provider/getAccount']
const web3 = rootGetters['provider/getWeb3']
const { salt } = deploymentActions
const { bytecode } = deploymentActions.actions.filter((action) => {
return action.domain === domain
})[0]
const { bytecode, expectedAddress } = deploymentActions.actions.filter(
(action) => {
return action.domain === domain
}
)[0]
const code = await web3.eth.getCode(expectedAddress)
if (code !== '0x') {
throw new Error('Already deployed')
}
const data = getters.deployerContract.methods
.deploy(bytecode, salt)
.encodeABI()
const gas = await getters.deployerContract.methods
.deploy(bytecode, salt)
.estimateGas({ from: ethAccount })
const callParams = {
method: 'eth_sendTransaction',
params: [
{
from: ethAccount,
to: getters.deployerContract.address,
gas: numberToHex(gas + 100000),
to: getters.deployerContract._address,
gas: numberToHex(6e6),
gasPrice: '0x100000000',
value: 0,
data,

125
store/steps.js Normal file
View File

@ -0,0 +1,125 @@
/* eslint-disable no-console */
const state = () => {
return {
steps: [
{
title: 'TORN token',
domain: 'torn.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Governance Implementation',
domain: 'governanceImpl.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Governance Upgradable Proxy',
domain: 'gov.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Anonymity mining: Verifier (1/3)',
domain: 'reward.verifier.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Anonymity mining: Verifier (2/3)',
domain: 'withdraw.verifier.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Anonymity mining: Verifier (3/3)',
domain: 'treeUpdate.verifier.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Anonymity mining: Swap contract for private points',
domain: 'swap.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Anonymity mining: TornadoTrees contract',
domain: 'tornadoTrees.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Anonymity mining: Miner contract',
domain: 'miningV2.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Airdrop contract',
domain: 'voucher.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Team vestings (1/5)',
domain: 'team1.vesting.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Team vestings (2/5)',
domain: 'team2.vesting.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Team vestings (3/5)',
domain: 'team2.vesting.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Team vestings (4/5)',
domain: 'team2.vesting.deploy.tornadocash.eth',
deployerAddress: null,
},
{
title: 'Team vestings (5/5)',
domain: 'team2.vesting.deploy.tornadocash.eth',
deployerAddress: null,
},
{
domain: 'mining.vesting.deploy.tornadocash.eth',
deployerAddress: null,
title: 'Vesting for the future anonymity mining (V3 release)',
},
{
domain: 'gov.vesting.deploy.tornadocash.eth',
deployerAddress: null,
title: 'Vesting for the governance itself',
},
],
}
}
const getters = {}
const SET_DEPLOYER = 'SET_DEPLOYER'
const mutations = {
[SET_DEPLOYER](state, { stepIndex, deployerAddress }) {
console.log('SET_DEPLOYER', stepIndex, deployerAddress)
console.log('state.steps[stepIndex]', state.steps[stepIndex])
this._vm.$set(state.steps[stepIndex], 'deployerAddress', deployerAddress)
},
}
const actions = {
fetchDeploymentStatus({ state, dispatch, commit }) {
try {
// todo collect data from chain
commit(SET_DEPLOYER, {
stepIndex: 0,
deployerAddress: '0x03Ebd0748Aa4D1457cF479cce56309641e0a98F5',
})
} catch (e) {
console.error('fetchDeploymentStatus', e.message)
}
},
}
export default {
namespaced: true,
state,
getters,
mutations,
actions,
}