mirror of
https://github.com/tornadocash/tornado-initiation-ui.git
synced 2024-11-22 17:40:04 +01:00
171 lines
4.8 KiB
JavaScript
171 lines
4.8 KiB
JavaScript
/* eslint-disable no-console */
|
|
import Web3 from 'web3'
|
|
import deploymentActions from '../static/deploymentActions.json'
|
|
|
|
const state = () => {
|
|
return {
|
|
steps: [
|
|
{
|
|
title: 'TORN token',
|
|
domain: 'torn.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
},
|
|
{
|
|
title: 'Governance Implementation',
|
|
domain: 'governance-impl.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
},
|
|
{
|
|
title: 'Governance Upgradable Proxy',
|
|
domain: 'governance.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: 'tree-update-verifier.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
},
|
|
{
|
|
title: 'Anonymity mining: Swap contract for private points',
|
|
domain: 'reward-swap.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
},
|
|
{
|
|
title: 'Poseidon hasher for two arguments',
|
|
domain: 'poseidon2.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
},
|
|
{
|
|
title: 'Poseidon hasher for three arguments',
|
|
domain: 'poseidon3.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
},
|
|
{
|
|
title: 'A proxy contract for ETH Tornado.cash instances',
|
|
domain: 'tornado-proxy.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
},
|
|
{
|
|
title: 'Anonymity mining: TornadoTrees contract',
|
|
domain: 'tornado-trees.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
},
|
|
{
|
|
title: 'Anonymity mining: Miner contract',
|
|
domain: 'mining-v2.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-v3.vesting.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
title: 'Vesting for the future anonymity mining (V3 release)',
|
|
},
|
|
{
|
|
domain: 'governance.vesting.deploy.tornadocash.eth',
|
|
deployerAddress: null,
|
|
title: 'Vesting for the governance itself',
|
|
},
|
|
],
|
|
}
|
|
}
|
|
|
|
const getters = {
|
|
deployedCount: (state) => {
|
|
const deployed = state.steps.filter((step) => {
|
|
return !!step.deployerAddress
|
|
}).length
|
|
const all = state.steps.length
|
|
return `${deployed}/${all}`
|
|
},
|
|
}
|
|
|
|
const SET_DEPLOYER = 'SET_DEPLOYER'
|
|
const mutations = {
|
|
[SET_DEPLOYER](state, { stepIndex, deployerAddress }) {
|
|
this._vm.$set(state.steps[stepIndex], 'deployerAddress', deployerAddress)
|
|
},
|
|
}
|
|
|
|
const actions = {
|
|
async fetchDeploymentStatus({ state, dispatch, commit, rootGetters }) {
|
|
// const deployContract = rootGetters['deploy/deployerContract']
|
|
// const events = await deployContract.getPastEvents('Deployed', {
|
|
// // filter: {
|
|
// // addr: ['0xd51154a046d2af2c572e850a4ed5bd65db2d83f0'],
|
|
// // },
|
|
// fromBlock: 21895260,
|
|
// toBlock: 'latest',
|
|
// })
|
|
// console.log('events', events)
|
|
const { rpcUrls } = rootGetters['provider/getNetwork']
|
|
const web3 = new Web3(rpcUrls.Infura.url)
|
|
|
|
try {
|
|
for (const [stepIndex, step] of state.steps.entries()) {
|
|
const { expectedAddress } = deploymentActions.actions.find((action) => {
|
|
return action.domain === step.domain
|
|
})
|
|
|
|
const code = await web3.eth.getCode(expectedAddress)
|
|
|
|
if (code !== '0x') {
|
|
// todo collect deployerAddress from chain
|
|
commit(SET_DEPLOYER, {
|
|
stepIndex,
|
|
deployerAddress: '0x03Ebd0748Aa4D1457cF479cce56309641e0a98F5',
|
|
})
|
|
}
|
|
}
|
|
} catch (e) {
|
|
console.error('fetchDeploymentStatus', e.message)
|
|
}
|
|
},
|
|
}
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
getters,
|
|
mutations,
|
|
actions,
|
|
}
|