{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -fno-omit-interface-pragmas #-}
{-# OPTIONS_GHC -fno-spec-constr #-}
{-# OPTIONS_GHC -fno-specialise #-}
{-# OPTIONS_GHC -fexpose-all-unfoldings #-}
module PlutusLedgerApi.V1.Value (
CurrencySymbol(..)
, currencySymbol
, adaSymbol
, TokenName(..)
, tokenName
, toString
, adaToken
, AssetClass(..)
, assetClass
, assetClassValue
, assetClassValueOf
, Value(..)
, singleton
, valueOf
, withCurrencySymbol
, currencySymbolValueOf
, lovelaceValue
, lovelaceValueOf
, scale
, symbols
, geq
, gt
, leq
, lt
, isZero
, split
, unionWith
, flattenValue
, Lovelace (..)
) where
import Prelude qualified as Haskell
import Control.DeepSeq (NFData)
import Data.ByteString qualified as BS
import Data.Data (Data, Typeable)
import Data.Function ((&))
import Data.String (IsString (fromString))
import Data.Text (Text)
import Data.Text qualified as Text
import Data.Text.Encoding qualified as E
import GHC.Generics (Generic)
import PlutusLedgerApi.V1.Bytes (LedgerBytes (LedgerBytes), encodeByteString)
import PlutusTx qualified
import PlutusTx.AssocMap (Map)
import PlutusTx.AssocMap qualified as Map
import PlutusTx.Blueprint (emptySchemaInfo)
import PlutusTx.Blueprint.Class (HasBlueprintSchema (..))
import PlutusTx.Blueprint.Definition (HasBlueprintDefinition (..), definitionIdFromType,
definitionRef)
import PlutusTx.Blueprint.Schema (MapSchema (..), PairSchema (..), Schema (..), emptyIntegerSchema,
withSchemaInfo)
import PlutusTx.Blueprint.Schema.Annotation (SchemaInfo (..))
import PlutusTx.Lift (makeLift)
import PlutusTx.List qualified
import PlutusTx.Ord qualified as Ord
import PlutusTx.Prelude as PlutusTx hiding (sort)
import PlutusTx.Show qualified as PlutusTx
import PlutusTx.These (These (..))
import Prettyprinter (Pretty, (<>))
import Prettyprinter.Extras (PrettyShow (PrettyShow))
newtype CurrencySymbol = CurrencySymbol {CurrencySymbol -> BuiltinByteString
unCurrencySymbol :: PlutusTx.BuiltinByteString}
deriving stock ((forall x. CurrencySymbol -> Rep CurrencySymbol x)
-> (forall x. Rep CurrencySymbol x -> CurrencySymbol)
-> Generic CurrencySymbol
forall x. Rep CurrencySymbol x -> CurrencySymbol
forall x. CurrencySymbol -> Rep CurrencySymbol x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CurrencySymbol -> Rep CurrencySymbol x
from :: forall x. CurrencySymbol -> Rep CurrencySymbol x
$cto :: forall x. Rep CurrencySymbol x -> CurrencySymbol
to :: forall x. Rep CurrencySymbol x -> CurrencySymbol
Generic, Typeable CurrencySymbol
Typeable CurrencySymbol =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CurrencySymbol -> c CurrencySymbol)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CurrencySymbol)
-> (CurrencySymbol -> Constr)
-> (CurrencySymbol -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CurrencySymbol))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CurrencySymbol))
-> ((forall b. Data b => b -> b)
-> CurrencySymbol -> CurrencySymbol)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CurrencySymbol -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CurrencySymbol -> r)
-> (forall u.
(forall d. Data d => d -> u) -> CurrencySymbol -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> CurrencySymbol -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol)
-> Data CurrencySymbol
CurrencySymbol -> Constr
CurrencySymbol -> DataType
(forall b. Data b => b -> b) -> CurrencySymbol -> CurrencySymbol
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> CurrencySymbol -> u
forall u. (forall d. Data d => d -> u) -> CurrencySymbol -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CurrencySymbol -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CurrencySymbol -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CurrencySymbol
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CurrencySymbol -> c CurrencySymbol
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CurrencySymbol)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CurrencySymbol)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CurrencySymbol -> c CurrencySymbol
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CurrencySymbol -> c CurrencySymbol
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CurrencySymbol
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CurrencySymbol
$ctoConstr :: CurrencySymbol -> Constr
toConstr :: CurrencySymbol -> Constr
$cdataTypeOf :: CurrencySymbol -> DataType
dataTypeOf :: CurrencySymbol -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CurrencySymbol)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CurrencySymbol)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CurrencySymbol)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CurrencySymbol)
$cgmapT :: (forall b. Data b => b -> b) -> CurrencySymbol -> CurrencySymbol
gmapT :: (forall b. Data b => b -> b) -> CurrencySymbol -> CurrencySymbol
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CurrencySymbol -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CurrencySymbol -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CurrencySymbol -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CurrencySymbol -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CurrencySymbol -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CurrencySymbol -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> CurrencySymbol -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> CurrencySymbol -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CurrencySymbol -> m CurrencySymbol
Data)
deriving anyclass (CurrencySymbol -> ()
(CurrencySymbol -> ()) -> NFData CurrencySymbol
forall a. (a -> ()) -> NFData a
$crnf :: CurrencySymbol -> ()
rnf :: CurrencySymbol -> ()
NFData, DefinitionId
DefinitionId -> HasBlueprintDefinition CurrencySymbol
forall t. DefinitionId -> HasBlueprintDefinition t
$cdefinitionId :: DefinitionId
definitionId :: DefinitionId
HasBlueprintDefinition)
deriving newtype
( CurrencySymbol -> CurrencySymbol -> Bool
(CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> Bool) -> Eq CurrencySymbol
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CurrencySymbol -> CurrencySymbol -> Bool
== :: CurrencySymbol -> CurrencySymbol -> Bool
$c/= :: CurrencySymbol -> CurrencySymbol -> Bool
/= :: CurrencySymbol -> CurrencySymbol -> Bool
Haskell.Eq
, Eq CurrencySymbol
Eq CurrencySymbol =>
(CurrencySymbol -> CurrencySymbol -> Ordering)
-> (CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> CurrencySymbol)
-> (CurrencySymbol -> CurrencySymbol -> CurrencySymbol)
-> Ord CurrencySymbol
CurrencySymbol -> CurrencySymbol -> Bool
CurrencySymbol -> CurrencySymbol -> Ordering
CurrencySymbol -> CurrencySymbol -> CurrencySymbol
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
$ccompare :: CurrencySymbol -> CurrencySymbol -> Ordering
compare :: CurrencySymbol -> CurrencySymbol -> Ordering
$c< :: CurrencySymbol -> CurrencySymbol -> Bool
< :: CurrencySymbol -> CurrencySymbol -> Bool
$c<= :: CurrencySymbol -> CurrencySymbol -> Bool
<= :: CurrencySymbol -> CurrencySymbol -> Bool
$c> :: CurrencySymbol -> CurrencySymbol -> Bool
> :: CurrencySymbol -> CurrencySymbol -> Bool
$c>= :: CurrencySymbol -> CurrencySymbol -> Bool
>= :: CurrencySymbol -> CurrencySymbol -> Bool
$cmax :: CurrencySymbol -> CurrencySymbol -> CurrencySymbol
max :: CurrencySymbol -> CurrencySymbol -> CurrencySymbol
$cmin :: CurrencySymbol -> CurrencySymbol -> CurrencySymbol
min :: CurrencySymbol -> CurrencySymbol -> CurrencySymbol
Haskell.Ord
, CurrencySymbol -> CurrencySymbol -> Bool
(CurrencySymbol -> CurrencySymbol -> Bool) -> Eq CurrencySymbol
forall a. (a -> a -> Bool) -> Eq a
$c== :: CurrencySymbol -> CurrencySymbol -> Bool
== :: CurrencySymbol -> CurrencySymbol -> Bool
Eq
, Eq CurrencySymbol
Eq CurrencySymbol =>
(CurrencySymbol -> CurrencySymbol -> Ordering)
-> (CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> Bool)
-> (CurrencySymbol -> CurrencySymbol -> CurrencySymbol)
-> (CurrencySymbol -> CurrencySymbol -> CurrencySymbol)
-> Ord CurrencySymbol
CurrencySymbol -> CurrencySymbol -> Bool
CurrencySymbol -> CurrencySymbol -> Ordering
CurrencySymbol -> CurrencySymbol -> CurrencySymbol
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
$ccompare :: CurrencySymbol -> CurrencySymbol -> Ordering
compare :: CurrencySymbol -> CurrencySymbol -> Ordering
$c< :: CurrencySymbol -> CurrencySymbol -> Bool
< :: CurrencySymbol -> CurrencySymbol -> Bool
$c<= :: CurrencySymbol -> CurrencySymbol -> Bool
<= :: CurrencySymbol -> CurrencySymbol -> Bool
$c> :: CurrencySymbol -> CurrencySymbol -> Bool
> :: CurrencySymbol -> CurrencySymbol -> Bool
$c>= :: CurrencySymbol -> CurrencySymbol -> Bool
>= :: CurrencySymbol -> CurrencySymbol -> Bool
$cmax :: CurrencySymbol -> CurrencySymbol -> CurrencySymbol
max :: CurrencySymbol -> CurrencySymbol -> CurrencySymbol
$cmin :: CurrencySymbol -> CurrencySymbol -> CurrencySymbol
min :: CurrencySymbol -> CurrencySymbol -> CurrencySymbol
Ord
, CurrencySymbol -> BuiltinData
(CurrencySymbol -> BuiltinData) -> ToData CurrencySymbol
forall a. (a -> BuiltinData) -> ToData a
$ctoBuiltinData :: CurrencySymbol -> BuiltinData
toBuiltinData :: CurrencySymbol -> BuiltinData
PlutusTx.ToData
, BuiltinData -> Maybe CurrencySymbol
(BuiltinData -> Maybe CurrencySymbol) -> FromData CurrencySymbol
forall a. (BuiltinData -> Maybe a) -> FromData a
$cfromBuiltinData :: BuiltinData -> Maybe CurrencySymbol
fromBuiltinData :: BuiltinData -> Maybe CurrencySymbol
PlutusTx.FromData
, BuiltinData -> CurrencySymbol
(BuiltinData -> CurrencySymbol) -> UnsafeFromData CurrencySymbol
forall a. (BuiltinData -> a) -> UnsafeFromData a
$cunsafeFromBuiltinData :: BuiltinData -> CurrencySymbol
unsafeFromBuiltinData :: BuiltinData -> CurrencySymbol
PlutusTx.UnsafeFromData
)
deriving
(
String -> CurrencySymbol
(String -> CurrencySymbol) -> IsString CurrencySymbol
forall a. (String -> a) -> IsString a
$cfromString :: String -> CurrencySymbol
fromString :: String -> CurrencySymbol
IsString
,
Int -> CurrencySymbol -> ShowS
[CurrencySymbol] -> ShowS
CurrencySymbol -> String
(Int -> CurrencySymbol -> ShowS)
-> (CurrencySymbol -> String)
-> ([CurrencySymbol] -> ShowS)
-> Show CurrencySymbol
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CurrencySymbol -> ShowS
showsPrec :: Int -> CurrencySymbol -> ShowS
$cshow :: CurrencySymbol -> String
show :: CurrencySymbol -> String
$cshowList :: [CurrencySymbol] -> ShowS
showList :: [CurrencySymbol] -> ShowS
Haskell.Show
,
(forall ann. CurrencySymbol -> Doc ann)
-> (forall ann. [CurrencySymbol] -> Doc ann)
-> Pretty CurrencySymbol
forall ann. [CurrencySymbol] -> Doc ann
forall ann. CurrencySymbol -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. CurrencySymbol -> Doc ann
pretty :: forall ann. CurrencySymbol -> Doc ann
$cprettyList :: forall ann. [CurrencySymbol] -> Doc ann
prettyList :: forall ann. [CurrencySymbol] -> Doc ann
Pretty
)
via LedgerBytes
instance HasBlueprintSchema CurrencySymbol referencedTypes where
{-# INLINABLE schema #-}
schema :: Schema referencedTypes
schema = forall t (referencedTypes :: [*]).
HasBlueprintSchema t referencedTypes =>
Schema referencedTypes
schema @PlutusTx.BuiltinByteString
Schema referencedTypes
-> (Schema referencedTypes -> Schema referencedTypes)
-> Schema referencedTypes
forall a b. a -> (a -> b) -> b
& (SchemaInfo -> SchemaInfo)
-> Schema referencedTypes -> Schema referencedTypes
forall (referencedTypes :: [*]).
(SchemaInfo -> SchemaInfo)
-> Schema referencedTypes -> Schema referencedTypes
withSchemaInfo \SchemaInfo
info ->
SchemaInfo
info { title = Just "CurrencySymbol" }
currencySymbol :: BS.ByteString -> CurrencySymbol
currencySymbol :: ByteString -> CurrencySymbol
currencySymbol = BuiltinByteString -> CurrencySymbol
CurrencySymbol (BuiltinByteString -> CurrencySymbol)
-> (ByteString -> BuiltinByteString)
-> ByteString
-> CurrencySymbol
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> BuiltinByteString
ByteString -> ToBuiltin ByteString
forall a. HasToBuiltin a => a -> ToBuiltin a
PlutusTx.toBuiltin
{-# INLINABLE currencySymbol #-}
newtype TokenName = TokenName {TokenName -> BuiltinByteString
unTokenName :: PlutusTx.BuiltinByteString}
deriving stock ((forall x. TokenName -> Rep TokenName x)
-> (forall x. Rep TokenName x -> TokenName) -> Generic TokenName
forall x. Rep TokenName x -> TokenName
forall x. TokenName -> Rep TokenName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TokenName -> Rep TokenName x
from :: forall x. TokenName -> Rep TokenName x
$cto :: forall x. Rep TokenName x -> TokenName
to :: forall x. Rep TokenName x -> TokenName
Generic, Typeable TokenName
Typeable TokenName =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TokenName -> c TokenName)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TokenName)
-> (TokenName -> Constr)
-> (TokenName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TokenName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokenName))
-> ((forall b. Data b => b -> b) -> TokenName -> TokenName)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TokenName -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TokenName -> r)
-> (forall u. (forall d. Data d => d -> u) -> TokenName -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> TokenName -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName)
-> Data TokenName
TokenName -> Constr
TokenName -> DataType
(forall b. Data b => b -> b) -> TokenName -> TokenName
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TokenName -> u
forall u. (forall d. Data d => d -> u) -> TokenName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TokenName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TokenName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TokenName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TokenName -> c TokenName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TokenName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokenName)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TokenName -> c TokenName
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TokenName -> c TokenName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TokenName
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TokenName
$ctoConstr :: TokenName -> Constr
toConstr :: TokenName -> Constr
$cdataTypeOf :: TokenName -> DataType
dataTypeOf :: TokenName -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TokenName)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TokenName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokenName)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokenName)
$cgmapT :: (forall b. Data b => b -> b) -> TokenName -> TokenName
gmapT :: (forall b. Data b => b -> b) -> TokenName -> TokenName
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TokenName -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TokenName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TokenName -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TokenName -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TokenName -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> TokenName -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TokenName -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TokenName -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TokenName -> m TokenName
Data)
deriving newtype
( TokenName -> TokenName -> Bool
(TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> Bool) -> Eq TokenName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TokenName -> TokenName -> Bool
== :: TokenName -> TokenName -> Bool
$c/= :: TokenName -> TokenName -> Bool
/= :: TokenName -> TokenName -> Bool
Haskell.Eq
, Eq TokenName
Eq TokenName =>
(TokenName -> TokenName -> Ordering)
-> (TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> TokenName)
-> (TokenName -> TokenName -> TokenName)
-> Ord TokenName
TokenName -> TokenName -> Bool
TokenName -> TokenName -> Ordering
TokenName -> TokenName -> TokenName
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
$ccompare :: TokenName -> TokenName -> Ordering
compare :: TokenName -> TokenName -> Ordering
$c< :: TokenName -> TokenName -> Bool
< :: TokenName -> TokenName -> Bool
$c<= :: TokenName -> TokenName -> Bool
<= :: TokenName -> TokenName -> Bool
$c> :: TokenName -> TokenName -> Bool
> :: TokenName -> TokenName -> Bool
$c>= :: TokenName -> TokenName -> Bool
>= :: TokenName -> TokenName -> Bool
$cmax :: TokenName -> TokenName -> TokenName
max :: TokenName -> TokenName -> TokenName
$cmin :: TokenName -> TokenName -> TokenName
min :: TokenName -> TokenName -> TokenName
Haskell.Ord
, TokenName -> TokenName -> Bool
(TokenName -> TokenName -> Bool) -> Eq TokenName
forall a. (a -> a -> Bool) -> Eq a
$c== :: TokenName -> TokenName -> Bool
== :: TokenName -> TokenName -> Bool
Eq
, Eq TokenName
Eq TokenName =>
(TokenName -> TokenName -> Ordering)
-> (TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> Bool)
-> (TokenName -> TokenName -> TokenName)
-> (TokenName -> TokenName -> TokenName)
-> Ord TokenName
TokenName -> TokenName -> Bool
TokenName -> TokenName -> Ordering
TokenName -> TokenName -> TokenName
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
$ccompare :: TokenName -> TokenName -> Ordering
compare :: TokenName -> TokenName -> Ordering
$c< :: TokenName -> TokenName -> Bool
< :: TokenName -> TokenName -> Bool
$c<= :: TokenName -> TokenName -> Bool
<= :: TokenName -> TokenName -> Bool
$c> :: TokenName -> TokenName -> Bool
> :: TokenName -> TokenName -> Bool
$c>= :: TokenName -> TokenName -> Bool
>= :: TokenName -> TokenName -> Bool
$cmax :: TokenName -> TokenName -> TokenName
max :: TokenName -> TokenName -> TokenName
$cmin :: TokenName -> TokenName -> TokenName
min :: TokenName -> TokenName -> TokenName
Ord
, TokenName -> BuiltinData
(TokenName -> BuiltinData) -> ToData TokenName
forall a. (a -> BuiltinData) -> ToData a
$ctoBuiltinData :: TokenName -> BuiltinData
toBuiltinData :: TokenName -> BuiltinData
PlutusTx.ToData
, BuiltinData -> Maybe TokenName
(BuiltinData -> Maybe TokenName) -> FromData TokenName
forall a. (BuiltinData -> Maybe a) -> FromData a
$cfromBuiltinData :: BuiltinData -> Maybe TokenName
fromBuiltinData :: BuiltinData -> Maybe TokenName
PlutusTx.FromData
, BuiltinData -> TokenName
(BuiltinData -> TokenName) -> UnsafeFromData TokenName
forall a. (BuiltinData -> a) -> UnsafeFromData a
$cunsafeFromBuiltinData :: BuiltinData -> TokenName
unsafeFromBuiltinData :: BuiltinData -> TokenName
PlutusTx.UnsafeFromData
)
deriving anyclass (TokenName -> ()
(TokenName -> ()) -> NFData TokenName
forall a. (a -> ()) -> NFData a
$crnf :: TokenName -> ()
rnf :: TokenName -> ()
NFData, DefinitionId
DefinitionId -> HasBlueprintDefinition TokenName
forall t. DefinitionId -> HasBlueprintDefinition t
$cdefinitionId :: DefinitionId
definitionId :: DefinitionId
HasBlueprintDefinition)
deriving ((forall ann. TokenName -> Doc ann)
-> (forall ann. [TokenName] -> Doc ann) -> Pretty TokenName
forall ann. [TokenName] -> Doc ann
forall ann. TokenName -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. TokenName -> Doc ann
pretty :: forall ann. TokenName -> Doc ann
$cprettyList :: forall ann. [TokenName] -> Doc ann
prettyList :: forall ann. [TokenName] -> Doc ann
Pretty) via (PrettyShow TokenName)
instance IsString TokenName where
fromString :: String -> TokenName
fromString = Text -> TokenName
fromText (Text -> TokenName) -> (String -> Text) -> String -> TokenName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
Text.pack
instance HasBlueprintSchema TokenName referencedTypes where
{-# INLINABLE schema #-}
schema :: Schema referencedTypes
schema = forall t (referencedTypes :: [*]).
HasBlueprintSchema t referencedTypes =>
Schema referencedTypes
schema @PlutusTx.BuiltinByteString
Schema referencedTypes
-> (Schema referencedTypes -> Schema referencedTypes)
-> Schema referencedTypes
forall a b. a -> (a -> b) -> b
& (SchemaInfo -> SchemaInfo)
-> Schema referencedTypes -> Schema referencedTypes
forall (referencedTypes :: [*]).
(SchemaInfo -> SchemaInfo)
-> Schema referencedTypes -> Schema referencedTypes
withSchemaInfo \SchemaInfo
info ->
SchemaInfo
info { title = Just "TokenName" }
tokenName :: BS.ByteString -> TokenName
tokenName :: ByteString -> TokenName
tokenName = BuiltinByteString -> TokenName
TokenName (BuiltinByteString -> TokenName)
-> (ByteString -> BuiltinByteString) -> ByteString -> TokenName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> BuiltinByteString
ByteString -> ToBuiltin ByteString
forall a. HasToBuiltin a => a -> ToBuiltin a
PlutusTx.toBuiltin
{-# INLINABLE tokenName #-}
fromText :: Text -> TokenName
fromText :: Text -> TokenName
fromText = ByteString -> TokenName
tokenName (ByteString -> TokenName)
-> (Text -> ByteString) -> Text -> TokenName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
E.encodeUtf8
fromTokenName :: (BS.ByteString -> r) -> (Text -> r) -> TokenName -> r
fromTokenName :: forall r. (ByteString -> r) -> (Text -> r) -> TokenName -> r
fromTokenName ByteString -> r
handleBytestring Text -> r
handleText (TokenName BuiltinByteString
bs) = (UnicodeException -> r)
-> (Text -> r) -> Either UnicodeException Text -> r
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (\UnicodeException
_ -> ByteString -> r
handleBytestring (ByteString -> r) -> ByteString -> r
forall a b. (a -> b) -> a -> b
$ BuiltinByteString -> FromBuiltin BuiltinByteString
forall arep. HasFromBuiltin arep => arep -> FromBuiltin arep
PlutusTx.fromBuiltin BuiltinByteString
bs) Text -> r
handleText (Either UnicodeException Text -> r)
-> Either UnicodeException Text -> r
forall a b. (a -> b) -> a -> b
$ ByteString -> Either UnicodeException Text
E.decodeUtf8' (BuiltinByteString -> FromBuiltin BuiltinByteString
forall arep. HasFromBuiltin arep => arep -> FromBuiltin arep
PlutusTx.fromBuiltin BuiltinByteString
bs)
asBase16 :: BS.ByteString -> Text
asBase16 :: ByteString -> Text
asBase16 ByteString
bs = [Text] -> Text
Text.concat [Text
"0x", ByteString -> Text
encodeByteString ByteString
bs]
quoted :: Text -> Text
quoted :: Text -> Text
quoted Text
s = [Text] -> Text
Text.concat [Text
"\"", Text
s, Text
"\""]
toString :: TokenName -> Haskell.String
toString :: TokenName -> String
toString = Text -> String
Text.unpack (Text -> String) -> (TokenName -> Text) -> TokenName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ByteString -> Text) -> (Text -> Text) -> TokenName -> Text
forall r. (ByteString -> r) -> (Text -> r) -> TokenName -> r
fromTokenName ByteString -> Text
asBase16 Text -> Text
forall a. a -> a
id
instance Haskell.Show TokenName where
show :: TokenName -> String
show = Text -> String
Text.unpack (Text -> String) -> (TokenName -> Text) -> TokenName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ByteString -> Text) -> (Text -> Text) -> TokenName -> Text
forall r. (ByteString -> r) -> (Text -> r) -> TokenName -> r
fromTokenName ByteString -> Text
asBase16 Text -> Text
quoted
adaSymbol :: CurrencySymbol
adaSymbol :: CurrencySymbol
adaSymbol = BuiltinByteString -> CurrencySymbol
CurrencySymbol BuiltinByteString
emptyByteString
{-# INLINABLE adaSymbol #-}
adaToken :: TokenName
adaToken :: TokenName
adaToken = BuiltinByteString -> TokenName
TokenName BuiltinByteString
emptyByteString
{-# INLINABLE adaToken #-}
newtype AssetClass = AssetClass {AssetClass -> (CurrencySymbol, TokenName)
unAssetClass :: (CurrencySymbol, TokenName)}
deriving stock ((forall x. AssetClass -> Rep AssetClass x)
-> (forall x. Rep AssetClass x -> AssetClass) -> Generic AssetClass
forall x. Rep AssetClass x -> AssetClass
forall x. AssetClass -> Rep AssetClass x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetClass -> Rep AssetClass x
from :: forall x. AssetClass -> Rep AssetClass x
$cto :: forall x. Rep AssetClass x -> AssetClass
to :: forall x. Rep AssetClass x -> AssetClass
Generic, Typeable AssetClass
Typeable AssetClass =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AssetClass -> c AssetClass)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AssetClass)
-> (AssetClass -> Constr)
-> (AssetClass -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AssetClass))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AssetClass))
-> ((forall b. Data b => b -> b) -> AssetClass -> AssetClass)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AssetClass -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AssetClass -> r)
-> (forall u. (forall d. Data d => d -> u) -> AssetClass -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> AssetClass -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass)
-> Data AssetClass
AssetClass -> Constr
AssetClass -> DataType
(forall b. Data b => b -> b) -> AssetClass -> AssetClass
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> AssetClass -> u
forall u. (forall d. Data d => d -> u) -> AssetClass -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AssetClass -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AssetClass -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AssetClass
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AssetClass -> c AssetClass
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AssetClass)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AssetClass)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AssetClass -> c AssetClass
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AssetClass -> c AssetClass
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AssetClass
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AssetClass
$ctoConstr :: AssetClass -> Constr
toConstr :: AssetClass -> Constr
$cdataTypeOf :: AssetClass -> DataType
dataTypeOf :: AssetClass -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AssetClass)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AssetClass)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AssetClass)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AssetClass)
$cgmapT :: (forall b. Data b => b -> b) -> AssetClass -> AssetClass
gmapT :: (forall b. Data b => b -> b) -> AssetClass -> AssetClass
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AssetClass -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AssetClass -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AssetClass -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AssetClass -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> AssetClass -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> AssetClass -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AssetClass -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AssetClass -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AssetClass -> m AssetClass
Data)
deriving newtype
( AssetClass -> AssetClass -> Bool
(AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> Bool) -> Eq AssetClass
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetClass -> AssetClass -> Bool
== :: AssetClass -> AssetClass -> Bool
$c/= :: AssetClass -> AssetClass -> Bool
/= :: AssetClass -> AssetClass -> Bool
Haskell.Eq
, Eq AssetClass
Eq AssetClass =>
(AssetClass -> AssetClass -> Ordering)
-> (AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> AssetClass)
-> (AssetClass -> AssetClass -> AssetClass)
-> Ord AssetClass
AssetClass -> AssetClass -> Bool
AssetClass -> AssetClass -> Ordering
AssetClass -> AssetClass -> AssetClass
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
$ccompare :: AssetClass -> AssetClass -> Ordering
compare :: AssetClass -> AssetClass -> Ordering
$c< :: AssetClass -> AssetClass -> Bool
< :: AssetClass -> AssetClass -> Bool
$c<= :: AssetClass -> AssetClass -> Bool
<= :: AssetClass -> AssetClass -> Bool
$c> :: AssetClass -> AssetClass -> Bool
> :: AssetClass -> AssetClass -> Bool
$c>= :: AssetClass -> AssetClass -> Bool
>= :: AssetClass -> AssetClass -> Bool
$cmax :: AssetClass -> AssetClass -> AssetClass
max :: AssetClass -> AssetClass -> AssetClass
$cmin :: AssetClass -> AssetClass -> AssetClass
min :: AssetClass -> AssetClass -> AssetClass
Haskell.Ord
, Int -> AssetClass -> ShowS
[AssetClass] -> ShowS
AssetClass -> String
(Int -> AssetClass -> ShowS)
-> (AssetClass -> String)
-> ([AssetClass] -> ShowS)
-> Show AssetClass
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetClass -> ShowS
showsPrec :: Int -> AssetClass -> ShowS
$cshow :: AssetClass -> String
show :: AssetClass -> String
$cshowList :: [AssetClass] -> ShowS
showList :: [AssetClass] -> ShowS
Haskell.Show
, AssetClass -> AssetClass -> Bool
(AssetClass -> AssetClass -> Bool) -> Eq AssetClass
forall a. (a -> a -> Bool) -> Eq a
$c== :: AssetClass -> AssetClass -> Bool
== :: AssetClass -> AssetClass -> Bool
Eq
, Eq AssetClass
Eq AssetClass =>
(AssetClass -> AssetClass -> Ordering)
-> (AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> Bool)
-> (AssetClass -> AssetClass -> AssetClass)
-> (AssetClass -> AssetClass -> AssetClass)
-> Ord AssetClass
AssetClass -> AssetClass -> Bool
AssetClass -> AssetClass -> Ordering
AssetClass -> AssetClass -> AssetClass
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
$ccompare :: AssetClass -> AssetClass -> Ordering
compare :: AssetClass -> AssetClass -> Ordering
$c< :: AssetClass -> AssetClass -> Bool
< :: AssetClass -> AssetClass -> Bool
$c<= :: AssetClass -> AssetClass -> Bool
<= :: AssetClass -> AssetClass -> Bool
$c> :: AssetClass -> AssetClass -> Bool
> :: AssetClass -> AssetClass -> Bool
$c>= :: AssetClass -> AssetClass -> Bool
>= :: AssetClass -> AssetClass -> Bool
$cmax :: AssetClass -> AssetClass -> AssetClass
max :: AssetClass -> AssetClass -> AssetClass
$cmin :: AssetClass -> AssetClass -> AssetClass
min :: AssetClass -> AssetClass -> AssetClass
Ord
, AssetClass -> BuiltinData
(AssetClass -> BuiltinData) -> ToData AssetClass
forall a. (a -> BuiltinData) -> ToData a
$ctoBuiltinData :: AssetClass -> BuiltinData
toBuiltinData :: AssetClass -> BuiltinData
PlutusTx.ToData
, BuiltinData -> Maybe AssetClass
(BuiltinData -> Maybe AssetClass) -> FromData AssetClass
forall a. (BuiltinData -> Maybe a) -> FromData a
$cfromBuiltinData :: BuiltinData -> Maybe AssetClass
fromBuiltinData :: BuiltinData -> Maybe AssetClass
PlutusTx.FromData
, BuiltinData -> AssetClass
(BuiltinData -> AssetClass) -> UnsafeFromData AssetClass
forall a. (BuiltinData -> a) -> UnsafeFromData a
$cunsafeFromBuiltinData :: BuiltinData -> AssetClass
unsafeFromBuiltinData :: BuiltinData -> AssetClass
PlutusTx.UnsafeFromData
)
deriving anyclass (AssetClass -> ()
(AssetClass -> ()) -> NFData AssetClass
forall a. (a -> ()) -> NFData a
$crnf :: AssetClass -> ()
rnf :: AssetClass -> ()
NFData, DefinitionId
DefinitionId -> HasBlueprintDefinition AssetClass
forall t. DefinitionId -> HasBlueprintDefinition t
$cdefinitionId :: DefinitionId
definitionId :: DefinitionId
HasBlueprintDefinition)
deriving ((forall ann. AssetClass -> Doc ann)
-> (forall ann. [AssetClass] -> Doc ann) -> Pretty AssetClass
forall ann. [AssetClass] -> Doc ann
forall ann. AssetClass -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. AssetClass -> Doc ann
pretty :: forall ann. AssetClass -> Doc ann
$cprettyList :: forall ann. [AssetClass] -> Doc ann
prettyList :: forall ann. [AssetClass] -> Doc ann
Pretty) via (PrettyShow (CurrencySymbol, TokenName))
instance HasBlueprintSchema AssetClass referencedTypes where
{-# INLINABLE schema #-}
schema :: Schema referencedTypes
schema =
SchemaInfo -> PairSchema referencedTypes -> Schema referencedTypes
forall (referencedTypes :: [*]).
SchemaInfo -> PairSchema referencedTypes -> Schema referencedTypes
SchemaBuiltInPair SchemaInfo
emptySchemaInfo (PairSchema referencedTypes -> Schema referencedTypes)
-> PairSchema referencedTypes -> Schema referencedTypes
forall a b. (a -> b) -> a -> b
$
MkPairSchema
{ $sel:left:MkPairSchema :: Schema referencedTypes
left = forall t (referencedTypes :: [*]).
HasBlueprintSchema t referencedTypes =>
Schema referencedTypes
schema @CurrencySymbol
, $sel:right:MkPairSchema :: Schema referencedTypes
right = forall t (referencedTypes :: [*]).
HasBlueprintSchema t referencedTypes =>
Schema referencedTypes
schema @TokenName
}
assetClass :: CurrencySymbol -> TokenName -> AssetClass
assetClass :: CurrencySymbol -> TokenName -> AssetClass
assetClass CurrencySymbol
s TokenName
t = (CurrencySymbol, TokenName) -> AssetClass
AssetClass (CurrencySymbol
s, TokenName
t)
{-# INLINABLE assetClass #-}
newtype Value = Value { Value -> Map CurrencySymbol (Map TokenName Integer)
getValue :: Map CurrencySymbol (Map TokenName Integer) }
deriving stock ((forall x. Value -> Rep Value x)
-> (forall x. Rep Value x -> Value) -> Generic Value
forall x. Rep Value x -> Value
forall x. Value -> Rep Value x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Value -> Rep Value x
from :: forall x. Value -> Rep Value x
$cto :: forall x. Rep Value x -> Value
to :: forall x. Rep Value x -> Value
Generic, Typeable Value
Typeable Value =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Value -> c Value)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Value)
-> (Value -> Constr)
-> (Value -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Value))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Value))
-> ((forall b. Data b => b -> b) -> Value -> Value)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r)
-> (forall u. (forall d. Data d => d -> u) -> Value -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Value -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Value -> m Value)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Value -> m Value)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Value -> m Value)
-> Data Value
Value -> Constr
Value -> DataType
(forall b. Data b => b -> b) -> Value -> Value
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Value -> u
forall u. (forall d. Data d => d -> u) -> Value -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Value -> m Value
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Value -> m Value
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Value
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Value -> c Value
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Value)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Value)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Value -> c Value
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Value -> c Value
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Value
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Value
$ctoConstr :: Value -> Constr
toConstr :: Value -> Constr
$cdataTypeOf :: Value -> DataType
dataTypeOf :: Value -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Value)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Value)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Value)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Value)
$cgmapT :: (forall b. Data b => b -> b) -> Value -> Value
gmapT :: (forall b. Data b => b -> b) -> Value -> Value
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Value -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Value -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Value -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Value -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Value -> m Value
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Value -> m Value
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Value -> m Value
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Value -> m Value
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Value -> m Value
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Value -> m Value
Data, Typeable, Int -> Value -> ShowS
[Value] -> ShowS
Value -> String
(Int -> Value -> ShowS)
-> (Value -> String) -> ([Value] -> ShowS) -> Show Value
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Value -> ShowS
showsPrec :: Int -> Value -> ShowS
$cshow :: Value -> String
show :: Value -> String
$cshowList :: [Value] -> ShowS
showList :: [Value] -> ShowS
Haskell.Show)
deriving anyclass (Value -> ()
(Value -> ()) -> NFData Value
forall a. (a -> ()) -> NFData a
$crnf :: Value -> ()
rnf :: Value -> ()
NFData)
deriving newtype (Value -> BuiltinData
(Value -> BuiltinData) -> ToData Value
forall a. (a -> BuiltinData) -> ToData a
$ctoBuiltinData :: Value -> BuiltinData
toBuiltinData :: Value -> BuiltinData
PlutusTx.ToData, BuiltinData -> Maybe Value
(BuiltinData -> Maybe Value) -> FromData Value
forall a. (BuiltinData -> Maybe a) -> FromData a
$cfromBuiltinData :: BuiltinData -> Maybe Value
fromBuiltinData :: BuiltinData -> Maybe Value
PlutusTx.FromData, BuiltinData -> Value
(BuiltinData -> Value) -> UnsafeFromData Value
forall a. (BuiltinData -> a) -> UnsafeFromData a
$cunsafeFromBuiltinData :: BuiltinData -> Value
unsafeFromBuiltinData :: BuiltinData -> Value
PlutusTx.UnsafeFromData)
deriving (forall ann. Value -> Doc ann)
-> (forall ann. [Value] -> Doc ann) -> Pretty Value
forall ann. [Value] -> Doc ann
forall ann. Value -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. Value -> Doc ann
pretty :: forall ann. Value -> Doc ann
$cprettyList :: forall ann. [Value] -> Doc ann
prettyList :: forall ann. [Value] -> Doc ann
Pretty via (PrettyShow Value)
instance HasBlueprintDefinition Value where
type Unroll Value = '[Value, CurrencySymbol, TokenName, Integer]
definitionId :: DefinitionId
definitionId = forall t. Typeable t => DefinitionId
definitionIdFromType @Value
instance HasBlueprintSchema Value referencedTypes where
{-# INLINABLE schema #-}
schema :: Schema referencedTypes
schema =
SchemaInfo -> MapSchema referencedTypes -> Schema referencedTypes
forall (referencedTypes :: [*]).
SchemaInfo -> MapSchema referencedTypes -> Schema referencedTypes
SchemaMap
SchemaInfo
emptySchemaInfo
{ title = Just "Value" }
MkMapSchema
{ $sel:keySchema:MkMapSchema :: Schema referencedTypes
keySchema = forall t (ts :: [*]). HasBlueprintDefinition t => Schema ts
definitionRef @CurrencySymbol
, $sel:valueSchema:MkMapSchema :: Schema referencedTypes
valueSchema =
SchemaInfo -> MapSchema referencedTypes -> Schema referencedTypes
forall (referencedTypes :: [*]).
SchemaInfo -> MapSchema referencedTypes -> Schema referencedTypes
SchemaMap SchemaInfo
emptySchemaInfo MkMapSchema
{ $sel:keySchema:MkMapSchema :: Schema referencedTypes
keySchema = forall t (ts :: [*]). HasBlueprintDefinition t => Schema ts
definitionRef @TokenName
, $sel:valueSchema:MkMapSchema :: Schema referencedTypes
valueSchema = forall t (ts :: [*]). HasBlueprintDefinition t => Schema ts
definitionRef @Integer
, $sel:minItems:MkMapSchema :: Maybe Natural
minItems = Maybe Natural
forall a. Maybe a
Nothing
, $sel:maxItems:MkMapSchema :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Nothing
}
, $sel:minItems:MkMapSchema :: Maybe Natural
minItems = Maybe Natural
forall a. Maybe a
Nothing
, $sel:maxItems:MkMapSchema :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Nothing
}
instance Haskell.Eq Value where
== :: Value -> Value -> Bool
(==) = Value -> Value -> Bool
eq
instance Eq Value where
{-# INLINABLE (==) #-}
== :: Value -> Value -> Bool
(==) = Value -> Value -> Bool
eq
instance Haskell.Semigroup Value where
<> :: Value -> Value -> Value
(<>) = (Integer -> Integer -> Integer) -> Value -> Value -> Value
unionWith Integer -> Integer -> Integer
forall a. AdditiveSemigroup a => a -> a -> a
(+)
instance Semigroup Value where
{-# INLINABLE (<>) #-}
<> :: Value -> Value -> Value
(<>) = (Integer -> Integer -> Integer) -> Value -> Value -> Value
unionWith Integer -> Integer -> Integer
forall a. AdditiveSemigroup a => a -> a -> a
(+)
instance Haskell.Monoid Value where
mempty :: Value
mempty = Map CurrencySymbol (Map TokenName Integer) -> Value
Value Map CurrencySymbol (Map TokenName Integer)
forall k v. Map k v
Map.empty
instance Monoid Value where
{-# INLINABLE mempty #-}
mempty :: Value
mempty = Map CurrencySymbol (Map TokenName Integer) -> Value
Value Map CurrencySymbol (Map TokenName Integer)
forall k v. Map k v
Map.empty
instance Group Value where
{-# INLINABLE inv #-}
inv :: Value -> Value
inv = forall s v. Module s v => s -> v -> v
scale @Integer @Value (-Integer
1)
deriving via (Additive Value) instance AdditiveSemigroup Value
deriving via (Additive Value) instance AdditiveMonoid Value
deriving via (Additive Value) instance AdditiveGroup Value
instance Module Integer Value where
{-# INLINABLE scale #-}
scale :: Integer -> Value -> Value
scale Integer
i (Value Map CurrencySymbol (Map TokenName Integer)
xs) = Map CurrencySymbol (Map TokenName Integer) -> Value
Value ((Map TokenName Integer -> Map TokenName Integer)
-> Map CurrencySymbol (Map TokenName Integer)
-> Map CurrencySymbol (Map TokenName Integer)
forall a b.
(a -> b) -> Map CurrencySymbol a -> Map CurrencySymbol b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Integer -> Integer)
-> Map TokenName Integer -> Map TokenName Integer
forall a b. (a -> b) -> Map TokenName a -> Map TokenName b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Integer
i' -> Integer
i Integer -> Integer -> Integer
forall a. MultiplicativeSemigroup a => a -> a -> a
* Integer
i')) Map CurrencySymbol (Map TokenName Integer)
xs)
instance JoinSemiLattice Value where
{-# INLINABLE (\/) #-}
\/ :: Value -> Value -> Value
(\/) = (Integer -> Integer -> Integer) -> Value -> Value -> Value
unionWith Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
Ord.max
instance MeetSemiLattice Value where
{-# INLINABLE (/\) #-}
/\ :: Value -> Value -> Value
(/\) = (Integer -> Integer -> Integer) -> Value -> Value -> Value
unionWith Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
Ord.min
valueOf :: Value -> CurrencySymbol -> TokenName -> Integer
valueOf :: Value -> CurrencySymbol -> TokenName -> Integer
valueOf Value
value CurrencySymbol
cur TokenName
tn =
CurrencySymbol
-> Value
-> Integer
-> (Map TokenName Integer -> Integer)
-> Integer
forall a.
CurrencySymbol -> Value -> a -> (Map TokenName Integer -> a) -> a
withCurrencySymbol CurrencySymbol
cur Value
value Integer
0 \Map TokenName Integer
tokens ->
case TokenName -> Map TokenName Integer -> Maybe Integer
forall k v. Eq k => k -> Map k v -> Maybe v
Map.lookup TokenName
tn Map TokenName Integer
tokens of
Maybe Integer
Nothing -> Integer
0
Just Integer
v -> Integer
v
{-# INLINABLE valueOf #-}
withCurrencySymbol :: CurrencySymbol -> Value -> a -> (Map TokenName Integer -> a) -> a
withCurrencySymbol :: forall a.
CurrencySymbol -> Value -> a -> (Map TokenName Integer -> a) -> a
withCurrencySymbol CurrencySymbol
currency Value
value a
def Map TokenName Integer -> a
k =
case CurrencySymbol
-> Map CurrencySymbol (Map TokenName Integer)
-> Maybe (Map TokenName Integer)
forall k v. Eq k => k -> Map k v -> Maybe v
Map.lookup CurrencySymbol
currency (Value -> Map CurrencySymbol (Map TokenName Integer)
getValue Value
value) of
Maybe (Map TokenName Integer)
Nothing -> a
def
Just Map TokenName Integer
tokenQuantities -> Map TokenName Integer -> a
k Map TokenName Integer
tokenQuantities
{-# INLINABLE withCurrencySymbol #-}
currencySymbolValueOf :: Value -> CurrencySymbol -> Integer
currencySymbolValueOf :: Value -> CurrencySymbol -> Integer
currencySymbolValueOf Value
value CurrencySymbol
cur = CurrencySymbol
-> Value
-> Integer
-> (Map TokenName Integer -> Integer)
-> Integer
forall a.
CurrencySymbol -> Value -> a -> (Map TokenName Integer -> a) -> a
withCurrencySymbol CurrencySymbol
cur Value
value Integer
0 \Map TokenName Integer
tokens ->
((TokenName, Integer) -> Integer -> Integer)
-> Integer -> [(TokenName, Integer)] -> Integer
forall a b. (a -> b -> b) -> b -> [a] -> b
PlutusTx.List.foldr (\(TokenName
_, Integer
amt) Integer
acc -> Integer
amt Integer -> Integer -> Integer
forall a. AdditiveSemigroup a => a -> a -> a
+ Integer
acc) Integer
0 (Map TokenName Integer -> [(TokenName, Integer)]
forall k v. Map k v -> [(k, v)]
Map.toList Map TokenName Integer
tokens)
{-# INLINABLE currencySymbolValueOf #-}
symbols :: Value -> [CurrencySymbol]
symbols :: Value -> [CurrencySymbol]
symbols (Value Map CurrencySymbol (Map TokenName Integer)
mp) = Map CurrencySymbol (Map TokenName Integer) -> [CurrencySymbol]
forall k v. Map k v -> [k]
Map.keys Map CurrencySymbol (Map TokenName Integer)
mp
{-# INLINABLE symbols #-}
singleton :: CurrencySymbol -> TokenName -> Integer -> Value
singleton :: CurrencySymbol -> TokenName -> Integer -> Value
singleton CurrencySymbol
c TokenName
tn Integer
i = Map CurrencySymbol (Map TokenName Integer) -> Value
Value (CurrencySymbol
-> Map TokenName Integer
-> Map CurrencySymbol (Map TokenName Integer)
forall k v. k -> v -> Map k v
Map.singleton CurrencySymbol
c (TokenName -> Integer -> Map TokenName Integer
forall k v. k -> v -> Map k v
Map.singleton TokenName
tn Integer
i))
{-# INLINABLE singleton #-}
lovelaceValue :: Lovelace -> Value
lovelaceValue :: Lovelace -> Value
lovelaceValue = CurrencySymbol -> TokenName -> Integer -> Value
singleton CurrencySymbol
adaSymbol TokenName
adaToken (Integer -> Value) -> (Lovelace -> Integer) -> Lovelace -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lovelace -> Integer
getLovelace
{-# INLINABLE lovelaceValue #-}
lovelaceValueOf :: Value -> Lovelace
lovelaceValueOf :: Value -> Lovelace
lovelaceValueOf Value
v = Integer -> Lovelace
Lovelace (Value -> CurrencySymbol -> TokenName -> Integer
valueOf Value
v CurrencySymbol
adaSymbol TokenName
adaToken)
{-# INLINABLE lovelaceValueOf #-}
assetClassValue :: AssetClass -> Integer -> Value
assetClassValue :: AssetClass -> Integer -> Value
assetClassValue (AssetClass (CurrencySymbol
c, TokenName
t)) = CurrencySymbol -> TokenName -> Integer -> Value
singleton CurrencySymbol
c TokenName
t
{-# INLINABLE assetClassValue #-}
assetClassValueOf :: Value -> AssetClass -> Integer
assetClassValueOf :: Value -> AssetClass -> Integer
assetClassValueOf Value
v (AssetClass (CurrencySymbol
c, TokenName
t)) = Value -> CurrencySymbol -> TokenName -> Integer
valueOf Value
v CurrencySymbol
c TokenName
t
{-# INLINABLE assetClassValueOf #-}
unionVal :: Value -> Value -> Map CurrencySymbol (Map TokenName (These Integer Integer))
unionVal :: Value
-> Value
-> Map CurrencySymbol (Map TokenName (These Integer Integer))
unionVal (Value Map CurrencySymbol (Map TokenName Integer)
l) (Value Map CurrencySymbol (Map TokenName Integer)
r) =
let
combined :: Map
CurrencySymbol
(These (Map TokenName Integer) (Map TokenName Integer))
combined = Map CurrencySymbol (Map TokenName Integer)
-> Map CurrencySymbol (Map TokenName Integer)
-> Map
CurrencySymbol
(These (Map TokenName Integer) (Map TokenName Integer))
forall k v r. Eq k => Map k v -> Map k r -> Map k (These v r)
Map.union Map CurrencySymbol (Map TokenName Integer)
l Map CurrencySymbol (Map TokenName Integer)
r
unThese :: These (Map k a) (Map k b) -> Map k (These a b)
unThese These (Map k a) (Map k b)
k = case These (Map k a) (Map k b)
k of
This Map k a
a -> a -> These a b
forall a b. a -> These a b
This (a -> These a b) -> Map k a -> Map k (These a b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Map k a
a
That Map k b
b -> b -> These a b
forall a b. b -> These a b
That (b -> These a b) -> Map k b -> Map k (These a b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Map k b
b
These Map k a
a Map k b
b -> Map k a -> Map k b -> Map k (These a b)
forall k v r. Eq k => Map k v -> Map k r -> Map k (These v r)
Map.union Map k a
a Map k b
b
in These (Map TokenName Integer) (Map TokenName Integer)
-> Map TokenName (These Integer Integer)
forall {k} {a} {b}.
Eq k =>
These (Map k a) (Map k b) -> Map k (These a b)
unThese (These (Map TokenName Integer) (Map TokenName Integer)
-> Map TokenName (These Integer Integer))
-> Map
CurrencySymbol
(These (Map TokenName Integer) (Map TokenName Integer))
-> Map CurrencySymbol (Map TokenName (These Integer Integer))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Map
CurrencySymbol
(These (Map TokenName Integer) (Map TokenName Integer))
combined
{-# INLINABLE unionVal #-}
unionWith :: (Integer -> Integer -> Integer) -> Value -> Value -> Value
unionWith :: (Integer -> Integer -> Integer) -> Value -> Value -> Value
unionWith Integer -> Integer -> Integer
f Value
ls Value
rs =
let
combined :: Map CurrencySymbol (Map TokenName (These Integer Integer))
combined = Value
-> Value
-> Map CurrencySymbol (Map TokenName (These Integer Integer))
unionVal Value
ls Value
rs
unThese :: These Integer Integer -> Integer
unThese These Integer Integer
k' = case These Integer Integer
k' of
This Integer
a -> Integer -> Integer -> Integer
f Integer
a Integer
0
That Integer
b -> Integer -> Integer -> Integer
f Integer
0 Integer
b
These Integer
a Integer
b -> Integer -> Integer -> Integer
f Integer
a Integer
b
in Map CurrencySymbol (Map TokenName Integer) -> Value
Value ((Map TokenName (These Integer Integer) -> Map TokenName Integer)
-> Map CurrencySymbol (Map TokenName (These Integer Integer))
-> Map CurrencySymbol (Map TokenName Integer)
forall a b.
(a -> b) -> Map CurrencySymbol a -> Map CurrencySymbol b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((These Integer Integer -> Integer)
-> Map TokenName (These Integer Integer) -> Map TokenName Integer
forall a b. (a -> b) -> Map TokenName a -> Map TokenName b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap These Integer Integer -> Integer
unThese) Map CurrencySymbol (Map TokenName (These Integer Integer))
combined)
{-# INLINABLE unionWith #-}
flattenValue :: Value -> [(CurrencySymbol, TokenName, Integer)]
flattenValue :: Value -> [(CurrencySymbol, TokenName, Integer)]
flattenValue Value
v = [(CurrencySymbol, TokenName, Integer)]
-> [(CurrencySymbol, Map TokenName Integer)]
-> [(CurrencySymbol, TokenName, Integer)]
forall {c} {a} {b}.
(Eq c, Num c) =>
[(a, b, c)] -> [(a, Map b c)] -> [(a, b, c)]
goOuter [] (Map CurrencySymbol (Map TokenName Integer)
-> [(CurrencySymbol, Map TokenName Integer)]
forall k v. Map k v -> [(k, v)]
Map.toList (Map CurrencySymbol (Map TokenName Integer)
-> [(CurrencySymbol, Map TokenName Integer)])
-> Map CurrencySymbol (Map TokenName Integer)
-> [(CurrencySymbol, Map TokenName Integer)]
forall a b. (a -> b) -> a -> b
$ Value -> Map CurrencySymbol (Map TokenName Integer)
getValue Value
v)
where
goOuter :: [(a, b, c)] -> [(a, Map b c)] -> [(a, b, c)]
goOuter [(a, b, c)]
acc [] = [(a, b, c)]
acc
goOuter [(a, b, c)]
acc ((a
cs, Map b c
m) : [(a, Map b c)]
tl) = [(a, b, c)] -> [(a, Map b c)] -> [(a, b, c)]
goOuter (a -> [(a, b, c)] -> [(b, c)] -> [(a, b, c)]
forall {c} {a} {b}.
(Eq c, Num c) =>
a -> [(a, b, c)] -> [(b, c)] -> [(a, b, c)]
goInner a
cs [(a, b, c)]
acc (Map b c -> [(b, c)]
forall k v. Map k v -> [(k, v)]
Map.toList Map b c
m)) [(a, Map b c)]
tl
goInner :: a -> [(a, b, c)] -> [(b, c)] -> [(a, b, c)]
goInner a
_ [(a, b, c)]
acc [] = [(a, b, c)]
acc
goInner a
cs [(a, b, c)]
acc ((b
tn, c
a) : [(b, c)]
tl)
| c
a c -> c -> Bool
forall a. Eq a => a -> a -> Bool
/= c
0 = a -> [(a, b, c)] -> [(b, c)] -> [(a, b, c)]
goInner a
cs ((a
cs, b
tn, c
a) (a, b, c) -> [(a, b, c)] -> [(a, b, c)]
forall a. a -> [a] -> [a]
: [(a, b, c)]
acc) [(b, c)]
tl
| Bool
otherwise = a -> [(a, b, c)] -> [(b, c)] -> [(a, b, c)]
goInner a
cs [(a, b, c)]
acc [(b, c)]
tl
{-# INLINABLE flattenValue #-}
isZero :: Value -> Bool
isZero :: Value -> Bool
isZero (Value Map CurrencySymbol (Map TokenName Integer)
xs) = (Map TokenName Integer -> Bool)
-> Map CurrencySymbol (Map TokenName Integer) -> Bool
forall a k. (a -> Bool) -> Map k a -> Bool
Map.all ((Integer -> Bool) -> Map TokenName Integer -> Bool
forall a k. (a -> Bool) -> Map k a -> Bool
Map.all (\Integer
i -> Integer
0 Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
== Integer
i)) Map CurrencySymbol (Map TokenName Integer)
xs
{-# INLINABLE isZero #-}
checkPred :: (These Integer Integer -> Bool) -> Value -> Value -> Bool
checkPred :: (These Integer Integer -> Bool) -> Value -> Value -> Bool
checkPred These Integer Integer -> Bool
f Value
l Value
r =
let
inner :: Map TokenName (These Integer Integer) -> Bool
inner :: Map TokenName (These Integer Integer) -> Bool
inner = (These Integer Integer -> Bool)
-> Map TokenName (These Integer Integer) -> Bool
forall a k. (a -> Bool) -> Map k a -> Bool
Map.all These Integer Integer -> Bool
f
in
(Map TokenName (These Integer Integer) -> Bool)
-> Map CurrencySymbol (Map TokenName (These Integer Integer))
-> Bool
forall a k. (a -> Bool) -> Map k a -> Bool
Map.all Map TokenName (These Integer Integer) -> Bool
inner (Value
-> Value
-> Map CurrencySymbol (Map TokenName (These Integer Integer))
unionVal Value
l Value
r)
{-# INLINABLE checkPred #-}
checkBinRel :: (Integer -> Integer -> Bool) -> Value -> Value -> Bool
checkBinRel :: (Integer -> Integer -> Bool) -> Value -> Value -> Bool
checkBinRel Integer -> Integer -> Bool
f Value
l Value
r =
let
unThese :: These Integer Integer -> Bool
unThese These Integer Integer
k' = case These Integer Integer
k' of
This Integer
a -> Integer -> Integer -> Bool
f Integer
a Integer
0
That Integer
b -> Integer -> Integer -> Bool
f Integer
0 Integer
b
These Integer
a Integer
b -> Integer -> Integer -> Bool
f Integer
a Integer
b
in (These Integer Integer -> Bool) -> Value -> Value -> Bool
checkPred These Integer Integer -> Bool
unThese Value
l Value
r
{-# INLINABLE checkBinRel #-}
geq :: Value -> Value -> Bool
geq :: Value -> Value -> Bool
geq = (Integer -> Integer -> Bool) -> Value -> Value -> Bool
checkBinRel Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
(>=)
{-# INLINABLE geq #-}
leq :: Value -> Value -> Bool
leq :: Value -> Value -> Bool
leq = (Integer -> Integer -> Bool) -> Value -> Value -> Bool
checkBinRel Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
(<=)
{-# INLINABLE leq #-}
gt :: Value -> Value -> Bool
gt :: Value -> Value -> Bool
gt Value
l Value
r = Value -> Value -> Bool
geq Value
l Value
r Bool -> Bool -> Bool
&& Bool -> Bool
not (Value -> Value -> Bool
eq Value
l Value
r)
{-# INLINABLE gt #-}
lt :: Value -> Value -> Bool
lt :: Value -> Value -> Bool
lt Value
l Value
r = Value -> Value -> Bool
leq Value
l Value
r Bool -> Bool -> Bool
&& Bool -> Bool
not (Value -> Value -> Bool
eq Value
l Value
r)
{-# INLINABLE lt #-}
split :: Value -> (Value, Value)
split :: Value -> (Value, Value)
split (Value Map CurrencySymbol (Map TokenName Integer)
mp) = (Value -> Value
forall a. AdditiveGroup a => a -> a
negate (Map CurrencySymbol (Map TokenName Integer) -> Value
Value Map CurrencySymbol (Map TokenName Integer)
neg), Map CurrencySymbol (Map TokenName Integer) -> Value
Value Map CurrencySymbol (Map TokenName Integer)
pos) where
(Map CurrencySymbol (Map TokenName Integer)
neg, Map CurrencySymbol (Map TokenName Integer)
pos) = (Map TokenName Integer
-> These (Map TokenName Integer) (Map TokenName Integer))
-> Map CurrencySymbol (Map TokenName Integer)
-> (Map CurrencySymbol (Map TokenName Integer),
Map CurrencySymbol (Map TokenName Integer))
forall v a b k. (v -> These a b) -> Map k v -> (Map k a, Map k b)
Map.mapThese Map TokenName Integer
-> These (Map TokenName Integer) (Map TokenName Integer)
splitIntl Map CurrencySymbol (Map TokenName Integer)
mp
splitIntl :: Map TokenName Integer -> These (Map TokenName Integer) (Map TokenName Integer)
splitIntl :: Map TokenName Integer
-> These (Map TokenName Integer) (Map TokenName Integer)
splitIntl Map TokenName Integer
mp' = Map TokenName Integer
-> Map TokenName Integer
-> These (Map TokenName Integer) (Map TokenName Integer)
forall a b. a -> b -> These a b
These Map TokenName Integer
l Map TokenName Integer
r where
(Map TokenName Integer
l, Map TokenName Integer
r) = (Integer -> These Integer Integer)
-> Map TokenName Integer
-> (Map TokenName Integer, Map TokenName Integer)
forall v a b k. (v -> These a b) -> Map k v -> (Map k a, Map k b)
Map.mapThese (\Integer
i -> if Integer
i Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
<= Integer
0 then Integer -> These Integer Integer
forall a b. a -> These a b
This Integer
i else Integer -> These Integer Integer
forall a b. b -> These a b
That Integer
i) Map TokenName Integer
mp'
{-# INLINABLE split #-}
unordEqWith :: forall k v. Eq k => (v -> Bool) -> (v -> v -> Bool) -> [(k, v)] -> [(k, v)] -> Bool
unordEqWith :: forall k v.
Eq k =>
(v -> Bool) -> (v -> v -> Bool) -> [(k, v)] -> [(k, v)] -> Bool
unordEqWith v -> Bool
is0 v -> v -> Bool
eqV = [(k, v)] -> [(k, v)] -> Bool
goBoth where
goBoth :: [(k, v)] -> [(k, v)] -> Bool
goBoth :: [(k, v)] -> [(k, v)] -> Bool
goBoth [] [(k, v)]
kvsR = ((k, v) -> Bool) -> [(k, v)] -> Bool
forall a. (a -> Bool) -> [a] -> Bool
all (v -> Bool
is0 (v -> Bool) -> ((k, v) -> v) -> (k, v) -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (k, v) -> v
forall a b. (a, b) -> b
snd) [(k, v)]
kvsR
goBoth [(k, v)]
kvsL [] = ((k, v) -> Bool) -> [(k, v)] -> Bool
forall a. (a -> Bool) -> [a] -> Bool
all (v -> Bool
is0 (v -> Bool) -> ((k, v) -> v) -> (k, v) -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (k, v) -> v
forall a b. (a, b) -> b
snd) [(k, v)]
kvsL
goBoth ((k
kL, v
vL) : [(k, v)]
kvsL') kvsR0 :: [(k, v)]
kvsR0@(kvR0 :: (k, v)
kvR0@(k
kR0, v
vR0) : [(k, v)]
kvsR0')
| k
kL k -> k -> Bool
forall a. Eq a => a -> a -> Bool
== k
kR0 = if v
vL v -> v -> Bool
`eqV` v
vR0 then [(k, v)] -> [(k, v)] -> Bool
goBoth [(k, v)]
kvsL' [(k, v)]
kvsR0' else Bool
False
| v -> Bool
is0 v
vL = [(k, v)] -> [(k, v)] -> Bool
goBoth [(k, v)]
kvsL' [(k, v)]
kvsR0
| Bool
otherwise = [(k, v)] -> [(k, v)] -> Bool
goRight [(k, v)
kvR0 | Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ v -> Bool
is0 v
vR0] [(k, v)]
kvsR0'
where
goRight :: [(k, v)] -> [(k, v)] -> Bool
goRight :: [(k, v)] -> [(k, v)] -> Bool
goRight [(k, v)]
_ [] = Bool
False
goRight [(k, v)]
acc (kvR :: (k, v)
kvR@(k
kR, v
vR) : [(k, v)]
kvsR')
| v -> Bool
is0 v
vR = [(k, v)] -> [(k, v)] -> Bool
goRight [(k, v)]
acc [(k, v)]
kvsR'
| k
kL k -> k -> Bool
forall a. Eq a => a -> a -> Bool
== k
kR = if v
vL v -> v -> Bool
`eqV` v
vR then [(k, v)] -> [(k, v)] -> Bool
goBoth [(k, v)]
kvsL' ([(k, v)] -> [(k, v)] -> [(k, v)]
forall a. [a] -> [a] -> [a]
revAppend [(k, v)]
acc [(k, v)]
kvsR') else Bool
False
| Bool
otherwise = [(k, v)] -> [(k, v)] -> Bool
goRight ((k, v)
kvR (k, v) -> [(k, v)] -> [(k, v)]
forall a. a -> [a] -> [a]
: [(k, v)]
acc) [(k, v)]
kvsR'
{-# INLINABLE unordEqWith #-}
eqMapWith ::
forall k v. Eq k => (v -> Bool) -> (v -> v -> Bool) -> Map k v -> Map k v -> Bool
eqMapWith :: forall k v.
Eq k =>
(v -> Bool) -> (v -> v -> Bool) -> Map k v -> Map k v -> Bool
eqMapWith v -> Bool
is0 v -> v -> Bool
eqV (Map k v -> [(k, v)]
forall k v. Map k v -> [(k, v)]
Map.toList -> [(k, v)]
xs1) (Map k v -> [(k, v)]
forall k v. Map k v -> [(k, v)]
Map.toList -> [(k, v)]
xs2) = (v -> Bool) -> (v -> v -> Bool) -> [(k, v)] -> [(k, v)] -> Bool
forall k v.
Eq k =>
(v -> Bool) -> (v -> v -> Bool) -> [(k, v)] -> [(k, v)] -> Bool
unordEqWith v -> Bool
is0 v -> v -> Bool
eqV [(k, v)]
xs1 [(k, v)]
xs2
{-# INLINABLE eqMapWith #-}
eq :: Value -> Value -> Bool
eq :: Value -> Value -> Bool
eq (Value Map CurrencySymbol (Map TokenName Integer)
currs1) (Value Map CurrencySymbol (Map TokenName Integer)
currs2) = (Map TokenName Integer -> Bool)
-> (Map TokenName Integer -> Map TokenName Integer -> Bool)
-> Map CurrencySymbol (Map TokenName Integer)
-> Map CurrencySymbol (Map TokenName Integer)
-> Bool
forall k v.
Eq k =>
(v -> Bool) -> (v -> v -> Bool) -> Map k v -> Map k v -> Bool
eqMapWith ((Integer -> Bool) -> Map TokenName Integer -> Bool
forall a k. (a -> Bool) -> Map k a -> Bool
Map.all (Integer
0 Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
==)) ((Integer -> Bool)
-> (Integer -> Integer -> Bool)
-> Map TokenName Integer
-> Map TokenName Integer
-> Bool
forall k v.
Eq k =>
(v -> Bool) -> (v -> v -> Bool) -> Map k v -> Map k v -> Bool
eqMapWith (Integer
0 Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
==) Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
(==)) Map CurrencySymbol (Map TokenName Integer)
currs1 Map CurrencySymbol (Map TokenName Integer)
currs2
{-# INLINABLE eq #-}
newtype Lovelace = Lovelace { Lovelace -> Integer
getLovelace :: Integer }
deriving stock ((forall x. Lovelace -> Rep Lovelace x)
-> (forall x. Rep Lovelace x -> Lovelace) -> Generic Lovelace
forall x. Rep Lovelace x -> Lovelace
forall x. Lovelace -> Rep Lovelace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Lovelace -> Rep Lovelace x
from :: forall x. Lovelace -> Rep Lovelace x
$cto :: forall x. Rep Lovelace x -> Lovelace
to :: forall x. Rep Lovelace x -> Lovelace
Generic, Typeable)
deriving ((forall ann. Lovelace -> Doc ann)
-> (forall ann. [Lovelace] -> Doc ann) -> Pretty Lovelace
forall ann. [Lovelace] -> Doc ann
forall ann. Lovelace -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. Lovelace -> Doc ann
pretty :: forall ann. Lovelace -> Doc ann
$cprettyList :: forall ann. [Lovelace] -> Doc ann
prettyList :: forall ann. [Lovelace] -> Doc ann
Pretty) via (PrettyShow Lovelace)
deriving anyclass (DefinitionId
DefinitionId -> HasBlueprintDefinition Lovelace
forall t. DefinitionId -> HasBlueprintDefinition t
$cdefinitionId :: DefinitionId
definitionId :: DefinitionId
HasBlueprintDefinition)
deriving newtype
( Lovelace -> Lovelace -> Bool
(Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Bool) -> Eq Lovelace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Lovelace -> Lovelace -> Bool
== :: Lovelace -> Lovelace -> Bool
$c/= :: Lovelace -> Lovelace -> Bool
/= :: Lovelace -> Lovelace -> Bool
Haskell.Eq
, Eq Lovelace
Eq Lovelace =>
(Lovelace -> Lovelace -> Ordering)
-> (Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Lovelace)
-> (Lovelace -> Lovelace -> Lovelace)
-> Ord Lovelace
Lovelace -> Lovelace -> Bool
Lovelace -> Lovelace -> Ordering
Lovelace -> Lovelace -> Lovelace
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
$ccompare :: Lovelace -> Lovelace -> Ordering
compare :: Lovelace -> Lovelace -> Ordering
$c< :: Lovelace -> Lovelace -> Bool
< :: Lovelace -> Lovelace -> Bool
$c<= :: Lovelace -> Lovelace -> Bool
<= :: Lovelace -> Lovelace -> Bool
$c> :: Lovelace -> Lovelace -> Bool
> :: Lovelace -> Lovelace -> Bool
$c>= :: Lovelace -> Lovelace -> Bool
>= :: Lovelace -> Lovelace -> Bool
$cmax :: Lovelace -> Lovelace -> Lovelace
max :: Lovelace -> Lovelace -> Lovelace
$cmin :: Lovelace -> Lovelace -> Lovelace
min :: Lovelace -> Lovelace -> Lovelace
Haskell.Ord
, Int -> Lovelace -> ShowS
[Lovelace] -> ShowS
Lovelace -> String
(Int -> Lovelace -> ShowS)
-> (Lovelace -> String) -> ([Lovelace] -> ShowS) -> Show Lovelace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Lovelace -> ShowS
showsPrec :: Int -> Lovelace -> ShowS
$cshow :: Lovelace -> String
show :: Lovelace -> String
$cshowList :: [Lovelace] -> ShowS
showList :: [Lovelace] -> ShowS
Haskell.Show
, Integer -> Lovelace
Lovelace -> Lovelace
Lovelace -> Lovelace -> Lovelace
(Lovelace -> Lovelace -> Lovelace)
-> (Lovelace -> Lovelace -> Lovelace)
-> (Lovelace -> Lovelace -> Lovelace)
-> (Lovelace -> Lovelace)
-> (Lovelace -> Lovelace)
-> (Lovelace -> Lovelace)
-> (Integer -> Lovelace)
-> Num Lovelace
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: Lovelace -> Lovelace -> Lovelace
+ :: Lovelace -> Lovelace -> Lovelace
$c- :: Lovelace -> Lovelace -> Lovelace
- :: Lovelace -> Lovelace -> Lovelace
$c* :: Lovelace -> Lovelace -> Lovelace
* :: Lovelace -> Lovelace -> Lovelace
$cnegate :: Lovelace -> Lovelace
negate :: Lovelace -> Lovelace
$cabs :: Lovelace -> Lovelace
abs :: Lovelace -> Lovelace
$csignum :: Lovelace -> Lovelace
signum :: Lovelace -> Lovelace
$cfromInteger :: Integer -> Lovelace
fromInteger :: Integer -> Lovelace
Haskell.Num
, Num Lovelace
Ord Lovelace
(Num Lovelace, Ord Lovelace) =>
(Lovelace -> Rational) -> Real Lovelace
Lovelace -> Rational
forall a. (Num a, Ord a) => (a -> Rational) -> Real a
$ctoRational :: Lovelace -> Rational
toRational :: Lovelace -> Rational
Haskell.Real
, Int -> Lovelace
Lovelace -> Int
Lovelace -> [Lovelace]
Lovelace -> Lovelace
Lovelace -> Lovelace -> [Lovelace]
Lovelace -> Lovelace -> Lovelace -> [Lovelace]
(Lovelace -> Lovelace)
-> (Lovelace -> Lovelace)
-> (Int -> Lovelace)
-> (Lovelace -> Int)
-> (Lovelace -> [Lovelace])
-> (Lovelace -> Lovelace -> [Lovelace])
-> (Lovelace -> Lovelace -> [Lovelace])
-> (Lovelace -> Lovelace -> Lovelace -> [Lovelace])
-> Enum Lovelace
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Lovelace -> Lovelace
succ :: Lovelace -> Lovelace
$cpred :: Lovelace -> Lovelace
pred :: Lovelace -> Lovelace
$ctoEnum :: Int -> Lovelace
toEnum :: Int -> Lovelace
$cfromEnum :: Lovelace -> Int
fromEnum :: Lovelace -> Int
$cenumFrom :: Lovelace -> [Lovelace]
enumFrom :: Lovelace -> [Lovelace]
$cenumFromThen :: Lovelace -> Lovelace -> [Lovelace]
enumFromThen :: Lovelace -> Lovelace -> [Lovelace]
$cenumFromTo :: Lovelace -> Lovelace -> [Lovelace]
enumFromTo :: Lovelace -> Lovelace -> [Lovelace]
$cenumFromThenTo :: Lovelace -> Lovelace -> Lovelace -> [Lovelace]
enumFromThenTo :: Lovelace -> Lovelace -> Lovelace -> [Lovelace]
Haskell.Enum
, Lovelace -> Lovelace -> Bool
(Lovelace -> Lovelace -> Bool) -> Eq Lovelace
forall a. (a -> a -> Bool) -> Eq a
$c== :: Lovelace -> Lovelace -> Bool
== :: Lovelace -> Lovelace -> Bool
PlutusTx.Eq
, Eq Lovelace
Eq Lovelace =>
(Lovelace -> Lovelace -> Ordering)
-> (Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Bool)
-> (Lovelace -> Lovelace -> Lovelace)
-> (Lovelace -> Lovelace -> Lovelace)
-> Ord Lovelace
Lovelace -> Lovelace -> Bool
Lovelace -> Lovelace -> Ordering
Lovelace -> Lovelace -> Lovelace
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
$ccompare :: Lovelace -> Lovelace -> Ordering
compare :: Lovelace -> Lovelace -> Ordering
$c< :: Lovelace -> Lovelace -> Bool
< :: Lovelace -> Lovelace -> Bool
$c<= :: Lovelace -> Lovelace -> Bool
<= :: Lovelace -> Lovelace -> Bool
$c> :: Lovelace -> Lovelace -> Bool
> :: Lovelace -> Lovelace -> Bool
$c>= :: Lovelace -> Lovelace -> Bool
>= :: Lovelace -> Lovelace -> Bool
$cmax :: Lovelace -> Lovelace -> Lovelace
max :: Lovelace -> Lovelace -> Lovelace
$cmin :: Lovelace -> Lovelace -> Lovelace
min :: Lovelace -> Lovelace -> Lovelace
PlutusTx.Ord
, Lovelace -> BuiltinData
(Lovelace -> BuiltinData) -> ToData Lovelace
forall a. (a -> BuiltinData) -> ToData a
$ctoBuiltinData :: Lovelace -> BuiltinData
toBuiltinData :: Lovelace -> BuiltinData
PlutusTx.ToData
, BuiltinData -> Maybe Lovelace
(BuiltinData -> Maybe Lovelace) -> FromData Lovelace
forall a. (BuiltinData -> Maybe a) -> FromData a
$cfromBuiltinData :: BuiltinData -> Maybe Lovelace
fromBuiltinData :: BuiltinData -> Maybe Lovelace
PlutusTx.FromData
, BuiltinData -> Lovelace
(BuiltinData -> Lovelace) -> UnsafeFromData Lovelace
forall a. (BuiltinData -> a) -> UnsafeFromData a
$cunsafeFromBuiltinData :: BuiltinData -> Lovelace
unsafeFromBuiltinData :: BuiltinData -> Lovelace
PlutusTx.UnsafeFromData
, Lovelace -> Lovelace -> Lovelace
(Lovelace -> Lovelace -> Lovelace) -> AdditiveSemigroup Lovelace
forall a. (a -> a -> a) -> AdditiveSemigroup a
$c+ :: Lovelace -> Lovelace -> Lovelace
+ :: Lovelace -> Lovelace -> Lovelace
PlutusTx.AdditiveSemigroup
, AdditiveSemigroup Lovelace
Lovelace
AdditiveSemigroup Lovelace => Lovelace -> AdditiveMonoid Lovelace
forall a. AdditiveSemigroup a => a -> AdditiveMonoid a
$czero :: Lovelace
zero :: Lovelace
PlutusTx.AdditiveMonoid
, AdditiveMonoid Lovelace
AdditiveMonoid Lovelace =>
(Lovelace -> Lovelace -> Lovelace) -> AdditiveGroup Lovelace
Lovelace -> Lovelace -> Lovelace
forall a. AdditiveMonoid a => (a -> a -> a) -> AdditiveGroup a
$c- :: Lovelace -> Lovelace -> Lovelace
- :: Lovelace -> Lovelace -> Lovelace
PlutusTx.AdditiveGroup
, Integer -> Lovelace -> ShowS
Lovelace -> BuiltinString
(Integer -> Lovelace -> ShowS)
-> (Lovelace -> BuiltinString) -> Show Lovelace
forall a. (Integer -> a -> ShowS) -> (a -> BuiltinString) -> Show a
$cshowsPrec :: Integer -> Lovelace -> ShowS
showsPrec :: Integer -> Lovelace -> ShowS
$cshow :: Lovelace -> BuiltinString
show :: Lovelace -> BuiltinString
PlutusTx.Show
)
instance HasBlueprintSchema Lovelace referencedTypes where
{-# INLINABLE schema #-}
schema :: Schema referencedTypes
schema = SchemaInfo -> IntegerSchema -> Schema referencedTypes
forall (referencedTypes :: [*]).
SchemaInfo -> IntegerSchema -> Schema referencedTypes
SchemaInteger SchemaInfo
info IntegerSchema
emptyIntegerSchema
where
info :: SchemaInfo
info = SchemaInfo
emptySchemaInfo { title = Just "Lovelace" }
$(makeLift ''CurrencySymbol)
$(makeLift ''TokenName)
$(makeLift ''AssetClass)
$(makeLift ''Value)
$(makeLift ''Lovelace)