Smart Clause® Templates in Clause are managed in Template Libraries. By default Clause displays the templates in the Open Source Accord Project template library, and your private or organization template library.

You can upload your own Smart Clause Templates to your private template library, or the template library for your organization, by switching to the Templates page and then selecting your library.

You can then simply drag-and-drop (or browse your local or cloud file system) and upload the CTA file for your template.

If you're uploading an updated version of a template that already exists in your template library, make sure to update the version number to avoid a duplicate template error. You can do this by editing the "package.json" file, or if using Template Studio, from the left-hand sidebar.

Notes for Template Developers

If you're building a template that you plan to use on Clause, please bear in mind the following behaviour.

1. Clause calls the init clause of the template when a contract is sent out for signatures. This is helpful for setting the default state of a contract.

2. Once all signatures have been received for a contract, a ContractSigned request is sent to the contract. If you want perform an action immediately upon signature your template should include a clause that accepts a ContractSigned request according to the definition in the AccordProject model. For example, include this line in your model file:

import org.accordproject.signature.ContractSigned from

And include this line in your logic file:

import org.accordproject.signature.ContractSigned

3. State changes and emission of obligations only happen when a contract is in the RUNNING state. See the trigger API documentation for further information on submitting requests to a template.

4. Clause indicates that a contract is COMPLETED when all of its Smart Clauses are in the COMPLETED state.

The state for your template must have a top-level enumeration called status whose value must contain the enumeration value COMPLETED

See below for an example.

asset PaymentUponSignatureState extends AccordContractState {
  o ContractLifecycleStatus status

enum ContractLifecycleStatus {