Simple fixes for Treasury Withdrawal Effect
Some simple fixes: naming convention, proper comment for haddoc
This commit is contained in:
parent
e3bf41af29
commit
7cae728860
1 changed files with 9 additions and 7 deletions
|
|
@ -4,6 +4,8 @@
|
||||||
Module : Agora.Effect.TreasuryWithdrawal
|
Module : Agora.Effect.TreasuryWithdrawal
|
||||||
Maintainer : seungheon.ooh@gmail.com
|
Maintainer : seungheon.ooh@gmail.com
|
||||||
Description: An Effect that withdraws treasury deposit
|
Description: 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
|
||||||
|
|
||||||
|
|
@ -77,25 +79,25 @@ findOwnAddress = phoistAcyclic $
|
||||||
|
|
||||||
treasuryWithdrawalValidator :: forall {s :: S}. CurrencySymbol -> Term s PValidator
|
treasuryWithdrawalValidator :: forall {s :: S}. CurrencySymbol -> Term s PValidator
|
||||||
treasuryWithdrawalValidator currSymbol = makeEffect currSymbol $
|
treasuryWithdrawalValidator currSymbol = makeEffect currSymbol $
|
||||||
\_cs (_datum :: Term _ PTreasuryWithdrawalDatum) _txOutRef _txInfo -> P.do
|
\_cs (datum' :: Term _ PTreasuryWithdrawalDatum) txOutRef' txInfo' -> P.do
|
||||||
receivers <- plet $ pfromData $ pfield @"receivers" # _datum
|
receivers <- plet $ pfromData $ pfield @"receivers" # datum'
|
||||||
txInfo <- pletFields @'["outputs"] _txInfo
|
txInfo <- pletFields @'["outputs"] txInfo'
|
||||||
let outputValues =
|
let outputValues =
|
||||||
pmap
|
pmap
|
||||||
# plam
|
# plam
|
||||||
( \_out -> P.do
|
( \out' -> P.do
|
||||||
out <- pletFields @'["address", "value"] $ pfromData _out
|
out <- pletFields @'["address", "value"] $ pfromData out'
|
||||||
cred <- pletFields @'["credential"] $ pfromData out.address
|
cred <- pletFields @'["credential"] $ pfromData out.address
|
||||||
pdata $ ptuple # cred.credential # out.value
|
pdata $ ptuple # cred.credential # out.value
|
||||||
)
|
)
|
||||||
#$ txInfo.outputs
|
#$ txInfo.outputs
|
||||||
outputContentMatchesRecivers =
|
outputContentMatchesRecivers =
|
||||||
pall # plam id #$ pmap
|
pall # plam id #$ pmap
|
||||||
# plam (\_out -> pelem # _out # outputValues)
|
# plam (\out -> pelem # out # outputValues)
|
||||||
#$ receivers
|
#$ receivers
|
||||||
outputNumberMatchesRecivers = plength # receivers #== plength # (pfromData txInfo.outputs)
|
outputNumberMatchesRecivers = plength # receivers #== plength # (pfromData txInfo.outputs)
|
||||||
outputIsNotPayingToEffect = P.do
|
outputIsNotPayingToEffect = P.do
|
||||||
input <- pletFields @'["address", "value"] $ findOwnAddress # pfromData _txInfo # _txOutRef
|
input <- pletFields @'["address", "value"] $ findOwnAddress # pfromData txInfo' # txOutRef'
|
||||||
let correctMinimum = passetClassValueOf' (AssetClass ("", "")) # input.value #== 2000000
|
let correctMinimum = passetClassValueOf' (AssetClass ("", "")) # input.value #== 2000000
|
||||||
notPayingToEffect =
|
notPayingToEffect =
|
||||||
pnot #$ pany
|
pnot #$ pany
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue