mirror of
https://github.com/fluencelabs/hackethberlin
synced 2025-04-24 17:02:18 +00:00
Formatting
This commit is contained in:
parent
3c0d3599d1
commit
8bc3f6c194
@ -4,6 +4,7 @@ import fluence.hackethberlin.types.DataVyper
|
||||
import shapeless.HList
|
||||
|
||||
class Contract[D <: HList](instructions: D)(implicit dv: DataVyper[D]) {
|
||||
|
||||
def toVyper: String =
|
||||
dv.toVyperDefinitions(instructions).mkString("\n")
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package fluence.hackethberlin.types
|
||||
|
||||
import fluence.hackethberlin.{FuncDef, types}
|
||||
import fluence.hackethberlin.{types, FuncDef}
|
||||
import shapeless._
|
||||
import shapeless.labelled.FieldType
|
||||
import shapeless.tag._
|
||||
@ -36,7 +36,8 @@ sealed trait LowPriorityDataVyperImplicits {
|
||||
data.toDataVyper :: Nil
|
||||
}
|
||||
|
||||
implicit def funcDefDataVyper[Args <: HList, Ret <: types.Type, Params <: HList]: DataVyper[FuncDef[Args, Ret, Params]] =
|
||||
implicit def funcDefDataVyper[Args <: HList, Ret <: types.Type, Params <: HList]
|
||||
: DataVyper[FuncDef[Args, Ret, Params]] =
|
||||
new DataVyper[FuncDef[Args, Ret, Params]] {
|
||||
override def toVyperDefinitions(func: FuncDef[Args, Ret, Params]): List[String] =
|
||||
func.toVyper :: Nil
|
||||
|
@ -48,12 +48,12 @@ object MakeVyperApp extends App {
|
||||
|
||||
val f = `@public` @:
|
||||
sumArgs.funcDef("sum", uint256) { args ⇒
|
||||
for {
|
||||
c ← 'c :=: `++`(args.ref('a), args.ref('b))
|
||||
d ← 'd :=: `++`(args.ref('b), c)
|
||||
sum ← `++`(args.ref('a), d).toReturn
|
||||
} yield sum
|
||||
}
|
||||
for {
|
||||
c ← 'c :=: `++`(args.ref('a), args.ref('b))
|
||||
d ← 'd :=: `++`(args.ref('b), c)
|
||||
sum ← `++`(args.ref('a), d).toReturn
|
||||
} yield sum
|
||||
}
|
||||
|
||||
val all = recordStruct :: data :: func :: f :: HNil
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user