Documentation ¶
Index ¶
- Constants
- Variables
- func GetChannelKey(channelID ChannelID) []byte
- func GetSubmittedUpdateKey(channelID ChannelID) []byte
- func RegisterCodec(cdc *codec.Codec)
- type Channel
- type ChannelID
- type MsgCreate
- type MsgSubmitUpdate
- type Payout
- type SubmittedUpdate
- type SubmittedUpdatesQueue
- type Update
- type UpdateSignature
Constants ¶
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 )
const ChannelDisputeTime = int64(50000) // about 3 days measured in blocks // TODO add as param in channels
Variables ¶
var ModuleCdc *codec.Codec
generic sealed codec to be used throughout module
Functions ¶
func GetChannelKey ¶
GetChannelKey returns the store key for the channel with the given ID.
func GetSubmittedUpdateKey ¶
GetSubmittedUpdateKey returns the store key for the SubmittedUpdate corresponding to the channel with the given ID.
func RegisterCodec ¶
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.
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 (MsgCreate) GetSigners ¶
func (msg MsgCreate) GetSigners() []sdk.AccAddress
func (MsgCreate) ValidateBasic ¶
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 ¶
Payout is a list of coins to be paid to each of Channel.Participants
func (Payout) IsAnyNegative ¶
type SubmittedUpdate ¶
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.