tx · 5EJBhiRcVDXxuJecUFqwuhcEDqS45XYyq3XGCddhE3Kt

3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV:  -0.01000000 Waves

2023.09.07 10:17 [2744652] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves

{ "type": 13, "id": "5EJBhiRcVDXxuJecUFqwuhcEDqS45XYyq3XGCddhE3Kt", "fee": 1000000, "feeAssetId": null, "timestamp": 1694071129582, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "5cabMsynqu4qiiy96iuFDVGytxCb9cfQEE1zSMacUraor8aWvmqGtECjUHks8LT9zJrJW5E2hQ2K9iBDeW4dGxY8" ], "script": "base64:BgIdCAISBAoCCAgSBQoDCAgIEgQKAggIEgQKAggIEgANABFBSV9UT0tFTl9BU1NFVF9JRAEgk+FyOHEEm2rommMfBCS3ZFOXLD68ZguDdK9ouySN4kIAC1NUQVRVU19PUEVOAgRvcGVuABJTVEFUVVNfQ0hFQ0tFRF9PVVQCC2NoZWNrZWRfb3V0AAtTVEFUVVNfRE9ORQIEZG9uZQAOQ0hFQ0tFRF9PVVRfQlkCEF9jaGVja2VkX291dF9ieV8AE1NJTVBMRV9DSEFUR1BUX1RBU0sCE3NpbXBsZV9DaGF0R1BUX3Rhc2sAEENIRUNLX09VVF9IRUlHSFQCEl9jaGVja19vdXRfaGVpZ2h0XwAPUkVHSVNURVJfSEVJR0hUAhFfcmVnaXN0ZXJfaGVpZ2h0XwANQ09NTUlUX0hFSUdIVAIPX2NvbW1pdF9oZWlnaHRfAQ9jYW5CZUNoZWNrZWRPdXQBBnRhc2tJZAQGc3RhdHVzCQCdCAIFBHRoaXMJAKwCAgUGdGFza0lkAgdfc3RhdHVzCQAAAgUGc3RhdHVzBQtTVEFUVVNfT1BFTgEOaXN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FAW4AAAkAaAIJAGsDBQ1wYXltZW50QW1vdW50BQ53YXZlc1VzZHRQcmljZQCAwtcvAGQDCQAAAgUQZmVlQXNzZXRJZFN0cmluZwUNVVNEVF9BU1NFVF9JRAkAaAIFDXBheW1lbnRBbW91bnQAZAMJAAACBRBmZWVBc3NldElkU3RyaW5nBQ1VU0RDX0FTU0VUX0lECQBoAgUNcGF5bWVudEFtb3VudABkCQACAQIpcGF5bWVudCBuZWNlc3NhcnkgaW4gV2F2ZXMsIFVTREMgb3IgVVNEVCEJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyBQZhbW91bnQJANkEAQUMQkFJX0FTU0VUX0lEBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V56RViuw==", "height": 2744652, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FxKDSfbh8ZMbjRDi2uj4sggGSK9gezevV3MkhSBK8Syq Next: ChGeWu4zwoRH9YgcF3C8QqCqokWcUAHYELf7j2GEmzQv Diff:
OldNewDifferences
99
1010 let STATUS_DONE = "done"
1111
12-let CHECKED_OUT_BY = "_checked_out_by"
12+let CHECKED_OUT_BY = "_checked_out_by_"
1313
1414 let SIMPLE_CHATGPT_TASK = "simple_ChatGPT_task"
1515
16-let CHECK_OUT_HEIGHT = "_check_out_height"
16+let CHECK_OUT_HEIGHT = "_check_out_height_"
1717
18-let REGISTER_HEIGHT = "_register_height"
18+let REGISTER_HEIGHT = "_register_height_"
1919
20-let COMMIT_HEIGHT = "_commit_height"
20+let COMMIT_HEIGHT = "_commit_height_"
2121
2222 func canBeCheckedOut (taskId) = {
2323 let status = getString(this, (taskId + "_status"))
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!"))
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)]
78+ 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)]
7979 }
8080 }
8181
8282
8383
8484 @Callable(i)
85-func registerChatGPTTask (description) = {
85+func registerTaskCallback (description,type,callback) = {
8686 let numberOfPayments = size(i.payments)
8787 if ((numberOfPayments != 1))
8888 then throw("Payment necessary!")
8989 else {
9090 let callerPublicKey = toBase58String(i.callerPublicKey)
91+ let caller = toString(i.caller)
9192 let txId = toBase58String(i.transactionId)
9293 let payment = i.payments[0]
9394 let fee = payment.amount
9495 let feeAssetId = payment.assetId
9596 let taskId = ((txId + "_") + callerPublicKey)
9697 let timestamp = lastBlock.timestamp
98+ let minFee = getPriceForType(type)
9799 if ((feeAssetId != AI_TOKEN_ASSET_ID))
98100 then throw("Payment only possible in the AI Token!")
99- else if ((10000000 > fee))
100- then throw("Payment needs to be at least 0.1 AI Token!")
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)]
101+ else if ((minFee == -1))
102+ then throw("Task type not supported!")
103+ else if ((minFee > fee))
104+ then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
105+ 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)]
102106 }
103107 }
104108
111115 let timestamp = lastBlock.timestamp
112116 if (!(taskStillOpen))
113117 then throw("Task not open for checkout!")
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), BooleanEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId), true), DeleteEntry(((("open_" + type) + "_") + taskId))]
115- }
116-
117-
118-
119-@Callable(i)
120-func checkoutChatGPTTask (taskId) = {
121- let callerPublicKey = toBase58String(i.callerPublicKey)
122- let taskStillOpen = canBeCheckedOut(taskId)
123- let timestamp = lastBlock.timestamp
124- if (!(taskStillOpen))
125- then throw("Task not open for checkout!")
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))]
118+ 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))]
127119 }
128120
129121
139131 case _ =>
140132 "not set"
141133 }
134+ let callback = match getString((taskId + "_callback")) {
135+ case s: String =>
136+ s
137+ case _ =>
138+ "no callback"
139+ }
140+ let caller = match getString((taskId + "_caller")) {
141+ case s: String =>
142+ s
143+ case _ =>
144+ "no callback"
145+ }
142146 if (!(correctAgent))
143147 then throw("Task may only be submitted by the agent who checked the task out!")
144148 else if ((type == "not set"))
145149 then throw("Can not identify type of task id")
146- else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp), DeleteEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId))]
147- }
148-
149-
150-
151-@Callable(i)
152-func commitChatGPTTask (taskId,response) = {
153- let callerPublicKey = toBase58String(i.callerPublicKey)
154- let correctAgent = isCorrectAgent(taskId, callerPublicKey)
155- let timestamp = lastBlock.timestamp
156- if (!(correctAgent))
157- then throw("Task may only be submitted by the agent who checked the task out!")
158- else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp)]
150+ else if ((callback != "no callback"))
151+ then {
152+ let result = invoke(Address(fromBase58String(caller)), callback, [response], nil)
153+[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+ 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))]
159156 }
160157
161158
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
12-let CHECKED_OUT_BY = "_checked_out_by"
12+let CHECKED_OUT_BY = "_checked_out_by_"
1313
1414 let SIMPLE_CHATGPT_TASK = "simple_ChatGPT_task"
1515
16-let CHECK_OUT_HEIGHT = "_check_out_height"
16+let CHECK_OUT_HEIGHT = "_check_out_height_"
1717
18-let REGISTER_HEIGHT = "_register_height"
18+let REGISTER_HEIGHT = "_register_height_"
1919
20-let COMMIT_HEIGHT = "_commit_height"
20+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!"))
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)]
78+ 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)]
7979 }
8080 }
8181
8282
8383
8484 @Callable(i)
85-func registerChatGPTTask (description) = {
85+func registerTaskCallback (description,type,callback) = {
8686 let numberOfPayments = size(i.payments)
8787 if ((numberOfPayments != 1))
8888 then throw("Payment necessary!")
8989 else {
9090 let callerPublicKey = toBase58String(i.callerPublicKey)
91+ let caller = toString(i.caller)
9192 let txId = toBase58String(i.transactionId)
9293 let payment = i.payments[0]
9394 let fee = payment.amount
9495 let feeAssetId = payment.assetId
9596 let taskId = ((txId + "_") + callerPublicKey)
9697 let timestamp = lastBlock.timestamp
98+ let minFee = getPriceForType(type)
9799 if ((feeAssetId != AI_TOKEN_ASSET_ID))
98100 then throw("Payment only possible in the AI Token!")
99- else if ((10000000 > fee))
100- then throw("Payment needs to be at least 0.1 AI Token!")
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)]
101+ else if ((minFee == -1))
102+ then throw("Task type not supported!")
103+ else if ((minFee > fee))
104+ then throw((("Payment needs to be at least " + toString(minFee)) + " AI Token!"))
105+ 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)]
102106 }
103107 }
104108
105109
106110
107111 @Callable(i)
108112 func checkoutTask (taskId,type) = {
109113 let callerPublicKey = toBase58String(i.callerPublicKey)
110114 let taskStillOpen = canBeCheckedOut(taskId)
111115 let timestamp = lastBlock.timestamp
112116 if (!(taskStillOpen))
113117 then throw("Task not open for checkout!")
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), BooleanEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId), true), DeleteEntry(((("open_" + type) + "_") + taskId))]
115- }
116-
117-
118-
119-@Callable(i)
120-func checkoutChatGPTTask (taskId) = {
121- let callerPublicKey = toBase58String(i.callerPublicKey)
122- let taskStillOpen = canBeCheckedOut(taskId)
123- let timestamp = lastBlock.timestamp
124- if (!(taskStillOpen))
125- then throw("Task not open for checkout!")
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))]
118+ 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))]
127119 }
128120
129121
130122
131123 @Callable(i)
132124 func commitTask (taskId,response) = {
133125 let callerPublicKey = toBase58String(i.callerPublicKey)
134126 let correctAgent = isCorrectAgent(taskId, callerPublicKey)
135127 let timestamp = lastBlock.timestamp
136128 let type = match getString((taskId + "_type")) {
137129 case s: String =>
138130 s
139131 case _ =>
140132 "not set"
141133 }
134+ let callback = match getString((taskId + "_callback")) {
135+ case s: String =>
136+ s
137+ case _ =>
138+ "no callback"
139+ }
140+ let caller = match getString((taskId + "_caller")) {
141+ case s: String =>
142+ s
143+ case _ =>
144+ "no callback"
145+ }
142146 if (!(correctAgent))
143147 then throw("Task may only be submitted by the agent who checked the task out!")
144148 else if ((type == "not set"))
145149 then throw("Can not identify type of task id")
146- else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp), DeleteEntry(((((("checked_out_by_" + callerPublicKey) + "_") + type) + "_") + taskId))]
147- }
148-
149-
150-
151-@Callable(i)
152-func commitChatGPTTask (taskId,response) = {
153- let callerPublicKey = toBase58String(i.callerPublicKey)
154- let correctAgent = isCorrectAgent(taskId, callerPublicKey)
155- let timestamp = lastBlock.timestamp
156- if (!(correctAgent))
157- then throw("Task may only be submitted by the agent who checked the task out!")
158- else [StringEntry((taskId + "_status"), STATUS_DONE), StringEntry((taskId + "_result"), response), IntegerEntry((taskId + COMMIT_HEIGHT), height), IntegerEntry((taskId + "_commit_timestamp"), timestamp)]
150+ else if ((callback != "no callback"))
151+ then {
152+ let result = invoke(Address(fromBase58String(caller)), callback, [response], nil)
153+[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+ 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))]
159156 }
160157
161158
162159
163160 @Callable(i)
164161 func buy () = {
165162 let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy")
166163 let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT"
167164 let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
168165 let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum"
169166 let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1"
170167 let numberOfPayments = size(i.payments)
171168 if ((numberOfPayments != 1))
172169 then throw("Payment necessary!")
173170 else {
174171 let payment = i.payments[0]
175172 let feeAssetId = payment.assetId
176173 let feeAssetIdString = match feeAssetId {
177174 case b: ByteVector =>
178175 toBase58String(b)
179176 case _ =>
180177 ""
181178 }
182179 let paymentAmount = payment.amount
183180 let amount = if (!(isDefined(feeAssetId)))
184181 then {
185182 let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) {
186183 case n: Int =>
187184 n
188185 case _ =>
189186 0
190187 }
191188 (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100)
192189 }
193190 else if ((feeAssetIdString == USDT_ASSET_ID))
194191 then (paymentAmount * 100)
195192 else if ((feeAssetIdString == USDC_ASSET_ID))
196193 then (paymentAmount * 100)
197194 else throw("payment necessary in Waves, USDC or USDT!")
198195 [ScriptTransfer(i.caller, amount, fromBase58String(BAI_ASSET_ID))]
199196 }
200197 }
201198
202199
203200 @Verifier(tx)
204201 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
205202

github/deemru/w8io/026f985 
52.53 ms