feat: when statements with field access now work
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user