createDeposit(amount map[common.Address]uint64) depositID
- sends a transaction to create a new deposit with the given target allowances
subscribeDepositEvents(ch chan struct {id depositID, state int})
- sends an event to the given channel every time a deposit goes into
pending
,active
orexpired
state
- sends an event to the given channel every time a deposit goes into
estimatedExpiry(id depositID) time.Duration
- returns the estimated remaining time while cheques can still be written using this deposit
allowancesLeft(id depositID) map[common.Address]uint64
lastCheque(id depositID, to common.Address) (totalSpent, allowanceLeft uint64)
writeCheque(id depositID, to common.Address, amount uint64) (totalSpent, allowanceLeft uint64, proofOfPayment []byte)
- creates a cheque if the deposit is in
active
state and there is enough allowance left (otherwiseproofOfPayment
should benil
) - allowances are nominated in currency units, the payment channel module converts it to probability based on the total deposit amount
proofOfPayment
is a serialized format of the cheque. It should contain the following info:- address of the deposit contract
- deposit ID
- highest winning random number (incremental)
- Merkle proof of the server being assigned to a random number range that contains the current highest winning number
- creates a cheque if the deposit is in
Created
December 9, 2019 10:08
-
-
Save zsfelfoldi/b4da6b5ca7fa67d4ce919c413094bdc7 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment