> For the complete documentation index, see [llms.txt](https://docs.swaps.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.swaps.io/swaps.io-protocol/collateral/withdraw-collateral.md).

# Withdraw collateral

<figure><img src="https://791393967-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FP8QJmMsjTmJShevis2Qi%2Fuploads%2FtQaX4ggVvjVBE1jJWDe6%2Fimage_05.png?alt=media&amp;token=38c821c2-03f7-4dd0-8fb4-090fc7fcd360" alt=""><figcaption><p>Collateral withdraw overview</p></figcaption></figure>

This sequence of actions demonstrates how the Swaps.io system handles the withdrawal of collateral. It includes the preparation for the withdrawal, the withdrawal itself, and the verification of the withdrawal.

<figure><img src="https://791393967-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FP8QJmMsjTmJShevis2Qi%2Fuploads%2FfcTiyU4ZmzqWK6r59kYO%2Fimage_06.png?alt=media&amp;token=3e7a7384-d356-4e02-b2f2-57d2ad5184aa" alt=""><figcaption><p>Collateral withdraw process</p></figcaption></figure>

1. **Preparation**:
   1. `CollalteralManager` emits a `WithdrawReport` event, signaling that it is prepared for the withdrawal of collateral.
   2. The Intent Agent sends an unlocking transaction by calling the `reportWithdraw` method of the `CollalteralManager` contract in the receive chain to prepare a withdrawal.
   3. `CollalteralManager` increases the amount of locked collateral by the order amount. Locked collateral is the amount of collateral that is currently locked and cannot be used for other orders.
2. **Withdrawal**:
   1. The Intent Agent instructs the `CollateralManager` to withdraw collateral, calling method `withdraw` and providing `reportProof`.
   2. `CollateralManager` checks to make sure the amount being withdrawn does not exceed the amount of locked collateral. If it does, the withdrawal is rejected.
   3. `CollateralManager`, with the help of Light Clients, verifies the proof of the `Withdraw` event provided with `reportProof`. If the proof is falsified, the withdrawal is rejected.
   4. `CollateralManager` decreases the total amount of collateral to reflect the withdrawal and updates its own state to reflect the new total amount.
   5. `CollateralManager` emits a `Withdraw` event, signaling that the withdrawal of collateral has occurred.
