Contract Interface

Terms

  • Contract State - data associated with a contract that can be retrieved by Applications and Components.
  • Delta - Represents a modification to some state - similar to a diff in source code
  • Parameters - Data that forms part of a contract along with the WebAssembly code
  • State Summary - A compact summary of a contract's state that can be used to create a delta

Interface

Locutus contracts must implement the contract interface from crates/locutus-stdlib/src/interface.rs:

{{#include ../../crates/locutus-stdlib/src/interface.rs:contractifce}}

Parameters, State, and StateDelta are all wrappers around simple [u8] byte arrays for maximum efficiency and flexibility.

Contract Interaction

In the (hopefully) near future we'll be adding the ability for contracts to read each other's state while validating and updating their own, see issue #167 for the latest on this.