VaultClient only ever mirrored vault.py/vault.rs's 2026-10-27 feature set
(positions/healthFactor/currentDebt/ltvBps/liquidationThresholdBps) — it
never picked up totalAssets/totalReserves/protocolReserves/borrowCap/
reserveFactorBps/totalLenderShares/lenderShares or the severity-scaled
liquidationBonusBpsFor the vault contract grew across later 2026-10-28/29
passes. apps/web's own /api/vault-position route already reads every one
of these fields to power the live LendCard/VaultCard UI, and
scripts/liquidation-bot-demo.mjs reimplements a raw eth_call for the
bonus instead of using the published SDK at all — a real third-party
integrator building a lending dashboard or liquidation bot off
@qie-forge/core had no way to read any of this.
- vault.ts: new getLiquidationBonusBps/getLenderShares/getPoolStats on
VaultClient, extending VAULT_ABI with the vault's real view functions.
- CLI: vault-position now prints liquidationBonusBps and a `pool` block
with the same stats, matching apps/web's route shape field-for-field.
- Core: 23/23 tests pass (was 20/20). CLI: 28/28 tests pass.
- Verified live against the real deployed demo vault behind
qie-forge.vercel.app (0xd49a...17be on the self-hosted anvil devnet,
addresses pulled via `vercel env pull` then deleted): the CLI's
totalAssets/totalDebtPrincipal/liquidationBonusBps exactly match a
direct curl against the production app's own /api/vault-position for
the same user, and the new fields (totalReserves, protocolReserves,
borrowCap=100000000000, reserveFactorBps=1000) are real on-chain reads
never exposed through the SDK/CLI before this.
Python and Rust SDKs both shipped VaultClient + AMM quote/route modules on
2026-10-27, mirroring @qie-forge/core's intended shape, but the actual
TypeScript core SDK never got them — leaving the one SDK the frontend and
CLI both depend on without any vault-position lookup or swap-quoting API.
- packages/core/src/vault.ts: read-only VaultClient (positions/healthFactor/
currentDebt/ltvBps/liquidationThresholdBps), field-for-field match of
vault.py/vault.rs.
- packages/core/src/amm.ts: getAmountOut/getAmountIn/quote pure math,
on-chain getReserves/getAmountsOut, and an unsigned
buildSwapExactTokensForTokensTx builder — mirrors amm.py/amm.rs.
- CLI: new `vault-position` and `amm-quote` commands built directly on
these, plus `--network demo` support (the only network with a real
deployment today).
Verified live against the real self-hosted demo chain backing
https://qie-forge.vercel.app (addresses pulled via `vercel env pull`):
- `amm-quote` for 1 WQIE -> TUSD returned 139579, exactly matching the live
production app's own `/api/quote` (on-chain router.getAmountsOut()) for
the same input.
- `vault-position` against the real deployed vault returned real
ltvBps=7500/liquidationThresholdBps=8000 and the correct "no position"
shape (healthFactor = uint256 max) for an address with none.
- 20/20 new+existing core unit tests, 28/28 CLI tests, 3/3 new live
integration tests (QIE_FORGE_RUN_LIVE_TESTS=1), full workspace
build+lint clean, apps/web Next.js build unaffected.
Found but out of scope (flagged, not fixed): packages/core/test/
oracle.live.test.ts's two mainnet assertions reference a non-existent
`result.rawPrice` field (the real field is `answer`) and have been
silently failing since the very first commit — a distinct, pre-existing
bug, left for a future pass per this repo's one-gap-per-pass discipline.
Closes the last genuinely-empty directory from the prior investigation
pass: packages/cli/test/ had zero files despite args.ts/index.ts having
real logic. Added 24 passing vitest tests (10 for parseArgs/requireFlag
edge cases, 14 for index.ts's command dispatch against a mocked
@qie-forge/core) and wired packages/cli into the workspace test/lint
scripts. Refactored run()/main() slightly so handler errors are caught
and turned into a proper exitCode in one place, making dispatch directly
testable without spawning the real CLI process.
Committed the previously-uncommitted TEST_LOCK serialization fix for
packages/rust/tests/anvil_integration.rs (closes a real resource-
contention flake between the two anvil-backed tests, confirmed passing
3x locally, 161-162s each run).
Corrected docs/STATUS.md: QieForgeVault.deposit()/withdraw() lender-share
accounting has existed since f55e3c6 (18 passing Foundry tests prove it),
but a stale "no lender deposit/withdraw flow" claim kept getting repeated
in STATUS.md and commit messages without re-reading the actual contract.
Removed the false gap, updated the real test counts (41/41 Foundry tests,
not 35/35), and documented the new CLI coverage.
Full workspace verification: npm test (33/33 JS tests), forge test
(41/41), cargo test --test anvil_integration (2/2), pytest (15/15, 8
live-gated skipped), npm run build + npm run lint (core+cli), and
`next build` for apps/web — all clean. Live-verified the already-shipped
demo deployment is still actually serving real data: curl against
qie-forge.vercel.app/api/quote and /api/vault-position return the real
on-chain quote (10 WQIE -> 1.39573 TUSD) and real vault position
(500,000 WQIE collateral, 20,000 TUSD debt, 2.8x health factor) described
in STATUS.md, and both /swap and /vault render the "demo network" banner
live, not the empty "not deployed" state.
Initial build for QIE Mainnet Hackathon 3.0 (DeFi & Financial
Infrastructure track). Includes:
- packages/contracts: constant-product AMM (factory/pair/router),
over-collateralized lending vault, and an oracle adapter wrapping
QIE's real deployed price-feed contracts. 25/25 Foundry tests pass
locally. Clean-room: no existing DEX/lending protocol source was
read or copied.
- packages/core: TypeScript SDK (viem-based) for QIE's chain, the
real (corrected) oracle ABI, a fail-closed QUSDC helper, a
Blockscout explorer client, and QIE Wallet connection constants.
Live-verified against real testnet (chain 1983) and mainnet
(chain 1990) RPCs and the real oracle contracts.
- packages/cli: a small CLI built on @qie-forge/core.
Real findings from building this, documented in README.md and
docs/STATUS.md: the previously-documented testnet RPC URL is dead
(replacement found and verified live); QIE's own oracle docs describe
a getPrice(string) function that reverts on the real deployed
contracts, which actually implement a Chainlink AggregatorV3-style
interface (verified live via raw eth_call); the oracle is deployed on
Mainnet only, not Testnet.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>