WA-238 Adding logic for withdrawing safe's funds
This commit is contained in:
parent
fe7a936687
commit
8d3bfa8d2a
|
@ -0,0 +1,26 @@
|
|||
// @flow
|
||||
import { getGnosisSafeContract, getCreateDailyLimitExtensionContract } from '~/wallets/safeContracts'
|
||||
|
||||
export const DESTINATION_PARAM = 'destination'
|
||||
export const VALUE_PARAM = 'ether'
|
||||
|
||||
const withdrawn = async (values: Object, safeAddress: string, userAccount: string): Promise<void> => {
|
||||
const gnosisSafe = getGnosisSafeContract().at(safeAddress)
|
||||
const dailyLimitExtension = getCreateDailyLimitExtensionContract().at(gnosisSafe.getExtensions()[0])
|
||||
|
||||
if (await dailyLimitExtension.gnosisSafe() !== gnosisSafe.address) {
|
||||
throw new Error('Using an extension of different safe')
|
||||
}
|
||||
|
||||
const CALL = 0
|
||||
await gnosisSafe.executeExtension(
|
||||
values[DESTINATION_PARAM],
|
||||
values[VALUE_PARAM],
|
||||
0,
|
||||
CALL,
|
||||
dailyLimitExtension.address,
|
||||
{ from: userAccount },
|
||||
)
|
||||
}
|
||||
|
||||
export default withdrawn
|
|
@ -44,7 +44,7 @@ const createDailyLimitExtensionContract = (web3: any) => {
|
|||
export const getGnosisSafeContract = ensureOnce(createGnosisSafeContract)
|
||||
const getCreateProxyFactoryContract = ensureOnce(createProxyFactoryContract)
|
||||
const getCreateAddExtensionContract = ensureOnce(createAddExtensionContract)
|
||||
const getCreateDailyLimitExtensionContract = ensureOnce(createDailyLimitExtensionContract)
|
||||
export const getCreateDailyLimitExtensionContract = ensureOnce(createDailyLimitExtensionContract)
|
||||
|
||||
const createMasterCopies = async () => {
|
||||
const web3 = getWeb3()
|
||||
|
|
Loading…
Reference in New Issue