class Zilliqa::Util::Unit

Constants

LI
QA
ZIL

Public Class Methods

from_qa(qa, unit, is_pack = false) click to toggle source
# 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) click to toggle source
# 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