Skip to main content
Version: v2.1.0

Law Stone

Overview

The okp4-law-stone smart contract aims to provide GaaS (i.e. Governance as a Service) in any Cosmos blockchains using the CosmWasm framework and the Logic OKP4 module.

This contract is built around a Prolog program describing the law by rules and facts. The law stone is immutable, this means it can only been questioned, there is no update mechanisms.

The okp4-law-stone responsibility is to guarantee the availability of its rules in order to question them, but not to ensure the rules application.

To ensure reliability over time, the associated Prolog program is stored and pinned in a okp4-objectarium contract. Moreover, all the eventual loaded files must be stored in a okp4-objectarium contract as well, allowing the contract to pin them.

To be able to free the underlying resources (i.e. objects in okp4-objectarium) if not used anymore, the contract admin can break the stone.

➡️ Checkout the examples for usage information.

InstantiateMsg

Instantiate message

parameterdescription
program*(Required.) * Binary. The Prolog program carrying law rules and facts.
storage_address*(Required.) * string. The okp4-objectarium contract address on which to store the law program.

ExecuteMsg

Execute messages

ExecuteMsg::BreakStone

Break the stone making this contract unusable, by clearing all the related resources: - Unpin all the pinned objects on okp4-objectarium contracts, if any. - Forget the main program (i.e. or at least unpin it). Only the contract admin is authorized to break it, if any. If already broken, this is a no-op.

literal
"break_stone"

QueryMsg

Query messages

QueryMsg::Ask

If not broken, ask the logic module the provided query with the law program loaded.

parameterdescription
ask*(Required.) * object.
ask.query*(Required.) * string.

QueryMsg::Program

If not broken, returns the law program location information.

literal
"program"

Responses

ask

propertydescription
answerAnswer|null.
gas_used*(Required.) * integer.
height*(Required.) * integer.

program

ProgramResponse carry elements to locate the program in a okp4-objectarium contract.

propertydescription
object_id*(Required.) * string. The program object id in the okp4-objectarium contract.
storage_address*(Required.) * string. The okp4-objectarium contract address on which the law program is stored.

Definitions

Answer

propertydescription
has_more*(Required.) * boolean.
results*(Required.) * Array<Result>.
success*(Required.) * boolean.
variables*(Required.) * Array<string>.

Binary

A string containing Base64-encoded data.

type
string.

Result

propertydescription
substitutions*(Required.) * Array<Substitution>.

Substitution

propertydescription
term*(Required.) * object.
variable*(Required.) * string.

Term

propertydescription
arguments*(Required.) * Array<Term>.
name*(Required.) * string.

Rendered by Fadroma (@fadroma/schema 1.1.0) from okp4-law-stone.json (2f26127f22c058d2)