refactor Spec.Sample.Shared with bridges
This commit is contained in:
parent
62bd2dee28
commit
f62189c38d
2 changed files with 14 additions and 26 deletions
|
|
@ -12,6 +12,7 @@ module Spec.Proposal (tests) where
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
import Agora.Proposal (
|
import Agora.Proposal (
|
||||||
|
Proposal (..),
|
||||||
ProposalDatum (ProposalDatum),
|
ProposalDatum (ProposalDatum),
|
||||||
ProposalId (ProposalId),
|
ProposalId (ProposalId),
|
||||||
ProposalRedeemer (Cosign),
|
ProposalRedeemer (Cosign),
|
||||||
|
|
@ -49,7 +50,7 @@ tests =
|
||||||
"policy"
|
"policy"
|
||||||
[ policySucceedsWith
|
[ policySucceedsWith
|
||||||
"proposalCreation"
|
"proposalCreation"
|
||||||
(proposalPolicy Shared.proposal)
|
(proposalPolicy Shared.proposal.governorSTAssetClass)
|
||||||
()
|
()
|
||||||
Proposal.proposalCreation
|
Proposal.proposalCreation
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -38,22 +38,22 @@ import Agora.Governor (
|
||||||
import Agora.Governor.Scripts (
|
import Agora.Governor.Scripts (
|
||||||
governorPolicy,
|
governorPolicy,
|
||||||
governorValidator,
|
governorValidator,
|
||||||
|
proposalFromGovernor,
|
||||||
|
proposalSTSymbolFromGovernor,
|
||||||
|
proposalValidatorHashFromGovernor,
|
||||||
|
stakeFromGovernor,
|
||||||
|
stakeSTSymbolFromGovernor,
|
||||||
|
stakeValidatorHashFromGovernor,
|
||||||
)
|
)
|
||||||
import Agora.Proposal (
|
import Agora.Proposal (
|
||||||
Proposal (..),
|
Proposal (..),
|
||||||
ProposalThresholds (..),
|
ProposalThresholds (..),
|
||||||
)
|
)
|
||||||
import Agora.Proposal.Scripts (
|
|
||||||
proposalPolicy,
|
|
||||||
proposalValidator,
|
|
||||||
)
|
|
||||||
import Agora.Stake (Stake (..))
|
import Agora.Stake (Stake (..))
|
||||||
import Agora.Stake.Scripts (stakePolicy, stakeValidator)
|
|
||||||
import Plutarch.Api.V1 (
|
import Plutarch.Api.V1 (
|
||||||
mintingPolicySymbol,
|
mintingPolicySymbol,
|
||||||
mkMintingPolicy,
|
mkMintingPolicy,
|
||||||
mkValidator,
|
mkValidator,
|
||||||
validatorHash,
|
|
||||||
)
|
)
|
||||||
import Plutarch.SafeMoney
|
import Plutarch.SafeMoney
|
||||||
import Plutus.V1.Ledger.Address (scriptHashAddress)
|
import Plutus.V1.Ledger.Address (scriptHashAddress)
|
||||||
|
|
@ -71,21 +71,13 @@ import Plutus.V1.Ledger.Value qualified as Value
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
stake :: Stake
|
stake :: Stake
|
||||||
stake =
|
stake = stakeFromGovernor governor
|
||||||
Stake
|
|
||||||
{ gtClassRef =
|
|
||||||
Tagged $
|
|
||||||
Value.assetClass
|
|
||||||
"da8c30857834c6ae7203935b89278c532b3995245295456f993e1d24"
|
|
||||||
"LQ"
|
|
||||||
, proposalSTClass = Value.assetClass proposalPolicySymbol ""
|
|
||||||
}
|
|
||||||
|
|
||||||
stakeSymbol :: CurrencySymbol
|
stakeSymbol :: CurrencySymbol
|
||||||
stakeSymbol = mintingPolicySymbol $ mkMintingPolicy $ stakePolicy stake.gtClassRef
|
stakeSymbol = stakeSTSymbolFromGovernor governor
|
||||||
|
|
||||||
stakeValidatorHash :: ValidatorHash
|
stakeValidatorHash :: ValidatorHash
|
||||||
stakeValidatorHash = validatorHash $ mkValidator (stakeValidator stake)
|
stakeValidatorHash = stakeValidatorHashFromGovernor governor
|
||||||
|
|
||||||
stakeAddress :: Address
|
stakeAddress :: Address
|
||||||
stakeAddress = Address (ScriptCredential stakeValidatorHash) Nothing
|
stakeAddress = Address (ScriptCredential stakeValidatorHash) Nothing
|
||||||
|
|
@ -111,15 +103,10 @@ govSymbol :: CurrencySymbol
|
||||||
govSymbol = mintingPolicySymbol govPolicy
|
govSymbol = mintingPolicySymbol govPolicy
|
||||||
|
|
||||||
proposal :: Proposal
|
proposal :: Proposal
|
||||||
proposal =
|
proposal = proposalFromGovernor governor
|
||||||
Proposal
|
|
||||||
{ governorSTAssetClass = Value.assetClass govSymbol ""
|
|
||||||
, stakeSTAssetClass = Value.assetClass stakeSymbol ""
|
|
||||||
, maximumCosigners = 6
|
|
||||||
}
|
|
||||||
|
|
||||||
proposalPolicySymbol :: CurrencySymbol
|
proposalPolicySymbol :: CurrencySymbol
|
||||||
proposalPolicySymbol = mintingPolicySymbol $ mkMintingPolicy (proposalPolicy proposal.governorSTAssetClass)
|
proposalPolicySymbol = proposalSTSymbolFromGovernor governor
|
||||||
|
|
||||||
-- | A sample 'PubKeyHash'.
|
-- | A sample 'PubKeyHash'.
|
||||||
signer :: PubKeyHash
|
signer :: PubKeyHash
|
||||||
|
|
@ -130,7 +117,7 @@ signer2 :: PubKeyHash
|
||||||
signer2 = "8a30896c4fd5e79843e4ca1bd2cdbaa36f8c0bc3be74012141420192"
|
signer2 = "8a30896c4fd5e79843e4ca1bd2cdbaa36f8c0bc3be74012141420192"
|
||||||
|
|
||||||
proposalValidatorHash :: ValidatorHash
|
proposalValidatorHash :: ValidatorHash
|
||||||
proposalValidatorHash = validatorHash (mkValidator $ proposalValidator proposal)
|
proposalValidatorHash = proposalValidatorHashFromGovernor governor
|
||||||
|
|
||||||
proposalValidatorAddress :: Address
|
proposalValidatorAddress :: Address
|
||||||
proposalValidatorAddress = scriptHashAddress proposalValidatorHash
|
proposalValidatorAddress = scriptHashAddress proposalValidatorHash
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue