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

	CodeInvalidNegotiation   cTypes.CodeType = 600
	CodeInvalidSignature     cTypes.CodeType = 601
	CodeInvalidBid           cTypes.CodeType = 602
	CodeUnauthorized         cTypes.CodeType = 603
	CodeInvalidInputsOutputs cTypes.CodeType = 604
	CodeNegativeAmount       cTypes.CodeType = 605
)
View Source
const (
	ModuleName   = "negotiation"
	StoreKey     = ModuleName
	RouterKey    = StoreKey
	QuerierRoute = RouterKey
)

Variables

View Source
var (
	EventTypeChangeNegotiationBid  = "changeNegotiation"
	EventTypeConfirmNegotiationBid = "confirmNegotiation"

	AttributeKeyNegotiationID = "negotiationID"

	AttributeKeyBuyerAddress  = "buyerAddress"
	AttributeKeySellerAddress = "sellerAddress"

	AttributeKeyPegHash = "pegHash"
)
View Source
var ModuleCdc *codec.Codec
View Source
var (
	NegotiationKey = []byte{0x01}
)

Functions

func BuildMsgChangeBuyerBid

func BuildMsgChangeBuyerBid(negotiation Negotiation) cTypes.Msg

BuildMsgChangeBuyerBid : build the MsgChangeBuyerBids

func BuildMsgChangeSellerBid

func BuildMsgChangeSellerBid(negotiation Negotiation) cTypes.Msg

BuildMsgChangeSellerBid : build the MsgChangeSellerBids

func BuildMsgConfirmBuyerBid

func BuildMsgConfirmBuyerBid(negotiation Negotiation) cTypes.Msg

BuildMsgConfirmBuyerBid : build the MsgConfirmBuyerBids

func BuildMsgConfirmSellerBid

func BuildMsgConfirmSellerBid(negotiation Negotiation) cTypes.Msg

BuildMsgConfirmSellerBid : build the MsgConfirmBuyerBids

func ErrInvalidBid

func ErrInvalidBid(codespace cTypes.CodespaceType, msg string) cTypes.Error

func ErrInvalidNegotiationID

func ErrInvalidNegotiationID(codespace cTypes.CodespaceType, msg string) cTypes.Error

func ErrNegativeAmount

func ErrNegativeAmount(codeSpace cTypes.CodespaceType, msg string) cTypes.Error

func ErrNoInputs

func ErrNoInputs(codeSpace cTypes.CodespaceType) cTypes.Error

ErrNoInputs is an error

func ErrUnauthorized

func ErrUnauthorized(codeSpace cTypes.CodespaceType) cTypes.Error

func ErrVerifySignature

func ErrVerifySignature(codespace cTypes.CodespaceType, msg string) cTypes.Error

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

Types

type BaseNegotiation

type BaseNegotiation struct {
	NegotiationID      NegotiationID     `json:"negotiationID" `
	BuyerAddress       cTypes.AccAddress `json:"buyerAddress" `
	SellerAddress      cTypes.AccAddress `json:"sellerAddress" `
	PegHash            types.PegHash     `json:"pegHash"`
	Bid                int64             `json:"bid"`
	Time               int64             `json:"time"`
	BuyerSignature     Signature         `json:"buyerSignature"`
	SellerSignature    Signature         `json:"sellerSignature"`
	BuyerBlockHeight   int64             `json:"buyerBlockHeight"`
	SellerBlockHeight  int64             `json:"sellerBlockHeight"`
	BuyerContractHash  string            `json:"buyerContractHash"`
	SellerContractHash string            `json:"sellerContractHash"`
}

BaseNegotiation : base negotiation type

func (BaseNegotiation) GetBid

func (baseNegotiation BaseNegotiation) GetBid() int64

GetBid : getter

func (BaseNegotiation) GetBuyerAddress

func (baseNegotiation BaseNegotiation) GetBuyerAddress() cTypes.AccAddress

GetBuyerAddress : getter

func (BaseNegotiation) GetBuyerBlockHeight

func (baseNegotiation BaseNegotiation) GetBuyerBlockHeight() int64

GetBuyerBlockHeight get buyer signed blockheight

func (BaseNegotiation) GetBuyerContractHash

func (baseNegotiation BaseNegotiation) GetBuyerContractHash() string

func (BaseNegotiation) GetBuyerSignature

func (baseNegotiation BaseNegotiation) GetBuyerSignature() Signature

GetBuyerSignature : getter

func (BaseNegotiation) GetNegotiationID

func (baseNegotiation BaseNegotiation) GetNegotiationID() NegotiationID

GetNegotiationID : getter

func (BaseNegotiation) GetPegHash

func (baseNegotiation BaseNegotiation) GetPegHash() types.PegHash

GetPegHash : getter

func (BaseNegotiation) GetSellerAddress

func (baseNegotiation BaseNegotiation) GetSellerAddress() cTypes.AccAddress

GetSellerAddress : getter

func (BaseNegotiation) GetSellerBlockHeight

func (baseNegotiation BaseNegotiation) GetSellerBlockHeight() int64

GetSellerBlockHeight get seller signed blockheight

func (BaseNegotiation) GetSellerContractHash

func (baseNegotiation BaseNegotiation) GetSellerContractHash() string

GetSellerContractHash : Get SellerCOntractHash

func (BaseNegotiation) GetSellerSignature

func (baseNegotiation BaseNegotiation) GetSellerSignature() Signature

GetSellerSignature : getter

func (BaseNegotiation) GetTime

func (baseNegotiation BaseNegotiation) GetTime() int64

GetTime : getter

func (*BaseNegotiation) SetBid

func (baseNegotiation *BaseNegotiation) SetBid(bid int64) error

SetBid : setter

func (*BaseNegotiation) SetBuyerAddress

func (baseNegotiation *BaseNegotiation) SetBuyerAddress(buyerAddress cTypes.AccAddress) error

SetBuyerAddress : setter

func (*BaseNegotiation) SetBuyerBlockHeight

func (baseNegotiation *BaseNegotiation) SetBuyerBlockHeight(height int64) error

SetBuyerBlockHeight set buyer block height

func (*BaseNegotiation) SetBuyerContractHash

func (baseNegotiation *BaseNegotiation) SetBuyerContractHash(buyerContractHash string) error

SetBuyerContractHash : set SetBuyerNegotiation

func (*BaseNegotiation) SetBuyerSignature

func (baseNegotiation *BaseNegotiation) SetBuyerSignature(buyerSignature Signature) error

SetBuyerSignature : setter

func (*BaseNegotiation) SetNegotiationID

func (baseNegotiation *BaseNegotiation) SetNegotiationID(negotiationID NegotiationID) error

SetNegotiationID : setter

func (*BaseNegotiation) SetPegHash

func (baseNegotiation *BaseNegotiation) SetPegHash(pegHash types.PegHash) error

SetPegHash : setter

func (*BaseNegotiation) SetSellerAddress

func (baseNegotiation *BaseNegotiation) SetSellerAddress(sellerAddress cTypes.AccAddress) error

SetSellerAddress : setter

func (*BaseNegotiation) SetSellerBlockHeight

func (baseNegotiation *BaseNegotiation) SetSellerBlockHeight(height int64) error

SetSellerBlockHeight set seller block height

func (*BaseNegotiation) SetSellerContractHash

func (baseNegotiation *BaseNegotiation) SetSellerContractHash(sellerContractHash string) error

SetSellerContractHash : set sellercontracthash

func (*BaseNegotiation) SetSellerSignature

func (baseNegotiation *BaseNegotiation) SetSellerSignature(sellerSignature Signature) error

SetSellerSignature : setter

func (*BaseNegotiation) SetTime

func (baseNegotiation *BaseNegotiation) SetTime(time int64) error

SetTime : setter

func (BaseNegotiation) String

func (negotiation BaseNegotiation) String() string

type ChangeBid

type ChangeBid struct {
	Negotiation Negotiation `json:"negotiation" valid:"required"`
}

ChangeBid - change negotiation bid

func NewChangeBid

func NewChangeBid(negotiation Negotiation) ChangeBid

NewChangeBid : initializer

func (ChangeBid) GetSignBytes

func (in ChangeBid) GetSignBytes() []byte

GetSignBytes : get bytes to sign

func (ChangeBid) ValidateBasic

func (in ChangeBid) ValidateBasic() cTypes.Error

type CodeType

type CodeType cTypes.CodeType

type ConfirmBid

type ConfirmBid struct {
	Negotiation Negotiation `json:"negotiation" valid:"required"`
}

ConfirmBid :

func NewConfirmBid

func NewConfirmBid(negotiation Negotiation) ConfirmBid

NewConfirmBid : initializer

func (ConfirmBid) GetSignBytes

func (in ConfirmBid) GetSignBytes() []byte

GetSignBytes : get bytes to sign

func (ConfirmBid) ValidateBasic

func (in ConfirmBid) ValidateBasic() cTypes.Error

type GenesisState

type GenesisState struct {
	Negotiations []Negotiation `json:"negotiations"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

type MsgChangeBuyerBids

type MsgChangeBuyerBids struct {
	ChangeBids []ChangeBid `json:"changeBids"`
}

MsgChangeBuyerBids : high level change bid of negotiation module

func NewMsgChangeBuyerBids

func NewMsgChangeBuyerBids(changeBids []ChangeBid) MsgChangeBuyerBids

NewMsgChangeBuyerBids : initializer

func (MsgChangeBuyerBids) GetSignBytes

func (msg MsgChangeBuyerBids) GetSignBytes() []byte

GetSignBytes : implements msg

func (MsgChangeBuyerBids) GetSigners

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

GetSigners : implements msg

func (MsgChangeBuyerBids) Route

func (msg MsgChangeBuyerBids) Route() string

func (MsgChangeBuyerBids) Type

func (msg MsgChangeBuyerBids) Type() string

Type : implements msg

func (MsgChangeBuyerBids) ValidateBasic

func (msg MsgChangeBuyerBids) ValidateBasic() cTypes.Error

ValidateBasic : implements msg

type MsgChangeSellerBids

type MsgChangeSellerBids struct {
	ChangeBids []ChangeBid `json:"changeBids"`
}

MsgChangeSellerBids : high level change bid of negotiation module

func NewMsgChangeSellerBids

func NewMsgChangeSellerBids(changeBids []ChangeBid) MsgChangeSellerBids

NewMsgChangeSellerBids : initilizer

func (MsgChangeSellerBids) GetSignBytes

func (msg MsgChangeSellerBids) GetSignBytes() []byte

GetSignBytes : implements msg

func (MsgChangeSellerBids) GetSigners

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

GetSigners : implements msg

func (MsgChangeSellerBids) Route

func (msg MsgChangeSellerBids) Route() string

func (MsgChangeSellerBids) Type

func (msg MsgChangeSellerBids) Type() string

Type : implements msg

func (MsgChangeSellerBids) ValidateBasic

func (msg MsgChangeSellerBids) ValidateBasic() cTypes.Error

ValidateBasic : implements msg

type MsgConfirmBuyerBids

type MsgConfirmBuyerBids struct {
	ConfirmBids []ConfirmBid `json:"confirmBids"`
}

MsgConfirmBuyerBids :

func NewMsgConfirmBuyerBids

func NewMsgConfirmBuyerBids(confirmBeds []ConfirmBid) MsgConfirmBuyerBids

NewMsgConfirmBuyerBids : initializer

func (MsgConfirmBuyerBids) GetSignBytes

func (msg MsgConfirmBuyerBids) GetSignBytes() []byte

GetSignBytes : implements msg

func (MsgConfirmBuyerBids) GetSigners

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

GetSigners : implements msg

func (MsgConfirmBuyerBids) Route

func (msg MsgConfirmBuyerBids) Route() string

func (MsgConfirmBuyerBids) Type

func (msg MsgConfirmBuyerBids) Type() string

Type : implements msg

func (MsgConfirmBuyerBids) ValidateBasic

func (msg MsgConfirmBuyerBids) ValidateBasic() cTypes.Error

ValidateBasic : implements msg

type MsgConfirmSellerBids

type MsgConfirmSellerBids struct {
	ConfirmBids []ConfirmBid `json:"confirmBids"`
}

MsgConfirmSellerBids :

func NewMsgConfirmSellerBids

func NewMsgConfirmSellerBids(confirmBids []ConfirmBid) MsgConfirmSellerBids

NewMsgConfirmSellerBids : initializer

func (MsgConfirmSellerBids) GetSignBytes

func (msg MsgConfirmSellerBids) GetSignBytes() []byte

GetSignBytes : implements msg

func (MsgConfirmSellerBids) GetSigners

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

GetSigners : implements msg

func (MsgConfirmSellerBids) Route

func (msg MsgConfirmSellerBids) Route() string

func (MsgConfirmSellerBids) Type

func (msg MsgConfirmSellerBids) Type() string

Type : implements msg

func (MsgConfirmSellerBids) ValidateBasic

func (msg MsgConfirmSellerBids) ValidateBasic() cTypes.Error

ValidateBasic : implements msg

type Negotiation

type Negotiation interface {
	GetNegotiationID() NegotiationID
	SetNegotiationID(NegotiationID) error

	GetBuyerAddress() cTypes.AccAddress
	SetBuyerAddress(cTypes.AccAddress) error

	GetSellerAddress() cTypes.AccAddress
	SetSellerAddress(cTypes.AccAddress) error

	GetPegHash() types.PegHash
	SetPegHash(types.PegHash) error

	GetBid() int64
	SetBid(int64) error

	GetTime() int64
	SetTime(int64) error

	GetBuyerSignature() Signature
	SetBuyerSignature(Signature) error

	GetSellerSignature() Signature
	SetSellerSignature(Signature) error

	GetBuyerBlockHeight() int64
	SetBuyerBlockHeight(int64) error

	GetSellerBlockHeight() int64
	SetSellerBlockHeight(int64) error

	GetBuyerContractHash() string
	SetBuyerContractHash(string) error

	GetSellerContractHash() string
	SetSellerContractHash(string) error
}

func NewBaseNegotiation

func NewBaseNegotiation(id NegotiationID, buyerAddress, sellerAddress cTypes.AccAddress, bid, time int64, buyerSignature, sellerSignature Signature, buyerBlockHeight, sellerBlockHeight int64, buyerContractHash, sellerContractHash string) Negotiation

func NewNegotiation

func NewNegotiation(buyerAddress, sellerAddress cTypes.AccAddress, pegHash types.PegHash) Negotiation

func ProtoBaseNegotiation

func ProtoBaseNegotiation() Negotiation

ProtoBaseNegotiation : converts concrete to Negotiation interface

type NegotiationID

type NegotiationID = common.HexBytes

func GetNegotiationIDFromString

func GetNegotiationIDFromString(negotiationIDStr string) (negotiationID NegotiationID, err error)

GetNegotiationIDHex : convert NegotiationID string to NegotiationID hex

func GetNegotiationKey

func GetNegotiationKey(id NegotiationID) NegotiationID

type SignNegotiationBody

type SignNegotiationBody struct {
	BuyerAddress  cTypes.AccAddress `json:"buyerAddress"`
	SellerAddress cTypes.AccAddress `json:"sellerAddress"`
	PegHash       types.PegHash     `json:"pegHash"`
	Bid           int64             `json:"bid"`
	Time          int64             `json:"time"`
}

SignNegotiationBody :

func NewSignNegotiationBody

func NewSignNegotiationBody(buyerAddress, sellerAddress cTypes.AccAddress, peghash types.PegHash, bid, time int64) *SignNegotiationBody

NewSignNegotiationBody :

func (SignNegotiationBody) GetSignBytes

func (bytes SignNegotiationBody) GetSignBytes() []byte

GetSignBytes :

type Signature

type Signature []byte

func (Signature) String

func (sign Signature) String() string

Jump to

Keyboard shortcuts

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