This file is the canonical handoff context for future agents working on this repo.
The active runtime is a Hinkal-based browser WebCLI on Arbitrum.
- Private actions: shield, unshield, unshield-weth, private supply, private borrow, private repay, private withdraw.
- Withdraw currently returns to private balance by default.
- Fee reserve preflight guard is implemented for supply/withdraw/borrow/repay (USDC fee token).
- Withdraw auth secrets are currently stored locally in browser session.
- Borrow path is USDC collateral -> WETH debt (adapter allowlist controlled by
setBorrowTokenAllowed).
Railgun phase documents are historical context only.
.
├─ README.md
├─ AGENT.md
├─ docs/
│ ├─ hinkal-integration.md
│ └─ user-flows.md
├─ .cursor/
│ └─ rules/
├─ src/
│ ├─ webcli/
│ │ ├─ app.ts
│ │ ├─ entry.ts
│ │ ├─ polyfills.ts
│ │ ├─ runtime.ts
│ │ ├─ commandDispatcher.ts
│ │ ├─ constants.ts
│ │ ├─ amounts.ts
│ │ ├─ abis.ts
│ │ ├─ types.ts
│ │ └─ commands/
│ │ ├─ helpCommand.ts
│ │ ├─ accountCommands.ts
│ │ ├─ getStartedCommand.ts
│ │ ├─ getStartedForJudgesCommand.ts
│ │ └─ positionCommands.ts
│ └─ privacy/
│ ├─ constants.ts
│ ├─ privacySession.ts
│ ├─ hinkalManager.ts
│ └─ hinkal/
│ ├─ constants.ts
│ ├─ helpers.ts
│ ├─ ops.ts
│ └─ types.ts
├─ contracts/
│ ├─ PrivateSupplyAdapter.sol
│ ├─ VaultFactory.sol
│ ├─ UserVault.sol
│ ├─ test/PrivateSupplyAdapter.t.sol
│ └─ mocks/
│ ├─ MockAavePool.sol
│ ├─ MockPrivacyExecutor.sol
│ └─ MockUSDC.sol
└─ scripts/
├─ sanity-check-mainnet-config.sh
├─ deploy-contracts/
│ ├─ deploy-vault-factory.sh
│ └─ deploy-private-supply-adapter.sh
├─ smoke-tests/
│ ├─ smoke-test-supply-adapter.sh
│ ├─ smoke-test-withdraw-supply-adapter.sh
│ ├─ smoke-test-borrow-supply-adapter.sh
│ └─ smoke-test-repay-supply-adapter.sh
└─ contracts-verification/
├─ verify-vault-factory-blockscout.sh
└─ verify-private-supply-adapter-blockscout.sh
helpclearloginlogin-test [mnemonic]import <mnemonic>approve <amount>shield <amount>unshield <amount> [recipient]unshield-weth <amount> [recipient]private-balance [usdc|weth]private-supply <amount>supply-positionsprivate-borrow <positionId> <amount>private-repay <positionId> <amount>private-withdraw <positionId> <amount|max>
- Do not break
private-supplyflow unless explicitly requested. - Keep
private-withdrawprivate-destination semantics:
- adapter recipient is Emporium
- no public recipient address should be required in WebCLI
- Preserve per-position secret lifecycle:
- rotate on borrow/repay/partial-withdraw
- remove on full close
- Keep max-withdraw fallback retry for Aave rounding edge case (
0x47bc4b2c). - Do not edit
node_modules.
Hinkal fee is runtime-estimated, not fixed.
WebCLI guard:
- estimate
flatFeepreflight, - compute reserve with configured buffer,
- fail early with clear message if private balance is insufficient.
Env override:
VITE_PRIVATE_FEE_BUFFER_BPS(default2000)
WebCLI:
VITE_PRIVATE_EMPORIUMVITE_PRIVATE_RPCVITE_PRIVATE_NETWORKVITE_SUPPLY_TOKENVITE_BORROW_TOKEN_WETHVITE_PRIVATE_SUPPLY_ADAPTERVITE_PRIVATE_FEE_BUFFER_BPS(optional)VITE_PRIVATE_DEBUG(optional)VITE_LOGIN_TEST_MNEMONIC(optional)
Contracts/scripts:
PRIVATE_EMPORIUMRPC_URLDEPLOYER_PRIVATE_KEYAAVE_POOLSUPPLY_TOKENBORROW_TOKENVAULT_FACTORYPRIVATE_SUPPLY_ADAPTERBLOCKSCOUT_VERIFIER_URL(optional, default:https://arbitrum.blockscout.com/api/)
Insufficient funds
- private spendable cannot cover action amount + reserve.
- Adapter executor mismatch
- adapter
privacyExecutor()differs from configured Emporium.
- Borrow token disabled
- adapter
isBorrowTokenAllowed(BORROW_TOKEN)is false.
Transfer Failed
- token routing/allowance mismatch in adapter path.
- Use WebCLI flows for end-to-end checks.
- Validate after changes:
bun run typecheckbun run build:web
- Smoke scripts (
supply/borrow/repay) are cleanup-by-default:
- they return assets to deployer wallet unless
SMOKE_CLEANUP=false. - preserve
SMOKE_WITHDRAW_SECRET_LABELif cleanup is disabled. - scripts are under
scripts/smoke-tests/.
- Keep docs updated when behavior changes:
README.mdAGENT.mddocs/hinkal-integration.mddocs/user-flows.md.cursor/rules/*contracts/README.md