stellar / soroban-examples

Example Soroban Contracts
Apache License 2.0
65 stars 68 forks source link

Remove term U256 that refer to 32 byte arrays #61

Closed leighmcculloch closed 2 years ago

leighmcculloch commented 2 years ago

We intend the BigInt type would be used instead of u128, u256, etc integer types. The examples (and token contract) use the term U256 to refer to 32 byte arrays, which is confusing because these are not integer types and can't be used as such.

This has created some confusion.

We should reserve uN terms for integer types, and use BytesN<...> (or FixedBinary<...> in the current released SDK) for fixed bytes.

Related discussion: https://discord.com/channels/897514728459468821/966788672164855829/1007336560506699806

jonjove commented 2 years ago

I'm fine with moving away from U256/U512, although I do like the brevity of them. But my recollection from writing the token contract (which was a while ago at this point) was that one of the macros, possibly contractimpl, was broken by the generics. Obviously things have changed a lot since then and my memory could be wrong, but we should just confirm that it actually works now.

leighmcculloch commented 2 years ago

FixedBinary<...>/BytesN<...> should work now. I think I fixed that issue following your report.

sisuresh commented 2 years ago

Resolved by https://github.com/stellar/soroban-examples/pull/76