minor codestyle fixes

This commit is contained in:
mmv 2019-05-22 19:51:15 +04:00
parent c5bc2fa584
commit 8f6823a9c4
1 changed files with 10 additions and 8 deletions

View File

@ -42,19 +42,20 @@ export const estimateDataGas = (
const gasPrice = 0 // no need to get refund when we submit txs to metamask const gasPrice = 0 // no need to get refund when we submit txs to metamask
const signatureCost = signatureCount * (68 + 2176 + 2176 + 6000) // array count (3 -> r, s, v) * signature count const signatureCost = signatureCount * (68 + 2176 + 2176 + 6000) // array count (3 -> r, s, v) * signature count
const sigs = `0x000000000000000000000000${ const sigs = `0x000000000000000000000000${'0xbc2BB26a6d821e69A38016f3858561a1D80d4182'.replace(
'0xbc2BB26a6d821e69A38016f3858561a1D80d4182'.replace('0x', '') '0x',
}0000000000000000000000000000000000000000000000000000000000000000` '',
)}0000000000000000000000000000000000000000000000000000000000000000`
const payload = safe.contract.methods const payload = safe.contract.methods
.execTransaction(to, valueInWei, data, operation, txGasEstimate, 0, gasPrice, gasToken, refundReceiver, sigs) .execTransaction(to, valueInWei, data, operation, txGasEstimate, 0, gasPrice, gasToken, refundReceiver, sigs)
.encodeABI() .encodeABI()
// eslint-disable-next-line
const dataGasEstimate = estimateDataGasCosts(payload) + signatureCost + (nonce > 0 ? 5000 : 20000) + 1500 // 1500 -> hash generation costs const dataGasEstimate = estimateDataGasCosts(payload) + signatureCost + (nonce > 0 ? 5000 : 20000) + 1500 // 1500 -> hash generation costs
return dataGasEstimate + 32000 // Add aditional gas costs (e.g. base tx costs, transfer costs) return dataGasEstimate + 32000 // Add aditional gas costs (e.g. base tx costs, transfer costs)
} }
// eslint-disable-next-line
export const generateTxGasEstimateFrom = async ( export const generateTxGasEstimateFrom = async (
safe: any, safe: any,
safeAddress: string, safeAddress: string,
@ -117,11 +118,12 @@ export const calculateTxFee = async (
Number(threshold), Number(threshold),
safeAddress, safeAddress,
) )
console.log({ dataGasEstimate, txGasEstimate })
const sigs = `0x000000000000000000000000${ const sigs = `0x000000000000000000000000${'0xbc2BB26a6d821e69A38016f3858561a1D80d4182'.replace(
'0xbc2BB26a6d821e69A38016f3858561a1D80d4182'.replace('0x', '') '0x',
}0000000000000000000000000000000000000000000000000000000000000000` '',
+ '01' )}0000000000000000000000000000000000000000000000000000000000000000` + '01'
console.log({ console.log({
to, to,
valueInWei, valueInWei,