# update IsolationMode debt

## Overview

<figure><img src="https://1829638638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0k7YXwFGMFZcsyqkM4q1%2Fuploads%2FYLfyJEi2Nv99n8CBOZwd%2Fimage.png?alt=media&#x26;token=9b5204d3-c965-4245-9cc5-f00f42155f62" alt=""><figcaption></figcaption></figure>

* [x] <mark style="color:orange;">cache</mark>
* [x] <mark style="color:orange;">updateState</mark>
* [x] getIsolationMode
* [x] validateBorrow
* [x] mint debt token
* [x] setBorrowing&#x20;
* [ ] update IsolationMode debt
* [ ] <mark style="color:orange;">updateInterestRates</mark>
* [ ] transfer underlying to user

<img src="https://1829638638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0k7YXwFGMFZcsyqkM4q1%2Fuploads%2FsntVDRFZHpAi6QJyPiDR%2Ffile.excalidraw.svg?alt=media&#x26;token=b874bf19-3563-4e32-a333-83d9bdf7b085" alt="" class="gitbook-drawing">

The bool `isolationModeAction` was retrieved earlier, from `getIsolationModeState`.&#x20;

If `isolationModeAction` is **`true`**, this implies that the incoming borrow action is an isolated borrow as well.&#x20;

* get current `isolationModeTotalDebt` (from `reservesData` mapping)
* increment it by the incoming stable debt amount
* assign the updated `isolationModeTotalDebt` to both:
  * `reservesData[...].isolationModeTotalDebt`
  * nextIsolationModeTotalDebt

<figure><img src="https://1829638638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0k7YXwFGMFZcsyqkM4q1%2Fuploads%2FIUYtnQKBs4tIfn0tPMGa%2Fimage.png?alt=media&#x26;token=5c6c5c25-e895-43c1-89ca-9437ef4d2bb4" alt=""><figcaption></figcaption></figure>

**On decimals:**

The amount is divided by $$10^{reserveDecimals}$$to standardise amount into the number of units of assets.

**I.e.**: amount (in wei)/  $$10^{reserveDecimals}$$ = amount (in units of asset)

{% hint style="info" %}

* 1 USDC = 1e6
* 1 Ether = 1e18
  {% endhint %}
