Check if transaction is destroy asset in Teal ()
Yes, use the TEAL opcodes (txn / gtxn) to verify that the transactions has the format indicated in Structure - Algorand Developer Portal
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
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
Ok, i see it now. Sorry not sure how i didnt see that before…
