tx · Vb4bt2cEZCpBbfWBBo37ezF39M18w31a8LzyFB2bBrr

3N9ttyLcRwDo7L4EmJkbS3ZFuQJygivupsL:  -0.00100000 Waves

2023.06.09 18:43 [2615323] smart account 3N9ttyLcRwDo7L4EmJkbS3ZFuQJygivupsL > SELF 0.00000000 Waves

{ "type": 13, "id": "Vb4bt2cEZCpBbfWBBo37ezF39M18w31a8LzyFB2bBrr", "fee": 100000, "feeAssetId": null, "timestamp": 1686325381071, "version": 1, "sender": "3N9ttyLcRwDo7L4EmJkbS3ZFuQJygivupsL", "senderPublicKey": "92ovWCy1Zf8CSsTLLLssC74m8yn5yPMqVp9fmVacou97", "proofs": [ "2dTMFGchudUB1LdsvG5CfXJYadPw4A7HE8D5KTp8w1PgTEikJZhYhDm3E2bai73bzuTKFPy9qzvE59nhHof1sE8H" ], "script": null, "chainId": 84, "height": 2615323, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FeBSPevjfCuVWiVBrejxVr6PcQbHCjVb6cLtnSpxK8s4 Next: none Full:
OldNewDifferences
1-{-# STDLIB_VERSION 6 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
5-
6-let STATUS_OPEN = "open"
7-
8-let STATUS_CHECKED_OUT = "checked_out"
9-
10-let STATUS_DONE = "done"
11-
12-let CHECKED_OUT_BY = "_checked_out_by"
13-
14-let SIMPLE_CHATGPT_TASK = "simple_ChatGPT_task"
15-
16-let CHECK_OUT_HEIGHT = "_check_out_height"
17-
18-let REGISTER_HEIGHT = "_register_height"
19-
20-let COMMIT_HEIGHT = "_commit_height"
21-
22-func canBeCheckedOut (taskId) = {
23- let status = getString(this, (taskId + "_status"))
24- (status == STATUS_OPEN)
25- }
26-
27-
28-func isCorrectAgent (taskId,agentId) = {
29- let checkoutAgentId = getString(this, (taskId + CHECKED_OUT_BY))
30- (checkoutAgentId == agentId)
31- }
32-
33-
34-func getTaskId (txId) = {
35- let callerPublicKey = match getString(this, (txId + "_initializer")) {
36- case str: String =>
37- str
38- case _ =>
39- ""
40- }
41- match getString(this, ((txId + "_") + callerPublicKey)) {
42- case str: String =>
43- str
44- case _ =>
45- ""
46- }
47- }
48-
49-
50-@Callable(i)
51-func registerChatGPTTask (description) = {
52- let numberOfPayments = size(i.payments)
53- if ((numberOfPayments != 1))
54- then throw("Payment necessary!")
55- else {
56- let callerPublicKey = toBase58String(i.callerPublicKey)
57- let txId = toBase58String(i.transactionId)
58- let payment = i.payments[0]
59- let fee = payment.amount
60- let feeAssetId = payment.assetId
61- let taskId = ((txId + "_") + callerPublicKey)
62- let timestamp = lastBlock.timestamp
63- if ((feeAssetId != AI_TOKEN_ASSET_ID))
64- then throw("Payment only possible in the AI Token!")
65- else if ((10000000 > fee))
66- then throw("Payment needs to be at least 0.1 AI Token!")
67- else [StringEntry((taskId + "_description"), description), StringEntry((txId + "_initializer"), callerPublicKey), StringEntry((taskId + "_status"), STATUS_OPEN), StringEntry((taskId + "_type"), SIMPLE_CHATGPT_TASK), IntegerEntry((taskId + REGISTER_HEIGHT), height), IntegerEntry((taskId + "_register_timestamp"), timestamp), BooleanEntry(("open_chatgpt_" + taskId), true)]
68- }
69- }
70-
71-
72-
73-@Callable(i)
74-func checkoutChatGPTTask (taskId) = {
75- let callerPublicKey = toBase58String(i.callerPublicKey)
76- let taskStillOpen = canBeCheckedOut(taskId)
77- let timestamp = lastBlock.timestamp
78- if (!(taskStillOpen))
79- then throw("Task not open for checkout!")
80- else [StringEntry((taskId + CHECKED_OUT_BY), callerPublicKey), StringEntry((taskId + "_status"), STATUS_CHECKED_OUT), IntegerEntry((taskId + CHECK_OUT_HEIGHT), height), IntegerEntry((taskId + "_check_out_timestamp"), timestamp), DeleteEntry(("open_chatgpt_" + taskId))]
81- }
82-
83-
84-
85-@Callable(i)
86-func commitChatGPTTask (taskId,response) = {
87- let callerPublicKey = toBase58String(i.callerPublicKey)
88- let correctAgent = isCorrectAgent(taskId, callerPublicKey)
89- let timestamp = lastBlock.timestamp
90- if (!(correctAgent))
91- then throw("Task may only be submitted by the agent who checked the task out!")
92- else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp)]
93- }
94-
95-
96-@Verifier(tx)
97-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
98-
1+# no script

github/deemru/w8io/026f985 
20.01 ms