diff --git a/Makefile b/Makefile index a2a17e7..50df7e5 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ usage: @echo " haddock -- Generate Haddock docs for project" hoogle: + pkill hoogle hoogle generate --local=haddock --database=hoo/local.hoo hoogle server --local -p 8081 >> /dev/null & hoogle server --local --database=hoo/local.hoo -p 8082 >> /dev/null & diff --git a/agora.cabal b/agora.cabal index b50a55b..7fdf830 100644 --- a/agora.cabal +++ b/agora.cabal @@ -124,7 +124,8 @@ library Agora.SafeMoney.QQ Agora.Stake Agora.Treasury - Agora.Voting + Agora.Governor + Agora.Proposal other-modules: Agora.Utils diff --git a/agora/Agora/Governor.hs b/agora/Agora/Governor.hs new file mode 100644 index 0000000..5dea361 --- /dev/null +++ b/agora/Agora/Governor.hs @@ -0,0 +1,8 @@ +{- | +Module : Agora.Governor +Maintainer : emi@haskell.fyi +Description: Governor entity scripts acting as authority of entire system. + +Governor entity scripts acting as authority of entire system. +-} +module Agora.Governor () where diff --git a/agora/Agora/Proposal.hs b/agora/Agora/Proposal.hs new file mode 100644 index 0000000..f215d30 --- /dev/null +++ b/agora/Agora/Proposal.hs @@ -0,0 +1,62 @@ +{- | +Module : Agora.Proposal +Maintainer : emi@haskell.fyi +Description: Proposal scripts encoding effects that operate on the system. + +Proposal scripts encoding effects that operate on the system. +-} +module Agora.Proposal ( + ProposalDatum (..), + ProposalStatus (..), + ResultTag (..), +) where + +import Plutus.V1.Ledger.Api (DatumHash, PubKeyHash, ValidatorHash) + +-------------------------------------------------------------------------------- + +{- | Encodes a result. Typically, for a Yes/No proposal, we encode it like this: + + "No" ~ EffectTag 0 + "Yes" ~ EffectTag 1 +-} +newtype ResultTag = ResultTag {getResultTag :: Integer} + +{- | The 'status' of the proposal. This is only useful for __actual__ + state transitions, as opposed to time-based 'phases'. + + If the proposal is 'VotingReady', for instance, that doesn't necessarily + mean that voting is possible, as this also requires the timing to be right. +-} +data ProposalStatus + = -- | A draft proposal represents a proposal that has yet to be realized. + -- In effect, this means one which didn't have enough LQ to be a full + -- proposal, and needs cosigners to enable that to happen. This is + -- similar to a "temperature check", but only useful if multiple people + -- want to pool governance tokens together. If the proposal doesn't get to + -- 'VotingReady' on time, the proposal will **never** be able to get + -- voted on. + Draft + | -- | The proposal has/had enough GT cosigned in order to be a fully fledged + -- proposal. This means that once the timing requirements align, + -- proposal will be able to be voted on. + VotingReady + | -- | The proposal has finished for whatever reason. This can mean it's been + -- voted on and completed, but it can also mean the proposal failed due to + -- time constraints or didn't get to 'VotingReady' first. + -- + -- TODO: The owner of the proposal may choose to reclaim their proposal. + Finished + +data ProposalDatum = ProposalDatum + { -- TODO: could we encode this more efficiently? + -- This is shaped this way for future proofing. + -- See https://github.com/Liqwid-Labs/agora/issues/39 + effects :: [(ResultTag, [(ValidatorHash, DatumHash)])] + -- ^ Effect lookup table. First by result, then by + , status :: ProposalStatus + -- ^ The status the proposal is in. + , proposers :: [PubKeyHash] + -- ^ Who created the proposal initially. + -- We may want to remove this. + } diff --git a/agora/Agora/Voting.hs b/agora/Agora/Voting.hs index 5436960..066956c 100644 --- a/agora/Agora/Voting.hs +++ b/agora/Agora/Voting.hs @@ -6,6 +6,3 @@ Description: Types for votes and vote counting module Agora.Voting ( Vote (..), ) where - --- | Type representing direction of vote. -data Vote = InFavorOf | OpposedTo