fix: use real id of token to estimate gas

This commit is contained in:
Anthony Laibe 2023-11-14 13:33:44 +01:00
parent 010afb4b39
commit 0345612a31

View File

@ -2,6 +2,7 @@ package bridge
import ( import (
"context" "context"
"fmt"
"math/big" "math/big"
"strings" "strings"
@ -60,11 +61,15 @@ func (s *ERC721TransferBridge) EstimateGas(fromNetwork *params.Network, toNetwor
if err != nil { if err != nil {
return 0, err return 0, err
} }
id, success := big.NewInt(0).SetString(token.Symbol, 0)
if !success {
return 0, fmt.Errorf("failed to convert %s to big.Int", token.Symbol)
}
input, err = abi.Pack("safeTransferFrom", input, err = abi.Pack("safeTransferFrom",
from, from,
to, to,
new(big.Int)) id,
)
if err != nil { if err != nil {
return 0, err return 0, err