currency

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Overview

Package currency provides an implementation of a token registry. It allows to keep keep track of token/currency configuration.

Once configured, token declaration cannot be altered.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCodec   = fmt.Errorf("proto: integer overflow")
)

Functions

func NewTokenInfo

func NewTokenInfo(ticker, name string) orm.Object

NewTokenInfo returns a new instance of Token Info, as represented by orm object.

func RegisterQuery

func RegisterQuery(qr weave.QueryRouter)

func RegisterRoutes

func RegisterRoutes(r weave.Registry, auth x.Authenticator, issuer weave.Address)

Types

type CreateMsg added in v0.17.0

type CreateMsg struct {
	Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
	Ticker   string          `protobuf:"bytes,2,opt,name=ticker,proto3" json:"ticker,omitempty"`
	Name     string          `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
}

CreateMsg will register a new currency. Ticker (currency symbol) can be registered only once.

func (*CreateMsg) Descriptor added in v0.17.0

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

func (*CreateMsg) GetMetadata added in v0.17.0

func (m *CreateMsg) GetMetadata() *weave.Metadata

func (*CreateMsg) GetName added in v0.17.0

func (m *CreateMsg) GetName() string

func (*CreateMsg) GetTicker added in v0.17.0

func (m *CreateMsg) GetTicker() string

func (*CreateMsg) Marshal added in v0.17.0

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

func (*CreateMsg) MarshalTo added in v0.17.0

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

func (CreateMsg) Path added in v0.17.0

func (CreateMsg) Path() string

func (*CreateMsg) ProtoMessage added in v0.17.0

func (*CreateMsg) ProtoMessage()

func (*CreateMsg) Reset added in v0.17.0

func (m *CreateMsg) Reset()

func (*CreateMsg) Size added in v0.17.0

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

func (*CreateMsg) String added in v0.17.0

func (m *CreateMsg) String() string

func (*CreateMsg) Unmarshal added in v0.17.0

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

func (*CreateMsg) Validate added in v0.17.0

func (msg *CreateMsg) Validate() error

func (*CreateMsg) XXX_DiscardUnknown added in v0.17.0

func (m *CreateMsg) XXX_DiscardUnknown()

func (*CreateMsg) XXX_Marshal added in v0.17.0

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

func (*CreateMsg) XXX_Merge added in v0.17.0

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

func (*CreateMsg) XXX_Size added in v0.17.0

func (m *CreateMsg) XXX_Size() int

func (*CreateMsg) XXX_Unmarshal added in v0.17.0

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

type Initializer

type Initializer struct{}

Initializer fulfils the Initializer interface to load data from the genesis file

func (*Initializer) FromGenesis

func (*Initializer) FromGenesis(opts weave.Options, params weave.GenesisParams, kv weave.KVStore) error

FromGenesis will parse initial account info from genesis and save it to the database

type TokenInfo

type TokenInfo struct {
	Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
	Name     string          `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
}

TokenInfo contains information about a single currency. It is used as an alternative solution to hardcoding supported currencies information.

func (*TokenInfo) Descriptor

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

func (*TokenInfo) GetMetadata added in v0.15.0

func (m *TokenInfo) GetMetadata() *weave.Metadata

func (*TokenInfo) GetName

func (m *TokenInfo) GetName() string

func (*TokenInfo) Marshal

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

func (*TokenInfo) MarshalTo

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

func (*TokenInfo) ProtoMessage

func (*TokenInfo) ProtoMessage()

func (*TokenInfo) Reset

func (m *TokenInfo) Reset()

func (*TokenInfo) Size

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

func (*TokenInfo) String

func (m *TokenInfo) String() string

func (*TokenInfo) Unmarshal

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

func (*TokenInfo) Validate

func (t *TokenInfo) Validate() error

func (*TokenInfo) XXX_DiscardUnknown added in v0.12.0

func (m *TokenInfo) XXX_DiscardUnknown()

func (*TokenInfo) XXX_Marshal added in v0.12.0

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

func (*TokenInfo) XXX_Merge added in v0.12.0

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

func (*TokenInfo) XXX_Size added in v0.12.0

func (m *TokenInfo) XXX_Size() int

func (*TokenInfo) XXX_Unmarshal added in v0.12.0

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

type TokenInfoBucket

type TokenInfoBucket struct {
	orm.Bucket
}

TokenInfoBucket stores TokenInfo instances, using ticker name (currency symbol) as the key.

func NewTokenInfoBucket

func NewTokenInfoBucket() *TokenInfoBucket

func (*TokenInfoBucket) Get

func (b *TokenInfoBucket) Get(db weave.KVStore, ticker string) (orm.Object, error)

func (*TokenInfoBucket) Save

func (b *TokenInfoBucket) Save(db weave.KVStore, obj orm.Object) error

Jump to

Keyboard shortcuts

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