plutus-playground-server-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Crowdfunding

Synopsis

Documentation

data Campaign Source #

A crowdfunding campaign.

Constructors

Campaign 

Fields

Instances

Instances details
Generic Campaign Source # 
Instance details

Defined in Crowdfunding

Associated Types

type Rep Campaign :: Type -> Type Source #

ToJSON Campaign Source # 
Instance details

Defined in Crowdfunding

FromJSON Campaign Source # 
Instance details

Defined in Crowdfunding

ToSchema Campaign Source # 
Instance details

Defined in Crowdfunding

Lift DefaultUni Campaign Source # 
Instance details

Defined in Crowdfunding

Typeable DefaultUni Campaign Source # 
Instance details

Defined in Crowdfunding

type Rep Campaign Source # 
Instance details

Defined in Crowdfunding

type Rep Campaign = D1 ('MetaData "Campaign" "Crowdfunding" "plutus-playground-server-0.1.0.0-9o0UzebbZ3FL7h93YOvSmI" 'False) (C1 ('MetaCons "Campaign" 'PrefixI 'True) (S1 ('MetaSel ('Just "campaignDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 POSIXTime) :*: (S1 ('MetaSel ('Just "campaignCollectionDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 POSIXTime) :*: S1 ('MetaSel ('Just "campaignOwner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PaymentPubKeyHash))))

data CampaignAction Source #

Action that can be taken by the participants in this contract. A value of CampaignAction is provided as the redeemer. The validator script then checks if the conditions for performing this action are met.

Constructors

Collect 
Refund 

type CrowdfundingSchema = Endpoint "schedule collection" () .\/ Endpoint "contribute" Contribution Source #

newtype Contribution Source #

Constructors

Contribution 

Fields

Instances

Instances details
Eq Contribution Source # 
Instance details

Defined in Crowdfunding

Show Contribution Source # 
Instance details

Defined in Crowdfunding

Generic Contribution Source # 
Instance details

Defined in Crowdfunding

Associated Types

type Rep Contribution :: Type -> Type Source #

ToJSON Contribution Source # 
Instance details

Defined in Crowdfunding

FromJSON Contribution Source # 
Instance details

Defined in Crowdfunding

ToSchema Contribution Source # 
Instance details

Defined in Crowdfunding

ToArgument Contribution Source # 
Instance details

Defined in Crowdfunding

type Rep Contribution Source # 
Instance details

Defined in Crowdfunding

type Rep Contribution = D1 ('MetaData "Contribution" "Crowdfunding" "plutus-playground-server-0.1.0.0-9o0UzebbZ3FL7h93YOvSmI" 'True) (C1 ('MetaCons "Contribution" 'PrefixI 'True) (S1 ('MetaSel ('Just "contribValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)))

mkCampaign :: POSIXTime -> POSIXTime -> Wallet -> Campaign Source #

Construct a Campaign value from the campaign parameters, using the wallet's public key.

collectionRange :: Campaign -> POSIXTimeRange Source #

The POSIXTimeRange during which the funds can be collected

refundRange :: Campaign -> POSIXTimeRange Source #

The POSIXTimeRange during which a refund may be claimed

data Crowdfunding Source #

Instances

Instances details
ValidatorTypes Crowdfunding Source # 
Instance details

Defined in Crowdfunding

type DatumType Crowdfunding Source # 
Instance details

Defined in Crowdfunding

type RedeemerType Crowdfunding Source # 
Instance details

Defined in Crowdfunding

mkValidator :: Campaign -> PaymentPubKeyHash -> CampaignAction -> ScriptContext -> Bool Source #

The validator script is of type CrowdfundingValidator, and is additionally parameterized by a Campaign definition. This argument is provided by the Plutus client, using applyCode. As a result, the Campaign definition is part of the script address, and different campaigns have different addresses.

contributionScript :: Campaign -> Validator Source #

The validator script that determines whether the campaign owner can retrieve the funds or the contributors can claim a refund.

campaignAddress :: Campaign -> ValidatorHash Source #

The address of a [[Campaign]]

crowdfunding :: AsContractError e => Campaign -> Contract () CrowdfundingSchema e () Source #

The crowdfunding contract for the Campaign.

theCampaign :: POSIXTime -> Campaign Source #

A sample campaign

contribute :: AsContractError e => Campaign -> Promise () CrowdfundingSchema e () Source #

The "contribute" branch of the contract for a specific Campaign. Exposes an endpoint that allows the user to enter their public key and the contribution. Then waits until the campaign is over, and collects the refund if the funding was not collected.

scheduleCollection :: AsContractError e => Campaign -> Promise () CrowdfundingSchema e () Source #

The campaign owner's branch of the contract for a given Campaign. It watches the campaign address for contributions and collects them if the funding goal was reached in time.