You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contracts/axone-gov.md
+40-9Lines changed: 40 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,11 +22,15 @@ This contract follows AXONE development patterns and uses the cargo-make build s
22
22
23
23
Instantiate message.
24
24
25
-
`constitution` is the Prolog program (UTF-8 bytes) that defines the governance rules. The contract validates that it provides the required predicates (`decide/2` and `decide/3`) during instantiation.
25
+
This contract stores a governance constitution as a Prolog program on the resource AA. The constitution defines governance rules using Prolog predicates. The `constitution` field must contain a UTF-8 encoded Prolog program.
| InstantiateMsg |**object**. Instantiate message.<br /><br />`constitution` is the Prolog program (UTF-8 bytes) that defines the governance rules. The contract validates that it provides the required predicates (`decide/2` and `decide/3`) during instantiation. |
27
+
During instantiation, the contract validates that the constitution defines the required predicates: - `decide/2` which takes a `Case` argument and returns a verdict term. - `decide/3` which takes a `Case` argument and returns both a verdict and a motivation term.
28
+
29
+
The `decide/2` predicate returns a verdict Prolog term indicating the decision outcome. The `decide/3` predicate returns both a verdict and a motivation term providing reasoning for the decision.
| InstantiateMsg |**object**. Instantiate message.<br /><br />This contract stores a governance constitution as a Prolog program on the resource AA. The constitution defines governance rules using Prolog predicates. The `constitution` field must contain a UTF-8 encoded Prolog program.<br /><br />During instantiation, the contract validates that the constitution defines the required predicates: - `decide/2` which takes a `Case` argument and returns a verdict term. - `decide/3` which takes a `Case` argument and returns both a verdict and a motivation term.<br /><br />The `decide/2` predicate returns a verdict Prolog term indicating the decision outcome. The `decide/3` predicate returns both a verdict and a motivation term providing reasoning for the decision. |
30
34
31
35
## ExecuteMsg
32
36
@@ -46,12 +50,30 @@ Query messages.
46
50
47
51
### QueryMsg::constitution
48
52
49
-
Return the stored governance constitution program.
53
+
Return the stored governance constitution program bytes.
50
54
51
55
| parameter | description |
52
56
| -------------- | -------------------------- |
53
57
|`constitution`|_(Required.) _ **object**. |
54
58
59
+
### QueryMsg::decide
60
+
61
+
Decide a case using the constitution's `decide/2` or `decide/3` predicate.
62
+
63
+
The `case` parameter is a Prolog dict term string that represents the decision context. This string is passed as the `Case` argument to the `decide` predicate.
64
+
65
+
Example of a case dict: `ctx{action:read, user:"did:example:123", object:"obj:42"}`
66
+
67
+
The `verdict` returned is an arbitrary Prolog term (which can be an atom or a compound term, e.g., `permitted` or `pay(user_1)`), representing the decision outcome.
68
+
69
+
If `motivated` is true, the contract calls `decide/3` and returns both `verdict` and `motivation`. The `motivation` is a Prolog term that provides reasoning behind the decision.
|`motivation`|**string\|null**. Optional motivation term returned as the third argument by `decide/3`. |
109
+
|`verdict`|_(Required.) _ **string**. The decision verdict as a Prolog term string. |
79
110
80
111
## Definitions
81
112
@@ -89,4 +120,4 @@ A string containing Base64-encoded data.
89
120
90
121
---
91
122
92
-
_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `axone-gov.json` (`51c999a033214538`)_
123
+
_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `axone-gov.json` (`7b8b444e2a0cab26`)_
0 commit comments