types

package
v0.2.2-0...-13ba25a Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodeSpace cTypes.CodespaceType = ModuleName

	CodeFeedbackCannotRegister cTypes.CodeType = 800
	CodeInvalidInputsOutputs   cTypes.CodeType = 801
)
View Source
const (
	ModuleName   = "reputations"
	StoreKey     = ModuleName
	RouterKey    = StoreKey
	QuerierRoute = RouterKey
)

Variables

View Source
var (
	EventTypeSetBuyerRatingToFeedback  = "SetBuyerRatingToFeedback"
	EventTypeSetSellerRatingToFeedback = "SetSellerRatingToFeedback"

	AttributeKeyPegHash = "pegHash"
	AttributeKeyRating  = "rating"
	AttributeKeyFrom    = "from"
	AttributeKeyTo      = "to"
)
View Source
var ModuleCdc *codec.Codec
View Source
var (
	ReputationKey = []byte{0x08}
)

Functions

func BuildBuyerFeedbackMsg

func BuildBuyerFeedbackMsg(buyerAddress cTypes.AccAddress, sellerAddress cTypes.AccAddress,
	pegHash types.PegHash, score int64) cTypes.Msg

func BuildSellerFeedbackMsg

func BuildSellerFeedbackMsg(buyerAddress cTypes.AccAddress, sellerAddress cTypes.AccAddress,
	pegHash types.PegHash, score int64) cTypes.Msg

func ErrFeedbackCannotRegister

func ErrFeedbackCannotRegister(msg string) cTypes.Error

func ErrNoInputs

func ErrNoInputs(codeSpace cTypes.CodespaceType) cTypes.Error

ErrNoInputs is an error

func GetReputationKey

func GetReputationKey(storeKey string) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func ValidateGensis

func ValidateGensis(data GenesisState) error

Types

type AccountReputation

type AccountReputation interface {
	GetAddress() cTypes.AccAddress
	SetAddress(cTypes.AccAddress) error

	GetTransactionFeedback() TransactionFeedback
	SetTransactionFeedback(TransactionFeedback) error

	GetTraderFeedbackHistory() TraderFeedbackHistory
	SetTraderFeedbackHistory(TraderFeedbackHistory) error

	AddTraderFeedback(TraderFeedback) cTypes.Error

	GetRating() int64
}

AccountReputation : implements basefeedback

func NewAccountReputation

func NewAccountReputation() AccountReputation

NewAccountReputation := creates new traderFeedback

func ProtoBaseAccountReputation

func ProtoBaseAccountReputation() AccountReputation

ProtoBaseAccountReputation : converts concrete to order in

type BaseAccountReputation

type BaseAccountReputation struct {
	Address               cTypes.AccAddress     `json:"address"`
	TransactionFeedback   TransactionFeedback   `json:"transactionFeedback"`
	TraderFeedbackHistory TraderFeedbackHistory `json:"traderFeedbackHistory"`
}

BaseAccountReputation : base account reputation

func NewBaseAccountReputation

func NewBaseAccountReputation() BaseAccountReputation

NewBaseAccountReputation : creates new

func (*BaseAccountReputation) AddTraderFeedback

func (baseAccountReputation *BaseAccountReputation) AddTraderFeedback(traderFeedback TraderFeedback) cTypes.Error

AddTraderFeedback : sets rating

func (BaseAccountReputation) GetAddress

func (baseAccountReputation BaseAccountReputation) GetAddress() cTypes.AccAddress

GetAddress : gets

func (BaseAccountReputation) GetRating

func (baseAccountReputation BaseAccountReputation) GetRating() int64

GetRating : gets a rating of that account

func (BaseAccountReputation) GetTraderFeedbackHistory

func (baseAccountReputation BaseAccountReputation) GetTraderFeedbackHistory() TraderFeedbackHistory

GetTraderFeedbackHistory : gets

func (BaseAccountReputation) GetTransactionFeedback

func (baseAccountReputation BaseAccountReputation) GetTransactionFeedback() TransactionFeedback

GetTransactionFeedback : gets

func (*BaseAccountReputation) SetAddress

func (baseAccountReputation *BaseAccountReputation) SetAddress(addr cTypes.AccAddress) error

SetAddress : sets

func (*BaseAccountReputation) SetTraderFeedbackHistory

func (baseAccountReputation *BaseAccountReputation) SetTraderFeedbackHistory(traderFeedbacks TraderFeedbackHistory) error

SetTraderFeedbackHistory : sets

func (*BaseAccountReputation) SetTransactionFeedback

func (baseAccountReputation *BaseAccountReputation) SetTransactionFeedback(transactionFeedback TransactionFeedback) error

SetTransactionFeedback : sets

type GenesisState

type GenesisState struct {
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

type MsgBuyerFeedbacks

type MsgBuyerFeedbacks struct {
	SubmitTraderFeedbacks []SubmitTraderFeedback `json:"submitTraderFeedbacks"`
}

func NewMsgBuyerFeedbacks

func NewMsgBuyerFeedbacks(submitTraderFeedbacks []SubmitTraderFeedback) MsgBuyerFeedbacks

func (MsgBuyerFeedbacks) GetSignBytes

func (msg MsgBuyerFeedbacks) GetSignBytes() []byte

func (MsgBuyerFeedbacks) GetSigners

func (msg MsgBuyerFeedbacks) GetSigners() []cTypes.AccAddress

func (MsgBuyerFeedbacks) Route

func (msg MsgBuyerFeedbacks) Route() string

func (MsgBuyerFeedbacks) Type

func (msg MsgBuyerFeedbacks) Type() string

func (MsgBuyerFeedbacks) ValidateBasic

func (msg MsgBuyerFeedbacks) ValidateBasic() cTypes.Error

type MsgSellerFeedbacks

type MsgSellerFeedbacks struct {
	SubmitTraderFeedbacks []SubmitTraderFeedback `json:" submitTraderFeedbacks"`
}

func NewMsgSellerFeedbacks

func NewMsgSellerFeedbacks(submitTraderFeedbacks []SubmitTraderFeedback) MsgSellerFeedbacks

func (MsgSellerFeedbacks) GetSignBytes

func (msg MsgSellerFeedbacks) GetSignBytes() []byte

func (MsgSellerFeedbacks) GetSigners

func (msg MsgSellerFeedbacks) GetSigners() []cTypes.AccAddress

func (MsgSellerFeedbacks) Route

func (msg MsgSellerFeedbacks) Route() string

func (MsgSellerFeedbacks) Type

func (msg MsgSellerFeedbacks) Type() string

func (MsgSellerFeedbacks) ValidateBasic

func (msg MsgSellerFeedbacks) ValidateBasic() cTypes.Error

type ReputationDecoder

type ReputationDecoder func(reputationBytes []byte) (AccountReputation, error)

ReputationDecoder : decoder function for Reputation

type SubmitTraderFeedback

type SubmitTraderFeedback struct {
	TraderFeedback TraderFeedback `json:"trader_feedback"`
}

func NewSubmitTraderFeedback

func NewSubmitTraderFeedback(traderFeedback TraderFeedback) SubmitTraderFeedback

func (SubmitTraderFeedback) GetSignBytes

func (submitTraderFeedback SubmitTraderFeedback) GetSignBytes() []byte

func (SubmitTraderFeedback) ValidateBasic

func (in SubmitTraderFeedback) ValidateBasic() cTypes.Error

type TraderFeedback

type TraderFeedback struct {
	BuyerAddress  cTypes.AccAddress `json:"buyerAddress"`
	SellerAddress cTypes.AccAddress `json:"sellerAddress"`
	PegHash       types.PegHash     `json:"pegHash"`
	Rating        int64             `json:"rating"`
}

TraderFeedback : traders traderFeedback this msg

func NewTraderFeedback

func NewTraderFeedback(buyerAddress cTypes.AccAddress, sellerAddress cTypes.AccAddress, pegHash types.PegHash, rating int64) TraderFeedback

NewTraderFeedback : create new Rating

func (TraderFeedback) GenerateNegotiationID

func (traderFeedback TraderFeedback) GenerateNegotiationID() []byte

GenerateNegotiationID : generates negotiationID from traderFeedback struct

type TraderFeedbackHistory

type TraderFeedbackHistory []TraderFeedback

TraderFeedbackHistory : A array of traderFeedbacks

func (TraderFeedbackHistory) Len

func (traderFeedbackHistory TraderFeedbackHistory) Len() int

func (TraderFeedbackHistory) Less

func (traderFeedbackHistory TraderFeedbackHistory) Less(i, j int) bool

func (TraderFeedbackHistory) Search

func (traderFeedbackHistory TraderFeedbackHistory) Search(incomingFeedback TraderFeedback) int

Search : searches if the element is in the array returns length of array if element is not found

func (TraderFeedbackHistory) Sort

func (traderFeedbackHistory TraderFeedbackHistory) Sort() TraderFeedbackHistory

Sort is a helper function to sort the set of traderFeedbacks inplace

func (TraderFeedbackHistory) Swap

func (traderFeedbackHistory TraderFeedbackHistory) Swap(i, j int)

type TransactionFeedback

type TransactionFeedback struct {
	SendAssetsPositiveTx int64 `json:"sendAssetsPositiveTx"`
	SendAssetsNegativeTx int64 `json:"sendAssetsNegativeTx"`

	SendFiatsPositiveTx int64 `json:"sendFiatsPositiveTx"`
	SendFiatsNegativeTx int64 `json:"sendFiatsNegativeTx"`

	IBCIssueAssetsPositiveTx int64 `json:"ibcIssueAssetsPositiveTx"`
	IBCIssueAssetsNegativeTx int64 `json:"ibcIssueAssetsNegativeTx"`

	IBCIssueFiatsPositiveTx int64 `json:"ibcIssueFiatsPositiveTx"`
	IBCIssueFiatsNegativeTx int64 `json:"ibcIssueFiatsNegativeTx"`

	BuyerExecuteOrderPositiveTx int64 `json:"buyerExecuteOrderPositiveTx"`
	BuyerExecuteOrderNegativeTx int64 `json:"buyerExecuteOrderNegativeTx"`

	SellerExecuteOrderPositiveTx int64 `json:"sellerExecuteOrderPositiveTx"`
	SellerExecuteOrderNegativeTx int64 `json:"sellerExecuteOrderNegativeTx"`

	ChangeBuyerBidPositiveTx int64 `json:"changeBuyerBidPositiveTx"`
	ChangeBuyerBidNegativeTx int64 `json:"changeBuyerBidNegativeTx"`

	ChangeSellerBidPositiveTx int64 `json:"changeSellerBidPositiveTx"`
	ChangeSellerBidNegativeTx int64 `json:"changeSellerBidNegativeTx"`

	ConfirmBuyerBidPositiveTx int64 `json:"confirmBuyerBidPositiveTx"`
	ConfirmBuyerBidNegativeTx int64 `json:"confirmBuyerBidNegativeTx"`

	ConfirmSellerBidPositiveTx int64 `json:"confirmSellerBidPositiveTx"`
	ConfirmSellerBidNegativeTx int64 `json:"confirmSellerBidNegativeTx"`

	NegotiationPositiveTx int64 `json:"negotiationPositiveTx"`
	NegotiationNegativeTx int64 `json:"negotiationNegativeTx"`
}

TransactionFeedback : type

Jump to

Keyboard shortcuts

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