| Maintainer | emi@haskell.fyi |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Agora.Stake
Description
Vote-lockable stake UTXOs holding GT.
Synopsis
- data StakeDatum = StakeDatum {}
- data StakeRedeemer
- data Stake = Stake {}
- data ProposalLock = ProposalLock {}
- newtype PStakeDatum (s :: S) = PStakeDatum {
- getStakeDatum :: Term s (PDataRecord '["stakedAmount" := PDiscrete GTTag, "owner" := PPubKeyHash, "lockedBy" := PBuiltinList (PAsData PProposalLock)])
- data PStakeRedeemer (s :: S)
- = PDepositWithdraw (Term s (PDataRecord '["delta" := PDiscrete GTTag]))
- | PDestroy (Term s (PDataRecord '[]))
- | PPermitVote (Term s (PDataRecord '["lock" := PProposalLock]))
- | PRetractVotes (Term s (PDataRecord '["locks" := PBuiltinList (PAsData PProposalLock)]))
- | PWitnessStake (Term s (PDataRecord '[]))
- newtype PProposalLock (s :: S) = PProposalLock {
- getProposalLock :: Term s (PDataRecord '["vote" := PResultTag, "proposalTag" := PProposalId])
- data PStakeUsage (s :: S)
- = PVotedFor (Term s PResultTag)
- | PCreated
- | PDidNothing
- stakeLocked :: forall (s :: S). Term s (PStakeDatum :--> PBool)
- findStakeOwnedBy :: Term s (PAssetClass :--> (PPubKeyHash :--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum)) :--> (PBuiltinList (PAsData PTxInInfo) :--> PMaybe (PAsData PStakeDatum)))))
- pgetStakeUsage :: Term _ (PBuiltinList (PAsData PProposalLock) :--> (PProposalId :--> PStakeUsage))
Haskell-land
data StakeDatum Source #
Haskell-level datum for Stake scripts.
Since: 0.1.0
Constructors
| StakeDatum | |
Fields
| |
Instances
data StakeRedeemer Source #
Haskell-level redeemer for Stake scripts.
Since: 0.1.0
Constructors
| DepositWithdraw (Tagged GTTag Integer) | Deposit or withdraw a discrete amount of the staked governance token. Stake must be unlocked. |
| Destroy | Destroy a stake, retrieving its LQ, the minimum ADA and any other assets. Stake must be unlocked. |
| PermitVote ProposalLock | Permit a Vote to be added onto a |
| RetractVotes [ProposalLock] | Retract a vote, removing it from the |
| WitnessStake | The owner can consume stake if nothing is changed about it. If the proposal token moves, this is equivalent to the owner consuming it. |
Instances
Parameters for creating Stake scripts.
Since: 0.1.0
Constructors
| Stake | |
Fields
| |
Instances
| Generic Stake Source # | |
| type Rep Stake Source # | Since: 0.1.0 |
Defined in Agora.Stake type Rep Stake = D1 ('MetaData "Stake" "Agora.Stake" "agora-0.1.0-C1o5klqsCO77ggIWQdJiNp" 'False) (C1 ('MetaCons "Stake" 'PrefixI 'True) (S1 ('MetaSel ('Just "gtClassRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Tagged GTTag AssetClass)) :*: S1 ('MetaSel ('Just "proposalSTClass") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssetClass))) | |
data ProposalLock Source #
A lock placed on a Stake datum in order to prevent depositing and withdrawing when votes are in place.
NOTE: Due to retracting votes always being possible, this lock will only lock with contention on the proposal.
FIXME: Contention on Proposals could create contention on voting which in turn creates contention on stakers.
Vaguely this is the dependency graph for this locking interaction. Both the stake validator and the proposal validator are only able to check for one another through the datum belonging to the ST:
┌─────────────────┐ ┌────────────────────┐
│ Stake Validator ├─┐ │ Proposal Validator │
└────────┬────────┘ │ └──────┬─────┬───────┘
│ │ │ │
│ ┌─┼────────┘ │
▼ │ │ ▼
┌──────────────┐ │ │ ┌─────────────────┐
│ Stake Policy │◄─┘ └►│ Proposal Policy │
└──────────────┘ └─────────────────┘
Since: 0.1.0
Constructors
| ProposalLock | |
Fields
| |
Instances
Plutarch-land
newtype PStakeDatum (s :: S) Source #
Plutarch-level datum for Stake scripts.
Since: 0.1.0
Constructors
| PStakeDatum | |
Fields
| |
Instances
data PStakeRedeemer (s :: S) Source #
Plutarch-level redeemer for Stake scripts.
Since: 0.1.0
Constructors
| PDepositWithdraw (Term s (PDataRecord '["delta" := PDiscrete GTTag])) | Deposit or withdraw a discrete amount of the staked governance token. |
| PDestroy (Term s (PDataRecord '[])) | Destroy a stake, retrieving its LQ, the minimum ADA and any other assets. |
| PPermitVote (Term s (PDataRecord '["lock" := PProposalLock])) | |
| PRetractVotes (Term s (PDataRecord '["locks" := PBuiltinList (PAsData PProposalLock)])) | |
| PWitnessStake (Term s (PDataRecord '[])) |
Instances
newtype PProposalLock (s :: S) Source #
Plutarch-level version of ProposalLock.
Since: 0.1.0
Constructors
| PProposalLock | |
Fields
| |
Instances
data PStakeUsage (s :: S) Source #
Represent the usage of a stake on a particular proposal. A stake can be used to either create or vote on a proposal.
Since: 0.1.0
Constructors
| PVotedFor (Term s PResultTag) | |
| PCreated | |
| PDidNothing |
Instances
Utility functions
stakeLocked :: forall (s :: S). Term s (PStakeDatum :--> PBool) Source #
Check whether a Stake is locked. If it is locked, various actions are unavailable.
Since: 0.1.0
findStakeOwnedBy :: Term s (PAssetClass :--> (PPubKeyHash :--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum)) :--> (PBuiltinList (PAsData PTxInInfo) :--> PMaybe (PAsData PStakeDatum))))) Source #
Find a stake owned by a particular PK.
Since: 0.1.0
pgetStakeUsage :: Term _ (PBuiltinList (PAsData PProposalLock) :--> (PProposalId :--> PStakeUsage)) Source #
O(n) .Return the usage of a stake on a particular proposal,
given the lockedBy field of a stake and the target proposal.
Since: 0.1.0