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.
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.
- Rust
- Typescript (Node.js)
- Python
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Get the first foundry in the account's balance.
- Burn the foundry by calling the
Account.burn()
function.
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Get the first foundry in the account's balance.
- Prepare the transaction that will burn the tokens using the
Account.prepareDestroyFoundry()
function and send the prepared transaction using theAccount.send()
function.
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Get the first foundry in the account's balance.
- Prepare the transaction that will burn the tokens using the
Account.prepare_destroy_foundry()
function and send the prepared transaction using theAccount.send()
function.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
loading...
loading...
loading...
Expected Output
Foundries before destroying: 51
Transaction sent: 0xe0930e445aa9e78f59e3979744102bb0980fe6332950c7bb4785700dcb24fe8e
Block included: https://explorer.shimmer.network/testnet/block/0x31d08663ae1d175d798d0f2925f41fa97f0eee8f9e233a4f5dacedb1398ed544
Foundries after destroying: 50