tx · 3LznDyEZnroS5VU5YsA1EM8VP4seozQ42jUfKGmdFDu5 3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos: -0.01400000 Waves 2024.05.20 20:14 [3114615] smart account 3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos > SELF 0.00000000 Waves
{ "type": 13, "id": "3LznDyEZnroS5VU5YsA1EM8VP4seozQ42jUfKGmdFDu5", "fee": 1400000, "feeAssetId": null, "timestamp": 1716225370018, "version": 2, "chainId": 84, "sender": "3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos", "senderPublicKey": "F7SLwr7RYVQpyocmVScFC6ooaAwewaGq6wNRDYvyiPj1", "proofs": [ "5b87tuvrhB7FJpToNeRxoNWU8FtZahbr8fqDtY9pPon4adaTxsHzjZssEByhn59PHcYwMT3u4HvgSWkFE8ArbSN7" ], "script": "base64:AAIFAAAAAAAAABIIAhIGCgQIGAgIEgQKAggIEgAAAAAGAAAAABRwcmVkaWN0aW9uTWF4Q291bnRlcgAAAAAAAAAAAwAAAAAKbWF4Q291bnRlcgAAAAAAAAAABgAAAAANZGVmYXVsdFJhdGluZwAAAAAAAAAAZAEAAAARc2VhcmNoRm9yQ291bnRlcnMAAAACAAAABml0ZW1JZAAAAAdjb3VudGVyBAAAABFzZWFyY2hGb3JDb3VudGVycwQAAAAHJG1hdGNoMAkABCIAAAABCQABLAAAAAIJAAEsAAAAAgUAAAAGaXRlbUlkAgAAAAFfCQABpAAAAAEFAAAAB2NvdW50ZXIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwIAAAAHTm8gVXNlcgUAAAARc2VhcmNoRm9yQ291bnRlcnMBAAAAGXNlYXJjaEZvckFkcmVzc1ByZWRpY3Rpb24AAAACAAAABml0ZW1JZAAAAAZhZHJlc3MEAAAAE3NlYXJjaEZvclByZWRpY3Rpb24EAAAAByRtYXRjaDAJAAQiAAAAAQkAASwAAAACCQABLAA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IJAAEsAAAAAgUAAAAGaXRlbUlkAgAAAAFfBQAAAAxjbGllbnRBZHJlc3MFAAAACnByZWRpY3Rpb24JAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAAGaXRlbUlkAgAAAAhfY291bnRlcgAAAAAAAAAAAQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACBQAAAAZpdGVtSWQCAAAAEl9wcmVkaWN0aW9uQ291bnRlcgAAAAAAAAAAAQUAAAADbmlsAAAAAWkBAAAADHJlZ2lzdGVyVXNlcgAAAAAEAAAADGNsaWVudEFkcmVzcwkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIEAAAADXNlYXJjaEZvclVzZXIEAAAAByRtYXRjaDAJAAQfAAAAAQUAAAAMY2xpZW50QWRyZXNzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXMFAAAAByRtYXRjaDAFAAAAAXMCAAAADU5vIHVzZXIgZm91bmQDCQEAAAACIT0AAAACBQAAAA1zZWFyY2hGb3JVc2VyAgAAAA1ObyB1c2VyIEZvdW5kCQAAAgAAAAECAAAAE1VzZXIgYWxyZWFkeSBleGlzdHMJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAADGNsaWVudEFkcmVzcwUAAAANZGVmYXVsdFJhdGluZwUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXl78AQm", "height": 3114615, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DSgTqxw9vomsU4KfLjjYLMDUdJW3rkYPafHn4q1sR39k Next: DiALfCc5dpcEZ9R5BeV8H2yK3w1n4NT6hyjMVwu3MxWK Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let maxCounter = 3 | |
4 | + | let predictionMaxCounter = 3 | |
5 | + | ||
6 | + | let maxCounter = 6 | |
5 | 7 | ||
6 | 8 | let defaultRating = 100 | |
7 | 9 | ||
8 | - | func | |
9 | - | let | |
10 | + | func searchForCounters (itemId,counter) = { | |
11 | + | let searchForCounters = match getString(((itemId + "_") + toString(counter))) { | |
10 | 12 | case s: String => | |
11 | 13 | s | |
12 | 14 | case _ => | |
13 | 15 | "No User" | |
14 | 16 | } | |
15 | - | searchForCounter | |
17 | + | searchForCounters | |
18 | + | } | |
19 | + | ||
20 | + | ||
21 | + | func searchForAdressPrediction (itemId,adress) = { | |
22 | + | let searchForPrediction = match getString(((itemId + "_") + adress)) { | |
23 | + | case s: String => | |
24 | + | s | |
25 | + | case _ => | |
26 | + | "Not Found" | |
27 | + | } | |
28 | + | searchForPrediction | |
16 | 29 | } | |
17 | 30 | ||
18 | 31 | ||
20 | 33 | let adressList = nil | |
21 | 34 | if ((counter >= 1)) | |
22 | 35 | then { | |
23 | - | let adress1 = | |
36 | + | let adress1 = searchForCounters(itemId, 1) | |
24 | 37 | (adressList :+ adress1) | |
25 | 38 | } | |
26 | 39 | else if ((counter >= 2)) | |
27 | 40 | then { | |
28 | - | let adress1 = | |
29 | - | let adress2 = | |
41 | + | let adress1 = searchForCounters(itemId, 1) | |
42 | + | let adress2 = searchForCounters(itemId, 2) | |
30 | 43 | ((adressList :+ adress1) :+ adress2) | |
31 | 44 | } | |
32 | 45 | else if ((counter >= 3)) | |
33 | 46 | then { | |
34 | - | let adress1 = | |
35 | - | let adress2 = | |
36 | - | let adress3 = | |
47 | + | let adress1 = searchForCounters(itemId, 1) | |
48 | + | let adress2 = searchForCounters(itemId, 2) | |
49 | + | let adress3 = searchForCounters(itemId, 3) | |
37 | 50 | (((adressList :+ adress1) :+ adress2) :+ adress3) | |
38 | 51 | } | |
39 | 52 | else if ((counter >= 4)) | |
40 | 53 | then { | |
41 | - | let adress1 = | |
42 | - | let adress2 = | |
43 | - | let adress3 = | |
44 | - | let adress4 = | |
54 | + | let adress1 = searchForCounters(itemId, 1) | |
55 | + | let adress2 = searchForCounters(itemId, 2) | |
56 | + | let adress3 = searchForCounters(itemId, 3) | |
57 | + | let adress4 = searchForCounters(itemId, 4) | |
45 | 58 | ((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) | |
46 | 59 | } | |
47 | 60 | else { | |
48 | - | let adress1 = | |
49 | - | let adress2 = | |
50 | - | let adress3 = | |
51 | - | let adress4 = | |
52 | - | let adress5 = | |
61 | + | let adress1 = searchForCounters(itemId, 1) | |
62 | + | let adress2 = searchForCounters(itemId, 2) | |
63 | + | let adress3 = searchForCounters(itemId, 3) | |
64 | + | let adress4 = searchForCounters(itemId, 4) | |
65 | + | let adress5 = searchForCounters(itemId, 5) | |
53 | 66 | (((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) :+ adress5) | |
54 | 67 | } | |
55 | 68 | } | |
69 | + | ||
70 | + | ||
71 | + | @Callable(i) | |
72 | + | func adjustRatingsAndPayoutParticipants (itemId,adressList,lastCallerAdress,finalPrediction) = nil | |
73 | + | ||
56 | 74 | ||
57 | 75 | ||
58 | 76 | @Callable(i) | |
102 | 120 | } | |
103 | 121 | let newCounter = (searchForCounter + 1) | |
104 | 122 | if ((lastPrediction == prediction)) | |
105 | - | then if (((predictionCounter + 1) == maxCounter)) | |
106 | - | then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), true), BooleanEntry((itemId + "_cancelled"), false)] | |
123 | + | then if (((predictionCounter + 1) == predictionMaxCounter)) | |
124 | + | then { | |
125 | + | let invokeAdjustRating = invoke(this, "adjustRatingsAndPayoutParticipants", [itemId, adressList, clientAdress, prediction], nil) | |
126 | + | if ((invokeAdjustRating != invokeAdjustRating)) | |
127 | + | then throw("Strict value is not equal to itself.") | |
128 | + | else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), true), BooleanEntry((itemId + "_cancelled"), false)] | |
129 | + | } | |
107 | 130 | else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), false), BooleanEntry((itemId + "_cancelled"), false)] | |
108 | - | else if ((newCounter >= | |
131 | + | else if ((newCounter >= maxCounter)) | |
109 | 132 | then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), true), BooleanEntry((itemId + "_final"), false)] | |
110 | 133 | else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), false), BooleanEntry((itemId + "_final"), false)] | |
111 | 134 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let maxCounter = 3 | |
4 | + | let predictionMaxCounter = 3 | |
5 | + | ||
6 | + | let maxCounter = 6 | |
5 | 7 | ||
6 | 8 | let defaultRating = 100 | |
7 | 9 | ||
8 | - | func | |
9 | - | let | |
10 | + | func searchForCounters (itemId,counter) = { | |
11 | + | let searchForCounters = match getString(((itemId + "_") + toString(counter))) { | |
10 | 12 | case s: String => | |
11 | 13 | s | |
12 | 14 | case _ => | |
13 | 15 | "No User" | |
14 | 16 | } | |
15 | - | searchForCounter | |
17 | + | searchForCounters | |
18 | + | } | |
19 | + | ||
20 | + | ||
21 | + | func searchForAdressPrediction (itemId,adress) = { | |
22 | + | let searchForPrediction = match getString(((itemId + "_") + adress)) { | |
23 | + | case s: String => | |
24 | + | s | |
25 | + | case _ => | |
26 | + | "Not Found" | |
27 | + | } | |
28 | + | searchForPrediction | |
16 | 29 | } | |
17 | 30 | ||
18 | 31 | ||
19 | 32 | func findPredictionAdresses (itemId,counter) = { | |
20 | 33 | let adressList = nil | |
21 | 34 | if ((counter >= 1)) | |
22 | 35 | then { | |
23 | - | let adress1 = | |
36 | + | let adress1 = searchForCounters(itemId, 1) | |
24 | 37 | (adressList :+ adress1) | |
25 | 38 | } | |
26 | 39 | else if ((counter >= 2)) | |
27 | 40 | then { | |
28 | - | let adress1 = | |
29 | - | let adress2 = | |
41 | + | let adress1 = searchForCounters(itemId, 1) | |
42 | + | let adress2 = searchForCounters(itemId, 2) | |
30 | 43 | ((adressList :+ adress1) :+ adress2) | |
31 | 44 | } | |
32 | 45 | else if ((counter >= 3)) | |
33 | 46 | then { | |
34 | - | let adress1 = | |
35 | - | let adress2 = | |
36 | - | let adress3 = | |
47 | + | let adress1 = searchForCounters(itemId, 1) | |
48 | + | let adress2 = searchForCounters(itemId, 2) | |
49 | + | let adress3 = searchForCounters(itemId, 3) | |
37 | 50 | (((adressList :+ adress1) :+ adress2) :+ adress3) | |
38 | 51 | } | |
39 | 52 | else if ((counter >= 4)) | |
40 | 53 | then { | |
41 | - | let adress1 = | |
42 | - | let adress2 = | |
43 | - | let adress3 = | |
44 | - | let adress4 = | |
54 | + | let adress1 = searchForCounters(itemId, 1) | |
55 | + | let adress2 = searchForCounters(itemId, 2) | |
56 | + | let adress3 = searchForCounters(itemId, 3) | |
57 | + | let adress4 = searchForCounters(itemId, 4) | |
45 | 58 | ((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) | |
46 | 59 | } | |
47 | 60 | else { | |
48 | - | let adress1 = | |
49 | - | let adress2 = | |
50 | - | let adress3 = | |
51 | - | let adress4 = | |
52 | - | let adress5 = | |
61 | + | let adress1 = searchForCounters(itemId, 1) | |
62 | + | let adress2 = searchForCounters(itemId, 2) | |
63 | + | let adress3 = searchForCounters(itemId, 3) | |
64 | + | let adress4 = searchForCounters(itemId, 4) | |
65 | + | let adress5 = searchForCounters(itemId, 5) | |
53 | 66 | (((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) :+ adress5) | |
54 | 67 | } | |
55 | 68 | } | |
69 | + | ||
70 | + | ||
71 | + | @Callable(i) | |
72 | + | func adjustRatingsAndPayoutParticipants (itemId,adressList,lastCallerAdress,finalPrediction) = nil | |
73 | + | ||
56 | 74 | ||
57 | 75 | ||
58 | 76 | @Callable(i) | |
59 | 77 | func savePrediction (itemId,prediction) = { | |
60 | 78 | let clientAdress = toString(i.caller) | |
61 | 79 | let searchForItem = match getString(itemId) { | |
62 | 80 | case s: String => | |
63 | 81 | s | |
64 | 82 | case _ => | |
65 | 83 | "no Data exists" | |
66 | 84 | } | |
67 | 85 | if ((searchForItem == "no Data exists")) | |
68 | 86 | then throw("This ItemID does not exist!") | |
69 | 87 | else { | |
70 | 88 | let searchForUser = match getInteger(clientAdress) { | |
71 | 89 | case s: Int => | |
72 | 90 | s | |
73 | 91 | case _ => | |
74 | 92 | "no User exists" | |
75 | 93 | } | |
76 | 94 | if ((searchForUser == "no User exists")) | |
77 | 95 | then throw("User does not exist") | |
78 | 96 | else { | |
79 | 97 | let searchForCounter = match getInteger((itemId + "_counter")) { | |
80 | 98 | case s: Int => | |
81 | 99 | s | |
82 | 100 | case _ => | |
83 | 101 | -1 | |
84 | 102 | } | |
85 | 103 | let adressList = findPredictionAdresses(itemId, searchForCounter) | |
86 | 104 | if (containsElement(adressList, clientAdress)) | |
87 | 105 | then throw("This User already gave a Prediction") | |
88 | 106 | else if ((searchForCounter >= 1)) | |
89 | 107 | then { | |
90 | 108 | let predictionCounter = match getInteger((itemId + "_predictionCounter")) { | |
91 | 109 | case s: Int => | |
92 | 110 | s | |
93 | 111 | case _ => | |
94 | 112 | -1 | |
95 | 113 | } | |
96 | 114 | let lastPredictionAdress = adressList[(size(adressList) - 1)] | |
97 | 115 | let lastPrediction = match getString(((itemId + "_") + lastPredictionAdress)) { | |
98 | 116 | case s: String => | |
99 | 117 | s | |
100 | 118 | case _ => | |
101 | 119 | "no Prediction Found" | |
102 | 120 | } | |
103 | 121 | let newCounter = (searchForCounter + 1) | |
104 | 122 | if ((lastPrediction == prediction)) | |
105 | - | then if (((predictionCounter + 1) == maxCounter)) | |
106 | - | then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), true), BooleanEntry((itemId + "_cancelled"), false)] | |
123 | + | then if (((predictionCounter + 1) == predictionMaxCounter)) | |
124 | + | then { | |
125 | + | let invokeAdjustRating = invoke(this, "adjustRatingsAndPayoutParticipants", [itemId, adressList, clientAdress, prediction], nil) | |
126 | + | if ((invokeAdjustRating != invokeAdjustRating)) | |
127 | + | then throw("Strict value is not equal to itself.") | |
128 | + | else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), true), BooleanEntry((itemId + "_cancelled"), false)] | |
129 | + | } | |
107 | 130 | else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), false), BooleanEntry((itemId + "_cancelled"), false)] | |
108 | - | else if ((newCounter >= | |
131 | + | else if ((newCounter >= maxCounter)) | |
109 | 132 | then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), true), BooleanEntry((itemId + "_final"), false)] | |
110 | 133 | else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), false), BooleanEntry((itemId + "_final"), false)] | |
111 | 134 | } | |
112 | 135 | else [StringEntry(((itemId + "_") + toString(1)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), 1), IntegerEntry((itemId + "_predictionCounter"), 1)] | |
113 | 136 | } | |
114 | 137 | } | |
115 | 138 | } | |
116 | 139 | ||
117 | 140 | ||
118 | 141 | ||
119 | 142 | @Callable(i) | |
120 | 143 | func registerUser () = { | |
121 | 144 | let clientAdress = toString(i.caller) | |
122 | 145 | let searchForUser = match getInteger(clientAdress) { | |
123 | 146 | case s: Int => | |
124 | 147 | s | |
125 | 148 | case _ => | |
126 | 149 | "No user found" | |
127 | 150 | } | |
128 | 151 | if ((searchForUser != "No user Found")) | |
129 | 152 | then throw("User already exists") | |
130 | 153 | else [IntegerEntry(clientAdress, defaultRating)] | |
131 | 154 | } | |
132 | 155 | ||
133 | 156 | ||
134 | 157 | @Verifier(tx) | |
135 | 158 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
136 | 159 |
github/deemru/w8io/026f985 34.23 ms ◑