I’m trying to understand how data types work in Teal. As I see, Int is represented with big endian to uint64. For example, if my argument string is “1”,
btoi opcode converts it to 49.
The problem I faced is checking AssetID in the Smart Contract. From this example https://github.com/algorand/smart-contracts/blob/master/devrel/poi/poi.teal#L226, this code always fails:
Let’s say AssetID equals 1. It is first converted and saved in global storage, line 19:
byte "AssetID" txna ApplicationArgs 0 btoi app_global_put // Value 49
Later, it is retrieved and stored in scratch space on line 202:
// get asset id from global int 0 //current app byte "AssetID" app_global_get_ex bz failed // store assetid store 11
When it’s time to check AssetID, saved value doesn’t not equal to the value of
XferAsset opcode, which returns 1.
gtxn 1 XferAsset // 1 load 11 //49 ==
What is the solution here?