# Deposits & Withdrawals

### Deposits

<figure><img src="https://1682534360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1GIl7Nzo3MKxyhJH2XeT%2Fuploads%2Fw5nH0hSGGhKGv2AdyQpQ%2Fimage.png?alt=media&#x26;token=78db12fc-cf25-486b-8ac8-4b8af55bed11" alt=""><figcaption><p><strong>Figure 3. Deposit</strong> – steps to deposit funds within Lighthouse.</p></figcaption></figure>

1. **Deposit Tokens**: Searchers deposit tokens into the Lighthouse contract to fund bidding fees.
2. **Send `Deposited` Event:** The server receives the deposits instantly and updates the searcher balances, avoiding redundant on-chain queries.
3. **Submit Bid:** Searchers submit MEV bundles with a `BidMsg`; the server verifies that each bid is fully backed by the searcher’s deposit.
4. **Send Auction Closed Message**: The server informs the chain of auction close, triggering settlement. The server deducts the winning bid and distributes it between Lighthouse and the rollup per a predefined ratio.

***

### Withdrawals

<figure><img src="https://1682534360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1GIl7Nzo3MKxyhJH2XeT%2Fuploads%2FUyEVGWOVFB5k95KbAppm%2Fimage.png?alt=media&#x26;token=6c3747d3-6641-41a0-af05-ea0ca4082ab8" alt=""><figcaption><p><strong>Figure 4. Withdrawal</strong> – steps to withdraw funds within Lighthouse.</p></figcaption></figure>

1. **Reserve Withdrawal:** A searcher reserves a withdrawal first. This enforces a delay to prevent inconsistencies (e.g., using the same deposits simultaneously for a bid and a withdrawal).
2. **Send `WithdrawalReserved` Event:** Upon receiving the reservation event, the server marks the searcher as *ineligible to bid*. From this point, the searcher cannot submit bids.
3. **Withdraw:** After the withdrawal window opens, the searcher withdraws their funds from the contract.
4. **Send `Withdrew` Event:** The server detects withdrawal and updates the searcher’s deposit balance.
