types

package
v0.0.0-...-285ad6f Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "paychan"
	// StoreKey is the store key string
	StoreKey = ModuleName
	// RouterKey is the message route
	RouterKey = ModuleName
	// QuerierRoute is the querier route
	QuerierRoute = ModuleName
)
View Source
const ChannelDisputeTime = int64(50000) // about 3 days measured in blocks // TODO add as param in channels

Variables

View Source
var ModuleCdc *codec.Codec

generic sealed codec to be used throughout module

Functions

func GetChannelKey

func GetChannelKey(channelID ChannelID) []byte

GetChannelKey returns the store key for the channel with the given ID.

func GetSubmittedUpdateKey

func GetSubmittedUpdateKey(channelID ChannelID) []byte

GetSubmittedUpdateKey returns the store key for the SubmittedUpdate corresponding to the channel with the given ID.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the paychan message types with the given codec. A codec needs to have implementations of interface types registered before it can serialize them.

Types

type Channel

type Channel struct {
	ID           ChannelID
	Participants [2]sdk.AccAddress // [senderAddr, receiverAddr]
	Coins        sdk.Coins
}

Channel represents a payment channel. Participants is limited to two as currently these are unidirectional channels. Last participant is designated as receiver.

func (Channel) String

func (Channel) String() string

Implement fmt.Stringer interface for compatibility while sdk moves over to using yaml // TODO

type ChannelID

type ChannelID int64 // TODO swap for uint64

func NewChannelIDFromString

func NewChannelIDFromString(s string) (ChannelID, error)

type MsgCreate

type MsgCreate struct {
	Participants [2]sdk.AccAddress // sender, receiver
	Coins        sdk.Coins
}

MsgCreate is for creating a payment channel.

func (MsgCreate) GetSignBytes

func (msg MsgCreate) GetSignBytes() []byte

func (MsgCreate) GetSigners

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

func (MsgCreate) Route

func (msg MsgCreate) Route() string

func (MsgCreate) Type

func (msg MsgCreate) Type() string

func (MsgCreate) ValidateBasic

func (msg MsgCreate) ValidateBasic() sdk.Error

type MsgSubmitUpdate

type MsgSubmitUpdate struct {
	Update
	Submitter sdk.AccAddress
}

MsgSubmitUpdate is for closing a payment channel.

func (MsgSubmitUpdate) GetSignBytes

func (msg MsgSubmitUpdate) GetSignBytes() []byte

func (MsgSubmitUpdate) GetSigners

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

func (MsgSubmitUpdate) Route

func (msg MsgSubmitUpdate) Route() string

func (MsgSubmitUpdate) Type

func (msg MsgSubmitUpdate) Type() string

func (MsgSubmitUpdate) ValidateBasic

func (msg MsgSubmitUpdate) ValidateBasic() sdk.Error

type Payout

type Payout [2]sdk.Coins

Payout is a list of coins to be paid to each of Channel.Participants

func (Payout) IsAnyNegative

func (p Payout) IsAnyNegative() bool

func (Payout) IsValid

func (p Payout) IsValid() bool

func (Payout) Sum

func (p Payout) Sum() sdk.Coins

type SubmittedUpdate

type SubmittedUpdate struct {
	Update
	ExecutionTime int64 // BlockHeight
}

An update that has been submitted to the blockchain, but not yet acted on.

func (SubmittedUpdate) String

func (SubmittedUpdate) String() string

Implement fmt.Stringer interface for compatibility while sdk moves over to using yaml // TODO

type SubmittedUpdatesQueue

type SubmittedUpdatesQueue []ChannelID // not technically a queue

func (SubmittedUpdatesQueue) Contains

func (suq SubmittedUpdatesQueue) Contains(channelID ChannelID) bool

Check if value is in queue

func (*SubmittedUpdatesQueue) RemoveMatchingElements

func (suq *SubmittedUpdatesQueue) RemoveMatchingElements(channelID ChannelID)

Remove all values from queue that match argument

type Update

type Update struct {
	ChannelID ChannelID
	Payout    Payout
	//Sequence  int64 Not needed for unidirectional channels
	Sigs [1]UpdateSignature // only sender needs to sign in unidirectional
}

The data that is passed between participants as payments, and submitted to the blockchain to close a channel.

func (Update) GetSignBytes

func (u Update) GetSignBytes() []byte

type UpdateSignature

type UpdateSignature struct {
	PubKey          crypto.PubKey
	CryptoSignature []byte
}

Jump to

Keyboard shortcuts

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