daoauth source pure
Package daoauth writes the arguments of a governed action as one typed, canonical string. memba\_gov stores that stri...
Package daoauth writes the arguments of a governed action as one typed, canonical string. memba_gov stores that string with the proposal and the target realm rebuilds it from its real arguments when it consumes the approval: the two must be equal byte for byte. Each value has exactly one spelling, so equal actions always encode to equal strings.
Fields are joined by "|":
Example
1u:<uint64> decimal, no sign, no leading zero
2i:<int64> decimal, "-" only when negative, no leading zero
3b:0 or b:1 bool
4a:<address> the lowercase bech32 text the chain gives a caller
5s:<len>:<text> length-prefixed printable ASCII (0x20-0x7E)
Strings are compared as raw bytes, with no Unicode normalisation; text is printable ASCII so that what a voter reads is exactly what executes.
1
1
4
func ValidAddress
ValidAddress reports whether a is "g1" and 38 lowercase bech32 characters whose checksum is the original bech32 one.
func ValidText
ValidText reports whether s is at most MaxText bytes of printable ASCII (0x20 to 0x7E): no control, invisible, combining or direction-changing character can make a value read differently from what executes.
func New
func Parse
Parse decodes s and refuses any text that is not the canonical encoding of its own fields. The empty string is the encoding of no fields.
2
type Args
structArgs accumulates fields in order. Methods panic on a value that has no canonical form, so a realm can never build an approval nobody can match.
type Field
structField is one decoded value: Tag is 'u', 'i', 'b', 'a' or 's', and Value is its text, without the length prefix for strings.
3
- errors stdlib
- strconv stdlib
- strings stdlib