Skip to content

Commit

Permalink
Remove mkCurrencySymbolUnsafe, use constructor instead
Browse files Browse the repository at this point in the history
  • Loading branch information
kozross committed Sep 26, 2023
1 parent 008ce4f commit 08baebd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
7 changes: 1 addition & 6 deletions src/Internal/Plutus/Types/CurrencySymbol.purs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module Ctl.Internal.Plutus.Types.CurrencySymbol
( CurrencySymbol
( CurrencySymbol(CurrencySymbol)
, adaSymbol
, currencyMPSHash
, getCurrencySymbol
, mkCurrencySymbol
, mkCurrencySymbolUnsafe
, mpsSymbol
, scriptHashAsCurrencySymbol
) where
Expand Down Expand Up @@ -99,10 +98,6 @@ mkCurrencySymbol byteArr
| otherwise =
scriptHashFromBytes byteArr $> CurrencySymbol byteArr

-- | Bypasses the usual checks of mkCurrencySymbol: use with extreme care!
mkCurrencySymbolUnsafe :: ByteArray -> CurrencySymbol
mkCurrencySymbolUnsafe = CurrencySymbol

--------------------------------------------------------------------------------
-- Internal
--------------------------------------------------------------------------------
Expand Down
6 changes: 2 additions & 4 deletions src/Internal/Scripts.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import Prelude
import Ctl.Internal.Hashing (plutusScriptHash)
import Ctl.Internal.NativeScripts (NativeScriptHash, nativeScriptHash)
import Ctl.Internal.Plutus.Types.CurrencySymbol
( CurrencySymbol
, mkCurrencySymbolUnsafe
( CurrencySymbol(CurrencySymbol)
)
import Ctl.Internal.Serialization.Address
( Address
Expand All @@ -36,7 +35,6 @@ import Ctl.Internal.Types.Scripts
, Validator
, ValidatorHash
)
import Data.Maybe (Maybe)
import Data.Newtype (unwrap, wrap)

-- | Helpers for `PlutusScript` and `ScriptHash` newtype wrappers, separate from
Expand Down Expand Up @@ -86,7 +84,7 @@ nativeScriptStakeValidatorHash = unwrap >>> nativeScriptHash >>> unwrap >>> wrap

-- | Converts a `MintingPolicy` to a `CurrencySymbol`.
scriptCurrencySymbol :: MintingPolicy -> CurrencySymbol
scriptCurrencySymbol = mkCurrencySymbolUnsafe
scriptCurrencySymbol = CurrencySymbol
<<< unwrap
<<< scriptHashToBytes
<<< unwrap
Expand Down

0 comments on commit 08baebd

Please sign in to comment.