Principles
Always simulate first (to catch reverts early), display oracle/guard errors clearly (many protocol reverts are intentional safety checks), and prefer SDK actions for consistency and ABI safety.Pattern (simulate → send → wait)
The SDK provides simulate-first helpers. You simulate viapublicClient, send via walletClient, then wait for confirmation.
Borrow flow checklist
A typical borrow flow is: ensure ERC1155 approval viasetApprovalForAll(coreAddress, true), deposit collateral with prepareCoreDeposit, borrow with prepareCoreBorrow, repay later with prepareCoreRepay (note the 1-minute repay delay), then withdraw with prepareCoreWithdraw.
Borrow: deposit collateral
Borrow: borrow
amount < MIN_BORROW or amount > maxBorrow. The pool must have enough available liquidity (reserve is excluded).
Borrow: repay
MIN_BORROW.
Lend: ERC4626 deposit
depositCap).
Approvals (one-time)
For approvals, ERC1155 collateral usessetApprovalForAll(coreAddress, true). ERC20 (USDC/USDT) uses approve(coreAddress, amount) for repay and approve(poolAddress, amount) for lending.