swap

package
v0.0.0-...-b78b3a4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InPayment

type InPayment interface {
	Receive(promise Promise) (*big.Int, error)
	AutoCash(cashInterval time.Duration, maxUncashed *big.Int)
	Stop()
}

type OutPayment

type OutPayment interface {
	Issue(amount *big.Int) (promise Promise, err error)
	AutoDeposit(interval time.Duration, threshold, buffer *big.Int)
	Stop()
}

type Params

type Params struct {
	*Profile
	*Strategy
}

type Payment

type Payment struct {
	Out         OutPayment //
	In          InPayment  //
	Buys, Sells bool
}

type Profile

type Profile struct {
	BuyAt  *big.Int //
	SellAt *big.Int //
	PayAt  uint     //
	DropAt uint     //
}

type Promise

type Promise interface{}

type Protocol

type Protocol interface {
	Pay(int, Promise) //
	Drop()
	String() string
}

type Strategy

type Strategy struct {
	AutoCashInterval     time.Duration //
	AutoCashThreshold    *big.Int      //
	AutoDepositInterval  time.Duration //
	AutoDepositThreshold *big.Int      //
	AutoDepositBuffer    *big.Int      //
}

type Swap

type Swap struct {
	Payment
	// contains filtered or unexported fields
}

func New

func New(local *Params, pm Payment, proto Protocol) (swap *Swap, err error)

func (*Swap) Add

func (swap *Swap) Add(n int) error

func (*Swap) Balance

func (swap *Swap) Balance() int

func (*Swap) Receive

func (swap *Swap) Receive(units int, promise Promise) error

func (*Swap) SetParams

func (swap *Swap) SetParams(local *Params)

func (*Swap) SetRemote

func (swap *Swap) SetRemote(remote *Profile)

func (*Swap) Stop

func (swap *Swap) Stop()

Jump to

Keyboard shortcuts

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