WA-238 Updating code to new safe-contracts version
This commit is contained in:
parent
7b969675d7
commit
3c740c0dbb
|
@ -87,7 +87,7 @@
|
|||
"storybook-host": "^4.1.5",
|
||||
"storybook-router": "^0.3.3",
|
||||
"style-loader": "^0.20.2",
|
||||
"truffle": "4.1.5",
|
||||
"truffle": "4.1.8",
|
||||
"truffle-contract": "^1.1.8",
|
||||
"truffle-solidity-loader": "0.0.8",
|
||||
"uglifyjs-webpack-plugin": "^1.2.2",
|
||||
|
|
|
@ -9,24 +9,21 @@ const withdrawn = async (values: Object, safeAddress: string, userAccount: strin
|
|||
const web3 = getWeb3()
|
||||
const gnosisSafe = getGnosisSafeContract(web3).at(safeAddress)
|
||||
|
||||
const extensions = await gnosisSafe.getExtensions()
|
||||
const dailyAddress = extensions[0]
|
||||
const dailyLimitExtension = getCreateDailyLimitExtensionContract(web3).at(dailyAddress)
|
||||
if (await dailyLimitExtension.gnosisSafe() !== gnosisSafe.address) {
|
||||
const modules = await gnosisSafe.getModules()
|
||||
const dailyAddress = modules[0]
|
||||
|
||||
const dailyLimitModule = getCreateDailyLimitExtensionContract(web3).at(dailyAddress)
|
||||
if (await dailyLimitModule.manager.call() !== gnosisSafe.address) {
|
||||
throw new Error('Using an extension of different safe')
|
||||
}
|
||||
|
||||
const destination = values[DESTINATION_PARAM]
|
||||
const value = web3.toWei(values[VALUE_PARAM], 'ether')
|
||||
|
||||
const CALL = 0
|
||||
|
||||
await gnosisSafe.executeExtension(
|
||||
await dailyLimitModule.executeDailyLimit(
|
||||
destination,
|
||||
value,
|
||||
0,
|
||||
CALL,
|
||||
dailyLimitExtension.address,
|
||||
{ from: userAccount, gas: '5000000' },
|
||||
)
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@ import contract from 'truffle-contract'
|
|||
import { promisify } from '~/utils/promisify'
|
||||
import { ensureOnce } from '~/utils/singleton'
|
||||
import { getWeb3 } from '~/wallets/getWeb3'
|
||||
import GnosisSafeSol from '#/GnosisSafe.json'
|
||||
import GnosisSafeSol from '#/GnosisSafeTeamEdition.json'
|
||||
import ProxyFactorySol from '#/ProxyFactory.json'
|
||||
import CreateAndAddExtensionSol from '#/CreateAndAddExtension.json'
|
||||
import DailyLimitExtensionSol from '#/DailyLimitExtension.json'
|
||||
import CreateAndAddModule from '#/CreateAndAddModule.json'
|
||||
import DailyLimitModule from '#/DailyLimitModule.json'
|
||||
|
||||
let proxyFactoryMaster
|
||||
let createAndAddExtensionMaster
|
||||
|
@ -28,17 +28,17 @@ const createProxyFactoryContract = (web3: any) => {
|
|||
}
|
||||
|
||||
const createAddExtensionContract = (web3: any) => {
|
||||
const createAndAddExtension = contract(CreateAndAddExtensionSol)
|
||||
createAndAddExtension.setProvider(web3.currentProvider)
|
||||
const createAndAddModule = contract(CreateAndAddModule)
|
||||
createAndAddModule.setProvider(web3.currentProvider)
|
||||
|
||||
return createAndAddExtension
|
||||
return createAndAddModule
|
||||
}
|
||||
|
||||
const createDailyLimitExtensionContract = (web3: any) => {
|
||||
const dailyLimitExtension = contract(DailyLimitExtensionSol)
|
||||
dailyLimitExtension.setProvider(web3.currentProvider)
|
||||
const dailyLimitModule = contract(DailyLimitModule)
|
||||
dailyLimitModule.setProvider(web3.currentProvider)
|
||||
|
||||
return dailyLimitExtension
|
||||
return dailyLimitModule
|
||||
}
|
||||
|
||||
export const getGnosisSafeContract = ensureOnce(createGnosisSafeContract)
|
||||
|
@ -88,11 +88,14 @@ export const initContracts = ensureOnce(createMasterCopies)
|
|||
|
||||
const getSafeDataBasedOn = async (accounts, numConfirmations, dailyLimitInEth) => {
|
||||
const web3 = getWeb3()
|
||||
const extensionData = await dailyLimitMaster.contract.setup
|
||||
|
||||
const moduleData = await dailyLimitMaster.contract.setup
|
||||
.getData([0], [web3.toWei(dailyLimitInEth, 'ether')])
|
||||
|
||||
const proxyFactoryData = await proxyFactoryMaster.contract.createProxy
|
||||
.getData(dailyLimitMaster.address, extensionData)
|
||||
const createAndAddExtensionData = createAndAddExtensionMaster.contract.createAndAddExtension
|
||||
.getData(dailyLimitMaster.address, moduleData)
|
||||
|
||||
const createAndAddExtensionData = createAndAddExtensionMaster.contract.createAndAddModule
|
||||
.getData(proxyFactoryMaster.address, proxyFactoryData)
|
||||
|
||||
return safeMaster.contract.setup
|
||||
|
|
24
yarn.lock
24
yarn.lock
|
@ -10477,9 +10477,9 @@ sockjs@0.3.19:
|
|||
faye-websocket "^0.10.0"
|
||||
uuid "^3.0.1"
|
||||
|
||||
solc@0.4.21, solc@^0.4.2:
|
||||
version "0.4.21"
|
||||
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.21.tgz#6a7ecd505bfa0fc268330d5de6b9ae65c8c68264"
|
||||
solc@0.4.23:
|
||||
version "0.4.23"
|
||||
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.23.tgz#54a0ff4015827b32fddb62c0a418b5247310a58e"
|
||||
dependencies:
|
||||
fs-extra "^0.30.0"
|
||||
memorystream "^0.3.1"
|
||||
|
@ -10505,6 +10505,16 @@ solc@^0.3.6:
|
|||
require-from-string "^1.1.0"
|
||||
yargs "^4.7.1"
|
||||
|
||||
solc@^0.4.2:
|
||||
version "0.4.21"
|
||||
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.21.tgz#6a7ecd505bfa0fc268330d5de6b9ae65c8c68264"
|
||||
dependencies:
|
||||
fs-extra "^0.30.0"
|
||||
memorystream "^0.3.1"
|
||||
require-from-string "^1.1.0"
|
||||
semver "^5.3.0"
|
||||
yargs "^4.7.1"
|
||||
|
||||
solidity-parser@^0.1.0, solidity-parser@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/solidity-parser/-/solidity-parser-0.1.1.tgz#0fb3b665ed7041bef4575962ee426e7cd9d0a90a"
|
||||
|
@ -11252,13 +11262,13 @@ truffle-solidity-loader@0.0.8:
|
|||
truffle "^2.0.8"
|
||||
web3 "^0.17.0-alpha"
|
||||
|
||||
truffle@4.1.5:
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/truffle/-/truffle-4.1.5.tgz#763c8175fe5ea1ada92aa7a02eff84b4ab272f72"
|
||||
truffle@4.1.8:
|
||||
version "4.1.8"
|
||||
resolved "https://registry.yarnpkg.com/truffle/-/truffle-4.1.8.tgz#b0b9175e0270145999567a3f0a2337c914a23a9c"
|
||||
dependencies:
|
||||
mocha "^3.4.2"
|
||||
original-require "^1.0.1"
|
||||
solc "0.4.21"
|
||||
solc "0.4.23"
|
||||
|
||||
truffle@^2.0.8:
|
||||
version "2.1.2"
|
||||
|
|
Loading…
Reference in New Issue