| CARVIEW |
morley: Developer tools for the Michelson Language
A library to make writing smart contracts in Michelson — the smart contract language of the Tezos blockchain — pleasant and effective.
[Skip to Readme]
Modules
[Index] [Quick Jump]
- Morley
- App
- Morley.AsRPC
- Morley.CLI
- Morley.Micheline
- Michelson
- Morley.Michelson.Analyzer
- Morley.Michelson.Doc
- Morley.Michelson.ErrorPos
- Morley.Michelson.FailPattern
- Internal
- Morley.Michelson.Interpret
- Morley.Michelson.Macro
- Morley.Michelson.Optimizer
- Morley.Michelson.Parser
- Morley.Michelson.Preprocess
- Morley.Michelson.Printer
- Morley.Michelson.Runtime
- Morley.Michelson.Text
- Morley.Michelson.TypeCheck
- Morley.Michelson.TypeCheck.Error
- Morley.Michelson.TypeCheck.Ext
- Morley.Michelson.TypeCheck.Helpers
- Morley.Michelson.TypeCheck.Instr
- Morley.Michelson.TypeCheck.TypeCheck
- Morley.Michelson.TypeCheck.TypeCheckedOp
- Morley.Michelson.TypeCheck.TypeCheckedSeq
- Morley.Michelson.TypeCheck.Types
- Morley.Michelson.TypeCheck.Value
- Morley.Michelson.Typed
- Morley.Michelson.Typed.Aliases
- Morley.Michelson.Typed.AnnotatedValue
- Morley.Michelson.Typed.Annotation
- Morley.Michelson.Typed.Arith
- Morley.Michelson.Typed.ClassifiedInstr
- Internal
- Morley.Michelson.Typed.Contract
- Morley.Michelson.Typed.Convert
- Morley.Michelson.Typed.Doc
- Morley.Michelson.Typed.Entrypoints
- Morley.Michelson.Typed.Existential
- Morley.Michelson.Typed.Extract
- Morley.Michelson.Typed.Haskell
- Morley.Michelson.Typed.Instr
- Morley.Michelson.Typed.Operation
- Morley.Michelson.Typed.Polymorphic
- Morley.Michelson.Typed.Scope
- Internal
- Morley.Michelson.Typed.Scope.Internal.CheckScope
- Morley.Michelson.Typed.Scope.Internal.Comparable
- Morley.Michelson.Typed.Scope.Internal.ForbidT
- Morley.Michelson.Typed.Scope.Internal.Presence
- Morley.Michelson.Typed.Scope.Internal.Scopes
- Morley.Michelson.Typed.Scope.Internal.TH
- Morley.Michelson.Typed.Scope.Internal.WellTyped
- Morley.Michelson.Typed.Scope.Internal.WithDeMorganScope
- Internal
- Morley.Michelson.Typed.Sing
- Morley.Michelson.Typed.T
- Morley.Michelson.Typed.TypeLevel
- Morley.Michelson.Typed.Util
- Morley.Michelson.Typed.Value
- Morley.Michelson.Typed.View
- Morley.Michelson.Untyped
- Morley.Michelson.Untyped.Aliases
- Morley.Michelson.Untyped.Annotation
- Morley.Michelson.Untyped.Contract
- Morley.Michelson.Untyped.Entrypoints
- Morley.Michelson.Untyped.Ext
- Morley.Michelson.Untyped.HoistInstr
- Morley.Michelson.Untyped.Instr
- Morley.Michelson.Untyped.Type
- Morley.Michelson.Untyped.Value
- Morley.Michelson.Untyped.View
- Tezos
- Util
- Morley.Util.Aeson
- Morley.Util.Bimap
- Morley.Util.Binary
- Morley.Util.ByteString
- Morley.Util.CLI
- Morley.Util.Constrained
- Morley.Util.CustomGeneric
- Morley.Util.Default
- Morley.Util.Exception
- Morley.Util.Fcf
- Morley.Util.Generic
- Morley.Util.Instances
- Morley.Util.Interpolate
- Morley.Util.Label
- Morley.Util.Lens
- Morley.Util.Main
- Morley.Util.Markdown
- Morley.Util.MismatchError
- Morley.Util.MultiReader
- Morley.Util.Named
- Morley.Util.Peano
- Morley.Util.PeanoNatural
- Morley.Util.ShowType
- Morley.Util.Sing
- Morley.Util.SizedList
- Morley.Util.StubbedProof
- Morley.Util.TH
- Morley.Util.Text
- Morley.Util.Type
- Morley.Util.TypeLits
- Morley.Util.TypeTuple
- Morley.Util.Typeable
Downloads
- morley-1.20.0.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Readme for morley-1.20.0
[back to package description]⚠️ Note: this project is deprecated.
It is no longer maintained since the activation of protocol "Nairobi" on the Tezos mainnet (June 24th, 2023).
Morley: Developer tools for the Michelson Language
Morley aims to make writing smart contracts in Michelson pleasant and effective. It contains 2 major things:
- An executable that lets you perform various operations on Michelson smart contracts.
- A library with core Tezos and Michelson data types, and functions such as Michelson typechecker and interpreter.
Morley executable
Dependencies
To install using stack or cabal, you need to install libsodium first.
If installing into a non-standard location, after its installation is complete, add
the directory containing libsodium.so to your LD_LIBRARY_PATH environment
variable. Otherwise, compilation with stack or cabal will fail.
How to install
There are three ways to get Morley executable:
- Docker based (preferable).
- Get script
(e. g. using
curl https://gitlab.com/morley-framework/morley/raw/master/scripts/morley.sh > morley.sh) and run it./morley.sh <args>. This script will pull a docker image that contains the latest version of Morley executable from theproductionbranch and run it with the given arguments. You'll needcoreutilsto be installed in order to usemorley.sh. - Usage example:
./morley.shto see help message./morley.sh run --contract add1.tz --storage 1 --parameter 1 --amount 1
- Get script
(e. g. using
- Stack based.
- Clone this git repository and run
stack buildcommand, after that you can dostack exec -- morley <args>to run morley executable built from the source code. - Usage example:
stack exec -- morley --helpto see help messagestack exec -- morley originate --contract contracts/tezos_examples/attic/add1.tz --storage 1 --verbose
- Clone this git repository and run
- Cabal based.
- Clone this git repository, go to this directory and run
cabal new-update && cabal new-buildcommand, after that you can docabal new-run -- morley <args>to run morley executable built from the source code. - Usage example:
cabal new-run -- morley --helpto see help messagecabal new-run -- morley originate --contract contracts/tezos_examples/attic/add1.tz --storage 1 --verbose
- Clone this git repository, go to this directory and run
Usage
Morley executable does not interact with Tezos node and Tezos network. It works in emulated environment which is stored in a simple JSON file on disk. The following commands depend on environment and may modify it:
emulate originatea contract.emulate transfertokens to a given address (and call a smart contract if it's the destination).emulate runa contract. A given contract is being originated first, and then the transaction is being sent to it.
The following commands don't depend on environment:
optimizea contract by replacing certain sequences of instructions with equivalent but more efficient ones.typechecka contract.replstarts a REPL where you can type Michelson instructions and interpret them.analyzea contract and print some statistics about it.printa contract in vanilla Michelson format. It can be useful in some cases:- You have a contract with inconsistent/ugly formatting and want to format it in uniform style.
- You want to print a contract on a single line.
parsea contract and return its representation in Haskell types.
NOTE: $TERM and $TERMINFO environment variables need to be set for an enhanced terminal experience when using utilities like
repl
You can get more info about these commands by running morley <command> --help.
Run morley --help to get the list of all commands.
Morley library
Morley-the library is available on Hackage. To use morley as library, simply include it in the package.yaml.
It is recommended to also
add morley extra-deps to your stack.yaml. The extra-deps can be found here.
The library consists of the following parts:
- The
Morley.Tezos.*hierarchy (Morley.Tezos.Address,Morley.Tezos.Core,Morley.Tezos.Crypto) is designed to implement cryptographic primitives, string and byte formats, and any other functionality specific to the Tezos protocol which is required for testing/execution of Michelson contracts but is used not only by Michelson. Morley.Michelson.UntypedandMorley.Michelson.Typedhierarchies define Haskell data types that assemble a Michelson contract. See michelsonTypes.md.Morley.Michelson.TypeCheck: A typechecker that validates Michelson contracts according to the Michelson's typing rules. Essentially, it performs conversion from untyped representation to the typed one. See morleyTypechecker.md.Morley.Michelson.Interpret: An interpreter for Michelson contracts which doesn't perform any side effects. See morleyInterpreter.md.Morley.Michelson.MacroTypes for macros, syntactic sugar, and other extensions that are described in the next chapter.Morley.Michelson.ParserA parser to turn a.tzinto a Haskell ADT.Morley.Michelson.Runtime: A high-level interface to Morley functionality, see morleyRuntime.md.- The
Morley.Micheline.*hierarchy (Morley.Micheline.Binary,Morley.Micheline.Class,Morley.Micheline.Expression,Morley.Micheline.Json) contains the representation of MichelineExpressions, conversion to/from Michelson values, as well as encoding/decoding to/from JSON and binary format. - The
Morley.Util.*hierarchy defines variousMorley-related utilities that are used all over the project.