tx · FNSH3SSR3B61ky3nG5kXf7G2o3Nu5oArN1SekwVTRZr8 3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3: -0.01000000 Waves 2023.11.26 18:35 [2860556] smart account 3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3 > SELF 0.00000000 Waves
{ "type": 13, "id": "FNSH3SSR3B61ky3nG5kXf7G2o3Nu5oArN1SekwVTRZr8", "fee": 1000000, "feeAssetId": null, "timestamp": 1701012943909, "version": 2, "chainId": 84, "sender": "3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3", "senderPublicKey": "5TXMdPyvDNfxhdixe86fk7Ya8FScpZGfZ6XNawu8sYK4", "proofs": [ "29PsYvsAsMCqD6cLteWyrEcqhJfg3sce9ydfgAxh59D2PVeM1vF4nPgsiQbCnF15ysVTzdEzuAjqwNyBSsWtWWcq" ], "script": "base64:BgIfCAISBwoFEREICAESAwoBCBIGCgQICAgIEgUKAwgBCAQAC0JBSV9BRERSRVNTAiMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgARQUlfVE9LRU5fQVNTRVRfSUQBIJPhcjhxBJtq6JpjHwQkt2RTlyw+vGYLg3SvaLskjeJCAQtyZW1vdmVNYXJrcwELbWFya3NTdHJpbmcEAWEJALACAgULbWFya3NTdHJpbmcAAQQBYgkAswICBQFhAAEFAWIBCXBhcnNlSnNvbgEEanNvbgQMbW9kaWZpZWRKc29uCQCwAgIFBGpzb24AAQQNbW9kaWZpZWRKc29uMgkAswICBQxtb2RpZmllZEpzb24AAQQGc3BsaXQxCQC1CQIFDW1vZGlmaWVkSnNvbjICASwECWtleVZhbHVlMQkAtQkCCQCRAwIFBnNwbGl0MQAAAgE6BARrZXkxCQELcmVtb3ZlTWFya3MBCQCRAwIFCWtleVZhbHVlMQAABAZ2YWx1ZTEJAQtyZW1vdmVNYXJrcwEJAJEDAgUJa2V5VmFsdWUxAAEECWtleVZhbHVlMgkAtQkCCQCRAwIFBnNw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Wx0eV9hZGRyZXNzBQ1ndWlsdHlBZGRyZXNzCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUHY3Jhc2hJZAIHX3N0YXR1cwIGY2xvc2VkCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMJAQdBZGRyZXNzAQkA2QQBBQ9pbm5vY2VudEFkZHJlc3MAgMLXLwUEdW5pdAUDbmlsAWkBDWV2YWx1YXRlZERhdGEEDXByZWRpY3Rpb25faWQPcGVyX29uZV9hZGRyZXNzD3Blcl90d29fYWRkcmVzcxVndWlsdHlfcGVyc29uX2FkZHJlc3MEBHR4SWQJANgEAQgFAWkNdHJhbnNhY3Rpb25JZAkAzAgCCQELU3RyaW5nRW50cnkCBQ1wcmVkaWN0aW9uX2lkBQR0eElkCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUEdHhJZAIHX2d1aWx0eQUVZ3VpbHR5X3BlcnNvbl9hZGRyZXNzBQNuaWwBaQENcmVxdWVzdFBheW91dAMJcHJlZF90eElkBmFtb3VudAJpZAQGY2xpZW50CQClCAEIBQFpBmNhbGxlcgQEdHhJZAkA2AQBCAUBaQ10cmFuc2FjdGlvbklkCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUCaWQCD19yZXF1ZXN0X3BheW91dAUEdHhJZAkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQR0eElkAgdfYW1vdW50BQZhbW91bnQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQR0eElkAg5fcHJlZGljdGlvbl9pZAUJcHJlZF90eElkBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V59O/fZw==", "height": 2860556, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BkVWUdsQ7JYxnNSBQC4rv1kZgMWPBgGeXmi2d41GYYvo Next: 6YCKoRKpJ435sKBbp4K6CfC6Gtb83Y5aKC8wxd21L8pj Diff:
Old | New | Differences | |
---|---|---|---|
64 | 64 | if ((RegisterTxId == "no Data exists")) | |
65 | 65 | then throw("There is no Data for this crashId!") | |
66 | 66 | else { | |
67 | - | let | |
68 | - | case s: | |
67 | + | let status = match getString((crashId + "_status")) { | |
68 | + | case s: String => | |
69 | 69 | s | |
70 | 70 | case _ => | |
71 | - | " | |
71 | + | "no Data exists" | |
72 | 72 | } | |
73 | - | if ((costEstimationOfInnocentPerson == "No data Found")) | |
74 | - | then throw("There is no data for this address!") | |
75 | - | else if ((costEstimationOfInnocentPerson == -1)) | |
76 | - | then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")] | |
77 | - | 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)] | |
73 | + | if ((status == "no Data exists")) | |
74 | + | then throw("There is no status for this case!") | |
75 | + | else if ((status == "closed")) | |
76 | + | then throw("A case should not be evaluated twice!") | |
77 | + | else { | |
78 | + | let costEstimationOfInnocentPerson = match getInteger((((RegisterTxId + "_") + innocentAddress) + "_cost")) { | |
79 | + | case s: Int => | |
80 | + | s | |
81 | + | case _ => | |
82 | + | "No data Found" | |
83 | + | } | |
84 | + | if ((costEstimationOfInnocentPerson == "No data Found")) | |
85 | + | then throw("There is no data for this address!") | |
86 | + | else if ((costEstimationOfInnocentPerson == -1)) | |
87 | + | then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")] | |
88 | + | 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)] | |
89 | + | } | |
78 | 90 | } | |
79 | 91 | } | |
80 | 92 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BAI_ADDRESS = "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV" | |
5 | 5 | ||
6 | 6 | let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
7 | 7 | ||
8 | 8 | func removeMarks (marksString) = { | |
9 | 9 | let a = drop(marksString, 1) | |
10 | 10 | let b = dropRight(a, 1) | |
11 | 11 | b | |
12 | 12 | } | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func parseJson (json) = { | |
16 | 16 | let modifiedJson = drop(json, 1) | |
17 | 17 | let modifiedJson2 = dropRight(modifiedJson, 1) | |
18 | 18 | let split1 = split(modifiedJson2, ",") | |
19 | 19 | let keyValue1 = split(split1[0], ":") | |
20 | 20 | let key1 = removeMarks(keyValue1[0]) | |
21 | 21 | let value1 = removeMarks(keyValue1[1]) | |
22 | 22 | let keyValue2 = split(split1[1], ":") | |
23 | 23 | let key2 = removeMarks(keyValue2[0]) | |
24 | 24 | let value2 = removeMarks(keyValue2[1]) | |
25 | 25 | let keyValue3 = split(split1[2], ":") | |
26 | 26 | let key3 = removeMarks(keyValue3[0]) | |
27 | 27 | let value3 = removeMarks(keyValue3[1]) | |
28 | 28 | $Tuple3([key1, value1], [key2, value2], [key3, value3]) | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | @Callable(i) | |
33 | 33 | func registerData (clientInput,opponentInput,id,oppAddress,lgtCond) = { | |
34 | 34 | let searchForExistingData = match getString(id) { | |
35 | 35 | case s: String => | |
36 | 36 | s | |
37 | 37 | case _ => | |
38 | 38 | "no Data exists" | |
39 | 39 | } | |
40 | 40 | if ((searchForExistingData != "no Data exists")) | |
41 | 41 | then throw("There is already existing Data for this case!") | |
42 | 42 | else { | |
43 | 43 | let client = toString(i.caller) | |
44 | 44 | let txId = toBase58String(i.transactionId) | |
45 | 45 | [StringEntry(id, txId), IntegerEntry((((txId + "_") + client) + "_age"), clientInput[0]), IntegerEntry((((txId + "_") + client) + "_sex"), clientInput[1]), IntegerEntry((((txId + "_") + client) + "_damage"), clientInput[2]), IntegerEntry((((txId + "_") + client) + "_fac1"), clientInput[3]), IntegerEntry((((txId + "_") + client) + "_fac2"), clientInput[4]), IntegerEntry((((txId + "_") + client) + "_fac3"), clientInput[5]), IntegerEntry((((txId + "_") + client) + "_fac4"), clientInput[6]), IntegerEntry((((txId + "_") + client) + "_vio1"), clientInput[7]), IntegerEntry((((txId + "_") + client) + "_vio2"), clientInput[8]), IntegerEntry((((txId + "_") + client) + "_vio3"), clientInput[9]), IntegerEntry((((txId + "_") + client) + "_vio4"), clientInput[10]), IntegerEntry((((txId + "_") + client) + "_cost"), clientInput[11]), IntegerEntry((((txId + "_") + oppAddress) + "_age"), opponentInput[0]), IntegerEntry((((txId + "_") + oppAddress) + "_sex"), opponentInput[1]), IntegerEntry((((txId + "_") + oppAddress) + "_damage"), opponentInput[2]), IntegerEntry((((txId + "_") + oppAddress) + "_fac1"), opponentInput[3]), IntegerEntry((((txId + "_") + oppAddress) + "_fac2"), opponentInput[4]), IntegerEntry((((txId + "_") + oppAddress) + "_fac3"), opponentInput[5]), IntegerEntry((((txId + "_") + oppAddress) + "_fac4"), opponentInput[6]), IntegerEntry((((txId + "_") + oppAddress) + "_vio1"), opponentInput[7]), IntegerEntry((((txId + "_") + oppAddress) + "_vio2"), opponentInput[8]), IntegerEntry((((txId + "_") + oppAddress) + "_vio3"), opponentInput[9]), IntegerEntry((((txId + "_") + oppAddress) + "_vio4"), opponentInput[10]), IntegerEntry((((txId + "_") + oppAddress) + "_cost"), opponentInput[11]), IntegerEntry((id + "_lgt"), lgtCond), StringEntry((id + "_status"), "open")] | |
46 | 46 | } | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | @Callable(i) | |
52 | 52 | func evaluatedDataCallback (response) = { | |
53 | 53 | let txId = toBase58String(i.transactionId) | |
54 | 54 | let parsedJson = parseJson(response) | |
55 | 55 | let crashId = parsedJson._1[1] | |
56 | 56 | let innocentAddress = parsedJson._2[1] | |
57 | 57 | let guiltyAddress = parsedJson._3[1] | |
58 | 58 | let RegisterTxId = match getString(crashId) { | |
59 | 59 | case s: String => | |
60 | 60 | s | |
61 | 61 | case _ => | |
62 | 62 | "no Data exists" | |
63 | 63 | } | |
64 | 64 | if ((RegisterTxId == "no Data exists")) | |
65 | 65 | then throw("There is no Data for this crashId!") | |
66 | 66 | else { | |
67 | - | let | |
68 | - | case s: | |
67 | + | let status = match getString((crashId + "_status")) { | |
68 | + | case s: String => | |
69 | 69 | s | |
70 | 70 | case _ => | |
71 | - | " | |
71 | + | "no Data exists" | |
72 | 72 | } | |
73 | - | if ((costEstimationOfInnocentPerson == "No data Found")) | |
74 | - | then throw("There is no data for this address!") | |
75 | - | else if ((costEstimationOfInnocentPerson == -1)) | |
76 | - | then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")] | |
77 | - | 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)] | |
73 | + | if ((status == "no Data exists")) | |
74 | + | then throw("There is no status for this case!") | |
75 | + | else if ((status == "closed")) | |
76 | + | then throw("A case should not be evaluated twice!") | |
77 | + | else { | |
78 | + | let costEstimationOfInnocentPerson = match getInteger((((RegisterTxId + "_") + innocentAddress) + "_cost")) { | |
79 | + | case s: Int => | |
80 | + | s | |
81 | + | case _ => | |
82 | + | "No data Found" | |
83 | + | } | |
84 | + | if ((costEstimationOfInnocentPerson == "No data Found")) | |
85 | + | then throw("There is no data for this address!") | |
86 | + | else if ((costEstimationOfInnocentPerson == -1)) | |
87 | + | then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")] | |
88 | + | 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)] | |
89 | + | } | |
78 | 90 | } | |
79 | 91 | } | |
80 | 92 | ||
81 | 93 | ||
82 | 94 | ||
83 | 95 | @Callable(i) | |
84 | 96 | func evaluatedData (prediction_id,per_one_address,per_two_address,guilty_person_address) = { | |
85 | 97 | let txId = toBase58String(i.transactionId) | |
86 | 98 | [StringEntry(prediction_id, txId), StringEntry((txId + "_guilty"), guilty_person_address)] | |
87 | 99 | } | |
88 | 100 | ||
89 | 101 | ||
90 | 102 | ||
91 | 103 | @Callable(i) | |
92 | 104 | func requestPayout (pred_txId,amount,id) = { | |
93 | 105 | let client = toString(i.caller) | |
94 | 106 | let txId = toBase58String(i.transactionId) | |
95 | 107 | [StringEntry((id + "_request_payout"), txId), IntegerEntry((txId + "_amount"), amount), StringEntry((txId + "_prediction_id"), pred_txId)] | |
96 | 108 | } | |
97 | 109 | ||
98 | 110 | ||
99 | 111 | @Verifier(tx) | |
100 | 112 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
101 | 113 |
github/deemru/w8io/026f985 30.76 ms ◑