Repository navigation
Marlowe extended contract metadata definition #7
hrajchert
started this conversation in
Marlowe Improvements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
While developing the PlayGround and Marlowe Run, we found the necessity of annotating the Contract with some
Metadatathat improved the UI.More so, we made a built-in editor in the playground to ease the editing.
The metadata was constructed organically with the two projects, which adds a benefit and a drawback:
Goals of this discussion
Some suggestions might revolve around:
TemplateParameters,TemplateInformation,ContractParameters,ContractInformation,ContractPreface,ContractPreamble,ContractRecitalsor similar.Improving the name would help us focus the scope of what information should be here or somewhere else.
The current fields were added with a clear UI element that display them in mind. I'd like to shift focus to the contracts domain, to something that is general available in all contracts. While looking for a more domain specific name (instead of metadata) I found the following definition of a contract preamble, which resonates a lot with most of the current metadata fields.
Whatever information we end up having, I think we should make every field optional.
While developing Marlowe Run we noticed that we needed a way to share the information with other contract participants so that they could also see the same UI. We ended up using a hack called Deinstantiate, in which we checked if the Core contract was an instance of a known Extended contract we knew the metadata for. Inside the Create transaction discussion we are adding the possibility to attach any custom metadata to a contract, but if we can solve the second point I think there is value to include this information as part of the 1564 metadata
Summary of current fields
Contract type
The ContractType is the most controversial field.
It was populated after the initial set of examples, and we have one type per example. At the very least
Othershould have an optional string, but I suggest removing this field altogether.Contract name
A
stringrepresenting the human readable name. I think it should stay as it is.Description
We have separate
stringfor short and long description, I think they are fine as it is. We might want to put a limit on the short description and make both optional.Role descriptions
This is a map between a
TokenNameand astringdescription.We might want to add a type alias for that string and maybe some size limit.
Time description
If we use a
TimeParamit can be useful to have a description of what thisTimeoutmeans. It is an ordered map instead of a simple map to denotate the order in which they should appear in the UI. It is also useful in the playground to have the order as we can put sensible defaults for the timeouts in the simulation.Both the key and the value should be replaced by aliases
Parameter description
If the contract uses a
ConstantParamfor aValue, then it's useful to have a description of what the value means and how it should be formattedI'm not sure if the
TimeFormatshould be a part ofNumberFormat, I think it is not currently being used and the Timeout already has its own metadata field. The number format is useful in the UI as it has a way to represent the amount of cents and token symbol.This is clearly a UI specific field, but I wonder if we can translate it to a Contract domain, something that colloquially would read as follow
Could be represented as:
Choice information
Whenever a choice is presented we can describe what are we choosing.
All reactions