currency

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: Apache-2.0 Imports: 10 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 NewTokenInfoHandler

func NewTokenInfoHandler(auth x.Authenticator, issuer weave.Address) weave.Handler

func RegisterQuery

func RegisterQuery(qr weave.QueryRouter)

func RegisterRoutes

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

Types

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, db weave.KVStore) error

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

type NewTokenInfoMsg

type NewTokenInfoMsg struct {
	Ticker string `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker,omitempty"`
	Name   string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
}

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

func (*NewTokenInfoMsg) Descriptor

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

func (*NewTokenInfoMsg) GetName

func (m *NewTokenInfoMsg) GetName() string

func (*NewTokenInfoMsg) GetTicker

func (m *NewTokenInfoMsg) GetTicker() string

func (*NewTokenInfoMsg) Marshal

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

func (*NewTokenInfoMsg) MarshalTo

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

func (NewTokenInfoMsg) Path

func (NewTokenInfoMsg) Path() string

func (*NewTokenInfoMsg) ProtoMessage

func (*NewTokenInfoMsg) ProtoMessage()

func (*NewTokenInfoMsg) Reset

func (m *NewTokenInfoMsg) Reset()

func (*NewTokenInfoMsg) Size

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

func (*NewTokenInfoMsg) String

func (m *NewTokenInfoMsg) String() string

func (*NewTokenInfoMsg) Unmarshal

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

func (*NewTokenInfoMsg) Validate

func (t *NewTokenInfoMsg) Validate() error

func (*NewTokenInfoMsg) XXX_DiscardUnknown added in v0.12.0

func (m *NewTokenInfoMsg) XXX_DiscardUnknown()

func (*NewTokenInfoMsg) XXX_Marshal added in v0.12.0

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

func (*NewTokenInfoMsg) XXX_Merge added in v0.12.0

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

func (*NewTokenInfoMsg) XXX_Size added in v0.12.0

func (m *NewTokenInfoMsg) XXX_Size() int

func (*NewTokenInfoMsg) XXX_Unmarshal added in v0.12.0

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

type TokenInfo

type TokenInfo struct {
	Name string `protobuf:"bytes,1,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) Copy

func (t *TokenInfo) Copy() orm.CloneableData

func (*TokenInfo) Descriptor

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

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
}

TockenInfoBucket 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

type TokenInfoHandler

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

func (*TokenInfoHandler) Check

func (*TokenInfoHandler) Deliver

Jump to

Keyboard shortcuts

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