Keeper & indexed data
A keeper fills the slices the contract says are due. The hosted one also indexes every DCA event into a database, which the app reads first.
What a keeper can do
Any allowlisted address may call executeSlice when the verdict is ready, and closeExpired after a deadline. Nothing else: no withdrawals, no edits, and the contract re-checks every rule in the fill. Orders never depend on one keeper, because owners can fill their own slices.
import { makeKeeper } from "@poincaretrade/api";
const pass = makeKeeper({ dcaAddress, privateKey: process.env.KEEPER_PRIVATE_KEY!, maxTx: 20 });
const run = await pass();
// { checked, executed: [{ id, amountIn, spreadBps }], refunded, held: { "spread-too-high": 2 }, deferred }The contract owner adds or removes keepers with setKeeper(address, bool).
Indexed data
Public RPCs serve at most 1,000 blocks per log query, so history comes from an index: after each keeper pass the hosted dca-keeper function reads every PoincareDCA event since its cursor and writes two public, read-only tables.
| Table | One row per | Main columns |
|---|---|---|
dca_orders | Order (latest state) | order_id, owner, side, status (open · completed · refunded · cancelled), paused, amount_in, spent, refunded, amount_out, fills, slices |
dca_fills | Executed slice | order_id, owner, side, amount_in, amount_out, price, spread_bps, ts, tx_hash |
Running it yourself: see DCA.md (opens in a new tab) for the edge functions, secrets and the pg_cron schedule.