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() }
InPayment 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() }
OutPayment interface for the (delayed) outgoing payment system with auto-deposit
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 }
Payment handlers
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 }
Profile - 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 serializable to send with Protocol
type Protocol ¶
Protocol interface for the peer protocol for testing or external alternative payment
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.