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() }
interface for the (delayed) incoming payment system with autocash
type OutPayment ¶
type OutPayment interface { Issue(amount *big.Int) (promise Promise, err error) AutoDeposit(interval time.Duration, threshold, buffer *big.Int) Stop() }
interface for the (delayed) ougoing payment system with autodeposit
type Params ¶
Params extends the public profile with private parameters relating to automatic deposit and automatic cashing
type Payment ¶
type Payment struct { Out OutPayment // outgoing payment handler In InPayment // incoming payment handler Buys, Sells bool }
type Profile ¶
type Profile struct { BuyAt *big.Int // accepted max price for chunk SellAt *big.Int // offered sale price for chunk PayAt uint // threshold that triggers payment request DropAt uint // threshold that triggers disconnect }
public swap profile public parameters for SWAP, serializable config struct passed in handshake
type Promise ¶
type Promise interface{}
Promise 3rd party Provable Promise of Payment issued by outPayment serialisable to send with Protocol
type Strategy ¶
type Strategy struct { AutoCashInterval time.Duration // default interval for autocash AutoCashThreshold *big.Int // threshold that triggers autocash (wei) AutoDepositInterval time.Duration // default interval for autocash AutoDepositThreshold *big.Int // threshold that triggers autodeposit (wei) AutoDepositBuffer *big.Int // buffer that is surplus for fork protection etc (wei) }
Strategy encapsulates parameters relating to automatic deposit and automatic cashing
type Swap ¶
type Swap struct { Payment // contains filtered or unexported fields }
swap is the swarm accounting protocol instance * pairwise accounting and payments
func (*Swap) Add ¶
Add(n) n > 0 called when promised/provided n units of service n < 0 called when used/requested n units of service
func (*Swap) Receive ¶
receive(units, promise) is called by the protocol when a payment msg is received returns error if promise is invalid.