From bb4b87eeb196000583ca924d6a0e99143a83cb8a Mon Sep 17 00:00:00 2001 From: Seungheon Oh Date: Mon, 25 Apr 2022 09:01:40 -0400 Subject: [PATCH] More comments --- agora/Agora/Effect.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/agora/Agora/Effect.hs b/agora/Agora/Effect.hs index db69492..3a3b1e9 100644 --- a/agora/Agora/Effect.hs +++ b/agora/Agora/Effect.hs @@ -33,17 +33,24 @@ makeEffect gatCs' f = ctx <- pletFields @'["txInfo", "purpose"] ctx' txInfo' <- plet ctx.txInfo + -- convert input datum, PData, into desierable type + -- the way this conversion is performed should be defined + -- by PTryFrom for each datum in effect script. (datum', _) <- ptryFrom @datum datum + -- ensure purpose is Spending. PSpending txOutRef <- pmatch $ pfromData ctx.purpose txOutRef' <- plet (pfield @"_0" # txOutRef) + -- fetch minted values to ensure single GAT is burned txInfo <- pletFields @'["mint"] txInfo' let mint :: Term _ PValue mint = txInfo.mint + -- fetch script context gatCs <- plet $ pconstant gatCs' passert "A single authority token has been burned" $ singleAuthorityTokenBurned gatCs txInfo' mint + -- run effect function f gatCs datum' txOutRef' txInfo'