Skip to main content
Version: v1.0.0

CW Law Stone

Overview

The cw-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 cw-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 cw-storage contract. Moreover, all the eventual loaded files must be stored in a cw-storage contract as well, allowing the contract to pin them.

To be able to free the underlying resources (i.e. objects in cw-storage) 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 cw-storage 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 cw-storage 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 cw-storage contract.

propertydescription
object_id*(Required.) * string. The program object id in the cw-storage contract.
storage_address*(Required.) * string. The cw-storage 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 cw-law-stone.json (e5d912ec14ffdad9)