tronprotocol-scala / scala-tron

Scala implementation of the Tron whitepaper
http://tronprotocol-scala.github.io/scala-tron/
GNU Lesser General Public License v3.0
15 stars 2 forks source link

DSL #27

Open Rovak opened 6 years ago

Rovak commented 6 years ago

Make a DSL similar to https://github.com/typelevel/squants

Prototype: https://scalafiddle.io/sf/wU5kTG8/3

Example

val bitcoins: Bitcoin = Satoshi(500000)
val satoshis: Satoshi = Bitcoin(2)

Bitcoin(2) == Satoshi(200000000)

val sum= Bitcoin(1) + Bitcoin(3)

val wallet = Wallet("0xjk234jlk234ljk234")
wallet send 1.bitcoin to "0xjkl345h43hjk2436kl"