This commit is contained in:
Seungheon Oh 2022-04-19 22:32:06 -04:00
parent aa4d198e9f
commit 774702f255
2 changed files with 35 additions and 7 deletions

View file

@ -12,11 +12,20 @@ import Plutus.V1.Ledger.Api
import Plutus.V1.Ledger.Interval qualified as Interval import Plutus.V1.Ledger.Interval qualified as Interval
import Plutus.V1.Ledger.Value qualified as Value import Plutus.V1.Ledger.Value qualified as Value
import Agora.Effect.TreasuryWithdrawal (treasuryWithdrawalValidator) import Agora.Effect.TreasuryWithdrawal
--receiverList :: TreasuryWithdrawalDatum
--receiverList = TreasuryWithdrawalDatum [(mempty, mempty)]
_datum :: TreasuryWithdrawalDatum
_datum =
TreasuryWithdrawalDatum
[ (PubKeyCredential signer, Value.singleton currSymbol validatorHashTN 1)
]
-- | A sample Currency Symbol -- | A sample Currency Symbol
currSymbol :: CurrencySymbol currSymbol :: CurrencySymbol
currSymbol = CurrencySymbol "Orange19721121" currSymbol = CurrencySymbol "Orangebottle19721121"
-- | A sample 'PubKeyHash'. -- | A sample 'PubKeyHash'.
signer :: PubKeyHash signer :: PubKeyHash
@ -36,11 +45,25 @@ withdrawalEffect =
{ scriptContextTxInfo = { scriptContextTxInfo =
TxInfo TxInfo
{ txInfoInputs = { txInfoInputs =
[ TxInInfo [ TxInInfo -- Initiator
(TxOutRef "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be" 1) (TxOutRef "Initiator" 1)
TxOut TxOut
{ txOutAddress = Address (ScriptCredential $ validatorHash validator) Nothing { txOutAddress = Address (ScriptCredential $ validatorHash validator) Nothing
, txOutValue = Value.singleton currSymbol validatorHashTN 1 , txOutValue = Value.singleton "" "" 2000000
, txOutDatumHash = Nothing
}
, TxInInfo -- Treasury 1
(TxOutRef "Treasury 1" 1)
TxOut
{ txOutAddress = Address (ScriptCredential $ validatorHash validator) Nothing
, txOutValue = Value.singleton currSymbol validatorHashTN 10
, txOutDatumHash = Nothing
}
, TxInInfo -- Treasury 2
(TxOutRef "Treasury 2" 1)
TxOut
{ txOutAddress = Address (ScriptCredential $ validatorHash validator) Nothing
, txOutValue = Value.singleton currSymbol validatorHashTN 10
, txOutDatumHash = Nothing , txOutDatumHash = Nothing
} }
] ]
@ -54,5 +77,6 @@ withdrawalEffect =
, txInfoData = [] , txInfoData = []
, txInfoId = "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be" , txInfoId = "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be"
} }
, scriptContextPurpose = Spending (TxOutRef "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be" 1) , scriptContextPurpose =
Spending (TxOutRef "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be" 1)
} }

View file

@ -7,7 +7,11 @@ Description: An Effect that withdraws treasury deposit
An Effect that withdraws treasury deposit An Effect that withdraws treasury deposit
-} -}
module Agora.Effect.TreasuryWithdrawal (TreasuryWithdrawalDatum, PTreasuryWithdrawalDatum, treasuryWithdrawalValidator) where module Agora.Effect.TreasuryWithdrawal (
TreasuryWithdrawalDatum(..),
PTreasuryWithdrawalDatum(..),
treasuryWithdrawalValidator,
) where
import GHC.Generics qualified as GHC import GHC.Generics qualified as GHC
import Generics.SOP (Generic, I (I)) import Generics.SOP (Generic, I (I))