DelmOrg / delm-concept / Concept.Contract

This is part of the standard library for Delm.


type Basic
    = RAddress Concept.Core.Address
    | RString String
    | RInt Basics.Int
    | RBool Basics.Bool

Blockchain base types.


type alias Contract msg model =
{ constructor : ( Concept.Core.Global -> FunctionIO -> model
, InterfaceIO )
, update : msg -> Concept.Core.Global -> model -> ( Concept.Core.Requirements
, model
, FunctionIO ) 
}

Contract specification.


type alias ContractCore msg model =
{ constructor : ( Concept.Core.Global -> FunctionIO -> model
, InterfaceIO )
, update : msg -> Concept.Core.Global -> model -> ( Concept.Core.Requirements
, model
, FunctionIO )
, signatures : List ( String
, Signature )
, encodeMsg : ( String
, FunctionIO ) -> msg 
}

Contract Core specification.


type FunctionIO
    = None
    | Single Basic
    | Tuple2 (( Basic, Basic ))
    | Tuple3 (( Basic, Basic, Basic ))

Function parameter positions.


type Interface
    = IAddress
    | IString
    | IInt
    | IBool

Interfaces.


type InterfaceIO
    = INone
    | ISingle Interface
    | ITuple2 (( Interface, Interface ))
    | ITuple3 (( Interface, Interface, Interface ))

Implementation type for Interfaces.


type alias Signature =
{ inputs : InterfaceIO
, outputs : InterfaceIO 
}

Signature specification.


type alias Model model =
{ deploys : Dict String model
, form : Dict String ( Maybe Basic
, Maybe Basic
, Maybe Basic )
, returns : Dict String FunctionIO
, addresses : Dict Concept.Core.Address Basics.Float
, sender : Maybe Concept.Core.Address
, value : Basics.Int
, global : Concept.Core.Global 
}

Model specification.


type Msg

Msg specification.

deploy : Contract msg model -> Platform.Program () model msg

Syntax sugar, not meant to be used directly.

interpret : ContractCore msg model -> Platform.Program () (Model model) Msg

Interpreter function.