types

package
v0.0.0-...-7621e19 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

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

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

	// RouterKey is the module name router key
	RouterKey = ModuleName

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

Variables

View Source
var ModuleCodec = codec.New()

Create a new Amino Codec instance to be used for serialisation/deserialisation for messages

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Applications using this module need to be able to register a new codec instance sometimes

Types

type Expense

type Expense struct {
	Owner    sdk.AccAddress `json:"owner"`    //The account which is claiming the expense
	Problem  string         `json:"problem"`  //The problem being solved < 70 chars
	Solution string         `json:"solution"` //Git commit hash of the solution, or a sha256 hash of the evidence package
	Amount   sdk.Coins      `json:"amount"`
	Parent   string         `json:"parent"`
	Votes    Votes          `json:"votes"`
}

func NewExpense

func NewExpense(owner sdk.AccAddress, problem string, solution string, amount sdk.Coins, parent string) Expense

func (Expense) CreateNewIndex

func (e Expense) CreateNewIndex() [32]byte

func (Expense) GetHash

func (e Expense) GetHash() []byte

Calculate the hash of the Expense to use as the index

func (Expense) GetSignBytes

func (e Expense) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (Expense) GetSigners

func (e Expense) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (Expense) Route

func (e Expense) Route() string

Route should return the name of the module

func (Expense) String

func (e Expense) String() string

implement fmt.Stringer for Expense

func (Expense) Type

func (e Expense) Type() string

Type should return the action

func (Expense) ValidateBasic

func (e Expense) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type Votes

type Votes struct {
	ForkYes uint64           `json:"fork_yes"`
	ForkNo  uint64           `json:"fork_no"`
	Yes     uint64           `json:"yes"`
	No      uint64           `json:"no"`
	Why     []why            `json:"why"` //TODO: why did you vote yes? Then anyone who voted the same way can ELO rank the reasons. Get a mathematician to work out a weighted ELO rank and get someone to implement it.
	Voted   []sdk.AccAddress `json:"voted"`
}

func NewVotes

func NewVotes() Votes

Jump to

Keyboard shortcuts

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