-
Notifications
You must be signed in to change notification settings - Fork 0
How to create a new contract
Denys Zadorozhnyi edited this page Feb 10, 2020
·
1 revision
Prerequisites:
- Install Z3 SMT solver from https://github.com/Z3Prover/z3
The first parameter has to be ctx: Context
, and subsequent parameters may be contract parameters. The return value has to be SigmaProp
. Make the first line of the contract code import ctx._
to improve readability.
See buy order
4. Create a subclass (object) of the class with contract code to make "instance" method to compile the code.
It'll a place to invoke the compiler (macros) and embed contract parameters. Create a method with parameters from the contract (without Context
parameter) and invoke ErgoContractCompiler.compile
. See buy order example
Mark this method with @ignore
annotation to hide it from Stainless.
Call returned ErgoContract.scalaFunc
to run the contract with given Context
. See buy order tests