plutus-use-cases-0.1.0.0: Collection of smart contracts to develop the plutus/wallet interface
Safe HaskellNone
LanguageHaskell2010

Plutus.Contracts.Vesting

Synopsis

Documentation

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 Plutus.Contracts.Vesting

Associated Types

type Rep VestingParams :: Type -> Type Source #

Lift DefaultUni VestingParams Source # 
Instance details

Defined in Plutus.Contracts.Vesting

Typeable DefaultUni VestingParams Source # 
Instance details

Defined in Plutus.Contracts.Vesting

type Rep VestingParams Source # 
Instance details

Defined in Plutus.Contracts.Vesting

type Rep VestingParams = D1 ('MetaData "VestingParams" "Plutus.Contracts.Vesting" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" '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))))

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 Plutus.Contracts.Vesting

Associated Types

type Rep VestingTranche :: Type -> Type Source #

Lift DefaultUni VestingTranche Source # 
Instance details

Defined in Plutus.Contracts.Vesting

Typeable DefaultUni VestingTranche Source # 
Instance details

Defined in Plutus.Contracts.Vesting

type Rep VestingTranche Source # 
Instance details

Defined in Plutus.Contracts.Vesting

type Rep VestingTranche = D1 ('MetaData "VestingTranche" "Plutus.Contracts.Vesting" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" '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 VestingError Source #

Instances

Instances details
Eq VestingError Source # 
Instance details

Defined in Plutus.Contracts.Vesting

Show VestingError Source # 
Instance details

Defined in Plutus.Contracts.Vesting

Generic VestingError Source # 
Instance details

Defined in Plutus.Contracts.Vesting

Associated Types

type Rep VestingError :: Type -> Type Source #

ToJSON VestingError Source # 
Instance details

Defined in Plutus.Contracts.Vesting

FromJSON VestingError Source # 
Instance details

Defined in Plutus.Contracts.Vesting

AsContractError VestingError Source # 
Instance details

Defined in Plutus.Contracts.Vesting

AsVestingError VestingError Source # 
Instance details

Defined in Plutus.Contracts.Vesting

type Rep VestingError Source # 
Instance details

Defined in Plutus.Contracts.Vesting

totalAmount :: VestingParams -> Value Source #

The total amount vested