Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
fix the order of transactions, change updateSafe to upgradeSafe to av…
Browse files Browse the repository at this point in the history
…oid naming confusion with the updateSafe action (#610)
  • Loading branch information
mmv08 authored Feb 26, 2020
1 parent 1f3f13e commit 0b7d6f0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { MultiSendTransactionInstanceType } from '~/logic/contracts/safeCon
import { DELEGATE_CALL } from '~/logic/safe/transactions'
import { getWeb3 } from '~/logic/wallets/getWeb3'

export const upgradeSafeToLastVersion = async (safeAddress: string, createTransaction: Function) => {
export const upgradeSafeToLatestVersion = async (safeAddress: string, createTransaction: Function) => {
const sendTransactions = async (txs: Array<MultiSendTransactionInstanceType>) => {
const web3 = getWeb3()
const encodeMultiSendCallData = getEncodedMultiSendCallData(txs, web3)
Expand All @@ -35,13 +35,13 @@ export const upgradeSafeToLastVersion = async (safeAddress: string, createTransa
operation: 0,
to: safeAddress,
value: 0,
data: fallbackHandlerTxData,
data: updateSafeTxData,
},
{
operation: 0,
to: safeAddress,
value: 0,
data: updateSafeTxData,
data: fallbackHandlerTxData,
},
]
return sendTransactions(txs)
Expand Down
4 changes: 2 additions & 2 deletions src/routes/safe/components/Settings/UpdateSafeModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import GnoForm from '~/components/forms/GnoForm'
import Block from '~/components/layout/Block'
import Button from '~/components/layout/Button'
import { styles } from './style'
import { upgradeSafeToLastVersion } from '~/logic/safe/utils/updateSafe'
import { upgradeSafeToLatestVersion } from '~/logic/safe/utils/upgradeSafe'

type Props = {
onClose: Function,
Expand All @@ -22,7 +22,7 @@ type Props = {
const UpdateSafeModal = ({ onClose, classes, safeAddress, createTransaction }: Props) => {
const handleSubmit = async () => {
// Call the update safe method
await upgradeSafeToLastVersion(safeAddress, createTransaction)
await upgradeSafeToLatestVersion(safeAddress, createTransaction)
onClose()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ describe('Upgrade a Safe', () => {
operation: 0,
to: safeAddress,
value: 0,
data: fallbackHandlerTxData,
data: updateSafeTxData,
},
{
operation: 0,
to: safeAddress,
value: 0,
data: updateSafeTxData,
data: fallbackHandlerTxData,
},
]
const expectedEncodedData = '0x8d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f08a0323000000000000000000000000d5d82b6addc9027b22dca772aa68d5d74cdbdf44000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000247de7edef00000000000000000000000034cfac646f301356faa8b21e94227e3583fe3f5f0000000000000000000000000000'
const expectedEncodedData = '0x8d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000247de7edef00000000000000000000000034cfac646f301356faa8b21e94227e3583fe3f5f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f08a0323000000000000000000000000d5d82b6addc9027b22dca772aa68d5d74cdbdf440000000000000000000000000000'
const multiSendTxData = getEncodedMultiSendCallData(txs, web3)
expect(multiSendTxData).toEqual(expectedEncodedData)
})
Expand Down

0 comments on commit 0b7d6f0

Please sign in to comment.