/position.
Why lifecycle webhooks (vs polling /position)
The /position endpoint reads balanceOf + convertToAssets directly from the chain — accurate but expensive to poll, and it doesn’t tell you which transaction caused the change. Lifecycle webhooks give you:
- A push signal the moment a deposit or redeem hits confirmation depth (no polling)
- The originating
tx_hashso you can join with your own pending-tx table - The exact
shares/amountso you can update your DB without a follow-up RPC call
/position for total balance display.
Sync vault sequence
Most BarkerEngine products wrap a synchronous ERC-4626 vault —deposit() returns shares atomically, redeem() returns assets atomically.
Deposit
Events fired:deposit.confirmed— fires once, after theDeposit(sender, owner, assets, shares)log reaches confirmation depth.
Redeem
Events fired:redeem.confirmed— fires once, after theWithdraw(sender, receiver, owner, assets, shares)log reaches confirmation depth.
Async vault sequence
Some underlying vaults (e.g. liquid-staking with unbond periods, certain Morpho strategies) cannot redeem atomically — the user submits a request, settlement happens later. BarkerEngine wraps this with two events. Events fired:redeem.requested— fires afterRedeemRequested(request_id, owner, shares)log. Includesestimated_settlement_at(computed from the underlying vault’s unbond period).redeem.confirmed— fires when the settlementWithdrawlog appears. Thetx_hashhere is the settlement tx, not the request tx.
user_address + shares (or query /position to confirm).
A product is sync vs async based on the underlying vault — check the redeem_mode field on the product detail endpoint (sync | async). Sync products never emit redeem.requested.
Confirmation depth
Engine logs are not delivered until they’re deep enough that a chain reorg is unlikely to drop them.| Chain | chain_id | Depth | Approx. delay |
|---|---|---|---|
| Ethereum mainnet | 1 | 12 blocks | ~3 min |
| Base | 8453 | 32 blocks | ~1 min |
| Arbitrum One | 42161 | 32 blocks | ~10 sec |
| Optimism | 10 | 32 blocks | ~1 min |
| Polygon PoS | 137 | 64 blocks | ~2 min |
| Sandbox testnets | 11155111, 84532, etc. | 1 block | ~12 sec |
GET /api/partner/products/{slug}/health) under confirmation_depth_blocks so you can compute the same “still pending” cutoff in your UI.
Reconciling with /position
After you handle deposit.confirmed you generally don’t need to call /position — the event payload already has the new shares and amount. But for a sanity check or when you reconnect after downtime:
/positionreturns the current chain state, not a snapshot at the event time- For a user who just deposited and immediately withdrew, the events arrive in order but
/positionreflects the net (zero) - The webhook’s
block_numberlets you order events; do not rely on delivery order alone (retries can shuffle)
Edge cases
Chain reorg below confirmation depth. The reorg happens before we deliver — no event fires for the orphaned tx. The user’s wallet shows the tx as dropped; your UI should treat tx-without-event as a failure once you exceedconfirmation_depth_blocks * 2 * block_time since submission.
Multiple deposits in the same tx (multicall). Each Deposit log produces one deposit.confirmed. The log_index differentiates them within the tx.
Same user, multiple products in one tx. Same as above — one event per log. The slug field tells you which product.
Engine paused mid-deposit. The deposit either reverts (no event) or completes (normal deposit.confirmed) — pause prevents new deposits but doesn’t void in-flight ones. After pause, the next event you’ll see for that product is vault_pause.
Redeem requested then user changes mind. Most async vaults don’t support cancellation. If they do, you’ll see neither redeem.confirmed nor a cancel event in v1; the request quietly disappears from the underlying vault. Until cancellation events ship, reconcile via /position.
What’s next
- Failure modes — RPC outages, tx replacement, webhook delivery failure, idempotency
- Webhooks — signature verification, retry policy, dedupe keys
- Headless integration — wallet-side deposit/redeem code samples