Skip to content

Commit

Permalink
tests: add sample for accordproject#851
Browse files Browse the repository at this point in the history
  • Loading branch information
prekel committed Jul 6, 2022
1 parent edcc9f0 commit efcc69b
Show file tree
Hide file tree
Showing 12 changed files with 557 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/OptionalDateTime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Issue 851 sample

https://github.com/accordproject/ergo/issues/851

```
cicero draft --template . --data ./data.json --unquoteVariables
```
6 changes: 6 additions & 0 deletions tests/OptionalDateTime/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$class": "org.accordproject.empty.EmptyContract",
"contractId": "573de9a8-d011-45f0-ab11-144d27941c9f",
"$identifier": "573de9a8-d011-45f0-ab11-144d27941c9f",
"myDate": "2025-01-01T00:00:00"
}
23 changes: 23 additions & 0 deletions tests/OptionalDateTime/logic/logic.ergo
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace org.accordproject.empty

import org.accordproject.time.*

contract Empty over EmptyContract {
clause donothing(request : EmptyRequest) : EmptyResponse {
return EmptyResponse{}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

concerto version ">= 1.0.0"

namespace org.accordproject.contract

/**
* Contract Data
* -- Describes the structure of contracts and clauses
*/

/* A contract is a asset -- This contains the contract data */
abstract asset Contract identified by contractId {
o String contractId
}

/* A clause is an asset -- This contains the clause data */
abstract asset Clause identified by clauseId {
o String clauseId
}
244 changes: 244 additions & 0 deletions tests/OptionalDateTime/model/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace org.accordproject.money

/**
* Represents an amount of Cryptocurrency
*/
concept DigitalMonetaryAmount {
o Double doubleValue
o DigitalCurrencyCode digitalCurrencyCode
}

/**
* Digital Currency codes. From https://en.wikipedia.org/wiki/List_of_cryptocurrencies
*/
enum DigitalCurrencyCode {
o ADA
o BCH
o BTC
o DASH
o EOS
o ETC
o ETH
o LTC
o NEO
o XLM
o XMR
o XRP
o ZEC
}

/**
* Represents an amount of money
*/
concept MonetaryAmount {
o Double doubleValue // convert to fixed-point?
o CurrencyCode currencyCode
}

/**
* ISO 4217 codes. From https://en.wikipedia.org/wiki/ISO_4217
* https://www.currency-iso.org/en/home/tables/table-a1.html
*/
enum CurrencyCode {
o AED
o AFN
o ALL
o AMD
o ANG
o AOA
o ARS
o AUD
o AWG
o AZN
o BAM
o BBD
o BDT
o BGN
o BHD
o BIF
o BMD
o BND
o BOB
o BOV
o BRL
o BSD
o BTN
o BWP
o BYN
o BZD
o CAD
o CDF
o CHE
o CHF
o CHW
o CLF
o CLP
o CNY
o COP
o COU
o CRC
o CUC
o CUP
o CVE
o CZK
o DJF
o DKK
o DOP
o DZD
o EGP
o ERN
o ETB
o EUR
o FJD
o FKP
o GBP
o GEL
o GHS
o GIP
o GMD
o GNF
o GTQ
o GYD
o HKD
o HNL
o HRK
o HTG
o HUF
o IDR
o ILS
o INR
o IQD
o IRR
o ISK
o JMD
o JOD
o JPY
o KES
o KGS
o KHR
o KMF
o KPW
o KRW
o KWD
o KYD
o KZT
o LAK
o LBP
o LKR
o LRD
o LSL
o LYD
o MAD
o MDL
o MGA
o MKD
o MMK
o MNT
o MOP
o MRU
o MUR
o MVR
o MWK
o MXN
o MXV
o MYR
o MZN
o NAD
o NGN
o NIO
o NOK
o NPR
o NZD
o OMR
o PAB
o PEN
o PGK
o PHP
o PKR
o PLN
o PYG
o QAR
o RON
o RSD
o RUB
o RWF
o SAR
o SBD
o SCR
o SDG
o SEK
o SGD
o SHP
o SLL
o SOS
o SRD
o SSP
o STN
o SVC
o SYP
o SZL
o THB
o TJS
o TMT
o TND
o TOP
o TRY
o TTD
o TWD
o TZS
o UAH
o UGX
o USD
o USN
o UYI
o UYU
o UZS
o VEF
o VND
o VUV
o WST
o XAF
o XAG
o XAU
o XBA
o XBB
o XBC
o XBD
o XCD
o XDR
o XOF
o XPD
o XPF
o XPT
o XSU
o XTS
o XUA
o XXX
o YER
o ZAR
o ZMW
o ZWL
}

/**
* Represents a currency conversion pair and exchange rate
*/
concept CurrencyConversion {
o CurrencyCode from
o CurrencyCode to
o Double rate
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

concerto version ">= 1.0.0"

namespace org.accordproject.runtime

import org.accordproject.contract.Contract from https://models.accordproject.org/accordproject/contract.cto

/**
* Runtime API
* -- Describes input and output of calls to a contract's clause
*/

/* A request is a transaction */
transaction Request {
}

/* A response is a transaction */
transaction Response {
}

/* An event that represents an obligation that needs to be fulfilled */
abstract event Obligation identified {
/* A back reference to the governing contract that emitted this obligation */
--> Contract contract

/* The party that is obligated */
--> Participant promisor optional

/* The party that receives the performance */
--> Participant promisee optional

/* The time before which the obligation is fulfilled */
o DateTime deadline optional
}

/* A contract state is an asset -- The runtime state of the contract */
asset State {
}
Loading

0 comments on commit efcc69b

Please sign in to comment.