adaOf
encodes Lovelace/Ada ratio in phantom type Micro
adaOf :: Micro -> Ada
type Micro = Fixed E6
newtype Fixed (a :: k) = MkFixed Integer
Question: Being that the ratio is already encoded in the type, can I somehow get it, such that I can have a function that takes actual Ada
token quantity -- not Lovelace
quantity -- and gives back Ada
, without hardcoding?
f :: Integer -> Ada
f adaQty = Lovelace (1_000_000 * n) -- don't really want to do this
I actually found the constant in the plutus
repo:
lovelacePerAda = Constant 1000000