sarafu-vise-events/event/route.go
2024-10-24 16:00:46 +01:00

31 lines
595 B
Go

package event
import (
"fmt"
"log/slog"
"os"
geEvent "github.com/grassrootseconomics/eth-tracker/pkg/event"
)
// 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}))
)
type Router struct {
}
func(r *Router) Route(gev *geEvent.Event) error {
logg.Debug("have event", "ev", gev)
evCC, ok := asCustodialRegistrationEvent(gev)
if !ok {
return handleCustodialRegistration(evCC)
}
return fmt.Errorf("unexpected message")
}