tx · DwHkFLxNsAVbSrHcoLTHD2XBxAJnuVUaeVi8iiL3kvA1

3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV:  -0.05000000 Waves

2024.10.28 10:17 [3346410] smart account 3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV > SELF 0.00000000 Waves

{ "type": 13, "id": "DwHkFLxNsAVbSrHcoLTHD2XBxAJnuVUaeVi8iiL3kvA1", "fee": 5000000, "feeAssetId": null, "timestamp": 1730099881834, "version": 2, "chainId": 84, "sender": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV", "senderPublicKey": "DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE", "proofs": [ "5skE7Fk9Pc1zjgK8XuEyVSYcrhmPTXZYTwN5vprVc2uoVH3j1zPaUqQG5cNPCooeeSCY6YjHiiFSijqQFEkUyg9r" ], "script": "base64:AAIFAAAAAAAAAA4IAhIECgIICBIECgIICAAAAAMAAAAAF0JBSV9DT05UUkFDVF9QVUJMSUNfS0VZAQAAACC4ub5WQ6dKmSY4XOD0ENHA5nSTpo3ZXmT/mOT2RZ2+BwAAAAAMQkFJX0NPTlRSQUNUCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAABdCQUlfQ09OVFJBQ1RfUFVCTElDX0tFWQAAAAAMQkFJX0FTU0VUX0lEAQAAACCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgAAAAIAAAABaQEAAAAQZ2V0QW5zd2VyRm9yQ2hhdAAAAAIAAAAGY2hhdElkAAAAA2NpZAQAAAAQbnVtYmVyT2ZQYXltZW50cwkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwMJAQAAAAIhPQAAAAIFAAAAEG51bWJlck9mUGF5bWVudHMAAAAAAAAAAAEJAAACAAAAAQIAAAASUGF5bWVudCBuZWNlc3NhcnkhBAAAAAdwYXltZW50CQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAA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UAAAAGY2hhdElkAgAAAApfaW5pdGlhdG9yAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXMFAAAAByRtYXRjaDAFAAAAAXMJAAACAAAAAQIAAAATTm8gaW5pdGlhdG9yIGZvdW5kIQQAAAAJdGltZXN0YW1wCQABpAAAAAEIBQAAAAlsYXN0QmxvY2sAAAAJdGltZXN0YW1wCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgUAAAAGY2hhdElkAgAAAAdfbGF0ZXN0BQAAAANjaWQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACBQAAAAZjaGF0SWQCAAAAB19zdGF0dXMCAAAABGRvbmUJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACCQABLAAAAAIFAAAACXB1YmxpY0tleQIAAAABXwUAAAAGY2hhdElkCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIFAAAAA2NpZAIAAAABXwUAAAAJdGltZXN0YW1wAgAAAAFfAgAAAARkb25lCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABmNhbGxlcgkAAlgAAAABCAUAAAABaQAAAA9jYWxsZXJQdWJsaWNLZXkFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5EZD+xA==", "height": 3346410, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3X47SC5puiDbDG9fY1MKzSrqJwhB5pd9h61SfSfxpsPK Next: 8FfhZKXNXG9SNHYDcsrANSKfKaSobwU281H5wQXSCBMo Full:
OldNewDifferences
1-{-# STDLIB_VERSION 6 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let a = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
4+let a = base58'DS6HkopS9zypvxX6VhkdNvv6v4wcPZuChRvTwKJeacxE'
55
6-let b = "open"
6+let b = addressFromPublicKey(a)
77
8-let c = "checked_out"
8+let c = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
99
10-let d = "done"
11-
12-let e = "_checked_out_by_"
13-
14-let f = "simple_ChatGPT_task"
15-
16-let g = "_check_out_height_"
17-
18-let h = "_register_height_"
19-
20-let i = "_commit_height_"
21-
22-func j (k,l) = {
23- let m = getString(this, ((k + "_status_") + l))
24- (m == b)
25- }
26-
27-
28-func n (k,o,l) = {
29- let p = getString(this, ((k + e) + l))
30- (p == o)
31- }
32-
33-
34-func q (l) = {
35- let r = getInteger(this, ("price_" + l))
36- if ($isInstanceOf(r, "Int"))
37- then {
38- let s = r
39- s
40- }
41- else -1
42- }
43-
44-
45-@Callable(s)
46-func registerTask (t,l) = {
47- let u = size(s.payments)
48- if ((u != 1))
10+@Callable(d)
11+func getAnswerForChat (e,f) = {
12+ let g = size(d.payments)
13+ if ((g != 1))
4914 then throw("Payment necessary!")
5015 else {
51- let v = toBase58String(s.callerPublicKey)
52- let w = toBase58String(s.transactionId)
53- let x = s.payments[0]
54- let y = x.amount
55- let z = x.assetId
56- let k = ((w + "_") + v)
57- let A = lastBlock.timestamp
58- let B = q(l)
59- let C = {
60- let r = getInteger(this, ("dao_user_" + v))
61- if ($isInstanceOf(r, "Int"))
16+ let h = d.payments[0]
17+ let i = h.amount
18+ let j = h.assetId
19+ let k = {
20+ let l = getInteger(b, "price_fullchatgpt")
21+ if ($isInstanceOf(l, "Int"))
6222 then {
63- let D = r
64- (D + y)
23+ let m = l
24+ m
6525 }
66- else y
26+ else 0
6727 }
68- let E = {
69- let r = getInteger(this, "dao_sum")
70- if ($isInstanceOf(r, "Int"))
71- then {
72- let D = r
73- (D + y)
74- }
75- else y
76- }
77- if ((z != a))
78- then throw("Payment only possible in the AI Token!")
79- else if ((B == -1))
80- then throw("Task type not supported!")
81- else if ((B > y))
82- then throw((("Payment needs to be at least " + toString(B)) + " BAI Token!"))
83- else [StringEntry(((k + "_description_") + l), t), StringEntry(((w + "_initializer_") + l), v), StringEntry(((k + "_status_") + l), b), StringEntry((k + "_type"), l), IntegerEntry(((k + h) + l), height), IntegerEntry(((k + "_register_timestamp_") + l), A), BooleanEntry(((("open_" + l) + "_") + k), true), IntegerEntry("dao_sum", E), IntegerEntry(("dao_user_" + v), C)]
28+ if (if ((j != c))
29+ then true
30+ else (k > i))
31+ then throw("Payment of the minimal BAI amount necessary!")
32+ else {
33+ let n = toBase58String(d.callerPublicKey)
34+ let o = toString(lastBlock.timestamp)
35+ let p = invoke(b, "registerTaskCallback", [f, "fullchatgpt", "callback"], [AttachedPayment(c, 10000000)])
36+ if ((p == p))
37+ then {
38+ let q = {
39+ let l = p
40+ if ($isInstanceOf(l, "String"))
41+ then {
42+ let r = l
43+ r
44+ }
45+ else throw("Unknown task id!")
46+ }
47+[StringEntry((e + "_latest"), f), StringEntry((e + "_status"), "waiting"), StringEntry(q, e), StringEntry(((n + "_") + e), ((((f + "_") + o) + "_") + "waiting")), StringEntry((e + "_initiator"), n)]
48+ }
49+ else throw("Strict value is not equal to itself.")
50+ }
8451 }
8552 }
8653
8754
8855
89-@Callable(s)
90-func registerTaskCallback (t,l,F) = {
91- let u = size(s.payments)
92- if ((u != 1))
93- then throw("Payment necessary!")
94- else {
95- let v = toBase58String(s.callerPublicKey)
96- let G = toString(s.caller)
97- let w = toBase58String(s.transactionId)
98- let x = s.payments[0]
99- let y = x.amount
100- let z = x.assetId
101- let k = ((w + "_") + v)
102- let A = lastBlock.timestamp
103- let B = q(l)
104- if ((z != a))
105- then throw("Payment only possible in the AI Token!")
106- else if ((B == -1))
107- then throw("Task type not supported!")
108- else if ((B > y))
109- then throw((("Payment needs to be at least " + toString(B)) + " BAI Token!"))
110- else $Tuple2([StringEntry(((k + "_description_") + l), t), StringEntry(((w + "_initializer_") + l), v), StringEntry(((k + "_callback_") + l), F), StringEntry(((k + "_caller_") + l), G), StringEntry(((k + "_status_") + l), b), StringEntry((k + "_type"), l), IntegerEntry(((k + h) + l), height), IntegerEntry(((k + "_register_timestamp_") + l), A), BooleanEntry(((("open_" + l) + "_") + k), true), StringEntry(((("callback_accounting_" + w) + "_") + toString(height)), k)], k)
56+@Callable(d)
57+func callback (q,f) = if ((d.callerPublicKey != a))
58+ then throw("Only BAI Contract is allowed to call the callback!")
59+ else {
60+ let e = {
61+ let l = getString(q)
62+ if ($isInstanceOf(l, "String"))
63+ then {
64+ let r = l
65+ r
66+ }
67+ else throw("Chat ID for task id not found!")
11168 }
112- }
69+ let n = {
70+ let l = getString((e + "_initiator"))
71+ if ($isInstanceOf(l, "String"))
72+ then {
73+ let r = l
74+ r
75+ }
76+ else throw("No initiator found!")
77+ }
78+ let o = toString(lastBlock.timestamp)
79+[StringEntry((e + "_latest"), f), StringEntry((e + "_status"), "done"), StringEntry(((n + "_") + e), ((((f + "_") + o) + "_") + "done")), StringEntry("caller", toBase58String(d.callerPublicKey))]
80+ }
11381
11482
115-
116-@Callable(s)
117-func checkoutTask (k,l) = {
118- let v = toBase58String(s.callerPublicKey)
119- let H = j(k, l)
120- let A = lastBlock.timestamp
121- if (!(H))
122- then throw("Task not open for checkout!")
123- else [StringEntry(((k + e) + l), v), StringEntry(((k + "_status_") + l), c), IntegerEntry(((k + g) + l), height), IntegerEntry(((k + "_check_out_timestamp_") + l), A), BooleanEntry(((((("checked_out_by_" + v) + "_") + l) + "_") + k), true), DeleteEntry(((("open_" + l) + "_") + k))]
124- }
125-
126-
127-
128-@Callable(s)
129-func commitTask (k,I) = {
130- let v = toBase58String(s.callerPublicKey)
131- let l = {
132- let r = getString((k + "_type"))
133- if ($isInstanceOf(r, "String"))
134- then {
135- let J = r
136- J
137- }
138- else "not set"
139- }
140- let K = n(k, v, l)
141- let A = lastBlock.timestamp
142- let F = {
143- let r = getString(((k + "_callback_") + l))
144- if ($isInstanceOf(r, "String"))
145- then {
146- let J = r
147- J
148- }
149- else "no callback"
150- }
151- let G = {
152- let r = getString(((k + "_caller_") + l))
153- if ($isInstanceOf(r, "String"))
154- then {
155- let J = r
156- J
157- }
158- else "no callback"
159- }
160- if (!(K))
161- then throw("Task may only be submitted by the agent who checked the task out!")
162- else if ((l == "not set"))
163- then throw("Can not identify type of task id")
164- else if ((F != "no callback"))
165- then {
166- let L = invoke(Address(fromBase58String(G)), F, [k, I], nil)
167- if ((L == L))
168- then [StringEntry(((k + "_status_") + l), d), StringEntry(((k + "_result_") + l), I), IntegerEntry(((k + i) + l), height), IntegerEntry(((k + "_commit_timestamp_") + l), A), DeleteEntry(((((("checked_out_by_" + v) + "_") + l) + "_") + k))]
169- else throw("Strict value is not equal to itself.")
170- }
171- else [StringEntry(((k + "_status_") + l), d), StringEntry(((k + "_result_") + l), I), IntegerEntry(((k + i) + l), height), IntegerEntry(((k + "_commit_timestamp_") + l), A), DeleteEntry(((((("checked_out_by_" + v) + "_") + l) + "_") + k))]
172- }
173-
174-
175-@Verifier(M)
176-func N () = sigVerify(M.bodyBytes, M.proofs[0], M.senderPublicKey)
83+@Verifier(s)
84+func t () = sigVerify(s.bodyBytes, s.proofs[0], s.senderPublicKey)
17785

github/deemru/w8io/169f3d6 
27.22 ms