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