PTryFrom for Treasury Withdrawal Effect!

This commit is contained in:
Seungheon Oh 2022-04-25 11:16:17 -04:00
parent 19c9cd06c8
commit cbff7324d8

View file

@ -15,10 +15,12 @@ module Agora.Effect.TreasuryWithdrawal (
import GHC.Generics qualified as GHC
import Generics.SOP (Generic, I (I))
import Control.Applicative (Const)
import Agora.Effect (makeEffect)
import Agora.Utils (findTxOutByTxOutRef, paddValue, passert)
import Plutarch (popaque)
import Plutarch.Internal (punsafeCoerce)
import Plutarch.Api.V1 (
PCredential (..),
PTuple,
@ -32,6 +34,7 @@ import Plutarch.DataRepr (
PDataFields,
PIsDataReprInstances (..),
)
import Plutarch.TryFrom ( PTryFrom(..) )
import Plutarch.Lift (PUnsafeLiftDecl (..))
import Plutarch.Monadic qualified as P
import Plutus.V1.Ledger.Credential (Credential)
@ -71,6 +74,13 @@ deriving via
instance
(PConstant TreasuryWithdrawalDatum)
instance PTryFrom PData PTreasuryWithdrawalDatum where
type PTryFromExcess PData PTreasuryWithdrawalDatum = Const ()
ptryFrom' opq cont =
-- this will need to not use punsafeCoerce...
cont (punsafeCoerce opq, ())
{- | Withdraws given list of values to specific target addresses.
It can be evoked by burning GAT. The transaction should have correct
outputs to the users and any left overs should be paid back to the treasury.