The ACTUS Foundation's Algorithmic Contract Types transform diverse financial instruments into algorithmically defined cash-flow patterns. The patterns exhibited in these contract types work similarly to smart contracts on a blockchain: Events are observed by the contracts in the form of some transaction or progression in time, and the contract may respond by generating a new transaction and moving to some new state. Since the ACTUS Algorithmic Contract Types are algorithmic in nature, their translation into smart contracts written in a programming language for a blockchain works quite beautifully.
IOHK's domain-specific smart-contract language Marlowe was built to simplify the translation of financial contracts into smart-contracts that can run on the Cardano blockchain. Implementing the ACTUS standards in Marlowe is the beautiful, inevitable conclusion of the search for formalization of financial smart contracts.
The goal of this project is to extend the ACTUS implementation in Marlowe by adding additional contract types to IOHK's Marlowe Playground, a web-based interactive development environment for Marlowe smart contracts. Furthermore, we aim to extend Marlowe's coverage of the ACTUS standard by adding the currently unimplemented applicability model to Marlowe.
What it does
This project extends the ACTUS implementation in Marlowe two-fold.
First, a contract generator for linear amortizer financial contracts has been added. This contract generator is similar to the already implemented principal at maturity contract generator in that the principal payment happens at the initial exchange date of the contract. The difference is in the repayment. The linear amortizer generator will create periodic repayments of fixed amounts. The interest payment is recalculated with each repayment of the principal. This is in contrast to the principal at maturity contract which has a one time principal repayment at the contracts maturity date. With this new contract generator, users of the Marlowe playground can easily generate more complicated smart contracts that will run on any blockchain that supports Marlowe.
Second, we implemented the ACTUS applicability model for both the linear amortizer and principal at maturity contract generators. The models the ACTUS standard defines for financial contracts are the schedule model, the contract state initialization, the contract payoff/state transition model, and the contract applicability model. The latter model had not been implemented in features the Marlowe playground already provides for ACTUS in Marlowe. This project has filled that hole, and in the future the Marlowe playground can now implement the full ACTUS definition for any type of financial contract.
How we built it
This project was built in Haskell and PureScript in a fork of the IOHK plutus repository. A special thanks goes to Dmytro Kondratiuk for his help in pointing our team in the right direction to begin the project, and aiding in understanding the ACTUS specification.
Challenges we ran into
The first challenge our team faced was getting a development environment set up. The Marlowe playground uses quite a few tools in concert to get the website up and running. Using Docker containers, we were able to create a modular development environment that could be used by all team members.
From there our team was able to make steady work, and any confusion during development was easily cleared up by asking the challenge runners for clarification.
What's next for Marlowe Actus Enhancement
The next steps are to implement more contract generators for ACTUS contract types. With the work already done, annutities, negative ammortizers, and exotic linear ammortizer are all good choices for the next generator to work on.