Skip to content

Commit 392cccb

Browse files
committed
integrate new system to show ranks for token with data from opensea
1 parent 6cfc8a9 commit 392cccb

File tree

18 files changed

+671
-481
lines changed

18 files changed

+671
-481
lines changed

cmd/live.go

+16-13
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/benleb/gloomberg/internal"
1414
"github.com/benleb/gloomberg/internal/collections"
1515
"github.com/benleb/gloomberg/internal/config"
16-
"github.com/benleb/gloomberg/internal/degendata"
16+
"github.com/benleb/gloomberg/internal/degendb/degendata"
1717
"github.com/benleb/gloomberg/internal/gbl"
1818
"github.com/benleb/gloomberg/internal/nemo/gloomberg"
1919
"github.com/benleb/gloomberg/internal/nemo/provider"
@@ -35,6 +35,7 @@ import (
3535
"github.com/benleb/gloomberg/internal/ws"
3636
"github.com/charmbracelet/log"
3737
"github.com/ethereum/go-ethereum/common"
38+
"github.com/muesli/termenv"
3839
"github.com/prometheus/client_golang/prometheus/promhttp"
3940
"github.com/redis/rueidis"
4041
"github.com/spf13/cobra"
@@ -57,6 +58,8 @@ var liveCmd = &cobra.Command{
5758
}
5859

5960
func runGloomberg(_ *cobra.Command, _ []string) {
61+
termenv.DefaultOutput().ClearScreen()
62+
6063
// print header
6164
header := style.GetHeader(internal.GloombergVersion)
6265
fmt.Println(header)
@@ -125,6 +128,14 @@ func runGloomberg(_ *cobra.Command, _ []string) {
125128
gb.Pr(fmt.Sprintf("connected to %s providers: %s", style.AlmostWhiteStyle.Render(fmt.Sprint(len(providers))), style.AlmostWhiteStyle.Render(strings.Join(nodeNames, ", "))))
126129
}
127130

131+
//
132+
// degendata - ranks
133+
go func() {
134+
if err := degendata.LoadOpenseaRanks(gb); err != nil {
135+
gbl.Log.Errorf("error loading opensea ranks: %v", err)
136+
}
137+
}()
138+
128139
//
129140
// queue for everything to print to the console
130141
terminalPrinterQueue := make(chan string, 256)
@@ -135,7 +146,6 @@ func runGloomberg(_ *cobra.Command, _ []string) {
135146
}
136147

137148
// nepa
138-
// queueTokenTransactions := make(chan *totra.TokenTransaction, 256)
139149
queueWsOutTokenTransactions := make(chan *totra.TokenTransaction, 256)
140150
queueWsInTokenTransactions := make(chan *totra.TokenTransaction, 256)
141151
nePa := nepa.NewNePa(gb)
@@ -148,9 +158,6 @@ func runGloomberg(_ *cobra.Command, _ []string) {
148158

149159
// trapri | ttx printer to process and format the token transactions
150160
go trapri.TokenTransactionFormatter(gb, seawa)
151-
// for workerID := 1; workerID <= viper.GetInt("server.workers.ttxFormatter"); workerID++ {
152-
// go trapri.TokenTransactionFormatter(gb, seawa, queueWsOutTokenTransactions, queueWsInTokenTransactions)
153-
// }
154161

155162
// start subscribing
156163
go nePa.Run()
@@ -411,10 +418,6 @@ func runGloomberg(_ *cobra.Command, _ []string) {
411418
}()
412419
}
413420

414-
// log.Print("")
415-
// degendata.ReadOSRawDataFiles(gb, "degendata/raw/opensea/")
416-
// log.Print("")
417-
418421
//
419422
// web ui
420423
if viper.GetBool("web.enabled") {
@@ -423,10 +426,6 @@ func runGloomberg(_ *cobra.Command, _ []string) {
423426
gb.PrMod("web", "web-ui started")
424427
}
425428

426-
if err := degendata.LoadMetadatas(); err != nil {
427-
log.Error(err)
428-
}
429-
430429
// prometheus metrics
431430
if viper.GetBool("metrics.enabled") {
432431
go func() {
@@ -512,6 +511,10 @@ func init() { //nolint:gochecknoinits
512511
liveCmd.Flags().Bool("show-unknown", false, "Show unknown")
513512
_ = viper.BindPFlag("show.unknown", liveCmd.Flags().Lookup("show-unknown"))
514513

514+
// degendb
515+
// liveCmd.Flags().StringVar(&ddbPath, "dd-path", "degendata", "path to degendata dir")
516+
viper.SetDefault("degendata.path", "degendata")
517+
515518
// worker settings
516519
viper.SetDefault("trapri.numOpenSeaEventhandlers", 3)
517520
viper.SetDefault("gloomberg.numEventHubHandlers", 3)

degendata

go.mod

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/mitchellh/mapstructure v1.5.0
2020
github.com/muesli/termenv v0.15.1
2121
github.com/nshafer/phx v0.2.0
22-
github.com/prometheus/client_golang v1.15.1
22+
github.com/prometheus/client_golang v1.16.0
2323
github.com/r3labs/sse/v2 v2.10.0
2424
github.com/redis/go-redis/v9 v9.0.5
2525
github.com/redis/rueidis v1.0.8
@@ -29,7 +29,7 @@ require (
2929
github.com/wealdtech/go-ens/v3 v3.5.5
3030
go.mongodb.org/mongo-driver v1.11.7
3131
go.uber.org/zap v1.24.0
32-
golang.org/x/net v0.10.0
32+
golang.org/x/net v0.11.0
3333
golang.org/x/term v0.9.0
3434
gonum.org/v1/gonum v0.13.0
3535
)
@@ -101,7 +101,7 @@ require (
101101
github.com/pkg/errors v0.9.1 // indirect
102102
github.com/prometheus/client_model v0.3.0 // indirect
103103
github.com/prometheus/common v0.42.0 // indirect
104-
github.com/prometheus/procfs v0.9.0 // indirect
104+
github.com/prometheus/procfs v0.10.1 // indirect
105105
github.com/rivo/uniseg v0.4.4 // indirect
106106
github.com/rogpeppe/go-internal v1.9.0 // indirect
107107
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
@@ -123,11 +123,11 @@ require (
123123
github.com/yusufpapurcu/wmi v1.2.2 // indirect
124124
go.uber.org/atomic v1.11.0 // indirect
125125
go.uber.org/multierr v1.11.0 // indirect
126-
golang.org/x/crypto v0.9.0 // indirect
126+
golang.org/x/crypto v0.10.0 // indirect
127127
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
128128
golang.org/x/sync v0.2.0 // indirect
129129
golang.org/x/sys v0.9.0 // indirect
130-
golang.org/x/text v0.9.0 // indirect
130+
golang.org/x/text v0.10.0 // indirect
131131
golang.org/x/time v0.3.0 // indirect
132132
google.golang.org/protobuf v1.30.0 // indirect
133133
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect

go.sum

+10-10
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
640640
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
641641
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
642642
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
643-
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
644-
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
643+
github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
644+
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
645645
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
646646
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
647647
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -654,8 +654,8 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI
654654
github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc=
655655
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
656656
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
657-
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
658-
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
657+
github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg=
658+
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
659659
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
660660
github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0=
661661
github.com/r3labs/sse/v2 v2.10.0/go.mod h1:Igau6Whc+F17QUgML1fYe1VPZzTV6EMCnYktEmkNJ7I=
@@ -845,8 +845,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
845845
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
846846
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
847847
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
848-
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
849-
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
848+
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
849+
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
850850
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
851851
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
852852
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -948,8 +948,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
948948
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
949949
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
950950
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
951-
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
952-
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
951+
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
952+
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
953953
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
954954
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
955955
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1076,8 +1076,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
10761076
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
10771077
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
10781078
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
1079-
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
1080-
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
1079+
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
1080+
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
10811081
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
10821082
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
10831083
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

internal/degendata/degendata.go

-158
This file was deleted.

0 commit comments

Comments
 (0)