validate.gno
0.71 Kb · 17 lines
1package game
2
3// validAddress is the one string rule of this realm: the addresses it keys
4// on. Everything else it prints is a number, a param key from its own
5// registry or an address checked here.
6
7// validAddress reports whether addr is a valid address in its canonical,
8// lowercase form.
9//
10// Bech32 can also be written in all capitals, and address.IsValid accepts
11// that. To this realm the capitals would be a second key for the same
12// account: a second player record, a second line on a leaderboard, an admin
13// who can never be matched to a caller. Bech32 does not allow mixing cases,
14// so looking at the first character is enough.
15func validAddress(addr address) bool {
16 return addr.IsValid() && addr[0] == 'g'
17}