tx · HQYxvWHFN8dWKbfKFdtWqw4r4ft4omRf1XETnuiKe16n

3NBsiM9nhCb44CYKhUKSkkCivsCssHjyNiF:  -0.01000000 Waves

2023.11.27 18:33 [2861995] smart account 3NBsiM9nhCb44CYKhUKSkkCivsCssHjyNiF > SELF 0.00000000 Waves

{ "type": 13, "id": "HQYxvWHFN8dWKbfKFdtWqw4r4ft4omRf1XETnuiKe16n", "fee": 1000000, "feeAssetId": null, "timestamp": 1701099286312, "version": 2, "chainId": 84, "sender": "3NBsiM9nhCb44CYKhUKSkkCivsCssHjyNiF", "senderPublicKey": "3hCTei4Guj2wEDRRRG1C1E6uactPJ7kvGnnURgGt9WjF", "proofs": [ "5vWu19NmSbr5w2Mwzs2dNsKov1hSQteLymSDzCZQ6daz6661VXpzYbnf8ZJ4HWcSp245kSCBV6NbYeccmPFWUAup" ], "script": "base64:BgIHCAISAwoBCAABAWkBFWV2YWx1YXRlZERhdGFDYWxsYmFjawEIcmVzcG9uc2UFA25pbABae//m", "height": 2861995, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D3jKKhTGkW3ujjcZCwz7SforZNQZWhCur1Ei7Z4N9YZf Next: 6Qg6nPbKKK1u6NWYNvaxWV4ctkGWpN2yDKz3gSijv4Sn Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let BAI_ADDRESS = "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV"
5-
6-let TYPE = "crashEvaluation"
7-
8-let BAI_FEE = 10000000
9-
10-let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
11-
12-func removeMarks (marksString) = {
13- let a = drop(marksString, 1)
14- let b = dropRight(a, 1)
15- b
16- }
17-
18-
19-func parseJson (json) = {
20- let modifiedJson = drop(json, 1)
21- let modifiedJson2 = dropRight(modifiedJson, 1)
22- let split1 = split(modifiedJson2, ",")
23- let keyValue1 = split(split1[0], ":")
24- let key1 = removeMarks(keyValue1[0])
25- let value1 = removeMarks(keyValue1[1])
26- let keyValue2 = split(split1[1], ":")
27- let key2 = removeMarks(keyValue2[0])
28- let value2 = removeMarks(keyValue2[1])
29- let keyValue3 = split(split1[2], ":")
30- let key3 = removeMarks(keyValue3[0])
31- let value3 = removeMarks(keyValue3[1])
32- $Tuple3([key1, value1], [key2, value2], [key3, value3])
33- }
344
355
366 @Callable(i)
37-func registerData (clientInput,opponentInput,id,oppAddress,lgtCond) = {
38- let searchForExistingData = match getString(id) {
39- case s: String =>
40- s
41- case _ =>
42- "no Data exists"
43- }
44- if ((searchForExistingData != "no Data exists"))
45- then throw("There is already existing Data for this case!")
46- else {
47- let parameters = [id, TYPE, "evaluatedDataCallback"]
48- let client = toString(i.caller)
49- let txId = toBase58String(i.transactionId)
50- let invokeTask = invoke(Address(fromBase58String(BAI_ADDRESS)), "registerTaskCallback", parameters, [AttachedPayment(AI_TOKEN_ASSET_ID, BAI_FEE)])
51-[StringEntry(id, txId), IntegerEntry((((id + "_") + client) + "_age"), clientInput[0]), IntegerEntry((((id + "_") + client) + "_sex"), clientInput[1]), IntegerEntry((((id + "_") + client) + "_damage"), clientInput[2]), IntegerEntry((((id + "_") + client) + "_fac1"), clientInput[3]), IntegerEntry((((id + "_") + client) + "_fac2"), clientInput[4]), IntegerEntry((((id + "_") + client) + "_fac3"), clientInput[5]), IntegerEntry((((id + "_") + client) + "_fac4"), clientInput[6]), IntegerEntry((((id + "_") + client) + "_vio1"), clientInput[7]), IntegerEntry((((id + "_") + client) + "_vio2"), clientInput[8]), IntegerEntry((((id + "_") + client) + "_vio3"), clientInput[9]), IntegerEntry((((id + "_") + client) + "_vio4"), clientInput[10]), IntegerEntry((((id + "_") + client) + "_cost"), clientInput[11]), IntegerEntry((((id + "_") + oppAddress) + "_age"), opponentInput[0]), IntegerEntry((((id + "_") + oppAddress) + "_sex"), opponentInput[1]), IntegerEntry((((id + "_") + oppAddress) + "_damage"), opponentInput[2]), IntegerEntry((((id + "_") + oppAddress) + "_fac1"), opponentInput[3]), IntegerEntry((((id + "_") + oppAddress) + "_fac2"), opponentInput[4]), IntegerEntry((((id + "_") + oppAddress) + "_fac3"), opponentInput[5]), IntegerEntry((((id + "_") + oppAddress) + "_fac4"), opponentInput[6]), IntegerEntry((((id + "_") + oppAddress) + "_vio1"), opponentInput[7]), IntegerEntry((((id + "_") + oppAddress) + "_vio2"), opponentInput[8]), IntegerEntry((((id + "_") + oppAddress) + "_vio3"), opponentInput[9]), IntegerEntry((((id + "_") + oppAddress) + "_vio4"), opponentInput[10]), IntegerEntry((((id + "_") + oppAddress) + "_cost"), opponentInput[11]), IntegerEntry((id + "_lgt"), lgtCond), StringEntry((id + "_status"), "open"), StringEntry((id + "_sender"), client)]
52- }
53- }
7+func evaluatedDataCallback (response) = nil
548
55-
56-
57-@Callable(i)
58-func evaluatedDataCallback (response) = {
59- let txId = toBase58String(i.transactionId)
60- let parsedJson = parseJson(response)
61- let crashId = parsedJson._1[1]
62- let innocentAddress = parsedJson._2[1]
63- let guiltyAddress = parsedJson._3[1]
64- let RegisterTxId = match getString(crashId) {
65- case s: String =>
66- s
67- case _ =>
68- "no Data exists"
69- }
70- if ((RegisterTxId == "no Data exists"))
71- then throw("There is no Data for this crashId!")
72- else {
73- let status = match getString((crashId + "_status")) {
74- case s: String =>
75- s
76- case _ =>
77- "no Data exists"
78- }
79- if ((status == "no Data exists"))
80- then throw("There is no status for this case!")
81- else if ((status == "closed"))
82- then throw("A case should not be evaluated twice!")
83- else {
84- let costEstimationOfInnocentPerson = match getInteger((((RegisterTxId + "_") + innocentAddress) + "_cost")) {
85- case s: Int =>
86- s
87- case _ =>
88- "No data Found"
89- }
90- if ((costEstimationOfInnocentPerson == "No data Found"))
91- then throw("There is no data for this address!")
92- else if ((costEstimationOfInnocentPerson == -1))
93- then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")]
94- else [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(innocentAddress)), 100000000, unit)]
95- }
96- }
97- }
98-
99-
100-
101-@Callable(i)
102-func evaluatedData (prediction_id,per_one_address,per_two_address,guilty_person_address) = {
103- let txId = toBase58String(i.transactionId)
104-[StringEntry(prediction_id, txId), StringEntry((txId + "_guilty"), guilty_person_address)]
105- }
106-
107-
108-
109-@Callable(i)
110-func requestPayout (pred_txId,amount,id) = {
111- let client = toString(i.caller)
112- let txId = toBase58String(i.transactionId)
113-[StringEntry((id + "_request_payout"), txId), IntegerEntry((txId + "_amount"), amount), StringEntry((txId + "_prediction_id"), pred_txId)]
114- }
115-
116-
117-@Verifier(tx)
118-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
1199

github/deemru/w8io/873ac7e 
38.11 ms