tx · 12vSW3GQ95NrhnTVMPNneumJVD8ko3qnoDzfKf2AjyQT

3MxW2aG6PcdZeNjj1DuzGSbmWoy2BDvmtSD:  -0.01000000 Waves

2024.10.28 11:10 [3346465] smart account 3MxW2aG6PcdZeNjj1DuzGSbmWoy2BDvmtSD > SELF 0.00000000 Waves

{ "type": 13, "id": "12vSW3GQ95NrhnTVMPNneumJVD8ko3qnoDzfKf2AjyQT", "fee": 1000000, "feeAssetId": null, "timestamp": 1730103073446, "version": 2, "chainId": 84, "sender": "3MxW2aG6PcdZeNjj1DuzGSbmWoy2BDvmtSD", "senderPublicKey": "HtED8Ks6yPKYzEnXYAoLvskVyZuFW3YcZH8JF5NWbMvb", "proofs": [ "5PsACz7VhuZD3qQ68uzxYi8FaadxDkhGid46eAU91xbUD8AQZ2L8jGAyCTspSDrQxevcHrAQGRRrrxistLXF1FF4" ], "script": "base64:AAIFAAAAAAAAAA8IAhIFCgMICAgSBAoCCAgAAAADAAAAABdCQUlfQ09OVFJBQ1RfUFVCTElDX0tFWQEAAAAguLm+VkOnSpkmOFzg9BDRwOZ0k6aN2V5k/5jk9kWdvgcAAAAADEJBSV9DT05UUkFDVAkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQUAAAAXQkFJX0NPTlRSQUNUX1BVQkxJQ19LRVkAAAAADEJBSV9BU1NFVF9JRAEAAAAgk+FyOHEEm2rommMfBCS3ZFOXLD68ZguDdK9ouySN4kIAAAACAAAAAWkBAAAAEGdldEFuc3dlckZvckNoYXQAAAADAAAABmNoYXRJZAAAAANjaWQAAAAIdGFza1R5cGUEAAAAEG51bWJlck9mUGF5bWVudHMJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMDCQEAAAACIT0AAAACBQAAABBudW1iZXJPZlBheW1lbnRzAAAAAAAAAAABCQAAAgAAAAECAAAAElBheW1lbnQgbmVjZXNzYXJ5IQQAAAAHcGF5bWVudAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAA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AAAQIAAAAeQ2hhdCBJRCBmb3IgdGFzayBpZCBub3QgZm91bmQhBAAAAAlwdWJsaWNLZXkEAAAAByRtYXRjaDAJAAQiAAAAAQkAASwAAAACBQAAAAZjaGF0SWQCAAAACl9pbml0aWF0b3IDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwkAAAIAAAABAgAAABNObyBpbml0aWF0b3IgZm91bmQhBAAAAAl0aW1lc3RhbXAJAAGkAAAAAQgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACBQAAAAZjaGF0SWQCAAAAB19sYXRlc3QFAAAAA2NpZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIFAAAABmNoYXRJZAIAAAAHX3N0YXR1cwIAAAAEZG9uZQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAJcHVibGljS2V5AgAAAAFfBQAAAAZjaGF0SWQJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAADY2lkAgAAAAFfBQAAAAl0aW1lc3RhbXACAAAAAV8CAAAABGRvbmUFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5wSIc4g==", "height": 3346465, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GwPpaB56o31qAtvauwC18Y5TdWZ4zNtfXS4w8YpFZrQY Next: none Diff:
OldNewDifferences
88 let BAI_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
99
1010 @Callable(i)
11-func getAnswerForChat (chatId,cid) = {
11+func getAnswerForChat (chatId,cid,taskType) = {
1212 let numberOfPayments = size(i.payments)
1313 if ((numberOfPayments != 1))
1414 then throw("Payment necessary!")
1616 let payment = i.payments[0]
1717 let fee = payment.amount
1818 let feeAssetId = payment.assetId
19- let minFee = match getInteger(BAI_CONTRACT, "price_fullchatgpt") {
19+ let minFee = match getInteger(BAI_CONTRACT, ("price_" + taskType)) {
2020 case n: Int =>
2121 n
2222 case _ =>
2929 else {
3030 let publicKey = toBase58String(i.callerPublicKey)
3131 let timestamp = toString(lastBlock.timestamp)
32- let result = invoke(BAI_CONTRACT, "registerTaskCallback", [cid, "fullchatgpt", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)])
32+ let result = invoke(BAI_CONTRACT, "registerTaskCallback", [cid, taskType, "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)])
3333 if ((result == result))
3434 then {
3535 let taskId = match result {
3838 case _ =>
3939 throw("Unknown task id!")
4040 }
41-[StringEntry((chatId + "_latest"), cid), StringEntry((chatId + "_status"), "waiting"), StringEntry(taskId, chatId), StringEntry(((publicKey + "_") + chatId), ((((cid + "_") + timestamp) + "_") + "waiting")), StringEntry((chatId + "_initiator"), publicKey)]
41+[StringEntry((chatId + "_latest"), cid), StringEntry((chatId + "_tasktype"), taskType), StringEntry((chatId + "_status"), "waiting"), StringEntry((chatId + "_initiator"), publicKey), StringEntry(taskId, chatId), StringEntry(((publicKey + "_") + chatId), ((((cid + "_") + timestamp) + "_") + "waiting"))]
4242 }
4343 else throw("Strict value is not equal to itself.")
4444 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BAI_CONTRACT_PUBLIC_KEY = base58'DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE'
55
66 let BAI_CONTRACT = addressFromPublicKey(BAI_CONTRACT_PUBLIC_KEY)
77
88 let BAI_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
99
1010 @Callable(i)
11-func getAnswerForChat (chatId,cid) = {
11+func getAnswerForChat (chatId,cid,taskType) = {
1212 let numberOfPayments = size(i.payments)
1313 if ((numberOfPayments != 1))
1414 then throw("Payment necessary!")
1515 else {
1616 let payment = i.payments[0]
1717 let fee = payment.amount
1818 let feeAssetId = payment.assetId
19- let minFee = match getInteger(BAI_CONTRACT, "price_fullchatgpt") {
19+ let minFee = match getInteger(BAI_CONTRACT, ("price_" + taskType)) {
2020 case n: Int =>
2121 n
2222 case _ =>
2323 0
2424 }
2525 if (if ((feeAssetId != BAI_ASSET_ID))
2626 then true
2727 else (minFee > fee))
2828 then throw("Payment of the minimal BAI amount necessary!")
2929 else {
3030 let publicKey = toBase58String(i.callerPublicKey)
3131 let timestamp = toString(lastBlock.timestamp)
32- let result = invoke(BAI_CONTRACT, "registerTaskCallback", [cid, "fullchatgpt", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)])
32+ let result = invoke(BAI_CONTRACT, "registerTaskCallback", [cid, taskType, "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)])
3333 if ((result == result))
3434 then {
3535 let taskId = match result {
3636 case s: String =>
3737 s
3838 case _ =>
3939 throw("Unknown task id!")
4040 }
41-[StringEntry((chatId + "_latest"), cid), StringEntry((chatId + "_status"), "waiting"), StringEntry(taskId, chatId), StringEntry(((publicKey + "_") + chatId), ((((cid + "_") + timestamp) + "_") + "waiting")), StringEntry((chatId + "_initiator"), publicKey)]
41+[StringEntry((chatId + "_latest"), cid), StringEntry((chatId + "_tasktype"), taskType), StringEntry((chatId + "_status"), "waiting"), StringEntry((chatId + "_initiator"), publicKey), StringEntry(taskId, chatId), StringEntry(((publicKey + "_") + chatId), ((((cid + "_") + timestamp) + "_") + "waiting"))]
4242 }
4343 else throw("Strict value is not equal to itself.")
4444 }
4545 }
4646 }
4747
4848
4949
5050 @Callable(i)
5151 func callback (taskId,cid) = if ((i.callerPublicKey != BAI_CONTRACT_PUBLIC_KEY))
5252 then throw("Only BAI Contract is allowed to call the callback!")
5353 else {
5454 let chatId = match getString(taskId) {
5555 case s: String =>
5656 s
5757 case _ =>
5858 throw("Chat ID for task id not found!")
5959 }
6060 let publicKey = match getString((chatId + "_initiator")) {
6161 case s: String =>
6262 s
6363 case _ =>
6464 throw("No initiator found!")
6565 }
6666 let timestamp = toString(lastBlock.timestamp)
6767 [StringEntry((chatId + "_latest"), cid), StringEntry((chatId + "_status"), "done"), StringEntry(((publicKey + "_") + chatId), ((((cid + "_") + timestamp) + "_") + "done"))]
6868 }
6969
7070
7171 @Verifier(tx)
7272 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
7373

github/deemru/w8io/fabc49c 
17.74 ms