Why is the BASE_ASSET_ID
type B256
- and not U256
?
#82
Replies: 1 comment 4 replies
-
While it's true that the minus sign doesn't exist at the low level, it does exist at the level of abstraction of the numerical data types built on top of the low-level bits. At any rate, I realized that I haven't picked the most appropriate argument for the cause/to explain what I was suggesting. So, let me rephrase. Data types should be chosen for a reason/because they're suitable for the context. To me, an "unsigned" type sounds the most appropriate for our context of asset ids. At the same time, the For reference, here's the description of the |
Beta Was this translation helpful? Give feedback.
-
This discussion started as a private conversation between @PaulRBerg and me on Slack, and so, I'll translate & quote our initial replies here.
Iaro: "An argument for switching to
U256
is that it'd be, at least, weird to allow the smart contracts toMINT
assets having negative ids.The 2nd one is that it would simplify the work with "asset ids" and "asset amounts"(which are already of type
U256
) - and make the code more readable."Paul: "There's no such thing as "negative" numbers in programming, and they only "become" negative if they're interpreted as such (e.g. the two's complement system)"
Beta Was this translation helpful? Give feedback.
All reactions