tx · H7ZvmpTSvZN6uH3TDXDNmQx13EQjhZCrLSCGFNnKx9KY 3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3: -0.01000000 Waves 2023.12.07 14:33 [2876177] smart account 3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3 > SELF 0.00000000 Waves
{ "type": 13, "id": "H7ZvmpTSvZN6uH3TDXDNmQx13EQjhZCrLSCGFNnKx9KY", "fee": 1000000, "feeAssetId": null, "timestamp": 1701948799893, "version": 2, "chainId": 84, "sender": "3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3", "senderPublicKey": "5TXMdPyvDNfxhdixe86fk7Ya8FScpZGfZ6XNawu8sYK4", "proofs": [ "5vCHvLnuyouKuWLGtKPkD42v5AfGjinAwW4XWcpNyzcWrhQ6iPKqmZbQqRFueJvboX4524FWsDg1hyS4nxdggKUT" ], "script": "base64:BgIWCAISBwoFEREICAESAwoBCBIECgIIAQcAC0JBSV9BRERSRVNTAiMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgAEVFlQRQIPY3Jhc2hFdmFsdWF0aW9uAAdCQUlfRkVFAICt4gQAEUFJX1RPS0VOX0FTU0VUX0lEASCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgASVVNEX1RPS0VOX0FTU0VUX0lEASD0y7xo+2oaYWIjSL66wV175dmB7kJoGRUhLW0SJ79srAELcmVtb3ZlTWFya3MBC21hcmtzU3RyaW5nBAFhCQCwAgIFC21hcmtzU3RyaW5nAAEEAWIJALMCAgUBYQABBQFiAQlwYXJzZUpzb24BBGpzb24EDG1vZGlmaWVkSnNvbgkAsAICBQRqc29uAAEEDW1vZGlmaWVkSnNvbjIJALMCAgUMbW9kaWZpZWRKc29uAAEEBnNwbGl0MQkAtQkCBQ1tb2RpZmllZEpzb24yAgEsBAlrZXlWYWx1ZTEJALUJAgkAkQMCBQZzcGxpdDEAAAIBOgQEa2V5MQkBC3JlbW92ZU1hc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AIBQJ0eA9zZW5kZXJQdWJsaWNLZXl4a+oY", "height": 2876177, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2mQu1Zd2j7zagJ7sL7S2gLTmTpoTfXAQvGWiFMtfg9h2 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let BAI_FEE = 10000000 | |
9 | 9 | ||
10 | 10 | let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
11 | + | ||
12 | + | let USD_TOKEN_ASSET_ID = base58'HUafUdHNmuLduuDkXiR7n6WA3LYf8rY2ySFbjkPWENV9' | |
11 | 13 | ||
12 | 14 | func removeMarks (marksString) = { | |
13 | 15 | let a = drop(marksString, 1) | |
93 | 95 | case s: Int => | |
94 | 96 | s | |
95 | 97 | case _ => | |
96 | - | | |
98 | + | -404 | |
97 | 99 | } | |
98 | - | if ((costEstimationOfInnocentPerson == | |
100 | + | if ((costEstimationOfInnocentPerson == -404)) | |
99 | 101 | then throw("There is no cost data for this address!") | |
100 | 102 | else if ((costEstimationOfInnocentPerson == -1)) | |
101 | 103 | then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")] | |
102 | - | else [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(innocentAddress)), | |
104 | + | else [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(innocentAddress)), costEstimationOfInnocentPerson, USD_TOKEN_ASSET_ID)] | |
103 | 105 | } | |
104 | 106 | } | |
105 | 107 | } | |
131 | 133 | then throw("There is no eligible person for this case!") | |
132 | 134 | else if ((eligible_address != sender)) | |
133 | 135 | then throw("You are not allowed to request a payout!") | |
134 | - | else [IntegerEntry((((crashId + "_") + sender) + "_cost"), amount), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(sender)), | |
136 | + | else [IntegerEntry((((crashId + "_") + sender) + "_cost"), amount), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(sender)), amount, USD_TOKEN_ASSET_ID)] | |
135 | 137 | } | |
136 | 138 | } | |
137 | 139 |
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 | + | ||
12 | + | let USD_TOKEN_ASSET_ID = base58'HUafUdHNmuLduuDkXiR7n6WA3LYf8rY2ySFbjkPWENV9' | |
11 | 13 | ||
12 | 14 | func removeMarks (marksString) = { | |
13 | 15 | let a = drop(marksString, 1) | |
14 | 16 | let b = dropRight(a, 1) | |
15 | 17 | b | |
16 | 18 | } | |
17 | 19 | ||
18 | 20 | ||
19 | 21 | func parseJson (json) = { | |
20 | 22 | let modifiedJson = drop(json, 1) | |
21 | 23 | let modifiedJson2 = dropRight(modifiedJson, 1) | |
22 | 24 | let split1 = split(modifiedJson2, ",") | |
23 | 25 | let keyValue1 = split(split1[0], ":") | |
24 | 26 | let key1 = removeMarks(keyValue1[0]) | |
25 | 27 | let value1 = removeMarks(keyValue1[1]) | |
26 | 28 | let keyValue2 = split(split1[1], ":") | |
27 | 29 | let key2 = removeMarks(keyValue2[0]) | |
28 | 30 | let value2 = removeMarks(keyValue2[1]) | |
29 | 31 | let keyValue3 = split(split1[2], ":") | |
30 | 32 | let key3 = removeMarks(keyValue3[0]) | |
31 | 33 | let value3 = removeMarks(keyValue3[1]) | |
32 | 34 | $Tuple3([key1, value1], [key2, value2], [key3, value3]) | |
33 | 35 | } | |
34 | 36 | ||
35 | 37 | ||
36 | 38 | @Callable(i) | |
37 | 39 | func registerData (clientInput,opponentInput,id,oppAddress,lgtCond) = { | |
38 | 40 | let searchForExistingData = match getString(id) { | |
39 | 41 | case s: String => | |
40 | 42 | s | |
41 | 43 | case _ => | |
42 | 44 | "no Data exists" | |
43 | 45 | } | |
44 | 46 | if ((searchForExistingData != "no Data exists")) | |
45 | 47 | then throw("There is already existing Data for this case!") | |
46 | 48 | else { | |
47 | 49 | let parameters = [id, TYPE, "evaluatedDataCallback"] | |
48 | 50 | let client = toString(i.caller) | |
49 | 51 | let txId = toBase58String(i.transactionId) | |
50 | 52 | if ((client == oppAddress)) | |
51 | 53 | then throw("Forbidden: Sender address equals opponents address!") | |
52 | 54 | else { | |
53 | 55 | let invokeTask = invoke(Address(fromBase58String(BAI_ADDRESS)), "registerTaskCallback", parameters, [AttachedPayment(AI_TOKEN_ASSET_ID, BAI_FEE)]) | |
54 | 56 | if ((invokeTask != invokeTask)) | |
55 | 57 | then throw("Strict value is not equal to itself.") | |
56 | 58 | 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)] | |
57 | 59 | } | |
58 | 60 | } | |
59 | 61 | } | |
60 | 62 | ||
61 | 63 | ||
62 | 64 | ||
63 | 65 | @Callable(i) | |
64 | 66 | func evaluatedDataCallback (response) = { | |
65 | 67 | let txId = toBase58String(i.transactionId) | |
66 | 68 | let parsedJson = parseJson(response) | |
67 | 69 | let crashId = parsedJson._1[1] | |
68 | 70 | let innocentAddress = parsedJson._2[1] | |
69 | 71 | let guiltyAddress = parsedJson._3[1] | |
70 | 72 | let RegisterTxId = match getString(crashId) { | |
71 | 73 | case s: String => | |
72 | 74 | s | |
73 | 75 | case _ => | |
74 | 76 | "no Data exists" | |
75 | 77 | } | |
76 | 78 | if ((RegisterTxId == "no Data exists")) | |
77 | 79 | then throw("There is no Data for this crashId!") | |
78 | 80 | else { | |
79 | 81 | let status = match getString((crashId + "_status")) { | |
80 | 82 | case s: String => | |
81 | 83 | s | |
82 | 84 | case _ => | |
83 | 85 | "no Data exists" | |
84 | 86 | } | |
85 | 87 | if ((status == "no Data exists")) | |
86 | 88 | then throw("There is no status for this case!") | |
87 | 89 | else if ((status == "closed")) | |
88 | 90 | then throw("A case should not be payed out twice!") | |
89 | 91 | else if ((status == "evaluated")) | |
90 | 92 | then throw("A case should not be evaluated twice!") | |
91 | 93 | else { | |
92 | 94 | let costEstimationOfInnocentPerson = match getInteger((((crashId + "_") + innocentAddress) + "_cost")) { | |
93 | 95 | case s: Int => | |
94 | 96 | s | |
95 | 97 | case _ => | |
96 | - | | |
98 | + | -404 | |
97 | 99 | } | |
98 | - | if ((costEstimationOfInnocentPerson == | |
100 | + | if ((costEstimationOfInnocentPerson == -404)) | |
99 | 101 | then throw("There is no cost data for this address!") | |
100 | 102 | else if ((costEstimationOfInnocentPerson == -1)) | |
101 | 103 | then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")] | |
102 | - | else [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(innocentAddress)), | |
104 | + | else [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(innocentAddress)), costEstimationOfInnocentPerson, USD_TOKEN_ASSET_ID)] | |
103 | 105 | } | |
104 | 106 | } | |
105 | 107 | } | |
106 | 108 | ||
107 | 109 | ||
108 | 110 | ||
109 | 111 | @Callable(i) | |
110 | 112 | func requestPayout (crashId,amount) = { | |
111 | 113 | let sender = toString(i.caller) | |
112 | 114 | let txId = toBase58String(i.transactionId) | |
113 | 115 | let status = match getString((crashId + "_status")) { | |
114 | 116 | case s: String => | |
115 | 117 | s | |
116 | 118 | case _ => | |
117 | 119 | "no Data exists" | |
118 | 120 | } | |
119 | 121 | if ((status == "no Data exists")) | |
120 | 122 | then throw("There is no status for this case!") | |
121 | 123 | else if ((status != "evaluated")) | |
122 | 124 | then throw("Only cases with evaluated status can request a payout!") | |
123 | 125 | else { | |
124 | 126 | let eligible_address = match getString((crashId + "_innocent_address")) { | |
125 | 127 | case s: String => | |
126 | 128 | s | |
127 | 129 | case _ => | |
128 | 130 | "no Data exists" | |
129 | 131 | } | |
130 | 132 | if ((status == "no Data exists")) | |
131 | 133 | then throw("There is no eligible person for this case!") | |
132 | 134 | else if ((eligible_address != sender)) | |
133 | 135 | then throw("You are not allowed to request a payout!") | |
134 | - | else [IntegerEntry((((crashId + "_") + sender) + "_cost"), amount), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(sender)), | |
136 | + | else [IntegerEntry((((crashId + "_") + sender) + "_cost"), amount), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(sender)), amount, USD_TOKEN_ASSET_ID)] | |
135 | 137 | } | |
136 | 138 | } | |
137 | 139 | ||
138 | 140 | ||
139 | 141 | @Verifier(tx) | |
140 | 142 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
141 | 143 |
github/deemru/w8io/026f985 35.62 ms ◑