tx · 52BdjMJtuMpkawNtXxrFu66jENYvKUn2qGKNg3rLUKMd

3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV:  -0.01000000 Waves

2023.09.08 13:12 [2746277] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves

{ "type": 13, "id": "52BdjMJtuMpkawNtXxrFu66jENYvKUn2qGKNg3rLUKMd", "fee": 1000000, "feeAssetId": null, "timestamp": 1694167968546, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "49RXFWnBTZANpyg9RwtcjRdn3czSBUbjFDQEQJWuGiMKWgtNXF3GtB2jSoBdHL1LMHx8Ten3vJbJYsVvg96yB4XT" ], "script": "base64:BgIdCAISBAoCCAgSBQoDCAgIEgQKAggIEgQKAggIEgAMABFBSV9UT0tFTl9BU1NFVF9JRAEgk+FyOHEEm2rommMfBCS3ZFOXLD68ZguDdK9ouySN4kIAC1NUQVRVU19PUEVOAgRvcGVuABJTVEFUVVNfQ0hFQ0tFRF9PVVQCC2NoZWNrZWRfb3V0AAtTVEFUVVNfRE9ORQIEZG9uZQAOQ0hFQ0tFRF9PVVRfQlkCEF9jaGVja2VkX291dF9ieV8AE1NJTVBMRV9DSEFUR1BUX1RBU0sCE3NpbXBsZV9DaGF0R1BUX3Rhc2sAEENIRUNLX09VVF9IRUlHSFQCEl9jaGVja19vdXRfaGVpZ2h0XwAPUkVHSVNURVJfSEVJR0hUAhFfcmVnaXN0ZXJfaGVpZ2h0XwANQ09NTUlUX0hFSUdIVAIPX2NvbW1pdF9oZWlnaHRfAQ9jYW5CZUNoZWNrZWRPdXQCBnRhc2tJZAR0eXBlBAZzdGF0dXMJAJ0IAgUEdGhpcwkArAICCQCsAgIFBnRhc2tJZAIIX3N0YXR1c18FBHR5cGUJAAACBQZzdGF0dXMF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gCCQBrAwUNcGF5bWVudEFtb3VudAUOd2F2ZXNVc2R0UHJpY2UAgMLXLwBkAwkAAAIFEGZlZUFzc2V0SWRTdHJpbmcFDVVTRFRfQVNTRVRfSUQJAGgCBQ1wYXltZW50QW1vdW50AGQDCQAAAgUQZmVlQXNzZXRJZFN0cmluZwUNVVNEQ19BU1NFVF9JRAkAaAIFDXBheW1lbnRBbW91bnQAZAkAAgECKXBheW1lbnQgbmVjZXNzYXJ5IGluIFdhdmVzLCBVU0RDIG9yIFVTRFQhCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUGYW1vdW50CQDZBAEFDEJBSV9BU1NFVF9JRAUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleWMG9SU=", "height": 2746277, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Bv2TgPFJv4HBp9grTznUWAHvdDFSrUZdQLRWAZoBsv3Z Next: 3SyhoNBqgMgTZMxSsHve7CYQWA2sNkBkFXdcpJGMjixS Diff:
OldNewDifferences
8686 then throw("Task type not supported!")
8787 else if ((minFee > fee))
8888 then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
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)]
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_" + txId) + "_") + toString(height)), taskId)]
9090 }
9191 }
9292
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,type) = {
2323 let status = getString(this, ((taskId + "_status_") + type))
2424 (status == STATUS_OPEN)
2525 }
2626
2727
2828 func isCorrectAgent (taskId,agentId,type) = {
2929 let checkoutAgentId = getString(this, ((taskId + CHECKED_OUT_BY) + type))
3030 (checkoutAgentId == agentId)
3131 }
3232
3333
3434 func getPriceForType (type) = match getInteger(this, ("price_" + type)) {
3535 case i: Int =>
3636 i
3737 case _ =>
3838 -1
3939 }
4040
4141
4242 @Callable(i)
4343 func registerTask (description,type) = {
4444 let numberOfPayments = size(i.payments)
4545 if ((numberOfPayments != 1))
4646 then throw("Payment necessary!")
4747 else {
4848 let callerPublicKey = toBase58String(i.callerPublicKey)
4949 let txId = toBase58String(i.transactionId)
5050 let payment = i.payments[0]
5151 let fee = payment.amount
5252 let feeAssetId = payment.assetId
5353 let taskId = ((txId + "_") + callerPublicKey)
5454 let timestamp = lastBlock.timestamp
5555 let minFee = getPriceForType(type)
5656 if ((feeAssetId != AI_TOKEN_ASSET_ID))
5757 then throw("Payment only possible in the AI Token!")
5858 else if ((minFee == -1))
5959 then throw("Task type not supported!")
6060 else if ((minFee > fee))
6161 then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
6262 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)]
6363 }
6464 }
6565
6666
6767
6868 @Callable(i)
6969 func registerTaskCallback (description,type,callback) = {
7070 let numberOfPayments = size(i.payments)
7171 if ((numberOfPayments != 1))
7272 then throw("Payment necessary!")
7373 else {
7474 let callerPublicKey = toBase58String(i.callerPublicKey)
7575 let caller = toString(i.caller)
7676 let txId = toBase58String(i.transactionId)
7777 let payment = i.payments[0]
7878 let fee = payment.amount
7979 let feeAssetId = payment.assetId
8080 let taskId = ((txId + "_") + callerPublicKey)
8181 let timestamp = lastBlock.timestamp
8282 let minFee = getPriceForType(type)
8383 if ((feeAssetId != AI_TOKEN_ASSET_ID))
8484 then throw("Payment only possible in the AI Token!")
8585 else if ((minFee == -1))
8686 then throw("Task type not supported!")
8787 else if ((minFee > fee))
8888 then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
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)]
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_" + txId) + "_") + toString(height)), taskId)]
9090 }
9191 }
9292
9393
9494
9595 @Callable(i)
9696 func checkoutTask (taskId,type) = {
9797 let callerPublicKey = toBase58String(i.callerPublicKey)
9898 let taskStillOpen = canBeCheckedOut(taskId, type)
9999 let timestamp = lastBlock.timestamp
100100 if (!(taskStillOpen))
101101 then throw("Task not open for checkout!")
102102 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))]
103103 }
104104
105105
106106
107107 @Callable(i)
108108 func commitTask (taskId,response) = {
109109 let callerPublicKey = toBase58String(i.callerPublicKey)
110110 let type = match getString((taskId + "_type")) {
111111 case s: String =>
112112 s
113113 case _ =>
114114 "not set"
115115 }
116116 let correctAgent = isCorrectAgent(taskId, callerPublicKey, type)
117117 let timestamp = lastBlock.timestamp
118118 let callback = match getString(((taskId + "_callback_") + type)) {
119119 case s: String =>
120120 s
121121 case _ =>
122122 "no callback"
123123 }
124124 let caller = match getString(((taskId + "_caller_") + type)) {
125125 case s: String =>
126126 s
127127 case _ =>
128128 "no callback"
129129 }
130130 if (!(correctAgent))
131131 then throw("Task may only be submitted by the agent who checked the task out!")
132132 else if ((type == "not set"))
133133 then throw("Can not identify type of task id")
134134 else if ((callback != "no callback"))
135135 then {
136136 let result = invoke(Address(fromBase58String(caller)), callback, [response], nil)
137137 if ((result == result))
138138 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))]
139139 else throw("Strict value is not equal to itself.")
140140 }
141141 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))]
142142 }
143143
144144
145145
146146 @Callable(i)
147147 func buy () = {
148148 let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy")
149149 let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT"
150150 let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
151151 let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
152152 let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1"
153153 let numberOfPayments = size(i.payments)
154154 if ((numberOfPayments != 1))
155155 then throw("Payment necessary!")
156156 else {
157157 let payment = i.payments[0]
158158 let feeAssetId = payment.assetId
159159 let feeAssetIdString = match feeAssetId {
160160 case b: ByteVector =>
161161 toBase58String(b)
162162 case _ =>
163163 ""
164164 }
165165 let paymentAmount = payment.amount
166166 let amount = if (!(isDefined(feeAssetId)))
167167 then {
168168 let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) {
169169 case n: Int =>
170170 n
171171 case _ =>
172172 0
173173 }
174174 (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100)
175175 }
176176 else if ((feeAssetIdString == USDT_ASSET_ID))
177177 then (paymentAmount * 100)
178178 else if ((feeAssetIdString == USDC_ASSET_ID))
179179 then (paymentAmount * 100)
180180 else throw("payment necessary in Waves, USDC or USDT!")
181181 [ScriptTransfer(i.caller, amount, fromBase58String(BAI_ASSET_ID))]
182182 }
183183 }
184184
185185
186186 @Verifier(tx)
187187 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
188188

github/deemru/w8io/026f985 
47.37 ms