module Plutarch.Builtin.Value (
PBuiltinValue (..),
pinsertCoin,
plookupCoin,
punionValue,
pvalueContains,
pvalueData,
punValueData,
pscaleValue,
) where
import GHC.Generics (Generic)
import Generics.SOP qualified as SOP
import Plutarch.Builtin.Bool (PBool)
import Plutarch.Builtin.ByteString (PByteString)
import Plutarch.Builtin.Data (PData)
import Plutarch.Builtin.Integer (PInteger)
import Plutarch.Builtin.Opaque (POpaque)
import Plutarch.Internal.Term (S, Term, punsafeBuiltin, (:-->))
import PlutusCore qualified as PLC
newtype PBuiltinValue (s :: S) = PBuiltinValue (Term s POpaque)
deriving stock
(
(forall x. PBuiltinValue s -> Rep (PBuiltinValue s) x)
-> (forall x. Rep (PBuiltinValue s) x -> PBuiltinValue s)
-> Generic (PBuiltinValue s)
forall x. Rep (PBuiltinValue s) x -> PBuiltinValue s
forall x. PBuiltinValue s -> Rep (PBuiltinValue s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PBuiltinValue s) x -> PBuiltinValue s
forall (s :: S) x. PBuiltinValue s -> Rep (PBuiltinValue s) x
$cfrom :: forall (s :: S) x. PBuiltinValue s -> Rep (PBuiltinValue s) x
from :: forall x. PBuiltinValue s -> Rep (PBuiltinValue s) x
$cto :: forall (s :: S) x. Rep (PBuiltinValue s) x -> PBuiltinValue s
to :: forall x. Rep (PBuiltinValue s) x -> PBuiltinValue s
Generic
)
deriving anyclass
(
All @[Type] (SListI @Type) (Code (PBuiltinValue s))
All @[Type] (SListI @Type) (Code (PBuiltinValue s)) =>
(PBuiltinValue s -> Rep (PBuiltinValue s))
-> (Rep (PBuiltinValue s) -> PBuiltinValue s)
-> Generic (PBuiltinValue s)
Rep (PBuiltinValue s) -> PBuiltinValue s
PBuiltinValue s -> Rep (PBuiltinValue s)
forall a.
All @[Type] (SListI @Type) (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S).
All @[Type] (SListI @Type) (Code (PBuiltinValue s))
forall (s :: S). Rep (PBuiltinValue s) -> PBuiltinValue s
forall (s :: S). PBuiltinValue s -> Rep (PBuiltinValue s)
$cfrom :: forall (s :: S). PBuiltinValue s -> Rep (PBuiltinValue s)
from :: PBuiltinValue s -> Rep (PBuiltinValue s)
$cto :: forall (s :: S). Rep (PBuiltinValue s) -> PBuiltinValue s
to :: Rep (PBuiltinValue s) -> PBuiltinValue s
SOP.Generic
)
pinsertCoin ::
forall (s :: S).
Term
s
( PByteString
:--> PByteString
:--> PInteger
:--> PBuiltinValue
:--> PBuiltinValue
)
pinsertCoin :: forall (s :: S).
Term
s
(PByteString
:--> (PByteString
:--> (PInteger :--> (PBuiltinValue :--> PBuiltinValue))))
pinsertCoin = DefaultFun
-> Term
s
(PByteString
:--> (PByteString
:--> (PInteger :--> (PBuiltinValue :--> PBuiltinValue))))
forall (s :: S) (a :: S -> Type). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.InsertCoin
plookupCoin ::
forall (s :: S).
Term
s
( PByteString
:--> PByteString
:--> PBuiltinValue
:--> PInteger
)
plookupCoin :: forall (s :: S).
Term
s
(PByteString :--> (PByteString :--> (PBuiltinValue :--> PInteger)))
plookupCoin = DefaultFun
-> Term
s
(PByteString :--> (PByteString :--> (PBuiltinValue :--> PInteger)))
forall (s :: S) (a :: S -> Type). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.LookupCoin
punionValue ::
forall (s :: S).
Term
s
( PBuiltinValue
:--> PBuiltinValue
:--> PBuiltinValue
)
punionValue :: forall (s :: S).
Term s (PBuiltinValue :--> (PBuiltinValue :--> PBuiltinValue))
punionValue = DefaultFun
-> Term s (PBuiltinValue :--> (PBuiltinValue :--> PBuiltinValue))
forall (s :: S) (a :: S -> Type). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.UnionValue
pvalueContains ::
forall (s :: S).
Term
s
( PBuiltinValue
:--> PBuiltinValue
:--> PBool
)
pvalueContains :: forall (s :: S).
Term s (PBuiltinValue :--> (PBuiltinValue :--> PBool))
pvalueContains = DefaultFun
-> Term s (PBuiltinValue :--> (PBuiltinValue :--> PBool))
forall (s :: S) (a :: S -> Type). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.ValueContains
pvalueData ::
forall (s :: S).
Term s (PBuiltinValue :--> PData)
pvalueData :: forall (s :: S). Term s (PBuiltinValue :--> PData)
pvalueData = DefaultFun -> Term s (PBuiltinValue :--> PData)
forall (s :: S) (a :: S -> Type). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.ValueData
punValueData ::
forall (s :: S).
Term s (PData :--> PBuiltinValue)
punValueData :: forall (s :: S). Term s (PData :--> PBuiltinValue)
punValueData = DefaultFun -> Term s (PData :--> PBuiltinValue)
forall (s :: S) (a :: S -> Type). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.UnValueData
pscaleValue ::
forall (s :: S).
Term s (PInteger :--> PBuiltinValue :--> PBuiltinValue)
pscaleValue :: forall (s :: S).
Term s (PInteger :--> (PBuiltinValue :--> PBuiltinValue))
pscaleValue = DefaultFun
-> Term s (PInteger :--> (PBuiltinValue :--> PBuiltinValue))
forall (s :: S) (a :: S -> Type). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.ScaleValue