anyl-wallet icon indicating copy to clipboard operation
anyl-wallet copied to clipboard

eth unit converter

Open pcppcp opened this issue 6 years ago • 3 comments

We'll need a helper function that can convert between different ethereum units.

The function should take an uint256 as an input, and convert & format it to a desired unit type.

int eth_convert(const uint256_t *amount, enum unit from, enum unit to, char *buf, size_t buf_size);

example

>> eth_convert(0x2406d0096ba0007624, ETH_UNIT_WEI, ETH_UNIT_ETH, out, out_size);
>> print out
664.5736893707777777

pcppcp avatar Oct 23 '18 07:10 pcppcp

Hi @pcppcp I would like to implement the eth unit converter. I intend to put the function in `src/web3.h' and add unit tests.

mislavn avatar Dec 10 '18 17:12 mislavn

Hi @mislavn ! Feel free to take on the task, and whenever you are ready, please create a PR! If you have any questions regarding the build, our slack is a best place to ask.

pcppcp avatar Dec 10 '18 17:12 pcppcp

Hi @pcppcp, do you want me to do any other changes.

mislavn avatar Dec 18 '18 07:12 mislavn