types

package
v0.0.7-alphanet Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 11 Imported by: 17

Documentation

Index

Constants

View Source
const (
	AddressPrefix   = "z"
	AddressSize     = 1 + AddressCoreSize
	AddressCoreSize = 19
)
View Source
const (
	UserAddrByte     = byte(0)
	ContractAddrByte = byte(1)
)
View Source
const (
	ZTSPrefix              = "zts"
	ZenonTokenStandardSize = 10
)
View Source
const (
	HashSize = 32
)

Variables

View Source
var (
	PillarContract      = parseEmbedded("z1qxemdeddedxpyllarxxxxxxxxxxxxxxxsy3fmg")
	PlasmaContract      = parseEmbedded("z1qxemdeddedxplasmaxxxxxxxxxxxxxxxxsctrp")
	StakeContract       = parseEmbedded("z1qxemdeddedxstakexxxxxxxxxxxxxxxxjv8v62")
	SporkContract       = parseEmbedded("z1qxemdeddedxsp0rkxxxxxxxxxxxxxxxx956u48")
	TokenContract       = parseEmbedded("z1qxemdeddedxt0kenxxxxxxxxxxxxxxxxh9amk0")
	SentinelContract    = parseEmbedded("z1qxemdeddedxsentynelxxxxxxxxxxxxxwy0r2r")
	SwapContract        = parseEmbedded("z1qxemdeddedxswapxxxxxxxxxxxxxxxxxxl4yww")
	LiquidityContract   = parseEmbedded("z1qxemdeddedxlyquydytyxxxxxxxxxxxxflaaae")
	AcceleratorContract = parseEmbedded("z1qxemdeddedxaccelerat0rxxxxxxxxxxp4tk22")
	HtlcContract        = parseEmbedded("z1qxemdeddedxhtlcxxxxxxxxxxxxxxxxxygecvw")
	BridgeContract      = parseEmbedded("z1qxemdeddedxdrydgexxxxxxxxxxxxxxxmqgr0d")

	EmbeddedContracts = []Address{PlasmaContract, PillarContract, TokenContract, SentinelContract, SwapContract, StakeContract, SporkContract, LiquidityContract, AcceleratorContract, HtlcContract, BridgeContract}
	EmbeddedWUpdate   = []Address{PillarContract, StakeContract, SentinelContract, LiquidityContract, AcceleratorContract}

	SporkAddress *Address
)
View Source
var (
	AcceleratorSpork        = NewImplementedSpork("6d2b1e6cb4025f2f45533f0fe22e9b7ce2014d91cc960471045fa64eee5a6ba3")
	HtlcSpork               = NewImplementedSpork("ceb7e3808ef17ea910adda2f3ab547be4cdfb54de8400ce3683258d06be1354b")
	BridgeAndLiquiditySpork = NewImplementedSpork("ddd43466769461c5b5d109c639da0f50a7eeb96ad6e7274b1928a35c431d7b1b")

	ImplementedSporksMap = map[Hash]bool{
		AcceleratorSpork.SporkId:        true,
		HtlcSpork.SporkId:               true,
		BridgeAndLiquiditySpork.SporkId: true,
	}
)
View Source
var QsrTokenStandard = ParseZTSPanic("zts1qsrxxxxxxxxxxxxxmrhjll")
View Source
var ZeroAddress = Address{}
View Source
var ZeroHash = Hash{}
View Source
var ZeroHashHeight = HashHeight{
	Hash:   ZeroHash,
	Height: 0,
}
View Source
var ZeroTokenStandard = ZenonTokenStandard{}
View Source
var ZnnTokenStandard = ParseZTSPanic("zts1znnxxxxxxxxxxxxx9z4ulx")

Functions

func IsEmbeddedAddress

func IsEmbeddedAddress(addr Address) bool

Types

type AccountHeader

type AccountHeader struct {
	Address Address `json:"address"`
	HashHeight
}

func DeProtoAccountHeader

func DeProtoAccountHeader(pb *AccountHeaderProto) *AccountHeader

func DeserializeAccountHeader

func DeserializeAccountHeader(data []byte) (*AccountHeader, error)

func (*AccountHeader) Bytes

func (abh *AccountHeader) Bytes() []byte

func (*AccountHeader) Identifier

func (abh *AccountHeader) Identifier() HashHeight

func (*AccountHeader) Proto

func (abh *AccountHeader) Proto() *AccountHeaderProto

func (*AccountHeader) Serialize

func (abh *AccountHeader) Serialize() ([]byte, error)

type AccountHeaderProto

type AccountHeaderProto struct {
	Address              *AddressProto    `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	HashHeight           *HashHeightProto `protobuf:"bytes,2,opt,name=hashHeight,proto3" json:"hashHeight,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*AccountHeaderProto) Descriptor

func (*AccountHeaderProto) Descriptor() ([]byte, []int)

func (*AccountHeaderProto) GetAddress

func (m *AccountHeaderProto) GetAddress() *AddressProto

func (*AccountHeaderProto) GetHashHeight

func (m *AccountHeaderProto) GetHashHeight() *HashHeightProto

func (*AccountHeaderProto) ProtoMessage

func (*AccountHeaderProto) ProtoMessage()

func (*AccountHeaderProto) Reset

func (m *AccountHeaderProto) Reset()

func (*AccountHeaderProto) String

func (m *AccountHeaderProto) String() string

func (*AccountHeaderProto) XXX_DiscardUnknown

func (m *AccountHeaderProto) XXX_DiscardUnknown()

func (*AccountHeaderProto) XXX_Marshal

func (m *AccountHeaderProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AccountHeaderProto) XXX_Merge

func (m *AccountHeaderProto) XXX_Merge(src proto.Message)

func (*AccountHeaderProto) XXX_Size

func (m *AccountHeaderProto) XXX_Size() int

func (*AccountHeaderProto) XXX_Unmarshal

func (m *AccountHeaderProto) XXX_Unmarshal(b []byte) error

type Address

type Address [AddressSize]byte

func BytesToAddress

func BytesToAddress(b []byte) (Address, error)

func DeProtoAddress

func DeProtoAddress(pb *AddressProto) *Address

func ParseAddress

func ParseAddress(addrStr string) (Address, error)

func ParseAddressPanic

func ParseAddressPanic(addrStr string) Address

func PubKeyToAddress

func PubKeyToAddress(pubKey []byte) Address

func (Address) Bytes

func (addr Address) Bytes() []byte

func (Address) IsZero

func (addr Address) IsZero() bool

func (Address) MarshalText

func (addr Address) MarshalText() ([]byte, error)

func (*Address) Proto

func (addr *Address) Proto() *AddressProto

func (*Address) SetBytes

func (addr *Address) SetBytes(b []byte) error

func (Address) String

func (addr Address) String() string

func (*Address) UnmarshalText

func (addr *Address) UnmarshalText(input []byte) error

type AddressProto

type AddressProto struct {
	Address              []byte   `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*AddressProto) Descriptor

func (*AddressProto) Descriptor() ([]byte, []int)

func (*AddressProto) GetAddress

func (m *AddressProto) GetAddress() []byte

func (*AddressProto) ProtoMessage

func (*AddressProto) ProtoMessage()

func (*AddressProto) Reset

func (m *AddressProto) Reset()

func (*AddressProto) String

func (m *AddressProto) String() string

func (*AddressProto) XXX_DiscardUnknown

func (m *AddressProto) XXX_DiscardUnknown()

func (*AddressProto) XXX_Marshal

func (m *AddressProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AddressProto) XXX_Merge

func (m *AddressProto) XXX_Merge(src proto.Message)

func (*AddressProto) XXX_Size

func (m *AddressProto) XXX_Size() int

func (*AddressProto) XXX_Unmarshal

func (m *AddressProto) XXX_Unmarshal(b []byte) error

type Hash

type Hash [HashSize]byte

func BytesToHash

func BytesToHash(b []byte) (Hash, error)

func BytesToHashPanic

func BytesToHashPanic(b []byte) Hash

func DeProtoHash

func DeProtoHash(pb *HashProto) *Hash

func HexToHash

func HexToHash(hexStr string) (Hash, error)

func HexToHashPanic

func HexToHashPanic(hexStr string) Hash

func NewHash

func NewHash(data []byte) Hash

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) IsZero

func (h Hash) IsZero() bool

func (Hash) MarshalText

func (h Hash) MarshalText() ([]byte, error)

func (*Hash) Proto

func (h *Hash) Proto() *HashProto

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte) error

func (Hash) String

func (h Hash) String() string

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(input []byte) error

type HashHeight

type HashHeight struct {
	Hash   Hash   `json:"hash"`
	Height uint64 `json:"height"`
}

func DeProtoHashHeight

func DeProtoHashHeight(pb *HashHeightProto) *HashHeight

func DeserializeHashHeight

func DeserializeHashHeight(data []byte) (*HashHeight, error)

func (*HashHeight) Bytes

func (b *HashHeight) Bytes() []byte

func (HashHeight) IsZero

func (b HashHeight) IsZero() bool

func (*HashHeight) Proto

func (b *HashHeight) Proto() *HashHeightProto

func (*HashHeight) Serialize

func (b *HashHeight) Serialize() []byte

type HashHeightProto

type HashHeightProto struct {
	Hash                 *HashProto `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	Height               uint64     `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*HashHeightProto) Descriptor

func (*HashHeightProto) Descriptor() ([]byte, []int)

func (*HashHeightProto) GetHash

func (m *HashHeightProto) GetHash() *HashProto

func (*HashHeightProto) GetHeight

func (m *HashHeightProto) GetHeight() uint64

func (*HashHeightProto) ProtoMessage

func (*HashHeightProto) ProtoMessage()

func (*HashHeightProto) Reset

func (m *HashHeightProto) Reset()

func (*HashHeightProto) String

func (m *HashHeightProto) String() string

func (*HashHeightProto) XXX_DiscardUnknown

func (m *HashHeightProto) XXX_DiscardUnknown()

func (*HashHeightProto) XXX_Marshal

func (m *HashHeightProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HashHeightProto) XXX_Merge

func (m *HashHeightProto) XXX_Merge(src proto.Message)

func (*HashHeightProto) XXX_Size

func (m *HashHeightProto) XXX_Size() int

func (*HashHeightProto) XXX_Unmarshal

func (m *HashHeightProto) XXX_Unmarshal(b []byte) error

type HashProto

type HashProto struct {
	Hash                 []byte   `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*HashProto) Descriptor

func (*HashProto) Descriptor() ([]byte, []int)

func (*HashProto) GetHash

func (m *HashProto) GetHash() []byte

func (*HashProto) ProtoMessage

func (*HashProto) ProtoMessage()

func (*HashProto) Reset

func (m *HashProto) Reset()

func (*HashProto) String

func (m *HashProto) String() string

func (*HashProto) XXX_DiscardUnknown

func (m *HashProto) XXX_DiscardUnknown()

func (*HashProto) XXX_Marshal

func (m *HashProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HashProto) XXX_Merge

func (m *HashProto) XXX_Merge(src proto.Message)

func (*HashProto) XXX_Size

func (m *HashProto) XXX_Size() int

func (*HashProto) XXX_Unmarshal

func (m *HashProto) XXX_Unmarshal(b []byte) error

type ImplementedSpork

type ImplementedSpork struct {
	SporkId Hash
}

func NewImplementedSpork

func NewImplementedSpork(SporkIdStr string) *ImplementedSpork

type PillarDelegation

type PillarDelegation struct {
	Name      string
	Producing Address
	Weight    *big.Int
}

func ToPillarDelegation

func ToPillarDelegation(details []*PillarDelegationDetail) []*PillarDelegation

ToPillarDelegation converts delegationDetail to delegation to save memory by dropping backers

func (*PillarDelegation) String

func (v *PillarDelegation) String() string

Used for logging purposes

type PillarDelegationDetail

type PillarDelegationDetail struct {
	PillarDelegation
	Backers map[Address]*big.Int
}

func (*PillarDelegationDetail) Merge

Add all values together into this object

func (*PillarDelegationDetail) Reduce

func (pdd *PillarDelegationDetail) Reduce(count int64)

Reduce all values by dividing them by count

type SortPDByWeight

type SortPDByWeight []*PillarDelegation

func (SortPDByWeight) Len

func (a SortPDByWeight) Len() int

func (SortPDByWeight) Less

func (a SortPDByWeight) Less(i, j int) bool

func (SortPDByWeight) Swap

func (a SortPDByWeight) Swap(i, j int)

type SortPDDByWeight

type SortPDDByWeight []*PillarDelegationDetail

func (SortPDDByWeight) Len

func (a SortPDDByWeight) Len() int

func (SortPDDByWeight) Less

func (a SortPDDByWeight) Less(i, j int) bool

func (SortPDDByWeight) Swap

func (a SortPDDByWeight) Swap(i, j int)

type ZenonTokenStandard

type ZenonTokenStandard [ZenonTokenStandardSize]byte

func BytesToZTS

func BytesToZTS(b []byte) (ZenonTokenStandard, error)

func BytesToZTSPanic

func BytesToZTSPanic(b []byte) ZenonTokenStandard

func NewZenonTokenStandard

func NewZenonTokenStandard(data ...[]byte) ZenonTokenStandard

func ParseZTS

func ParseZTS(ztsString string) (ZenonTokenStandard, error)

func ParseZTSPanic

func ParseZTSPanic(ztsString string) ZenonTokenStandard

func (ZenonTokenStandard) Bytes

func (zts ZenonTokenStandard) Bytes() []byte

func (ZenonTokenStandard) MarshalText

func (zts ZenonTokenStandard) MarshalText() ([]byte, error)

func (*ZenonTokenStandard) SetBytes

func (zts *ZenonTokenStandard) SetBytes(b []byte) error

func (ZenonTokenStandard) String

func (zts ZenonTokenStandard) String() string

func (*ZenonTokenStandard) UnmarshalText

func (zts *ZenonTokenStandard) UnmarshalText(input []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL