Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data VestingParams = VestingParams {
- vestingTranche1 :: VestingTranche
- vestingTranche2 :: VestingTranche
- vestingOwner :: PaymentPubKeyHash
- type VestingSchema = Endpoint "vest funds" () .\/ Endpoint "retrieve funds" Value
- data VestingTranche = VestingTranche {
- vestingTrancheDate :: POSIXTime
- vestingTrancheAmount :: Value
- data VestingError
- = VContractError ContractError
- | InsufficientFundsError Value Value Value
- class AsVestingError r where
- _VestingError :: Prism' r VestingError
- _VContractError :: Prism' r ContractError
- _InsufficientFundsError :: Prism' r (Value, Value, Value)
- totalAmount :: VestingParams -> Value
- vestingContract :: VestingParams -> Contract () VestingSchema VestingError ()
- validate :: VestingParams -> () -> () -> ScriptContext -> Bool
- vestingScript :: VestingParams -> Validator
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.
VestingParams | |
|
Instances
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.
VestingTranche | |
|
Instances
data VestingError Source #
VContractError ContractError | |
InsufficientFundsError Value Value Value |
Instances
class AsVestingError r where Source #
_VestingError :: Prism' r VestingError Source #
_VContractError :: Prism' r ContractError Source #
_InsufficientFundsError :: Prism' r (Value, Value, Value) Source #
Instances
AsVestingError VestingError Source # | |
Defined in Plutus.Contracts.Vesting _VestingError :: Prism' VestingError VestingError Source # _VContractError :: Prism' VestingError ContractError Source # _InsufficientFundsError :: Prism' VestingError (Value, Value, Value) Source # |
totalAmount :: VestingParams -> Value Source #
The total amount vested
vestingContract :: VestingParams -> Contract () VestingSchema VestingError () Source #
validate :: VestingParams -> () -> () -> ScriptContext -> Bool Source #
vestingScript :: VestingParams -> Validator Source #