paych

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0, MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const LaneStatesAmtBitwidth = 3
View Source
const SettleDelay = builtin.EpochsInHour * 12

Variables

View Source
var Methods = map[abi.MethodNum]builtin.MethodMeta{
	1: builtin.NewMethodMeta("Constructor", *new(func(*ConstructorParams) *abi.EmptyValue)),
	2: builtin.NewMethodMeta("UpdateChannelState", *new(func(*UpdateChannelStateParams) *abi.EmptyValue)),
	3: builtin.NewMethodMeta("Settle", *new(func(*abi.EmptyValue) *abi.EmptyValue)),
	4: builtin.NewMethodMeta("Collect", *new(func(*abi.EmptyValue) *abi.EmptyValue)),
}

Functions

This section is empty.

Types

type ConstructorParams

type ConstructorParams struct {
	From addr.Address // Payer
	To   addr.Address // Payee
}

func (*ConstructorParams) MarshalCBOR

func (t *ConstructorParams) MarshalCBOR(w io.Writer) error

func (*ConstructorParams) UnmarshalCBOR

func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error)

type LaneState

type LaneState struct {
	Redeemed big.Int
	Nonce    uint64
}

The Lane state tracks the latest (highest) voucher nonce used to merge the lane as well as the amount it has already redeemed.

func (*LaneState) MarshalCBOR

func (t *LaneState) MarshalCBOR(w io.Writer) error

func (*LaneState) UnmarshalCBOR

func (t *LaneState) UnmarshalCBOR(r io.Reader) (err error)

type Merge

type Merge struct {
	Lane  uint64
	Nonce uint64
}

Specifies which `Lane`s to be merged with what `Nonce` on channelUpdate

func (*Merge) MarshalCBOR

func (t *Merge) MarshalCBOR(w io.Writer) error

func (*Merge) UnmarshalCBOR

func (t *Merge) UnmarshalCBOR(r io.Reader) (err error)

type ModVerifyParams

type ModVerifyParams struct {
	// Actor on which to invoke the method.
	Actor addr.Address
	// Method to invoke.
	Method abi.MethodNum
	// Pre-serialized method parameters.
	Data []byte
}

Modular Verification method

func (*ModVerifyParams) MarshalCBOR

func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error

func (*ModVerifyParams) UnmarshalCBOR

func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error)

type SignedVoucher

type SignedVoucher struct {
	// ChannelAddr is the address of the payment channel this signed voucher is valid for
	ChannelAddr addr.Address
	// TimeLockMin sets a min epoch before which the voucher cannot be redeemed
	TimeLockMin abi.ChainEpoch
	// TimeLockMax sets a max epoch beyond which the voucher cannot be redeemed
	// TimeLockMax set to 0 means no timeout
	TimeLockMax abi.ChainEpoch
	// (optional) The SecretHash is used by `To` to validate
	SecretHash []byte
	// (optional) Extra can be specified by `From` to add a verification method to the voucher.
	Extra *ModVerifyParams
	// Specifies which lane the Voucher merges into (will be created if does not exist)
	Lane uint64
	// Nonce is set by `From` to prevent redemption of stale vouchers on a lane
	Nonce uint64
	// Amount voucher can be redeemed for
	Amount big.Int
	// (optional) MinSettleHeight can extend channel MinSettleHeight if needed
	MinSettleHeight abi.ChainEpoch

	// (optional) Set of lanes to be merged into `Lane`
	Merges []Merge

	// Sender's signature over the voucher
	Signature *crypto.Signature
}

A voucher is sent by `From` to `To` off-chain in order to enable `To` to redeem payments on-chain in the future

func (*SignedVoucher) MarshalCBOR

func (t *SignedVoucher) MarshalCBOR(w io.Writer) error

func (*SignedVoucher) SigningBytes

func (t *SignedVoucher) SigningBytes() ([]byte, error)

func (*SignedVoucher) UnmarshalCBOR

func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error)

type State

type State struct {
	// Channel owner, who has funded the actor
	From addr.Address
	// Recipient of payouts from channel
	To addr.Address

	// Amount successfully redeemed through the payment channel, paid out on `Collect()`
	ToSend abi.TokenAmount

	// Height at which the channel can be `Collected`
	SettlingAt abi.ChainEpoch
	// Height before which the channel `ToSend` cannot be collected
	MinSettleHeight abi.ChainEpoch

	// Collections of lane states for the channel, maintained in ID order.
	LaneStates cid.Cid // AMT<LaneState>
}

A given payment channel actor is established by From to enable off-chain microtransactions to To to be reconciled and tallied on chain.

func (*State) MarshalCBOR

func (t *State) MarshalCBOR(w io.Writer) error

func (*State) UnmarshalCBOR

func (t *State) UnmarshalCBOR(r io.Reader) (err error)

type StateSummary

type StateSummary struct {
	Redeemed abi.TokenAmount
}

func CheckStateInvariants

func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount) (*StateSummary, *builtin.MessageAccumulator)

Checks internal invariants of paych state.

type UpdateChannelStateParams

type UpdateChannelStateParams struct {
	Sv     SignedVoucher
	Secret []byte
}

func (*UpdateChannelStateParams) MarshalCBOR

func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error

func (*UpdateChannelStateParams) UnmarshalCBOR

func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error)

Jump to

Keyboard shortcuts

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