Documentation ¶
Index ¶
- Constants
- func AbsUint(n1 uint, n2 uint) uint
- func BytesToHexString(data []byte) string
- func BytesToInt(b []byte) []int
- func BytesToInt16(b []byte) int16
- func ClearBytes(arr []byte, len int)
- func CompareHeight(blockHeight uint32, heights []uint32) bool
- func FileExisted(filename string) bool
- func GetUint16Array(source []byte) ([]uint16, error)
- func HexStringToBytes(value string) ([]byte, error)
- func IntToBytes(n int) []byte
- func IsValidHexAddr(s []byte) bool
- func SliceRemove(slice []uint32, h uint32) []uint32
- func ToByteArray(source []uint16) []byte
- type Cache
- type Fixed64
- type GoCache
- type Uint160
- func (u *Uint160) Big() *big.Int
- func (u *Uint160) CompareTo(o Uint160) int
- func (f *Uint160) Deserialize(r io.Reader) error
- func (u *Uint160) Serialize(w io.Writer) (int, error)
- func (u *Uint160) SetBytes(b []byte) *Uint160
- func (f *Uint160) ToAddress() (string, error)
- func (u *Uint160) ToArray() []byte
- type Uint256
Constants ¶
const ( // supported max asset precision is 8 MaximumPrecision = 8 StorageFactor = 100000000 )
const FOOLPROOFPREFIX = 0x02b824 + 1 // +1 for avoid affected by lower 192bits shift-add
FOOLPROOFPREFIX used for fool-proof prefix base58.BitcoinEncoding[21] = 'N', base58.BitcoinEncoding[18] = 'K' 33 = len(base58.Encode( (2**192).Bytes() )), 192 = 8bit * (UINT160SIZE + SHA256CHKSUM) ((21 * 58**35) + (18 * 58**34) + (21 * 58**33)) >> 192 = 0x02b824
const HEXADDRLEN = PREFIXLEN + UINT160SIZE + SHA256CHKSUM
const MaxUint32 = ^uint32(0)
const PREFIXLEN = 3
PREFIXLEN = len( 0x02b825.Bytes() )
const SHA256CHKSUM = 4
const UINT160SIZE = 20
const UINT256SIZE = 32
Variables ¶
This section is empty.
Functions ¶
func BytesToHexString ¶
func BytesToInt ¶
func BytesToInt16 ¶
func ClearBytes ¶
func CompareHeight ¶
func FileExisted ¶
func GetUint16Array ¶
func HexStringToBytes ¶
func IntToBytes ¶
func IsValidHexAddr ¶
func SliceRemove ¶
func ToByteArray ¶
Types ¶
type Cache ¶
type Cache interface { Add([]byte, interface{}) error Get([]byte) (interface{}, bool) Set([]byte, interface{}) error }
Cache is an anstract cache layer
type Fixed64 ¶
type Fixed64 int64
the 64 bit fixed-point number, precise 10^-8
func StringToFixed64 ¶
type GoCache ¶
type GoCache struct {
// contains filtered or unexported fields
}
GoCache is the caching layer implemented by go-cache.
func NewGoCache ¶
NewGoCache creates a go-cache cache with a given default expiration duration and cleanup interval.
func (*GoCache) Add ¶
Add adds an item to the cache only if an item doesn't already exist for the given key, or if the existing item has expired. Returns an error otherwise.
type Uint160 ¶
type Uint160 [UINT160SIZE]uint8
var EmptyUint160 Uint160
func BigToUint160 ¶
func BytesToUint160 ¶
func ToCodeHash ¶
func ToScriptHash ¶
func Uint160ParseFromBytes ¶
type Uint256 ¶
type Uint256 [UINT256SIZE]uint8
var EmptyUint256 Uint256