In the movescription contract, locking and returning SUI is a crucial aspect, especially in the process of minting, managing, and burning (Movescription). Let's analyze the security of the SUI you pay during the process of minting an inscription.
Movescription is minted, a certain amount of SUI fee is charged. This fee is encapsulated in the balance of the Movescription object. The relevant code for this process can be found in the do_mint function, where the minting fee (fee_coin) is converted into a balance (fee_balance) and stored in the Movescription object.public fun do_mint(
tick_record: &mut TickRecord,
fee_coin: Coin<SUI>,
clk: &Clock,
ctx: &mut TxContext
) {
// Code omitted for brevity
}
Movescription struct includes a field called acc of type Balance<SUI>. This field holds the locked SUI balance associated with the inscription.struct Movescription has key, store {
// ... other fields ...
acc: Balance<SUI>,
// ... other fields ...
}
acc field of the Movescription. This is evident in the do_mint function, where fee_balance is the result of processing fee_coin.burn function allows users to burn an inscription. When this happens, any locked SUI associated with the inscription should be returned to the user.public entry fun burn(
tick_record: &mut TickRecord,
inscription: Movescription,
ctx: &mut TxContext
) {
// Code omitted for brevity
}
do_burn function, the acc balance of the inscription is converted back into a Coin<SUI> object. This is done using the coin::from_balance<SUI> function, effectively unlocking the SUI and making it available for transfer.public fun do_burn(
tick_record: &mut TickRecord,
inscription: Movescription,
ctx: &mut TxContext
) : Coin<SUI> {
// Code omitted for brevity
}
burn function uses transfer::public_transfer to send the unlocked SUI back to the user (sender) who initiated the burn transaction.In the Movescription contract, SUI is locked as a fee during the minting process and stored in the balance field of the Movescription struct. When an inscription is burned, the locked SUI is converted back into a Coin<SUI> and returned to the user. This mechanism ensures that SUI is securely locked during inscription minting and can be retrieved by the user (sender) at any time by burning the inscription.