Skip to content

Commit 4e29128

Browse files
committed
wip
1 parent 4aba9e6 commit 4e29128

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{-# LANGUAGE ScopedTypeVariables #-}
2+
{-# LANGUAGE UndecidableInstances #-}
3+
4+
module ErgoDex.PContracts.PStakingWithPkhLock (
5+
pkhLockStakingValidatorT
6+
) where
7+
8+
import Plutarch
9+
import Plutarch.Api.V2.Contexts
10+
import Plutarch.Prelude
11+
import Plutarch.Extra.TermCont
12+
import Plutarch.Api.V2 (PPubKeyHash)
13+
14+
import ErgoDex.PContracts.PApi (containsSignature)
15+
import PExtra.Monadic (tletField)
16+
17+
pkhLockStakingValidatorT :: Term s PPubKeyHash -> Term s (PData :--> PScriptContext :--> PBool)
18+
pkhLockStakingValidatorT authPkh = plam $ \_ ctx' -> unTermCont $ do
19+
ctx <- pletFieldsC @'["txInfo", "purpose"] ctx'
20+
let txInfo' = getField @"txInfo" ctx
21+
22+
sigs <- tletField @"signatories" txInfo'
23+
24+
pmatchC (getField @"purpose" ctx) >>= \case
25+
PRewarding _ -> pure $ containsSignature # sigs # authPkh
26+
PCertifying _ -> pure $ containsSignature # sigs # authPkh
27+
_ -> pure . pcon $ PFalse

0 commit comments

Comments
 (0)