types

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	EventTypeFileUpload = "FileUpload"
	EventTypePrepay     = "Prepay"

	AttributeKeyReporter = "reporter"
	AttributeKeyFileHash = "file_hash"
	AttributeKeyUploader = "uploader"

	AttributeKeyRecipient    = "recipient"
	AttributeKeyCoins        = "coins"
	AttributeKeyPurchasedUoz = "purchased"

	AttributeValueCategory = ModuleName
)

sds module event types

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "sds"

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

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

	// QuerierRoute to be used for querier msgs
	QuerierRoute = ModuleName
)
View Source
const (
	ConstFileUpload = "FileUploadTx"
	ConstSdsPrepay  = "SdsPrepayTx"
)
View Source
const (
	DefaultParamSpace = ModuleName
	DefaultBondDenom  = "ustos"
)

Default parameter namespace

View Source
const (
	QueryParams         = "params"
	QueryUploadedFile   = "uploaded_file"
	QueryPrepay         = "prepay"
	QuerySimulatePrepay = "simulate_prepay"
	QueryCurrUozPrice   = "curr_uoz_price"
	QueryUozSupply      = "uoz_supply"
)

querier keys

Variables

View Source
var (
	// Acc Balance prefix for sds store
	PrepayBalancePrefix = []byte{0x01}
	// FileStorage prefix for sds store
	FileStoreKeyPrefix = []byte{0x02}
)
View Source
var (
	ErrInvalid = sdkerrors.Register(ModuleName, 1, "error invalid")
)
View Source
var (
	KeyBondDenom = []byte("BondDenom")
)

Parameter store keys

View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

Functions

func FileStoreKey

func FileStoreKey(sender []byte) []byte

FileStoreKey turn an address to key used to get it from the account store

func MustMarshalFileInfo

func MustMarshalFileInfo(cdc *codec.Codec, file FileInfo) []byte

MustMarshalFileInfo returns the fileInfo's bytes. Panics if fails

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for sds module

func PrepayBalanceKey

func PrepayBalanceKey(acc []byte) []byte

PrepayBalanceKey turn an address to key used to get prepaid balance from the sds store

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the sds genesis parameters

Types

type FileInfo

type FileInfo struct {
	Height   sdk.Int
	Reporter sdk.AccAddress
	Uploader sdk.AccAddress
}

func MustUnmarshalFileInfo

func MustUnmarshalFileInfo(cdc *codec.Codec, value []byte) FileInfo

MustUnmarshalFileInfo unmarshal a file's info from a store value. Panics if fails

func NewFileInfo

func NewFileInfo(height sdk.Int, reporter, uploader sdk.AccAddress) FileInfo

constructor

func UnmarshalFileInfo

func UnmarshalFileInfo(cdc *codec.Codec, value []byte) (fi FileInfo, err error)

UnmarshalResourceNode unmarshal a file's info from a store value

func (FileInfo) String

func (fi FileInfo) String() string

String returns a human readable string representation of a resource node.

type GenesisState

type GenesisState struct {
	Params Params `json:"params" yaml:"params"`
}

GenesisState - all sds state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - default GenesisState used by Cosmos Hub

func NewGenesisState

func NewGenesisState(params Params) GenesisState

NewGenesisState creates a new GenesisState object

type MsgFileUpload

type MsgFileUpload struct {
	FileHash string         `json:"file_hash" yaml:"file_hash"` // hash of file
	From     sdk.AccAddress `json:"from" yaml:"from"`           // wallet addr who will pay this tx
	Reporter sdk.AccAddress `json:"reporter" yaml:"reporter"`   // p2pAddr of sp node who reports this tx
	Uploader sdk.AccAddress `json:"uploader" yaml:"uploader"`   // user who uploads the file
}

func NewMsgUpload

func NewMsgUpload(fileHash string, from, reporter, uploader sdk.AccAddress) MsgFileUpload

NewMsg<Action> creates a new Msg<Action> instance

func (MsgFileUpload) GetSignBytes

func (msg MsgFileUpload) GetSignBytes() []byte

GetSignBytes gets the bytes for the message signer to sign on

func (MsgFileUpload) GetSigners

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

func (MsgFileUpload) Route

func (msg MsgFileUpload) Route() string

nolint

func (MsgFileUpload) Type

func (msg MsgFileUpload) Type() string

func (MsgFileUpload) ValidateBasic

func (msg MsgFileUpload) ValidateBasic() error

ValidateBasic validity check for the AnteHandler

type MsgPrepay

type MsgPrepay struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"` // sender of tx
	Coins  sdk.Coins      `json:"coins" yaml:"coins"`   // coins to send
}

func NewMsgPrepay

func NewMsgPrepay(sender sdk.AccAddress, coins sdk.Coins) MsgPrepay

NewMsg<Action> creates a new Msg<Action> instance

func (MsgPrepay) GetSignBytes

func (msg MsgPrepay) GetSignBytes() []byte

GetSignBytes gets the bytes for the message signer to sign on

func (MsgPrepay) GetSigners

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

func (MsgPrepay) Route

func (msg MsgPrepay) Route() string

nolint

func (MsgPrepay) Type

func (msg MsgPrepay) Type() string

func (MsgPrepay) ValidateBasic

func (msg MsgPrepay) ValidateBasic() error

ValidateBasic validity check for the AnteHandler

type ParamSubspace

type ParamSubspace interface {
	SetUploadFile(ctx sdk.Context, key []byte, value string)
	GetUploadFile(ctx sdk.Context, key []byte) MsgFileUpload
}

ParamSubspace defines the expected Subspace interfacace

type Params

type Params struct {
	BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination
}

Params - used for initializing default parameter for sds at genesis

func DefaultParams

func DefaultParams() Params

DefaultParams defines the parameters for this module

func NewParams

func NewParams(bondDenom string) Params

NewParams creates a new Params object

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs - Implements params.ParamSet

func (Params) String

func (p Params) String() string

String implements the stringer interface for Params

func (Params) ValidateBasic added in v0.6.0

func (p Params) ValidateBasic() error

type QueryUploadedFileParams

type QueryUploadedFileParams struct {
	Sender types.AccAddress `json:"sender" yaml:"sender"`
}

params for query 'custom/distr/validator_outstanding_rewards'

func NewQueryUploadedFileParams

func NewQueryUploadedFileParams(sender types.AccAddress) QueryUploadedFileParams

creates a new instance of QueryValidatorSlashesParams

Jump to

Keyboard shortcuts

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