Cicero
What is Cicero?
Smart agreements require machine executable components to be included within the text of documents. The Cicero format enables contract text to be converted to structured templates.
Cicero templates consist of:
- a data model defining the agreement variables and their format
- agreement text; and
- optional business logic to add executable functions to the document.
Why is it helpful?
With Cicero, users are able to build templates and agreements using reusable domain models and markup to define clauses, sections, links, lists, tables, expressions, embed execution logic, and more. Cicero also includes a Node.js VM designed to be easily embeddable across a wide-variety of form factors: web, middleware, SaaS, on-blockchain execution and off-blockchain execution.
Example Template
template.tem
Late Delivery and Penalty. In case of delayed delivery of Goods, {{buyer}} shall pay to {{seller}} a penalty amounting to {{penaltyPercentage}}% of the total value of the Goods for every {{penaltyDuration}} of delay. If the delay is more than {{maximumDelay}}, the Buyer is entitled to terminate this Contract.
model.cto
namespace org.accordproject.minilatedeliveryandpenalty
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
import org.accordproject.time.* from https://models.accordproject.org/v2.0/time.cto
/**
* Data Model for the LateDeliveryAndPenalty template.
*/
asset MiniLateDeliveryClause extends AccordClause {
o AccordParty buyer // Party to the contract (buyer)
o AccordParty seller // Party to the contract (seller)
o Duration penaltyDuration // Length of time resulting in penalty
o Double penaltyPercentage // Penalty percentage
o Duration maximumDelay // Maximum delay before termination
}
/**
* Defines the input data required by the template
*/
transaction MiniLateDeliveryRequest extends Request {
o DateTime agreedDelivery
o DateTime deliveredAt optional
o Double goodsValue
}
/**
* Defines the output data for the template
*/
transaction MiniLateDeliveryResponse extends Response {
o Double penalty
o Boolean buyerMayTerminate
}
Example Logic
logic.ergo
namespace org.accordproject.minilatedeliveryandpenalty
import org.accordproject.time.*
contract MiniLateDelivery over MiniLateDeliveryClause {
clause latedeliveryandpenalty(request : MiniLateDeliveryRequest) : MiniLateDeliveryResponse {
// Guard against calling late delivery clause too early
let agreed = request.agreedDelivery;
// Calculate the time difference between current date and agreed upon date
let diff : Duration = diffDurationAs(now, agreed, 'days');
let diffRatio : Double = divideDuration(diff, durationAs(contract.penaltyDuration, 'days'));
// Penalty formula
let penalty = diffRatio * contract.penaltyPercentage / 100.0 * request.goodsValue;
// Return the response with the penalty and termination determination
return MiniLateDeliveryResponse{
penalty: penalty,
buyerMayTerminate: diff.amount > durationAs(contract.maximumDelay, 'days').amount
}
}
}
Features
Neutrality
Cicero is designed to be technically neutral — a ‘.doc’ format for executable agreements. Templates formatted using Cicero enable components (e.g. clauses or sections) to be executed in separately defined environments. For example, an agreement may comprise clauses that execute off-chain and clauses that execute on a blockchain.
Markup
Quickly and easily structure an agreement using markup language.
Extensibility
The Cicero templating system is built to be easily extensible in order to support new, additional, and updated components.
Standardization
By supporting reusable models, users are able to quickly and easily create structured templates using industry standard business domain schemas and specifications (e.g. patents, loans, etc); enabling contracts and clauses to be standardized and content verified.