Skip to content

Commit

Permalink
Split IsData into three
Browse files Browse the repository at this point in the history
The recent changes to `IsData` introduced a much faster alternative to
`fromBuiltinData`, namely `unsafeFromBuiltinData`. It's also *much*
smaller. Or rather, `fromBuiltinData` is really very big!

However, both of these are typeclass methods of `IsData`, and so even if
we onyl use one of them, GHC can't prune away the others. It still
constructs the typeclass dictionary with all three. This doesn't cost us
much runtime but *does* cost us lots of space usage.

The simplest solution I could think of was just to split up `IsData`
into a class per function. This allows us to only use the constraints
that we really need, which cuts down on size a lot. In particular,
`wrapValidator` and friends only require an `UnsafeFromData` constraint.

There are still some places where we incur the other constraints, but
they're mostly off-chain. Main offenders are:
- `Oracle`: uses `fromBuiltinData` and returns a specific error if it
fails. It *might* be okay to use `unsafeFromBuiltinData` here, I'm not
sure.
- `StateMachine`: uses `toBuiltinData` to compare the expected state to
the new state. I'm not sure we can get away from this, unfortunately.
  • Loading branch information
michaelpj committed Jul 26, 2021
1 parent e0b0fdd commit 5fa8498
Show file tree
Hide file tree
Showing 48 changed files with 1,270 additions and 8,310 deletions.
16 changes: 9 additions & 7 deletions plutus-contract/src/Plutus/Contract/Request.hs
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,9 @@ submitTx = submitTxConstraintsWith @Void mempty
-- contract's own public key to solve the constraints.
submitTxConstraints
:: forall a w s e.
( PlutusTx.IsData (RedeemerType a)
, PlutusTx.IsData (DatumType a)
( PlutusTx.ToData (RedeemerType a)
, PlutusTx.FromData (DatumType a)
, PlutusTx.ToData (DatumType a)
, AsContractError e
)
=> TypedValidator a
Expand All @@ -426,8 +427,9 @@ submitTxConstraints inst = submitTxConstraintsWith (Constraints.typedValidatorLo
-- to resolve any input constraints (see 'Ledger.Constraints.TxConstraints.InputConstraint')
submitTxConstraintsSpending
:: forall a w s e.
( PlutusTx.IsData (RedeemerType a)
, PlutusTx.IsData (DatumType a)
( PlutusTx.ToData (RedeemerType a)
, PlutusTx.FromData (DatumType a)
, PlutusTx.ToData (DatumType a)
, AsContractError e
)
=> TypedValidator a
Expand All @@ -442,8 +444,9 @@ submitTxConstraintsSpending inst utxo =
-- network. Using the given constraints.
submitTxConstraintsWith
:: forall a w s e.
( PlutusTx.IsData (RedeemerType a)
, PlutusTx.IsData (DatumType a)
( PlutusTx.ToData (RedeemerType a)
, PlutusTx.FromData (DatumType a)
, PlutusTx.ToData (DatumType a)
, AsContractError e
)
=> ScriptLookups a
Expand All @@ -457,4 +460,3 @@ submitTxConstraintsWith sl constraints = do
-- confirmed on the ledger before returning.
submitTxConfirmed :: forall w s e. (AsContractError e) => UnbalancedTx -> Contract w s e ()
submitTxConfirmed t = submitUnbalancedTx t >>= awaitTxConfirmed . txId

47 changes: 29 additions & 18 deletions plutus-contract/src/Plutus/Contract/StateMachine.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type OnChainState s i = (Typed.TypedScriptTxOut (SM.StateMachine s i), Typed.Typ

getStates
:: forall s i
. (PlutusTx.IsData s)
. (PlutusTx.FromData s, PlutusTx.ToData s)
=> SM.StateMachineInstance s i
-> Map Tx.TxOutRef Tx.TxOutTx
-> [OnChainState s i]
Expand Down Expand Up @@ -197,7 +197,8 @@ mkStateMachineClient inst =
-}
getOnChainState ::
( AsSMContractError e
, PlutusTx.IsData state
, PlutusTx.FromData state
, PlutusTx.ToData state
)
=> StateMachineClient state i
-> Contract w schema e (Maybe (OnChainState state i, UtxoMap))
Expand Down Expand Up @@ -227,7 +228,8 @@ data WaitingResult a
waitForUpdateUntilSlot ::
( AsSMContractError e
, AsContractError e
, PlutusTx.IsData state
, PlutusTx.FromData state
, PlutusTx.ToData state
)
=> StateMachineClient state i
-> Slot
Expand Down Expand Up @@ -259,7 +261,8 @@ waitForUpdateUntilSlot StateMachineClient{scInstance, scChooser} timeoutSlot = d
waitForUpdateUntilTime ::
( AsSMContractError e
, AsContractError e
, PlutusTx.IsData state
, PlutusTx.FromData state
, PlutusTx.ToData state
)
=> StateMachineClient state i
-> POSIXTime
Expand All @@ -275,7 +278,8 @@ waitForUpdateUntilTime sm timeoutTime = do
waitForUpdate ::
( AsSMContractError e
, AsContractError e
, PlutusTx.IsData state
, PlutusTx.FromData state
, PlutusTx.ToData state
)
=> StateMachineClient state i
-> Contract w schema e (Maybe (OnChainState state i))
Expand All @@ -293,8 +297,9 @@ waitForUpdate StateMachineClient{scInstance, scChooser} = do
runGuardedStep ::
forall w a e state schema input.
( AsSMContractError e
, PlutusTx.IsData state
, PlutusTx.IsData input
, PlutusTx.FromData state
, PlutusTx.ToData state
, PlutusTx.ToData input
)
=> StateMachineClient state input -- ^ The state machine
-> input -- ^ The input to apply to the state machine
Expand All @@ -306,8 +311,9 @@ runGuardedStep = runGuardedStepWith mempty mempty
runStep ::
forall w e state schema input.
( AsSMContractError e
, PlutusTx.IsData state
, PlutusTx.IsData input
, PlutusTx.FromData state
, PlutusTx.ToData state
, PlutusTx.ToData input
)
=> StateMachineClient state input
-- ^ The state machine
Expand All @@ -327,8 +333,9 @@ getThreadToken = mapError (review _SMContractError) $ do
-- | Initialise a state machine
runInitialise ::
forall w e state schema input.
( PlutusTx.IsData state
, PlutusTx.IsData input
( PlutusTx.FromData state
, PlutusTx.ToData state
, PlutusTx.ToData input
, AsSMContractError e
)
=> StateMachineClient state input
Expand All @@ -352,8 +359,9 @@ data StateMachineTransition state input =
-- | Initialise a state machine and supply additional constraints and lookups for transaction.
runInitialiseWith ::
forall w e state schema input.
( PlutusTx.IsData state
, PlutusTx.IsData input
( PlutusTx.FromData state
, PlutusTx.ToData state
, PlutusTx.ToData input
, AsSMContractError e
)
=> ScriptLookups (StateMachine state input)
Expand Down Expand Up @@ -390,8 +398,9 @@ runInitialiseWith customLookups customConstraints StateMachineClient{scInstance}
runStepWith ::
forall w e state schema input.
( AsSMContractError e
, PlutusTx.IsData state
, PlutusTx.IsData input
, PlutusTx.FromData state
, PlutusTx.ToData state
, PlutusTx.ToData input
)
=> ScriptLookups (StateMachine state input)
-- ^ Additional lookups
Expand All @@ -411,8 +420,9 @@ runStepWith lookups constraints smc input =
runGuardedStepWith ::
forall w a e state schema input.
( AsSMContractError e
, PlutusTx.IsData state
, PlutusTx.IsData input
, PlutusTx.FromData state
, PlutusTx.ToData state
, PlutusTx.ToData input
)
=> ScriptLookups (StateMachine state input) -- ^ Additional lookups
-> TxConstraints input state -- ^ Additional constraints
Expand All @@ -438,7 +448,8 @@ runGuardedStepWith userLookups userConstraints smc input guard = mapError (revie
mkStep ::
forall w e state schema input.
( AsSMContractError e
, PlutusTx.IsData state
, PlutusTx.FromData state
, PlutusTx.ToData state
)
=> StateMachineClient state input
-> input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ machineAddress = validatorAddress . typedValidator

{-# INLINABLE mkValidator #-}
-- | Turn a state machine into a validator script.
mkValidator :: forall s i. (PlutusTx.IsData s) => StateMachine s i -> ValidatorType (StateMachine s i)
mkValidator :: forall s i. (PlutusTx.ToData s) => StateMachine s i -> ValidatorType (StateMachine s i)
mkValidator (StateMachine step isFinal check threadToken) currentState input ptx =
let vl = maybe (error ()) (txOutValue . txInInfoResolved) (findOwnInput ptx)
checkOk =
Expand Down
4 changes: 2 additions & 2 deletions plutus-contract/src/Plutus/Contract/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ import qualified Plutus.Contract.Request as Request
import Plutus.Contract.Resumable (Request (..), Response (..))
import qualified Plutus.Contract.Resumable as State
import Plutus.Contract.Types (Contract (..), ResumableResult, shrinkResumableResult)
import PlutusTx (CompiledCode, IsData (..), getPir)
import PlutusTx (CompiledCode, FromData (..), getPir)
import qualified PlutusTx.Prelude as P

import Ledger (Validator)
Expand Down Expand Up @@ -339,7 +339,7 @@ valueAtAddress address check =
tell @(Doc Void) ("Funds at address" <+> pretty address <+> "were" <+> pretty vl)
pure result

dataAtAddress :: IsData a => Address -> (a -> Bool) -> TracePredicate
dataAtAddress :: FromData a => Address -> (a -> Bool) -> TracePredicate
dataAtAddress address check =
flip postMapM (L.generalize $ Folds.utxoAtAddress address) $ \utxo -> do
let isSingletonWith p xs = length xs == 1 && all p xs
Expand Down
2 changes: 1 addition & 1 deletion plutus-ledger-api/src/Plutus/V1/Ledger/Ada.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ newtype Ada = Lovelace { getLovelace :: Integer }
deriving (Haskell.Enum)
deriving stock (Haskell.Eq, Haskell.Ord, Haskell.Show, Generic)
deriving anyclass (ToJSON, FromJSON)
deriving newtype (Eq, Ord, Haskell.Num, AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, MultiplicativeSemigroup, MultiplicativeMonoid, Haskell.Integral, Haskell.Real, Serialise, PlutusTx.IsData)
deriving newtype (Eq, Ord, Haskell.Num, AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, MultiplicativeSemigroup, MultiplicativeMonoid, Haskell.Integral, Haskell.Real, Serialise, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving Pretty via (Tagged "Lovelace:" Integer)

instance Haskell.Semigroup Ada where
Expand Down
7 changes: 5 additions & 2 deletions plutus-ledger-api/src/Plutus/V1/Ledger/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ module Plutus.V1.Ledger.Api (
-- * Data
, PLC.Data (..)
, BuiltinData (..)
, IsData (..)
, ToData (..)
, FromData (..)
, UnsafeFromData (..)
, toData
, fromData
, dataToBuiltinData
Expand Down Expand Up @@ -137,7 +139,8 @@ import qualified PlutusCore.Evaluation.Machine.ExBudget as PLC
import PlutusCore.Evaluation.Machine.ExMemory (ExCPU (..), ExMemory (..))
import PlutusCore.Evaluation.Machine.MachineParameters
import PlutusCore.Pretty
import PlutusTx (IsData (..), fromData, toData)
import PlutusTx (FromData (..), ToData (..), UnsafeFromData (..),
fromData, toData)
import PlutusTx.Builtins.Internal (BuiltinData (..), builtinDataToData,
dataToBuiltinData)
import qualified UntypedPlutusCore as UPLC
Expand Down
2 changes: 1 addition & 1 deletion plutus-ledger-api/src/Plutus/V1/Ledger/Bytes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fromHex = fmap LedgerBytes . asBSLiteral
-- type for PureScript.
newtype LedgerBytes = LedgerBytes { getLedgerBytes :: Builtins.ByteString } -- TODO: use strict bytestring
deriving stock (Eq, Ord, Generic)
deriving newtype (Serialise, P.Eq, P.Ord, PlutusTx.IsData)
deriving newtype (Serialise, P.Eq, P.Ord, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving anyclass (JSON.ToJSONKey, JSON.FromJSONKey, NFData)
deriving Pretty via (PrettyShow LedgerBytes)

Expand Down
8 changes: 4 additions & 4 deletions plutus-ledger-api/src/Plutus/V1/Ledger/Crypto.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import qualified PlutusTx.Prelude as P
newtype PubKey = PubKey { getPubKey :: LedgerBytes }
deriving stock (Eq, Ord, Generic)
deriving anyclass (Newtype, ToJSON, FromJSON, NFData)
deriving newtype (P.Eq, P.Ord, Serialise, PlutusTx.IsData)
deriving newtype (P.Eq, P.Ord, Serialise, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving IsString via LedgerBytes
deriving (Show, Pretty) via LedgerBytes
makeLift ''PubKey
Expand All @@ -78,7 +78,7 @@ instance FromJSONKey PubKey where
newtype PubKeyHash = PubKeyHash { getPubKeyHash :: BS.ByteString }
deriving stock (Eq, Ord, Generic)
deriving anyclass (ToJSON, FromJSON, Newtype, ToJSONKey, FromJSONKey, NFData)
deriving newtype (P.Eq, P.Ord, Serialise, PlutusTx.IsData, Hashable)
deriving newtype (P.Eq, P.Ord, Serialise, Hashable, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving IsString via LedgerBytes
deriving (Show, Pretty) via LedgerBytes
makeLift ''PubKeyHash
Expand All @@ -94,15 +94,15 @@ pubKeyHash (PubKey (LedgerBytes bs)) =
newtype PrivateKey = PrivateKey { getPrivateKey :: LedgerBytes }
deriving stock (Eq, Ord, Generic)
deriving anyclass (ToJSON, FromJSON, Newtype, ToJSONKey, FromJSONKey)
deriving newtype (P.Eq, P.Ord, Serialise, PlutusTx.IsData)
deriving newtype (P.Eq, P.Ord, Serialise, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving (Show, Pretty) via LedgerBytes

makeLift ''PrivateKey

-- | A message with a cryptographic signature.
newtype Signature = Signature { getSignature :: Builtins.ByteString }
deriving stock (Eq, Ord, Generic)
deriving newtype (P.Eq, P.Ord, Serialise, PlutusTx.IsData, NFData)
deriving newtype (P.Eq, P.Ord, Serialise, NFData, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving (Show, Pretty) via LedgerBytes

instance ToJSON Signature where
Expand Down
17 changes: 9 additions & 8 deletions plutus-ledger-api/src/Plutus/V1/Ledger/Scripts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ import qualified PlutusCore.Data as PLC
import qualified PlutusCore.DeBruijn as PLC
import qualified PlutusCore.Evaluation.Machine.ExBudget as PLC
import qualified PlutusCore.MkPlc as PLC
import PlutusTx (CompiledCode, IsData (..), getPlc, makeLift)
import PlutusTx (CompiledCode, FromData (..), ToData (..),
UnsafeFromData (..), getPlc, makeLift)
import PlutusTx.Builtins as Builtins
import PlutusTx.Builtins.Internal as BI
import PlutusTx.Evaluation (ErrorWithCause (..), EvaluationError (..), evaluateCekTrace)
Expand Down Expand Up @@ -244,7 +245,7 @@ instance BA.ByteArrayAccess Validator where
-- | 'Datum' is a wrapper around 'Data' values which are used as data in transaction outputs.
newtype Datum = Datum { getDatum :: BuiltinData }
deriving stock (Generic, Haskell.Show)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, IsData)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, ToData, FromData, UnsafeFromData)
deriving (ToJSON, FromJSON, Serialise, NFData) via PLC.Data
deriving Pretty via PLC.Data

Expand Down Expand Up @@ -287,31 +288,31 @@ newtype ValidatorHash =
ValidatorHash Builtins.ByteString
deriving (IsString, Haskell.Show, Serialise, Pretty) via LedgerBytes
deriving stock (Generic)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, Hashable, IsData)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, Hashable, ToData, FromData, UnsafeFromData)
deriving anyclass (FromJSON, ToJSON, ToJSONKey, FromJSONKey, NFData)

-- | Script runtime representation of a @Digest SHA256@.
newtype DatumHash =
DatumHash Builtins.ByteString
deriving (IsString, Haskell.Show, Serialise, Pretty) via LedgerBytes
deriving stock (Generic)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, Hashable, IsData, NFData)
deriving anyclass (FromJSON, ToJSON, ToJSONKey, FromJSONKey)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, Hashable, ToData, FromData, UnsafeFromData)
deriving anyclass (FromJSON, ToJSON, ToJSONKey, FromJSONKey, NFData)

-- | Script runtime representation of a @Digest SHA256@.
newtype RedeemerHash =
RedeemerHash Builtins.ByteString
deriving (IsString, Haskell.Show, Serialise, Pretty) via LedgerBytes
deriving stock (Generic)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, Hashable, IsData)
deriving anyclass (FromJSON, ToJSON, ToJSONKey, FromJSONKey)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, Hashable, ToData, FromData, UnsafeFromData)
deriving anyclass (FromJSON, ToJSON, ToJSONKey, FromJSONKey, NFData)

-- | Script runtime representation of a @Digest SHA256@.
newtype MintingPolicyHash =
MintingPolicyHash Builtins.ByteString
deriving (IsString, Haskell.Show, Serialise, Pretty) via LedgerBytes
deriving stock (Generic)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, Hashable, IsData)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, Hashable, ToData, FromData, UnsafeFromData)
deriving anyclass (FromJSON, ToJSON, ToJSONKey, FromJSONKey)

datumHash :: Datum -> DatumHash
Expand Down
2 changes: 1 addition & 1 deletion plutus-ledger-api/src/Plutus/V1/Ledger/Slot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import Plutus.V1.Ledger.Interval
newtype Slot = Slot { getSlot :: Integer }
deriving stock (Haskell.Eq, Haskell.Ord, Haskell.Show, Generic)
deriving anyclass (FromJSON, FromJSONKey, ToJSON, ToJSONKey, NFData)
deriving newtype (AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, Eq, Ord, Enum, PlutusTx.IsData)
deriving newtype (AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, Eq, Ord, Enum, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving newtype (Haskell.Num, Haskell.Enum, Haskell.Real, Haskell.Integral, Serialise, Hashable)

makeLift ''Slot
Expand Down
4 changes: 2 additions & 2 deletions plutus-ledger-api/src/Plutus/V1/Ledger/Time.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ import qualified Prelude as Haskell
newtype DiffMilliSeconds = DiffMilliSeconds Integer
deriving stock (Haskell.Eq, Haskell.Ord, Haskell.Show, Generic)
deriving anyclass (FromJSON, FromJSONKey, ToJSON, ToJSONKey, NFData)
deriving newtype (Haskell.Num, AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, Haskell.Enum, Eq, Ord, Haskell.Real, Haskell.Integral, Serialise, Hashable, PlutusTx.IsData)
deriving newtype (Haskell.Num, AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, Haskell.Enum, Eq, Ord, Haskell.Real, Haskell.Integral, Serialise, Hashable, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)

makeLift ''DiffMilliSeconds

-- | POSIX time is measured as the number of milliseconds since 1970-01-01T00:00:00Z
newtype POSIXTime = POSIXTime { getPOSIXTime :: Integer }
deriving stock (Haskell.Eq, Haskell.Ord, Haskell.Show, Generic)
deriving anyclass (FromJSONKey, ToJSONKey, NFData)
deriving newtype (AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, Eq, Ord, Enum, PlutusTx.IsData)
deriving newtype (AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, Eq, Ord, Enum, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving newtype (Haskell.Num, Haskell.Enum, Haskell.Real, Haskell.Integral, Serialise, Hashable)

-- | Custom `FromJSON` instance which allows to parse a JSON number to a
Expand Down
8 changes: 4 additions & 4 deletions plutus-ledger-api/src/Plutus/V1/Ledger/Value.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import PlutusTx.These
newtype CurrencySymbol = CurrencySymbol { unCurrencySymbol :: Builtins.ByteString }
deriving (IsString, Haskell.Show, Serialise, Pretty) via LedgerBytes
deriving stock (Generic)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, PlutusTx.IsData)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving anyclass (Hashable, ToJSONKey, FromJSONKey, NFData)

instance ToJSON CurrencySymbol where
Expand Down Expand Up @@ -122,7 +122,7 @@ currencySymbol = CurrencySymbol
newtype TokenName = TokenName { unTokenName :: Builtins.ByteString }
deriving (Serialise) via LedgerBytes
deriving stock (Generic)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, PlutusTx.IsData)
deriving newtype (Haskell.Eq, Haskell.Ord, Eq, Ord, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving anyclass (Hashable, NFData)
deriving Pretty via (PrettyShow TokenName)

Expand Down Expand Up @@ -182,7 +182,7 @@ tokenName = TokenName
-- | An asset class, identified by currency symbol and token name.
newtype AssetClass = AssetClass { unAssetClass :: (CurrencySymbol, TokenName) }
deriving stock (Generic)
deriving newtype (Haskell.Eq, Haskell.Ord, Haskell.Show, Eq, Ord, PlutusTx.IsData, Serialise)
deriving newtype (Haskell.Eq, Haskell.Ord, Haskell.Show, Eq, Ord, Serialise, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving anyclass (Hashable, NFData, ToJSON, FromJSON)
deriving Pretty via (PrettyShow (CurrencySymbol, TokenName))

Expand Down Expand Up @@ -210,7 +210,7 @@ makeLift ''AssetClass
newtype Value = Value { getValue :: Map.Map CurrencySymbol (Map.Map TokenName Integer) }
deriving stock (Generic)
deriving anyclass (ToJSON, FromJSON, Hashable, NFData)
deriving newtype (Serialise, PlutusTx.IsData)
deriving newtype (Serialise, PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
deriving Pretty via (PrettyShow Value)

instance Haskell.Show Value where
Expand Down
Loading

0 comments on commit 5fa8498

Please sign in to comment.