• This repository has been archived on 07/Sep/2023
  • Stars
    star
    157
  • Rank 238,399 (Top 5 %)
  • Language Coq
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Programming Language for Smart Legal Contracts

Ergo logo

Build Status Build Mechanization Status Coverage Status GitHub license downloads npm version Join the Accord Project Discord Server

Introduction

This is the source code for the Ergo compiler. Ergo is the Accord Project language for Smart Legal Contracts.

The Ergo compiler is distributed as an npm package.

The Ergo compiler is written using the Coq proof assistant, with parsing and support code written in OCaml. It makes extensive use of the Q*cert compiler for code generation and type checking.

Both the Ergo language and its compiler are in early development phase. If you would like to build from source or to contribute, consult the DEVELOPERS file.

Try Ergo online

If you want to take a peek at Ergo without installing anything, check out the interactive REPL (read-eval-print-loop) for Ergo stand-alone, or the Accord Project Template Studio which illustrates Ergo in Accord Project templates.

Documentation

The most recent Ergo documentation is in the [Ergo Language Guide][docergo].

Structure of the Code Repository

Top level repository (ergo), with sub packages. Each sub-package is published as an independent npm module using lerna:

  • ergo-cli : Command line interface for the Ergo compiler
  • ergo-compiler : Core classes for the Ergo compiler
  • ergo-engine : A Node.js VM based execution engine for Ergo
  • ergo-test : Cucumber based testing for Ergo

Installation

The easiest way to install Ergo is as a Node.js package. Once you have Node.js installed on your machine, you can get the Ergo compiler and command-line using the Node.js package manager by typing the following in a terminal:

$ npm install -g @accordproject/ergo-cli

This will install the Ergo command-line (ergo) and Read-Eval-Print-Loop (ergotop). Those will allow you to create, test and compile Ergo contracts. You can check your installed version by typing the following in a terminal:

$ ergo --version

Or to get command line help:

$ ergo --help
ergo <command>

Commands:
  ergo draft       create a contract text from data
  ergo trigger     send a request to the contract
  ergo invoke      invoke a clause of the contract
  ergo initialize  initialize the state for a contract
  ergo compile     compile a contract

Options:
  --help         Show help                                             [boolean]
  --version      Show version number                                   [boolean]
  --verbose, -v                                                 [default: false]

Create contract text

To create a contract text from a contract:

$ ergo draft --template ./tests/volumediscount --data ./tests/volumediscount/data.json

Initialize a contract

To obtain the initial state of the contract:

$ ergo initialize --template ./tests/volumediscount --data ./tests/volumediscount/data.json
06:40:29 - info:

Send a request to a contract

To send a request to a contract:

$ ergo trigger --template ./tests/volumediscount --data ./tests/volumediscount/data.json --request ./tests/volumediscount/request.json --state ./tests/volumediscount/state.json
06:40:01 - info:
{
  "clause": "orgXaccordprojectXvolumediscountXVolumeDiscount",
  "request": {
    "$class": "org.accordproject.volumediscount.VolumeDiscountRequest",
    "netAnnualChargeVolume": 10.4
  },
  "response": {
    "$class": "org.accordproject.volumediscount.VolumeDiscountResponse",
    "discountRate": 2.8,
    "transactionId": "13fa7cb6-03fc-4fd8-8e12-9a85ac8d5eb7",
    "timestamp": "2019-10-12T23:56:33.688Z"
  },
  "state": {
    "$class": "org.accordproject.cicero.contract.AccordContractState",
    "stateId": "1"
  },
  "emit": []
}

Invoke a clause

To invoke a specific clause of the contract:

$ ergo invoke --template ./tests/volumediscount --clauseName volumediscount --data ./tests/volumediscount/data.json --params ./tests/volumediscount/params.json --state ./tests/volumediscount/state.json

Compile a contract

To compile your first Ergo contract to JavaScript:

$ ergo compile ./tests/volumediscount/model/model.cto ./tests/volumediscount/logic/logic.ergo
Processing file: ./tests/volumediscount/logic.ergo -- compiled to: ./tests/volumediscount/logic.js

By default, Ergo compiles to JavaScript for execution. You can inspect the compiled JavaScript code in ./tests/volumediscount/logic.js


Accord Project Logo

GitHub license Join the Accord Project Discord Server

Accord Project is an open source, non-profit, initiative working to transform contract management and contract automation by digitizing contracts. Accord Project operates under the umbrella of the Linux Foundation. The technical charter for the Accord Project can be found here.

Learn More About Accord Project

Overview

Documentation

Contributing

The Accord Project technology is being developed as open source. All the software packages are being actively maintained on GitHub and we encourage organizations and individuals to contribute requirements, documentation, issues, new templates, and code.

Find out what’s coming on our blog.

Join the Accord Project Technology Working Group Discord Server to get involved!

For code contributions, read our CONTRIBUTING guide and information for DEVELOPERS.

README Badge

Using Accord Project? Add a README badge to let everyone know: accord project

[![accord project](https://img.shields.io/badge/powered%20by-accord%20project-19C6C8.svg)](https://www.accordproject.org/)

License

Accord Project source code files are made available under the Apache License, Version 2.0. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0).

Copyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See LF Projects Trademark Policy.

More Repositories

1

template-archive

Smart Legal Contracts & Templating System
JavaScript
281
star
2

concerto

Business schema language and runtime
JavaScript
118
star
3

web-components

React Components for Accord Project
JavaScript
117
star
4

cicero-template-library

Accord Project Template Library
HTML
81
star
5

markdown-transform

Parse and transform markdown text, including TemplateMark markdown templates
JavaScript
71
star
6

techdocs

Accord Project Documentation
CSS
60
star
7

lab-concerto-graph

Graph Storage for Concerto Models
TypeScript
45
star
8

markdown-editor

Markdown editor based on Slate.js
JavaScript
42
star
9

template-studio

A Web UI for creating, editing and testing Accord Project templates
JavaScript
32
star
10

cicero-ui

A library of React components for Accord Project templates
JavaScript
29
star
11

models

Accord Project Model Repository
JavaScript
29
star
12

cicero-word-add-in

A plugin to allow users to interact with Accord Project templates directly in MS Word.
JavaScript
19
star
13

template-playground

Web Playground for TemplateMark templates
TypeScript
18
star
14

cicero-word-add-in-deprecated

Microsoft Word add-in for the Accord Project
JavaScript
17
star
15

vscode-extension

VS Code extension for editing Accord Project artifacts
TypeScript
15
star
16

template-studio-v2

Web UI for creating, editing and testing Accord Project templates
JavaScript
15
star
17

hlf-cicero-contract

Accord Project Cicero contracts on Hyperledger Fabric v2
JavaScript
14
star
18

template-engine

Template Engine β€” converts TemplateMark + JSON data to AgreementMark
TypeScript
10
star
19

aws-qldb-lambda

[INCUBATION] Accord Project Smart Legal Contracts on AWS
JavaScript
9
star
20

governance

Governance and non-technical documentation for the Accord Project
9
star
21

cicero-perishable-network

Hyperledger Composer business network that invokes an out of process cicero-server
JavaScript
8
star
22

labs-cicero-classify

This project investigates the automatic Identification And Classification of Contract Data Types with NLP Models
Jupyter Notebook
7
star
23

technical-steering-committee

Technical Steering Committee for Accord Project
TypeScript
7
star
24

lab-contract-design

Design document for Smart Legal Contracts Templates and Instances
6
star
25

concerto-tools

NOTICE: All content has been moved to the Concerto repository
JavaScript
5
star
26

concerto-codegen

JavaScript
5
star
27

web-components-starter

Starter React app for using AP web components
JavaScript
5
star
28

apap

Accord Project Agreement Protocol
HTML
3
star
29

working-groups

Working Group documentation for the Accord Project
3
star
30

concerto-metamodel

JavaScript
3
star
31

concerto-cli

JavaScript
3
star
32

lab-concerto-editor-web

Graphical Web Editor for Concerto Models
TypeScript
3
star
33

concerto-docs

Concerto Data Model Language Documentation Site
JavaScript
2
star
34

ergo-vscode-plugin

(Obsolete) Replaced by https://github.com/accordproject/cicero-vscode-extension
TypeScript
2
star
35

maestro

Tools and Samples for Hyperledger Fabric
JavaScript
2
star
36

concerto-dotnet

A .NET implementation of the Concerto Schema Language
C#
2
star
37

whitepaper-2024

2
star
38

vscode-web-extension

VSCode Extension to Edit Accord Project models and templates
TypeScript
1
star
39

slate-markdown-transform

(Obsolete) This project has been moved to: markdown-transform
JavaScript
1
star
40

org.accordproject.fpml.ecore

Convert ECore models to CTO (for FpML)
Java
1
star
41

contract-editor

Full text editor
JavaScript
1
star
42

template-cli

Command Line Interface for template engine and data format conversion
TypeScript
1
star