remove outdated test cases
This commit is contained in:
parent
20497fcfe3
commit
1557067b76
2 changed files with 1 additions and 82 deletions
|
|
@ -11,9 +11,6 @@ module Sample.Stake (
|
||||||
signer,
|
signer,
|
||||||
|
|
||||||
-- * Script contexts
|
-- * Script contexts
|
||||||
stakeCreation,
|
|
||||||
stakeCreationWrongDatum,
|
|
||||||
stakeCreationUnsigned,
|
|
||||||
stakeDepositWithdraw,
|
stakeDepositWithdraw,
|
||||||
DepositWithdrawExample (..),
|
DepositWithdrawExample (..),
|
||||||
) where
|
) where
|
||||||
|
|
@ -25,36 +22,24 @@ import Agora.Stake (
|
||||||
)
|
)
|
||||||
import Data.Tagged (Tagged)
|
import Data.Tagged (Tagged)
|
||||||
import Plutarch.Context (
|
import Plutarch.Context (
|
||||||
MintingBuilder,
|
|
||||||
SpendingBuilder,
|
SpendingBuilder,
|
||||||
buildMinting',
|
|
||||||
buildSpending',
|
buildSpending',
|
||||||
input,
|
input,
|
||||||
mint,
|
|
||||||
output,
|
output,
|
||||||
script,
|
script,
|
||||||
signedWith,
|
signedWith,
|
||||||
txId,
|
txId,
|
||||||
withDatum,
|
withDatum,
|
||||||
withMinting,
|
|
||||||
withRef,
|
withRef,
|
||||||
withSpendingOutRef,
|
withSpendingOutRef,
|
||||||
withValue,
|
withValue,
|
||||||
)
|
)
|
||||||
import Plutarch.Extra.AssetClass (assetClassValue)
|
import Plutarch.Extra.AssetClass (assetClassValue)
|
||||||
import PlutusLedgerApi.V1.Contexts (TxOutRef (..))
|
import PlutusLedgerApi.V1.Contexts (TxOutRef (..))
|
||||||
import PlutusLedgerApi.V1.Value qualified as Value (
|
|
||||||
singleton,
|
|
||||||
)
|
|
||||||
import PlutusLedgerApi.V2 (
|
import PlutusLedgerApi.V2 (
|
||||||
Credential (PubKeyCredential),
|
Credential (PubKeyCredential),
|
||||||
Datum (Datum),
|
|
||||||
ScriptContext (..),
|
ScriptContext (..),
|
||||||
ScriptPurpose (Minting),
|
|
||||||
ToData (toBuiltinData),
|
|
||||||
TxInfo (txInfoData, txInfoSignatories),
|
|
||||||
)
|
)
|
||||||
import PlutusTx.AssocMap qualified as AssocMap
|
|
||||||
import Sample.Shared (
|
import Sample.Shared (
|
||||||
governor,
|
governor,
|
||||||
signer,
|
signer,
|
||||||
|
|
@ -64,52 +49,6 @@ import Sample.Shared (
|
||||||
)
|
)
|
||||||
import Test.Util (sortValue)
|
import Test.Util (sortValue)
|
||||||
|
|
||||||
-- | This script context should be a valid transaction.
|
|
||||||
stakeCreation :: ScriptContext
|
|
||||||
stakeCreation =
|
|
||||||
let st = assetClassValue stakeAssetClass 1 -- Stake ST
|
|
||||||
datum :: StakeDatum
|
|
||||||
datum = StakeDatum 424242424242 (PubKeyCredential signer) Nothing []
|
|
||||||
|
|
||||||
builder :: MintingBuilder
|
|
||||||
builder =
|
|
||||||
mconcat
|
|
||||||
[ txId "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be"
|
|
||||||
, signedWith signer
|
|
||||||
, mint st
|
|
||||||
, output $
|
|
||||||
mconcat
|
|
||||||
[ script stakeValidatorHash
|
|
||||||
, withValue (st <> Value.singleton "da8c30857834c6ae7203935b89278c532b3995245295456f993e1d24" "LQ" 424242424242)
|
|
||||||
, withDatum datum
|
|
||||||
]
|
|
||||||
, withMinting stakeSymbol
|
|
||||||
]
|
|
||||||
in buildMinting' builder
|
|
||||||
|
|
||||||
-- | This ScriptContext should fail because the datum has too much GT.
|
|
||||||
stakeCreationWrongDatum :: ScriptContext
|
|
||||||
stakeCreationWrongDatum =
|
|
||||||
let datum :: Datum
|
|
||||||
datum = Datum (toBuiltinData $ StakeDatum 4242424242424242 (PubKeyCredential signer) Nothing []) -- Too much GT
|
|
||||||
in ScriptContext
|
|
||||||
{ scriptContextTxInfo = stakeCreation.scriptContextTxInfo {txInfoData = AssocMap.fromList [("", datum)]}
|
|
||||||
, scriptContextPurpose = Minting stakeSymbol
|
|
||||||
}
|
|
||||||
|
|
||||||
-- | This ScriptContext should fail because the datum has too much GT.
|
|
||||||
stakeCreationUnsigned :: ScriptContext
|
|
||||||
stakeCreationUnsigned =
|
|
||||||
ScriptContext
|
|
||||||
{ scriptContextTxInfo =
|
|
||||||
stakeCreation.scriptContextTxInfo
|
|
||||||
{ txInfoSignatories = []
|
|
||||||
}
|
|
||||||
, scriptContextPurpose = Minting stakeSymbol
|
|
||||||
}
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- | Config for creating a ScriptContext that deposits or withdraws.
|
-- | Config for creating a ScriptContext that deposits or withdraws.
|
||||||
data DepositWithdrawExample = DepositWithdrawExample
|
data DepositWithdrawExample = DepositWithdrawExample
|
||||||
{ startAmount :: Tagged GTTag Integer
|
{ startAmount :: Tagged GTTag Integer
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import Agora.Stake (
|
||||||
StakeRedeemer (DepositWithdraw),
|
StakeRedeemer (DepositWithdraw),
|
||||||
)
|
)
|
||||||
import PlutusLedgerApi.V1 (Credential (PubKeyCredential))
|
import PlutusLedgerApi.V1 (Credential (PubKeyCredential))
|
||||||
import Sample.Shared (stakePolicy, stakeValidator)
|
import Sample.Shared (stakeValidator)
|
||||||
import Sample.Stake (
|
import Sample.Stake (
|
||||||
DepositWithdrawExample (
|
DepositWithdrawExample (
|
||||||
DepositWithdrawExample,
|
DepositWithdrawExample,
|
||||||
|
|
@ -24,9 +24,6 @@ import Sample.Stake (
|
||||||
signer,
|
signer,
|
||||||
)
|
)
|
||||||
import Sample.Stake qualified as Stake (
|
import Sample.Stake qualified as Stake (
|
||||||
stakeCreation,
|
|
||||||
stakeCreationUnsigned,
|
|
||||||
stakeCreationWrongDatum,
|
|
||||||
stakeDepositWithdraw,
|
stakeDepositWithdraw,
|
||||||
)
|
)
|
||||||
import Sample.Stake.Create qualified as Create
|
import Sample.Stake.Create qualified as Create
|
||||||
|
|
@ -34,8 +31,6 @@ import Sample.Stake.SetDelegate qualified as SetDelegate
|
||||||
import Test.Specification (
|
import Test.Specification (
|
||||||
SpecificationTree,
|
SpecificationTree,
|
||||||
group,
|
group,
|
||||||
policyFailsWith,
|
|
||||||
policySucceedsWith,
|
|
||||||
validatorFailsWith,
|
validatorFailsWith,
|
||||||
validatorSucceedsWith,
|
validatorSucceedsWith,
|
||||||
)
|
)
|
||||||
|
|
@ -94,21 +89,6 @@ specs =
|
||||||
False
|
False
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, policySucceedsWith
|
|
||||||
"stakeCreation"
|
|
||||||
stakePolicy
|
|
||||||
()
|
|
||||||
Stake.stakeCreation
|
|
||||||
, policyFailsWith
|
|
||||||
"stakeCreationWrongDatum"
|
|
||||||
stakePolicy
|
|
||||||
()
|
|
||||||
Stake.stakeCreationWrongDatum
|
|
||||||
, policyFailsWith
|
|
||||||
"stakeCreationUnsigned"
|
|
||||||
stakePolicy
|
|
||||||
()
|
|
||||||
Stake.stakeCreationUnsigned
|
|
||||||
]
|
]
|
||||||
, group
|
, group
|
||||||
"validator"
|
"validator"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue