From dd7b3d1af829360b0b5bb93494f01bfd3c9b69c1 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Tue, 28 May 2024 12:29:02 +0200 Subject: [PATCH] fix_: unblocking the router calculation if an approval is required for the gas estimation --- services/wallet/bridge/hop.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/wallet/bridge/hop.go b/services/wallet/bridge/hop.go index a7406f433..5b1c42b6e 100644 --- a/services/wallet/bridge/hop.go +++ b/services/wallet/bridge/hop.go @@ -216,7 +216,14 @@ func (h *HopBridge) EstimateGas(fromNetwork *params.Network, toNetwork *params.N estimation, err := ethClient.EstimateGas(context.Background(), msg) if err != nil { - return 0, err + if !token.IsNative() { + // TODO: this is a temporary solution until we find a better way to estimate the gas + // hardcoding the estimation for other than ETH, cause we cannot get a proper estimation without having an approval placed first + // this is an error we're facing otherwise: `execution reverted: ERC20: transfer amount exceeds allowance` + estimation = 350000 + } else { + return 0, err + } } increasedEstimation := float64(estimation) * IncreaseEstimatedGasFactor