Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(rfq): move chain utils to new util pkg #2982

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions services/rfq/e2e/rfq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"github.com/synapsecns/sanguine/services/rfq/contracts/fastbridge"
"github.com/synapsecns/sanguine/services/rfq/guard/guarddb"
guardService "github.com/synapsecns/sanguine/services/rfq/guard/service"
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb"
"github.com/synapsecns/sanguine/services/rfq/relayer/service"
"github.com/synapsecns/sanguine/services/rfq/testutil"
"github.com/synapsecns/sanguine/services/rfq/util"
)

type IntegrationSuite struct {
Expand Down Expand Up @@ -288,7 +288,7 @@ func (i *IntegrationSuite) TestETHtoETH() {

// let's figure out the amount of ETH we need
for _, quote := range allQuotes {
if common.HexToAddress(quote.DestTokenAddr) == chain.EthAddress {
if common.HexToAddress(quote.DestTokenAddr) == util.EthAddress {
destAmountBigInt, _ := new(big.Int).SetString(quote.DestAmount, 10)
if destAmountBigInt.Cmp(realWantAmount) > 0 {
// we found our quote!
Expand All @@ -308,9 +308,9 @@ func (i *IntegrationSuite) TestETHtoETH() {
tx, err := originFastBridge.Bridge(auth.TransactOpts, fastbridge.IFastBridgeBridgeParams{
DstChainId: uint32(i.destBackend.GetChainID()),
To: i.userWallet.Address(),
OriginToken: chain.EthAddress,
OriginToken: util.EthAddress,
SendChainGas: true,
DestToken: chain.EthAddress,
DestToken: util.EthAddress,
OriginAmount: realWantAmount,
DestAmount: new(big.Int).Sub(realWantAmount, big.NewInt(1e17)),
Deadline: new(big.Int).SetInt64(time.Now().Add(time.Hour * 24).Unix()),
Expand Down Expand Up @@ -353,7 +353,7 @@ func (i *IntegrationSuite) TestETHtoETH() {

// let's figure out the amount of ETH we need
for _, quote := range allQuotes {
if common.HexToAddress(quote.DestTokenAddr) == chain.EthAddress && quote.DestChainID == originBackendChainID {
if common.HexToAddress(quote.DestTokenAddr) == util.EthAddress && quote.DestChainID == originBackendChainID {
// we should now have some ETH on the origin chain since we claimed
// this should be offered up as inventory
destAmountBigInt, _ := new(big.Int).SetString(quote.DestAmount, 10)
Expand Down
14 changes: 7 additions & 7 deletions services/rfq/e2e/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import (
"github.com/synapsecns/sanguine/services/rfq/guard/guardconfig"
guardConnect "github.com/synapsecns/sanguine/services/rfq/guard/guarddb/connect"
guardService "github.com/synapsecns/sanguine/services/rfq/guard/service"
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
"github.com/synapsecns/sanguine/services/rfq/relayer/relconfig"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb/connect"
"github.com/synapsecns/sanguine/services/rfq/relayer/service"
"github.com/synapsecns/sanguine/services/rfq/testutil"
"github.com/synapsecns/sanguine/services/rfq/util"
)

func (i *IntegrationSuite) setupQuoterAPI() {
Expand Down Expand Up @@ -241,7 +241,7 @@ func (i *IntegrationSuite) getRelayerConfig() relconfig.Config {
Confirmations: 0,
Tokens: map[string]relconfig.TokenConfig{
"ETH": {
Address: chain.EthAddress.String(),
Address: util.EthAddress.String(),
PriceUSD: 2000,
Decimals: 18,
},
Expand All @@ -254,7 +254,7 @@ func (i *IntegrationSuite) getRelayerConfig() relconfig.Config {
Confirmations: 0,
Tokens: map[string]relconfig.TokenConfig{
"ETH": {
Address: chain.EthAddress.String(),
Address: util.EthAddress.String(),
PriceUSD: 2000,
Decimals: 18,
},
Expand Down Expand Up @@ -379,11 +379,11 @@ func (i *IntegrationSuite) setupRelayer() {
}

// Add ETH as quotable token from origin to destination
cfg.QuotableTokens[fmt.Sprintf("%d-%s", originBackendChainID, chain.EthAddress)] = []string{
fmt.Sprintf("%d-%s", destBackendChainID, chain.EthAddress),
cfg.QuotableTokens[fmt.Sprintf("%d-%s", originBackendChainID, util.EthAddress)] = []string{
fmt.Sprintf("%d-%s", destBackendChainID, util.EthAddress),
}
cfg.QuotableTokens[fmt.Sprintf("%d-%s", destBackendChainID, chain.EthAddress)] = []string{
fmt.Sprintf("%d-%s", originBackendChainID, chain.EthAddress),
cfg.QuotableTokens[fmt.Sprintf("%d-%s", destBackendChainID, util.EthAddress)] = []string{
fmt.Sprintf("%d-%s", originBackendChainID, util.EthAddress),
}

var err error
Expand Down
3 changes: 2 additions & 1 deletion services/rfq/relayer/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/synapsecns/sanguine/services/rfq/contracts/fastbridge"
"github.com/synapsecns/sanguine/services/rfq/relayer/relconfig"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb"
"github.com/synapsecns/sanguine/services/rfq/util"
)

// Chain is a chain helper for relayer.
Expand Down Expand Up @@ -75,7 +76,7 @@ func (c Chain) SubmitRelay(ctx context.Context, request reldb.QuoteRequest) (uin
var err error

// Check to see if ETH should be sent to destination
if IsGasToken(request.Transaction.DestToken) {
if util.IsGasToken(request.Transaction.DestToken) {
gasAmount = request.Transaction.DestAmount
} else if request.Transaction.SendChainGas {
gasAmount, err = c.Bridge.ChainGasAmount(&bind.CallOpts{Context: ctx})
Expand Down
14 changes: 7 additions & 7 deletions services/rfq/relayer/inventory/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"github.com/synapsecns/sanguine/ethergo/client"
"github.com/synapsecns/sanguine/ethergo/submitter"
"github.com/synapsecns/sanguine/services/rfq/contracts/ierc20"
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
"github.com/synapsecns/sanguine/services/rfq/relayer/relconfig"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb"
"github.com/synapsecns/sanguine/services/rfq/util"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/trace"
Expand Down Expand Up @@ -95,7 +95,7 @@ func (i *inventoryManagerImpl) GetCommittableBalance(ctx context.Context, chainI
balance := committableBalances[chainID][token]
// the gas token may not be registered in the inventory tokens map,
// but it is always tracked in gasBalances.
if balance == nil && token == chain.EthAddress {
if balance == nil && token == util.EthAddress {
gasBalance, ok := i.gasBalances[chainID]
if !ok || gasBalance == nil {
return nil, ErrUnsupportedChain
Expand Down Expand Up @@ -311,7 +311,7 @@ func (i *inventoryManagerImpl) ApproveAllTokens(ctx context.Context) error {
// approve RFQ contract.
// Note: in the case where submitter hasn't finished from last boot,
// this will double submit approvals unfortunately.
if address != chain.EthAddress && token.Allowances[contractRFQ].Cmp(big.NewInt(0)) == 0 {
if address != util.EthAddress && token.Allowances[contractRFQ].Cmp(big.NewInt(0)) == 0 {
tokenAddr := address // capture func literal
contractAddr, err := i.cfg.GetRFQAddress(chainID)
if err != nil {
Expand All @@ -324,7 +324,7 @@ func (i *inventoryManagerImpl) ApproveAllTokens(ctx context.Context) error {
}

// approve SynapseCCTP contract
if address != chain.EthAddress && token.Allowances[contractSynapseCCTP].Cmp(big.NewInt(0)) == 0 {
if address != util.EthAddress && token.Allowances[contractSynapseCCTP].Cmp(big.NewInt(0)) == 0 {
tokenAddr := address // capture func literal
contractAddr, err := i.cfg.GetSynapseCCTPAddress(chainID)
if err != nil {
Expand All @@ -337,7 +337,7 @@ func (i *inventoryManagerImpl) ApproveAllTokens(ctx context.Context) error {
}

// approve TokenMessenger contract
if address != chain.EthAddress && token.Allowances[contractTokenMessenger].Cmp(big.NewInt(0)) == 0 {
if address != util.EthAddress && token.Allowances[contractTokenMessenger].Cmp(big.NewInt(0)) == 0 {
tokenAddr := address // capture func literal
contractAddr, err := i.cfg.GetTokenMessengerAddress(chainID)
if err != nil {
Expand Down Expand Up @@ -409,7 +409,7 @@ func (i *inventoryManagerImpl) HasSufficientGas(parentCtx context.Context, chain
span.SetAttributes(attribute.String("gas_value", gasValue.String()))
}

gasBalance, err := i.GetCommittableBalance(ctx, chainID, chain.EthAddress)
gasBalance, err := i.GetCommittableBalance(ctx, chainID, util.EthAddress)
if err != nil {
return false, fmt.Errorf("error getting committable gas on origin: %w", err)
}
Expand Down Expand Up @@ -541,7 +541,7 @@ func (i *inventoryManagerImpl) initializeTokens(parentCtx context.Context, cfg r

var token common.Address
if rtoken.IsGasToken {
token = chain.EthAddress
token = util.EthAddress
} else {
token = common.HexToAddress(tokenCfg.Address)
}
Expand Down
4 changes: 2 additions & 2 deletions services/rfq/relayer/quoter/quoter.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (

"github.com/ipfs/go-log"
"github.com/synapsecns/sanguine/core/metrics"
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
"github.com/synapsecns/sanguine/services/rfq/relayer/pricer"
"github.com/synapsecns/sanguine/services/rfq/relayer/relconfig"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb"
"github.com/synapsecns/sanguine/services/rfq/util"
"golang.org/x/exp/slices"
"golang.org/x/sync/errgroup"

Expand Down Expand Up @@ -539,7 +539,7 @@ func (m *Manager) getOriginAmount(parentCtx context.Context, origin, dest int, a

// deductGasCost deducts the gas cost from the quote amount, if necessary.
func (m *Manager) deductGasCost(parentCtx context.Context, quoteAmount *big.Int, address common.Address, dest int) (quoteAmountAdj *big.Int, err error) {
if !chain.IsGasToken(address) {
if !util.IsGasToken(address) {
return quoteAmount, nil
}

Expand Down
16 changes: 8 additions & 8 deletions services/rfq/relayer/quoter/quoter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
fetcherMocks "github.com/synapsecns/sanguine/ethergo/submitter/mocks"
"github.com/synapsecns/sanguine/services/rfq/api/model"
"github.com/synapsecns/sanguine/services/rfq/contracts/fastbridge"
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
inventoryMocks "github.com/synapsecns/sanguine/services/rfq/relayer/inventory/mocks"
"github.com/synapsecns/sanguine/services/rfq/relayer/pricer"
priceMocks "github.com/synapsecns/sanguine/services/rfq/relayer/pricer/mocks"
"github.com/synapsecns/sanguine/services/rfq/relayer/quoter"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb"
"github.com/synapsecns/sanguine/services/rfq/util"
)

func (s *QuoterSuite) TestGenerateQuotes() {
Expand All @@ -43,7 +43,7 @@ func (s *QuoterSuite) TestGenerateQuotes() {
func (s *QuoterSuite) TestGenerateQuotesForNativeToken() {
// Generate quotes for ETH on the destination chain.
balance, _ := new(big.Int).SetString("1000000000000000000", 10) // 1 ETH
quotes, err := s.manager.GenerateQuotes(s.GetTestContext(), int(s.destinationEth), chain.EthAddress, balance)
quotes, err := s.manager.GenerateQuotes(s.GetTestContext(), int(s.destinationEth), util.EthAddress, balance)
s.Require().NoError(err)

minGasToken, err := s.config.GetMinGasToken(int(s.destination))
Expand All @@ -54,9 +54,9 @@ func (s *QuoterSuite) TestGenerateQuotesForNativeToken() {
expectedQuotes := []model.PutQuoteRequest{
{
OriginChainID: int(s.origin),
OriginTokenAddr: chain.EthAddress.String(),
OriginTokenAddr: util.EthAddress.String(),
DestChainID: int(s.destinationEth),
DestTokenAddr: chain.EthAddress.String(),
DestTokenAddr: util.EthAddress.String(),
DestAmount: expectedQuoteAmount.String(),
MaxOriginAmount: expectedQuoteAmount.String(),
FixedFee: "150000000000000000", // (500k gas + 1m gas) * 100 gwei
Expand All @@ -68,7 +68,7 @@ func (s *QuoterSuite) TestGenerateQuotesForNativeToken() {
s.config.BaseChainConfig.MinGasToken = "100000000000000000" // 0.1 ETH
s.manager.SetConfig(s.config)

quotes, err = s.manager.GenerateQuotes(s.GetTestContext(), int(s.destinationEth), chain.EthAddress, balance)
quotes, err = s.manager.GenerateQuotes(s.GetTestContext(), int(s.destinationEth), util.EthAddress, balance)
s.Require().NoError(err)

minGasToken, err = s.config.GetMinGasToken(int(s.destination))
Expand All @@ -79,9 +79,9 @@ func (s *QuoterSuite) TestGenerateQuotesForNativeToken() {
expectedQuotes = []model.PutQuoteRequest{
{
OriginChainID: int(s.origin),
OriginTokenAddr: chain.EthAddress.String(),
OriginTokenAddr: util.EthAddress.String(),
DestChainID: int(s.destinationEth),
DestTokenAddr: chain.EthAddress.String(),
DestTokenAddr: util.EthAddress.String(),
DestAmount: expectedQuoteAmount.String(),
MaxOriginAmount: expectedQuoteAmount.String(),
FixedFee: "150000000000000000", // (500k gas + 1m gas) * 100 gwei
Expand All @@ -93,7 +93,7 @@ func (s *QuoterSuite) TestGenerateQuotesForNativeToken() {
s.config.BaseChainConfig.MinGasToken = "1000000000000000001" // 0.1 ETH
s.manager.SetConfig(s.config)

quotes, err = s.manager.GenerateQuotes(s.GetTestContext(), int(s.destinationEth), chain.EthAddress, balance)
quotes, err = s.manager.GenerateQuotes(s.GetTestContext(), int(s.destinationEth), util.EthAddress, balance)
s.NoError(err)
s.Equal(quotes[0].DestAmount, "0")
s.Equal(quotes[0].MaxOriginAmount, "0")
Expand Down
6 changes: 3 additions & 3 deletions services/rfq/relayer/quoter/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"github.com/synapsecns/sanguine/core/testsuite"
clientMocks "github.com/synapsecns/sanguine/ethergo/client/mocks"
fetcherMocks "github.com/synapsecns/sanguine/ethergo/submitter/mocks"
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
inventoryMocks "github.com/synapsecns/sanguine/services/rfq/relayer/inventory/mocks"
"github.com/synapsecns/sanguine/services/rfq/relayer/pricer"
priceMocks "github.com/synapsecns/sanguine/services/rfq/relayer/pricer/mocks"
"github.com/synapsecns/sanguine/services/rfq/relayer/quoter"
"github.com/synapsecns/sanguine/services/rfq/relayer/relconfig"
"github.com/synapsecns/sanguine/services/rfq/util"
)

// Server suite is the main API server test suite.
Expand Down Expand Up @@ -53,7 +53,7 @@ func (s *QuoterSuite) SetupTest() {
Decimals: 6,
},
"ETH": {
Address: chain.EthAddress.String(),
Address: util.EthAddress.String(),
PriceUSD: 2000,
Decimals: 18,
},
Expand All @@ -78,7 +78,7 @@ func (s *QuoterSuite) SetupTest() {
int(s.destinationEth): {
Tokens: map[string]relconfig.TokenConfig{
"ETH": {
Address: chain.EthAddress.String(),
Address: util.EthAddress.String(),
PriceUSD: 2000,
Decimals: 18,
},
Expand Down
6 changes: 3 additions & 3 deletions services/rfq/relayer/relapi/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/synapsecns/sanguine/core/retry"
submitterdb "github.com/synapsecns/sanguine/ethergo/submitter/db"
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
"github.com/synapsecns/sanguine/services/rfq/relayer/relapi"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb"
"github.com/synapsecns/sanguine/services/rfq/util"
)

func (c *RelayerClientSuite) TestHealth() {
Expand Down Expand Up @@ -72,7 +72,7 @@ func (c *RelayerClientSuite) TestEthWithdraw() {
ChainID: uint32(backend.GetChainID()),
To: testWithdrawalAddress,
Amount: withdrawalAmount.String(),
TokenAddress: chain.EthAddress,
TokenAddress: util.EthAddress,
})
c.Require().NoError(err)

Expand Down Expand Up @@ -171,7 +171,7 @@ func (c *RelayerClientSuite) TestEthWithdrawCLI() {
ChainID: c.underlying.originChainID,
To: common.HexToAddress(testWithdrawalAddress.String()),
Amount: "1000000000000000000",
TokenAddress: chain.EthAddress,
TokenAddress: util.EthAddress,
})
c.Require().NoError(err)

Expand Down
8 changes: 5 additions & 3 deletions services/rfq/relayer/relapi/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ package relapi
import (
"encoding/json"
"fmt"
"github.com/synapsecns/sanguine/core/metrics"
"go.opentelemetry.io/otel/attribute"
"math/big"
"net/http"

"github.com/synapsecns/sanguine/core/metrics"
"go.opentelemetry.io/otel/attribute"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"
"github.com/synapsecns/sanguine/ethergo/submitter"
"github.com/synapsecns/sanguine/services/rfq/contracts/ierc20"
"github.com/synapsecns/sanguine/services/rfq/relayer/relconfig"
"github.com/synapsecns/sanguine/services/rfq/util"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
Expand Down Expand Up @@ -215,7 +217,7 @@ func (h *Handler) Withdraw(c *gin.Context) {
}

//nolint: nestif
if chain.IsGasToken(req.TokenAddress) {
if util.IsGasToken(req.TokenAddress) {
nonce, err = h.submitter.SubmitTransaction(ctx, big.NewInt(int64(req.ChainID)), func(transactor *bind.TransactOpts) (tx *types.Transaction, err error) {
bc := bind.NewBoundContract(req.To, abi.ABI{}, h.chains[req.ChainID].Client, h.chains[req.ChainID].Client, h.chains[req.ChainID].Client)
if transactor.GasPrice != nil {
Expand Down
6 changes: 3 additions & 3 deletions services/rfq/relayer/relapi/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"testing"

"github.com/ethereum/go-ethereum/params"
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
"github.com/synapsecns/sanguine/services/rfq/testutil"
"github.com/synapsecns/sanguine/services/rfq/util"

"github.com/Flaque/filet"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand Down Expand Up @@ -104,10 +104,10 @@ func (c *RelayerServerSuite) SetupTest() {
},
QuotableTokens: map[string][]string{
// gas tokens.
fmt.Sprintf("%d-%s", c.originChainID, chain.EthAddress): {
fmt.Sprintf("%d-%s", c.originChainID, util.EthAddress): {
// not used for this test
},
fmt.Sprintf("%d-%s", c.destChainID, chain.EthAddress): {
fmt.Sprintf("%d-%s", c.destChainID, util.EthAddress): {
// not used for this test
},
c.getMockTokenID(c.testBackends[uint64(c.originChainID)]): {
Expand Down
4 changes: 2 additions & 2 deletions services/rfq/relayer/relconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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"
"github.com/synapsecns/sanguine/services/rfq/util"
"gopkg.in/yaml.v2"

"path/filepath"
Expand Down Expand Up @@ -259,7 +259,7 @@ func (c Config) validateTokenDecimals(ctx context.Context, omniClient omniClient
}

// Check if the token is the gas token. SHOULD BE 18.
if tokenCFG.Address == chain.EthAddress.String() {
if tokenCFG.Address == util.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)
}
Expand Down
Loading
Loading