| Maintainer | emi@haskell.fyi |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Agora.Proposal
Description
Proposal scripts encoding effects that operate on the system.
Synopsis
- data Proposal = Proposal {}
- data ProposalDatum = ProposalDatum {}
- data ProposalRedeemer
- data ProposalStatus
- = Draft
- | VotingReady
- | Locked
- | Finished
- data ProposalThresholds = ProposalThresholds {}
- newtype ProposalVotes = ProposalVotes {}
- newtype ProposalId = ProposalId {}
- newtype ResultTag = ResultTag {}
- emptyVotesFor :: forall a. Map ResultTag a -> ProposalVotes
- newtype PProposalDatum (s :: S) = PProposalDatum {
- getProposalDatum :: Term s (PDataRecord '["proposalId" := PProposalId, "effects" := PMap 'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash), "status" := PProposalStatus, "cosigners" := PBuiltinList (PAsData PPubKeyHash), "thresholds" := PProposalThresholds, "votes" := PProposalVotes, "timingConfig" := PProposalTimingConfig, "startingTime" := PProposalStartingTime])
- data PProposalRedeemer (s :: S)
- = PVote (Term s (PDataRecord '["resultTag" := PResultTag]))
- | PCosign (Term s (PDataRecord '["newCosigners" := PBuiltinList (PAsData PPubKeyHash)]))
- | PUnlock (Term s (PDataRecord '["resultTag" := PResultTag]))
- | PAdvanceProposal (Term s (PDataRecord '[]))
- data PProposalStatus (s :: S)
- = PDraft (Term s (PDataRecord '[]))
- | PVotingReady (Term s (PDataRecord '[]))
- | PLocked (Term s (PDataRecord '[]))
- | PFinished (Term s (PDataRecord '[]))
- newtype PProposalThresholds (s :: S) = PProposalThresholds {}
- newtype PProposalVotes (s :: S) = PProposalVotes (Term s (PMap 'Unsorted PResultTag PInteger))
- newtype PProposalId (s :: S) = PProposalId (Term s PInteger)
- newtype PResultTag (s :: S) = PResultTag (Term s PInteger)
- proposalDatumValid :: Proposal -> Term s (PProposalDatum :--> PBool)
- pemptyVotesFor :: forall s a. PIsData a => Term s (PMap 'Unsorted PResultTag a :--> PProposalVotes)
- pwinner :: Term s (PProposalVotes :--> (PInteger :--> (PResultTag :--> PResultTag)))
- pwinner' :: Term s (PProposalVotes :--> (PInteger :--> PMaybe PResultTag))
- pneutralOption :: Term s (PMap 'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash) :--> PResultTag)
- pretractVotes :: Term s (PResultTag :--> (PInteger :--> (PProposalVotes :--> PProposalVotes)))
Haskell-land
Parameters that identify the Proposal validator script.
Since: 0.1.0
Constructors
| Proposal | |
Fields
| |
Instances
| Generic Proposal Source # | |
| Show Proposal Source # | Since: 0.1.0 |
| Eq Proposal Source # | Since: 0.1.0 |
| type Rep Proposal Source # | Since: 0.1.0 |
Defined in Agora.Proposal type Rep Proposal = D1 ('MetaData "Proposal" "Agora.Proposal" "agora-0.1.0-C1o5klqsCO77ggIWQdJiNp" 'False) (C1 ('MetaCons "Proposal" 'PrefixI 'True) (S1 ('MetaSel ('Just "governorSTAssetClass") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssetClass) :*: (S1 ('MetaSel ('Just "stakeSTAssetClass") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssetClass) :*: S1 ('MetaSel ('Just "maximumCosigners") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))) | |
data ProposalDatum Source #
Haskell-level datum for Proposal scripts.
Since: 0.1.0
Constructors
| ProposalDatum | |
Fields
| |
Instances
data ProposalRedeemer Source #
Haskell-level redeemer for Proposal scripts.
Since: 0.1.0
Constructors
| Vote ResultTag | Cast one or more votes towards a particular |
| Cosign [PubKeyHash] | Add one or more public keys to the cosignature list. Must be signed by those cosigning. This is particularly used in the |
| Unlock ResultTag | Allow unlocking one or more stakes with votes towards particular |
| AdvanceProposal | Advance the proposal, performing the required checks for whether that is legal. These are roughly the checks for each possible transition:
Draft -> VotingReady |
Instances
data ProposalStatus Source #
The "status" of the proposal. This is only useful for state transitions that need to happen as a result of a transaction as opposed to time-based "periods".
See the note on wording & the state machine in the tech-design.
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.
Since: 0.1.0
Constructors
| Draft | 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 | 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. |
| Locked | The proposal has been voted on, and the votes have been locked permanently. The proposal now goes into a locking time after the normal voting time. After this, it's possible to execute the proposal. |
| Finished | The proposal has finished. 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 At this stage, the See TODO: The owner of the proposal may choose to reclaim their proposal. |
Instances
data ProposalThresholds Source #
The threshold values for various state transitions to happen.
This data is stored centrally (in the Governor) and copied over
to Proposals when they are created.
Since: 0.1.0
Constructors
| ProposalThresholds | |
Fields
| |
Instances
newtype ProposalVotes Source #
Map which encodes the total tally for each result.
It's important that the "shape" is consistent with the shape of effects.
e.g. if the effects field looks like the following:
[(ResultTag0, []), (ResultTag1, [(vh, dh)])]
Then ProposalVotes needs be of the shape:
[(ResultTag0, n), (ResultTag1, m)]
Since: 0.1.0
Constructors
| ProposalVotes | |
Fields | |
Instances
newtype ProposalId Source #
Identifies a Proposal, issued upon creation of a proposal. In practice,
this number starts at zero, and increments by one for each proposal.
The 100th proposal will be . This counter lives
in the ProposalId 99Governor. See nextProposalId, and
pgetNextProposalId.
Since: 0.1.0
Constructors
| ProposalId | |
Fields | |
Instances
Encodes a result. Typically, for a Yes/No proposal, we encode it like this:
No ~ResultTag0 Yes ~ResultTag1
Since: 0.1.0
Constructors
| ResultTag | |
Fields | |
Instances
emptyVotesFor :: forall a. Map ResultTag a -> ProposalVotes Source #
Create a ProposalVotes that has the same shape as the effects field.
Since: 0.1.0
Plutarch-land
newtype PProposalDatum (s :: S) Source #
Plutarch-level version of ProposalDatum.
Since: 0.1.0
Constructors
| PProposalDatum | |
Fields
| |
Instances
data PProposalRedeemer (s :: S) Source #
Plutarch-level version of ProposalRedeemer.
Since: 0.1.0
Constructors
| PVote (Term s (PDataRecord '["resultTag" := PResultTag])) | |
| PCosign (Term s (PDataRecord '["newCosigners" := PBuiltinList (PAsData PPubKeyHash)])) | |
| PUnlock (Term s (PDataRecord '["resultTag" := PResultTag])) | |
| PAdvanceProposal (Term s (PDataRecord '[])) |
Instances
data PProposalStatus (s :: S) Source #
Plutarch-level version of ProposalStatus.
Since: 0.1.0
Constructors
| PDraft (Term s (PDataRecord '[])) | |
| PVotingReady (Term s (PDataRecord '[])) | |
| PLocked (Term s (PDataRecord '[])) | |
| PFinished (Term s (PDataRecord '[])) |
Instances
newtype PProposalThresholds (s :: S) Source #
Plutarch-level version of ProposalThresholds.
Since: 0.1.0
Constructors
| PProposalThresholds | |
Instances
newtype PProposalVotes (s :: S) Source #
Plutarch-level version of ProposalVotes.
Since: 0.1.0
Constructors
| PProposalVotes (Term s (PMap 'Unsorted PResultTag PInteger)) |
Instances
newtype PProposalId (s :: S) Source #
Plutarch-level version of PProposalId.
Since: 0.1.0
Constructors
| PProposalId (Term s PInteger) |
Instances
newtype PResultTag (s :: S) Source #
Plutarch-level version of ResultTag.
Since: 0.1.0
Constructors
| PResultTag (Term s PInteger) |
Instances
Plutarch helpers
proposalDatumValid :: Proposal -> Term s (PProposalDatum :--> PBool) Source #
Check for various invariants a proposal must uphold. This can be used to check both upon creation and upon any following state transitions in the proposal.
Since: 0.1.0
pemptyVotesFor :: forall s a. PIsData a => Term s (PMap 'Unsorted PResultTag a :--> PProposalVotes) Source #
Plutarch-level version of emptyVotesFor.
Since: 0.1.0
pwinner :: Term s (PProposalVotes :--> (PInteger :--> (PResultTag :--> PResultTag))) Source #
Wrapper for pwinner'. When the winner cannot be found,
the neutral option will be returned.
Since: 0.1.0
pwinner' :: Term s (PProposalVotes :--> (PInteger :--> PMaybe PResultTag)) Source #
Find the winner result tag, given the votes and the quorum.
The winner should be unambiguous, meaning that if two options have the same highest votes,
the function will return PNothing.
Since: 0.1.0
pneutralOption :: Term s (PMap 'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash) :--> PResultTag) Source #
Find the "neutral" option (a dummy outcome with no effect) given the effects.
Since: 0.1.0
pretractVotes :: Term s (PResultTag :--> (PInteger :--> (PProposalVotes :--> PProposalVotes))) Source #
Retract votes given the option and the amount of votes.
Since: 0.1.0