tx · 7PBVLoRMtRvSYqkXhfYG1u7KXimWbnLQQ2r8FtkekWjP 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV: -0.05000000 Waves 2024.01.12 13:48 [2928203] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves
{ "type": 13, "id": "7PBVLoRMtRvSYqkXhfYG1u7KXimWbnLQQ2r8FtkekWjP", "fee": 5000000, "feeAssetId": null, "timestamp": 1705056545165, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "2UgbvwX7H6i1d9Qs9FkCyQmkcimKdfgqVCq5ukEuSTH3mtCRJG9gBab2W3TipUsK2XteP9Xsz1LQUspFoLpwJsNU" ], "script": "base64:BgIdCAISBAoCCAgSBQoDCAgIEgQKAggIEgQKAggIEgAMABFBSV9UT0tFTl9BU1NFVF9JRAEgk+FyOHEEm2rommMfBCS3ZFOXLD68ZguDdK9ouySN4kIAC1NUQVRVU19PUEVOAgRvcGVuABJTVEFUVVNfQ0hFQ0tFRF9PVVQCC2NoZWNrZWRfb3V0AAtTVEFUVVNfRE9ORQIEZG9uZQAOQ0hFQ0tFRF9PVVRfQlkCEF9jaGVja2VkX291dF9ieV8AE1NJTVBMRV9DSEFUR1BUX1RBU0sCE3NpbXBsZV9DaGF0R1BUX3Rhc2sAEENIRUNLX09VVF9IRUlHSFQCEl9jaGVja19vdXRfaGVpZ2h0XwAPUkVHSVNURVJfSEVJR0hUAhFfcmVnaXN0ZXJfaGVpZ2h0XwANQ09NTUlUX0hFSUdIVAIPX2NvbW1pdF9oZWlnaHRfAQ9jYW5CZUNoZWNrZWRPdXQCBnRhc2tJZAR0eXBlBAZzdGF0dXMJAJ0IAgUEdGhpcwkArAICCQCsAgIFBnRhc2tJZAIIX3N0YXR1c18FBHR5cGUJAAACBQZzdG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1lbnQJAJEDAggFAWkIcGF5bWVudHMAAAQKZmVlQXNzZXRJZAgFB3BheW1lbnQHYXNzZXRJZAQQZmVlQXNzZXRJZFN0cmluZwQHJG1hdGNoMAUKZmVlQXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAFiBQckbWF0Y2gwCQDYBAEFAWICAAQNcGF5bWVudEFtb3VudAgFB3BheW1lbnQGYW1vdW50BAZhbW91bnQDCQEBIQEJAQlpc0RlZmluZWQBBQpmZWVBc3NldElkBA53YXZlc1VzZHRQcmljZQQHJG1hdGNoMAkAmggCBRFXQVZFU19VU0RUX09SQUNMRQUVV0FWRVNfVVNEVF9PUkFDTEVfS0VZAwkAAQIFByRtYXRjaDACA0ludAQBbgUHJG1hdGNoMAUBbgAACQBoAgkAawMFDXBheW1lbnRBbW91bnQFDndhdmVzVXNkdFByaWNlAIDC1y8AZAMJAAACBRBmZWVBc3NldElkU3RyaW5nBQ1VU0RUX0FTU0VUX0lECQBoAgUNcGF5bWVudEFtb3VudABkAwkAAAIFEGZlZUFzc2V0SWRTdHJpbmcFDVVTRENfQVNTRVRfSUQJAGgCBQ1wYXltZW50QW1vdW50AGQJAAIBAilwYXltZW50IG5lY2Vzc2FyeSBpbiBXYXZlcywgVVNEQyBvciBVU0RUIQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFBmFtb3VudAkA2QQBBQxCQUlfQVNTRVRfSUQFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkKWxAH", "height": 2928203, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3SyhoNBqgMgTZMxSsHve7CYQWA2sNkBkFXdcpJGMjixS Next: 3X47SC5puiDbDG9fY1MKzSrqJwhB5pd9h61SfSfxpsPK Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | let taskId = ((txId + "_") + callerPublicKey) | |
54 | 54 | let timestamp = lastBlock.timestamp | |
55 | 55 | let minFee = getPriceForType(type) | |
56 | + | let daoUserValue = match getInteger(this, ("dao_user_" + callerPublicKey)) { | |
57 | + | case n: Int => | |
58 | + | (n + fee) | |
59 | + | case _ => | |
60 | + | fee | |
61 | + | } | |
62 | + | let daoSum = match getInteger(this, "dao_sum") { | |
63 | + | case n: Int => | |
64 | + | (n + fee) | |
65 | + | case _ => | |
66 | + | fee | |
67 | + | } | |
56 | 68 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
57 | 69 | then throw("Payment only possible in the AI Token!") | |
58 | 70 | else if ((minFee == -1)) | |
59 | 71 | then throw("Task type not supported!") | |
60 | 72 | else if ((minFee > fee)) | |
61 | 73 | then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!")) | |
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)] | |
74 | + | 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), IntegerEntry("dao_sum", daoSum), IntegerEntry(("dao_user_" + callerPublicKey), daoUserValue)] | |
63 | 75 | } | |
64 | 76 | } | |
65 | 77 |
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 | + | let daoUserValue = match getInteger(this, ("dao_user_" + callerPublicKey)) { | |
57 | + | case n: Int => | |
58 | + | (n + fee) | |
59 | + | case _ => | |
60 | + | fee | |
61 | + | } | |
62 | + | let daoSum = match getInteger(this, "dao_sum") { | |
63 | + | case n: Int => | |
64 | + | (n + fee) | |
65 | + | case _ => | |
66 | + | fee | |
67 | + | } | |
56 | 68 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
57 | 69 | then throw("Payment only possible in the AI Token!") | |
58 | 70 | else if ((minFee == -1)) | |
59 | 71 | then throw("Task type not supported!") | |
60 | 72 | else if ((minFee > fee)) | |
61 | 73 | then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!")) | |
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)] | |
74 | + | 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), IntegerEntry("dao_sum", daoSum), IntegerEntry(("dao_user_" + callerPublicKey), daoUserValue)] | |
63 | 75 | } | |
64 | 76 | } | |
65 | 77 | ||
66 | 78 | ||
67 | 79 | ||
68 | 80 | @Callable(i) | |
69 | 81 | func registerTaskCallback (description,type,callback) = { | |
70 | 82 | let numberOfPayments = size(i.payments) | |
71 | 83 | if ((numberOfPayments != 1)) | |
72 | 84 | then throw("Payment necessary!") | |
73 | 85 | else { | |
74 | 86 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
75 | 87 | let caller = toString(i.caller) | |
76 | 88 | let txId = toBase58String(i.transactionId) | |
77 | 89 | let payment = i.payments[0] | |
78 | 90 | let fee = payment.amount | |
79 | 91 | let feeAssetId = payment.assetId | |
80 | 92 | let taskId = ((txId + "_") + callerPublicKey) | |
81 | 93 | let timestamp = lastBlock.timestamp | |
82 | 94 | let minFee = getPriceForType(type) | |
83 | 95 | if ((feeAssetId != AI_TOKEN_ASSET_ID)) | |
84 | 96 | then throw("Payment only possible in the AI Token!") | |
85 | 97 | else if ((minFee == -1)) | |
86 | 98 | then throw("Task type not supported!") | |
87 | 99 | else if ((minFee > fee)) | |
88 | 100 | then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!")) | |
89 | 101 | else [StringEntry(((taskId + "_description_") + type), description), StringEntry(((txId + "_initializer_") + type), callerPublicKey), StringEntry(((taskId + "_callback_") + type), callback), StringEntry(((taskId + "_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_" + txId) + "_") + toString(height)), taskId)] | |
90 | 102 | } | |
91 | 103 | } | |
92 | 104 | ||
93 | 105 | ||
94 | 106 | ||
95 | 107 | @Callable(i) | |
96 | 108 | func checkoutTask (taskId,type) = { | |
97 | 109 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
98 | 110 | let taskStillOpen = canBeCheckedOut(taskId, type) | |
99 | 111 | let timestamp = lastBlock.timestamp | |
100 | 112 | if (!(taskStillOpen)) | |
101 | 113 | then throw("Task not open for checkout!") | |
102 | 114 | 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 | 115 | } | |
104 | 116 | ||
105 | 117 | ||
106 | 118 | ||
107 | 119 | @Callable(i) | |
108 | 120 | func commitTask (taskId,response) = { | |
109 | 121 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
110 | 122 | let type = match getString((taskId + "_type")) { | |
111 | 123 | case s: String => | |
112 | 124 | s | |
113 | 125 | case _ => | |
114 | 126 | "not set" | |
115 | 127 | } | |
116 | 128 | let correctAgent = isCorrectAgent(taskId, callerPublicKey, type) | |
117 | 129 | let timestamp = lastBlock.timestamp | |
118 | 130 | let callback = match getString(((taskId + "_callback_") + type)) { | |
119 | 131 | case s: String => | |
120 | 132 | s | |
121 | 133 | case _ => | |
122 | 134 | "no callback" | |
123 | 135 | } | |
124 | 136 | let caller = match getString(((taskId + "_caller_") + type)) { | |
125 | 137 | case s: String => | |
126 | 138 | s | |
127 | 139 | case _ => | |
128 | 140 | "no callback" | |
129 | 141 | } | |
130 | 142 | if (!(correctAgent)) | |
131 | 143 | then throw("Task may only be submitted by the agent who checked the task out!") | |
132 | 144 | else if ((type == "not set")) | |
133 | 145 | then throw("Can not identify type of task id") | |
134 | 146 | else if ((callback != "no callback")) | |
135 | 147 | then { | |
136 | 148 | let result = invoke(Address(fromBase58String(caller)), callback, [response], nil) | |
137 | 149 | if ((result == result)) | |
138 | 150 | 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 | 151 | else throw("Strict value is not equal to itself.") | |
140 | 152 | } | |
141 | 153 | 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))] | |
142 | 154 | } | |
143 | 155 | ||
144 | 156 | ||
145 | 157 | ||
146 | 158 | @Callable(i) | |
147 | 159 | func buy () = { | |
148 | 160 | let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy") | |
149 | 161 | let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT" | |
150 | 162 | let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
151 | 163 | let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
152 | 164 | let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1" | |
153 | 165 | let numberOfPayments = size(i.payments) | |
154 | 166 | if ((numberOfPayments != 1)) | |
155 | 167 | then throw("Payment necessary!") | |
156 | 168 | else { | |
157 | 169 | let payment = i.payments[0] | |
158 | 170 | let feeAssetId = payment.assetId | |
159 | 171 | let feeAssetIdString = match feeAssetId { | |
160 | 172 | case b: ByteVector => | |
161 | 173 | toBase58String(b) | |
162 | 174 | case _ => | |
163 | 175 | "" | |
164 | 176 | } | |
165 | 177 | let paymentAmount = payment.amount | |
166 | 178 | let amount = if (!(isDefined(feeAssetId))) | |
167 | 179 | then { | |
168 | 180 | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
169 | 181 | case n: Int => | |
170 | 182 | n | |
171 | 183 | case _ => | |
172 | 184 | 0 | |
173 | 185 | } | |
174 | 186 | (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100) | |
175 | 187 | } | |
176 | 188 | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
177 | 189 | then (paymentAmount * 100) | |
178 | 190 | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
179 | 191 | then (paymentAmount * 100) | |
180 | 192 | else throw("payment necessary in Waves, USDC or USDT!") | |
181 | 193 | [ScriptTransfer(i.caller, amount, fromBase58String(BAI_ASSET_ID))] | |
182 | 194 | } | |
183 | 195 | } | |
184 | 196 | ||
185 | 197 | ||
186 | 198 | @Verifier(tx) | |
187 | 199 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
188 | 200 |
github/deemru/w8io/026f985 41.29 ms ◑