From 7a70d8e1844d557fb757de9bd21bd864b983ad03 Mon Sep 17 00:00:00 2001 From: golangisfun123 Date: Fri, 26 Jul 2024 11:09:09 -0500 Subject: [PATCH] handle native gas token --- services/rfq/relayer/relconfig/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/rfq/relayer/relconfig/config.go b/services/rfq/relayer/relconfig/config.go index f676f2d6fe..e8977a13f2 100644 --- a/services/rfq/relayer/relconfig/config.go +++ b/services/rfq/relayer/relconfig/config.go @@ -17,6 +17,7 @@ import ( submitterConfig "github.com/synapsecns/sanguine/ethergo/submitter/config" cctpConfig "github.com/synapsecns/sanguine/services/cctp-relayer/config" "github.com/synapsecns/sanguine/services/rfq/contracts/ierc20" + "github.com/synapsecns/sanguine/services/rfq/relayer/chain" "gopkg.in/yaml.v2" "path/filepath" @@ -246,6 +247,14 @@ func (c Config) ValidateTokenDecimals(ctx context.Context, omniClient omniClient return fmt.Errorf("could not get chain client for chain %d: %w", chainID, err) } + // Check if the token is the gas token. SHOULD BE 18. + if tokenCFG.Address == chain.EthAddress.String() { + if tokenCFG.Decimals != 18 { + return fmt.Errorf("decimals mismatch for token %s on chain %d: expected 18, got %d", tokenName, chainID, tokenCFG.Decimals) + } + continue + } + ierc20, err := ierc20.NewIERC20(common.HexToAddress(tokenCFG.Address), chainClient) if err != nil { return fmt.Errorf("could not create caller for token %s at address %s on chain %d: %w", tokenName, tokenCFG.Address, chainID, err)