Skip to content
On this page

Compilation targets โ€‹

Compilation targets allow users to produce multiple compiled variations for contracts and expressions.

It is usually used with the CLI to produce the contract code and its initial storage.

Adding a Compilation Target โ€‹

Contract compilation โ€‹

It compiles a contract with name with optional storage.

sp.add_compilation_target(name, contract, storage = None)

Expression compilation โ€‹

It compiles an expression called name.

sp.add_expression_compilation_target(name, expression)

Examples โ€‹

# A contract with an empty (unit) storage
sp.add_compilation_target("min_comp", MyContract())

# A contract with a simple int storage
sp.add_compilation_target("min_comp_int", MyContract(x = 1))

# An expression
sp.add_expression_compilation_target("x", 42)

# Another expression
sp.add_expression_compilation_target("y", ("a", [1, 2, 3]))