tx · 4ypyKu4JKGe6iG5CDhLns9aRm54xWYtKYH6huCHuTVVz 3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3: -0.01000000 Waves 2023.11.27 19:44 [2862072] smart account 3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3 > SELF 0.00000000 Waves
{ "type": 13, "id": "4ypyKu4JKGe6iG5CDhLns9aRm54xWYtKYH6huCHuTVVz", "fee": 1000000, "feeAssetId": null, "timestamp": 1701103541243, "version": 2, "chainId": 84, "sender": "3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3", "senderPublicKey": "5TXMdPyvDNfxhdixe86fk7Ya8FScpZGfZ6XNawu8sYK4", "proofs": [ "BbfN2YV7hebEGbTXKTF2en6LzyiegbWwu6BWvTZjLRdBWorPJmBMBWAn5HqdjUTcYAgv13rmzJKePAnBL8s4xMG" ], "script": "base64:BgIfCAISBwoFEREICAESAwoBCBIGCgQICAgIEgUKAwgBCAYAC0JBSV9BRERSRVNTAiMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgAEVFlQRQIPY3Jhc2hFdmFsdWF0aW9uAAdCQUlfRkVFAICt4gQAEUFJX1RPS0VOX0FTU0VUX0lEASCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgELcmVtb3ZlTWFya3MBC21hcmtzU3RyaW5nBAFhCQCwAgIFC21hcmtzU3RyaW5nAAEEAWIJALMCAgUBYQABBQFiAQlwYXJzZUpzb24BBGpzb24EDG1vZGlmaWVkSnNvbgkAsAICBQRqc29uAAEEDW1vZGlmaWVkSnNvbjIJALMCAgUMbW9kaWZpZWRKc29uAAEEBnNwbGl0MQkAtQkCBQ1tb2RpZmllZEpzb24yAgEsBAlrZXlWYWx1ZTEJALUJAgkAkQMCBQZzcGxpdDEAAAIBOgQEa2V5MQkBC3JlbW92ZU1hcmtzAQkAkQMCBQlrZXlWYWx1ZTEAAAQGdmFsdWUxCQELcmVtb3ZlTWFya3MB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gFAWkNdHJhbnNhY3Rpb25JZAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIFAmlkAg9fcmVxdWVzdF9wYXlvdXQFBHR4SWQJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUEdHhJZAIHX2Ftb3VudAUGYW1vdW50CQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUEdHhJZAIOX3ByZWRpY3Rpb25faWQFCXByZWRfdHhJZAUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleV+yA1w=", "height": 2862072, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DuVFXE8VktE8Kmc5wjQguUSyjSobPptt72ovGnSq7DqW Next: 3MAAMJYru4pbfhrNCTUkZAhGufHbofgEFJpqJVP5cGUi Diff:
Old | New | Differences | |
---|---|---|---|
63 | 63 | let crashId = parsedJson._1[1] | |
64 | 64 | let innocentAddress = parsedJson._2[1] | |
65 | 65 | let guiltyAddress = parsedJson._3[1] | |
66 | - | [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "closed")] | |
66 | + | let RegisterTxId = match getString(crashId) { | |
67 | + | case s: String => | |
68 | + | s | |
69 | + | case _ => | |
70 | + | "no Data exists" | |
71 | + | } | |
72 | + | if ((RegisterTxId == "no Data exists")) | |
73 | + | then throw("There is no Data for this crashId!") | |
74 | + | else { | |
75 | + | let status = match getString((crashId + "_status")) { | |
76 | + | case s: String => | |
77 | + | s | |
78 | + | case _ => | |
79 | + | "no Data exists" | |
80 | + | } | |
81 | + | if ((status == "no Data exists")) | |
82 | + | then throw("There is no status for this case!") | |
83 | + | else if ((status == "closed")) | |
84 | + | then throw("A case should payed out twice!") | |
85 | + | else if ((status == "evaluated")) | |
86 | + | then throw("A case should not be evaluated twice!") | |
87 | + | else { | |
88 | + | let costEstimationOfInnocentPerson = match getInteger((((crashId + "_") + innocentAddress) + "_cost")) { | |
89 | + | case s: Int => | |
90 | + | s | |
91 | + | case _ => | |
92 | + | "No data Found" | |
93 | + | } | |
94 | + | if ((costEstimationOfInnocentPerson == "No data Found")) | |
95 | + | then throw("There is no cost data for this address!") | |
96 | + | else if ((costEstimationOfInnocentPerson == -1)) | |
97 | + | then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")] | |
98 | + | 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)] | |
99 | + | } | |
100 | + | } | |
67 | 101 | } | |
68 | 102 | ||
69 | 103 |
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 TYPE = "crashEvaluation" | |
7 | 7 | ||
8 | 8 | let BAI_FEE = 10000000 | |
9 | 9 | ||
10 | 10 | let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
11 | 11 | ||
12 | 12 | func removeMarks (marksString) = { | |
13 | 13 | let a = drop(marksString, 1) | |
14 | 14 | let b = dropRight(a, 1) | |
15 | 15 | b | |
16 | 16 | } | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func parseJson (json) = { | |
20 | 20 | let modifiedJson = drop(json, 1) | |
21 | 21 | let modifiedJson2 = dropRight(modifiedJson, 1) | |
22 | 22 | let split1 = split(modifiedJson2, ",") | |
23 | 23 | let keyValue1 = split(split1[0], ":") | |
24 | 24 | let key1 = removeMarks(keyValue1[0]) | |
25 | 25 | let value1 = removeMarks(keyValue1[1]) | |
26 | 26 | let keyValue2 = split(split1[1], ":") | |
27 | 27 | let key2 = removeMarks(keyValue2[0]) | |
28 | 28 | let value2 = removeMarks(keyValue2[1]) | |
29 | 29 | let keyValue3 = split(split1[2], ":") | |
30 | 30 | let key3 = removeMarks(keyValue3[0]) | |
31 | 31 | let value3 = removeMarks(keyValue3[1]) | |
32 | 32 | $Tuple3([key1, value1], [key2, value2], [key3, value3]) | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | @Callable(i) | |
37 | 37 | func registerData (clientInput,opponentInput,id,oppAddress,lgtCond) = { | |
38 | 38 | let searchForExistingData = match getString(id) { | |
39 | 39 | case s: String => | |
40 | 40 | s | |
41 | 41 | case _ => | |
42 | 42 | "no Data exists" | |
43 | 43 | } | |
44 | 44 | if ((searchForExistingData != "no Data exists")) | |
45 | 45 | then throw("There is already existing Data for this case!") | |
46 | 46 | else { | |
47 | 47 | let parameters = [id, TYPE, "evaluatedDataCallback"] | |
48 | 48 | let client = toString(i.caller) | |
49 | 49 | let txId = toBase58String(i.transactionId) | |
50 | 50 | let invokeTask = invoke(Address(fromBase58String(BAI_ADDRESS)), "registerTaskCallback", parameters, [AttachedPayment(AI_TOKEN_ASSET_ID, BAI_FEE)]) | |
51 | 51 | if ((invokeTask != invokeTask)) | |
52 | 52 | then throw("Strict value is not equal to itself.") | |
53 | 53 | else [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)] | |
54 | 54 | } | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(i) | |
60 | 60 | func evaluatedDataCallback (response) = { | |
61 | 61 | let txId = toBase58String(i.transactionId) | |
62 | 62 | let parsedJson = parseJson(response) | |
63 | 63 | let crashId = parsedJson._1[1] | |
64 | 64 | let innocentAddress = parsedJson._2[1] | |
65 | 65 | let guiltyAddress = parsedJson._3[1] | |
66 | - | [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "closed")] | |
66 | + | let RegisterTxId = match getString(crashId) { | |
67 | + | case s: String => | |
68 | + | s | |
69 | + | case _ => | |
70 | + | "no Data exists" | |
71 | + | } | |
72 | + | if ((RegisterTxId == "no Data exists")) | |
73 | + | then throw("There is no Data for this crashId!") | |
74 | + | else { | |
75 | + | let status = match getString((crashId + "_status")) { | |
76 | + | case s: String => | |
77 | + | s | |
78 | + | case _ => | |
79 | + | "no Data exists" | |
80 | + | } | |
81 | + | if ((status == "no Data exists")) | |
82 | + | then throw("There is no status for this case!") | |
83 | + | else if ((status == "closed")) | |
84 | + | then throw("A case should payed out twice!") | |
85 | + | else if ((status == "evaluated")) | |
86 | + | then throw("A case should not be evaluated twice!") | |
87 | + | else { | |
88 | + | let costEstimationOfInnocentPerson = match getInteger((((crashId + "_") + innocentAddress) + "_cost")) { | |
89 | + | case s: Int => | |
90 | + | s | |
91 | + | case _ => | |
92 | + | "No data Found" | |
93 | + | } | |
94 | + | if ((costEstimationOfInnocentPerson == "No data Found")) | |
95 | + | then throw("There is no cost data for this address!") | |
96 | + | else if ((costEstimationOfInnocentPerson == -1)) | |
97 | + | then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")] | |
98 | + | 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)] | |
99 | + | } | |
100 | + | } | |
67 | 101 | } | |
68 | 102 | ||
69 | 103 | ||
70 | 104 | ||
71 | 105 | @Callable(i) | |
72 | 106 | func evaluatedData (prediction_id,per_one_address,per_two_address,guilty_person_address) = { | |
73 | 107 | let txId = toBase58String(i.transactionId) | |
74 | 108 | [StringEntry(prediction_id, txId), StringEntry((txId + "_guilty"), guilty_person_address)] | |
75 | 109 | } | |
76 | 110 | ||
77 | 111 | ||
78 | 112 | ||
79 | 113 | @Callable(i) | |
80 | 114 | func requestPayout (pred_txId,amount,id) = { | |
81 | 115 | let client = toString(i.caller) | |
82 | 116 | let txId = toBase58String(i.transactionId) | |
83 | 117 | [StringEntry((id + "_request_payout"), txId), IntegerEntry((txId + "_amount"), amount), StringEntry((txId + "_prediction_id"), pred_txId)] | |
84 | 118 | } | |
85 | 119 | ||
86 | 120 | ||
87 | 121 | @Verifier(tx) | |
88 | 122 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
89 | 123 |
github/deemru/w8io/026f985 29.88 ms ◑