Skip to content

Commit 3484f0f

Browse files
Better run
1 parent 58c8d8f commit 3484f0f

37 files changed

+17965
-993
lines changed

output.json

+567
Large diffs are not rendered by default.

package-lock.json

+993-978
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

run.bat

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
call npm run compile
2-
coffee src/EntryPoint.coffee %1 %2 %3 %4 %5 %6 %7
1+
call run subscribe localhost 3050

run.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
npm run compile
2-
coffee src/EntryPoint.coffee $1 $2 $3 $4 $5 $6 $7
1+
run subscribe localhost 3050

run2.bat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
call npm run compile
2+
coffee src/EntryPoint.coffee %1 %2 %3 %4 %5 %6 %7

run2.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npm run compile
2+
coffee src/EntryPoint.coffee $1 $2 $3 $4 $5 $6 $7

src/models/address.cto

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace org.accordproject.address
2+
3+
/**
4+
* Based on http://schema.org/PostalAddress
5+
*/
6+
concept PostalAddress {
7+
o String streetAddress optional
8+
o String postalCode optional
9+
o String postOfficeBoxNumber optional
10+
o String addressRegion optional
11+
o String addressLocality optional
12+
o String addressCountry optional
13+
}

src/models/cicero/contract.cto

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
namespace org.accordproject.cicero.contract
2+
3+
/**
4+
* Contract Data
5+
* -- Describes the structure of contracts and clauses
6+
*/
7+
8+
/* A contract state is an asset -- The runtime state of the contract */
9+
asset AccordContractState identified by stateId {
10+
o String stateId
11+
}
12+
13+
/* A party to a contract */
14+
participant AccordParty identified by partyId {
15+
o String partyId
16+
}
17+
18+
/* A contract is a asset -- This contains the contract data */
19+
abstract asset AccordContract identified by contractId {
20+
o String contractId
21+
--> AccordParty[] parties optional
22+
}
23+
24+
/* A clause is an asset -- This contains the clause data */
25+
abstract asset AccordClause identified by clauseId {
26+
o String clauseId
27+
}

src/models/cicero/dom.cto

+198
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
namespace org.accordproject.cicero.dom
2+
3+
import org.accordproject.cicero.contract.AccordParty from https://models.accordproject.org/cicero/contract.cto
4+
5+
/**
6+
* Describes the structure of the natural language and automated clauses for
7+
* contract and clause templates.
8+
*
9+
* Scoping
10+
* =======
11+
*
12+
* The @scope annotation is used to tag elements that can only be used in
13+
* clause templates, contract templates or used in both.
14+
*
15+
* Elements tagged with the ContractTemplate scope may appear in the DOM tree
16+
* under a root ContractTemplate.
17+
*
18+
* Elements tagged with the ClauseTemplate scope may appear in the DOM tree
19+
* under the root ClauseTemplate.
20+
*
21+
* Elements tagged with both ContractTemplate and ClauseTemplate may appear
22+
in the DOM tree for either a ContractTemplate or ClauseTemplate.
23+
*/
24+
25+
/**
26+
* DOM metadata
27+
*/
28+
concept Metadata {
29+
o String version default="1.0" // version of the DOM
30+
o String locale default="en-US" // Default locale. IETF Language Tag specification (BCP 47)
31+
}
32+
33+
/**
34+
* An abstract base type
35+
*/
36+
abstract asset Element identified by id {
37+
o String id
38+
}
39+
40+
/**
41+
* Root type for contract templates
42+
*/
43+
asset ContractTemplate extends Element {
44+
o Metadata metadata
45+
o Section content optional
46+
}
47+
48+
/**
49+
* Root type for clause templates
50+
*/
51+
@scope(ContractTemplate)
52+
asset ClauseTemplate extends Element {
53+
o Metadata metadata
54+
o Section content optional
55+
}
56+
57+
/**
58+
* A block of (unparameterized) natural language text in a template
59+
*/
60+
@scope(ContractTemplate, ClauseTemplate)
61+
asset Text extends Element {
62+
o String content
63+
o String locale optional // if not specified inherits the locale of the owning clause or contract
64+
}
65+
66+
/**
67+
* A parameter in a template. The parameter has a name and optionally a fully-qualified type name
68+
* and a description. If the type name is present then the type MUST NOT be present in the template model
69+
* for the contract or clause and will be dyanmically added. If the type is not present then the template
70+
* model MUST HAVE a property with the name.
71+
*/
72+
@scope(ContractTemplate, ClauseTemplate)
73+
asset Parameter extends Element {
74+
o String name // the name of the parameter
75+
o String description optional
76+
o String type optional // the type of the parameter if defined inline. If not specified the parameter must be in the template model.
77+
o BooleanExpression constraint optional // An expression to constrain the parameter.
78+
}
79+
80+
/**
81+
* An element that must be one of a set of options.
82+
*/
83+
@scope(ContractTemplate, ClauseTemplate)
84+
asset Choice extends Element {
85+
o Element[] options
86+
o Boolean required
87+
}
88+
89+
/**
90+
* An element that must be included if a predicate is true
91+
*/
92+
@scope(ContractTemplate, ClauseTemplate)
93+
asset Conditional extends Element {
94+
o Element element
95+
o BooleanExpression predicate
96+
}
97+
98+
/**
99+
* A reference to a clause via a URI. The URI scheme is opaque to the specification
100+
* but can include external clauses with URIs like ap://[email protected]#8fd9219cf577fe121cdd05d7b0c340fbe0755dc8aec3c6ff818d3b4e5d5a863f
101+
* or internal clauses with URIs like internal://MyContractSpecificClause
102+
*/
103+
@scope(ContractTemplate)
104+
abstract asset Clause extends Element {
105+
o String templateUri
106+
}
107+
108+
/**
109+
* A concept that captures the description and reference to a signing party to the contract
110+
*/
111+
@scope(ContractTemplate)
112+
concept SigningParty {
113+
o Text description
114+
--> AccordParty party
115+
}
116+
117+
/**
118+
* A set of signing parties for a contract
119+
*/
120+
@scope(ContractTemplate)
121+
asset Signatures extends Element {
122+
o SigningParty[] parties
123+
}
124+
125+
/**
126+
* A link to an element in the contract.
127+
*/
128+
@scope(ContractTemplate, ClauseTemplate)
129+
asset Link extends Element {
130+
--> Element reference
131+
}
132+
133+
/**
134+
* A section of a contract or clause. A section has a heading
135+
* and an optional set of child elements. A section can optionally include
136+
* a page break.
137+
*/
138+
@scope(ContractTemplate, ClauseTemplate)
139+
asset Section extends Element {
140+
o Text heading
141+
o Element[] children optional
142+
o Boolean pageBreak default=false
143+
}
144+
145+
/**
146+
* List styles to support both ordered (numbered) lists, unordered (bullet) lists
147+
* and lists displayed on a single line
148+
*/
149+
enum ListStyle {
150+
o ORDERED // numbers
151+
o UNORDERED // bullets
152+
o SINGLE_LINE // a separated list on a single line
153+
}
154+
155+
/**
156+
* A list is a section that numbers or bullets its child elements
157+
*/
158+
@scope(ContractTemplate, ClauseTemplate)
159+
asset List extends Section {
160+
o ListStyle style
161+
o String separator optional
162+
}
163+
164+
/**
165+
* Logic can be inlined in contracts or clauses
166+
*/
167+
abstract asset Script extends Element {
168+
o String language default="ERGO"
169+
o String version
170+
o String code
171+
}
172+
173+
/**
174+
* Logic declarations (constants, functions) can be included in a contract to perform basic calculations
175+
*/
176+
@scope(ContractTemplate)
177+
asset Declarations extends Script {
178+
}
179+
180+
/**
181+
* Expressions can be included to construct part of the output contract or check constraints on parameters
182+
*/
183+
abstract asset Expression extends Script {
184+
}
185+
186+
187+
/**
188+
* An expression to that returns an element
189+
*/
190+
@scope(ContractTemplate, ClauseTemplate)
191+
asset ElementExpression extends Expression{
192+
}
193+
194+
/**
195+
* An expression that returns true or false
196+
*/
197+
asset BooleanExpression extends Expression{
198+
}

src/models/cicero/runtime.cto

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
namespace org.accordproject.cicero.runtime
2+
3+
import org.accordproject.cicero.contract.* from https://models.accordproject.org/cicero/contract.cto
4+
import org.accordproject.money.MonetaryAmount from https://models.accordproject.org/money.cto
5+
6+
/**
7+
* Contract API
8+
* -- Describes input and output of calls to a contract's clause
9+
*/
10+
11+
/* A request is a transaction */
12+
transaction Request {}
13+
14+
/* A response is a transaction */
15+
transaction Response {}
16+
17+
/* An Error is a transaction */
18+
abstract transaction ErrorResponse {}
19+
20+
/* An event that represents an obligation that needs to be fulfilled */
21+
abstract event Obligation {
22+
/* A back reference to the governing contract that emitted this obligation */
23+
--> AccordContract contract
24+
25+
/* The party that is obligated */
26+
--> Participant promisor optional // TODO make this mandatory once proper party support is in place
27+
28+
/* The party that receives the performance */
29+
--> Participant promisee optional // TODO make this mandatory once proper party support is in place
30+
31+
/* The time before which the obligation is fulfilled */
32+
o DateTime deadline optional
33+
}
34+
35+
event PaymentObligation extends Obligation{
36+
o MonetaryAmount amount
37+
o String description
38+
}
39+
40+
event NotificationObligation extends Obligation {
41+
o String title
42+
o String message
43+
}
44+
45+
/* A payload has contract data, a request and a state */
46+
concept Payload {
47+
o AccordContract contract // the contract data
48+
o Request request
49+
o AccordContractState state optional
50+
}
51+
52+
/* If the call to a contract's clause succeeds, it returns a response, a list of events and a new state */
53+
concept Success {
54+
o Response response
55+
o AccordContractState state
56+
o Event[] emit
57+
}
58+
/* If the call to a contract's clause fails, it returns and error */
59+
concept Failure {
60+
o ErrorResponse error
61+
}
62+
63+
/**
64+
* The functional signature for a contract call is as follows:
65+
* clausecall : String contractName -> String clauseName -> Payload payload -> Success | Failure
66+
*/

src/models/color.cto

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace org.accordproject.color
2+
3+
enum Color {
4+
o Red // Red
5+
o Orange // Orange
6+
o Yellow // Yellow
7+
o Green // Green
8+
o Blue // Blue
9+
}

src/models/finance/bond.cto

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
namespace org.accordproject.finance.bond
2+
3+
import org.accordproject.organization.Organization from https://models.accordproject.org/organization.cto
4+
import org.accordproject.time.Duration from https://models.accordproject.org/time.cto
5+
import org.accordproject.money.CurrencyCode from https://models.accordproject.org/money.cto
6+
7+
enum CouponType {
8+
o FIXED
9+
o FLOATING
10+
}
11+
12+
concept PaymentFrequency {
13+
o Integer periodMultiplier
14+
o Duration period
15+
}
16+
17+
/**
18+
* Definition of a Bond, based on the FpML schema:
19+
* http://www.fpml.org/spec/fpml-5-3-2-wd-2/html/reporting/schemaDocumentation/schemas/fpml-asset-5-3_xsd/elements/bond.html
20+
*
21+
*/
22+
concept Bond {
23+
o String[] instrumentId
24+
o String description optional
25+
o CurrencyCode currency optional
26+
o String[] exchangeId
27+
o String clearanceSystem optional
28+
o String definition optional
29+
o String seniority optional
30+
o CouponType couponType optional
31+
o Double couponRate optional
32+
o DateTime maturity
33+
o Double parValue
34+
o Double faceAmount
35+
o PaymentFrequency paymentFrequency
36+
o String dayCountFraction
37+
--> Organization issuer
38+
}
39+
40+
asset BondAsset identified by ISINCode {
41+
o String ISINCode
42+
o Bond bond
43+
}

0 commit comments

Comments
 (0)