Skip to content

HexCommunity/hex

Repository files navigation

HEX

a repo for all things hex solidity / truffle development

WARNING

this package is untested

need tests for all code (.sol + .js)

contracts

use contracts/* to test the contracts you plan to build on hex.

utils

const { UNITS, fromHeart, toHeart, convert } = require('@hexcommunity/hex/utils')

UNITS

an object with the units as keys and the factor (1e8) as values.

heart
microhex
millihex
hex
hectohex
kilohex
megahex
gigahex
terahex

convert

convert any unit into any other unit returns a BN.js value

convert('heart', 200000000, 'hex') // 2<BN>

fromHeart

convert heart unit to any other unit, default destination hex

fromHeart(200000000)             // 2<BN>
fromHeart(200000000, 'hex')      // 2<BN>
fromHeart(200000000, 'millihex') // 2000<BN>

toHeart

convert from any other unit to heart, default source hex

toHeart(2)                // 200000000<BN>
toHeart(2, 'hex')         // 200000000<BN>
toHeart(2000, 'millihex') // 200000000<BN>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published