1package validator_scores
23import"strings"45// admin is the samcrew 2-of-3 multisig. Its only power is SetPublisher.6const admin address ="g136j0m08pkm2lwwde9dmlx8uee26llent9s5cpf"78var publisher address = initialPublisher
910// caller returns the frame-verified caller of a crossing function.11funccaller(cur realm) address {12if!cur.IsCurrent(){13panic("validator_scores: stale realm")14}15return cur.Previous().Address()16}1718funcrequirePublisher(cur realm){19ifcaller(cur)!= publisher {20panic("validator_scores: publisher only")21}22}2324// isCanonicalAddress accepts only a lowercase, checksummed g1 address.25funcisCanonicalAddress(s string)bool{26iflen(s)!=40||!strings.HasPrefix(s,"g1")|| strings.ToLower(s)!= s {27returnfalse28}29returnaddress(s).IsValid()30}3132// SetPublisher replaces the publisher. Admin only.33funcSetPublisher(cur realm, addr address){34ifcaller(cur)!= admin {35panic("validator_scores: admin only")36}37if!isCanonicalAddress(string(addr)){38panic("validator_scores: invalid publisher address")39}40 publisher = addr
41}4243// GetAdmin returns the admin address, for post-deployment checks.44funcGetAdmin()string{returnstring(admin)}4546// GetPublisher returns the current publisher address.47funcGetPublisher()string{returnstring(publisher)}48