sarafu-vise-events/event/custodial_registration.go

28 lines
654 B
Go
Raw Permalink Normal View History

2024-10-24 17:00:46 +02:00
package event
import (
geEvent "github.com/grassrootseconomics/eth-tracker/pkg/event"
2025-01-13 18:47:21 +01:00
apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event"
2024-10-24 17:00:46 +02:00
)
const (
2025-01-13 18:47:21 +01:00
evReg = apievent.EventRegistrationTag
//accountCreatedFlag = 9
2024-10-24 17:00:46 +02:00
)
2024-11-03 20:04:44 +01:00
// attempt to coerce event as custodial registration.
2025-01-13 18:47:21 +01:00
func asCustodialRegistrationEvent(gev *geEvent.Event) (*apievent.EventCustodialRegistration, bool) {
2024-10-24 17:00:46 +02:00
var ok bool
2025-01-13 18:47:21 +01:00
var ev apievent.EventCustodialRegistration
2024-10-24 17:00:46 +02:00
if gev.TxType != evReg {
return nil, false
}
pl := gev.Payload
ev.Account, ok = pl["account"].(string)
2024-10-24 17:00:46 +02:00
if !ok {
return nil, false
}
2024-11-03 01:34:28 +01:00
logg.Debugf("parsed ev", "pl", pl, "ev", ev)
2024-10-24 17:00:46 +02:00
return &ev, true
}