agora-0.1.0
Maintaineremi@haskell.fyi
Safe HaskellSafe-Inferred
LanguageHaskell2010

Agora.Stake.Scripts

Description

Plutus Scripts for Stakes.

Synopsis

Documentation

stakePolicy Source #

Arguments

:: Tagged GTTag AssetClass

The (governance) token that a Stake can store.

-> ClosedTerm PMintingPolicy 

Policy for Stake state threads.

What this Policy does

For minting:

  • Check that exactly one state thread is minted.
  • Check that an output exists with a state thread and a valid datum.
  • Check that no state thread is an input.
  • assert TokenName == ValidatorHash of the script that we pay to.

For burning:

  • Check that exactly one state thread is burned.
  • Check that datum at state thread is valid and not locked.

Since: 0.1.0

stakeValidator :: Stake -> ClosedTerm PValidator Source #

Validator intended for Stake UTXOs to be locked by.

What this Validator does:

DepositWithdraw

Deposit or withdraw some GT to the stake.

  • Tx must be signed by the owner.
  • The stakedAmount field must be updated.
  • The stake must not be locked.
  • The new UTXO must have the previous value plus the difference as stated by the redeemer.

PermitVote

Allow a ProposalLock to be put on the stake in order to vote on a proposal.

  • A proposal token must be spent alongside the stake.
  • Its total votes must be correctly updated to include this stake's contribution.
  • Tx must be signed by the owner.

RetractVotes

Remove a ProposalLock set when voting on a proposal.

  • A proposal token must be spent alongside the stake.
  • Tx must be signed by the owner.

Destroy

Destroy the stake in order to reclaim the min ADA.

  • The stake must not be locked.
  • Tx must be signed by the owner.

WitnessStake

Allow this Stake to be included in a transaction without making any changes to it. In the future, this could use CIP-31 instead.

  • Tx must be signed by the owner or a proposal ST token must be spent alongside the stake.
  • The datum and value must remain unchanged.

Since: 0.1.0