mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-12 19:14:08 +00:00
WA-238 Including DailyLimit when creating the safe
This commit is contained in:
parent
c2fd9fb1a5
commit
7569002ce0
@ -31,7 +31,7 @@ const createSafe = async (values: Object, userAccount: string, addSafe: AddSafe)
|
||||
const GnosisSafe = getGnosisSafeContract(web3)
|
||||
|
||||
await initContracts()
|
||||
const safe = await deploySafeContract(accounts, numConfirmations, userAccount)
|
||||
const safe = await deploySafeContract(accounts, numConfirmations, dailyLimit, userAccount)
|
||||
|
||||
const param = safe.logs[1].args.proxy
|
||||
const safeContract = GnosisSafe.at(param)
|
||||
|
@ -16,11 +16,13 @@ const withdrawn = async (values: Object, safeAddress: string, userAccount: strin
|
||||
if (await dailyLimitExtension.gnosisSafe() !== 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(
|
||||
values[DESTINATION_PARAM],
|
||||
values[VALUE_PARAM],
|
||||
destination,
|
||||
value,
|
||||
0,
|
||||
CALL,
|
||||
dailyLimitExtension.address,
|
||||
|
@ -86,9 +86,10 @@ const createMasterCopies = async () => {
|
||||
|
||||
export const initContracts = ensureOnce(createMasterCopies)
|
||||
|
||||
const getSafeDataBasedOn = async (accounts, numConfirmations) => {
|
||||
const getSafeDataBasedOn = async (accounts, numConfirmations, dailyLimitInEth) => {
|
||||
const web3 = getWeb3()
|
||||
const extensionData = await dailyLimitMaster.contract.setup
|
||||
.getData([0], [100])
|
||||
.getData([0], [web3.toWei(dailyLimitInEth, 'ether')])
|
||||
const proxyFactoryData = await proxyFactoryMaster.contract.createProxy
|
||||
.getData(dailyLimitMaster.address, extensionData)
|
||||
const createAndAddExtensionData = createAndAddExtensionMaster.contract.createAndAddExtension
|
||||
@ -98,7 +99,12 @@ const getSafeDataBasedOn = async (accounts, numConfirmations) => {
|
||||
.getData(accounts, numConfirmations, createAndAddExtensionMaster.address, createAndAddExtensionData)
|
||||
}
|
||||
|
||||
export const deploySafeContract = async (safeAccounts: string[], numConfirmations: number, userAccount: string) => {
|
||||
const gnosisSafeData = await getSafeDataBasedOn(safeAccounts, numConfirmations)
|
||||
export const deploySafeContract = async (
|
||||
safeAccounts: string[],
|
||||
numConfirmations: number,
|
||||
dailyLimit: number,
|
||||
userAccount: string,
|
||||
) => {
|
||||
const gnosisSafeData = await getSafeDataBasedOn(safeAccounts, numConfirmations, dailyLimit)
|
||||
return proxyFactoryMaster.createProxy(safeMaster.address, gnosisSafeData, { from: userAccount, gas: '5000000' })
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user