tx · Bv2TgPFJv4HBp9grTznUWAHvdDFSrUZdQLRWAZoBsv3Z 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV: -0.01000000 Waves 2023.09.08 12:57 [2746261] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves
{ "type": 13, "id": "Bv2TgPFJv4HBp9grTznUWAHvdDFSrUZdQLRWAZoBsv3Z", "fee": 1000000, "feeAssetId": null, "timestamp": 1694167060146, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "caiVh5EdYRybVL2u7jVnMU1zBmGicNcjC6XuQZZMZftJkhkcKNYSeXn5tGbpU6zccni3LogghhhVZGaQer3yVJ5" ], "script": "base64:BgIdCAISBAoCCAgSBQoDCAgIEgQKAggIEgQKAggIEgAMABFBSV9UT0tFTl9BU1NFVF9JRAEgk+FyOHEEm2rommMfBCS3ZFOXLD68ZguDdK9ouySN4kIAC1NUQVRVU19PUEVOAgRvcGVuABJTVEFUVVNfQ0hFQ0tFRF9PVVQCC2NoZWNrZWRfb3V0AAtTVEFUVVNfRE9ORQIEZG9uZQAOQ0hFQ0tFRF9PVVRfQlkCEF9jaGVja2VkX291dF9ieV8AE1NJTVBMRV9DSEFUR1BUX1RBU0sCE3NpbXBsZV9DaGF0R1BUX3Rhc2sAEENIRUNLX09VVF9IRUlHSFQCEl9jaGVja19vdXRfaGVpZ2h0XwAPUkVHSVNURVJfSEVJR0hUAhFfcmVnaXN0ZXJfaGVpZ2h0XwANQ09NTUlUX0hFSUdIVAIPX2NvbW1pdF9oZWlnaHRfAQ9jYW5CZUNoZWNrZWRPdXQCBnRhc2tJZAR0eXBlBAZzdGF0dXMJAJ0IAgUEdGhpcwkArAICCQCsAgIFBnRhc2tJZAIIX3N0YXR1c18FBHR5cGUJAAACBQZzdGF0dXM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50BQ53YXZlc1VzZHRQcmljZQCAwtcvAGQDCQAAAgUQZmVlQXNzZXRJZFN0cmluZwUNVVNEVF9BU1NFVF9JRAkAaAIFDXBheW1lbnRBbW91bnQAZAMJAAACBRBmZWVBc3NldElkU3RyaW5nBQ1VU0RDX0FTU0VUX0lECQBoAgUNcGF5bWVudEFtb3VudABkCQACAQIpcGF5bWVudCBuZWNlc3NhcnkgaW4gV2F2ZXMsIFVTREMgb3IgVVNEVCEJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyBQZhbW91bnQJANkEAQUMQkFJX0FTU0VUX0lEBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5HHmu+g==", "height": 2746261, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GuBAA5ssjAH5r85FUMHyfU6H5J2Qw3iLZ8gMWYM3wJSZ Next: 52BdjMJtuMpkawNtXxrFu66jENYvKUn2qGKNg3rLUKMd Diff:
Old | New | Differences | |
---|---|---|---|
134 | 134 | else if ((callback != "no callback")) | |
135 | 135 | then { | |
136 | 136 | let result = invoke(Address(fromBase58String(caller)), callback, [response], nil) | |
137 | - | [StringEntry(((taskId + "_status_") + type), STATUS_DONE), StringEntry(((taskId + "_result_") + type), response), IntegerEntry(((taskId + COMMIT_HEIGHT) + type), height), IntegerEntry(((taskId + "_commit_timestamp_") + type), timestamp), DeleteEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId))] | |
137 | + | if ((result == result)) | |
138 | + | then [StringEntry(((taskId + "_status_") + type), STATUS_DONE), StringEntry(((taskId + "_result_") + type), response), IntegerEntry(((taskId + COMMIT_HEIGHT) + type), height), IntegerEntry(((taskId + "_commit_timestamp_") + type), timestamp), DeleteEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId))] | |
139 | + | else throw("Strict value is not equal to itself.") | |
138 | 140 | } | |
139 | 141 | else [StringEntry(((taskId + "_status_") + type), STATUS_DONE), StringEntry(((taskId + "_result_") + type), response), IntegerEntry(((taskId + COMMIT_HEIGHT) + type), height), IntegerEntry(((taskId + "_commit_timestamp_") + type), timestamp), DeleteEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId))] | |
140 | 142 | } |
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 | let SIMPLE_CHATGPT_TASK = "simple_ChatGPT_task" | |
15 | 15 | ||
16 | 16 | let CHECK_OUT_HEIGHT = "_check_out_height_" | |
17 | 17 | ||
18 | 18 | let REGISTER_HEIGHT = "_register_height_" | |
19 | 19 | ||
20 | 20 | let COMMIT_HEIGHT = "_commit_height_" | |
21 | 21 | ||
22 | 22 | func canBeCheckedOut (taskId,type) = { | |
23 | 23 | let status = getString(this, ((taskId + "_status_") + type)) | |
24 | 24 | (status == STATUS_OPEN) | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func isCorrectAgent (taskId,agentId,type) = { | |
29 | 29 | let checkoutAgentId = getString(this, ((taskId + CHECKED_OUT_BY) + type)) | |
30 | 30 | (checkoutAgentId == agentId) | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getPriceForType (type) = match getInteger(this, ("price_" + type)) { | |
35 | 35 | case i: Int => | |
36 | 36 | i | |
37 | 37 | case _ => | |
38 | 38 | -1 | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | 43 | func registerTask (description,type) = { | |
44 | 44 | let numberOfPayments = size(i.payments) | |
45 | 45 | if ((numberOfPayments != 1)) | |
46 | 46 | then throw("Payment necessary!") | |
47 | 47 | else { | |
48 | 48 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
49 | 49 | let txId = toBase58String(i.transactionId) | |
50 | 50 | let payment = i.payments[0] | |
51 | 51 | let fee = payment.amount | |
52 | 52 | let feeAssetId = payment.assetId | |
53 | 53 | let taskId = ((txId + "_") + callerPublicKey) | |
54 | 54 | let timestamp = lastBlock.timestamp | |
55 | 55 | let minFee = getPriceForType(type) | |
56 | 56 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
57 | 57 | then throw("Payment only possible in the AI Token!") | |
58 | 58 | else if ((minFee == -1)) | |
59 | 59 | then throw("Task type not supported!") | |
60 | 60 | else if ((minFee > fee)) | |
61 | 61 | then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!")) | |
62 | 62 | else [StringEntry(((taskId + "_description_") + type), description), StringEntry(((txId + "_initializer_") + type), callerPublicKey), StringEntry(((taskId + "_status_") + type), STATUS_OPEN), StringEntry((taskId + "_type"), type), IntegerEntry(((taskId + REGISTER_HEIGHT) + type), height), IntegerEntry(((taskId + "_register_timestamp_") + type), timestamp), BooleanEntry(((("open_" + type) + "_") + taskId), true)] | |
63 | 63 | } | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(i) | |
69 | 69 | func registerTaskCallback (description,type,callback) = { | |
70 | 70 | let numberOfPayments = size(i.payments) | |
71 | 71 | if ((numberOfPayments != 1)) | |
72 | 72 | then throw("Payment necessary!") | |
73 | 73 | else { | |
74 | 74 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
75 | 75 | let caller = toString(i.caller) | |
76 | 76 | let txId = toBase58String(i.transactionId) | |
77 | 77 | let payment = i.payments[0] | |
78 | 78 | let fee = payment.amount | |
79 | 79 | let feeAssetId = payment.assetId | |
80 | 80 | let taskId = ((txId + "_") + callerPublicKey) | |
81 | 81 | let timestamp = lastBlock.timestamp | |
82 | 82 | let minFee = getPriceForType(type) | |
83 | 83 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
84 | 84 | then throw("Payment only possible in the AI Token!") | |
85 | 85 | else if ((minFee == -1)) | |
86 | 86 | then throw("Task type not supported!") | |
87 | 87 | else if ((minFee > fee)) | |
88 | 88 | then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!")) | |
89 | 89 | else [StringEntry(((taskId + "_description_") + type), description), StringEntry(((txId + "_initializer_") + type), callerPublicKey), StringEntry(((txId + "_callback_") + type), callback), StringEntry(((txId + "_caller_") + type), caller), StringEntry(((taskId + "_status_") + type), STATUS_OPEN), StringEntry((taskId + "_type"), type), IntegerEntry(((taskId + REGISTER_HEIGHT) + type), height), IntegerEntry(((taskId + "_register_timestamp_") + type), timestamp), BooleanEntry(((("open_" + type) + "_") + taskId), true), StringEntry(("callback_accounting_" + toString(height)), taskId)] | |
90 | 90 | } | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | ||
95 | 95 | @Callable(i) | |
96 | 96 | func checkoutTask (taskId,type) = { | |
97 | 97 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
98 | 98 | let taskStillOpen = canBeCheckedOut(taskId, type) | |
99 | 99 | let timestamp = lastBlock.timestamp | |
100 | 100 | if (!(taskStillOpen)) | |
101 | 101 | then throw("Task not open for checkout!") | |
102 | 102 | else [StringEntry(((taskId + CHECKED_OUT_BY) + type), callerPublicKey), StringEntry(((taskId + "_status_") + type), STATUS_CHECKED_OUT), IntegerEntry(((taskId + CHECK_OUT_HEIGHT) + type), height), IntegerEntry(((taskId + "_check_out_timestamp_") + type), timestamp), BooleanEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId), true), DeleteEntry(((("open_" + type) + "_") + taskId))] | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | ||
107 | 107 | @Callable(i) | |
108 | 108 | func commitTask (taskId,response) = { | |
109 | 109 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
110 | 110 | let type = match getString((taskId + "_type")) { | |
111 | 111 | case s: String => | |
112 | 112 | s | |
113 | 113 | case _ => | |
114 | 114 | "not set" | |
115 | 115 | } | |
116 | 116 | let correctAgent = isCorrectAgent(taskId, callerPublicKey, type) | |
117 | 117 | let timestamp = lastBlock.timestamp | |
118 | 118 | let callback = match getString(((taskId + "_callback_") + type)) { | |
119 | 119 | case s: String => | |
120 | 120 | s | |
121 | 121 | case _ => | |
122 | 122 | "no callback" | |
123 | 123 | } | |
124 | 124 | let caller = match getString(((taskId + "_caller_") + type)) { | |
125 | 125 | case s: String => | |
126 | 126 | s | |
127 | 127 | case _ => | |
128 | 128 | "no callback" | |
129 | 129 | } | |
130 | 130 | if (!(correctAgent)) | |
131 | 131 | then throw("Task may only be submitted by the agent who checked the task out!") | |
132 | 132 | else if ((type == "not set")) | |
133 | 133 | then throw("Can not identify type of task id") | |
134 | 134 | else if ((callback != "no callback")) | |
135 | 135 | then { | |
136 | 136 | let result = invoke(Address(fromBase58String(caller)), callback, [response], nil) | |
137 | - | [StringEntry(((taskId + "_status_") + type), STATUS_DONE), StringEntry(((taskId + "_result_") + type), response), IntegerEntry(((taskId + COMMIT_HEIGHT) + type), height), IntegerEntry(((taskId + "_commit_timestamp_") + type), timestamp), DeleteEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId))] | |
137 | + | if ((result == result)) | |
138 | + | then [StringEntry(((taskId + "_status_") + type), STATUS_DONE), StringEntry(((taskId + "_result_") + type), response), IntegerEntry(((taskId + COMMIT_HEIGHT) + type), height), IntegerEntry(((taskId + "_commit_timestamp_") + type), timestamp), DeleteEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId))] | |
139 | + | else throw("Strict value is not equal to itself.") | |
138 | 140 | } | |
139 | 141 | else [StringEntry(((taskId + "_status_") + type), STATUS_DONE), StringEntry(((taskId + "_result_") + type), response), IntegerEntry(((taskId + COMMIT_HEIGHT) + type), height), IntegerEntry(((taskId + "_commit_timestamp_") + type), timestamp), DeleteEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId))] | |
140 | 142 | } | |
141 | 143 | ||
142 | 144 | ||
143 | 145 | ||
144 | 146 | @Callable(i) | |
145 | 147 | func buy () = { | |
146 | 148 | let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy") | |
147 | 149 | let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT" | |
148 | 150 | let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
149 | 151 | let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
150 | 152 | let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1" | |
151 | 153 | let numberOfPayments = size(i.payments) | |
152 | 154 | if ((numberOfPayments != 1)) | |
153 | 155 | then throw("Payment necessary!") | |
154 | 156 | else { | |
155 | 157 | let payment = i.payments[0] | |
156 | 158 | let feeAssetId = payment.assetId | |
157 | 159 | let feeAssetIdString = match feeAssetId { | |
158 | 160 | case b: ByteVector => | |
159 | 161 | toBase58String(b) | |
160 | 162 | case _ => | |
161 | 163 | "" | |
162 | 164 | } | |
163 | 165 | let paymentAmount = payment.amount | |
164 | 166 | let amount = if (!(isDefined(feeAssetId))) | |
165 | 167 | then { | |
166 | 168 | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
167 | 169 | case n: Int => | |
168 | 170 | n | |
169 | 171 | case _ => | |
170 | 172 | 0 | |
171 | 173 | } | |
172 | 174 | (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100) | |
173 | 175 | } | |
174 | 176 | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
175 | 177 | then (paymentAmount * 100) | |
176 | 178 | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
177 | 179 | then (paymentAmount * 100) | |
178 | 180 | else throw("payment necessary in Waves, USDC or USDT!") | |
179 | 181 | [ScriptTransfer(i.caller, amount, fromBase58String(BAI_ASSET_ID))] | |
180 | 182 | } | |
181 | 183 | } | |
182 | 184 | ||
183 | 185 | ||
184 | 186 | @Verifier(tx) | |
185 | 187 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
186 | 188 |
github/deemru/w8io/026f985 48.80 ms ◑