sarafu-vise-events/event/custodial_registration.go
2025-01-13 17:47:26 +00:00

28 lines
654 B
Go

package event
import (
geEvent "github.com/grassrootseconomics/eth-tracker/pkg/event"
apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event"
)
const (
evReg = apievent.EventRegistrationTag
//accountCreatedFlag = 9
)
// attempt to coerce event as custodial registration.
func asCustodialRegistrationEvent(gev *geEvent.Event) (*apievent.EventCustodialRegistration, bool) {
var ok bool
var ev apievent.EventCustodialRegistration
if gev.TxType != evReg {
return nil, false
}
pl := gev.Payload
ev.Account, ok = pl["account"].(string)
if !ok {
return nil, false
}
logg.Debugf("parsed ev", "pl", pl, "ev", ev)
return &ev, true
}