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.
  1. Burn the foundry by calling the Account.burn() function.

Full Example Code


Expected Output

Foundries before destroying: 51
Transaction sent: 0xe0930e445aa9e78f59e3979744102bb0980fe6332950c7bb4785700dcb24fe8e
Block included:
Foundries after destroying: 50