3

This is possible, but not advised. If you do this, you should cast the int32 to an int256 in order to be explicit. int32 a = 1; int256 b = 3; int256 c = int256(a) + b; However, using types smaller than 32 bytes may actually be more expensive than using types that are 32 bytes exactly (such as int256, uint256, etc.). The reason for this is that the EVM ...


3

You are using soliditySha3, which produces a 256-bit (32 bytes) hash, because of that your code works with bytes32. As you can see in the docs, the output of soliditySha3 is something like the following, with a length of 66, 64 without 0x. Check that one byte corresponds to two chars, so the result is 32 bytes. var x = web3.utils.soliditySha3('234'); // ...


2

This is a library for organizing an unordered key set with delete capability. https://github.com/rob-Hitchens/UnorderedKeySet It is an implementation of the Mapped Structs with Delete-enabled Index technique in the SE page Richard linked to. The library deals with the keys only. Store structs in a mapping to handle additional fields. Hope it helps.


1

Tight packing of storage variables is not unique to structs. From the Solidity documentation on the layout of state variables in storage: Statically-sized variables (everything except mapping and dynamically-sized array types) are laid out contiguously in storage starting from position 0. Multiple, contiguous items that need less than 32 bytes are packed ...


1

Your input is not ABI encoded. The correct ABI encoding of those values is as follows: 0xff00000000000000000000000000000000000000000000000000000000000000ffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000006bc84f6a0fabbd7102be338c048fe0ae54948c2e0000000000000000000000006bc84f6a0fabbd7102be338c048fe0ae54948c2e In ABI ...


1

You may use fixed point math library such as ABDK Math 64.64. It has method divi that divides one integer by another and returns the result as binary fixed point number with 64 binary digits after dot.


Only top voted, non community-wiki answers of a minimum length are eligible