diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index 17e3783..379f468 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "slices" "strconv" "time" @@ -269,11 +270,13 @@ func (k Keeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol stri // check if new symbol's oracle script id is existing for _, req := range allBandOracleRequests { if req.OracleScriptId == oracleScriptId { - req.Symbols = append(req.Symbols, symbol) - err := k.SetBandOracleRequest(ctx, *req) - if err != nil { - return errorsmod.Wrapf(types.ErrSetBandOracleRequest, "can not set symbol %s with oracle script id %v", symbol, oracleScriptId) + if !slices.Contains(req.Symbols, symbol) { + req.Symbols = append(req.Symbols, symbol) + if err := k.SetBandOracleRequest(ctx, *req); err != nil { + return errorsmod.Wrapf(types.ErrSetBandOracleRequest, "can not set symbol %s with oracle script id %v", symbol, oracleScriptId) + } } + return nil } }