Decode the isolation debt ceiling in Aave v3 configuration

An isolated collateral reserve can be subject to a debt ceiling with its own decimal scale. Token decimals and debt ceiling decimals describe different quantities.

Read the ceiling using its protocol precision

Get the debt-ceiling field for the isolated collateral at the chosen block. In the reference v3 configuration the debt ceiling uses two decimal places. Decode the illustrative 125000 as 1250.00 in debt-ceiling accounting units.

DEBT_CEILING_DECIMALS = 2
encoded ceiling = 125000
represented ceiling = 1250.00 ceiling units

Compare isolationModeTotalDebt and the ceiling in the same scaled representation. If the total is 124900, the difference is 100 raw ceiling units, equivalent to 1.00 ceiling unit. It is not one hundred raw units of the collateral token.

Check eligible borrowed assets separately

Passing a numeric ceiling calculation alone does not establish borrow eligibility. The borrowed reserve must be enabled for isolation borrowing and other reserve and account rules still apply. Use deployment-specific logic for converting a proposed borrow into ceiling units. github.com ReserveConfiguration.sol