Add correct gas bumping parameters and fix limit estimation
This commit is contained in:
parent
cf394714c3
commit
c4b5f69b72
@ -641,13 +641,15 @@ const actions = {
|
||||
}
|
||||
},
|
||||
async estimateRelayerWithdrawGasLimit(
|
||||
{ getters, rootState, commit },
|
||||
{ getters, rootState, rootGetters, commit },
|
||||
{ currency, amount, netId, proof, withdrawCallArgs }
|
||||
) {
|
||||
const tornadoProxy = getters.tornadoProxyContract({ netId })
|
||||
const tornadoInstance = getters.instanceContract({ currency, amount, netId })
|
||||
const relayer = rootState.relayer.selectedRelayer.address
|
||||
|
||||
const gasPrice = toBN(rootGetters['gasPrices/gasPrice'])
|
||||
|
||||
let gasLimit
|
||||
try {
|
||||
const fetchedGasLimit = await tornadoProxy.methods
|
||||
@ -655,7 +657,9 @@ const actions = {
|
||||
.estimateGas({
|
||||
from: relayer,
|
||||
to: tornadoProxy._address,
|
||||
value: withdrawCallArgs[5] || 0
|
||||
value: withdrawCallArgs[5] || 0,
|
||||
gasPrice,
|
||||
gasLimit: getters.defaultWithdrawGas
|
||||
})
|
||||
gasLimit = Math.floor(fetchedGasLimit * 1.3)
|
||||
} catch (e) {
|
||||
|
@ -23,7 +23,7 @@ export const getters = {
|
||||
return new GasPriceOracle({
|
||||
chainId: netId,
|
||||
defaultRpc: rootGetters['settings/currentRpc'].url,
|
||||
minPriority: netId === 1 ? 2 : 0.05,
|
||||
minPriority: netId === 1 || netId === 5 ? 2 : 0.05,
|
||||
percentile: 5,
|
||||
blocksCount: 20,
|
||||
defaultFallbackGasPrices: gasPrices
|
||||
@ -73,7 +73,20 @@ export const actions = {
|
||||
|
||||
try {
|
||||
// Bump more for Polygon (MATIC) and for Goerli, because minPriority for this sidechains don't affect correctly
|
||||
const bumpPercent = netId === 137 || netId === 5 ? 30 : 10
|
||||
let bumpPercent
|
||||
switch (netId) {
|
||||
case 5:
|
||||
bumpPercent = 100
|
||||
break
|
||||
case 137:
|
||||
case 43114:
|
||||
case 100:
|
||||
bumpPercent = 30
|
||||
break
|
||||
default:
|
||||
bumpPercent = 10
|
||||
}
|
||||
|
||||
let txGasParams = {}
|
||||
try {
|
||||
// Use maxFeePerGas if eip1599 gas support by chain, use fast if legacy gas fetched
|
||||
|
Loading…
Reference in New Issue
Block a user