fix_: unblocking the router calculation if an approval is required for the gas estimation
This commit is contained in:
parent
74b1dfd694
commit
dd7b3d1af8
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue