WA-238 Do not redeploy master copies if the instances do not work
This commit is contained in:
parent
ad94d78ef9
commit
6e221dacdf
|
@ -1,6 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
import contract from 'truffle-contract'
|
import contract from 'truffle-contract'
|
||||||
import { promisify } from '~/utils/promisify'
|
|
||||||
import { ensureOnce } from '~/utils/singleton'
|
import { ensureOnce } from '~/utils/singleton'
|
||||||
import { getWeb3 } from '~/wallets/getWeb3'
|
import { getWeb3 } from '~/wallets/getWeb3'
|
||||||
import GnosisSafeSol from '#/GnosisSafeTeamEdition.json'
|
import GnosisSafeSol from '#/GnosisSafeTeamEdition.json'
|
||||||
|
@ -65,40 +64,22 @@ export const getCreateDailyLimitExtensionContract = ensureOnce(createDailyLimitE
|
||||||
|
|
||||||
const createMasterCopies = async () => {
|
const createMasterCopies = async () => {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
const accounts = await promisify(cb => web3.eth.getAccounts(cb))
|
|
||||||
const userAccount = accounts[0]
|
|
||||||
|
|
||||||
// Create ProxyFactory Master Copy
|
// Create ProxyFactory Master Copy
|
||||||
const ProxyFactory = getCreateProxyFactoryContract(web3)
|
const ProxyFactory = getCreateProxyFactoryContract(web3)
|
||||||
try {
|
proxyFactoryMaster = await ProxyFactory.deployed()
|
||||||
proxyFactoryMaster = await ProxyFactory.deployed()
|
|
||||||
} catch (err) {
|
|
||||||
proxyFactoryMaster = await ProxyFactory.new({ from: userAccount, gas: '5000000' })
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create AddExtension Master Copy
|
// Create AddExtension Master Copy
|
||||||
const CreateAndAddExtension = getCreateAddExtensionContract(web3)
|
const CreateAndAddExtension = getCreateAddExtensionContract(web3)
|
||||||
try {
|
createAndAddModuleMaster = await CreateAndAddExtension.deployed()
|
||||||
createAndAddModuleMaster = await CreateAndAddExtension.deployed()
|
|
||||||
} catch (err) {
|
|
||||||
createAndAddModuleMaster = await CreateAndAddExtension.new({ from: userAccount, gas: '5000000' })
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize safe master copy
|
// Initialize safe master copy
|
||||||
const GnosisSafe = getGnosisSafeContract(web3)
|
const GnosisSafe = getGnosisSafeContract(web3)
|
||||||
try {
|
safeMaster = await GnosisSafe.deployed()
|
||||||
safeMaster = await GnosisSafe.deployed()
|
|
||||||
} catch (err) {
|
|
||||||
safeMaster = await GnosisSafe.new([userAccount], 1, 0, 0, { from: userAccount, gas: '5000000' })
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize extension master copy
|
// Initialize extension master copy
|
||||||
const DailyLimitExtension = getCreateDailyLimitExtensionContract(web3)
|
const DailyLimitExtension = getCreateDailyLimitExtensionContract(web3)
|
||||||
try {
|
dailyLimitMaster = await DailyLimitExtension.deployed()
|
||||||
dailyLimitMaster = await DailyLimitExtension.deployed()
|
|
||||||
} catch (err) {
|
|
||||||
dailyLimitMaster = await DailyLimitExtension.new([], [], { from: userAccount, gas: '5000000' })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initContracts = ensureOnce(createMasterCopies)
|
export const initContracts = ensureOnce(createMasterCopies)
|
||||||
|
|
Loading…
Reference in New Issue