use liqwid-nix 2.0

This commit is contained in:
Emily Martins 2022-11-30 01:26:47 +01:00
parent b6ab3762ce
commit 7e628328da
35 changed files with 458 additions and 564 deletions

View file

@ -35,7 +35,7 @@ import Plutarch.Context (
withValue,
)
import Plutarch.Extra.AssetClass (assetClassValue)
import Plutarch.Extra.ScriptContext (validatorHashToTokenName)
import Plutarch.Extra.ScriptContext (scriptHashToTokenName)
import Plutarch.Lift (PUnsafeLiftDecl (PLifted))
import PlutusLedgerApi.V1.Value qualified as Value
import PlutusLedgerApi.V2 (
@ -49,8 +49,8 @@ import Sample.Shared (
signer,
signer2,
stakePolicy,
stakeScriptHash,
stakeSymbol,
stakeValidatorHash,
)
import Test.Specification (SpecificationTree, testPolicy)
import Test.Util (CombinableBuilder, mkMinting, validatorHashes)
@ -93,7 +93,7 @@ create ps@Parameters {stakeDatum} =
sstName =
if ps.invalidSSTName
then "114514"
else validatorHashToTokenName stakeValidatorHash
else scriptHashToTokenName stakeScriptHash
sst = Value.singleton stakeSymbol sstName 1
@ -105,7 +105,7 @@ create ps@Parameters {stakeDatum} =
stakeBuilder =
mconcat
[ script stakeValidatorHash
[ script stakeScriptHash
, withValue $ normalizeValue $ sst <> perStakeGTs
, withStakeDatum
]

View file

@ -53,9 +53,9 @@ import Sample.Shared (
signer2,
stakeAssetClass,
stakePolicy,
stakeScriptHash,
stakeSymbol,
stakeValidator,
stakeValidatorHash,
)
import Test.Specification (
SpecificationTree,
@ -125,7 +125,7 @@ destroy ps =
stakeUTxOTemplate =
mconcat
[ script stakeValidatorHash
[ script stakeScriptHash
, withDatum stakeInputDatum
, withValue $ normalizeValue $ sst <> minAda
]

View file

@ -50,8 +50,8 @@ import Sample.Shared (
signer,
signer2,
stakeAssetClass,
stakeScriptHash,
stakeValidator,
stakeValidatorHash,
)
import Test.Specification (SpecificationTree, testValidator)
import Test.Util (pubKeyHashes, sortValue)
@ -132,14 +132,14 @@ setDelegate ps = buildSpending' builder
, signedWith signer
, input $
mconcat
[ script stakeValidatorHash
[ script stakeScriptHash
, withValue stakeValue
, withDatum stakeInput
, withRef stakeRef
]
, output $
mconcat
[ script stakeValidatorHash
[ script stakeScriptHash
, withValue stakeValue
, withDatum stakeOutput
]

View file

@ -13,14 +13,14 @@ import Plutarch.Context (
withValue,
)
import Plutarch.Extra.AssetClass (assetClassValue)
import Plutarch.Extra.ScriptContext (validatorHashToTokenName)
import Plutarch.Extra.ScriptContext (scriptHashToTokenName)
import PlutusLedgerApi.V1.Value qualified as Value
import Sample.Shared (
minAda,
stakeAssetClass,
stakePolicy,
stakeScriptHash,
stakeSymbol,
stakeValidatorHash,
)
import Test.Specification (SpecificationTree, testPolicy)
import Test.Util (
@ -51,7 +51,7 @@ exploit (Parameters inputSST) =
, mint sst
, output $
mconcat
[ script stakeValidatorHash
[ script stakeScriptHash
, withValue $
normalizeValue $
minAda <> sst
@ -63,7 +63,7 @@ exploit (Parameters inputSST) =
fakeSSTValue =
Value.singleton
stakeSymbol
(validatorHashToTokenName attacker)
(scriptHashToTokenName attacker)
. fromIntegral
sst = assetClassValue stakeAssetClass 1