tx · 8FfhZKXNXG9SNHYDcsrANSKfKaSobwU281H5wQXSCBMo 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV: -0.05000000 Waves 2024.10.28 10:19 [3346412] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves
{ "type": 13, "id": "8FfhZKXNXG9SNHYDcsrANSKfKaSobwU281H5wQXSCBMo", "fee": 5000000, "feeAssetId": null, "timestamp": 1730099969850, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "xu3bE2WqLv157CaCJmXx9WVerfSCkWyz5msS4qAWFPsSS1ueuhy93svXwFTX1wy879WtejAZKJN1jdUSei7jf2X" ], "script": "base64:AAIFAAAAAAAAAA4IAhIECgIICBIECgIICAAAAAMAAAAAF0JBSV9DT05UUkFDVF9QVUJMSUNfS0VZAQAAACC4ub5WQ6dKmSY4XOD0ENHA5nSTpo3ZXmT/mOT2RZ2+BwAAAAAMQkFJX0NPTlRSQUNUAgAAACMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgAAAAAMQkFJX0FTU0VUX0lEAQAAACCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgAAAAIAAAABaQEAAAAQZ2V0QW5zd2VyRm9yQ2hhdAAAAAIAAAAGY2hhdElkAAAAA2NpZAQAAAAQbnVtYmVyT2ZQYXltZW50cwkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwMJAQAAAAIhPQAAAAIFAAAAEG51bWJlck9mUGF5bWVudHMAAAAAAAAAAAEJAAACAAAAAQIAAAASUGF5bWVudCBuZWNlc3NhcnkhBAAAAAdwYXltZW50CQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAANmZWUIBQAAAAdwYXltZW50AAAABmFtb3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AAAByRtYXRjaDAJAAQiAAAAAQkAASwAAAACBQAAAAZjaGF0SWQCAAAACl9pbml0aWF0b3IDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwkAAAIAAAABAgAAABNObyBpbml0aWF0b3IgZm91bmQhBAAAAAl0aW1lc3RhbXAJAAGkAAAAAQgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACBQAAAAZjaGF0SWQCAAAAB19sYXRlc3QFAAAAA2NpZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIFAAAABmNoYXRJZAIAAAAHX3N0YXR1cwIAAAAEZG9uZQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAJcHVibGljS2V5AgAAAAFfBQAAAAZjaGF0SWQJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAADY2lkAgAAAAFfBQAAAAl0aW1lc3RhbXACAAAAAV8CAAAABGRvbmUJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAGY2FsbGVyCQACWAAAAAEIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlly9qa", "height": 3346412, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DwHkFLxNsAVbSrHcoLTHD2XBxAJnuVUaeVi8iiL3kvA1 Next: GZtrLmwpweSUDTLzjPPuKXa8M8dQXoQUWpcnJChWEkaF Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BAI_CONTRACT_PUBLIC_KEY = base58'DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE' | |
5 | 5 | ||
6 | - | let BAI_CONTRACT = | |
6 | + | let BAI_CONTRACT = "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV" | |
7 | 7 | ||
8 | 8 | let BAI_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
9 | 9 | ||
16 | 16 | let payment = i.payments[0] | |
17 | 17 | let fee = payment.amount | |
18 | 18 | let feeAssetId = payment.assetId | |
19 | - | let minFee = match getInteger(BAI_CONTRACT, "price_fullchatgpt") { | |
19 | + | let minFee = match getInteger(Address(fromBase58String(BAI_CONTRACT)), "price_fullchatgpt") { | |
20 | 20 | case n: Int => | |
21 | 21 | n | |
22 | 22 | case _ => | |
29 | 29 | else { | |
30 | 30 | let publicKey = toBase58String(i.callerPublicKey) | |
31 | 31 | let timestamp = toString(lastBlock.timestamp) | |
32 | - | let result = invoke(BAI_CONTRACT, "registerTaskCallback", [cid, "fullchatgpt", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)]) | |
32 | + | let result = invoke(Address(fromBase58String(BAI_CONTRACT)), "registerTaskCallback", [cid, "fullchatgpt", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)]) | |
33 | 33 | if ((result == result)) | |
34 | 34 | then { | |
35 | 35 | let taskId = match result { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BAI_CONTRACT_PUBLIC_KEY = base58'DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE' | |
5 | 5 | ||
6 | - | let BAI_CONTRACT = | |
6 | + | let BAI_CONTRACT = "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV" | |
7 | 7 | ||
8 | 8 | let BAI_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
9 | 9 | ||
10 | 10 | @Callable(i) | |
11 | 11 | func getAnswerForChat (chatId,cid) = { | |
12 | 12 | let numberOfPayments = size(i.payments) | |
13 | 13 | if ((numberOfPayments != 1)) | |
14 | 14 | then throw("Payment necessary!") | |
15 | 15 | else { | |
16 | 16 | let payment = i.payments[0] | |
17 | 17 | let fee = payment.amount | |
18 | 18 | let feeAssetId = payment.assetId | |
19 | - | let minFee = match getInteger(BAI_CONTRACT, "price_fullchatgpt") { | |
19 | + | let minFee = match getInteger(Address(fromBase58String(BAI_CONTRACT)), "price_fullchatgpt") { | |
20 | 20 | case n: Int => | |
21 | 21 | n | |
22 | 22 | case _ => | |
23 | 23 | 0 | |
24 | 24 | } | |
25 | 25 | if (if ((feeAssetId != BAI_ASSET_ID)) | |
26 | 26 | then true | |
27 | 27 | else (minFee > fee)) | |
28 | 28 | then throw("Payment of the minimal BAI amount necessary!") | |
29 | 29 | else { | |
30 | 30 | let publicKey = toBase58String(i.callerPublicKey) | |
31 | 31 | let timestamp = toString(lastBlock.timestamp) | |
32 | - | let result = invoke(BAI_CONTRACT, "registerTaskCallback", [cid, "fullchatgpt", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)]) | |
32 | + | let result = invoke(Address(fromBase58String(BAI_CONTRACT)), "registerTaskCallback", [cid, "fullchatgpt", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)]) | |
33 | 33 | if ((result == result)) | |
34 | 34 | then { | |
35 | 35 | let taskId = match result { | |
36 | 36 | case s: String => | |
37 | 37 | s | |
38 | 38 | case _ => | |
39 | 39 | throw("Unknown task id!") | |
40 | 40 | } | |
41 | 41 | [StringEntry((chatId + "_latest"), cid), StringEntry((chatId + "_status"), "waiting"), StringEntry(taskId, chatId), StringEntry(((publicKey + "_") + chatId), ((((cid + "_") + timestamp) + "_") + "waiting")), StringEntry((chatId + "_initiator"), publicKey)] | |
42 | 42 | } | |
43 | 43 | else throw("Strict value is not equal to itself.") | |
44 | 44 | } | |
45 | 45 | } | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | ||
50 | 50 | @Callable(i) | |
51 | 51 | func callback (taskId,cid) = if ((i.callerPublicKey != BAI_CONTRACT_PUBLIC_KEY)) | |
52 | 52 | then throw("Only BAI Contract is allowed to call the callback!") | |
53 | 53 | else { | |
54 | 54 | let chatId = match getString(taskId) { | |
55 | 55 | case s: String => | |
56 | 56 | s | |
57 | 57 | case _ => | |
58 | 58 | throw("Chat ID for task id not found!") | |
59 | 59 | } | |
60 | 60 | let publicKey = match getString((chatId + "_initiator")) { | |
61 | 61 | case s: String => | |
62 | 62 | s | |
63 | 63 | case _ => | |
64 | 64 | throw("No initiator found!") | |
65 | 65 | } | |
66 | 66 | let timestamp = toString(lastBlock.timestamp) | |
67 | 67 | [StringEntry((chatId + "_latest"), cid), StringEntry((chatId + "_status"), "done"), StringEntry(((publicKey + "_") + chatId), ((((cid + "_") + timestamp) + "_") + "done")), StringEntry("caller", toBase58String(i.callerPublicKey))] | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | @Verifier(tx) | |
72 | 72 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
73 | 73 |
github/deemru/w8io/169f3d6 25.60 ms ◑