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

You can upload your own Smart Clause® Templates to your private library, or the library for your organization, by switching to the Libraries 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 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. Actions are only triggered in Clause when obligations are emitted by a template. For Clause to detect that your template can emit obligations add the emits declaration to your clause definition. e.g. 

clause contractSigned(request: ContractSigned): Response emits PaymentObligation{

5. Clause indicates that a contract is COMPLETED when all of its Smart Clause® Templates 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 {