a repo for all things hex solidity / truffle development
this package is untested
need tests for all code (.sol
+ .js
)
use contracts/*
to test the contracts you plan to build on hex.
const { UNITS, fromHeart, toHeart, convert } = require('@hexcommunity/hex/utils')
an object with the units as keys and the factor (1e8) as values.
heart
microhex
millihex
hex
hectohex
kilohex
megahex
gigahex
terahex
convert any unit into any other unit returns a BN.js value
convert('heart', 200000000, 'hex') // 2<BN>
convert heart
unit to any other unit, default destination hex
fromHeart(200000000) // 2<BN>
fromHeart(200000000, 'hex') // 2<BN>
fromHeart(200000000, 'millihex') // 2000<BN>
convert from any other unit to heart
, default source hex
toHeart(2) // 200000000<BN>
toHeart(2, 'hex') // 200000000<BN>
toHeart(2000, 'millihex') // 200000000<BN>