feat: when statements with field access now work

This commit is contained in:
Kasey White
2022-11-16 04:29:50 -05:00
committed by Lucas
parent 8d1e73bbea
commit f10c78d800
3 changed files with 165 additions and 153 deletions

View File

@@ -7,8 +7,9 @@ pub type ScriptContext {
}
pub type Redeem {
Buy
Sell
Buy { tipo: ByteArray, fin: Int }
Sell { twice: ByteArray, find: Int }
Hold(Int)
}
pub type Datum {

View File

@@ -33,8 +33,10 @@ pub fn spend(
rdmr: Redeemer,
ctx: spend.ScriptContext,
) -> Bool {
let a = datum.fin
a
|> add_two
|> final_check
let x = datum.rdmr
when x is {
sample.Buy(tipo1, fin) -> fin > 0
sample.Sell(twice, find: fin) -> fin > 0
sample.Hold(some) -> some > 0
}
}