File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
cardano-dex-contracts-onchain/ErgoDex/PContracts Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments