This forum is a read-only archive. Posting, replying and signing in are disabled.

Check if transaction is destroy asset in Teal ()

oabeleda

Hi,

Is it possible to check if the transaction is to destroy an asset in teal?

Thanks

✔ Solved by fabrice in post #4
oabeleda

Hi,

Yes I’ve look at this but its not clear to me how? There is not txn.type equal to destroy asset and i even look at the tealdbg gtxn/txn fields and im not finding anything obvious that tells me that is a destroy asset. Actually destroy asset looks like configure asset txn but nothing tells me that is a destroy asset txn…

Thanks

fabrice

As explained in Structure - Algorand Developer Portal, the type is the same as for creation/re-configuration except asset parameters are empty.

I have not reviewed the code below and I cannot guarantee its security, but here is something that may work:

txn TypeEnum
int acfg
==
assert

txn ConfigAsset
int 42 // assuming the asset ID is 42
==
assert

// Check all managers are empty which indicates a
// transaction destroying the asset
txn ConfigAssetManager
global ZeroAddress
==
assert

txn ConfigAssetReserve
global ZeroAddress
==
assert

txn ConfigAssetFreeze
global ZeroAddress
==
assert

txn ConfigAssetClawback
global ZeroAddress
==
assert
✔ Solution