# Rebase

### Rebase Start

The rebase process begins with the deployer consuming the original info\_cell. In the data field of this cell, the xudt\_hash is replaced with the rebased\_xudt\_hash of the token to be rebased, and the mint\_status is changed from 1 to 2. Once the mint\_status becomes 2, the info\_cell is frozen.

* The rebased\_xudt\_hash is the type\_hash of the Inscription xUDT that is to be rebased.

```rust
Inscription type_script:
    code_hash: xUDT type_hash
    hash_type: type
    args: rebase_owner_script_hash

```

* &#x20;The rebase\_owner\_script is a virtual script that isn't actually used by any cell as a type or lock.

```rust
owner_script:
    code_hash: Rebase type_hash
    hash_type: type
    args: Inscription_Info type_hash (32bytes) + pre_xudt_hash (32 bytes) + actual_supply (uint128 16Bytes)
```

The pre\_xudt\_hash is the xUDT minted during the inscription, used to construct the rebased\_xudt\_hash. Update the info\_cell to start the rebase process.

### Rebase Mint

Each user must perform the rebase operation to exchange their tokens for new ones.

The construction of the rebase transaction is similar to minting, requiring cells with xudt, Inscription Info, Rebase codes as cell\_deps. Additionally, the cell containing the info must be included as a cell\_dep.

During rebase, like in minting, the virtual Owner\_script is filled in the designated Witness field.

The input is a certain amount of pre\_xudt, and the output is a certain amount of rebased\_xudt.

The quantity follows the formula: rebasedAmount = preAmount \* expectSupply / actualSupply. Due to precision issues in computation, the result should be rounded down.

* rebasedAmount: The amount of tokens minted in this rebase transaction.
* preAmount: The amount of original tokens destroyed in this rebase transaction.
* expectSupply: The expected total issuance.
* actualSupply: The total amount actually minted during the minting phase.

For example, if the expected issuance is 2,100,000,000,000,000 and the actual issuance is 3,158,000,000,000,000.

In a transaction destroying 20,000,000,000,

The amount of new inscription tokens rebased would be 20,000,000,000 \* 2,100,000,000,000,000 / 3,158,000,000,000,000 = 13,299,556,681.44395, but since it needs to be rounded down, the amount would be 13,299,556,681.


---

# Agent Instructions: 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:

```
GET https://docs.omiga.io/ckb-inscription/rebase.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
