galleon-euler-lending
Euler V2 lending
Identify the account and vault
Resolve chain ID, owner, EVC subaccount, collateral vault, borrowing vault, amount/unit and requested operation. EulerEarn allocation vaults are a separate product. Use the current official @eulerxyz/euler-v2-sdk release and its deployment resolver; pin the tested version. Do not use the archived legacy Euler SDK or derive subaccount ownership from a ticker.
For a read-only TypeScript client built with buildEulerSDK, call accountService.fetchAccount(chainId, owner, { populateAll: true }) and vaultMetaService.fetchVault(chainId, vault). Inspect result and any failures; do not assume a populated account contains every subaccount. Fetch the selected subaccount explicitly through the version-matched service. Record enabled collateral, controller, debt, share balances, oracle unit, rate, cash, caps, hooks and current borrowing/liquidation LTVs.
Evaluate the requested change
- Keep collateral assets, vault shares and borrowed assets separate. Read conversions and accrued debt at one block; align oracle quotes to the liability's unit of account.
- Calculate current, proposed and stressed positions. Use each selected collateral's configured borrow LTV for new risk; liquidation LTV is a separate threshold. A high aggregate dollar value does not make an unenabled collateral usable.
- Inspect EVC account permissions and enabled controller. Adding an operator or switching controller changes authority or risk, so report the exact required change rather than silently enabling it.
- Use the SDK's documented plan method for the requested action, preserving all approval steps and EVC batch items. Simulate the complete plan with the exact account. A simulation using state overrides must disclose them; overridden balances or approvals are assumptions, not live prerequisites.
- Evaluate final batch state. Intermediate collateral/debt values can be transient because EVC defers checks; do not classify each call in isolation as a valid independently sendable action.
Worked decision
Synthetic collateral is worth 20,000 in the borrow vault's accounting unit. Its borrow LTV is 70%, liquidation LTV 80%, and accrued debt 13,000. A 2,000 borrow would exceed the 14,000 borrow capacity even though 15,000 remains below 16,000 liquidation capacity. Decline that requested size. A 20% collateral decline reduces liquidation capacity to 12,800, already below existing debt; flag the stress exposure independently of the failed new borrow.