how to write better code here?
According to Documentation.
Since a contract running on the chain will typically not be able to recover from panics, and error traces are not reported, it is useful not to bloat code size with them. Setting
panic=abortwill make it so that the compiler will generate simple
Wasmtraps on any panic that occurs. This option can be specified either in
.cargo/configas exemplified in counter/.cargo/config, or in the