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(
|
async estimateRelayerWithdrawGasLimit(
|
||||||
{ getters, rootState, commit },
|
{ getters, rootState, rootGetters, commit },
|
||||||
{ currency, amount, netId, proof, withdrawCallArgs }
|
{ currency, amount, netId, proof, withdrawCallArgs }
|
||||||
) {
|
) {
|
||||||
const tornadoProxy = getters.tornadoProxyContract({ netId })
|
const tornadoProxy = getters.tornadoProxyContract({ netId })
|
||||||
const tornadoInstance = getters.instanceContract({ currency, amount, netId })
|
const tornadoInstance = getters.instanceContract({ currency, amount, netId })
|
||||||
const relayer = rootState.relayer.selectedRelayer.address
|
const relayer = rootState.relayer.selectedRelayer.address
|
||||||
|
|
||||||
|
const gasPrice = toBN(rootGetters['gasPrices/gasPrice'])
|
||||||
|
|
||||||
let gasLimit
|
let gasLimit
|
||||||
try {
|
try {
|
||||||
const fetchedGasLimit = await tornadoProxy.methods
|
const fetchedGasLimit = await tornadoProxy.methods
|
||||||
@ -655,7 +657,9 @@ const actions = {
|
|||||||
.estimateGas({
|
.estimateGas({
|
||||||
from: relayer,
|
from: relayer,
|
||||||
to: tornadoProxy._address,
|
to: tornadoProxy._address,
|
||||||
value: withdrawCallArgs[5] || 0
|
value: withdrawCallArgs[5] || 0,
|
||||||
|
gasPrice,
|
||||||
|
gasLimit: getters.defaultWithdrawGas
|
||||||
})
|
})
|
||||||
gasLimit = Math.floor(fetchedGasLimit * 1.3)
|
gasLimit = Math.floor(fetchedGasLimit * 1.3)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -23,7 +23,7 @@ export const getters = {
|
|||||||
return new GasPriceOracle({
|
return new GasPriceOracle({
|
||||||
chainId: netId,
|
chainId: netId,
|
||||||
defaultRpc: rootGetters['settings/currentRpc'].url,
|
defaultRpc: rootGetters['settings/currentRpc'].url,
|
||||||
minPriority: netId === 1 ? 2 : 0.05,
|
minPriority: netId === 1 || netId === 5 ? 2 : 0.05,
|
||||||
percentile: 5,
|
percentile: 5,
|
||||||
blocksCount: 20,
|
blocksCount: 20,
|
||||||
defaultFallbackGasPrices: gasPrices
|
defaultFallbackGasPrices: gasPrices
|
||||||
@ -73,7 +73,20 @@ export const actions = {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Bump more for Polygon (MATIC) and for Goerli, because minPriority for this sidechains don't affect correctly
|
// 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 = {}
|
let txGasParams = {}
|
||||||
try {
|
try {
|
||||||
// Use maxFeePerGas if eip1599 gas support by chain, use fast if legacy gas fetched
|
// Use maxFeePerGas if eip1599 gas support by chain, use fast if legacy gas fetched
|
||||||
|
Loading…
Reference in New Issue
Block a user