{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-specialise #-}
{-# OPTIONS_GHC -Wno-simplifiable-class-constraints #-}
{-# OPTIONS_GHC -fno-omit-interface-pragmas #-}
module PlutusLedgerApi.V1.DCert
( DCert(..)
) where
import Control.DeepSeq (NFData)
import GHC.Generics (Generic)
import PlutusLedgerApi.V1.Credential (StakingCredential)
import PlutusLedgerApi.V1.Crypto (PubKeyHash)
import PlutusTx qualified
import PlutusTx.Prelude qualified as P
import Prettyprinter.Extras
data DCert
= DCertDelegRegKey StakingCredential
| DCertDelegDeRegKey StakingCredential
| DCertDelegDelegate
StakingCredential
PubKeyHash
|
DCertPoolRegister
PubKeyHash
PubKeyHash
|
DCertPoolRetire PubKeyHash Integer
|
DCertGenesis
|
DCertMir
deriving stock (DCert -> DCert -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DCert -> DCert -> Bool
$c/= :: DCert -> DCert -> Bool
== :: DCert -> DCert -> Bool
$c== :: DCert -> DCert -> Bool
Eq, Eq DCert
DCert -> DCert -> Bool
DCert -> DCert -> Ordering
DCert -> DCert -> DCert
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DCert -> DCert -> DCert
$cmin :: DCert -> DCert -> DCert
max :: DCert -> DCert -> DCert
$cmax :: DCert -> DCert -> DCert
>= :: DCert -> DCert -> Bool
$c>= :: DCert -> DCert -> Bool
> :: DCert -> DCert -> Bool
$c> :: DCert -> DCert -> Bool
<= :: DCert -> DCert -> Bool
$c<= :: DCert -> DCert -> Bool
< :: DCert -> DCert -> Bool
$c< :: DCert -> DCert -> Bool
compare :: DCert -> DCert -> Ordering
$ccompare :: DCert -> DCert -> Ordering
Ord, Int -> DCert -> ShowS
[DCert] -> ShowS
DCert -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DCert] -> ShowS
$cshowList :: [DCert] -> ShowS
show :: DCert -> String
$cshow :: DCert -> String
showsPrec :: Int -> DCert -> ShowS
$cshowsPrec :: Int -> DCert -> ShowS
Show, forall x. Rep DCert x -> DCert
forall x. DCert -> Rep DCert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DCert x -> DCert
$cfrom :: forall x. DCert -> Rep DCert x
Generic)
deriving anyclass (DCert -> ()
forall a. (a -> ()) -> NFData a
rnf :: DCert -> ()
$crnf :: DCert -> ()
NFData)
deriving forall ann. [DCert] -> Doc ann
forall ann. DCert -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [DCert] -> Doc ann
$cprettyList :: forall ann. [DCert] -> Doc ann
pretty :: forall ann. DCert -> Doc ann
$cpretty :: forall ann. DCert -> Doc ann
Pretty via (PrettyShow DCert)
instance P.Eq DCert where
{-# INLINABLE (==) #-}
DCertDelegRegKey StakingCredential
sc == :: DCert -> DCert -> Bool
== DCertDelegRegKey StakingCredential
sc' = StakingCredential
sc forall a. Eq a => a -> a -> Bool
P.== StakingCredential
sc'
DCertDelegDeRegKey StakingCredential
sc == DCertDelegDeRegKey StakingCredential
sc' = StakingCredential
sc forall a. Eq a => a -> a -> Bool
P.== StakingCredential
sc'
DCertDelegDelegate StakingCredential
sc PubKeyHash
pkh == DCertDelegDelegate StakingCredential
sc' PubKeyHash
pkh' = StakingCredential
sc forall a. Eq a => a -> a -> Bool
P.== StakingCredential
sc' Bool -> Bool -> Bool
&& PubKeyHash
pkh forall a. Eq a => a -> a -> Bool
P.== PubKeyHash
pkh'
DCertPoolRegister PubKeyHash
pid PubKeyHash
pvfr == DCertPoolRegister PubKeyHash
pid' PubKeyHash
pvfr' = PubKeyHash
pid forall a. Eq a => a -> a -> Bool
P.== PubKeyHash
pid' Bool -> Bool -> Bool
&& PubKeyHash
pvfr forall a. Eq a => a -> a -> Bool
P.== PubKeyHash
pvfr'
DCertPoolRetire PubKeyHash
pkh Integer
i == DCertPoolRetire PubKeyHash
pkh' Integer
i' = PubKeyHash
pkh forall a. Eq a => a -> a -> Bool
P.== PubKeyHash
pkh' Bool -> Bool -> Bool
&& Integer
i forall a. Eq a => a -> a -> Bool
P.== Integer
i'
DCert
DCertGenesis == DCert
DCertGenesis = Bool
True
DCert
DCertMir == DCert
DCertMir = Bool
True
DCert
_ == DCert
_ = Bool
False
PlutusTx.makeIsDataIndexed
''DCert
[ ('DCertDelegRegKey,0)
, ('DCertDelegDeRegKey,1)
, ('DCertDelegDelegate,2)
, ('DCertPoolRegister,3)
, ('DCertPoolRetire,4)
, ('DCertGenesis,5)
, ('DCertMir,6)
]
PlutusTx.makeLift ''DCert