Skip to content

feat(vibenet): add Liquidations validity transactions demo - #175

Open
haardikk21 wants to merge 2 commits into
mainfrom
hh/validity-liquidations
Open

haardikk21 wants to merge 2 commits into
mainfrom
hh/validity-liquidations

Conversation

@haardikk21

@haardikk21 haardikk21 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds Liquidations, a third validity-transactions demo at /vibenet/demos/validity/liquidations.

Borrowers (vibenet actors) keep VibeLend loans open near their liquidation price while the VIBE/USDV pool moves. A rival keeper liquidates with plain transactions about three seconds after a loan goes under water. The user can liquidate by hand, or arm a validity liquidation ahead of time that the sequencer includes the first block the price allows. The page shows how many blocks each liquidation took after the position went under water.

VibeLend (lib/contracts/VibeLend.sol + artifact): minimal lending market. VIBE collateral, USDV debt, spot price read from the AMM pool reserves. A position is liquidatable when collateral * price * 80% < debt, and liquidate() pays the caller 5% of the collateral. It's deployed through Nick's CREATE2 proxy, so the UI predicts the address (lib/lending.ts).

Validity predicates on an armed liquidation:

  1. pool slot 8 USDV reserve <= ceiling. The price check is reduced to a single reserve bound, derived in the page's advanced details.
  2. the borrower's packed position word = its current value, so the tx is never included if the keeper or borrower changes the position first. It's dropped rather than reverted.
  3. block number <= expiry (15/30/60s).

UI

  • Stats card: price, block, open positions, under water, VIBE earned via validity.
  • Liquidator panel: arm, or "Liquidate now" (always sends, and reverts onchain if the position is healthy).
  • Book sorted by health, your attempts with +X VIBE rewards read from the Liquidated event, and a recent-liquidations feed with blocks-under-water.
  • Advanced details: contract excerpt and live predicates JSON.

Shared: extracted the Solidity/JSON highlighter from Race the Agent into components/CodeSnippet.tsx. Race the Agent now uses it; its output is unchanged.

Wiring: catalogue card, sitemap, metadata test, and a trackValidityLiquidation(attempt, status) analytics helper (row added to AGENTS.md). llms.txt / agents.md are regenerated in a separate commit (the post-commit hook isn't installed in my clone, so I ran npm run llms && npm run agents by hand with the external target).

Depends on base/vibenet#66 (VibeLend deploy in setup + borrower/keeper actors). #66 is merged and deployed: VibeLend is live at 0x8bC80e109f90426554C1c2fD24f0c0036d104Da4 and the host actors run the borrower and keeper roles. The UI computes the same address from the live USDV/pair.

Linear: CHAIN-5663 (parent CHAIN-5660)

Screenshots

Validity Transactions index: new Liquidations card
validity-index

Liquidations
validity-liquidations

Liquidations, dark mode, after a validity liquidation landed (1,250 VIBE earned)
liquidations-validity-win-dark

Liquidations: advanced details
liquidations-advanced

Race the Agent (shared CodeSnippet, no visual change intended)
validity-race-the-agent
race-the-agent-advanced

Test plan

  • npx tsc --noEmit -p . clean
  • npx vitest run app/vibenet: 278 pass. New: lib/lending.test.ts (price, health, liquidation-price math, predicate/slot encoding), liquidations/attempts.test.ts (nonce gating, under-water tracking and reset on recovery, reward totals), components/CodeSnippet.test.ts, sitemap/metadata entries
  • npx eslint app/vibenet/demos/validity: warnings only, no errors
  • npm run llms -- --check: current
  • Manually against live vibenet with the actors running: armed validity liquidations landed in the first block after the price crossed (e.g. block chore: ui tweaks #8,233,136, +1,250 VIBE), while the keeper's liquidations landed about 8–21 blocks after going under water. Expired and preempted attempts show as dropped. "Liquidate now" on a healthy position reverts onchain.

haardikk21 and others added 2 commits September 29, 2026 12:32
Borrowers hold VibeLend positions near their liquidation price and a rival
keeper liquidates with plain transactions. Users arm a validity liquidation
ahead of time, pinned to the pool reserve, the position slot, and an expiry
block, and compare how many blocks each side takes.

Also extracts the Solidity/JSON highlighter into a shared CodeSnippet used by
Race the Agent and Liquidations.

Co-authored-by: OpenCode <opencode-noreply@coinbase.com>
Co-authored-by: OpenCode <opencode-noreply@coinbase.com>
@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
omni-ui Ready Ready Preview Sep 29, 2026 4:35pm UTC

Request Review

@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

This branch was successfully deployed

1 active deployment
Preview — be4dc299 Deployed Sep 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants