> For the complete documentation index, see [llms.txt](https://learn.bluefin.io/bluefin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.bluefin.io/bluefin/bluefin-perps-exchange/migration-to-pro/final-withdrawal-from-legacy.md).

# Final Withdrawal from Legacy

### 📝 Manual Guide For Users with funds in the Legacy Exchange

This guide explains how users can manually withdraw their funds and close positions from Bluefin Legacy via **SuiScan**.

***

## 💰Withdraw Funds from Margin Bank

### 🪜 Step 1: Open the Legacy Perp Contract

1. Visit the following SuiScan link:

   <https://suiscan.xyz/mainnet/object/0xba8eab09ab60204ced2c129d3fd3a8a5fccc49272702ebbc965c69664dd1dcc9/contracts>
2. On the page, click on the **“Contracts”** tab.
3. Under the **“Margin Bank”** section, locate the `Withdraw_All_Margin_From_Bank` method in the right-hand sidebar.

<figure><img src="/files/4IISBkw8N6gjlWDp8WEi" alt=""><figcaption></figcaption></figure>

### 🪜 Step 2: Enter the Parameters

* **Type0:**

  ```
  0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN
  ```
* **Arg0:**

  ```
  0x39c65abefaee0a18ffa0e059a0074fcc9910216fa1a3550aa32c2e0ec1c03043
  ```
* **Arg1:**

  ```
  0x0331a962dd201b75c8af844fe2f90236b24e88fdb197599e98e400b0a9391939
  ```
* **Arg2:**

  ```
  Any random number or string
  ```
* **Arg3:**

  ```
  your wallet address
  ```

### 🪜 Step 3: Connect Your Wallet

1. Click **“Connect Wallet”** on SuiScan.
2. Approve the connection request in your wallet (e.g., Slush Wallet).

<figure><img src="/files/K5y7OLsxDafIfgVtJNy8" alt=""><figcaption></figcaption></figure>

### 🪜 Step 4: Execute the Withdrawal

1. After entering the correct parameters, click **“Execute”**.
2. A wallet popup will appear — review and **sign the transaction**.

### 🪜 Step 5: Approve the Transaction

* After reviewing, approve the transaction
* Once successful, the withdrawn amount (shown in the popup) will be transferred directly to your wallet.
* You’ll also see the **Transaction Digest** on the screen.
* use the link and view the transaction details on SuiScan.

{% hint style="info" %}
If you see the error `906` which implies Arg2 is already used, you need to add another unique random string.
{% endhint %}

***

✅ **You’ve successfully withdrawn your funds**

## 💰Close Your Position

### 🪜 Step 1: Open the Legacy Perp Contract

1. Visit the following SuiScan link:

   <https://suiscan.xyz/mainnet/object/0xba8eab09ab60204ced2c129d3fd3a8a5fccc49272702ebbc965c69664dd1dcc9/contracts>
2. On the page, click on the **“Contracts”** tab.
3. Under the **“Exchange”** section, locate the `Close Position` method in the right-hand sidebar.

<figure><img src="/files/T3ZCnkc9xKwt9CMkQUNK" alt=""><figcaption></figcaption></figure>

### 🪜 Step 2: Enter the Parameters

* **Type0:**

  ```
  0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN
  ```
* **Arg0:**

  ```
  copy the address from below for your chosen market.
  ```

  ```jsx
  ETH-PERP: 
  0x30b7baece69ecd1b1bea5c965f22e52ffbb3dd28b15b79449971945b2687fc35
  BTC-PERP:
  0x38d43822f621968460a642f47db2c5a20b3d59826c6dd34811c78ba3866cc2d1 
  SUI-PERP:
  0xdade62fa7a4b4f1eac97c76d61e70b68c91d3c60ce399c7f741dee43e8d93167
  SOL-PERP:
  0x876905808eefa9104ae3b569cd21d364346da791f1638aab5d4f89af53b8baec
  ARB-PERP:
  0x2da0b91d57ba9e0877ec0b93da18902e627be687e909df7c2e5111f3b34e27ab
  APT-PERP:
  0xd9a014692e3002d196107d5c58657c451ae7f8d00ebd61d45b71fd9a98cabff4
  AVAX-PERP:
  0x1563fe1b1eda2b2427fa33d683c60464cc3a8912c0f9a9836fb6c3fd30810d0e
  TIA-PERP:
  0x69021f4991ac18fdbfc6b07914835811236008a797a51a56a6948ff3474bc8f6
  MATIC-PERP:
  0x18a2f1a773b66b1d568cfa56cadbc9bfe91a1a16a09c7338897273a60a293a4b
  SEI-PERP:
  0xcf84b2b99a65fd595e8bf03a9dc16c7002533ebdbc3ad035f9863594a9b356a1
  SEND-PERP:
  0x321d8d207b14e265d112ece32dd70e3bf175bea3ac9e5c38a9e3e814678a17aa
  DEEP-PERP:
  0xd79e5e591f1ded21ed8c0e8b92c04f5d395043084c437c476b9726268766185
  BLUE-PERP:
  0x7838ad4ef9441f4c653553814417a8d940ff1044ee43b366aeb87946ff367f3b
  TRUMP-PERP:
  0x8995f3c1fcc449aabf9a4e71b97c6e2c3c8136cae205261b8f978bde60d0b006
  WAL-PERP:
  0xf31921507132c0dedf395c59cc089d36c07aa02719af3e96e16f596d17e3f37f
  ```
* **Arg1:**

  ```
  0x39c65abefaee0a18ffa0e059a0074fcc9910216fa1a3550aa32c2e0ec1c03043
  ```
* **Arg2:**

  ```
  0x0331a962dd201b75c8af844fe2f90236b24e88fdb197599e98e400b0a9391939
  ```
* **Arg3:**

  ```
  Any random number or string
  ```

### 🪜 Step 3: Connect Your Wallet

1. Click **“Connect Wallet”** on SuiScan.
2. Approve the connection request in your wallet (e.g., Slush Wallet).

<figure><img src="/files/jmZ1JHeuthQoJzuvJMxR" alt=""><figcaption></figcaption></figure>

### 🪜 Step 4: Execute

1. After entering the correct parameters, click **“Execute”**.
2. A wallet popup will appear — review and **sign the transaction**.

### 🪜 Step 5: Approve the Transaction

* After reviewing, approve the transaction
* Once successful, you’ll also see the **Transaction Digest** on the screen.
* use the link and view the transaction details on SuiScan.

{% hint style="info" %}
If you see the error `55` this implies you have pending funding on the position that must be paid
{% endhint %}

{% hint style="info" %}
If you see the error `invalid borrow, does not exist` this implies you have no open positions.
{% endhint %}

***

✅ **You’ve successfully closed your position**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.bluefin.io/bluefin/bluefin-perps-exchange/migration-to-pro/final-withdrawal-from-legacy.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
