tx · 3X47SC5puiDbDG9fY1MKzSrqJwhB5pd9h61SfSfxpsPK

3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV:  -0.05000000 Waves

2024.10.24 19:20 [3341143] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves

{ "type": 13, "id": "3X47SC5puiDbDG9fY1MKzSrqJwhB5pd9h61SfSfxpsPK", "fee": 5000000, "feeAssetId": null, "timestamp": 1729786826032, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "49Ss9DoqWHvquLh99ePWDqFJQJByU9BzXYVzvSYzhjYHXdfFeFVuJA7mrEjsgKWxFHHLNLTd6pLN9XMRiLCPfJn5" ], "script": "base64:BgIbCAISBAoCCAgSBQoDCAgIEgQKAggIEgQKAggIDAARQUlfVE9LRU5fQVNTRVRfSUQBIJPhcjhxBJtq6JpjHwQkt2RTlyw+vGYLg3SvaLskjeJCAAtTVEFUVVNfT1BFTgIEb3BlbgASU1RBVFVTX0NIRUNLRURfT1VUAgtjaGVja2VkX291dAALU1RBVFVTX0RPTkUCBGRvbmUADkNIRUNLRURfT1VUX0JZAhBfY2hlY2tlZF9vdXRfYnlfABNTSU1QTEVfQ0hBVEdQVF9UQVNLAhNzaW1wbGVfQ2hhdEdQVF90YXNrABBDSEVDS19PVVRfSEVJR0hUAhJfY2hlY2tfb3V0X2hlaWdodF8AD1JFR0lTVEVSX0hFSUdIVAIRX3JlZ2lzdGVyX2hlaWdodF8ADUNPTU1JVF9IRUlHSFQCD19jb21taXRfaGVpZ2h0XwEPY2FuQmVDaGVja2VkT3V0AgZ0YXNrSWQEdHlwZQQGc3RhdHVzCQCdCAIFBHRoaXMJAKwCAgkArAICBQZ0YXNrSWQCCF9zdGF0dXNfBQR0eXBlCQAAAgUGc3RhdHVzBQtTVEFU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VlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICBQZ0YXNrSWQCCF9zdGF0dXNfBQR0eXBlBQtTVEFUVVNfRE9ORQkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUGdGFza0lkAghfcmVzdWx0XwUEdHlwZQUIcmVzcG9uc2UJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkArAICBQZ0YXNrSWQFDUNPTU1JVF9IRUlHSFQFBHR5cGUFBmhlaWdodAkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICCQCsAgIFBnRhc2tJZAISX2NvbW1pdF90aW1lc3RhbXBfBQR0eXBlBQl0aW1lc3RhbXAJAMwIAgkBC0RlbGV0ZUVudHJ5AQkArAICCQCsAgIJAKwCAgkArAICCQCsAgICD2NoZWNrZWRfb3V0X2J5XwUPY2FsbGVyUHVibGljS2V5AgFfBQR0eXBlAgFfBQZ0YXNrSWQFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkmP4uL", "height": 3341143, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7PBVLoRMtRvSYqkXhfYG1u7KXimWbnLQQ2r8FtkekWjP Next: DwHkFLxNsAVbSrHcoLTHD2XBxAJnuVUaeVi8iiL3kvA1 Diff:
OldNewDifferences
7070 else if ((minFee == -1))
7171 then throw("Task type not supported!")
7272 else if ((minFee > fee))
73- then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
73+ then throw((("Payment needs to be at least " + toString(minFee)) + " BAI Token!"))
7474 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)]
7575 }
7676 }
9797 else if ((minFee == -1))
9898 then throw("Task type not supported!")
9999 else if ((minFee > fee))
100- then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
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)]
100+ then throw((("Payment needs to be at least " + toString(minFee)) + " BAI Token!"))
101+ else $Tuple2([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)], taskId)
102102 }
103103 }
104104
145145 then throw("Can not identify type of task id")
146146 else if ((callback != "no callback"))
147147 then {
148- let result = invoke(Address(fromBase58String(caller)), callback, [response], nil)
148+ let result = invoke(Address(fromBase58String(caller)), callback, [taskId, response], nil)
149149 if ((result == result))
150150 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))]
151151 else throw("Strict value is not equal to itself.")
152152 }
153153 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))]
154- }
155-
156-
157-
158-@Callable(i)
159-func buy () = {
160- let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy")
161- let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT"
162- let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
163- let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
164- let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1"
165- let numberOfPayments = size(i.payments)
166- if ((numberOfPayments != 1))
167- then throw("Payment necessary!")
168- else {
169- let payment = i.payments[0]
170- let feeAssetId = payment.assetId
171- let feeAssetIdString = match feeAssetId {
172- case b: ByteVector =>
173- toBase58String(b)
174- case _ =>
175- ""
176- }
177- let paymentAmount = payment.amount
178- let amount = if (!(isDefined(feeAssetId)))
179- then {
180- let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) {
181- case n: Int =>
182- n
183- case _ =>
184- 0
185- }
186- (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100)
187- }
188- else if ((feeAssetIdString == USDT_ASSET_ID))
189- then (paymentAmount * 100)
190- else if ((feeAssetIdString == USDC_ASSET_ID))
191- then (paymentAmount * 100)
192- else throw("payment necessary in Waves, USDC or USDT!")
193-[ScriptTransfer(i.caller, amount, fromBase58String(BAI_ASSET_ID))]
194- }
195154 }
196155
197156
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 let daoUserValue = match getInteger(this, ("dao_user_" + callerPublicKey)) {
5757 case n: Int =>
5858 (n + fee)
5959 case _ =>
6060 fee
6161 }
6262 let daoSum = match getInteger(this, "dao_sum") {
6363 case n: Int =>
6464 (n + fee)
6565 case _ =>
6666 fee
6767 }
6868 if ((feeAssetId != AI_TOKEN_ASSET_ID))
6969 then throw("Payment only possible in the AI Token!")
7070 else if ((minFee == -1))
7171 then throw("Task type not supported!")
7272 else if ((minFee > fee))
73- then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
73+ then throw((("Payment needs to be at least " + toString(minFee)) + " BAI Token!"))
7474 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)]
7575 }
7676 }
7777
7878
7979
8080 @Callable(i)
8181 func registerTaskCallback (description,type,callback) = {
8282 let numberOfPayments = size(i.payments)
8383 if ((numberOfPayments != 1))
8484 then throw("Payment necessary!")
8585 else {
8686 let callerPublicKey = toBase58String(i.callerPublicKey)
8787 let caller = toString(i.caller)
8888 let txId = toBase58String(i.transactionId)
8989 let payment = i.payments[0]
9090 let fee = payment.amount
9191 let feeAssetId = payment.assetId
9292 let taskId = ((txId + "_") + callerPublicKey)
9393 let timestamp = lastBlock.timestamp
9494 let minFee = getPriceForType(type)
9595 if ((feeAssetId != AI_TOKEN_ASSET_ID))
9696 then throw("Payment only possible in the AI Token!")
9797 else if ((minFee == -1))
9898 then throw("Task type not supported!")
9999 else if ((minFee > fee))
100- then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
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)]
100+ then throw((("Payment needs to be at least " + toString(minFee)) + " BAI Token!"))
101+ else $Tuple2([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)], taskId)
102102 }
103103 }
104104
105105
106106
107107 @Callable(i)
108108 func checkoutTask (taskId,type) = {
109109 let callerPublicKey = toBase58String(i.callerPublicKey)
110110 let taskStillOpen = canBeCheckedOut(taskId, type)
111111 let timestamp = lastBlock.timestamp
112112 if (!(taskStillOpen))
113113 then throw("Task not open for checkout!")
114114 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))]
115115 }
116116
117117
118118
119119 @Callable(i)
120120 func commitTask (taskId,response) = {
121121 let callerPublicKey = toBase58String(i.callerPublicKey)
122122 let type = match getString((taskId + "_type")) {
123123 case s: String =>
124124 s
125125 case _ =>
126126 "not set"
127127 }
128128 let correctAgent = isCorrectAgent(taskId, callerPublicKey, type)
129129 let timestamp = lastBlock.timestamp
130130 let callback = match getString(((taskId + "_callback_") + type)) {
131131 case s: String =>
132132 s
133133 case _ =>
134134 "no callback"
135135 }
136136 let caller = match getString(((taskId + "_caller_") + type)) {
137137 case s: String =>
138138 s
139139 case _ =>
140140 "no callback"
141141 }
142142 if (!(correctAgent))
143143 then throw("Task may only be submitted by the agent who checked the task out!")
144144 else if ((type == "not set"))
145145 then throw("Can not identify type of task id")
146146 else if ((callback != "no callback"))
147147 then {
148- let result = invoke(Address(fromBase58String(caller)), callback, [response], nil)
148+ let result = invoke(Address(fromBase58String(caller)), callback, [taskId, response], nil)
149149 if ((result == result))
150150 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))]
151151 else throw("Strict value is not equal to itself.")
152152 }
153153 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))]
154- }
155-
156-
157-
158-@Callable(i)
159-func buy () = {
160- let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy")
161- let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT"
162- let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
163- let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
164- let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1"
165- let numberOfPayments = size(i.payments)
166- if ((numberOfPayments != 1))
167- then throw("Payment necessary!")
168- else {
169- let payment = i.payments[0]
170- let feeAssetId = payment.assetId
171- let feeAssetIdString = match feeAssetId {
172- case b: ByteVector =>
173- toBase58String(b)
174- case _ =>
175- ""
176- }
177- let paymentAmount = payment.amount
178- let amount = if (!(isDefined(feeAssetId)))
179- then {
180- let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) {
181- case n: Int =>
182- n
183- case _ =>
184- 0
185- }
186- (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100)
187- }
188- else if ((feeAssetIdString == USDT_ASSET_ID))
189- then (paymentAmount * 100)
190- else if ((feeAssetIdString == USDC_ASSET_ID))
191- then (paymentAmount * 100)
192- else throw("payment necessary in Waves, USDC or USDT!")
193-[ScriptTransfer(i.caller, amount, fromBase58String(BAI_ASSET_ID))]
194- }
195154 }
196155
197156
198157 @Verifier(tx)
199158 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
200159

github/deemru/w8io/026f985 
59.71 ms