plutus-playground-server-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Vesting

Synopsis

Documentation

type VestingSchema = Endpoint "vest funds" () .\/ Endpoint "retrieve funds" Value Source #

A simple vesting scheme. Money is locked by a contract and may only be retrieved after some time has passed.

This is our first example of a contract that covers multiple transactions, with a contract state that changes over time.

In our vesting scheme the money will be released in two _tranches_ (parts): A smaller part will be available after an initial number of time has passed, and the entire amount will be released at the end. The owner of the vesting scheme does not have to take out all the money at once: They can take out any amount up to the total that has been released so far. The remaining funds stay locked and can be retrieved later.

Let's start with the data types.

data VestingTranche Source #

Tranche of a vesting scheme.

Instances

Instances details
Generic VestingTranche Source # 
Instance details

Defined in Vesting

Associated Types

type Rep VestingTranche :: Type -> Type Source #

Lift DefaultUni VestingTranche Source # 
Instance details

Defined in Vesting

Typeable DefaultUni VestingTranche Source # 
Instance details

Defined in Vesting

type Rep VestingTranche Source # 
Instance details

Defined in Vesting

type Rep VestingTranche = D1 ('MetaData "VestingTranche" "Vesting" "plutus-playground-server-0.1.0.0-9o0UzebbZ3FL7h93YOvSmI" 'False) (C1 ('MetaCons "VestingTranche" 'PrefixI 'True) (S1 ('MetaSel ('Just "vestingTrancheDate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 POSIXTime) :*: S1 ('MetaSel ('Just "vestingTrancheAmount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)))

data VestingParams Source #

A vesting scheme consisting of two tranches. Each tranche defines a date (POSIX time) after which an additional amount can be spent.

Instances

Instances details
Generic VestingParams Source # 
Instance details

Defined in Vesting

Associated Types

type Rep VestingParams :: Type -> Type Source #

Lift DefaultUni VestingParams Source # 
Instance details

Defined in Vesting

Typeable DefaultUni VestingParams Source # 
Instance details

Defined in Vesting

type Rep VestingParams Source # 
Instance details

Defined in Vesting

type Rep VestingParams = D1 ('MetaData "VestingParams" "Vesting" "plutus-playground-server-0.1.0.0-9o0UzebbZ3FL7h93YOvSmI" 'False) (C1 ('MetaCons "VestingParams" 'PrefixI 'True) (S1 ('MetaSel ('Just "vestingTranche1") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VestingTranche) :*: (S1 ('MetaSel ('Just "vestingTranche2") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VestingTranche) :*: S1 ('MetaSel ('Just "vestingOwner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PaymentPubKeyHash))))

totalAmount :: VestingParams -> Value Source #

The total amount vested

availableFrom :: VestingTranche -> POSIXTimeRange -> Value Source #

The amount guaranteed to be available from a given tranche in a given time range.

remainingFrom :: VestingTranche -> POSIXTimeRange -> Value Source #

The amount that has not been released from this tranche yet

data Vesting Source #

Instances

Instances details
ValidatorTypes Vesting Source # 
Instance details

Defined in Vesting

type DatumType Vesting Source # 
Instance details

Defined in Vesting

type DatumType Vesting = ()
type RedeemerType Vesting Source # 
Instance details

Defined in Vesting

data Liveness Source #

Constructors

Alive 
Dead