use liqwid-nix 2.0
This commit is contained in:
parent
b6ab3762ce
commit
7e628328da
35 changed files with 458 additions and 564 deletions
|
|
@ -2,7 +2,7 @@ module Sample.Effect.GovernorMutation (
|
|||
mkEffectTxInfo,
|
||||
effectValidator,
|
||||
effectValidatorAddress,
|
||||
effectValidatorHash,
|
||||
effectScriptHash,
|
||||
atAssetClass,
|
||||
govRef,
|
||||
effectRef,
|
||||
|
|
@ -20,9 +20,10 @@ import Agora.SafeMoney (AuthorityTokenTag)
|
|||
import Data.Default.Class (Default (def))
|
||||
import Data.Map ((!))
|
||||
import Data.Tagged (Tagged (..))
|
||||
import Plutarch.Api.V2 (validatorHash)
|
||||
import Plutarch.Api.V2 (scriptHash)
|
||||
import Plutarch.Extra.AssetClass (AssetClass (AssetClass), assetClassValue)
|
||||
import Plutarch.Extra.ScriptContext (validatorHashToTokenName)
|
||||
import Plutarch.Extra.ScriptContext (scriptHashToTokenName)
|
||||
import Plutarch.Script (Script)
|
||||
import PlutusLedgerApi.V1 qualified as Interval (always)
|
||||
import PlutusLedgerApi.V1.Address (scriptHashAddress)
|
||||
import PlutusLedgerApi.V1.Value qualified as Value (
|
||||
|
|
@ -32,14 +33,13 @@ import PlutusLedgerApi.V2 (
|
|||
Address,
|
||||
Datum (..),
|
||||
OutputDatum (OutputDatumHash),
|
||||
ScriptHash,
|
||||
ScriptPurpose (Spending),
|
||||
ToData (..),
|
||||
TxInInfo (..),
|
||||
TxInfo (..),
|
||||
TxOut (..),
|
||||
TxOutRef (TxOutRef),
|
||||
Validator (Validator),
|
||||
ValidatorHash (..),
|
||||
)
|
||||
import PlutusTx.AssocMap qualified as AssocMap
|
||||
import Sample.Shared (
|
||||
|
|
@ -54,22 +54,22 @@ import Sample.Shared (
|
|||
import Test.Util (datumPair, toDatumHash)
|
||||
|
||||
-- | The effect validator instance.
|
||||
effectValidator :: Validator
|
||||
effectValidator = Validator $ agoraScripts ! "agora:mutateGovernorValidator"
|
||||
effectValidator :: Script
|
||||
effectValidator = agoraScripts ! "agora:mutateGovernorValidator"
|
||||
|
||||
-- | The hash of the validator instance.
|
||||
effectValidatorHash :: ValidatorHash
|
||||
effectValidatorHash = validatorHash effectValidator
|
||||
effectScriptHash :: ScriptHash
|
||||
effectScriptHash = scriptHash effectValidator
|
||||
|
||||
-- | The address of the validator.
|
||||
effectValidatorAddress :: Address
|
||||
effectValidatorAddress = scriptHashAddress effectValidatorHash
|
||||
effectValidatorAddress = scriptHashAddress effectScriptHash
|
||||
|
||||
-- | The assetclass of the authority token.
|
||||
atAssetClass :: Tagged AuthorityTokenTag AssetClass
|
||||
atAssetClass = Tagged $ AssetClass authorityTokenSymbol tokenName
|
||||
where
|
||||
tokenName = validatorHashToTokenName effectValidatorHash
|
||||
tokenName = scriptHashToTokenName effectScriptHash
|
||||
|
||||
-- | The mock reference of the governor state UTXO.
|
||||
govRef :: TxOutRef
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ import Agora.Effect.TreasuryWithdrawal (
|
|||
TreasuryWithdrawalDatum (TreasuryWithdrawalDatum),
|
||||
)
|
||||
import Data.Map ((!))
|
||||
import Plutarch.Api.V2 (validatorHash)
|
||||
import Plutarch.Api.V2 (scriptHash)
|
||||
import Plutarch.Script (Script)
|
||||
import PlutusLedgerApi.V1.Interval qualified as Interval (always)
|
||||
import PlutusLedgerApi.V1.Value qualified as Value (singleton)
|
||||
import PlutusLedgerApi.V2 (
|
||||
|
|
@ -36,14 +37,13 @@ import PlutusLedgerApi.V2 (
|
|||
PubKeyHash,
|
||||
Redeemer (Redeemer),
|
||||
ScriptContext (..),
|
||||
ScriptHash (ScriptHash),
|
||||
ScriptPurpose (Spending),
|
||||
TokenName (TokenName),
|
||||
TxInInfo (TxInInfo),
|
||||
TxInfo (..),
|
||||
TxOut (..),
|
||||
TxOutRef (TxOutRef),
|
||||
Validator (Validator),
|
||||
ValidatorHash (ValidatorHash),
|
||||
Value,
|
||||
toBuiltinData,
|
||||
)
|
||||
|
|
@ -72,7 +72,7 @@ inputGAT =
|
|||
TxInInfo
|
||||
(TxOutRef "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be" 1)
|
||||
TxOut
|
||||
{ txOutAddress = Address (ScriptCredential $ validatorHash validator) Nothing
|
||||
{ txOutAddress = Address (ScriptCredential $ scriptHash validator) Nothing
|
||||
, txOutValue = Value.singleton currSymbol validatorHashTN 1 -- Stake ST
|
||||
, txOutDatum = OutputDatumHash (DatumHash "")
|
||||
, txOutReferenceScript = Nothing
|
||||
|
|
@ -147,12 +147,12 @@ buildReceiversOutputFromDatum (TreasuryWithdrawalDatum xs _) = f <$> xs
|
|||
}
|
||||
|
||||
-- | Effect validator instance.
|
||||
validator :: Validator
|
||||
validator = Validator $ agoraScripts ! "agora:treasuryWithdrawalValidator"
|
||||
validator :: Script
|
||||
validator = agoraScripts ! "agora:treasuryWithdrawalValidator"
|
||||
|
||||
-- | 'TokenName' that represents the hash of the 'Agora.Stake.Stake' validator.
|
||||
validatorHashTN :: TokenName
|
||||
validatorHashTN = let ValidatorHash vh = validatorHash validator in TokenName vh
|
||||
validatorHashTN = let ScriptHash hash = scriptHash validator in TokenName hash
|
||||
|
||||
buildScriptContext :: [TxInInfo] -> [TxOut] -> ScriptContext
|
||||
buildScriptContext inputs outputs =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue