qie-forge/apps/web/.env.example
caelum0x 36ee94e427 fix: close a real lender-share donation/inflation exploit, ship vault borrow/repay/supply UI, fix wallet chain-ID + stale demo oracle
Found by actually using the live site and testing against the real deployed
demo contract, not just reading code:

- QieForgeVault.deposit() minted a first lender's shares against their own
  amount alone, ignoring any totalAssets() already in the vault before
  totalLenderShares existed -- exactly the state DeployDemo.s.sol's own
  seeding pattern creates. Reproduced live: a 1,000 TUSD first deposit into
  the pre-funded demo vault minted shares worth 501,000 TUSD (100% of
  totalAssets, including 500,000 pre-funded liquidity + 20,000 outstanding
  debt) -- the textbook ERC4626 donation/inflation attack, no mitigation
  unlike QieForgePair's MINIMUM_LIQUIDITY burn. Fixed with an equivalent
  MINIMUM_LENDER_SHARES floor locked on first deposit into a non-pristine
  vault; forge test 41/41 -> 43/43 with two new regression tests; re-verified
  live against a freshly redeployed demo stack (same documented 500,000/
  20,000/2.8x numbers) that the same attack now round-trips exactly.
- SwapCard/VaultCard's own "Connect Wallet" buttons hardcoded chainId 1983
  (QIE Testnet) regardless of the actually configured network, so a real
  wallet user on the live demo (chain 31337) would connect to the wrong
  chain. Fixed to derive chainId from getNetworkConfig(), same pattern the
  header's WalletConnectButton already used correctly.
- The live demo oracle's mock price feed staleness window (1 hour) had
  elapsed since deploy, so borrow()/healthFactor() were reverting for
  everyone including the documented demo position. Fixed live via
  setMaxStaleness() and in DeployDemo.s.sol for future redeploys.

Shipped the actual missing feature that prompted this pass: /vault only
ever exposed depositCollateral() in the UI, never borrow/repay/withdraw-
collateral or the lender deposit()/withdraw() that have existed in the
contract and SDKs since f55e3c6. Added those to VaultCard plus a new
LendCard (supply/withdraw liquidity, live pool stats), a shared
erc20Actions.ts approve-then-send helper, and verified every new handler's
exact encoding against the live redeployed contract with cast send/call.

Also fixed infra: the self-hosted demo RPC's Caddy site had silently
dropped out of sites-enabled a second time (not in the box's managed
caddy/sites/ dir or CADDY_SITES) -- added it for real this time in the
infra-box repo instead of hand-copying into /etc/caddy/ again.
2026-10-28 21:12:06 +03:00

26 lines
1.2 KiB
Plaintext

# Which QIE network this frontend points at.
NEXT_PUBLIC_QIE_FORGE_NETWORK=testnet
# Optional RPC override (defaults to the real, verified endpoint for the network above).
NEXT_PUBLIC_QIE_FORGE_RPC_URL=
# Deployed contract addresses. Left unset until a real on-chain deployment
# exists (blocked on a funded deployer wallet — see docs/STATUS.md). The UI
# shows an honest "not deployed yet" state when these are empty, rather
# than pointing at a placeholder address.
NEXT_PUBLIC_QIE_FORGE_FACTORY_ADDRESS=
NEXT_PUBLIC_QIE_FORGE_ROUTER_ADDRESS=
NEXT_PUBLIC_QIE_FORGE_VAULT_ADDRESS=
NEXT_PUBLIC_QIE_FORGE_VAULT_COLLATERAL_ADDRESS=
NEXT_PUBLIC_QIE_FORGE_VAULT_COLLATERAL_DECIMALS=18
NEXT_PUBLIC_QIE_FORGE_VAULT_COLLATERAL_SYMBOL=
# The vault's borrow/quote asset — the one borrowers draw down and lenders
# supply via deposit()/withdraw() (see components/LendCard.tsx). Left unset
# until deployed; the borrow/repay and lender-supply UI stay disabled
# without it, same fail-closed posture as every other address here.
NEXT_PUBLIC_QIE_FORGE_VAULT_BORROW_ADDRESS=
NEXT_PUBLIC_QIE_FORGE_VAULT_BORROW_DECIMALS=18
NEXT_PUBLIC_QIE_FORGE_VAULT_BORROW_SYMBOL=
# Comma-separated SYMBOL:address:decimals list for the swap token picker.
NEXT_PUBLIC_QIE_FORGE_SWAP_TOKENS=