Skip to content

Commit

Permalink
Merge pull request #30 from okx/hai/change-mock-price
Browse files Browse the repository at this point in the history
Change mock price behavior
  • Loading branch information
trunghai95 authored Nov 9, 2023
2 parents 0682df0 + 2aa96fc commit e885099
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions redisstorage/redisstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package redisstorage

import (
"context"
"math/rand"
"strconv"
"strings"
"time"

"github.com/0xPolygonHermez/zkevm-bridge-service/bridgectrl/pb"
"github.com/0xPolygonHermez/zkevm-node/log"
Expand Down Expand Up @@ -139,10 +137,11 @@ func (s *redisStorageImpl) GetCoinPrice(ctx context.Context, symbols []*pb.Symbo
return nil, err
}

// If enable mock price, always return no price to the front end
if s.mockPrice {
for _, price := range priceList {
price.Price = rand.Float64() // #nosec
price.Time = uint64(time.Now().UnixMilli())
price.Price = 0
price.Time = 0
}
}
return priceList, nil
Expand Down

0 comments on commit e885099

Please sign in to comment.