
Aave · Reads onchain state
Finds the E-Mode category an Aave market assigns a collateral and borrow asset pair. Membership lives on the category side of the pool: each category carries a bitmap of the reserves it accepts as collateral and a bitmap of those it lets a position borrow. The categories are scanned on-chain for every one whose bitmaps hold both reserves, and the id with the highest collateral LTV, the category built for the pair, comes back, so the same program lands in the right category for whatever assets reach it. Reach for it when the collateral arrives from an earlier step, like a Pendle market's PT, and coil the id into set E-Mode and the E-Mode config read, so the category stops being a number anyone types.
On other protocols · 1