2024-10-23 22:01:10 +02:00
|
|
|
package event
|
|
|
|
|
|
|
|
import (
|
2024-10-24 17:00:46 +02:00
|
|
|
"fmt"
|
|
|
|
"log/slog"
|
|
|
|
"os"
|
|
|
|
|
2024-10-23 22:01:10 +02:00
|
|
|
geEvent "github.com/grassrootseconomics/eth-tracker/pkg/event"
|
|
|
|
)
|
|
|
|
|
2024-10-24 17:00:46 +02:00
|
|
|
// TODO: this vocabulary should be public in and provided by the eth-tracker repo
|
|
|
|
const (
|
|
|
|
evGive = "FAUCET_GIVE"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
logg = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}))
|
|
|
|
)
|
|
|
|
|
2024-10-23 22:01:10 +02:00
|
|
|
type Router struct {
|
|
|
|
}
|
|
|
|
|
2024-10-24 17:00:46 +02:00
|
|
|
func(r *Router) Route(gev *geEvent.Event) error {
|
|
|
|
logg.Debug("have event", "ev", gev)
|
|
|
|
evCC, ok := asCustodialRegistrationEvent(gev)
|
2024-10-24 17:17:04 +02:00
|
|
|
if ok {
|
2024-10-24 17:00:46 +02:00
|
|
|
return handleCustodialRegistration(evCC)
|
|
|
|
}
|
|
|
|
return fmt.Errorf("unexpected message")
|
2024-10-23 22:01:10 +02:00
|
|
|
}
|