# Removing Liquidity.

When removing liquidity from a pool, several things will happen [in this transaction](https://eigenphi.io/mev/eigentx/0x01e55eaf91125a5de871595e9601e49853efadf5f10c72fce7b64a443cc327e7?rankdir=LR). Remember, you are still the liquidity provider here. Let's use the above tables again for easier understanding.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FjgHHhGtWufifOQcPP3xE%2Fimage%20(42).png?alt=media&#x26;token=93c1fc2f-5e3a-4f8b-8569-c2844fb0a377" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FmgDiblvNZEeQRMHkqqwz%2Fimage.png?alt=media&#x26;token=f232463e-b86c-4e32-9dd6-f666c1a112e0" alt=""><figcaption></figcaption></figure>

* MOVE 1: Your exclusive shares of the pool in "virtualLiquidity-350101" will be burned to reflect your liquidity removal. This is a virtual shares "burn" operation added by EigenTx to indicate the internal accounting operation. Remember that we've added "minted," 2 virtual shares in the Adding Liquidity transaction.
* MOVE 2: The total shares of the pool will remove your shares from the total share "virtualLiquidity." This is also a virtual shares "burn" operation added by EigenTx to indicate the internal accounting operation.
* MOVE 3: The internal assets position data will remove your assets. Since we did not mint any virtual assets in the Adding Liquidity transaction, here we need to "mint" the virtual assets first. These are also "virtual" operations.

{% hint style="info" %}
The internal accounting processes of Uniswap and Bank are generally similar, with the difference being that, on Uniswap, after a user deposits money, their assets are mixed with others and follow the changes in currency holdings according to the AMM curve. Therefore, when depositing money, it is not necessary to record how much of each token has been deposited. When the liquidity is removed, Uniswap calculates the specific amount of tokens that can be taken out based on the provider's liquidity shares.
{% endhint %}

* MOVE 4: The removed virtual assets from the pool's internal assets positions will be added to your external position data, which are "mint" operations. These are also "virtual" operations.
* MOVE 5: Now, the pool's internal accounting operations have done the removal process. Then, the pool transfers the actual assets to you, including the liquidity fees you earn.
* MOVE 6: To keep the sheet balance, the internal and external position data need to "burn" the virtual assets. These are also "virtual" related operations.
* MOVE 7: In the end, the Position NFT will be burned to reflect the liquidity removal.

Now, let's look at [this actual liquidity removal transaction](https://bit.ly/43Q8MoP) step by step.

Here is the whole token flow chart.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FGj8VTi8WA85ZBnyu8267%2Fimage.png?alt=media&#x26;token=634886ba-cf0a-4ce6-abc8-1d4ede1610c2" alt=""><figcaption></figcaption></figure>

It is time to thoroughly break down the steps involved and match the abovementioned moves.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FSaqI9PBbVbdX1nYC5p96%2Fimage.png?alt=media&#x26;token=6d685549-7ee4-4c0b-a141-f88581c754b1" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FeMoZf743GPtEBp0K4eiL%2Fimage.png?alt=media&#x26;token=297e890c-f6b3-40ac-81b6-e45d618174eb" alt=""><figcaption></figcaption></figure>

Steps 0-1: The two virtual internal assets positions minted virtualOwed0WBTC and virtualOwed1USDC and sent to the actual total internal position contract. MOVE 3. These 2 steps are overlapped in the chart. But you can find the details in the transfer list shown below.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FKvB4wMo599IgPPM4HMjN%2Fimage.png?alt=media&#x26;token=fcb5750d-afa8-446e-8d84-c3ff9460f652" alt=""><figcaption></figcaption></figure>

Go to the next step.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FRfmwKI8tfPLMs2psS7Xx%2Fimage.png?alt=media&#x26;token=9492256e-5208-46ec-bb44-d957e58b38d9" alt=""><figcaption></figcaption></figure>

Step 2: The virtual total shares burned your shares. MOVE 2.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FeZ5oP0X03Oti4tc1Vvpz%2Fimage.png?alt=media&#x26;token=5f17ab1f-9547-4125-9642-fb632517916a" alt=""><figcaption></figcaption></figure>

Step 3: Your exclusive external virtual shares were burned. MOVE 1.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FpHA9h629exb5fxTdXBBR%2Fimage.png?alt=media&#x26;token=7438d803-bb46-43ca-b234-c55b81567046" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2F6ElRxq0H6TfL0wu4FT9e%2Fimage.png?alt=media&#x26;token=f62af8c7-6c0c-4b29-b828-fbf7cfbbf846" alt=""><figcaption></figcaption></figure>

Steps 4-5: The two virtual external assets positions minted virtualOwed0WBTC-350101 and virtualOwed1USDC-350101 and sent to the actual total internal position contract. MOVE 4.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2F1EV8otwBcRyHIh27DwBy%2Fimage.png?alt=media&#x26;token=a64e5cc0-2952-4f02-b8de-04ecb69e30f3" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FBFWqBPzQIK4LhK2I26KO%2Fimage.png?alt=media&#x26;token=cdbbe243-7b35-4776-b118-be0b8923d4c1" alt=""><figcaption></figcaption></figure>

Steps 6-7: The pool transferred your liquidity and fees you earned back to you. MOVE 5.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2Frg68qrxScXee2ZHx0K7u%2Fimage.png?alt=media&#x26;token=9d96a536-4b01-41d9-8b9e-0ba40b788b9e" alt=""><figcaption></figcaption></figure>

Steps 8-11: Now that both the internal and external representation of the liquidity provider account should have no balance. UNI-V3-POS and UNI-V3-POS-350101 burned the corresponding balances of virtual assets. MOVE 6.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2FYiMARVGAnoN16unXsbkh%2Fimage.png?alt=media&#x26;token=2b29fa50-9dac-4f3c-8c58-3e37cf93dee6" alt=""><figcaption></figcaption></figure>

Step 12: This matches the MOVE 7 that burned the position NFT to reflect the liquidity removal.

<figure><img src="https://2783121027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6mxU4QYtlg9O3vnppqQm%2Fuploads%2F62kjmeAaL9YFGSvnJGQR%2Fimage.png?alt=media&#x26;token=e704d93f-1bfc-4bcf-af42-55412034cfd2" alt=""><figcaption></figcaption></figure>

Step 13: The builder was paid.
