WA-521 Use Personal Safe contract in case we use signatures validation via provider

This commit is contained in:
apanizo 2018-08-22 13:41:48 +02:00
parent 9d1098295a
commit b1c281b6d2
1 changed files with 9 additions and 1 deletions

View File

@ -4,10 +4,12 @@ import { ensureOnce } from '~/utils/singleton'
import { getWeb3 } from '~/logic/wallets/getWeb3' import { getWeb3 } from '~/logic/wallets/getWeb3'
import { promisify } from '~/utils/promisify' import { promisify } from '~/utils/promisify'
import GnosisSafeSol from '#/GnosisSafeTeamEdition.json' import GnosisSafeSol from '#/GnosisSafeTeamEdition.json'
import GnosisPersonalSafeSol from '#/GnosisSafePersonalEdition.json'
import ProxyFactorySol from '#/ProxyFactory.json' import ProxyFactorySol from '#/ProxyFactory.json'
import CreateAndAddModules from '#/CreateAndAddModules.json' import CreateAndAddModules from '#/CreateAndAddModules.json'
import DailyLimitModule from '#/DailyLimitModule.json' import DailyLimitModule from '#/DailyLimitModule.json'
import { calculateGasOf, calculateGasPrice, EMPTY_DATA } from '~/logic/wallets/ethTransactions' import { calculateGasOf, calculateGasPrice, EMPTY_DATA } from '~/logic/wallets/ethTransactions'
import { signaturesViaMetamask } from '~/config'
let proxyFactoryMaster let proxyFactoryMaster
let createAndAddModuleMaster let createAndAddModuleMaster
@ -30,8 +32,14 @@ function createAndAddModulesData(dataArray) {
return dataArray.reduce((acc, data) => acc + mw.setup.getData(data).substr(74), EMPTY_DATA) return dataArray.reduce((acc, data) => acc + mw.setup.getData(data).substr(74), EMPTY_DATA)
} }
const createGnosisSafeContract = (web3: any) => { const createGnosisSafeContract = (web3: any) => {
if (signaturesViaMetamask()) {
const gnosisSafe = contract(GnosisPersonalSafeSol)
gnosisSafe.setProvider(web3.currentProvider)
return gnosisSafe
}
const gnosisSafe = contract(GnosisSafeSol) const gnosisSafe = contract(GnosisSafeSol)
gnosisSafe.setProvider(web3.currentProvider) gnosisSafe.setProvider(web3.currentProvider)