tx · 49FFoEg2Skhtwq43ZkHFswZg2y34DTuqMUn5vaUsrGyB 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV: -0.05000000 Waves 2023.06.07 23:38 [2612739] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves
{ "type": 13, "id": "49FFoEg2Skhtwq43ZkHFswZg2y34DTuqMUn5vaUsrGyB", "fee": 5000000, "feeAssetId": null, "timestamp": 1686170398134, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "2XWiV8P3AfWLrp8YaHZ18LqhYYNrMvLrVTNxDb6R765cKgwYhC7WL7jpmYFFYaBV8qMyzUotsZA9ssC7vZSEAmoD" ], "script": "base64:BgISCAISAwoBCBIDCgEIEgQKAggIBwARQUlfVE9LRU5fQVNTRVRfSUQBIJPhcjhxBJtq6JpjHwQkt2RTlyw+vGYLg3SvaLskjeJCAAtTVEFUVVNfT1BFTgIEb3BlbgASU1RBVFVTX0NIRUNLRURfT1VUAgtjaGVja2VkX291dAALU1RBVFVTX0RPTkUCBGRvbmUADkNIRUNLRURfT1VUX0JZAg9fY2hlY2tlZF9vdXRfYnkBD2NhbkJlQ2hlY2tlZE91dAEGdGFza0lkBAZzdGF0dXMJAJ0IAgUEdGhpcwkArAICBQZ0YXNrSWQCB19zdGF0dXMJAAACBQZzdGF0dXMFC1NUQVRVU19PUEVOAQ5pc0NvcnJlY3RBZ2VudAIGdGFza0lkB2FnZW50SWQED2NoZWNrb3V0QWdlbnRJZAkAnQgCBQR0aGlzCQCsAgIFBnRhc2tJZAUOQ0hFQ0tFRF9PVVRfQlkJAAACBQ9jaGVja291dEFnZW50SWQFB2FnZW50SWQDAWkBE3JlZ2lzdGVyQ2hhdEdQVFRhc2sBC2Rlc2NyaXB0aW9uBA9jYWxsZXJQdWJsa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25zZQQPY2FsbGVyUHVibGljS2V5CQCwCQEIBQFpD2NhbGxlclB1YmxpY0tleQQMY29ycmVjdEFnZW50CQEOaXNDb3JyZWN0QWdlbnQCBQZ0YXNrSWQFD2NhbGxlclB1YmxpY0tleQMJAQEhAQUMY29ycmVjdEFnZW50CQACAQJBVGFzayBtYXkgb25seSBiZSBzdWJtaXR0ZWQgYnkgdGhlIGFnZW50IHdobyBjaGVja2VkIHRoZSB0YXNrIG91dCEJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQZ0YXNrSWQCB19zdGF0dXMFC1NUQVRVU19ET05FCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUGdGFza0lkAgdfcmVzdWx0BQhyZXNwb25zZQUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQKwAJ8=", "height": 2612739, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FfeFtAriPDgdrzqWU6KTMgPtJX1JewGQSDWrU9ukQReA Next: 88e1FpicY1ovEaZ72UL8zXSdeTFu4BXtCZcd2gjra5sT Diff:
Old | New | Differences | |
---|---|---|---|
32 | 32 | let feeAssetId = payment.assetId | |
33 | 33 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
34 | 34 | then throw("Payment only possible in the AI Token!") | |
35 | - | else [StringEntry((txId + "_description"), description), StringEntry((txId + "_initializer"), callerPublicKey), StringEntry((txId + "_status"), STATUS_OPEN)] | |
35 | + | else if ((100000000 > fee)) | |
36 | + | then throw("Payment needs to be at least on AI Token!") | |
37 | + | else [StringEntry((txId + "_description"), description), StringEntry((txId + "_initializer"), callerPublicKey), StringEntry((txId + "_status"), STATUS_OPEN)] | |
36 | 38 | } | |
37 | 39 | ||
38 | 40 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
5 | 5 | ||
6 | 6 | let STATUS_OPEN = "open" | |
7 | 7 | ||
8 | 8 | let STATUS_CHECKED_OUT = "checked_out" | |
9 | 9 | ||
10 | 10 | let STATUS_DONE = "done" | |
11 | 11 | ||
12 | 12 | let CHECKED_OUT_BY = "_checked_out_by" | |
13 | 13 | ||
14 | 14 | func canBeCheckedOut (taskId) = { | |
15 | 15 | let status = getString(this, (taskId + "_status")) | |
16 | 16 | (status == STATUS_OPEN) | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func isCorrectAgent (taskId,agentId) = { | |
21 | 21 | let checkoutAgentId = getString(this, (taskId + CHECKED_OUT_BY)) | |
22 | 22 | (checkoutAgentId == agentId) | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | @Callable(i) | |
27 | 27 | func registerChatGPTTask (description) = { | |
28 | 28 | let callerPublicKey = toUtf8String(i.callerPublicKey) | |
29 | 29 | let txId = toUtf8String(i.transactionId) | |
30 | 30 | let payment = i.payments[0] | |
31 | 31 | let fee = payment.amount | |
32 | 32 | let feeAssetId = payment.assetId | |
33 | 33 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
34 | 34 | then throw("Payment only possible in the AI Token!") | |
35 | - | else [StringEntry((txId + "_description"), description), StringEntry((txId + "_initializer"), callerPublicKey), StringEntry((txId + "_status"), STATUS_OPEN)] | |
35 | + | else if ((100000000 > fee)) | |
36 | + | then throw("Payment needs to be at least on AI Token!") | |
37 | + | else [StringEntry((txId + "_description"), description), StringEntry((txId + "_initializer"), callerPublicKey), StringEntry((txId + "_status"), STATUS_OPEN)] | |
36 | 38 | } | |
37 | 39 | ||
38 | 40 | ||
39 | 41 | ||
40 | 42 | @Callable(i) | |
41 | 43 | func checkoutChatGPTTask (taskId) = { | |
42 | 44 | let callerPublicKey = toUtf8String(i.callerPublicKey) | |
43 | 45 | let taskStillOpen = canBeCheckedOut(taskId) | |
44 | 46 | if (!(taskStillOpen)) | |
45 | 47 | then throw("Task not open for checkout!") | |
46 | 48 | else [StringEntry((taskId + CHECKED_OUT_BY), callerPublicKey), StringEntry((taskId + "_status"), STATUS_CHECKED_OUT)] | |
47 | 49 | } | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | ||
51 | 53 | @Callable(i) | |
52 | 54 | func finishChatGPTTask (taskId,response) = { | |
53 | 55 | let callerPublicKey = toUtf8String(i.callerPublicKey) | |
54 | 56 | let correctAgent = isCorrectAgent(taskId, callerPublicKey) | |
55 | 57 | if (!(correctAgent)) | |
56 | 58 | then throw("Task may only be submitted by the agent who checked the task out!") | |
57 | 59 | else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response)] | |
58 | 60 | } | |
59 | 61 | ||
60 | 62 | ||
61 | 63 | @Verifier(tx) | |
62 | 64 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
63 | 65 |
github/deemru/w8io/169f3d6 25.98 ms ◑