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