Skip to content

Commit

Permalink
fix according to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
iostream1308 committed Dec 9, 2024
1 parent b6d5b8c commit 8a5aa55
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
8 changes: 3 additions & 5 deletions v2/cmd/price_filler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
"go.uber.org/zap"
)

// This week I will deploy the new price filler of tradelog v2, which calls my new mark to market.
// After deploying, I will have data to continue creating competition dashboard.
func main() {
app := libapp.NewApp()
app.Name = "trade logs crawler service"
Expand Down Expand Up @@ -71,11 +73,7 @@ func run(c *cli.Context) error {
pancakeswapStorage.New(l, db),
}
httpClient := &http.Client{}
mtmClient, err := mtm.NewMtmClient(c.String(libapp.MarkToMarketURLFlag.Name), httpClient)
if err != nil {
l.Errorw("Error init new mtmClient")
return err
}
mtmClient := mtm.NewMtmClient(c.String(libapp.MarkToMarketURLFlag.Name), httpClient)
dashboardStorage := dashboardStorage.New(l, db)
priceFiller, err := pricefiller.NewPriceFiller(l, s, mtmClient, dashboardStorage)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions v2/pkg/mtm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ type MtmClient struct {
httpClient *http.Client
}

func NewMtmClient(baseURL string, httpClient *http.Client) (*MtmClient, error) {
func NewMtmClient(baseURL string, httpClient *http.Client) *MtmClient {
return &MtmClient{
baseURL: strings.TrimRight(baseURL, "/"),
httpClient: httpClient,
}, nil
}
}

type Token struct {
Expand Down
6 changes: 2 additions & 4 deletions v2/pkg/mtm/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ import (
func TestNewMtmClient(t *testing.T) {
// need mtm url
t.Skip()
MTM_URL := "h"
MTM_URL := ""
httpClient := &http.Client{}
client, err := NewMtmClient(MTM_URL, httpClient)
require.NoError(t, err)
client := NewMtmClient(MTM_URL, httpClient)
rate, err := client.GetHistoricalRate(context.Background(), "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "0xdac17f958d2ee523a2206206994597c13d831ec7", 1, time.UnixMilli(1732870268000))
require.NoError(t, err)
fmt.Println("historical rate", rate)

_, err = client.GetListTokens(context.Background())
require.NoError(t, err)
// fmt.Println("tokens", tokens)
}
6 changes: 2 additions & 4 deletions v2/pkg/price_filler/price_filler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import (
func TestFillPrice(t *testing.T) {
t.Skip("Need to add mtm url")
httpClient := &http.Client{}
mtmClient, err := mtm.NewMtmClient("", httpClient)
require.NoError(t, err)
mtmClient := mtm.NewMtmClient("", httpClient)
filler, err := NewPriceFiller(zap.S(), nil, mtmClient, nil)
require.NoError(t, err)

Expand Down Expand Up @@ -70,8 +69,7 @@ func TestFillPrice(t *testing.T) {
func TestFillBebopPrice(t *testing.T) {
t.Skip("Need to add mtm url")
httpClient := &http.Client{}
mtmClient, err := mtm.NewMtmClient("", httpClient)
require.NoError(t, err)
mtmClient := mtm.NewMtmClient("", httpClient)
filler, err := NewPriceFiller(zap.S(), nil, mtmClient, nil)
require.NoError(t, err)

Expand Down

0 comments on commit 8a5aa55

Please sign in to comment.