Skip to main content

Destroy a Foundry

If at any point you want to disable the production of your native token, you should destroy the foundry. However, you can only destroy a foundry output as long as its circulating native token supply is zero.

Destroying Foundry

A foundry can only be destroyed (and its storage deposit be claimed) if the circulating supply is zero. Therefore if you control the foundry and want to destroy it in the future, you should consider melting your native tokens instead of burning them.

Example Code

Before you run the example, you should make sure the first foundry on your account has zero circulating supply. If you have no available foundries, you can create one by creating a native token. If you've already created your tokens but need to empty the foundry, you can decrease your native token supply by melting them.

  1. Instantiate a Wallet, get Alice's Account which was created in the first guide and sync it.
  2. Get the first foundry in the account's balance.
sdk/examples/how_tos/native_tokens/destroy_foundry.rs
loading...
  1. Burn the foundry by calling the Account.burn() function.
sdk/examples/how_tos/native_tokens/destroy_foundry.rs
loading...

Full Example Code

sdk/examples/how_tos/native_tokens/destroy_foundry.rs
loading...

Expected Output

Foundries before destroying: 51
Transaction sent: 0xe0930e445aa9e78f59e3979744102bb0980fe6332950c7bb4785700dcb24fe8e
Block included: https://explorer.shimmer.network/testnet/block/0x31d08663ae1d175d798d0f2925f41fa97f0eee8f9e233a4f5dacedb1398ed544
Foundries after destroying: 50