tx · Ard2KekPMgzREu9fkdMxuL8atrT6Sn8u33oYpCRjYiE8 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx: -0.01200000 Waves 2023.08.30 16:32 [2733482] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves
{ "type": 13, "id": "Ard2KekPMgzREu9fkdMxuL8atrT6Sn8u33oYpCRjYiE8", "fee": 1200000, "feeAssetId": null, "timestamp": 1693402334571, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "5LDLhcwophqngA65TagenkG28oYohH4nmZY1gG5GrzEeDbGEt3vvGpzwgTb37a2Hs9owei7KQzoAnF6mCgpKy4U2" ], "script": "base64:BgIfCAISBgoEAQEBARIAEgASBAoCCAESBAoCCAESAwoBATUAD0RFRkFVTFRMT0NBVElPTgIPQWZyaWNhX0ZfQWZyaWNhARRrZXlTdGFrZWREdWNrQnlPd25lcgEJb3duZXJBZGRyCQCsAgICEnN0YWtlZER1Y2tCeU93bmVyXwUJb3duZXJBZGRyAQ9rZXlEdWNrTG9jYXRpb24BC2R1Y2tBc3NldElkCQCsAgICDWR1Y2tMb2NhdGlvbl8FC2R1Y2tBc3NldElkAA1sYXN0VG91cklkS2V5Ag4lc19fbGFzdFRvdXJJZAEVa2V5VG91clN0YXRpY0RhdGFCeUlkAQN0SWQJAKwCAgIWJXMlZF9fdG91clN0YXRpY0RhdGFfXwkApAMBBQN0SWQBFmtleVRvdXJEeW5hbWljRGF0YUJ5SWQBA3RJZAkArAICAhclcyVkX190b3VyRHluYW1pY0RhdGFfXwkApAMBBQN0SWQBE2tleVNjb3JlQm9hcmRCeVRvdXIBA3RJZAkArAICAhIlcyVkX19zY29yZUJvYXJkX18JAKQDAQUDdElkARtrZXlMYXN0UmVnaXN0ZXJlZFRvdXJCeUR1Y2s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ACBQZzdGF0dXMCCEFSQ0hJVkVECQACAQkArAICCQCsAgICC1RvdXJuYW1lbnQgCQCkAwEFA3RJZAIUIGlzIGFscmVhZHkgQVJDSElWRUQEEnVwZGF0ZWREeW5hbWljRGF0YQkBC2R5bmFtaWNEYXRhBQIIQVJDSElWRUQJAJEDAgUHZHluYW1pYwUPdER5bmFtaWNXaW5EdWNrCQENcGFyc2VJbnRWYWx1ZQEJAJEDAgUHZHluYW1pYwURdER5bmFtaWNXaW5SZXN1bHQJAQ1wYXJzZUludFZhbHVlAQkAkQMCBQdkeW5hbWljBRV0RHluYW1pY1RvdGFsUmVnQ291bnQJAQ1wYXJzZUludFZhbHVlAQkAkQMCBQdkeW5hbWljBRV0RHluYW1pY1RvdGFsQXR0ZW1wdHMJAJQKAgkAzAgCCQELU3RyaW5nRW50cnkCCQEWa2V5VG91ckR5bmFtaWNEYXRhQnlJZAEFA3RJZAUSdXBkYXRlZER5bmFtaWNEYXRhBQNuaWwAAAComIki", "height": 2733482, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A5CSo1mLr5WauaKk3Zqexpcnc11dpjzFhsAYFJHbjqQd Next: k9we15it79grTzFQsYa925Nh4fPwNyc3xGEWdPeZHqm Diff:
Old | New | Differences | |
---|---|---|---|
17 | 17 | func keyTourDynamicDataById (tId) = ("%s%d__tourDynamicData__" + toString(tId)) | |
18 | 18 | ||
19 | 19 | ||
20 | - | func keyAllRegistrantsByTour (tId) = ("%s%d__allRegistrants__" + toString(tId)) | |
20 | + | func keyScoreBoardByTour (tId) = ("%s%d__scoreBoard__" + toString(tId)) | |
21 | + | ||
22 | + | ||
23 | + | func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId) | |
24 | + | ||
25 | + | ||
26 | + | func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], "__") | |
27 | + | ||
28 | + | ||
29 | + | func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], "__") | |
30 | + | ||
31 | + | ||
32 | + | func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], "__") | |
21 | 33 | ||
22 | 34 | ||
23 | 35 | let idxStatic = 0 | |
54 | 66 | let locIdxType = 1 | |
55 | 67 | ||
56 | 68 | let locIdxId = 2 | |
57 | - | ||
58 | - | func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId) | |
59 | - | ||
60 | - | ||
61 | - | func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], "__") | |
62 | - | ||
63 | - | ||
64 | - | func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], "__") | |
65 | - | ||
66 | - | ||
67 | - | func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], "__") | |
68 | - | ||
69 | 69 | ||
70 | 70 | let chain = take(drop(this.bytes, 1), 1) | |
71 | 71 | ||
132 | 132 | let lowPart = toString((val % tenPow)) | |
133 | 133 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
134 | 134 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
135 | + | } | |
136 | + | ||
137 | + | ||
138 | + | func padL (val,len) = { | |
139 | + | let valS = toString(val) | |
140 | + | let zeroes = drop(toString(pow(10, 0, (len - size(valS)), 0, 0, DOWN)), 1) | |
141 | + | (zeroes + valS) | |
135 | 142 | } | |
136 | 143 | ||
137 | 144 | ||
228 | 235 | then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD")) | |
229 | 236 | else { | |
230 | 237 | let duckAssetId = duckByCaller(i.originCaller) | |
231 | - | let oldRegistrants = valueOrElse(getString(keyAllRegistrantsByTour(lastId)), "") | |
232 | - | let regList = if ((oldRegistrants == "")) | |
233 | - | then nil | |
234 | - | else split_51C(oldRegistrants, "_") | |
238 | + | let oldScoreBoard = valueOrElse(getString(keyScoreBoardByTour(lastId)), "") | |
235 | 239 | if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)) | |
236 | 240 | then true | |
237 | - | else | |
241 | + | else contains(oldScoreBoard, duckAssetId)) | |
238 | 242 | then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId))) | |
239 | 243 | else { | |
240 | 244 | let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts])) | |
241 | - | $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyAllRegistrantsByTour(lastId), makeString_11C((regList :+ duckAssetId), "_")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult) | |
245 | + | $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyScoreBoardByTour(lastId), if ((oldScoreBoard == "")) | |
246 | + | then (duckAssetId + ":000") | |
247 | + | else (((oldScoreBoard + "_") + duckAssetId) + ":000")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult) | |
242 | 248 | } | |
243 | 249 | } | |
244 | 250 | } | |
267 | 273 | else { | |
268 | 274 | let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId) | |
269 | 275 | let lastAttempt = getInteger(attemptsIteratorKey) | |
270 | - | let $ | |
276 | + | let $t059246556 = if (!(isDefined(lastAttempt))) | |
271 | 277 | then $Tuple2(0, 0) | |
272 | 278 | else if ((size(i.payments) != 1)) | |
273 | 279 | then throw("exactly 1 payment must be attached") | |
284 | 290 | else $Tuple2((value(lastAttempt) + 1), 1) | |
285 | 291 | } | |
286 | 292 | } | |
287 | - | let payedAttempts = $ | |
288 | - | let increment = $ | |
293 | + | let payedAttempts = $t059246556._1 | |
294 | + | let increment = $t059246556._2 | |
289 | 295 | let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment)) | |
290 | 296 | let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_") | |
291 | 297 | let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId) | |
346 | 352 | else false) | |
347 | 353 | then { | |
348 | 354 | let oldBestResult = valueOrElse(getInteger(bestResultKey), 0) | |
349 | - | $Tuple2([IntegerEntry(bestResultKey, max([oldBestResult, newBest]))], 0) | |
355 | + | let scoreKey = keyScoreBoardByTour(lastId) | |
356 | + | let oldScoreBoard = valueOrElse(getString(scoreKey), "") | |
357 | + | let updated = if ((newBest > oldBestResult)) | |
358 | + | then if (!(contains(oldScoreBoard, duckAssetId))) | |
359 | + | then throw(("scoreBoard does not contain " + duckAssetId)) | |
360 | + | else { | |
361 | + | let parts = split_51C(oldScoreBoard, duckAssetId) | |
362 | + | ((((parts[0] + duckAssetId) + ":") + padL(newBest, 3)) + drop(parts[1], 4)) | |
363 | + | } | |
364 | + | else oldScoreBoard | |
365 | + | $Tuple2([IntegerEntry(bestResultKey, max([oldBestResult, newBest])), StringEntry(scoreKey, updated)], 0) | |
350 | 366 | } | |
351 | 367 | else $Tuple2(nil, 0) | |
352 | 368 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let DEFAULTLOCATION = "Africa_F_Africa" | |
5 | 5 | ||
6 | 6 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | let lastTourIdKey = "%s__lastTourId" | |
13 | 13 | ||
14 | 14 | func keyTourStaticDataById (tId) = ("%s%d__tourStaticData__" + toString(tId)) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyTourDynamicDataById (tId) = ("%s%d__tourDynamicData__" + toString(tId)) | |
18 | 18 | ||
19 | 19 | ||
20 | - | func keyAllRegistrantsByTour (tId) = ("%s%d__allRegistrants__" + toString(tId)) | |
20 | + | func keyScoreBoardByTour (tId) = ("%s%d__scoreBoard__" + toString(tId)) | |
21 | + | ||
22 | + | ||
23 | + | func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId) | |
24 | + | ||
25 | + | ||
26 | + | func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], "__") | |
27 | + | ||
28 | + | ||
29 | + | func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], "__") | |
30 | + | ||
31 | + | ||
32 | + | func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], "__") | |
21 | 33 | ||
22 | 34 | ||
23 | 35 | let idxStatic = 0 | |
24 | 36 | ||
25 | 37 | let idxDynamic = 1 | |
26 | 38 | ||
27 | 39 | func getTourData (tourContract,tId) = { | |
28 | 40 | let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__") | |
29 | 41 | let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__") | |
30 | 42 | [static, dynamic] | |
31 | 43 | } | |
32 | 44 | ||
33 | 45 | ||
34 | 46 | let tStaticRegisterCost = 2 | |
35 | 47 | ||
36 | 48 | let tStaticAttemptCost = 3 | |
37 | 49 | ||
38 | 50 | let tStaticStart = 5 | |
39 | 51 | ||
40 | 52 | let tStaticEnd = 6 | |
41 | 53 | ||
42 | 54 | let tDynamicStatus = 1 | |
43 | 55 | ||
44 | 56 | let tDynamicWinDuck = 2 | |
45 | 57 | ||
46 | 58 | let tDynamicWinResult = 3 | |
47 | 59 | ||
48 | 60 | let tDynamicTotalRegCount = 4 | |
49 | 61 | ||
50 | 62 | let tDynamicTotalAttempts = 5 | |
51 | 63 | ||
52 | 64 | let locIdxContinent = 0 | |
53 | 65 | ||
54 | 66 | let locIdxType = 1 | |
55 | 67 | ||
56 | 68 | let locIdxId = 2 | |
57 | - | ||
58 | - | func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId) | |
59 | - | ||
60 | - | ||
61 | - | func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], "__") | |
62 | - | ||
63 | - | ||
64 | - | func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], "__") | |
65 | - | ||
66 | - | ||
67 | - | func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], "__") | |
68 | - | ||
69 | 69 | ||
70 | 70 | let chain = take(drop(this.bytes, 1), 1) | |
71 | 71 | ||
72 | 72 | let defaultRestAddressStr = match chain { | |
73 | 73 | case _ => | |
74 | 74 | if ((base58'2W' == $match0)) | |
75 | 75 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
76 | 76 | else if ((base58'2T' == $match0)) | |
77 | 77 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
78 | 78 | else throw("Unknown chain") | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | let SEP = "__" | |
82 | 82 | ||
83 | 83 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | let IdxCfgStakingDapp = 1 | |
87 | 87 | ||
88 | 88 | let IdxCfgWlgDapp = 4 | |
89 | 89 | ||
90 | 90 | func keyRestCfg () = "%s__restConfig" | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func keyRestAddress () = "%s__restAddr" | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
103 | 103 | ||
104 | 104 | let restCfg = readRestCfgOrFail(restContract) | |
105 | 105 | ||
106 | 106 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
107 | 107 | ||
108 | 108 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
109 | 109 | ||
110 | 110 | let wlgAssetIdKey = "wlg_assetId" | |
111 | 111 | ||
112 | 112 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet") | |
113 | 113 | ||
114 | 114 | func asString (v) = match v { | |
115 | 115 | case s: String => | |
116 | 116 | s | |
117 | 117 | case _ => | |
118 | 118 | throw("fail to cast into String") | |
119 | 119 | } | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func asInt (v) = match v { | |
123 | 123 | case n: Int => | |
124 | 124 | n | |
125 | 125 | case _ => | |
126 | 126 | throw("fail to cast into Int") | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func fixedPoint (val,decimals) = { | |
131 | 131 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
132 | 132 | let lowPart = toString((val % tenPow)) | |
133 | 133 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
134 | 134 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
135 | + | } | |
136 | + | ||
137 | + | ||
138 | + | func padL (val,len) = { | |
139 | + | let valS = toString(val) | |
140 | + | let zeroes = drop(toString(pow(10, 0, (len - size(valS)), 0, 0, DOWN)), 1) | |
141 | + | (zeroes + valS) | |
135 | 142 | } | |
136 | 143 | ||
137 | 144 | ||
138 | 145 | let MAXTOURNAMENTLENGTH = 432000000 | |
139 | 146 | ||
140 | 147 | let HOUR = 3600000 | |
141 | 148 | ||
142 | 149 | let adminsList = [toString(this), match chain { | |
143 | 150 | case _ => | |
144 | 151 | if ((base58'2W' == $match0)) | |
145 | 152 | then "3PEe2RELUHCFCBsmSCNcBJ8N3URLVQende7" | |
146 | 153 | else if ((base58'2T' == $match0)) | |
147 | 154 | then "3MtBgJTaLxPB3C7UJD1UE8qjkHthfKvFQYY" | |
148 | 155 | else throw("Unknown chain") | |
149 | 156 | }] | |
150 | 157 | ||
151 | 158 | func staticData (txId,registerCost,attemptCost,creationTime,startTime,endTime) = makeString(["%s%d%d%d%d%d", txId, toString(registerCost), toString(attemptCost), toString(creationTime), toString(startTime), toString(endTime)], SEP) | |
152 | 159 | ||
153 | 160 | ||
154 | 161 | func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP) | |
155 | 162 | ||
156 | 163 | ||
157 | 164 | func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil)) | |
158 | 165 | ||
159 | 166 | ||
160 | 167 | func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked") | |
161 | 168 | ||
162 | 169 | ||
163 | 170 | @Callable(i) | |
164 | 171 | func createTournament (startTime,endTime,registerCost,attemptCost) = { | |
165 | 172 | let caller = toString(i.caller) | |
166 | 173 | if (!(containsElement(adminsList, caller))) | |
167 | 174 | then throw("Permission denied") | |
168 | 175 | else { | |
169 | 176 | let lastId = getInteger(lastTourIdKey) | |
170 | 177 | let tId = if (isDefined(lastId)) | |
171 | 178 | then { | |
172 | 179 | let lastTourId = value(lastId) | |
173 | 180 | let dynamic = valueOrErrorMessage(getString(keyTourDynamicDataById(lastTourId)), (("Error reading tournament " + toString(lastTourId)) + " data")) | |
174 | 181 | let status = split(dynamic, SEP)[tDynamicStatus] | |
175 | 182 | if ((status != "ARCHIVED")) | |
176 | 183 | then throw(("Current tournement is not completed, status=" + status)) | |
177 | 184 | else (lastTourId + 1) | |
178 | 185 | } | |
179 | 186 | else 1 | |
180 | 187 | let now = lastBlock.timestamp | |
181 | 188 | if ((now > startTime)) | |
182 | 189 | then throw(((("startTime=" + toString(startTime)) + " < creationTime=") + toString(now))) | |
183 | 190 | else if ((startTime > endTime)) | |
184 | 191 | then throw(((("endTime=" + toString(endTime)) + " < startTime=") + toString(startTime))) | |
185 | 192 | else if (((endTime - startTime) > MAXTOURNAMENTLENGTH)) | |
186 | 193 | then throw(((("Tournament period exceeds max: " + toString((endTime - startTime))) + " > ") + toString(MAXTOURNAMENTLENGTH))) | |
187 | 194 | else if (if ((0 >= registerCost)) | |
188 | 195 | then true | |
189 | 196 | else (0 >= attemptCost)) | |
190 | 197 | then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost))) | |
191 | 198 | else $Tuple2([IntegerEntry(lastTourIdKey, tId), StringEntry(keyTourStaticDataById(tId), staticData(toBase58String(i.transactionId), registerCost, attemptCost, now, startTime, endTime)), StringEntry(keyTourDynamicDataById(tId), dynamicData("CREATED", " ", 0, 0, 0))], tId) | |
192 | 199 | } | |
193 | 200 | } | |
194 | 201 | ||
195 | 202 | ||
196 | 203 | ||
197 | 204 | @Callable(i) | |
198 | 205 | func register () = { | |
199 | 206 | let prologResult = prolog() | |
200 | 207 | if ((size(i.payments) != 1)) | |
201 | 208 | then throw("exactly 1 payment must be attached") | |
202 | 209 | else { | |
203 | 210 | let pmt = i.payments[0] | |
204 | 211 | let wlgAmt = pmt.amount | |
205 | 212 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!") | |
206 | 213 | if ((pmtAssetId != wlgAssetId)) | |
207 | 214 | then throw("WLGOLD payments only!") | |
208 | 215 | else { | |
209 | 216 | let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments") | |
210 | 217 | let now = lastBlock.timestamp | |
211 | 218 | let tData = getTourData(this, lastId) | |
212 | 219 | let static = tData[idxStatic] | |
213 | 220 | let dynamic = tData[idxDynamic] | |
214 | 221 | let status = dynamic[tDynamicStatus] | |
215 | 222 | if (!(if (if (if ((status == "CREATED")) | |
216 | 223 | then (now > parseIntValue(static[tStaticStart])) | |
217 | 224 | else false) | |
218 | 225 | then ((parseIntValue(static[tStaticEnd]) - HOUR) > now) | |
219 | 226 | else false) | |
220 | 227 | then true | |
221 | 228 | else if ((status == "INPROGRESS")) | |
222 | 229 | then ((parseIntValue(static[tStaticEnd]) - HOUR) > now) | |
223 | 230 | else false)) | |
224 | 231 | then throw("Cannot register now") | |
225 | 232 | else { | |
226 | 233 | let regCost = parseIntValue(static[tStaticRegisterCost]) | |
227 | 234 | if ((wlgAmt != regCost)) | |
228 | 235 | then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD")) | |
229 | 236 | else { | |
230 | 237 | let duckAssetId = duckByCaller(i.originCaller) | |
231 | - | let oldRegistrants = valueOrElse(getString(keyAllRegistrantsByTour(lastId)), "") | |
232 | - | let regList = if ((oldRegistrants == "")) | |
233 | - | then nil | |
234 | - | else split_51C(oldRegistrants, "_") | |
238 | + | let oldScoreBoard = valueOrElse(getString(keyScoreBoardByTour(lastId)), "") | |
235 | 239 | if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)) | |
236 | 240 | then true | |
237 | - | else | |
241 | + | else contains(oldScoreBoard, duckAssetId)) | |
238 | 242 | then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId))) | |
239 | 243 | else { | |
240 | 244 | let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts])) | |
241 | - | $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyAllRegistrantsByTour(lastId), makeString_11C((regList :+ duckAssetId), "_")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult) | |
245 | + | $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyScoreBoardByTour(lastId), if ((oldScoreBoard == "")) | |
246 | + | then (duckAssetId + ":000") | |
247 | + | else (((oldScoreBoard + "_") + duckAssetId) + ":000")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult) | |
242 | 248 | } | |
243 | 249 | } | |
244 | 250 | } | |
245 | 251 | } | |
246 | 252 | } | |
247 | 253 | } | |
248 | 254 | ||
249 | 255 | ||
250 | 256 | ||
251 | 257 | @Callable(i) | |
252 | 258 | func newAttempt () = { | |
253 | 259 | let prologResult = prolog() | |
254 | 260 | let duckAssetId = duckByCaller(i.originCaller) | |
255 | 261 | let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments") | |
256 | 262 | let now = lastBlock.timestamp | |
257 | 263 | let tData = getTourData(this, lastId) | |
258 | 264 | let static = tData[idxStatic] | |
259 | 265 | let dynamic = tData[idxDynamic] | |
260 | 266 | let status = dynamic[tDynamicStatus] | |
261 | 267 | if (!(if ((status == "INPROGRESS")) | |
262 | 268 | then ((parseIntValue(static[tStaticEnd]) - HOUR) > now) | |
263 | 269 | else false)) | |
264 | 270 | then throw("Attempt is not possible") | |
265 | 271 | else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false))) | |
266 | 272 | then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId))) | |
267 | 273 | else { | |
268 | 274 | let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId) | |
269 | 275 | let lastAttempt = getInteger(attemptsIteratorKey) | |
270 | - | let $ | |
276 | + | let $t059246556 = if (!(isDefined(lastAttempt))) | |
271 | 277 | then $Tuple2(0, 0) | |
272 | 278 | else if ((size(i.payments) != 1)) | |
273 | 279 | then throw("exactly 1 payment must be attached") | |
274 | 280 | else { | |
275 | 281 | let pmt = i.payments[0] | |
276 | 282 | let wlgAmt = pmt.amount | |
277 | 283 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!") | |
278 | 284 | if ((pmtAssetId != wlgAssetId)) | |
279 | 285 | then throw("WLGOLD payments only!") | |
280 | 286 | else { | |
281 | 287 | let attCost = parseIntValue(static[tStaticAttemptCost]) | |
282 | 288 | if ((wlgAmt != attCost)) | |
283 | 289 | then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD")) | |
284 | 290 | else $Tuple2((value(lastAttempt) + 1), 1) | |
285 | 291 | } | |
286 | 292 | } | |
287 | - | let payedAttempts = $ | |
288 | - | let increment = $ | |
293 | + | let payedAttempts = $t059246556._1 | |
294 | + | let increment = $t059246556._2 | |
289 | 295 | let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment)) | |
290 | 296 | let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_") | |
291 | 297 | let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId) | |
292 | 298 | let best = if (if ((curLocation[locIdxType] == "T")) | |
293 | 299 | then (parseIntValue(curLocation[locIdxContinent]) == lastId) | |
294 | 300 | else false) | |
295 | 301 | then { | |
296 | 302 | let bestResult = valueOrElse(getInteger(bestResultKey), 0) | |
297 | 303 | let curResult = parseIntValue(curLocation[locIdxId]) | |
298 | 304 | max([bestResult, curResult]) | |
299 | 305 | } | |
300 | 306 | else 0 | |
301 | 307 | let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil)) | |
302 | 308 | $Tuple2([IntegerEntry(bestResultKey, best), IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc]) | |
303 | 309 | } | |
304 | 310 | } | |
305 | 311 | ||
306 | 312 | ||
307 | 313 | ||
308 | 314 | @Callable(i) | |
309 | 315 | func updateDynamicData (duckAssetId,newBest) = if ((i.caller != stakingContract)) | |
310 | 316 | then throw("Access denied") | |
311 | 317 | else { | |
312 | 318 | let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments") | |
313 | 319 | let tData = getTourData(this, lastId) | |
314 | 320 | let static = tData[idxStatic] | |
315 | 321 | let dynamic = tData[idxDynamic] | |
316 | 322 | if (if (if ((parseIntValue(dynamic[tDynamicWinResult]) >= newBest)) | |
317 | 323 | then true | |
318 | 324 | else (dynamic[tDynamicStatus] != "INPROGRESS")) | |
319 | 325 | then true | |
320 | 326 | else (lastBlock.timestamp > parseIntValue(static[tStaticEnd]))) | |
321 | 327 | then $Tuple2(nil, 0) | |
322 | 328 | else { | |
323 | 329 | let updatedDynamicData = dynamicData("INPROGRESS", duckAssetId, newBest, parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts])) | |
324 | 330 | $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], 0) | |
325 | 331 | } | |
326 | 332 | } | |
327 | 333 | ||
328 | 334 | ||
329 | 335 | ||
330 | 336 | @Callable(i) | |
331 | 337 | func saveDuckResult (duckAssetId,newBest) = if ((i.caller != stakingContract)) | |
332 | 338 | then throw("Access denied") | |
333 | 339 | else { | |
334 | 340 | let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments") | |
335 | 341 | let tData = getTourData(this, lastId) | |
336 | 342 | let static = tData[idxStatic] | |
337 | 343 | let dynamic = tData[idxDynamic] | |
338 | 344 | let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_") | |
339 | 345 | let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId) | |
340 | 346 | if (if (if (if ((curLocation[locIdxType] == "T")) | |
341 | 347 | then (parseIntValue(curLocation[locIdxContinent]) == lastId) | |
342 | 348 | else false) | |
343 | 349 | then (dynamic[tDynamicStatus] == "INPROGRESS") | |
344 | 350 | else false) | |
345 | 351 | then (parseIntValue(static[tStaticEnd]) >= lastBlock.timestamp) | |
346 | 352 | else false) | |
347 | 353 | then { | |
348 | 354 | let oldBestResult = valueOrElse(getInteger(bestResultKey), 0) | |
349 | - | $Tuple2([IntegerEntry(bestResultKey, max([oldBestResult, newBest]))], 0) | |
355 | + | let scoreKey = keyScoreBoardByTour(lastId) | |
356 | + | let oldScoreBoard = valueOrElse(getString(scoreKey), "") | |
357 | + | let updated = if ((newBest > oldBestResult)) | |
358 | + | then if (!(contains(oldScoreBoard, duckAssetId))) | |
359 | + | then throw(("scoreBoard does not contain " + duckAssetId)) | |
360 | + | else { | |
361 | + | let parts = split_51C(oldScoreBoard, duckAssetId) | |
362 | + | ((((parts[0] + duckAssetId) + ":") + padL(newBest, 3)) + drop(parts[1], 4)) | |
363 | + | } | |
364 | + | else oldScoreBoard | |
365 | + | $Tuple2([IntegerEntry(bestResultKey, max([oldBestResult, newBest])), StringEntry(scoreKey, updated)], 0) | |
350 | 366 | } | |
351 | 367 | else $Tuple2(nil, 0) | |
352 | 368 | } | |
353 | 369 | ||
354 | 370 | ||
355 | 371 | ||
356 | 372 | @Callable(i) | |
357 | 373 | func finishTournament (tId) = { | |
358 | 374 | let caller = toString(i.caller) | |
359 | 375 | if (!(containsElement(adminsList, caller))) | |
360 | 376 | then throw("Permission denied") | |
361 | 377 | else { | |
362 | 378 | let tData = getTourData(this, tId) | |
363 | 379 | let dynamic = tData[idxDynamic] | |
364 | 380 | let status = dynamic[tDynamicStatus] | |
365 | 381 | if ((status == "ARCHIVED")) | |
366 | 382 | then throw((("Tournament " + toString(tId)) + " is already ARCHIVED")) | |
367 | 383 | else { | |
368 | 384 | let updatedDynamicData = dynamicData("ARCHIVED", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts])) | |
369 | 385 | $Tuple2([StringEntry(keyTourDynamicDataById(tId), updatedDynamicData)], 0) | |
370 | 386 | } | |
371 | 387 | } | |
372 | 388 | } | |
373 | 389 | ||
374 | 390 |
github/deemru/w8io/026f985 53.91 ms ◑