func (Str) Type() Type {
	return TypeStr
}
Type implements the Value interface for the Str type.
package v0
import (
	"bytes"
	"encoding"
	"encoding/base64"
	"encoding/binary"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"math/big"
	"sort"
	"strings"
	"github.com/ethereum/go-ethereum/common/math"
)
type Type string
const (
	TypeAddress = "address"
	TypeStr     = "str"
	TypeB32     = "b32"
	TypeB       = "b"
	TypeI8      = "i8"
	TypeI16     = "i16"
	TypeI32     = "i32"
	TypeI64     = "i64"
	TypeI128    = "i128"
	TypeI256    = "i256"
	TypeU8      = "u8"
	TypeU16     = "u16"
	TypeU32     = "u32"
	TypeU64     = "u64"
	TypeU128    = "u128"
	TypeU256    = "u256"
	TypeRecord  = "record"
	TypeList    = "list"
)
type Value interface {
	encoding.BinaryMarshaler
	Type() Type
	Equal(Value) bool
}
type Address string
func (Address) Type() Type {
	return TypeAddress
}
func (address Address) Equal(other Value) bool {
	if other.Type() != TypeAddress {
		return false
	}
	return address == other.(Address)
}
func (address *Address) UnmarshalJSON(data []byte) error {
	var v string
	err := json.Unmarshal(data, &v)
	*address = Address(v)
	return err
}
func (address Address) MarshalBinary() ([]byte, error) {
	buf := new(bytes.Buffer)
	addressBytes := []byte(address)
	if err := binary.Write(buf, binary.LittleEndian, uint64(len(addressBytes))); err != nil {
		return buf.Bytes(), fmt.Errorf("cannot write address len: %v", err)
	}
	if err := binary.Write(buf, binary.LittleEndian, addressBytes); err != nil {
		return buf.Bytes(), fmt.Errorf("cannot write address data: %v", err)
	}
	return buf.Bytes(), nil
}
func (address *Address) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)
	var numBytes uint64
	if err := binary.Read(buf, binary.LittleEndian, &numBytes); err != nil {
		return fmt.Errorf("cannot read address len: %v", err)
	}
	if numBytes > 10*1024 {
		return fmt.Errorf("cannot read address: too many bytes")
	}
	addressBytes := make([]byte, numBytes)
	if _, err := buf.Read(addressBytes); err != nil {
		return fmt.Errorf("cannot read address data: %v", err)
	}
	*address = Address(addressBytes)
	return nil
}
type Str string