From f0ad482c621646b9483c89d1a953b615c2240991 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Thu, 10 Oct 2024 10:18:16 +0000 Subject: [PATCH 1/2] hydra-plutus: Remove unused functions --- hydra-plutus/src/Hydra/Contract/Head.hs | 15 --------------- hydra-plutus/src/Hydra/ScriptContext.hs | 6 ------ 2 files changed, 21 deletions(-) diff --git a/hydra-plutus/src/Hydra/Contract/Head.hs b/hydra-plutus/src/Hydra/Contract/Head.hs index ddb514057fa..eeec4fac1b0 100644 --- a/hydra-plutus/src/Hydra/Contract/Head.hs +++ b/hydra-plutus/src/Hydra/Contract/Head.hs @@ -22,7 +22,6 @@ import Hydra.Data.Party (Party (vkey)) import Hydra.Plutus.Extras (ValidatorType, scriptValidatorHash, wrapValidator) import PlutusLedgerApi.Common (SerialisedScript, serialiseCompiledCode) import PlutusLedgerApi.V1.Time (fromMilliSeconds) -import PlutusLedgerApi.V1.Value (valueOf) import PlutusLedgerApi.V2 ( Address, CurrencySymbol, @@ -44,8 +43,6 @@ import PlutusLedgerApi.V2 ( TxOutRef (..), UpperBound (..), Value (Value), - adaSymbol, - adaToken, ) import PlutusLedgerApi.V2.Contexts (findOwnInput) import PlutusTx (CompiledCode) @@ -542,18 +539,6 @@ checkFanout ScriptContext{scriptContextTxInfo = txInfo} closedDatum numberOfFano -- Helpers -------------------------------------------------------------------------------- -(&) :: a -> (a -> b) -> b -(&) = flip ($) -{-# INLINEABLE (&) #-} - -txOutAdaValue :: TxOut -> Integer -txOutAdaValue o = valueOf (txOutValue o) adaSymbol adaToken -{-# INLINEABLE txOutAdaValue #-} - -txInfoAdaFee :: TxInfo -> Integer -txInfoAdaFee tx = valueOf (txInfoFee tx) adaSymbol adaToken -{-# INLINEABLE txInfoAdaFee #-} - makeContestationDeadline :: ContestationPeriod -> ScriptContext -> POSIXTime makeContestationDeadline cperiod ScriptContext{scriptContextTxInfo} = case ivTo (txInfoValidRange scriptContextTxInfo) of diff --git a/hydra-plutus/src/Hydra/ScriptContext.hs b/hydra-plutus/src/Hydra/ScriptContext.hs index 0564eb32a0d..009c296fcc4 100644 --- a/hydra-plutus/src/Hydra/ScriptContext.hs +++ b/hydra-plutus/src/Hydra/ScriptContext.hs @@ -28,7 +28,6 @@ import PlutusLedgerApi.V2 ( Value, ) import PlutusTx (makeIsDataIndexed) -import PlutusTx.AssocMap (lookup) -- * Tx info @@ -99,11 +98,6 @@ findOwnInput ScriptContext{scriptContextTxInfo = TxInfo{txInfoInputs}, scriptCon findOwnInput _ = Nothing {-# INLINEABLE findOwnInput #-} --- | Find the data corresponding to a data hash, if there is one -findDatum :: DatumHash -> TxInfo -> Maybe Datum -findDatum dsh TxInfo{txInfoData} = lookup dsh txInfoData -{-# INLINEABLE findDatum #-} - -- | Given a UTXO reference and a transaction (`TxInfo`), resolve it to one of the transaction's inputs (`TxInInfo`). findTxInByTxOutRef :: TxOutRef -> TxInfo -> Maybe TxInInfo findTxInByTxOutRef outRef TxInfo{txInfoInputs} = From d45c7fe416a5efbebaa155ab8d018ffa6a65fdf6 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Thu, 10 Oct 2024 10:24:51 +0000 Subject: [PATCH 2/2] Add Spec.main as weeder root --- weeder.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weeder.toml b/weeder.toml index 4215e181265..4395dbd0fe6 100644 --- a/weeder.toml +++ b/weeder.toml @@ -1,2 +1,2 @@ -roots = [ "^Main.main$" ] +roots = [ "^Main.main$" ,"^Spec.main$" ] type-class-roots = true