tx · 6zuBE5c7nEWMMeSmtAfB2X5i6aveTFntARqmMKwA5qCf 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV: -0.05000000 Waves 2023.07.31 17:03 [2690146] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves
{ "type": 13, "id": "6zuBE5c7nEWMMeSmtAfB2X5i6aveTFntARqmMKwA5qCf", "fee": 5000000, "feeAssetId": null, "timestamp": 1690812211508, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "2kTf1WLfVTMZ4hri1LiT3xG15qeKxoW3eS88niQ1caQfD9t5mzB3jfTXWBX7dDRvYTdyvoVGaJHgu7ogKy1C7Ave" ], "script": "base64:BgImCAISBAoCCAgSAwoBCBIECgIICBIDCgEIEgQKAggIEgQKAggIEgANABFBSV9UT0tFTl9BU1NFVF9JRAEgk+FyOHEEm2rommMfBCS3ZFOXLD68ZguDdK9ouySN4kIAC1NUQVRVU19PUEVOAgRvcGVuABJTVEFUVVNfQ0hFQ0tFRF9PVVQCC2NoZWNrZWRfb3V0AAtTVEFUVVNfRE9ORQIEZG9uZQAOQ0hFQ0tFRF9PVVRfQlkCD19jaGVja2VkX291dF9ieQATU0lNUExFX0NIQVRHUFRfVEFTSwITc2ltcGxlX0NoYXRHUFRfdGFzawAQQ0hFQ0tfT1VUX0hFSUdIVAIRX2NoZWNrX291dF9oZWlnaHQAD1JFR0lTVEVSX0hFSUdIVAIQX3JlZ2lzdGVyX2hlaWdodAANQ09NTUlUX0hFSUdIVAIOX2NvbW1pdF9oZWlnaHQBD2NhbkJlQ2hlY2tlZE91dAEGdGFza0lkBAZzdGF0dXMJAJ0IAgUEdGhpcwkArAICBQZ0YXNrSWQCB19zdGF0dXMJAAACBQZzdGF0dXMFC1NUQVRVU19PUEVOAQ5pc0N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3BheW1lbnQJAJEDAggFAWkIcGF5bWVudHMAAAQKZmVlQXNzZXRJZAgFB3BheW1lbnQHYXNzZXRJZAQQZmVlQXNzZXRJZFN0cmluZwQHJG1hdGNoMAUKZmVlQXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAFiBQckbWF0Y2gwCQDYBAEFAWICAAQNcGF5bWVudEFtb3VudAgFB3BheW1lbnQGYW1vdW50BAZhbW91bnQDCQEBIQEJAQlpc0RlZmluZWQBBQpmZWVBc3NldElkBA53YXZlc1VzZHRQcmljZQQHJG1hdGNoMAkAmggCBRFXQVZFU19VU0RUX09SQUNMRQUVV0FWRVNfVVNEVF9PUkFDTEVfS0VZAwkAAQIFByRtYXRjaDACA0ludAQBbgUHJG1hdGNoMAUBbgAACQBoAgkAawMFDXBheW1lbnRBbW91bnQFDndhdmVzVXNkdFByaWNlAIDC1y8AZAMJAAACBRBmZWVBc3NldElkU3RyaW5nBQ1VU0RUX0FTU0VUX0lECQBoAgUNcGF5bWVudEFtb3VudABkAwkAAAIFEGZlZUFzc2V0SWRTdHJpbmcFDVVTRENfQVNTRVRfSUQJAGgCBQ1wYXltZW50QW1vdW50AGQJAAIBAilwYXltZW50IG5lY2Vzc2FyeSBpbiBXYXZlcywgVVNEQyBvciBVU0RUIQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFBmFtb3VudAkA2QQBBQxCQUlfQVNTRVRfSUQFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXnBuM0B", "height": 2690146, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ApLJrssZrMbELDKVdv2Wi7nq9sGKTixuYBXeyJriDkVB Next: 3okdC1kQ5pDdK8ktWtAT27ALWyYaTMQgCn33JUiwtKEJ Diff:
Old | New | Differences | |
---|---|---|---|
154 | 154 | ||
155 | 155 | @Callable(i) | |
156 | 156 | func buy () = { | |
157 | - | let WAVES_USDT_ORACLE = addressFromStringValue("") | |
157 | + | let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy") | |
158 | 158 | let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT" | |
159 | 159 | let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
160 | 160 | let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" |
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) = { | |
23 | 23 | let status = getString(this, (taskId + "_status")) | |
24 | 24 | (status == STATUS_OPEN) | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func isCorrectAgent (taskId,agentId) = { | |
29 | 29 | let checkoutAgentId = getString(this, (taskId + CHECKED_OUT_BY)) | |
30 | 30 | (checkoutAgentId == agentId) | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getTaskId (txId) = { | |
35 | 35 | let callerPublicKey = match getString(this, (txId + "_initializer")) { | |
36 | 36 | case str: String => | |
37 | 37 | str | |
38 | 38 | case _ => | |
39 | 39 | "" | |
40 | 40 | } | |
41 | 41 | match getString(this, ((txId + "_") + callerPublicKey)) { | |
42 | 42 | case str: String => | |
43 | 43 | str | |
44 | 44 | case _ => | |
45 | 45 | "" | |
46 | 46 | } | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func getPriceForType (type) = match getInteger(this, ("price_" + type)) { | |
51 | 51 | case i: Int => | |
52 | 52 | i | |
53 | 53 | case _ => | |
54 | 54 | -1 | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | @Callable(i) | |
59 | 59 | func registerTask (description,type) = { | |
60 | 60 | let numberOfPayments = size(i.payments) | |
61 | 61 | if ((numberOfPayments != 1)) | |
62 | 62 | then throw("Payment necessary!") | |
63 | 63 | else { | |
64 | 64 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
65 | 65 | let txId = toBase58String(i.transactionId) | |
66 | 66 | let payment = i.payments[0] | |
67 | 67 | let fee = payment.amount | |
68 | 68 | let feeAssetId = payment.assetId | |
69 | 69 | let taskId = ((txId + "_") + callerPublicKey) | |
70 | 70 | let timestamp = lastBlock.timestamp | |
71 | 71 | let minFee = getPriceForType(type) | |
72 | 72 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
73 | 73 | then throw("Payment only possible in the AI Token!") | |
74 | 74 | else if ((minFee == -1)) | |
75 | 75 | then throw("Task type not supported!") | |
76 | 76 | else if ((minFee > fee)) | |
77 | 77 | then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!")) | |
78 | 78 | else [StringEntry((taskId + "_description"), description), StringEntry((txId + "_initializer"), callerPublicKey), StringEntry((taskId + "_status"), STATUS_OPEN), StringEntry((taskId + "_type"), type), IntegerEntry((taskId + REGISTER_HEIGHT), height), IntegerEntry((taskId + "_register_timestamp"), timestamp), BooleanEntry(((("open_" + type) + "_") + taskId), true)] | |
79 | 79 | } | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | ||
84 | 84 | @Callable(i) | |
85 | 85 | func registerChatGPTTask (description) = { | |
86 | 86 | let numberOfPayments = size(i.payments) | |
87 | 87 | if ((numberOfPayments != 1)) | |
88 | 88 | then throw("Payment necessary!") | |
89 | 89 | else { | |
90 | 90 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
91 | 91 | let txId = toBase58String(i.transactionId) | |
92 | 92 | let payment = i.payments[0] | |
93 | 93 | let fee = payment.amount | |
94 | 94 | let feeAssetId = payment.assetId | |
95 | 95 | let taskId = ((txId + "_") + callerPublicKey) | |
96 | 96 | let timestamp = lastBlock.timestamp | |
97 | 97 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
98 | 98 | then throw("Payment only possible in the AI Token!") | |
99 | 99 | else if ((10000000 > fee)) | |
100 | 100 | then throw("Payment needs to be at least 0.1 AI Token!") | |
101 | 101 | 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)] | |
102 | 102 | } | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | ||
107 | 107 | @Callable(i) | |
108 | 108 | func checkoutTask (taskId,type) = { | |
109 | 109 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
110 | 110 | let taskStillOpen = canBeCheckedOut(taskId) | |
111 | 111 | let timestamp = lastBlock.timestamp | |
112 | 112 | if (!(taskStillOpen)) | |
113 | 113 | then throw("Task not open for checkout!") | |
114 | 114 | 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_" + type) + "_") + taskId))] | |
115 | 115 | } | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | 119 | @Callable(i) | |
120 | 120 | func checkoutChatGPTTask (taskId) = { | |
121 | 121 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
122 | 122 | let taskStillOpen = canBeCheckedOut(taskId) | |
123 | 123 | let timestamp = lastBlock.timestamp | |
124 | 124 | if (!(taskStillOpen)) | |
125 | 125 | then throw("Task not open for checkout!") | |
126 | 126 | 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))] | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
131 | 131 | @Callable(i) | |
132 | 132 | func commitTask (taskId,response) = { | |
133 | 133 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
134 | 134 | let correctAgent = isCorrectAgent(taskId, callerPublicKey) | |
135 | 135 | let timestamp = lastBlock.timestamp | |
136 | 136 | if (!(correctAgent)) | |
137 | 137 | then throw("Task may only be submitted by the agent who checked the task out!") | |
138 | 138 | else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp)] | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | ||
143 | 143 | @Callable(i) | |
144 | 144 | func commitChatGPTTask (taskId,response) = { | |
145 | 145 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
146 | 146 | let correctAgent = isCorrectAgent(taskId, callerPublicKey) | |
147 | 147 | let timestamp = lastBlock.timestamp | |
148 | 148 | if (!(correctAgent)) | |
149 | 149 | then throw("Task may only be submitted by the agent who checked the task out!") | |
150 | 150 | else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp)] | |
151 | 151 | } | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | ||
155 | 155 | @Callable(i) | |
156 | 156 | func buy () = { | |
157 | - | let WAVES_USDT_ORACLE = addressFromStringValue("") | |
157 | + | let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy") | |
158 | 158 | let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT" | |
159 | 159 | let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
160 | 160 | let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
161 | 161 | let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1" | |
162 | 162 | let numberOfPayments = size(i.payments) | |
163 | 163 | if ((numberOfPayments != 1)) | |
164 | 164 | then throw("Payment necessary!") | |
165 | 165 | else { | |
166 | 166 | let payment = i.payments[0] | |
167 | 167 | let feeAssetId = payment.assetId | |
168 | 168 | let feeAssetIdString = match feeAssetId { | |
169 | 169 | case b: ByteVector => | |
170 | 170 | toBase58String(b) | |
171 | 171 | case _ => | |
172 | 172 | "" | |
173 | 173 | } | |
174 | 174 | let paymentAmount = payment.amount | |
175 | 175 | let amount = if (!(isDefined(feeAssetId))) | |
176 | 176 | then { | |
177 | 177 | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
178 | 178 | case n: Int => | |
179 | 179 | n | |
180 | 180 | case _ => | |
181 | 181 | 0 | |
182 | 182 | } | |
183 | 183 | (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100) | |
184 | 184 | } | |
185 | 185 | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
186 | 186 | then (paymentAmount * 100) | |
187 | 187 | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
188 | 188 | then (paymentAmount * 100) | |
189 | 189 | else throw("payment necessary in Waves, USDC or USDT!") | |
190 | 190 | [ScriptTransfer(i.caller, amount, fromBase58String(BAI_ASSET_ID))] | |
191 | 191 | } | |
192 | 192 | } | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | @Verifier(tx) | |
196 | 196 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
197 | 197 |
github/deemru/w8io/169f3d6 34.72 ms ◑