type safe sorted votes/effects

This commit is contained in:
Hongrui Fang 2022-08-26 18:43:38 +08:00
parent 6fbee1313d
commit edee537ce2
No known key found for this signature in database
GPG key ID: F10AB2CCE24113DD
10 changed files with 394 additions and 338 deletions

View file

@ -37,6 +37,7 @@ import Agora.Stake (
import Data.Coerce (coerce)
import Data.Default (def)
import Data.List (sort)
import Data.Map.Strict qualified as StrictMap
import Data.Tagged (Tagged, untag)
import Plutarch.Context (
input,
@ -57,7 +58,6 @@ import PlutusLedgerApi.V2 (
TxOutRef (..),
Value,
)
import PlutusTx.AssocMap qualified as AssocMap
import Sample.Proposal.Shared (proposalTxRef, stakeTxRef)
import Sample.Shared (
agoraScripts,
@ -101,9 +101,9 @@ perStakedGTs = 5
mkProposalInputDatum :: Parameters -> ProposalDatum
mkProposalInputDatum ps =
let effects =
AssocMap.fromList
[ (ResultTag 0, AssocMap.empty)
, (ResultTag 1, AssocMap.empty)
StrictMap.fromList
[ (ResultTag 0, StrictMap.empty)
, (ResultTag 1, StrictMap.empty)
]
in ProposalDatum
{ proposalId = ProposalId 0