types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Track events
	EventTypeTrackCreate   = "track_create"
	EventTypeTrackAddShare = "track_add_share"

	// Track attributes
	AttributeKeyTrackID = "track_id"
	AttributeKeyEntity  = "entity"
	AttributeKeyShare   = "share"

	// Track Token attributes
	AttributeKeyTokenAmount    = "token_amount"
	AttributeKeyTokenRecipient = "token_recipient"
)
View Source
const (
	// ModuleName is the name of the module
	ModuleName = "track"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	// QuerierRoute to be used for querierer msgs
	QuerierRoute = ModuleName

	// TODO: move to params
	MaxTrackInfoLength = 30 * 1024
)
View Source
const (
	TypeMsgTrackCreate      = "track_create"
	TypeMsgTrackAddShare    = "track_add_share"
	TypeMsgTrackRemoveShare = "track_remove_share"
)

Content messages types and routes

View Source
const (
	QueryParams        = "params"
	QueryTracks        = "tracks"
	QueryID            = "id"
	QueryCreatorTracks = "creator_tracks"
)

Variables

View Source
var (
	DefaultCodespace   = ModuleName
	ErrUnknownTrack    = sdkerrors.Register(ModuleName, 1, "unknown track")
	ErrUnknownShare    = sdkerrors.Register(ModuleName, 2, "unknown share")
	ErrInvalidAmount   = sdkerrors.Register(ModuleName, 3, "invalid amount")
	ErrDuplicatedTrack = sdkerrors.Register(ModuleName, 4, "trackID is duplicated")
)
View Source
var (
	TrackKeyPrefix         = []byte{0x00}
	TracksCreatorKeyPrefix = []byte{0x10}
	SharesKeyPrefix        = []byte{0x20}
)

Keys for track store Items are stored with the following key: values

- 0x00<trackID_Bytes>: Track - 0x10<creatorAddr_Bytes><trackID_Bytes>: Track - 0x20<trackID_Bytes><entityAddr_Bytes>: Share

View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

Functions

func GetCreatorKey added in v0.4.0

func GetCreatorKey(addr sdk.AccAddress) []byte

func GetTrackByCreatorAddr added in v0.4.0

func GetTrackByCreatorAddr(addr sdk.AccAddress, trackID string) []byte

func GetTrackIDBytes added in v0.4.0

func GetTrackIDBytes(trackID string) []byte

func GetTrackKey added in v0.4.0

func GetTrackKey(trackID string) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec

func ShareKey

func ShareKey(trackID string, entityAddr sdk.AccAddress) []byte

func SharesKey added in v0.5.0

func SharesKey(trackID string) []byte

func ValidateGenesis added in v0.4.0

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the tracks genesis parameters

Types

type Entity added in v0.4.0

type Entity struct {
	Shares  sdk.Int        `json:"share" yaml:"share"`
	Address sdk.AccAddress `json:"address" yaml:"address"`
}

type GenesisState added in v0.4.0

type GenesisState struct {
	Tracks []Track `json:"tracks"`
}

GenesisState - all tracks state that must be provided at genesis

func DefaultGenesisState added in v0.4.0

func DefaultGenesisState() GenesisState

DefaultGenesisState - default GenesisState

func NewGenesisState added in v0.4.0

func NewGenesisState(tracks []Track) GenesisState

NewGenesisState creates a new GenesisState object

type MsgTrackAddShare added in v0.5.0

type MsgTrackAddShare struct {
	TrackID string         `json:"track_id" yaml:"track_id"`
	Entity  sdk.AccAddress `json:"entity" yaml:"entity"`
	Share   sdk.Coin       `json:"share" yaml:"share"`
}

func NewMsgTrackAddShare added in v0.5.0

func NewMsgTrackAddShare(trackID string, share sdk.Coin, entity sdk.AccAddress) MsgTrackAddShare

func (MsgTrackAddShare) GetSignBytes added in v0.5.0

func (msg MsgTrackAddShare) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgTrackAddShare) GetSigners added in v0.5.0

func (msg MsgTrackAddShare) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgTrackAddShare) Route added in v0.5.0

func (msg MsgTrackAddShare) Route() string

func (MsgTrackAddShare) String added in v0.5.0

func (msg MsgTrackAddShare) String() string

func (MsgTrackAddShare) Type added in v0.5.0

func (msg MsgTrackAddShare) Type() string

func (MsgTrackAddShare) ValidateBasic added in v0.5.0

func (msg MsgTrackAddShare) ValidateBasic() error

type MsgTrackCreate added in v0.4.0

type MsgTrackCreate struct {
	TrackID   string         `json:"track_id" yaml:"track_id"`
	TrackInfo []byte         `json:"track_info" yaml:"track_info"`
	Entities  []Entity       `json:"entities" yaml:"entities"`
	Creator   sdk.AccAddress `json:"creator" yaml:"creator"`
}

func NewMsgTrackCreate added in v0.4.0

func NewMsgTrackCreate(trackID string, info []byte, creator sdk.AccAddress, entities []Entity) MsgTrackCreate

func (MsgTrackCreate) GetSignBytes added in v0.4.0

func (msg MsgTrackCreate) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgTrackCreate) GetSigners added in v0.4.0

func (msg MsgTrackCreate) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgTrackCreate) Route added in v0.4.0

func (msg MsgTrackCreate) Route() string

func (MsgTrackCreate) String added in v0.4.0

func (msg MsgTrackCreate) String() string

func (MsgTrackCreate) Type added in v0.4.0

func (msg MsgTrackCreate) Type() string

func (MsgTrackCreate) ValidateBasic added in v0.4.0

func (msg MsgTrackCreate) ValidateBasic() error

type MsgTrackRemoveShare added in v0.5.0

type MsgTrackRemoveShare struct {
	TrackID string         `json:"track_id" yaml:"track_id"`
	Entity  sdk.AccAddress `json:"entity" yaml:"entity"`
	Share   sdk.Coin       `json:"share" yaml:"share"`
}

func NewMsgTrackRemoveShare added in v0.5.0

func NewMsgTrackRemoveShare(trackID string, share sdk.Coin, entity sdk.AccAddress) MsgTrackRemoveShare

func (MsgTrackRemoveShare) GetSignBytes added in v0.5.0

func (msg MsgTrackRemoveShare) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgTrackRemoveShare) GetSigners added in v0.5.0

func (msg MsgTrackRemoveShare) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgTrackRemoveShare) Route added in v0.5.0

func (msg MsgTrackRemoveShare) Route() string

func (MsgTrackRemoveShare) String added in v0.5.0

func (msg MsgTrackRemoveShare) String() string

func (MsgTrackRemoveShare) Type added in v0.5.0

func (msg MsgTrackRemoveShare) Type() string

func (MsgTrackRemoveShare) ValidateBasic added in v0.5.0

func (msg MsgTrackRemoveShare) ValidateBasic() error

type QueryCreatorTracksParams added in v0.4.0

type QueryCreatorTracksParams struct {
	Creator sdk.AccAddress `json:"creator" yaml:"creator"`
}

type QueryTrackParams

type QueryTrackParams struct {
	ID uint64 `json:"id" yaml:"id"`
}

Params for queries

func NewQueryContentParams added in v0.4.0

func NewQueryContentParams(id uint64) QueryTrackParams

creates a new instance of QueryContentParams

type QueryTracksParams

type QueryTracksParams struct {
	Page  int
	Limit int
}

func DefaultQueryTracksParams added in v0.4.0

func DefaultQueryTracksParams(page, limit int) QueryTracksParams

type Share

type Share struct {
	TrackID string         `json:"track_id" yaml:"track_id"`
	Entity  sdk.AccAddress `json:"entity" yaml:"entity"`
	Shares  sdk.Coin       `json:"shares" yaml:"shares"`
}

type Track

type Track struct {
	TrackID   string         `json:"track_id" yaml:"track_id"`     // the bitsong unique track id ****
	Hash      string         `json:"hash" yaml:"hash"`             // the track hash
	Uri       string         `json:"uri" yaml:"uri"`               // bitsong uri for track e.g: bitsong:track:<track_id> ****
	TrackInfo []byte         `json:"track_info" yaml:"track_info"` // Raw Track Info (see specs)
	Creator   sdk.AccAddress `json:"creator" yaml:"creator"`       // creator of the track

	TotalShares sdk.Coin `json:"total_shares" yaml:"total_shares"`

	StartTime time.Time `json:"start_time" yaml:"start_time"`
	EndTime   time.Time `json:"end_time" yaml:"end_time"`
}

func NewTrack

func NewTrack(id string, info []byte, creator sdk.AccAddress) *Track

func (*Track) Equals added in v0.4.0

func (t *Track) Equals(track Track) bool

func (*Track) String

func (t *Track) String() string

func (*Track) ToCoinDenom added in v0.4.0

func (t *Track) ToCoinDenom() string

func (*Track) Validate added in v0.4.0

func (t *Track) Validate() error

TODO

Jump to

Keyboard shortcuts

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