Do ASAs created in the group have consecutive IDs?

Since applications have a max of 64 slots for global storage, I was imagining how smart contracts can efficiently store multiple asset IDs for later reference in the application code.

Perhaps there is a better way to do this than storing the ID of every individual asset and using precious global storage space.

Is it possible send a transaction group of 15 asset config transactions and to store only the ID of the first asset in global storage? Is this behavior “guaranteed” and/or would it be considered bad practice? Or are there smarter ways to compact data?

While it is true that currently you would get consecutive IDs, I would strongly recommend NOT to rely on this. This behavior is not guaranteed in the future.

Note that if you use variables of type []byte instead of uint, then you have 128 bytes of storage for both the value and the key. If the key is 8 bytes, you can store 120/8 = 15 uint64 inside, that is 15 ASA ID per state variable.

1 Like