Documentation ¶
Index ¶
- Variables
- type Backend
- type ChallengeError
- type Channel
- func (c *Channel) Accept(auth *bind.TransactOpts, id [32]byte) error
- func (c *Channel) CoopClose(auth *bind.TransactOpts) error
- func (c *Channel) CreateCoopClose() ([32]byte, error)
- func (c *Channel) CurrentState() State
- func (c *Channel) DisputeForceClose(auth *bind.TransactOpts, startBlock uint64) (time.Time, error)
- func (c *Channel) FinishForceClose(auth *bind.TransactOpts) error
- func (c *Channel) MetaData() MetaData
- func (c *Channel) Open(auth *bind.TransactOpts) ([32]byte, error)
- func (c *Channel) ReceivedMoney(valueA, valueB, round *big.Int, sig []byte) error
- func (c *Channel) SendMoney(value *big.Int) ([32]byte, error)
- func (c *Channel) StartForceClose(auth *bind.TransactOpts) (time.Time, error)
- type MetaData
- type State
Constants ¶
This section is empty.
Variables ¶
var ChannelAddr = common.HexToAddress("0x01")
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { bind.DeployBackend bind.ContractBackend }
type ChallengeError ¶
type ChallengeError struct {
// contains filtered or unexported fields
}
func (*ChallengeError) Error ¶
func (e *ChallengeError) Error() string
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel wraps an SSPC payment channel.
func NewChannel ¶
func NewChannel(backend Backend, addrA, addrB common.Address, valueA, valueB *big.Int) (*Channel, error)
NewChannel initializes the channel object.
func (*Channel) Accept ¶
func (c *Channel) Accept(auth *bind.TransactOpts, id [32]byte) error
Accept accepts the proposed channel opening with ID id.
func (*Channel) CoopClose ¶
func (c *Channel) CoopClose(auth *bind.TransactOpts) error
CoopClose sends a cooperative close with the latest channel state. The latest channel state must be a valid cooperative close message.
func (*Channel) CreateCoopClose ¶
CreateCoopClose creates the hash of a coop close which needs to be signed and send to a peer. Once a coop close is signed, the channel must not be used to send transactions anymore.
func (*Channel) CurrentState ¶
Current state returns the state of a channel.
func (*Channel) DisputeForceClose ¶
DisputeForceClose disputes a force close procedure. It returns the time when the force close is finished. `startBlock` denotes a block reasonably long before the force close happened.
func (*Channel) FinishForceClose ¶
func (c *Channel) FinishForceClose(auth *bind.TransactOpts) error
FinishForceClose distributes the money after a force close is concluded. This can happen both after a StartForceClose or a DisputeForceClose.
func (*Channel) Open ¶
func (c *Channel) Open(auth *bind.TransactOpts) ([32]byte, error)
Open proposes to open a channel with the initially provided parameters. Open returns the resulting channel ID.
func (*Channel) ReceivedMoney ¶
ReceivedMoney updates the local channel state with the new values received from our peer.
func (*Channel) SendMoney ¶
SendMoney returns the hash of the state after the value is transferred. This hash needs to be signed and send to the peer.
func (*Channel) StartForceClose ¶
StartForceClose starts the forceful closure procedure with the latest peer signature. It returns the time when the force close is successful.