utils

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 33 Imported by: 14

Documentation

Index

Constants

View Source
const (
	PathVarChain             = "Chain"
	PathVarRecipientChain    = "RecipientChain"
	PathVarContract          = "Contract"
	PathVarCosmosAddress     = "CosmosAddress"
	PathVarCounter           = "Counter"
	PathVarAmount            = "Amount"
	PathVarLinkedAddress     = "LinkedAddress"
	PathVarEthereumAddress   = "EthereumAddress"
	PathVarTxID              = "TxID"
	PathVarCommandID         = "CommandID"
	PathVarBatchedCommandsID = "BatchedCommandsID"
	PathVarKeyRole           = "KeyRole"
	PathVarTxType            = "txType"
	PathVarKeyID             = "KeyID"
	PathVarSigID             = "SigID"
	PathVarOutpoint          = "Outpoint"
	PathvarSymbol            = "Symbol"
	PathVarAsset             = "Asset"
)

routes

View Source
const DefaultDelimiter = "_"

DefaultDelimiter represents the default delimiter used for the KV store keys

Variables

View Source
var (
	ErrInvalidLengthBitmap        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBitmap          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupBitmap = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQueuer        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQueuer          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQueuer = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthThreshold        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowThreshold          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupThreshold = fmt.Errorf("proto: unexpected end of group")
)

Functions

func CloseLogError

func CloseLogError(iter sdk.Iterator, logger log.Logger)

CloseLogError closes the given iterator and logs if an error is returned

func ExtractReqSender

func ExtractReqSender(w http.ResponseWriter, req rest.BaseReq) (sdk.AccAddress, bool)

ExtractReqSender extracts the sender address from an SDK base request

func IndexOf

func IndexOf(strs []string, str string) int

IndexOf returns the index of str in the slice; -1 if not found

func IsABCIError added in v0.12.0

func IsABCIError(err error) bool

IsABCIError checks if the error is a (wrapped) registered error

func NewNOPLogger

func NewNOPLogger() log.Logger

NewNOPLogger returns a logger that doesn't do anything.

func NormalizeString added in v0.12.0

func NormalizeString(str string) string

NormalizeString normalizes a string as NFKC

func RegisterQueryHandlerFn

func RegisterQueryHandlerFn(r *mux.Router, moduleRoute string) func(http.HandlerFunc, string, ...string)

RegisterQueryHandlerFn returns a function to register query routes with the given router

func RegisterTxHandlerFn

func RegisterTxHandlerFn(r *mux.Router, moduleRoute string) func(http.HandlerFunc, string, ...string)

RegisterTxHandlerFn returns a function to register rest routes with the given router

func RunCached added in v0.21.0

func RunCached[T any](c sdk.Context, l Logger, f func(sdk.Context) (T, error)) T

RunCached wraps the given function, handles error/panic and rolls back the state if necessary

func ValidateString added in v0.12.0

func ValidateString(str string, forbidden ...string) error

ValidateString checks if the given string is:

1. non-empty 2. entirely composed of utf8 runes 3. normalized as NFKC 4. does not contain any forbidden Unicode code points

func ValidateStringAllowEmpty added in v0.12.0

func ValidateStringAllowEmpty(str string, forbidden string) error

ValidateStringAllowEmpty checks if the given string is:

1. entirely composed of utf8 runes 2. normalized as NFKC 3. does not contain any forbidden Unicode code points

Types

type BackOff

type BackOff func(currentRetryCount int) time.Duration

BackOff computes the next back-off duration

func ExponentialBackOff

func ExponentialBackOff(minTimeout time.Duration) BackOff

ExponentialBackOff computes an exponential back-off

func LinearBackOff

func LinearBackOff(minTimeout time.Duration) BackOff

LinearBackOff computes a linear back-off

type Bitmap added in v0.18.0

type Bitmap struct {
	TrueCountCache *CircularBuffer `protobuf:"bytes,2,opt,name=true_count_cache,json=trueCountCache,proto3" json:"true_count_cache,omitempty"`
}

func NewBitmap added in v0.18.0

func NewBitmap(maxSize int) Bitmap

NewBitmap is the constructor for Bitmap

func (*Bitmap) Add added in v0.18.0

func (m *Bitmap) Add(bit bool) *Bitmap

Add adds a new bit to the Bitmap

func (Bitmap) CountFalse added in v0.18.0

func (m Bitmap) CountFalse(bitCount int) uint64

CountFalse returns the number of 0's in the given range

func (Bitmap) CountTrue added in v0.18.0

func (m Bitmap) CountTrue(bitCount int) uint64

CountTrue returns the number of 1's in the given range

func (*Bitmap) Descriptor added in v0.18.0

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

func (*Bitmap) Marshal added in v0.18.0

func (m *Bitmap) Marshal() (dAtA []byte, err error)

func (*Bitmap) MarshalTo added in v0.18.0

func (m *Bitmap) MarshalTo(dAtA []byte) (int, error)

func (*Bitmap) MarshalToSizedBuffer added in v0.18.0

func (m *Bitmap) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Bitmap) ProtoMessage added in v0.18.0

func (*Bitmap) ProtoMessage()

func (*Bitmap) Reset added in v0.18.0

func (m *Bitmap) Reset()

func (*Bitmap) Size added in v0.18.0

func (m *Bitmap) Size() (n int)

func (*Bitmap) String added in v0.18.0

func (m *Bitmap) String() string

func (*Bitmap) Unmarshal added in v0.18.0

func (m *Bitmap) Unmarshal(dAtA []byte) error

func (*Bitmap) XXX_DiscardUnknown added in v0.18.0

func (m *Bitmap) XXX_DiscardUnknown()

func (*Bitmap) XXX_Marshal added in v0.18.0

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

func (*Bitmap) XXX_Merge added in v0.18.0

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

func (*Bitmap) XXX_Size added in v0.18.0

func (m *Bitmap) XXX_Size() int

func (*Bitmap) XXX_Unmarshal added in v0.18.0

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

type BlockHeightKVQueue

type BlockHeightKVQueue struct {
	GeneralKVQueue
}

BlockHeightKVQueue is a queue that orders items with the block height at which the items are enqueued; the order of items that are enqueued at the same block height is deterministically based on their actual key in the KVStore

func NewBlockHeightKVQueue

func NewBlockHeightKVQueue(name string, store KVStore, blockHeight int64, logger log.Logger) BlockHeightKVQueue

NewBlockHeightKVQueue is the constructor of BlockHeightKVQueue

type CircularBuffer added in v0.18.0

type CircularBuffer struct {
	CumulativeValue []uint64 `protobuf:"varint,1,rep,packed,name=cumulative_value,json=cumulativeValue,proto3" json:"cumulative_value,omitempty"`
	Index           int32    `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
	MaxSize         int32    `protobuf:"varint,3,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
}

func NewCircularBuffer added in v0.18.0

func NewCircularBuffer(maxSize int) *CircularBuffer

NewCircularBuffer is the constructor of CircularBuffer

func (*CircularBuffer) Add added in v0.18.0

func (m *CircularBuffer) Add(value uint32)

Add appends a new value into the CircularBuffer

func (CircularBuffer) Count added in v0.18.0

func (m CircularBuffer) Count(windowRange int) uint64

Count returns the cumulative value for the most recent given window

func (*CircularBuffer) Descriptor added in v0.18.0

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

func (*CircularBuffer) Marshal added in v0.18.0

func (m *CircularBuffer) Marshal() (dAtA []byte, err error)

func (*CircularBuffer) MarshalTo added in v0.18.0

func (m *CircularBuffer) MarshalTo(dAtA []byte) (int, error)

func (*CircularBuffer) MarshalToSizedBuffer added in v0.18.0

func (m *CircularBuffer) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CircularBuffer) ProtoMessage added in v0.18.0

func (*CircularBuffer) ProtoMessage()

func (*CircularBuffer) Reset added in v0.18.0

func (m *CircularBuffer) Reset()

func (*CircularBuffer) SetMaxSize added in v0.18.0

func (m *CircularBuffer) SetMaxSize(size int)

SetMaxSize sets the max size of the buffer to the given value. The buffer size gets updated accordingly the next time a value is added.

func (*CircularBuffer) Size added in v0.18.0

func (m *CircularBuffer) Size() (n int)

func (*CircularBuffer) String added in v0.18.0

func (m *CircularBuffer) String() string

func (*CircularBuffer) Unmarshal added in v0.18.0

func (m *CircularBuffer) Unmarshal(dAtA []byte) error

func (*CircularBuffer) XXX_DiscardUnknown added in v0.18.0

func (m *CircularBuffer) XXX_DiscardUnknown()

func (*CircularBuffer) XXX_Marshal added in v0.18.0

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

func (*CircularBuffer) XXX_Merge added in v0.18.0

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

func (*CircularBuffer) XXX_Size added in v0.18.0

func (m *CircularBuffer) XXX_Size() int

func (*CircularBuffer) XXX_Unmarshal added in v0.18.0

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

type ErrorWrapper added in v0.21.0

type ErrorWrapper struct {
	grpc.Server
	Err    *errors.Error
	Logger func(ctx sdk.Context) log.Logger
}

ErrorWrapper wraps around a grpc server to return registered errors

func (ErrorWrapper) RegisterService added in v0.21.0

func (r ErrorWrapper) RegisterService(sd *grpc2.ServiceDesc, server interface{})

RegisterService ensures that every server method that gets registered returns a registered error

type GeneralKVQueue added in v0.14.0

type GeneralKVQueue struct {
	// contains filtered or unexported fields
}

GeneralKVQueue is a queue that orders items based on the given prioritizer function

func NewGeneralKVQueue added in v0.14.0

func NewGeneralKVQueue(name string, store KVStore, logger log.Logger, prioritizer func(value codec.ProtoMarshaler) Key) GeneralKVQueue

NewGeneralKVQueue is the contructor for GeneralKVQueue

func (GeneralKVQueue) Dequeue added in v0.14.0

func (q GeneralKVQueue) Dequeue(value codec.ProtoMarshaler) bool

Dequeue pops the first item in queue and stores it in the given value

func (GeneralKVQueue) DequeueIf added in v0.21.0

func (q GeneralKVQueue) DequeueIf(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool

DequeueIf pops the first item in queue iff it matches the given filter and stores it in the given value

func (GeneralKVQueue) DequeueUntil added in v0.21.0

func (q GeneralKVQueue) DequeueUntil(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool

DequeueUntil pops the first item in queue that matches the given filter and stores it in the given value

func (GeneralKVQueue) Enqueue added in v0.14.0

func (q GeneralKVQueue) Enqueue(key Key, value codec.ProtoMarshaler)

Enqueue pushes the given value onto the top of the queue and stores the value at given key

func (GeneralKVQueue) ExportState added in v0.17.0

func (q GeneralKVQueue) ExportState() (state QueueState)

ExportState exports the given queue's state from the kv store

func (GeneralKVQueue) ImportState added in v0.14.0

func (q GeneralKVQueue) ImportState(state QueueState)

ImportState imports the given queue state into the kv store

func (GeneralKVQueue) IsEmpty added in v0.14.0

func (q GeneralKVQueue) IsEmpty() bool

IsEmpty returns true if the queue is empty; otherwise, false

func (GeneralKVQueue) Keys added in v0.14.0

func (q GeneralKVQueue) Keys() []Key

Keys returns a list with the keys for the values still enqueued

type Iterator

type Iterator interface {
	sdk.Iterator
	UnmarshalValue(marshaler codec.ProtoMarshaler)
	GetKey() Key
}

Iterator is an easier and safer to use sdk.Iterator extension

type KVQueue

type KVQueue interface {
	// Enqueue pushes the given value into the queue with the given key
	Enqueue(key Key, value codec.ProtoMarshaler)
	// Dequeue pops the first item in queue and stores it in the given value
	Dequeue(value codec.ProtoMarshaler) bool
	// DequeueIf pops the first item in queue iff it matches the given filter and stores it in the given value
	DequeueIf(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool
	// DequeueUntil pops the first item in queue that matches the given filter and stores it in the given value
	DequeueUntil(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool
	// IsEmpty returns true if the queue is empty; false otherwise
	IsEmpty() bool

	//TODO: convert to iterator
	Keys() []Key
}

KVQueue represents a queue built with the KVStore

type KVStore

type KVStore struct {
	sdk.KVStore
	// contains filtered or unexported fields
}

KVStore is a wrapper around the cosmos-sdk KVStore to provide more safety regarding key management and better ease-of-use

func NewNormalizedStore

func NewNormalizedStore(store sdk.KVStore, cdc codec.BinaryCodec) KVStore

NewNormalizedStore returns a new KVStore

func (KVStore) Delete

func (store KVStore) Delete(key Key)

Delete deletes the value stored under the given key, if it exists

func (KVStore) DeleteRaw added in v0.21.0

func (store KVStore) DeleteRaw(key []byte)

DeleteRaw deletes the value stored under the given raw key, if it exists

func (KVStore) Get

func (store KVStore) Get(key Key, value codec.ProtoMarshaler) bool

Get unmarshals the raw bytes stored under the given key into the value object. Returns true if the key exists. Deprecated: use GetNew instead

func (KVStore) GetNew added in v0.21.0

func (store KVStore) GetNew(key key.Key, value codec.ProtoMarshaler) bool

GetNew unmarshals the raw bytes stored under the given key into the value object. Returns true if the key exists.

func (KVStore) GetRaw

func (store KVStore) GetRaw(key Key) []byte

GetRaw returns the raw bytes stored under the given key. Returns nil with key does not exist. Deprecated: use GetNew instead

func (KVStore) Has

func (store KVStore) Has(key Key) bool

Has returns true if the key exists.

func (KVStore) Iterator

func (store KVStore) Iterator(prefix Key) Iterator

Iterator returns an Iterator that can handle a structured Key

func (KVStore) IteratorNew added in v0.21.0

func (store KVStore) IteratorNew(prefix key.Key) Iterator

IteratorNew returns an Iterator that can handle a structured Key

func (KVStore) ReverseIterator added in v0.21.0

func (store KVStore) ReverseIterator(prefix Key) Iterator

ReverseIterator returns an Iterator that can handle a structured Key and interate reversely

func (KVStore) Set

func (store KVStore) Set(key Key, value codec.ProtoMarshaler)

Set marshals the value and stores it under the given key Deprecated: use SetNew instead

func (KVStore) SetNew added in v0.21.0

func (store KVStore) SetNew(k key.Key, value codec.ProtoMarshaler)

SetNew marshals the value and stores it under the given key

func (KVStore) SetRaw

func (store KVStore) SetRaw(key Key, value []byte)

SetRaw stores the value under the given key Deprecated: use SetNew instead

type Key

type Key interface {
	// AsKey returns the byte representation of the key. If given, uses a delimiter string to separate prefixes
	AsKey(delimiter ...string) []byte
	Prepend(prefix Key) Key
	Append(key Key) Key
}

Key represents a store key to interact with the KVStore Deprecated: use key.Key instead

type Logger added in v0.17.0

type Logger interface {
	Logger(ctx sdk.Context) log.Logger
}

Logger wraps keepers which expose a Logger method

type NOPLogger

type NOPLogger struct{}

NOPLogger is a logger that doesn't do anything

func (NOPLogger) Debug

func (NOPLogger) Debug(string, ...interface{})

Debug does nothing

func (NOPLogger) Error

func (NOPLogger) Error(string, ...interface{})

Error does nothing

func (NOPLogger) Info

func (NOPLogger) Info(string, ...interface{})

Info does nothing

func (*NOPLogger) With

func (l *NOPLogger) With(...interface{}) log.Logger

With does nothing

type Nonce added in v0.9.0

type Nonce [sha256.Size]byte

Nonce defines a 32 byte array representing a deterministically-generated nonce

func GetNonce added in v0.9.0

func GetNonce(hash tmbytes.HexBytes, gasMeter sdk.GasMeter) Nonce

GetNonce deterministically calculates a nonce using a hash and gas meter

type QueueState added in v0.17.0

type QueueState struct {
	Items map[string]QueueState_Item `` /* 141-byte string literal not displayed */
}

func (*QueueState) Descriptor added in v0.17.0

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

func (*QueueState) Marshal added in v0.17.0

func (m *QueueState) Marshal() (dAtA []byte, err error)

func (*QueueState) MarshalTo added in v0.17.0

func (m *QueueState) MarshalTo(dAtA []byte) (int, error)

func (*QueueState) MarshalToSizedBuffer added in v0.17.0

func (m *QueueState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueueState) ProtoMessage added in v0.17.0

func (*QueueState) ProtoMessage()

func (*QueueState) Reset added in v0.17.0

func (m *QueueState) Reset()

func (*QueueState) Size added in v0.17.0

func (m *QueueState) Size() (n int)

func (*QueueState) String added in v0.17.0

func (m *QueueState) String() string

func (*QueueState) Unmarshal added in v0.17.0

func (m *QueueState) Unmarshal(dAtA []byte) error

func (QueueState) ValidateBasic added in v0.17.0

func (m QueueState) ValidateBasic(queueName ...string) error

ValidateBasic returns an error if the given queue state is invalid

func (*QueueState) XXX_DiscardUnknown added in v0.17.0

func (m *QueueState) XXX_DiscardUnknown()

func (*QueueState) XXX_Marshal added in v0.17.0

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

func (*QueueState) XXX_Merge added in v0.17.0

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

func (*QueueState) XXX_Size added in v0.17.0

func (m *QueueState) XXX_Size() int

func (*QueueState) XXX_Unmarshal added in v0.17.0

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

type QueueState_Item added in v0.17.0

type QueueState_Item struct {
	Key   []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

func (*QueueState_Item) Descriptor added in v0.17.0

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

func (*QueueState_Item) Marshal added in v0.17.0

func (m *QueueState_Item) Marshal() (dAtA []byte, err error)

func (*QueueState_Item) MarshalTo added in v0.17.0

func (m *QueueState_Item) MarshalTo(dAtA []byte) (int, error)

func (*QueueState_Item) MarshalToSizedBuffer added in v0.17.0

func (m *QueueState_Item) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueueState_Item) ProtoMessage added in v0.17.0

func (*QueueState_Item) ProtoMessage()

func (*QueueState_Item) Reset added in v0.17.0

func (m *QueueState_Item) Reset()

func (*QueueState_Item) Size added in v0.17.0

func (m *QueueState_Item) Size() (n int)

func (*QueueState_Item) String added in v0.17.0

func (m *QueueState_Item) String() string

func (*QueueState_Item) Unmarshal added in v0.17.0

func (m *QueueState_Item) Unmarshal(dAtA []byte) error

func (*QueueState_Item) XXX_DiscardUnknown added in v0.17.0

func (m *QueueState_Item) XXX_DiscardUnknown()

func (*QueueState_Item) XXX_Marshal added in v0.17.0

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

func (*QueueState_Item) XXX_Merge added in v0.17.0

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

func (*QueueState_Item) XXX_Size added in v0.17.0

func (m *QueueState_Item) XXX_Size() int

func (*QueueState_Item) XXX_Unmarshal added in v0.17.0

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

type SequenceKVQueue

type SequenceKVQueue struct {
	// contains filtered or unexported fields
}

SequenceKVQueue is a queue that orders items with the sequence number at which the items are enqueued;

func NewSequenceKVQueue

func NewSequenceKVQueue(prefixStore KVStore, maxSize uint64, logger log.Logger) SequenceKVQueue

NewSequenceKVQueue is the constructor of SequenceKVQueue. The prefixStore should isolate the namespace of the queue

func (*SequenceKVQueue) Dequeue

func (q *SequenceKVQueue) Dequeue(n uint64, value codec.ProtoMarshaler) bool

Dequeue pops the nth value off and unmarshals it into the given object, returns false if n is out of range n is 0-based

func (*SequenceKVQueue) Enqueue

func (q *SequenceKVQueue) Enqueue(value codec.ProtoMarshaler) error

Enqueue pushes the given value onto the top of the queue and stores the value at given key. Returns queue position and status

func (SequenceKVQueue) Peek

func (q SequenceKVQueue) Peek(n uint64, value codec.ProtoMarshaler) bool

Peek unmarshals the value into the given object at the given index and returns its sequence number, returns false if n is out of range n is 0-based

func (SequenceKVQueue) Size

func (q SequenceKVQueue) Size() uint64

Size returns the given current size of the queue

type StringKey

type StringKey interface {
	Key
	AppendStr(key string, stringTransformations ...func(string) string) StringKey
	PrependStr(key string, stringTransformations ...func(string) string) StringKey
}

StringKey extends the Key interface for simplified appending and prepending Deprecated: use key.Key instead

func KeyFromBz

func KeyFromBz(k []byte) StringKey

KeyFromBz returns a structured key

func KeyFromInt added in v0.21.0

func KeyFromInt[T constraints.Integer](k T) StringKey

KeyFromInt returns a structured key

func KeyFromStr

func KeyFromStr(k string, stringTransformations ...func(string) string) StringKey

KeyFromStr applies the optional string transformations to the given key in sequence and returns a structured key

func LowerCaseKey

func LowerCaseKey(k string) StringKey

LowerCaseKey returns a key with the input converted to lower case

type Threshold

type Threshold struct {
	// split threshold into Numerator and denominator to avoid floating point
	// errors down the line
	Numerator   int64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"`
	Denominator int64 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"`
}
var OneThreshold Threshold = NewThreshold(1, 1)

OneThreshold is a threshold that equals to 1

var ZeroThreshold Threshold = NewThreshold(0, 1)

ZeroThreshold is a threshold that equals to 0

func NewThreshold

func NewThreshold(numerator, denominator int64) Threshold

NewThreshold is the constructor for Threshold

func (*Threshold) Descriptor

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

func (Threshold) GT

func (m Threshold) GT(t Threshold) bool

GT returns true if and only if threshold is greater than the given one

func (Threshold) GTE

func (m Threshold) GTE(t Threshold) bool

GTE returns true if and only if threshold is greater than or equal to the given one

func (Threshold) IsMet

func (m Threshold) IsMet(share sdk.Int, total sdk.Int) bool

IsMet returns true if share >= threshold * total

func (Threshold) LT

func (m Threshold) LT(t Threshold) bool

LT returns true if and only if threshold is less than the given one

func (Threshold) LTE

func (m Threshold) LTE(t Threshold) bool

LTE returns true if and only if threshold is less than or equal to the given one

func (*Threshold) Marshal

func (m *Threshold) Marshal() (dAtA []byte, err error)

func (*Threshold) MarshalTo

func (m *Threshold) MarshalTo(dAtA []byte) (int, error)

func (*Threshold) MarshalToSizedBuffer

func (m *Threshold) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Threshold) ProtoMessage

func (*Threshold) ProtoMessage()

func (*Threshold) Reset

func (m *Threshold) Reset()

func (*Threshold) Size

func (m *Threshold) Size() (n int)

func (Threshold) String

func (m Threshold) String() string

String returns a string representation of the threshold

func (*Threshold) Unmarshal

func (m *Threshold) Unmarshal(dAtA []byte) error

func (Threshold) Validate

func (m Threshold) Validate() error

Validate returns an error if threshold is invalid

func (*Threshold) XXX_DiscardUnknown

func (m *Threshold) XXX_DiscardUnknown()

func (*Threshold) XXX_Marshal

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

func (*Threshold) XXX_Merge

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

func (*Threshold) XXX_Size

func (m *Threshold) XXX_Size() int

func (*Threshold) XXX_Unmarshal

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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