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.

Inscription type_script:
    code_hash: xUDT type_hash
    hash_type: type
    args: rebase_owner_script_hash
  • The rebase_owner_script is a virtual script that isn't actually used by any cell as a type or lock.

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.

Last updated