DelmOrg/delm-concept/2.3.0

Concept.Contract

This is part of the standard library for Delm.

type Basic
= RAddress Address
| RString String
| RInt Int
| RBool Bool

Blockchain base types.

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

Contract specification.

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

Contract Core specification.

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

Function parameter positions.

= IAddress
| IString
| IInt
| IBool

Interfaces.

= 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 Address Float
, sender : Maybe Address
, value : Int
, global : Global
}

Model specification.

type Msg

Msg specification.

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

Syntax sugar, not meant to be used directly.

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

Interpreter function.