Running payroll

This guide is for whoever pays. You need a wallet with DIESEL and a little BTC for fees.

1. Create a pool

A pool is your payroll account. Creating one mints two tokens to your wallet:

n is the pool's own id number, so each pool's tokens are easy to tell apart.

2. Fund it

Send DIESEL to the pool with Deposit. Anyone can deposit, so a treasury or a co-signer can top it up too. Keep enough in the pool for at least the next payday of every stream. If the pool runs short, nobody loses pay: the stream records what it is owed and draws it after the next deposit (see Shortfalls).

3. Add a person

Create stream sets up one person's pay. The terms:

termmeaning
startthe first payday (unix time). Leave empty for "now".
back paya one-off amount paid on the first payday, for pay that is already late
amount per paydayUSD paid on every later payday
intervaltime between paydays: 14 days is 1209600 seconds. Paydays follow the clock, not block counts.
budgetthe total USD this stream may pay, back pay included. The last payday is partial if the budget runs out mid-period.
cancelablewhether you can stop the stream later. A non-cancelable stream's terms can only improve.
price floorthe lowest DIESEL price a payday will use. If the oracle ever reports something absurdly low, the stream pays at the floor instead of draining the pool.
max per paydayan optional hard cap on DIESEL per payday
TWAP window0 uses the price at the payday. Up to 1 day averages the price over that window instead.
pool capan optional lifetime limit on DIESEL this stream may draw from the pool

The pool returns your admin token and a stream NFT. Send the NFT to the person. Holding it is what lets them collect.

Example

Someone joins on the 1st, you set things up on the 20th, and pay is $2,500 every two weeks for six months:

They can collect the back pay straight away, priced at that day's DIESEL rate. Every two weeks after that, another $2,500 of DIESEL becomes theirs at that payday's rate.

Changing terms

Hold the admin token and use these on a stream:

On a non-cancelable stream, Amend may only raise the rate, raise the budget or shorten the interval.

Shortfalls

When a payday comes and the pool can't cover it, the stream still fixes the DIESEL amount at that day's price. The part it couldn't draw becomes debt on the pool. Debt is reserved: Withdraw can only take the pool's balance minus its debt. The next deposit pays the debt first.

Withdrawing

Withdraw returns DIESEL you don't need. It is limited to the free balance, which is the pool balance minus debt.

Paydays that have come but haven't been settled yet aren't reserved until someone settles them. Anyone can settle a stream at any time, and our keeper settles each stream right after its payday.

Keeping things moving

Paydays settle when someone touches the stream: the person collecting, you changing terms, or a Settle call, which anyone may make. A stream that has been idle a long time catches up a few paydays per call. Settle accepts a smaller batch if a transaction ever runs short of fuel.

Revoke (emergency brake)

Revoke on the pool stops a stream from drawing anything new. Pay already recorded as debt stays reserved and drawable. Use Cancel for normal offboarding. Revoke is for a stream you believe is misbehaving.