Marlowe Lang

crates.io Documentation BuildAndTest

An experimental Rust implementation of the Marlowe DSL for Cardano smart (financial) contracts. It allows you to create Marlowe contracts from Rust rather than using Marlowe directly.

It is used by the MarloweLSP VSCode Extention (Syntax highlighting for Marlowe in VSCode).

Main Features

Experimental features (wildly unstable)

Planned features

Disclaimers

Example usage

```rust use marlowelang::types::marlowe::*; use marlowelang::parsing::{ deserialization::deserialize, serialization::serialize, };

let mycontract = Contract::When { cases: vec![ Some(Case { action: Some(Action::Notify { notifyif: Some(Observation::TrueObs) }), contract: Some(Contract::Close.boxed()) } ) ], timeout: Some(timeout::TimeParam("test".into())), timeout_continuation: Some(Contract::Close.boxed()), };

let serialized = serialize(my_contract); let deserialized : Contract = deserialize(&serialized).unwrap(); println!("{serialized}"); ```

Where 'println!("{serialized}")' would output this:

text When [ Case (Notify (TrueObs)) Close ] (TimeParam "test") Close

CLI Tool:

Features

How to install marlowelangcli:

bash rustup default nightly cargo install marlowe_lang

marlowe_lang -h

```text USAGE: marlowelangcli.exe

OPTIONS: -h, --help Print help information -V, --version Print version information

SUBCOMMANDS: contract Tools for working with contracts datum Tools for working with datums help Print this message or the help of the given subcommand(s) plutus-data Tools for working with unknown plutus data redeemer Tools for working with inputs/redeemers (marlowe actions) state Tools for working with state ```