Class: Zilliqa::Util::Unit
- Inherits:
-
Object
- Object
- Zilliqa::Util::Unit
- Defined in:
- lib/zilliqa/util/unit.rb
Constant Summary collapse
- ZIL =
'zil'- LI =
'li'- QA =
'qa'
Class Method Summary collapse
Class Method Details
.from_qa(qa, unit, is_pack = false) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/zilliqa/util/unit.rb', line 8 def self.from_qa(qa, unit, is_pack = false) ret = case unit when ZIL qa / 1000000000000.0 when LI qa / 1000000.0 when QA qa end if is_pack ret.round else ret end end |
.to_qa(qa, unit) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/zilliqa/util/unit.rb', line 25 def self.to_qa(qa, unit) case unit when ZIL qa * 1000000000000 when LI qa * 1000000 when QA qa end end |