Skip to content

Commit

Permalink
handle native gas token
Browse files Browse the repository at this point in the history
  • Loading branch information
golangisfun123 committed Jul 26, 2024
1 parent 2c28464 commit 7a70d8e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions services/rfq/relayer/relconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 warning on line 248 in services/rfq/relayer/relconfig/config.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/relconfig/config.go#L247-L248

Added lines #L247 - L248 were not covered by tests

// 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

Check warning on line 255 in services/rfq/relayer/relconfig/config.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/relconfig/config.go#L252-L255

Added lines #L252 - L255 were not covered by tests
}

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)
Expand Down

0 comments on commit 7a70d8e

Please sign in to comment.