A domain-specific language for writing financial contracts targeting Move. It uses a functional and combinatorial approach for building reusable and safe smart contracts that are fast to develop.
Please note that the language is highly experimental and is designed for testing. It is currently in active development and we expect many breaking changes as it evolves. Stay tuned for exciting new announcements and updates 🎵
Programs are represented as combinations of contracts, inspired by this paper by Simon Peyton Jones, with a Haskell-like syntax. main
is the entrypoint for all programs, a simple example is
scaleK :: Word -> Contract -> Contract
scaleK k c = scale (konst k) c
main :: Contract
main = scaleK 10 one
These are the lowest-level of the contract combinators and are similar to those introduced by Jones in his paper referenced above. However, this is not exhaustive list and we plan to add more primitive combinators in the near future!
A trivial contract where neither the party nor the counterparty have any rights and obligations, for example
zero :: Contract
main :: Contract
main = zero
A contract where the party is paid a single microLibra from the funds of the contract, for example
one :: Contract
main :: Contract
main = one
A contract allowing the party to acquire an inner contract before a given date, for example
before :: Date -> Contract -> Contract
main :: Contract
main = before 2020-12-25T00:00:00Z one
A contract allowing the party to acquire an inner contract after a given date, for example
after :: Date -> Contract -> Contract
main :: Contract
main = after 2020-12-25T00:00:00Z one
A contract allowing the party to acquire an inner contract at any time, for example
anytime :: Contract -> Contract
main :: Contract
main = anytime one
A contract reversing the rights and obligations (between the party and counterparty) of an inner contract, for example
give :: Contract -> Contract
main :: Contract
main = give one
A contract allowing the party to acquire one of two inner contracts but not both, for example
or :: Contract -> Contract -> Contract
main :: Contract
main = or zero one
A contract allowing the party to acquire both of two inner contracts, for example
and :: Contract -> Contract -> Contract
main :: Contract
main = and zero one
A contract where the inner contract is scaled by a given observable, for example
scale :: Observable Word -> Contract -> Contract
main :: Contract
main = scale (konst 10) one