Unify and refactor gnosis safe instance functions
This commit is contained in:
parent
e4d2e3b35d
commit
2e2a7d906c
|
@ -75,7 +75,7 @@ export const deploySafeContract = async (safeAccounts: string[], numConfirmation
|
||||||
|
|
||||||
export const getGnosisSafeInstanceAt = async (safeAddress: string) => {
|
export const getGnosisSafeInstanceAt = async (safeAddress: string) => {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
const GnosisSafe = await getGnosisSafeContract(web3)
|
const GnosisSafe = getGnosisSafeContract(web3)
|
||||||
const gnosisSafe = await GnosisSafe.at(safeAddress)
|
const gnosisSafe = await GnosisSafe.at(safeAddress)
|
||||||
|
|
||||||
return gnosisSafe
|
return gnosisSafe
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { List } from 'immutable'
|
import { List } from 'immutable'
|
||||||
import { calculateGasOf, checkReceiptStatus, calculateGasPrice } from '~/logic/wallets/ethTransactions'
|
import { calculateGasOf, checkReceiptStatus, calculateGasPrice } from '~/logic/wallets/ethTransactions'
|
||||||
import { type Operation, submitOperation } from '~/logic/safe/safeTxHistory'
|
import { type Operation, submitOperation } from '~/logic/safe/safeTxHistory'
|
||||||
import { getSafeEthereumInstance } from '~/logic/safe/safeFrontendOperations'
|
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||||
import { buildSignaturesFrom } from '~/logic/safe/safeTxSigner'
|
import { buildSignaturesFrom } from '~/logic/safe/safeTxSigner'
|
||||||
import { generateMetamaskSignature, generateTxGasEstimateFrom, estimateDataGas } from '~/logic/safe/safeTxSignerEIP712'
|
import { generateMetamaskSignature, generateTxGasEstimateFrom, estimateDataGas } from '~/logic/safe/safeTxSignerEIP712'
|
||||||
import { storeSignature, getSignaturesFrom } from '~/utils/storage/signatures'
|
import { storeSignature, getSignaturesFrom } from '~/utils/storage/signatures'
|
||||||
|
@ -21,7 +21,7 @@ export const approveTransaction = async (
|
||||||
|
|
||||||
if (signaturesViaMetamask()) {
|
if (signaturesViaMetamask()) {
|
||||||
// return executeTransaction(safeAddress, to, valueInWei, data, operation, nonce, sender)
|
// return executeTransaction(safeAddress, to, valueInWei, data, operation, nonce, sender)
|
||||||
const safe = await getSafeEthereumInstance(safeAddress)
|
const safe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const txGasEstimate = await generateTxGasEstimateFrom(safe, safeAddress, data, to, valueInWei, operation)
|
const txGasEstimate = await generateTxGasEstimateFrom(safe, safeAddress, data, to, valueInWei, operation)
|
||||||
const signature = await generateMetamaskSignature(
|
const signature = await generateMetamaskSignature(
|
||||||
safe,
|
safe,
|
||||||
|
@ -39,7 +39,7 @@ export const approveTransaction = async (
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const contractTxHash = await gnosisSafe.getTransactionHash(to, valueInWei, data, operation, 0, 0, 0, 0, 0, nonce)
|
const contractTxHash = await gnosisSafe.getTransactionHash(to, valueInWei, data, operation, 0, 0, 0, 0, 0, nonce)
|
||||||
|
|
||||||
const approveData = gnosisSafe.contract.methods.approveHash(contractTxHash).encodeABI()
|
const approveData = gnosisSafe.contract.methods.approveHash(contractTxHash).encodeABI()
|
||||||
|
@ -67,7 +67,7 @@ export const executeTransaction = async (
|
||||||
const gasPrice = await calculateGasPrice()
|
const gasPrice = await calculateGasPrice()
|
||||||
|
|
||||||
if (signaturesViaMetamask()) {
|
if (signaturesViaMetamask()) {
|
||||||
const safe = await getSafeEthereumInstance(safeAddress)
|
const safe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const txGasEstimate = await generateTxGasEstimateFrom(safe, safeAddress, data, to, valueInWei, operation)
|
const txGasEstimate = await generateTxGasEstimateFrom(safe, safeAddress, data, to, valueInWei, operation)
|
||||||
const signature = await generateMetamaskSignature(
|
const signature = await generateMetamaskSignature(
|
||||||
safe,
|
safe,
|
||||||
|
@ -120,7 +120,7 @@ export const executeTransaction = async (
|
||||||
return txHash
|
return txHash
|
||||||
}
|
}
|
||||||
|
|
||||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const signatures = buildSignaturesFrom(ownersWhoHasSigned, sender)
|
const signatures = buildSignaturesFrom(ownersWhoHasSigned, sender)
|
||||||
const txExecutionData = gnosisSafe.contract.methods
|
const txExecutionData = gnosisSafe.contract.methods
|
||||||
.execTransaction(to, valueInWei, data, operation, 0, 0, 0, 0, 0, signatures)
|
.execTransaction(to, valueInWei, data, operation, 0, 0, 0, 0, 0, signatures)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { executeTransaction, approveTransaction } from '~/logic/safe/safeBlockch
|
||||||
import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
|
import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
|
||||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
||||||
import { type Safe } from '~/routes/safe/store/models/safe'
|
import { type Safe } from '~/routes/safe/store/models/safe'
|
||||||
import { getGnosisSafeContract } from '~/logic/contracts/safeContracts'
|
|
||||||
import { storeSubject } from '~/utils/storage/transactions'
|
import { storeSubject } from '~/utils/storage/transactions'
|
||||||
|
|
||||||
export const TX_NAME_PARAM = 'txName'
|
export const TX_NAME_PARAM = 'txName'
|
||||||
|
@ -23,13 +22,6 @@ const hasOneOwner = (safe: Safe) => {
|
||||||
return owners.count() === 1
|
return owners.count() === 1
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getSafeEthereumInstance = async (safeAddress: string) => {
|
|
||||||
const web3 = getWeb3()
|
|
||||||
const GnosisSafe = await getGnosisSafeContract(web3)
|
|
||||||
const safeInstance = await GnosisSafe.at(safeAddress)
|
|
||||||
return safeInstance
|
|
||||||
}
|
|
||||||
|
|
||||||
export const createTransaction = async (
|
export const createTransaction = async (
|
||||||
safe: Safe,
|
safe: Safe,
|
||||||
name: string,
|
name: string,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
||||||
import { getTxServiceUriFrom, getTxServiceHost } from '~/config'
|
import { getTxServiceUriFrom, getTxServiceHost } from '~/config'
|
||||||
import { getSafeEthereumInstance } from '~/logic/safe/safeFrontendOperations'
|
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||||
|
|
||||||
export type TxServiceType = 'confirmation' | 'execution' | 'initialised'
|
export type TxServiceType = 'confirmation' | 'execution' | 'initialised'
|
||||||
export type Operation = 0 | 1 | 2
|
export type Operation = 0 | 1 | 2
|
||||||
|
@ -17,7 +17,7 @@ const calculateBodyFrom = async (
|
||||||
sender: string,
|
sender: string,
|
||||||
type: TxServiceType,
|
type: TxServiceType,
|
||||||
) => {
|
) => {
|
||||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const contractTransactionHash = await gnosisSafe.getTransactionHash(
|
const contractTransactionHash = await gnosisSafe.getTransactionHash(
|
||||||
to,
|
to,
|
||||||
valueInWei,
|
valueInWei,
|
||||||
|
|
|
@ -5,8 +5,7 @@ import Page from '~/components/layout/Page'
|
||||||
import {
|
import {
|
||||||
getAccountsFrom, getThresholdFrom, getNamesFrom, getSafeNameFrom,
|
getAccountsFrom, getThresholdFrom, getNamesFrom, getSafeNameFrom,
|
||||||
} from '~/routes/open/utils/safeDataExtractor'
|
} from '~/routes/open/utils/safeDataExtractor'
|
||||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
import { getGnosisSafeInstanceAt, deploySafeContract, initContracts } from '~/logic/contracts/safeContracts'
|
||||||
import { getGnosisSafeContract, deploySafeContract, initContracts } from '~/logic/contracts/safeContracts'
|
|
||||||
import { checkReceiptStatus } from '~/logic/wallets/ethTransactions'
|
import { checkReceiptStatus } from '~/logic/wallets/ethTransactions'
|
||||||
import { history } from '~/store'
|
import { history } from '~/store'
|
||||||
import { OPENING_ADDRESS, stillInOpeningView, SAFELIST_ADDRESS } from '~/routes/routes'
|
import { OPENING_ADDRESS, stillInOpeningView, SAFELIST_ADDRESS } from '~/routes/routes'
|
||||||
|
@ -30,15 +29,12 @@ export const createSafe = async (values: Object, userAccount: string, addSafe: A
|
||||||
const name = getSafeNameFrom(values)
|
const name = getSafeNameFrom(values)
|
||||||
const owners = getNamesFrom(values)
|
const owners = getNamesFrom(values)
|
||||||
|
|
||||||
const web3 = getWeb3()
|
|
||||||
const GnosisSafe = getGnosisSafeContract(web3)
|
|
||||||
|
|
||||||
await initContracts()
|
await initContracts()
|
||||||
const safe = await deploySafeContract(accounts, numConfirmations, userAccount)
|
const safe = await deploySafeContract(accounts, numConfirmations, userAccount)
|
||||||
checkReceiptStatus(safe.tx)
|
await checkReceiptStatus(safe.tx)
|
||||||
|
|
||||||
const param = safe.logs[0].args.proxy
|
const safeAddress = safe.logs[0].args.proxy
|
||||||
const safeContract = await GnosisSafe.at(param)
|
const safeContract = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
|
|
||||||
addSafe(name, safeContract.address, numConfirmations, owners, accounts)
|
addSafe(name, safeContract.address, numConfirmations, owners, accounts)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ import { connect } from 'react-redux'
|
||||||
import { type Safe } from '~/routes/safe/store/models/safe'
|
import { type Safe } from '~/routes/safe/store/models/safe'
|
||||||
import { type Owner, makeOwner } from '~/routes/safe/store/models/owner'
|
import { type Owner, makeOwner } from '~/routes/safe/store/models/owner'
|
||||||
import { setOwners } from '~/logic/safe/utils'
|
import { setOwners } from '~/logic/safe/utils'
|
||||||
import { getSafeEthereumInstance, createTransaction } from '~/logic/safe/safeFrontendOperations'
|
import { createTransaction } from '~/logic/safe/safeFrontendOperations'
|
||||||
|
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||||
import AddOwnerForm, { NAME_PARAM, OWNER_ADDRESS_PARAM, INCREASE_PARAM } from './AddOwnerForm'
|
import AddOwnerForm, { NAME_PARAM, OWNER_ADDRESS_PARAM, INCREASE_PARAM } from './AddOwnerForm'
|
||||||
import Review from './Review'
|
import Review from './Review'
|
||||||
import selector, { type SelectorProps } from './selector'
|
import selector, { type SelectorProps } from './selector'
|
||||||
|
@ -36,7 +37,7 @@ const getOwnerAddressesFrom = (owners: List<Owner>) => {
|
||||||
|
|
||||||
export const addOwner = async (values: Object, safe: Safe, threshold: number, executor: string) => {
|
export const addOwner = async (values: Object, safe: Safe, threshold: number, executor: string) => {
|
||||||
const safeAddress = safe.get('address')
|
const safeAddress = safe.get('address')
|
||||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const nonce = await gnosisSafe.nonce()
|
const nonce = await gnosisSafe.nonce()
|
||||||
|
|
||||||
const newThreshold = values[INCREASE_PARAM] ? threshold + 1 : threshold
|
const newThreshold = values[INCREASE_PARAM] ? threshold + 1 : threshold
|
||||||
|
|
|
@ -3,7 +3,8 @@ import * as React from 'react'
|
||||||
import Stepper from '~/components/Stepper'
|
import Stepper from '~/components/Stepper'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { type Safe } from '~/routes/safe/store/models/safe'
|
import { type Safe } from '~/routes/safe/store/models/safe'
|
||||||
import { getSafeEthereumInstance, createTransaction } from '~/logic/safe/safeFrontendOperations'
|
import { createTransaction } from '~/logic/safe/safeFrontendOperations'
|
||||||
|
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||||
import RemoveOwnerForm, { DECREASE_PARAM } from './RemoveOwnerForm'
|
import RemoveOwnerForm, { DECREASE_PARAM } from './RemoveOwnerForm'
|
||||||
import Review from './Review'
|
import Review from './Review'
|
||||||
import selector, { type SelectorProps } from './selector'
|
import selector, { type SelectorProps } from './selector'
|
||||||
|
@ -42,7 +43,7 @@ export const removeOwner = async (
|
||||||
executor: string,
|
executor: string,
|
||||||
) => {
|
) => {
|
||||||
const safeAddress = safe.get('address')
|
const safeAddress = safe.get('address')
|
||||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const nonce = await gnosisSafe.nonce()
|
const nonce = await gnosisSafe.nonce()
|
||||||
const newThreshold = values[DECREASE_PARAM] ? threshold - 1 : threshold
|
const newThreshold = values[DECREASE_PARAM] ? threshold - 1 : threshold
|
||||||
const storedOwners = await gnosisSafe.getOwners()
|
const storedOwners = await gnosisSafe.getOwners()
|
||||||
|
|
|
@ -10,7 +10,8 @@ import { type Token } from '~/logic/tokens/store/model/token'
|
||||||
import { isEther } from '~/logic/tokens/utils/tokenHelpers'
|
import { isEther } from '~/logic/tokens/utils/tokenHelpers'
|
||||||
import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
|
import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
|
||||||
import { toNative } from '~/logic/wallets/tokens'
|
import { toNative } from '~/logic/wallets/tokens'
|
||||||
import { createTransaction, getSafeEthereumInstance } from '~/logic/safe/safeFrontendOperations'
|
import { createTransaction } from '~/logic/safe/safeFrontendOperations'
|
||||||
|
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||||
import actions, { type Actions } from './actions'
|
import actions, { type Actions } from './actions'
|
||||||
import selector, { type SelectorProps } from './selector'
|
import selector, { type SelectorProps } from './selector'
|
||||||
import SendTokenForm, { TKN_DESTINATION_PARAM, TKN_VALUE_PARAM } from './SendTokenForm'
|
import SendTokenForm, { TKN_DESTINATION_PARAM, TKN_VALUE_PARAM } from './SendTokenForm'
|
||||||
|
@ -40,7 +41,7 @@ const getTransferData = async (tokenAddress: string, to: string, amount: BigNumb
|
||||||
|
|
||||||
const processTokenTransfer = async (safe: Safe, token: Token, to: string, amount: string, userAddress: string) => {
|
const processTokenTransfer = async (safe: Safe, token: Token, to: string, amount: string, userAddress: string) => {
|
||||||
const safeAddress = safe.get('address')
|
const safeAddress = safe.get('address')
|
||||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const nonce = await gnosisSafe.nonce()
|
const nonce = await gnosisSafe.nonce()
|
||||||
const symbol = token.get('symbol')
|
const symbol = token.get('symbol')
|
||||||
const name = `Send ${amount} ${symbol} to ${to}`
|
const name = `Send ${amount} ${symbol} to ${to}`
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import Stepper from '~/components/Stepper'
|
import Stepper from '~/components/Stepper'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { getSafeEthereumInstance, createTransaction } from '~/logic/safe/safeFrontendOperations'
|
import { createTransaction } from '~/logic/safe/safeFrontendOperations'
|
||||||
|
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||||
import { type Safe } from '~/routes/safe/store/models/safe'
|
import { type Safe } from '~/routes/safe/store/models/safe'
|
||||||
import ThresholdForm, { THRESHOLD_PARAM } from './ThresholdForm'
|
import ThresholdForm, { THRESHOLD_PARAM } from './ThresholdForm'
|
||||||
import selector, { type SelectorProps } from './selector'
|
import selector, { type SelectorProps } from './selector'
|
||||||
|
@ -35,7 +36,7 @@ class Threshold extends React.PureComponent<Props, State> {
|
||||||
const { safe, userAddress, fetchTransactions } = this.props // , fetchThreshold } = this.props
|
const { safe, userAddress, fetchTransactions } = this.props // , fetchThreshold } = this.props
|
||||||
const newThreshold = values[THRESHOLD_PARAM]
|
const newThreshold = values[THRESHOLD_PARAM]
|
||||||
const safeAddress = safe.get('address')
|
const safeAddress = safe.get('address')
|
||||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const nonce = await gnosisSafe.nonce()
|
const nonce = await gnosisSafe.nonce()
|
||||||
const data = gnosisSafe.contract.changeThreshold(newThreshold).encodeABI()
|
const data = gnosisSafe.contract.changeThreshold(newThreshold).encodeABI()
|
||||||
await createTransaction(safe, `Change Safe's threshold [${nonce}]`, safeAddress, '0', nonce, userAddress, data)
|
await createTransaction(safe, `Change Safe's threshold [${nonce}]`, safeAddress, '0', nonce, userAddress, data)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import { makeOwner } from '~/routes/safe/store/models/owner'
|
||||||
import type { SafeProps } from '~/routes/safe/store/models/safe'
|
import type { SafeProps } from '~/routes/safe/store/models/safe'
|
||||||
import { addSafe } from '~/routes/safe/store/actions/addSafe'
|
import { addSafe } from '~/routes/safe/store/actions/addSafe'
|
||||||
import { getOwners, getSafeName } from '~/logic/safe/utils'
|
import { getOwners, getSafeName } from '~/logic/safe/utils'
|
||||||
import { getGnosisSafeContract } from '~/logic/contracts/safeContracts'
|
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||||
import { getWeb3, getBalanceInEtherOf } from '~/logic/wallets/getWeb3'
|
import { getBalanceInEtherOf } from '~/logic/wallets/getWeb3'
|
||||||
import updateSafe from '~/routes/safe/store/actions/updateSafe'
|
import updateSafe from '~/routes/safe/store/actions/updateSafe'
|
||||||
|
|
||||||
const buildOwnersFrom = (
|
const buildOwnersFrom = (
|
||||||
|
@ -19,9 +19,7 @@ const buildOwnersFrom = (
|
||||||
})
|
})
|
||||||
|
|
||||||
export const buildSafe = async (safeAddress: string, safeName: string) => {
|
export const buildSafe = async (safeAddress: string, safeName: string) => {
|
||||||
const web3 = getWeb3()
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const SafeContract = await getGnosisSafeContract(web3)
|
|
||||||
const gnosisSafe = await SafeContract.at(safeAddress)
|
|
||||||
const ethBalance = await getBalanceInEtherOf(safeAddress)
|
const ethBalance = await getBalanceInEtherOf(safeAddress)
|
||||||
|
|
||||||
const threshold = Number(await gnosisSafe.getThreshold())
|
const threshold = Number(await gnosisSafe.getThreshold())
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
import { getTransactionFromReduxStore } from '~/routes/safe/test/testMultisig'
|
import { getTransactionFromReduxStore } from '~/routes/safe/test/testMultisig'
|
||||||
import { buildMathPropsFrom } from '~/test/utils/buildReactRouterProps'
|
import { buildMathPropsFrom } from '~/test/utils/buildReactRouterProps'
|
||||||
import { createTransaction } from '~/wallets/createTransactions'
|
import { createTransaction } from '~/wallets/createTransactions'
|
||||||
import { getGnosisSafeContract } from '~/wallets/safeContracts'
|
import { getGnosisSafeInstanceAt } from '~/wallets/safeContracts'
|
||||||
import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions'
|
import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions'
|
||||||
*/
|
*/
|
||||||
describe('React DOM TESTS > Change threshold', () => {
|
describe('React DOM TESTS > Change threshold', () => {
|
||||||
|
@ -32,9 +32,7 @@ describe('React DOM TESTS > Change threshold', () => {
|
||||||
const match: Match = buildMathPropsFrom(address)
|
const match: Match = buildMathPropsFrom(address)
|
||||||
const safe = safeSelector(store.getState(), { match })
|
const safe = safeSelector(store.getState(), { match })
|
||||||
if (!safe) throw new Error()
|
if (!safe) throw new Error()
|
||||||
const web3 = getWeb3()
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const GnosisSafe = await getGnosisSafeContract(web3)
|
|
||||||
const gnosisSafe = GnosisSafe.at(address)
|
|
||||||
|
|
||||||
// WHEN
|
// WHEN
|
||||||
const nonce = Date.now()
|
const nonce = Date.now()
|
||||||
|
@ -79,9 +77,7 @@ describe('React DOM TESTS > Change threshold', () => {
|
||||||
const match: Match = buildMathPropsFrom(address)
|
const match: Match = buildMathPropsFrom(address)
|
||||||
const safe = safeSelector(store.getState(), { match })
|
const safe = safeSelector(store.getState(), { match })
|
||||||
if (!safe) throw new Error()
|
if (!safe) throw new Error()
|
||||||
const web3 = getWeb3()
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const GnosisSafe = await getGnosisSafeContract(web3)
|
|
||||||
const gnosisSafe = GnosisSafe.at(address)
|
|
||||||
|
|
||||||
// WHEN
|
// WHEN
|
||||||
const nonce = Date.now()
|
const nonce = Date.now()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { List } from 'immutable'
|
import { List } from 'immutable'
|
||||||
import { getSafeEthereumInstance, createTransaction } from '~/logic/safe/safeFrontendOperations'
|
import { createTransaction } from '~/logic/safe/safeFrontendOperations'
|
||||||
|
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||||
import { type Safe } from '~/routes/safe/store/models/safe'
|
import { type Safe } from '~/routes/safe/store/models/safe'
|
||||||
import { makeOwner } from '~/routes/safe/store/models/owner'
|
import { makeOwner } from '~/routes/safe/store/models/owner'
|
||||||
import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions'
|
import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions'
|
||||||
|
@ -29,7 +30,7 @@ describe('Transactions Suite', () => {
|
||||||
|
|
||||||
it('retrieves tx info from service having subject available', async () => {
|
it('retrieves tx info from service having subject available', async () => {
|
||||||
let safe: Safe = getSafeFrom(store.getState(), safeAddress)
|
let safe: Safe = getSafeFrom(store.getState(), safeAddress)
|
||||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress)
|
||||||
const firstTxData = gnosisSafe.contract.methods.addOwnerWithThreshold(accounts[1], 2).encodeABI()
|
const firstTxData = gnosisSafe.contract.methods.addOwnerWithThreshold(accounts[1], 2).encodeABI()
|
||||||
const executor = accounts[0]
|
const executor = accounts[0]
|
||||||
const nonce = await gnosisSafe.nonce()
|
const nonce = await gnosisSafe.nonce()
|
||||||
|
|
|
@ -6,7 +6,7 @@ import abi from 'ethereumjs-abi'
|
||||||
console.log(`to[${to}] \n\n valieInWei[${valueInWei}] \n\n
|
console.log(`to[${to}] \n\n valieInWei[${valueInWei}] \n\n
|
||||||
data[${data}] \n\n operation[${operation}] \n\n sigs[${sigs}]`)
|
data[${data}] \n\n operation[${operation}] \n\n sigs[${sigs}]`)
|
||||||
|
|
||||||
const gnosisSafe = await getSafeEthereumInstance(address)
|
const gnosisSafe = await getGnosisSafeInstanceAt(address)
|
||||||
await printOutApprove("Remove owner 3", address, await gnosisSafe.getOwners(), tx.get('data'), tx.get('nonce'))
|
await printOutApprove("Remove owner 3", address, await gnosisSafe.getOwners(), tx.get('data'), tx.get('nonce'))
|
||||||
const txData =
|
const txData =
|
||||||
await gnosisSafe.contract.execTransactionIfApproved.getData(address, 0, tx.get('data'), 0, tx.get('nonce'))
|
await gnosisSafe.contract.execTransactionIfApproved.getData(address, 0, tx.get('data'), 0, tx.get('nonce'))
|
||||||
|
|
Loading…
Reference in New Issue