Skip to content
Logo

Keepers and auctions

Dark cube-shaped robots with glowing green eyes hovering above a reflective surface.

A keeper calls the routine public functions that keep the protocol moving, from booking revenue to closing a sale. The protocol has no admin who runs these jobs. Anyone can call them. The Blocks team runs a keeper, and so can you.

In short

  • Anyone can run every routine job. No role or permission is needed.
  • No job pays its caller. Keepers pay their own gas, and the protocol pays no reward.
  • Two auctions sell tokens at a falling price. Jar auctions sell the tokens a Jar collects for BUX. Policy auctions sell a Policy's BUX for the token the Policy wants.
  • Buyers in both auctions need no permission either. Their only reward is the token they buy, at a price they chose to pay.

What keepers do

Each job is one contract call, grouped by purpose:

Keep revenue moving:

  • book money that has reached a vault. The vault pays the work fee and records the rest as backing. Redemptions book BUX on their own; everything else waits for a keeper
  • route a plain transfer that has reached a Jar
  • collect a block's share for its Policy, from the market and from the Jar
  • sweep a coin's fees to the fee pool and the parent block's Jar
  • split the fee pool between its two recipients

Finish launches:

  • close a sale once it ends, which pays the success fee and opens the market
  • deliver each buyer's tokens and any refund
  • release vested tokens to the creator payout

Pay creators:

  • claim a creator's share of swap fees to the creator payout
  • distribute a weighted payout among its payees, then pay each one

Start auctions:

  • stage a Jar lot, which puts a Jar's inventory of one token up for sale
  • start a Policy auction, which puts the Policy's BUX up for sale
  • report what a Policy has bought: pass the wrapped token to a staking block as revenue, or forward a Reserve Policy's asset to the vault

Send BUX home, once the bridge opens (coming soon):

  • send a remote Jar's home-bound BUX to the home Jar, paying the message fee

The two auctions

Both auctions sell at a falling price with no price feed. Each lot starts at a deliberately high price, which falls until a buyer takes it. A buyer can take any part of a lot and pays the matching share of the current price. A buyer who values a lot above the current price has no reason to wait, because another buyer can take it first.

A Jar auction sells a Jar's inventory: the tokens it collects, other than dollars and tokens the vault keeps. The Releaser contract runs it, and the buyer pays BUX. The Jars page walks through one lot.

A Policy auction sells a Policy's BUX for the token the Policy wants. A staking block's buyback Policy wants the wrapped token. A Reserve Policy wants its reserve asset. Each Policy that uses an auction has its own, and is the only one that can start a lot in it, so anyone starts a lot by asking the Policy. The buyer pays the wanted token, straight to the Policy.

Jar auctionPolicy auction
What is solda Jar's inventory of one tokenthe Policy's BUX
What the buyer paysBUXthe token the Policy wants
Who starts a lotanyone, by staging it on the Releaseranyone, by asking the Policy to kick its auction
Opening price1,000,000,000 BUX for the whole lotfar above any real value, for the whole lot
Price fallabout 1.5% a minuteabout 5.8% a minute
Lowest price1 BUX for the whole lot, reached after 23 hoursthe wanted token's smallest unit per BUX, where the lot ends
Lot length24 hours: 23 hours of falling price, then 1 hour at 1 BUXuntil the lot sells out or reaches its lowest price, at most about 17 hours
Where the money goesto the Jar, which passes it to the vault, or holds it for the Policy to collectto the Policy, for anyone to report to the vault
The next lotanyone stages it once this one endsanyone kicks it once this one ends

After a Policy auction, the Policy holds the token it bought and anyone reports it. A staking block's Policy passes the wrapped token to the bToken vault, which pays the work fee and locks the rest for bToken holders. A Reserve Policy forwards its asset to the block's vault, which books it as backing. Read bTokens and Policies for each.

Who runs them

The Blocks team runs a keeper for the routine jobs above, and a separate buyer bot that stages Jar lots and buys at its own valuation. Anyone can run their own. Nothing in the contracts knows who a keeper is, so there is nothing to apply for.

No job pays its caller. Keepers pay their own gas, and the protocol pays no reward. People run keepers because they want the work done: an app wants the revenue it sends booked, a creator wants payouts delivered, a Policy author wants auctions started.

Buyers are different. The protocol pays them no separate reward; they receive the tokens they buy at the current price. Each buyer decides when the price meets their own valuation. Waiting lowers the price, but another buyer may take the lot first.

Run your own keeper

You need three things:

  • an RPC endpoint for the chain: Robinhood is chain id 4663, Base is chain id 8453
  • a wallet holding enough of the chain's native currency for gas
  • the contract addresses, listed on the contracts page

There are two ways to find work, and most keepers use both:

  • index events. Every launch, deposit, commitment and swap emits a public event, so an indexer can list every block, sale, Jar, payout and Policy, and what has arrived at each
  • read state. Every job has a read that says whether there is anything to do. They are listed under For developers

Then run a loop.

List the blocks you want to serve

Start from the factories' launch events, or from one block you care about. For each one, note its vault, Jar, sale, escrow, payout and Policy. The contracts page shows how to find each.

Check for work

Each job has a read that says whether there is anything to do. Check them on a timer. Once a minute is plenty.

Send one transaction per job

Call the matching function. Simulate the call first, so a job someone else has already done costs you nothing. Skip work worth less than the gas to do it.

Stage and kick auctions

When a Jar holds a token to sell, stage a lot. When a Policy holds BUX, kick its auction. If you also want to buy, read the current price and take when it suits you.

For developers

Anyone may send every call below. Each row gives the read that says the job is ready.

JobCallReady when
Book vault revenueBlockVault.sync(asset)the vault's balance of asset is above available(asset) plus reserved(asset). BUX and retained tokens only
Route a Jar transferJar.sync(asset)the Jar's balance of asset is above accounted(asset). The zero address is native currency
Collect the market rowBlockHook.claimPolicy(token)earned(token, address(0)) is above zero
Collect a Jar rowJar.claimPolicyAsset(asset), or PolicySweeper.claimAll(token) for every row at oncepolicyClaimable(asset) is above zero
Sweep coin feesCoinHook.sweepVault(token)pendingFees(token, row) is above zero for address(0), the block's row, or address(1), the protocol's
Split the fee poolFeePool.distribute(asset)the pool holds any asset
Close a saleBlockBatchSale.close()state() is Selling and the block time has reached terms().endTime
Deliver a buyerBlockBatchSale.deliver(to)the sale is closed, commitments(to) is above zero and delivered(to) is false. Committed events list every buyer
Release vested tokensVestingEscrow.release()releasable() is above zero
Claim creator swap feesBlockHook.claimPoolFees(token, payout) or CoinHook.claimPoolFees(token, payout)earned(token, payout) is above zero. The payout is BlockFactory.payoutOf(token), or the payout in CoinFactory.swapFeeTerms(token)
Distribute a payoutCreatorPayout.distribute(asset)the payout's balance plus totalPaid(asset) is above totalReceived(asset)
Pay a payeeCreatorPayout.claim(asset, account)claimable(asset, account) is above zero
Stage a Jar lotReleaser.stage(jar, asset)Jar.inventory(asset) is above zero and the last lot in lots(jar, asset) was staged more than 24 hours ago
Buy from a Jar lotReleaser.takeWithLimits(jar, asset, maxAmount, minAmount, maxPayment, receiver, deadline), or JarSweeper.buyMany(legs, deadline, maxTotalPayment, legGas, skipFailures) for several lotsavailable(jar, asset) is above zero. Approve the Releaser, or the sweeper, for the BUX first
Kick a Policy auctionBuybackPolicy.kickAuction() or ReservePolicy.kickAuction()the Policy, or the rows waiting for it, hold BUX, and auction().isActive(bux) is false
Buy from a Policy auctiontake(bux, maxAmount, receiver) on the Policy's auction()isActive(bux) is true. getAmountNeeded(bux, amount) quotes the cost. Approve the auction for that much of the wanted token
Report a buybackBuybackPolicy.reportUnderlying(buxToRedeem)the Policy holds the wrapped token. Pass 0, or the BUX to redeem when the wrapped token is the dollar behind BUX
Forward a reserveReservePolicy.forward(asset)the Policy holds asset, which is any token but BUX
Send BUX home (coming soon)Jar.bridgeHome(amount), payablehomeBound(bux) on a remote Jar is above zero. Quote the fee with the router's getFee

Notes:

  • the current Releaser is ProtocolSettings.releaser(). Its band is public: ceiling 1,000,000,000 BUX, floor 1 BUX, step 36 seconds, decayRay about 0.99103 per step, slide 82,800 seconds and FLOOR_WINDOW 1 hour
  • a Policy's auction is auction() on the Policy. Every Policy auction opens at 1e36 (wad) for the whole lot, steps every 5 seconds, falls 50 bps a step and has a minimum price of 10 ** (18 - decimals) of the wanted token per whole BUX. The decay rounds to zero 62,710 seconds after the kick, which ends any lot still open
  • the Safe can replace the Releaser and the auction factory. Read ProtocolSettings.releaser() and the Policy's auction() before each purchase rather than caching them
  • deliver, claim and claimPoolFees take one account each. Batch them through Multicall3

Next

  • Jars for how a Jar sorts what arrives, with one Jar lot in full
  • bTokens for the staking block's buyback Policy
  • Policies for Reserve Policies and the rows a Policy collects
  • Contracts for every address