WA-521 Including gas calculation upfront error when set free records in smartcontracts

This commit is contained in:
apanizo 2018-08-17 17:51:59 +02:00
parent b868dcd6f3
commit 82f4a24749
1 changed files with 10 additions and 3 deletions

View File

@ -42,10 +42,17 @@ export const executeTransaction = async (
const gnosisSafe = await getSafeEthereumInstance(safeAddress) const gnosisSafe = await getSafeEthereumInstance(safeAddress)
const txConfirmationData = const txConfirmationData =
gnosisSafe.contract.execTransactionIfApproved.getData(to, valueInWei, data, operation, nonce) gnosisSafe.contract.execTransactionIfApproved.getData(to, valueInWei, data, operation, nonce)
const numOwners = await gnosisSafe.getOwners()
const gas = await calculateGasOf(txConfirmationData, sender, safeAddress) const gas = await calculateGasOf(txConfirmationData, sender, safeAddress)
const gasIncludingRemovingStoreUpfront = gas + (numOwners.length * 15000)
const txReceipt = const txReceipt = await gnosisSafe.execTransactionIfApproved(
await gnosisSafe.execTransactionIfApproved(to, valueInWei, data, operation, nonce, { from: sender, gas, gasPrice }) to,
valueInWei,
data,
operation,
nonce,
{ from: sender, gas: gasIncludingRemovingStoreUpfront, gasPrice },
)
const txHash = txReceipt.tx const txHash = txReceipt.tx
await checkReceiptStatus(txHash) await checkReceiptStatus(txHash)