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+FyOHEEm2rommMfBCS3ZFOXLD68ZguDdK9ouySN4kIAC1NUQVRVU19PUEVOAgRvcGVuABJTVEFUVVNfQ0hFQ0tFRF9PVVQCC2NoZWNrZWRfb3V0AAtTVEFUVVNfRE9ORQIEZG9uZQAOQ0hFQ0tFRF9PVVRfQlkCD19jaGVja2VkX291dF9ieQATU0lNUExFX0NIQVRHUFRfVEFTSwITc2ltcGxlX0NoYXRHUFRfdGFzawAQQ0hFQ0tfT1VUX0hFSUdIVAIRX2NoZWNrX291dF9oZWlnaHQAD1JFR0lTVEVSX0hFSUdIVAIQX3JlZ2lzdGVyX2hlaWdodAANQ09NTUlUX0hFSUdIVAIOX2NvbW1pdF9oZWlnaHQBD2NhbkJlQ2hlY2tlZE91dAEGdGFza0lkBAZzdGF0dXMJAJ0IAgUEdGhpcwkArAICBQZ0YXNrSWQCB19zdGF0dXMJAAACBQZzdGF0dXMFC1NUQVRVU19PUEVOAQ5pc0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B3BheW1lbnQJAJEDAggFAWkIcGF5bWVudHMAAAQKZmVlQXNzZXRJZAgFB3BheW1lbnQHYXNzZXRJZAQQZmVlQXNzZXRJZFN0cmluZwQHJG1hdGNoMAUKZmVlQXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAFiBQckbWF0Y2gwCQDYBAEFAWICAAQNcGF5bWVudEFtb3VudAgFB3BheW1lbnQGYW1vdW50BAZhbW91bnQDCQEBIQEJAQlpc0RlZmluZWQBBQpmZWVBc3NldElkBA53YXZlc1VzZHRQcmljZQQHJG1hdGNoMAkAmggCBRFXQVZFU19VU0RUX09SQUNMRQUVV0FWRVNfVVNEVF9PUkFDTEVfS0VZAwkAAQIFByRtYXRjaDACA0ludAQBbgUHJG1hdGNoMAUBbgAACQBoAgkAawMFDXBheW1lbnRBbW91bnQFDndhdmVzVXNkdFByaWNlAIDC1y8AZAMJAAACBRBmZWVBc3NldElkU3RyaW5nBQ1VU0RUX0FTU0VUX0lECQBoAgUNcGF5bWVudEFtb3VudABkAwkAAAIFEGZlZUFzc2V0SWRTdHJpbmcFDVVTRENfQVNTRVRfSUQJAGgCBQ1wYXltZW50QW1vdW50AGQJAAIBAilwYXltZW50IG5lY2Vzc2FyeSBpbiBXYXZlcywgVVNEQyBvciBVU0RUIQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFBmFtb3VudAkA2QQBBQxCQUlfQVNTRVRfSUQFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXnBuM0B", "height": 2690146, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ApLJrssZrMbELDKVdv2Wi7nq9sGKTixuYBXeyJriDkVB Next: 3okdC1kQ5pDdK8ktWtAT27ALWyYaTMQgCn33JUiwtKEJ Diff:
OldNewDifferences
154154
155155 @Callable(i)
156156 func buy () = {
157- let WAVES_USDT_ORACLE = addressFromStringValue("")
157+ let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy")
158158 let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT"
159159 let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
160160 let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
55
66 let STATUS_OPEN = "open"
77
88 let STATUS_CHECKED_OUT = "checked_out"
99
1010 let STATUS_DONE = "done"
1111
1212 let CHECKED_OUT_BY = "_checked_out_by"
1313
1414 let SIMPLE_CHATGPT_TASK = "simple_ChatGPT_task"
1515
1616 let CHECK_OUT_HEIGHT = "_check_out_height"
1717
1818 let REGISTER_HEIGHT = "_register_height"
1919
2020 let COMMIT_HEIGHT = "_commit_height"
2121
2222 func canBeCheckedOut (taskId) = {
2323 let status = getString(this, (taskId + "_status"))
2424 (status == STATUS_OPEN)
2525 }
2626
2727
2828 func isCorrectAgent (taskId,agentId) = {
2929 let checkoutAgentId = getString(this, (taskId + CHECKED_OUT_BY))
3030 (checkoutAgentId == agentId)
3131 }
3232
3333
3434 func getTaskId (txId) = {
3535 let callerPublicKey = match getString(this, (txId + "_initializer")) {
3636 case str: String =>
3737 str
3838 case _ =>
3939 ""
4040 }
4141 match getString(this, ((txId + "_") + callerPublicKey)) {
4242 case str: String =>
4343 str
4444 case _ =>
4545 ""
4646 }
4747 }
4848
4949
5050 func getPriceForType (type) = match getInteger(this, ("price_" + type)) {
5151 case i: Int =>
5252 i
5353 case _ =>
5454 -1
5555 }
5656
5757
5858 @Callable(i)
5959 func registerTask (description,type) = {
6060 let numberOfPayments = size(i.payments)
6161 if ((numberOfPayments != 1))
6262 then throw("Payment necessary!")
6363 else {
6464 let callerPublicKey = toBase58String(i.callerPublicKey)
6565 let txId = toBase58String(i.transactionId)
6666 let payment = i.payments[0]
6767 let fee = payment.amount
6868 let feeAssetId = payment.assetId
6969 let taskId = ((txId + "_") + callerPublicKey)
7070 let timestamp = lastBlock.timestamp
7171 let minFee = getPriceForType(type)
7272 if ((feeAssetId != AI_TOKEN_ASSET_ID))
7373 then throw("Payment only possible in the AI Token!")
7474 else if ((minFee == -1))
7575 then throw("Task type not supported!")
7676 else if ((minFee > fee))
7777 then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
7878 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)]
7979 }
8080 }
8181
8282
8383
8484 @Callable(i)
8585 func registerChatGPTTask (description) = {
8686 let numberOfPayments = size(i.payments)
8787 if ((numberOfPayments != 1))
8888 then throw("Payment necessary!")
8989 else {
9090 let callerPublicKey = toBase58String(i.callerPublicKey)
9191 let txId = toBase58String(i.transactionId)
9292 let payment = i.payments[0]
9393 let fee = payment.amount
9494 let feeAssetId = payment.assetId
9595 let taskId = ((txId + "_") + callerPublicKey)
9696 let timestamp = lastBlock.timestamp
9797 if ((feeAssetId != AI_TOKEN_ASSET_ID))
9898 then throw("Payment only possible in the AI Token!")
9999 else if ((10000000 > fee))
100100 then throw("Payment needs to be at least 0.1 AI Token!")
101101 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)]
102102 }
103103 }
104104
105105
106106
107107 @Callable(i)
108108 func checkoutTask (taskId,type) = {
109109 let callerPublicKey = toBase58String(i.callerPublicKey)
110110 let taskStillOpen = canBeCheckedOut(taskId)
111111 let timestamp = lastBlock.timestamp
112112 if (!(taskStillOpen))
113113 then throw("Task not open for checkout!")
114114 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))]
115115 }
116116
117117
118118
119119 @Callable(i)
120120 func checkoutChatGPTTask (taskId) = {
121121 let callerPublicKey = toBase58String(i.callerPublicKey)
122122 let taskStillOpen = canBeCheckedOut(taskId)
123123 let timestamp = lastBlock.timestamp
124124 if (!(taskStillOpen))
125125 then throw("Task not open for checkout!")
126126 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))]
127127 }
128128
129129
130130
131131 @Callable(i)
132132 func commitTask (taskId,response) = {
133133 let callerPublicKey = toBase58String(i.callerPublicKey)
134134 let correctAgent = isCorrectAgent(taskId, callerPublicKey)
135135 let timestamp = lastBlock.timestamp
136136 if (!(correctAgent))
137137 then throw("Task may only be submitted by the agent who checked the task out!")
138138 else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp)]
139139 }
140140
141141
142142
143143 @Callable(i)
144144 func commitChatGPTTask (taskId,response) = {
145145 let callerPublicKey = toBase58String(i.callerPublicKey)
146146 let correctAgent = isCorrectAgent(taskId, callerPublicKey)
147147 let timestamp = lastBlock.timestamp
148148 if (!(correctAgent))
149149 then throw("Task may only be submitted by the agent who checked the task out!")
150150 else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp)]
151151 }
152152
153153
154154
155155 @Callable(i)
156156 func buy () = {
157- let WAVES_USDT_ORACLE = addressFromStringValue("")
157+ let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy")
158158 let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT"
159159 let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
160160 let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
161161 let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1"
162162 let numberOfPayments = size(i.payments)
163163 if ((numberOfPayments != 1))
164164 then throw("Payment necessary!")
165165 else {
166166 let payment = i.payments[0]
167167 let feeAssetId = payment.assetId
168168 let feeAssetIdString = match feeAssetId {
169169 case b: ByteVector =>
170170 toBase58String(b)
171171 case _ =>
172172 ""
173173 }
174174 let paymentAmount = payment.amount
175175 let amount = if (!(isDefined(feeAssetId)))
176176 then {
177177 let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) {
178178 case n: Int =>
179179 n
180180 case _ =>
181181 0
182182 }
183183 (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100)
184184 }
185185 else if ((feeAssetIdString == USDT_ASSET_ID))
186186 then (paymentAmount * 100)
187187 else if ((feeAssetIdString == USDC_ASSET_ID))
188188 then (paymentAmount * 100)
189189 else throw("payment necessary in Waves, USDC or USDT!")
190190 [ScriptTransfer(i.caller, amount, fromBase58String(BAI_ASSET_ID))]
191191 }
192192 }
193193
194194
195195 @Verifier(tx)
196196 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
197197

github/deemru/w8io/169f3d6 
34.72 ms