@wowok/agent-mcp 2.2.13 → 2.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +19 -11
  2. package/dist/index.js +44 -100
  3. package/dist/schema/query/index.js +1 -1
  4. package/dist/schema-query/index.d.ts +29 -0
  5. package/dist/schema-query/index.js +149 -0
  6. package/dist/schemas/account_operation.schema.json +255 -0
  7. package/dist/schemas/guard2file.schema.json +71 -0
  8. package/dist/schemas/index.json +139 -0
  9. package/dist/schemas/local_info_operation.schema.json +142 -0
  10. package/dist/schemas/local_mark_operation.schema.json +119 -0
  11. package/dist/schemas/machineNode2file.schema.json +71 -0
  12. package/dist/schemas/messenger_operation.schema.json +1393 -0
  13. package/dist/schemas/onchain_events.schema.json +113 -0
  14. package/dist/schemas/onchain_operations.schema.json +376 -0
  15. package/dist/schemas/onchain_operations_allocation.schema.json +914 -0
  16. package/dist/schemas/onchain_operations_arbitration.schema.json +1166 -0
  17. package/dist/schemas/onchain_operations_contact.schema.json +853 -0
  18. package/dist/schemas/onchain_operations_demand.schema.json +984 -0
  19. package/dist/schemas/onchain_operations_gen_passport.schema.json +1141 -0
  20. package/dist/schemas/onchain_operations_guard.schema.json +713 -0
  21. package/dist/schemas/onchain_operations_machine.schema.json +1347 -0
  22. package/dist/schemas/onchain_operations_order.schema.json +830 -0
  23. package/dist/schemas/onchain_operations_payment.schema.json +717 -0
  24. package/dist/schemas/onchain_operations_permission.schema.json +1088 -0
  25. package/dist/schemas/onchain_operations_personal.schema.json +1282 -0
  26. package/dist/schemas/onchain_operations_progress.schema.json +751 -0
  27. package/dist/schemas/onchain_operations_repository.schema.json +1572 -0
  28. package/dist/schemas/onchain_operations_reward.schema.json +955 -0
  29. package/dist/schemas/onchain_operations_service.schema.json +1411 -0
  30. package/dist/schemas/onchain_operations_treasury.schema.json +1155 -0
  31. package/dist/schemas/onchain_table_data.schema.json +35 -0
  32. package/dist/schemas/query_toolkit.schema.json +32 -0
  33. package/dist/schemas/schema_query.schema.json +33 -0
  34. package/dist/schemas/wip_file.schema.json +27 -0
  35. package/dist/schemas/wowok_buildin_info.schema.json +487 -0
  36. package/package.json +7 -5
  37. package/dist/docs/index.d.ts +0 -3
  38. package/dist/docs/index.js +0 -2
  39. package/dist/docs/loader.d.ts +0 -12
  40. package/dist/docs/loader.js +0 -177
  41. package/dist/docs/search.d.ts +0 -17
  42. package/dist/docs/search.js +0 -325
  43. package/dist/docs/types.d.ts +0 -55
  44. package/dist/docs/types.js +0 -1
  45. package/docs/README.md +0 -249
  46. package/docs/WIP.md +0 -388
  47. package/docs/WTS.md +0 -536
  48. package/docs/docs/account.md +0 -914
  49. package/docs/docs/allocation.md +0 -635
  50. package/docs/docs/arbitration.md +0 -1804
  51. package/docs/docs/arbitration_state_machine.md +0 -270
  52. package/docs/docs/contact.md +0 -709
  53. package/docs/docs/demand.md +0 -948
  54. package/docs/docs/guard.md +0 -1465
  55. package/docs/docs/localinfo.md +0 -432
  56. package/docs/docs/localmark.md +0 -583
  57. package/docs/docs/machine.md +0 -2490
  58. package/docs/docs/messenger.md +0 -2098
  59. package/docs/docs/onchain_events.md +0 -267
  60. package/docs/docs/order.md +0 -1001
  61. package/docs/docs/payment.md +0 -512
  62. package/docs/docs/permission.md +0 -1438
  63. package/docs/docs/personal.md +0 -742
  64. package/docs/docs/progress.md +0 -1748
  65. package/docs/docs/query.md +0 -467
  66. package/docs/docs/repository.md +0 -1043
  67. package/docs/docs/reward.md +0 -833
  68. package/docs/docs/service.md +0 -2130
  69. package/docs/docs/stage-01-introduction.md +0 -243
  70. package/docs/docs/stage-02-trust.md +0 -302
  71. package/docs/docs/stage-03-collaboration.md +0 -337
  72. package/docs/docs/stage-04-transaction.md +0 -277
  73. package/docs/docs/stage-05-business.md +0 -151
  74. package/docs/docs/stage-06-personal.md +0 -203
  75. package/docs/docs/stage-07-query.md +0 -572
  76. package/docs/docs/stage-08-examples.md +0 -184
  77. package/docs/docs/treasury.md +0 -1149
  78. package/docs/docs/wowok_buildin_info.md +0 -740
  79. package/docs/examples/Insurance/Insurance.md +0 -594
  80. package/docs/examples/Insurance/Insurance_TestResults.md +0 -481
  81. package/docs/examples/Insurance/insurance_complete_guard_v1.json +0 -50
  82. package/docs/examples/MyShop/MyShop.md +0 -1353
  83. package/docs/examples/MyShop/MyShop_TestResults.md +0 -1003
  84. package/docs/examples/MyShop_Advanced/MyShop_Advanced.md +0 -1898
  85. package/docs/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +0 -1297
  86. package/docs/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +0 -743
  87. package/docs/examples/MyShop_Advanced/machine_nodes.json +0 -222
  88. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature.md +0 -776
  89. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +0 -599
  90. package/docs/examples/Travel/Travel.md +0 -1157
  91. package/docs/examples/Travel/Travel_TestResults.md +0 -743
  92. package/docs/examples/Travel/calc-weather-timestamps.js +0 -8
  93. package/docs/examples/Travel/travel_machine_v2_export.json +0 -104
  94. package/docs/examples/Travel/weather_check_guard_v1.json +0 -51
  95. package/docs/skills/WOWOK.md +0 -650
  96. package/docs/skills/onchain_operations/_common.md +0 -406
  97. package/docs/skills/onchain_operations/_index.md +0 -196
  98. package/docs/skills/onchain_operations/allocation.md +0 -28
  99. package/docs/skills/onchain_operations/arbitration.md +0 -106
  100. package/docs/skills/onchain_operations/contact.md +0 -40
  101. package/docs/skills/onchain_operations/demand.md +0 -53
  102. package/docs/skills/onchain_operations/gen_passport.md +0 -23
  103. package/docs/skills/onchain_operations/guard.md +0 -56
  104. package/docs/skills/onchain_operations/machine.md +0 -89
  105. package/docs/skills/onchain_operations/order.md +0 -56
  106. package/docs/skills/onchain_operations/payment.md +0 -24
  107. package/docs/skills/onchain_operations/permission.md +0 -68
  108. package/docs/skills/onchain_operations/personal.md +0 -58
  109. package/docs/skills/onchain_operations/progress.md +0 -38
  110. package/docs/skills/onchain_operations/repository.md +0 -70
  111. package/docs/skills/onchain_operations/reward.md +0 -38
  112. package/docs/skills/onchain_operations/service.md +0 -78
  113. package/docs/skills/onchain_operations/treasury.md +0 -68
  114. package/docs/skills/schema-account_operation.md +0 -402
  115. package/docs/skills/schema-guard2file.md +0 -153
  116. package/docs/skills/schema-local_info_operation.md +0 -160
  117. package/docs/skills/schema-local_mark_operation.md +0 -148
  118. package/docs/skills/schema-machineNode2file.md +0 -155
  119. package/docs/skills/schema-messenger_operation.md +0 -547
  120. package/docs/skills/schema-onchain_events.md +0 -201
  121. package/docs/skills/schema-onchain_table_data.md +0 -334
  122. package/docs/skills/schema-query_toolkit.md +0 -395
  123. package/docs/skills/schema-wip_file.md +0 -240
  124. package/docs/skills/schema-wowok_buildin_info.md +0 -296
  125. package/docs/wip-examples/three_body.html +0 -57
  126. package/docs/wip-examples/three_body.wip +0 -30
@@ -1,635 +0,0 @@
1
-
2
- # Allocation Component (📤 Auto Distribution)
3
-
4
- ---
5
-
6
- ## Component Overview
7
-
8
- The Allocation component is WoWok protocol's automatic fund distribution module, used to create distribution plans that auto-distribute funds to multiple recipients. Allocation objects can be created with predefined distribution rules, receive funds, and automatically distribute them based on the configured allocators when Guard verification passes.
9
-
10
- ---
11
-
12
- ## Function List
13
-
14
- | Function Name | Purpose | Usage Scenario | Significance |
15
- |---------------|---------|----------------|-------------|
16
- | **Create Allocation** | Define fund distribution plans | Set up profit sharing, team payouts | Establishes automated distribution rules |
17
- | **Receive Funds** | Deposit funds for distribution | Collect payments, revenues | Fills the allocation pool |
18
- | **Execute Distribution** | Trigger fund distribution | Run scheduled payouts, one-time distributions | Executes pre-defined sharing rules |
19
- | **Combined Operations** | Receive and distribute in one call | Complete payout workflow | Streamlines end-to-end distribution process |
20
-
21
- ---
22
-
23
- ## Complete Tool Call Structure
24
-
25
- Allocation operations use the following top-level structure:
26
-
27
- ```json
28
- {
29
- "operation_type": "allocation",
30
- "data": { ... }, // Allocation data definition
31
- "env": { ... }, // Execution environment (optional)
32
- "submission": { ... } // Guard verification submission (optional)
33
- }
34
- ```
35
-
36
- ---
37
-
38
- ## Schema Tree
39
-
40
- ```
41
- allocation (Allocation Object)
42
- ├── operation_type: "allocation" (fixed value)
43
- ├── data (Allocation data definition)
44
- │ ├── object (object definition, required)
45
- │ │ ├── Option 1: Reference existing object (string) - object name or ID
46
- │ │ └── Option 2: Create new object (object)
47
- │ │ ├── name (string, optional) - local mark name, max 64 bcs characters
48
- │ │ ├── tags (array, optional) - tags array
49
- │ │ ├── onChain (boolean, optional) - whether to sync name to blockchain
50
- │ │ ├── replaceExistName (boolean, optional) - force claim existing name
51
- │ │ └── type_parameter (string, optional) - token type, default: 0x2::wow::WOW
52
- │ ├── allocators (object, required for create) - fund allocator list
53
- │ │ ├── description (string, required) - allocators description, max 4000 bcs characters
54
- │ │ ├── threshold (number or string, required) - threshold amount in smallest units
55
- │ │ └── allocators (array, required) - allocator list (1-100 allocators)
56
- │ │ └── Allocator object
57
- │ │ ├── guard (string, required) - Guard object ID or name
58
- │ │ ├── sharing (array, required) - sharing items (1-100 items)
59
- │ │ │ └── Sharing object
60
- │ │ │ ├── who (object, required) - recipient type
61
- │ │ │ │ ├── Option 1: GuardIdentifier (object)
62
- │ │ │ │ │ └── GuardIdentifier (number) - Guard table identifier 0-255
63
- │ │ │ │ ├── Option 2: Entity (object)
64
- │ │ │ │ │ └── Entity (object)
65
- │ │ │ │ │ └── name_or_address (string) - entity name or address
66
- │ │ │ │ └── Option 3: Signer (object)
67
- │ │ │ │ └── Signer (string) - fixed value "signer"
68
- │ │ │ ├── sharing (number or string, required) - sharing amount/rate in smallest units
69
- │ │ │ └── mode (string, required) - allocation mode: "Amount", "Rate", or "Surplus"
70
- │ │ ├── fix (number or string, optional) - fixed allocation amount for all recipients
71
- │ │ └── max (number | string | null, optional) - maximum allocation amount
72
- │ ├── coin (object | string, required for create) - initial deposit coin
73
- │ │ ├── Option 1: Balance object (object)
74
- │ │ │ └── balance (number or string) - balance amount
75
- │ │ └── Option 2: Coin object ID (string)
76
- │ ├── payment_info (object, required for create) - payment info
77
- │ │ ├── remark (string, required) - payment remark
78
- │ │ ├── index (number | string, required) - payment record index
79
- │ │ ├── for_object (string | null, optional) - payment for specific object
80
- │ │ └── for_guard (string | null, optional) - payment for specific guard
81
- │ ├── received_coins (string | object, optional) - receive funds configuration
82
- │ │ ├── Option 1: "recently" (string) - receive all recent coins
83
- │ │ └── Option 2: ReceivedBalance object (object)
84
- │ │ ├── balance (number or string)
85
- │ │ ├── token_type (string)
86
- │ │ └── received (array of received items)
87
- │ │ └── Received item
88
- │ │ ├── id (string) - CoinWrapper object ID
89
- │ │ └── payment (string) - Payment object ID
90
- │ └── alloc_by_guard (string, optional) - Guard object ID/name to verify and execute distribution
91
- ├── env (optional, execution environment)
92
- │ ├── account (string, optional) - account name or address, empty string for default
93
- │ ├── network (string, optional) - "testnet" or "localnet"
94
- │ ├── permission_guard (array, optional) - list of permission guard IDs
95
- │ ├── no_cache (boolean, optional) - disable caching
96
- │ └── referrer (string, optional) - referrer ID
97
- └── submission (optional, submission data)
98
- ├── type (string) - fixed value "submission"
99
- ├── guard (array) - list of guards to verify
100
- │ └── [{ object: "guard_id", impack: boolean }]
101
- └── submission (array) - submission data for guards
102
- └── [{ guard: "guard_id", submission: [guard_submission_items] }]
103
- └── guard_submission_items
104
- ├── identifier (number, 0-255) - Guard table item identifier
105
- ├── b_submission (boolean) - whether this item requires submission
106
- ├── value_type (number | string) - value type (e.g., 6 or "U64" for U64 type)
107
- ├── **value (any) - submitted value**
108
- └── name (string, optional) - item name
109
- ```
110
-
111
- ---
112
-
113
- ### ⚠️ Important Note About Submission
114
-
115
- If the execution returns a `submission` field in the response, it indicates that additional Guard verification data is required. You must:
116
-
117
- 1. Complete all required submission data within the `submission` structure
118
- 2. Resubmit the operation with the completed submission data
119
- 3. **Do not modify any other parts of the structure** - only fill in the required submission values
120
-
121
- The submission structure will specify which Guard objects need verification and what data needs to be provided for each Guard table item.
122
-
123
- **Query Value Types**: Use the `wowok_buildin_info` tool with `{ "info": "value types" }` to query all supported value types with their numeric and string representations. This helps you understand what `value_type` values are valid for submission data.
124
-
125
- ---
126
-
127
- ## Sub-feature 1: Create New Allocation
128
-
129
- ### Feature Description
130
-
131
- Create a new Allocation object with predefined distribution rules. Newly created allocations can receive funds and automatically distribute them based on the configured allocators.
132
-
133
- ### Parameter Description
134
-
135
- | Parameter Path | Type | Required | Description | Constraints |
136
- |----------|------|------|------|------|
137
- | `operation_type` | string | Yes | Operation type | Fixed value "allocation" |
138
- | `data.object` | object | Yes | Create new Allocation | TypeNamedObject structure |
139
- | `data.object.name` | string | No | Local mark name | Max 64 BCS bytes, cannot start with "0x" |
140
- | `data.object.tags` | array | No | Tags array | String array |
141
- | `data.object.onChain` | boolean | No | Whether to mark on-chain | |
142
- | `data.object.replaceExistName` | boolean | No | Replace existing name | |
143
- | `data.object.type_parameter` | string | No | Token type | Default: 0x2::wow::WOW |
144
- | `data.allocators.description` | string | Yes | Allocators description | Max 4000 BCS bytes |
145
- | `data.allocators.threshold` | number or string | Yes | Threshold amount in smallest units | No decimals or negatives |
146
- | `data.allocators.allocators` | array | Yes | Allocator list | 1-100 allocators |
147
- | `data.allocators.allocators[].guard` | string | Yes | Guard object for this allocator | Guard name or ID |
148
- | `data.allocators.allocators[].sharing` | array | Yes | Sharing items for this allocator | 1-100 sharing items |
149
- | `data.allocators.allocators[].sharing[].who` | object | Yes | Recipient type | `{ GuardIdentifier: number }`, `{ Entity: { name_or_address: string } }`, or `{ Signer: "signer" }` |
150
- | `data.allocators.allocators[].sharing[].sharing` | number or string | Yes | Sharing amount or rate in smallest units | No decimals or negatives |
151
- | `data.allocators.allocators[].sharing[].mode` | string | Yes | Allocation mode | "Amount", "Rate", or "Surplus" |
152
- | `data.allocators.allocators[].fix` | number or string | No | Fixed allocation amount for all recipients | No decimals or negatives |
153
- | `data.allocators.allocators[].max` | number, string, or null | No | Maximum allocation amount | No decimals or negatives |
154
- | `data.coin` | object or string | Yes | Initial deposit coin | CoinParam structure |
155
- | `data.coin.balance` | number or string | No | Balance amount | No decimals or negatives |
156
- | `data.payment_info.remark` | string | Yes | Payment record remark | |
157
- | `data.payment_info.index` | number or string | Yes | Payment record index | |
158
- | `data.payment_info.for_object` | string or null | No | Payment for specific object | |
159
- | `data.payment_info.for_guard` | string or null | No | Payment for specific guard | |
160
-
161
- ### Important Notes
162
-
163
- ⚠️ **Sum of all sharing rates should be ≤ 10000 (100%).**
164
-
165
- ⚠️ **When mode is "Surplus", the sharing field is ignored.**
166
-
167
- ⚠️ **Rate Mode Requirements**: When using pure Rate mode (without any Amount mode items), the total rate must equal 10000 (100%). The sharing amounts will be calculated as percentages of the available balance during execution.
168
-
169
- ⚠️ **Threshold Check**: For Amount mode allocations, the sum of all amounts must be greater than or equal to the threshold. For Rate mode allocations, the threshold check is performed during execution based on the actual balance.
170
-
171
- ---
172
-
173
- ### Examples
174
-
175
- #### Example 1.1: Create Simple Amount-based Allocation
176
-
177
- **Prompt**: Create a new allocation named "profit_sharing" with: 1) Description "Monthly profit distribution", 2) Threshold at 1000000000 (1 WOW), 3) One allocator with "always_true_guard" guard, 4) Sharing items: 1000000000 to alice, 500000000 to testuser1, 500000000 to bob using Amount mode, 5) Initial deposit of 2000000000 (2 WOW), 6) Payment info with remark "Initial deposit" and index 1.
178
-
179
- ```json
180
- {
181
- "operation_type": "allocation",
182
- "data": {
183
- "object": {
184
- "name": "profit_sharing",
185
- "type_parameter": "0x2::wow::WOW",
186
- "tags": ["profit", "distribution"],
187
- "onChain": false
188
- },
189
- "allocators": {
190
- "description": "Monthly profit distribution",
191
- "threshold": 1000000000,
192
- "allocators": [
193
- {
194
- "guard": "always_true_guard",
195
- "sharing": [
196
- {
197
- "who": {
198
- "Entity": {
199
- "name_or_address": "alice"
200
- }
201
- },
202
- "sharing": 1000000000,
203
- "mode": "Amount"
204
- },
205
- {
206
- "who": {
207
- "Entity": {
208
- "name_or_address": "testuser1"
209
- }
210
- },
211
- "sharing": 500000000,
212
- "mode": "Amount"
213
- },
214
- {
215
- "who": {
216
- "Entity": {
217
- "name_or_address": "bob"
218
- }
219
- },
220
- "sharing": 500000000,
221
- "mode": "Amount"
222
- }
223
- ],
224
- "max": null
225
- }
226
- ]
227
- },
228
- "coin": {
229
- "balance": 2000000000
230
- },
231
- "payment_info": {
232
- "remark": "Initial deposit",
233
- "index": 1
234
- }
235
- }
236
- }
237
- ```
238
-
239
- **Execution Result**:
240
- ```json
241
- {
242
- "status": "success",
243
- "object": "0x8a63...331b",
244
- "type": "Allocation",
245
- "version": "100983",
246
- "change": "created"
247
- }
248
- ```
249
-
250
- #### Example 1.2: Create Allocation with Amount Mode
251
-
252
- **Prompt**: Create allocation "team_payouts" with: 1) Description "Team weekly payouts", 2) Threshold at 500000000 (0.5 WOW), 3) One allocator with "weekly_guard" (fixed amount to alice, testuser1, and bob), 4) Initial deposit of 2000000000 (2 WOW), 5) Payment info with remark "Team payout initial" and index 2.
253
-
254
- ```json
255
- {
256
- "operation_type": "allocation",
257
- "data": {
258
- "object": {
259
- "name": "team_payouts",
260
- "type_parameter": "0x2::wow::WOW"
261
- },
262
- "allocators": {
263
- "description": "Team weekly payouts",
264
- "threshold": 500000000,
265
- "allocators": [
266
- {
267
- "guard": "weekly_guard",
268
- "sharing": [
269
- {
270
- "who": {
271
- "Entity": {
272
- "name_or_address": "alice"
273
- }
274
- },
275
- "sharing": 500000000,
276
- "mode": "Amount"
277
- },
278
- {
279
- "who": {
280
- "Entity": {
281
- "name_or_address": "testuser1"
282
- }
283
- },
284
- "sharing": 300000000,
285
- "mode": "Amount"
286
- },
287
- {
288
- "who": {
289
- "Entity": {
290
- "name_or_address": "bob"
291
- }
292
- },
293
- "sharing": 200000000,
294
- "mode": "Amount"
295
- }
296
- ],
297
- "max": 10000000000
298
- }
299
- ]
300
- },
301
- "coin": {
302
- "balance": 2000000000
303
- },
304
- "payment_info": {
305
- "remark": "Team payout initial",
306
- "index": 2,
307
- "for_guard": "weekly_guard"
308
- }
309
- }
310
- }
311
- ```
312
-
313
- **Execution Result**:
314
- ```json
315
- {
316
- "status": "success",
317
- "object": "0xa223...3a4e",
318
- "type": "Allocation",
319
- "version": "101677",
320
- "change": "created"
321
- }
322
- ```
323
-
324
- #### Example 1.3: Create Rate-based Allocation
325
-
326
- **Prompt**: Create a new allocation named "profit_sharing_rate" with: 1) Description "Monthly profit distribution by rate", 2) Threshold at 1000000000 (1 WOW), 3) One allocator with "always_true_guard" guard, 4) Sharing items: 50% to alice, 30% to testuser1, 20% to bob using Rate mode (total must be 10000 = 100%), 5) Initial deposit of 2000000000 (2 WOW), 6) Payment info with remark "Rate mode deposit" and index 3.
327
-
328
- ```json
329
- {
330
- "operation_type": "allocation",
331
- "data": {
332
- "object": {
333
- "name": "profit_sharing_rate",
334
- "type_parameter": "0x2::wow::WOW"
335
- },
336
- "allocators": {
337
- "description": "Monthly profit distribution by rate",
338
- "threshold": 1000000000,
339
- "allocators": [
340
- {
341
- "guard": "always_true_guard",
342
- "sharing": [
343
- {
344
- "who": {
345
- "Entity": {
346
- "name_or_address": "alice"
347
- }
348
- },
349
- "sharing": 5000,
350
- "mode": "Rate"
351
- },
352
- {
353
- "who": {
354
- "Entity": {
355
- "name_or_address": "testuser1"
356
- }
357
- },
358
- "sharing": 3000,
359
- "mode": "Rate"
360
- },
361
- {
362
- "who": {
363
- "Entity": {
364
- "name_or_address": "bob"
365
- }
366
- },
367
- "sharing": 2000,
368
- "mode": "Rate"
369
- }
370
- ],
371
- "max": null
372
- }
373
- ]
374
- },
375
- "coin": {
376
- "balance": 2000000000
377
- },
378
- "payment_info": {
379
- "remark": "Rate mode deposit",
380
- "index": 3
381
- }
382
- }
383
- }
384
- ```
385
-
386
- **Execution Result**:
387
- ```json
388
- {
389
- "status": "success",
390
- "object": "0xb071...650c",
391
- "type": "Allocation",
392
- "version": "992",
393
- "change": "created"
394
- }
395
- ```
396
-
397
- ---
398
-
399
- ## Sub-feature 2: Operate Existing Allocation - Receive Funds
400
-
401
- ### Feature Description
402
-
403
- Receive CoinWrapper objects sent to the Allocation object and deposit them into the pending distribution balance.
404
-
405
- ### Parameter Description
406
-
407
- | Parameter Path | Type | Required | Description | Constraints |
408
- |----------|------|------|------|------|
409
- | `operation_type` | string | Yes | Operation type | Fixed value "allocation" |
410
- | `data.object` | string | Yes | Reference existing Allocation | Allocation name or ID |
411
- | `data.received_coins` | string or object | No | Receive funds configuration | "recently" or ReceivedBalance object |
412
-
413
- ### Important Notes
414
-
415
- ⚠️ **Use "recently" to receive all recently received coins.**
416
-
417
- ---
418
-
419
- ### Example
420
-
421
- #### Example 2.1: Receive Recently Received Coins
422
-
423
- **Prerequisites**: Before receiving funds, you need to send a Payment to the Allocation object. Here are the steps:
424
-
425
- **Step 1**: Create and send a Payment to the Allocation object
426
-
427
- ```json
428
- {
429
- "operation_type": "payment",
430
- "data": {
431
- "object": {
432
- "name": "payment_to_allocation"
433
- },
434
- "revenue": [
435
- {
436
- "recipient": {
437
- "name_or_address": "profit_sharing"
438
- },
439
- "amount": {
440
- "balance": 1000000000
441
- }
442
- }
443
- ],
444
- "info": {
445
- "remark": "Payment to profit sharing allocation",
446
- "index": 5
447
- }
448
- }
449
- }
450
- ```
451
-
452
- **Step 2**: Receive the funds into the Allocation object
453
-
454
- **Prompt**: Receive all recently received coins into the "profit_sharing" allocation object.
455
-
456
- ```json
457
- {
458
- "operation_type": "allocation",
459
- "data": {
460
- "object": "profit_sharing",
461
- "received_coins": "recently"
462
- }
463
- }
464
- ```
465
-
466
- **Execution Result**:
467
- ```json
468
- {
469
- "status": "success",
470
- "object": "0x8a63...331b",
471
- "type": "Allocation",
472
- "version": "102109",
473
- "change": "mutated",
474
- "received": [
475
- {
476
- "id": "0xd9fe...1f70",
477
- "type": "0x2::payment::CoinWrapper<0x2::wow::WOW>",
478
- "amount": 1000000000
479
- }
480
- ]
481
- }
482
- ```
483
-
484
- ⚠️ **Note**: You can also use the detailed format for `received_coins` with specific object details:
485
-
486
- ```json
487
- {
488
- "operation_type": "allocation",
489
- "data": {
490
- "object": "profit_sharing",
491
- "received_coins": {
492
- "balance": 1000000000,
493
- "token_type": "0x2::wow::WOW",
494
- "received": [
495
- {
496
- "id": "0xd9fed2a4b98b8125dd252775e5954d6db4be7bc8c9e53d176fa76ba1a5721f70",
497
- "payment": "0x2197a9421d457c45bdec487a3e506c89861a2935806493615028994f1b8794ac",
498
- "balance": 1000000000
499
- }
500
- ]
501
- }
502
- }
503
- }
504
- ```
505
-
506
- ---
507
-
508
- ## Sub-feature 3: Operate Existing Allocation - Execute Distribution
509
-
510
- ### Feature Description
511
-
512
- Verify the specified Guard and execute the corresponding fund distribution based on the configured allocators.
513
-
514
- ### Parameter Description
515
-
516
- | Parameter Path | Type | Required | Description | Constraints |
517
- |----------|------|------|------|------|
518
- | `operation_type` | string | Yes | Operation type | Fixed value "allocation" |
519
- | `data.object` | string | Yes | Reference existing Allocation | Allocation name or ID |
520
- | `data.alloc_by_guard` | string | Yes | Guard object to verify and execute | Guard name or ID |
521
-
522
- ### Important Notes
523
-
524
- ⚠️ **The Guard must be configured in the allocators to execute distribution.**
525
-
526
- ---
527
-
528
- ### Example
529
-
530
- #### Example 3.1: Execute Distribution by Guard
531
-
532
- **Prompt**: Execute fund distribution for "profit_sharing" allocation by verifying "always_true_guard".
533
-
534
- ```json
535
- {
536
- "operation_type": "allocation",
537
- "data": {
538
- "object": "profit_sharing",
539
- "alloc_by_guard": "always_true_guard"
540
- }
541
- }
542
- ```
543
-
544
- **Execution Result**:
545
- ```json
546
- {
547
- "status": "success",
548
- "object": "0x8a63...331b",
549
- "type": "Allocation",
550
- "version": "102951",
551
- "change": "mutated"
552
- }
553
- ```
554
-
555
- ---
556
-
557
- ## Sub-feature 4: Combined Operations
558
-
559
- ### Feature Description
560
-
561
- Execute multiple operations in a single call: receive funds and execute distribution.
562
-
563
- ### Parameter Description
564
-
565
- | Parameter Path | Type | Required | Description | Constraints |
566
- |----------|------|------|------|------|
567
- | `operation_type` | string | Yes | Operation type | Fixed value "allocation" |
568
- | `data.object` | string | Yes | Reference existing Allocation | Allocation name or ID |
569
- | `data.received_coins` | string or object | No | Receive funds configuration | "recently" or ReceivedBalance object |
570
- | `data.alloc_by_guard` | string | No | Guard object to execute | Guard name or ID |
571
-
572
- ---
573
-
574
- ### Example
575
-
576
- #### Example 4.1: Receive and Distribute in One Call
577
-
578
- **Prompt**: For "team_payouts" allocation: 1) Receive all recently received coins, 2) Execute distribution using "weekly_guard".
579
-
580
- ```json
581
- {
582
- "operation_type": "allocation",
583
- "data": {
584
- "object": "team_payouts",
585
- "received_coins": {
586
- "balance": 1000000000,
587
- "token_type": "0x2::wow::WOW",
588
- "received": [
589
- {
590
- "id": "0x7857681fd9b9eeced363dfcf05750d6fa37178995fe88ab6cddd008b7e11365c",
591
- "payment": "0xdde7c6c1906bbd0592b742b2772b5fc81fa1d1deb400a2ef3e59a644e9dd84bf",
592
- "balance": 1000000000
593
- }
594
- ]
595
- },
596
- "alloc_by_guard": "weekly_guard"
597
- }
598
- }
599
- ```
600
-
601
- **Execution Result**:
602
- ```json
603
- {
604
- "status": "success",
605
- "object": "0xa223...3a4e",
606
- "type": "Allocation",
607
- "version": "103485",
608
- "change": "mutated"
609
- }
610
- ```
611
-
612
- ---
613
-
614
- ## Important Notes
615
-
616
- ⚠️ **Sum of all sharing rates should be ≤ 10000 (100%) when no Surplus mode is used.**
617
-
618
- ⚠️ **Automatic distribution can be initiated after deposit reaches the threshold.**
619
-
620
- ⚠️ **Distribution records are permanently public on-chain.**
621
-
622
- ⚠️ **After creating an Allocation, you cannot modify the allocators configuration.**
623
-
624
- ---
625
-
626
- ## Related Components
627
-
628
- | Component | Description |
629
- |-----------|-------------|
630
- | **[Service](service.md)** | WYSIWYG product trading - can use Allocation for order fund distribution |
631
- | **[Reward](reward.md)** | Marketing incentives - similar distribution mechanism |
632
- | **[Treasury](treasury.md)** | Team fund management |
633
- | **[Permission](permission.md)** | Permission management |
634
- | **[Guard](guard.md)** | Trust verification engine - required for executing distributions |
635
-