asset

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2018 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeUnknownAsset       sdk.CodeType = 500
	CodeInvalidTransaction sdk.CodeType = 501
	CodeInvalidInput       sdk.CodeType = 502
	CodeInvalidOutput      sdk.CodeType = 503
	CodeInvalidAssets      sdk.CodeType = 504
	CodeMissingField       sdk.CodeType = 505
)

ABCI Response Codes Base SDK reserves 500 - 599.

Variables

View Source
var (
	// Keys for store prefixes
	AssetKey = []byte{0x00} // prefix for each key to a candidate
)

nolint

Functions

func CodeToDefaultMsg

func CodeToDefaultMsg(code sdk.CodeType) string

CodeToDefaultMsg NOTE: Don't stringer this, we'll put better messages in later.

func ErrInvalidAssets

func ErrInvalidAssets(msg string) sdk.Error

func ErrInvalidInput

func ErrInvalidInput(msg string) sdk.Error

func ErrInvalidOutput

func ErrInvalidOutput(msg string) sdk.Error

func ErrMissingField

func ErrMissingField(field string) sdk.Error

ErrMissingField ...

func ErrNoInputs

func ErrNoInputs() sdk.Error

func ErrNoOutputs

func ErrNoOutputs() sdk.Error

func ErrUnknownAsset

func ErrUnknownAsset(msg string) sdk.Error

ErrUnknownAsset ...

func GetAssetKey

func GetAssetKey(uid []byte) []byte

GetAssetKey get the key for the record with address

func InvalidTransaction

func InvalidTransaction(msg string) sdk.Error

InvalidTransaction ...

func NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler ...

Types

type AddQuantityMsg

type AddQuantityMsg struct {
	Issuer   sdk.Address `json:"issuer"`
	ID       string      `json:"id"`
	Quantity int64       `json:"quantity"`
}

AddQuantityMsg ... ---------------------------------------------------------------

func (AddQuantityMsg) Get

func (msg AddQuantityMsg) Get(key interface{}) (value interface{})

func (AddQuantityMsg) GetSignBytes

func (msg AddQuantityMsg) GetSignBytes() []byte

GetSignBytes Get the bytes for the message signer to sign on

func (AddQuantityMsg) GetSigners

func (msg AddQuantityMsg) GetSigners() []sdk.Address

func (AddQuantityMsg) String

func (msg AddQuantityMsg) String() string

func (AddQuantityMsg) Type

func (msg AddQuantityMsg) Type() string

func (AddQuantityMsg) ValidateBasic

func (msg AddQuantityMsg) ValidateBasic() sdk.Error

ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly

type AnswerProposalMsg

type AnswerProposalMsg struct {
	AssetID   string      `json:"asset_id"`
	Recipient sdk.Address `json:"recipient"`
	Response  int         `json:"response"`
}

AnswerProposalMsg ...

func (AnswerProposalMsg) Get

func (msg AnswerProposalMsg) Get(key interface{}) (value interface{})

func (AnswerProposalMsg) GetSignBytes

func (msg AnswerProposalMsg) GetSignBytes() []byte

GetSignBytes Get the bytes for the message signer to sign on

func (AnswerProposalMsg) GetSigners

func (msg AnswerProposalMsg) GetSigners() []sdk.Address

func (AnswerProposalMsg) String

func (msg AnswerProposalMsg) String() string

func (AnswerProposalMsg) Type

func (msg AnswerProposalMsg) Type() string

func (AnswerProposalMsg) ValidateBasic

func (msg AnswerProposalMsg) ValidateBasic() sdk.Error

ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly

type Asset

type Asset struct {
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	Issuer     sdk.Address `json:"issuer"`
	Quantity   int64       `json:"quantity"`
	Company    string      `json:"company"`
	Email      string      `json:"email"`
	Attributes []Attribute `json:"attributes"`
	Proposals  Proposals   `json:"proposals"`
}

Assets ...

func (Asset) IsOwner

func (a Asset) IsOwner(addr sdk.Address) bool

IsOwner ....

type Attribute

type Attribute struct {
	Name         string   `json:"name"`
	Type         int      `json:"type"`
	BytesValue   []byte   `json:"bytes_value"`
	StringValue  string   `json:"string_value"`
	BooleanValue bool     `json:"boolean_value"`
	NumberValue  int64    `json:"number_value"`
	EnumValue    []string `json:"enum_value"`
	Location     Location `json:"location_value"`
}

Attribute ...

type CreateProposalMsg

type CreateProposalMsg struct {
	AssetID     string      `json:"asset_id"`
	Issuer      sdk.Address `json:"issuer"`
	Recipient   sdk.Address `json:"recipient"`
	Propertipes []string    `json:"propertipes"`
}

CreateProposalMsg ...

func (CreateProposalMsg) Get

func (msg CreateProposalMsg) Get(key interface{}) (value interface{})

func (CreateProposalMsg) GetSignBytes

func (msg CreateProposalMsg) GetSignBytes() []byte

GetSignBytes Get the bytes for the message signer to sign on

func (CreateProposalMsg) GetSigners

func (msg CreateProposalMsg) GetSigners() []sdk.Address

func (CreateProposalMsg) String

func (msg CreateProposalMsg) String() string

func (CreateProposalMsg) Type

func (msg CreateProposalMsg) Type() string

func (CreateProposalMsg) ValidateBasic

func (msg CreateProposalMsg) ValidateBasic() sdk.Error

ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly

type Keeper

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

Keeper ...

func NewKeeper

func NewKeeper(key sdk.StoreKey, cdc *wire.Codec, bank bank.Keeper) Keeper

NewKeeper - Returns the Keeper

func (Keeper) AddQuantity

func (k Keeper) AddQuantity(ctx sdk.Context, msg AddQuantityMsg) (sdk.Coins, types.Tags, sdk.Error)

AddQuantity ...

func (Keeper) GetAsset

func (k Keeper) GetAsset(ctx sdk.Context, uid string) *Asset

GetAsset get asset by IDS

func (Keeper) Has

func (k Keeper) Has(ctx sdk.Context, id string) bool

Has asset

func (Keeper) RegisterAsset

func (k Keeper) RegisterAsset(ctx sdk.Context, asset Asset) (sdk.Coins, types.Tags, sdk.Error)

Register register new asset

func (Keeper) SubtractQuantity

func (k Keeper) SubtractQuantity(ctx sdk.Context, msg SubtractQuantityMsg) (sdk.Coins, types.Tags, sdk.Error)

SubtractQuantity ...

func (Keeper) UpdateAttribute

func (k Keeper) UpdateAttribute(ctx sdk.Context, msg UpdateAttrMsg) (types.Tags, sdk.Error)

UpdateAttribute ...

type Location

type Location struct {
	Latitude  float64 `json:"latitude" amino:"unsafe"`
	Longitude float64 `json:"longitude" amino:"unsafe"`
}

type Proposal

type Proposal struct {
	Role       int64
	Status     int64
	Properties []string
	Issuer     sdk.Address
	Recipient  sdk.Address
}

type Proposals

type Proposals []Proposal

type RegisterMsg

type RegisterMsg struct {
	Issuer   sdk.Address `json:"issuer"`
	ID       string      `json:"id"`
	Name     string      `json:"name"`
	Quantity int64       `json:"quantity"`

	// Company info
	Company string `json:"company"`
	Email   string `json:"email"`
}

RegisterMsg A really msg record create type, these fields are can be entirely arbitrary and custom to your message

func NewRegisterMsg

func NewRegisterMsg(issuer sdk.Address, id, name string, quantity int64, company, email string) RegisterMsg

NewRegisterMsg new record create msg

func (RegisterMsg) Get

func (msg RegisterMsg) Get(key interface{}) (value interface{})

func (RegisterMsg) GetSignBytes

func (msg RegisterMsg) GetSignBytes() []byte

GetSignBytes Get the bytes for the message signer to sign on

func (RegisterMsg) GetSigners

func (msg RegisterMsg) GetSigners() []sdk.Address

func (RegisterMsg) String

func (msg RegisterMsg) String() string

func (RegisterMsg) Type

func (msg RegisterMsg) Type() string

nolint ...

func (RegisterMsg) ValidateBasic

func (msg RegisterMsg) ValidateBasic() sdk.Error

ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly

type RevokeProposalMsg

type RevokeProposalMsg struct {
	AssetID     string      `json:"asset_id"`
	Issuer      sdk.Address `json:"issuer"`
	Recipient   sdk.Address `json:"recipient"`
	Propertipes []string    `json:"propertipes"`
}

RevokeProposalMsg ...

func (RevokeProposalMsg) Get

func (msg RevokeProposalMsg) Get(key interface{}) (value interface{})

func (RevokeProposalMsg) GetSignBytes

func (msg RevokeProposalMsg) GetSignBytes() []byte

GetSignBytes Get the bytes for the message signer to sign on

func (RevokeProposalMsg) GetSigners

func (msg RevokeProposalMsg) GetSigners() []sdk.Address

func (RevokeProposalMsg) String

func (msg RevokeProposalMsg) String() string

func (RevokeProposalMsg) Type

func (msg RevokeProposalMsg) Type() string

func (RevokeProposalMsg) ValidateBasic

func (msg RevokeProposalMsg) ValidateBasic() sdk.Error

ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly

type SubtractQuantityMsg

type SubtractQuantityMsg struct {
	Issuer   sdk.Address `json:"issuer"`
	ID       string      `json:"id"`
	Quantity int64       `json:"quantity"`
}

AddQuantityMsg ... ---------------------------------------------------------------

func (SubtractQuantityMsg) Get

func (msg SubtractQuantityMsg) Get(key interface{}) (value interface{})

func (SubtractQuantityMsg) GetSignBytes

func (msg SubtractQuantityMsg) GetSignBytes() []byte

GetSignBytes Get the bytes for the message signer to sign on

func (SubtractQuantityMsg) GetSigners

func (msg SubtractQuantityMsg) GetSigners() []sdk.Address

func (SubtractQuantityMsg) String

func (msg SubtractQuantityMsg) String() string

func (SubtractQuantityMsg) Type

func (msg SubtractQuantityMsg) Type() string

func (SubtractQuantityMsg) ValidateBasic

func (msg SubtractQuantityMsg) ValidateBasic() sdk.Error

ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly

type UpdateAttrMsg

type UpdateAttrMsg struct {
	Issuer     sdk.Address `json:"issuer"`
	ID         string      `json:"id"`
	Attributes []Attribute `json:"attribute"`
}

UpdateAttrMsg ... ---------------------------------------------------------------

func (UpdateAttrMsg) Get

func (msg UpdateAttrMsg) Get(key interface{}) (value interface{})

func (UpdateAttrMsg) GetSignBytes

func (msg UpdateAttrMsg) GetSignBytes() []byte

GetSignBytes Get the bytes for the message signer to sign on

func (UpdateAttrMsg) GetSigners

func (msg UpdateAttrMsg) GetSigners() []sdk.Address

func (UpdateAttrMsg) String

func (msg UpdateAttrMsg) String() string

func (UpdateAttrMsg) Type

func (msg UpdateAttrMsg) Type() string

func (UpdateAttrMsg) ValidateBasic

func (msg UpdateAttrMsg) ValidateBasic() sdk.Error

ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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