Eat Apples

Author: Accord Project

eat-apples@0.10.1 Clause ^0.20.10 fc26b60d5cb6c23c4e85ea643a6931bca96c42ec94e467df522d80fb79864353

This is a clause enforcing healthy eating habits in employees.

Download Archive Download Compiled Archive Open in Template Studio Open in VSCode Web

Eat Apples!

This is a clause enforcing healthy eating habits in employees.

Template Text

Eating healthy clause between "Dan" (the Employee) and "ACME" (the Company). The canteen only sells apple products. Apples, apple juice, apple flapjacks, toffee apples. Employee gets fired if caught eating anything without apples in it. THE EMPLOYEE, IF ALLERGIC TO APPLES, SHALL ALWAYS BE HUNGRY. Apple products at the canteen are subject to a 4.5% tax.

Eating healthy clause between "Dan" (the Employee) and "ACME" (the Company). The canteen only sells apple products. Apples, apple juice, apple flapjacks, toffee apples. Employee gets fired if caught eating anything without apples in it. THE EMPLOYEE, IF ALLERGIC TO APPLES, SHALL ALWAYS BE HUNGRY. Apple products at the canteen are subject to a 4.5% tax.
Eating healthy clause between {{employee}} (the Employee) and {{company}} (the Company). The canteen only sells apple products. Apples, apple juice, apple flapjacks, toffee apples. Employee gets fired if caught eating anything without apples in it. THE EMPLOYEE, IF ALLERGIC TO APPLES, SHALL ALWAYS BE HUNGRY. Apple products at the canteen are subject to a {{tax}}% tax.
{
    "$class": "org.accordproject.canteen.CanteenClause",
    "clauseId": "ea6f48f8-d360-430c-a901-92363c6a2a2d",
    "employee": "Dan",
    "company": "ACME",
    "tax": 4.5
}

Template Model

namespace org.accordproject.canteen

import org.accordproject.cicero.contract.* from https://models.accordproject.org/cicero/contract.cto
import org.accordproject.cicero.runtime.* from https://models.accordproject.org/cicero/runtime.cto

transaction Food {
  o String produce
  o Double price
}

transaction Outcome {
  o String notice
}

event Bill {
  o String billTo
  o Double amount
}

asset CanteenClause extends AccordClause {
  o String employee
  o String company
  o Double tax
}

Model Dependencies

Template Logic

Find the full logic for this template on on GitHub.

State Types

Type Sample JSON
org.accordproject.cicero.contract.AccordContractState
{
    "$class": "org.accordproject.cicero.contract.AccordContractState",
    "stateId": "cc5ea801-c07a-11ea-ad77-8b5ce7c057ac"
}

Request Types

Type Sample JSON
org.accordproject.canteen.Food
{
    "$class": "org.accordproject.canteen.Food",
    "produce": "Cupidatat enim eu.",
    "price": 17.195,
    "transactionId": "cc5e80f0-c07a-11ea-ad77-8b5ce7c057ac",
    "timestamp": "2020-07-07T18:53:43.551+01:00"
}

Response Types

Type Sample JSON
org.accordproject.canteen.Outcome
{
    "$class": "org.accordproject.canteen.Outcome",
    "notice": "Minim.",
    "transactionId": "cc5ea800-c07a-11ea-ad77-8b5ce7c057ac",
    "timestamp": "2020-07-07T18:53:43.552+01:00"
}

Events Types

Type Sample JSON
org.accordproject.base.Event
{
    "abstract": "this is an abstract type"
}

Technical Integration

Please refer to the Cicero documentation for details and examples of how to integrate a call to a Cicero template into your application.

View the Latest code for this template on GitHub.