From 1f0b71cd8a3a2fa609bf8d82dd534e15106dc39f Mon Sep 17 00:00:00 2001 From: Daniel Wasserman Date: Wed, 9 Oct 2024 14:39:46 -0500 Subject: [PATCH] Feat: handle MaxQuoteAmount in quoter test --- services/rfq/relayer/quoter/quoter_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/services/rfq/relayer/quoter/quoter_test.go b/services/rfq/relayer/quoter/quoter_test.go index b10370cda7..7610b093ad 100644 --- a/services/rfq/relayer/quoter/quoter_test.go +++ b/services/rfq/relayer/quoter/quoter_test.go @@ -178,15 +178,18 @@ func (s *QuoterSuite) TestGetOriginAmount() { quoteOffset float64 minQuoteAmount string maxBalance string + maxQuoteAmount string } setQuoteParams := func(params quoteParams) { s.config.BaseChainConfig.QuotePct = ¶ms.quotePct destTokenCfg := s.config.Chains[dest].Tokens["USDC"] destTokenCfg.MinQuoteAmount = params.minQuoteAmount + destTokenCfg.MaxQuoteAmount = params.maxQuoteAmount originTokenCfg := s.config.Chains[origin].Tokens["USDC"] originTokenCfg.QuoteOffsetBps = params.quoteOffset originTokenCfg.MaxBalance = ¶ms.maxBalance + originTokenCfg.MaxQuoteAmount = params.maxQuoteAmount s.config.Chains[dest].Tokens["USDC"] = destTokenCfg s.config.Chains[origin].Tokens["USDC"] = originTokenCfg s.manager.SetConfig(s.config) @@ -267,6 +270,19 @@ func (s *QuoterSuite) TestGetOriginAmount() { expectedAmount = big.NewInt(1000_000_000) s.Equal(expectedAmount, quoteAmount) + // Set QuotePct to 100 with MinQuoteAmount of 0 and MaxQuoteAmount of 500; should be 500. + setQuoteParams(quoteParams{ + quotePct: 100, + quoteOffset: 0, + minQuoteAmount: "0", + maxBalance: "0", + maxQuoteAmount: "500", + }) + quoteAmount, err = s.manager.GetOriginAmount(s.GetTestContext(), input) + s.NoError(err) + expectedAmount = big.NewInt(500_000_000) + s.Equal(expectedAmount, quoteAmount) + // Set QuotePct to 25 with MinQuoteAmount of 1500 and MaxBalance of 1200; should be 200. setQuoteParams(quoteParams{ quotePct: 25,