tx · 5PKEzJMoznYB9BQfDbpA4uLt2FX9qiM2hDxpSp4f65Mu 3N1J3hv1b83NFk17ez6fyjTMhtCFtkwH3vM: -0.01000000 Waves 2022.09.24 23:59 [2243723] smart account 3N1J3hv1b83NFk17ez6fyjTMhtCFtkwH3vM > SELF 0.00000000 Waves
{ "type": 13, "id": "5PKEzJMoznYB9BQfDbpA4uLt2FX9qiM2hDxpSp4f65Mu", "fee": 1000000, "feeAssetId": null, "timestamp": 1664053185725, "version": 2, "chainId": 84, "sender": "3N1J3hv1b83NFk17ez6fyjTMhtCFtkwH3vM", "senderPublicKey": "EsDjVby9WbYrc3jCUwjSr8AugVCytkKm779FYwWrehM7", "proofs": [ "tgDK8JjkDgA7SBkH5QW77HUqoscRrxgGDUWtVC2fcP5sEmkJkT7WfZx4Z7MJRihKkmiuy6xvBvE9AuaYaow3qK8" ], "script": "base64:BgI1CAISAwoBCBIAEgMKAQgSBgoECAEBCBIECgIICBIFCgMICAESAwoBCBIAEgUKAwgICBIAEgAeAAV3YXZlcwCAwtcvAA50aWNrZXRQcmljZUludADAhD0AC3RpY2tldFByaWNlBQ50aWNrZXRQcmljZUludAAGaW52RmVlAKDCHgASd2l0aGRyYXdGZWVQZXJjZW50AAUAFmZlZUNvbGxlY3RvckFkZHJlc3NLZXkCE2ZlZUNvbGxlY3RvckFkZHJlc3MADmRlcG9zaXRBc3NldElkAiw1dWUxZml1VjZqNlVCcjZYZjI4UW1zNnk1RnF6S3RxdmF4eGh3dTdoVFE1OAENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtYXRjaDAFAWIAAAESZ2V0VGlja2V0c0NvdW50S2V5AQ1hZGRyZXNzU3RyaW5nCQCsAgIFDWFkZHJlc3NTdHJpbmcCDV90aWNrZXRzQ291bnQBHXRpY2tldEZvclRvdXJuYW1lbnRGb3JBY2NvdW50Agx0b3VybmFtZW50SWQ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2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXm8O9jE", "height": 2243723, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let waves = 100000000 | |
5 | + | ||
6 | + | let ticketPriceInt = 1000000 | |
7 | + | ||
8 | + | let ticketPrice = ticketPriceInt | |
9 | + | ||
10 | + | let invFee = 500000 | |
11 | + | ||
12 | + | let withdrawFeePercent = 5 | |
13 | + | ||
14 | + | let feeCollectorAddressKey = "feeCollectorAddress" | |
15 | + | ||
16 | + | let depositAssetId = "5ue1fiuV6j6UBr6Xf28Qms6y5FqzKtqvaxxhwu7hTQ58" | |
17 | + | ||
18 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
19 | + | case b: Int => | |
20 | + | b | |
21 | + | case _ => | |
22 | + | 0 | |
23 | + | } | |
24 | + | ||
25 | + | ||
26 | + | func getTicketsCountKey (addressString) = (addressString + "_ticketsCount") | |
27 | + | ||
28 | + | ||
29 | + | func ticketForTournamentForAccount (tournamentId,account) = ((tournamentId + "_ticketForAccount_") + account) | |
30 | + | ||
31 | + | ||
32 | + | func tournamentPrizeAmountKey (tournamentId) = (tournamentId + "_tournamentPrizeAmount") | |
33 | + | ||
34 | + | ||
35 | + | func tournamentMaxPlayersCountKey (tournamentId) = (tournamentId + "_tournamentMaxPlayersCount") | |
36 | + | ||
37 | + | ||
38 | + | func tournamentPlayersCountKey (tournamentId) = (tournamentId + "_tournamentPlayersCount") | |
39 | + | ||
40 | + | ||
41 | + | func tournamentPrizeAssetIdKey (tournamentId) = (tournamentId + "_tournamentPrizeAssetId") | |
42 | + | ||
43 | + | ||
44 | + | func tournamentPrizeAssetNameKey (tournamentId) = (tournamentId + "_tournamentPrizeAssetName") | |
45 | + | ||
46 | + | ||
47 | + | func tournamentBuyInAmountKey (tournamentId) = (tournamentId + "_tournamentBuyInAmount") | |
48 | + | ||
49 | + | ||
50 | + | func tournamentBuyInAssetIdKey (tournamentId) = (tournamentId + "_tournamentBuyInAssetId") | |
51 | + | ||
52 | + | ||
53 | + | func tournamentBuyInAssetNameKey (tournamentId) = (tournamentId + "_tournamentBuyInAssetName") | |
54 | + | ||
55 | + | ||
56 | + | func tournamentBuyInAssetDecimalsKey (tournamentId) = (tournamentId + "_tournamentBuyInAssetDecimals") | |
57 | + | ||
58 | + | ||
59 | + | func tournamentPrizeAssetDecimalsKey (tournamentId) = (tournamentId + "_tournamentPrizeAssetDecimals") | |
60 | + | ||
61 | + | ||
62 | + | func tournamentStatusKey (tournamentId) = (tournamentId + "_tournamentStatus") | |
63 | + | ||
64 | + | ||
65 | + | func tournamentWinningTransactionIdKey (tournamentId) = (tournamentId + "_tournamentWinningTransactionId") | |
66 | + | ||
67 | + | ||
68 | + | func gameWinnerKey (gameId) = (gameId + "_winner") | |
69 | + | ||
70 | + | ||
71 | + | func addressAvailableFundsKey (address) = (address + "_availableFunds") | |
72 | + | ||
73 | + | ||
74 | + | func addressTotalLockedFundsKey (address) = (address + "_totalLockedFunds") | |
75 | + | ||
76 | + | ||
77 | + | func addressLockedFundsTotalHistoryKey (address) = (address + "_lockedFundsTotalHistory") | |
78 | + | ||
79 | + | ||
80 | + | func addressLockedFundsForGameKey (address,gameId) = ((address + "_lockedFunds_") + gameId) | |
81 | + | ||
82 | + | ||
83 | + | func addressAvailableRewardsKey (address) = (address + "_availableRewards") | |
84 | + | ||
85 | + | ||
86 | + | func getTicketsCount (addressString) = tryGetInteger(getTicketsCountKey(addressString)) | |
87 | + | ||
88 | + | ||
89 | + | func consumeTicket (playerAddr) = { | |
90 | + | let currentTicketCount = getTicketsCount(playerAddr) | |
91 | + | let newCurrentTicketCount = (currentTicketCount - 1) | |
92 | + | if ((0 > newCurrentTicketCount)) | |
93 | + | then 0 | |
94 | + | else newCurrentTicketCount | |
95 | + | } | |
96 | + | ||
97 | + | ||
98 | + | @Callable(i) | |
99 | + | func setFeeCollectorAddress (collectorAddr) = if ((i.caller != this)) | |
100 | + | then throw("Admin Only") | |
101 | + | else [StringEntry(feeCollectorAddressKey, collectorAddr)] | |
102 | + | ||
103 | + | ||
104 | + | ||
105 | + | @Callable(i) | |
106 | + | func depositFunds () = { | |
107 | + | let pmt = if ((size(i.payments) == 1)) | |
108 | + | then i.payments[0] | |
109 | + | else throw("Please attach exactly one payment") | |
110 | + | if ((pmt.assetId != fromBase58String(depositAssetId))) | |
111 | + | then throw("You can only deposit USDN") | |
112 | + | else { | |
113 | + | let callerAddrStr = toBase58String(i.caller.bytes) | |
114 | + | let currentAvailableFunds = tryGetInteger(addressAvailableFundsKey(callerAddrStr)) | |
115 | + | $Tuple2([IntegerEntry(addressAvailableFundsKey(callerAddrStr), (currentAvailableFunds + pmt.amount))], 1) | |
116 | + | } | |
117 | + | } | |
118 | + | ||
119 | + | ||
120 | + | ||
121 | + | @Callable(i) | |
122 | + | func signUpToTournament (tournamentId) = { | |
123 | + | let maxPlayersCount = getIntegerValue(this, tournamentMaxPlayersCountKey(tournamentId)) | |
124 | + | let alreadyRegisteredPlayersCount = tryGetInteger(tournamentPlayersCountKey(tournamentId)) | |
125 | + | let tournamentStatus = getStringValue(tournamentStatusKey(tournamentId)) | |
126 | + | if ((tournamentStatus != "registration")) | |
127 | + | then throw("Tournament is not in registration phase!") | |
128 | + | else if ((alreadyRegisteredPlayersCount == maxPlayersCount)) | |
129 | + | then throw("Tournament is currently full, please try again later!") | |
130 | + | else { | |
131 | + | let pmt = if ((size(i.payments) == 1)) | |
132 | + | then i.payments[0] | |
133 | + | else throw("Please attach exactly one payment") | |
134 | + | let buyInAssetid = match pmt.assetId { | |
135 | + | case b: Unit => | |
136 | + | "" | |
137 | + | case b: ByteVector => | |
138 | + | toBase58String(b) | |
139 | + | case _ => | |
140 | + | throw("Match error") | |
141 | + | } | |
142 | + | let buyInRequiredAmount = getIntegerValue(this, tournamentBuyInAmountKey(tournamentId)) | |
143 | + | let buyInRequiredAssetId = getStringValue(this, tournamentBuyInAssetIdKey(tournamentId)) | |
144 | + | if ((buyInRequiredAmount != pmt.amount)) | |
145 | + | then throw(("Attached payment amount is invalid, must be " + toString(buyInRequiredAmount))) | |
146 | + | else if ((buyInRequiredAssetId != buyInAssetid)) | |
147 | + | then throw(("Attached payment asset id is invalid, must be " + buyInRequiredAssetId)) | |
148 | + | else { | |
149 | + | let callerAddrStr = toBase58String(i.caller.bytes) | |
150 | + | $Tuple2([BooleanEntry(ticketForTournamentForAccount(tournamentId, callerAddrStr), true), IntegerEntry(tournamentPlayersCountKey(tournamentId), (alreadyRegisteredPlayersCount + 1))], 1) | |
151 | + | } | |
152 | + | } | |
153 | + | } | |
154 | + | ||
155 | + | ||
156 | + | ||
157 | + | @Callable(i) | |
158 | + | func createTournament (tournamentId,playersCount,buyInAmount,buyInAssetId) = { | |
159 | + | let pmt = if ((size(i.payments) == 1)) | |
160 | + | then i.payments[0] | |
161 | + | else throw("Please attach exactly one payment") | |
162 | + | let prizeAssetId = match pmt.assetId { | |
163 | + | case b: Unit => | |
164 | + | "" | |
165 | + | case b: ByteVector => | |
166 | + | toBase58String(b) | |
167 | + | case _ => | |
168 | + | throw("Match error") | |
169 | + | } | |
170 | + | let assetDetails = match pmt.assetId { | |
171 | + | case b: Unit => | |
172 | + | ["Waves", 8] | |
173 | + | case b: ByteVector => | |
174 | + | match assetInfo(b) { | |
175 | + | case asset: Asset => | |
176 | + | [asset.name, asset.decimals] | |
177 | + | case _ => | |
178 | + | throw("Can't find asset") | |
179 | + | } | |
180 | + | case _ => | |
181 | + | throw("Match error") | |
182 | + | } | |
183 | + | let buyInAsset = match assetInfo(fromBase58String(buyInAssetId)) { | |
184 | + | case asset: Asset => | |
185 | + | [asset.name, asset.decimals] | |
186 | + | case _ => | |
187 | + | ["", 0] | |
188 | + | } | |
189 | + | $Tuple2([IntegerEntry(tournamentPrizeAmountKey(tournamentId), pmt.amount), IntegerEntry(tournamentMaxPlayersCountKey(tournamentId), playersCount), StringEntry(tournamentPrizeAssetIdKey(tournamentId), prizeAssetId), StringEntry(tournamentPrizeAssetNameKey(tournamentId), { | |
190 | + | let @ = assetDetails[0] | |
191 | + | if ($isInstanceOf(@, "String")) | |
192 | + | then @ | |
193 | + | else throw(($getType(assetDetails[0]) + " couldn't be cast to String")) | |
194 | + | }), IntegerEntry(tournamentPrizeAssetDecimalsKey(tournamentId), { | |
195 | + | let @ = assetDetails[1] | |
196 | + | if ($isInstanceOf(@, "Int")) | |
197 | + | then @ | |
198 | + | else throw(($getType(assetDetails[1]) + " couldn't be cast to Int")) | |
199 | + | }), StringEntry(tournamentStatusKey(tournamentId), "registration"), IntegerEntry(tournamentBuyInAmountKey(tournamentId), buyInAmount), StringEntry(tournamentBuyInAssetNameKey(tournamentId), { | |
200 | + | let @ = buyInAsset[0] | |
201 | + | if ($isInstanceOf(@, "String")) | |
202 | + | then @ | |
203 | + | else throw(($getType(buyInAsset[0]) + " couldn't be cast to String")) | |
204 | + | }), IntegerEntry(tournamentBuyInAssetDecimalsKey(tournamentId), { | |
205 | + | let @ = buyInAsset[1] | |
206 | + | if ($isInstanceOf(@, "Int")) | |
207 | + | then @ | |
208 | + | else throw(($getType(buyInAsset[1]) + " couldn't be cast to Int")) | |
209 | + | }), StringEntry(tournamentBuyInAssetIdKey(tournamentId), buyInAssetId)], 1) | |
210 | + | } | |
211 | + | ||
212 | + | ||
213 | + | ||
214 | + | @Callable(i) | |
215 | + | func finishTournament (tournamentId,winningTransfertTransactionId) = if ((i.caller != this)) | |
216 | + | then throw("Admin Only") | |
217 | + | else $Tuple2([StringEntry(tournamentWinningTransactionIdKey(tournamentId), winningTransfertTransactionId), StringEntry(tournamentStatusKey(tournamentId), "finished")], 1) | |
218 | + | ||
219 | + | ||
220 | + | ||
221 | + | @Callable(i) | |
222 | + | func playerExitGame (gameId,playerAddr,exitStackAmount) = if ((i.caller != this)) | |
223 | + | then throw("Admin Only") | |
224 | + | else { | |
225 | + | let currentTotalLockedFunds = tryGetInteger(addressTotalLockedFundsKey(playerAddr)) | |
226 | + | let currentGameLockedAmountForPlayer = tryGetInteger(addressLockedFundsForGameKey(playerAddr, gameId)) | |
227 | + | $Tuple2([IntegerEntry(addressTotalLockedFundsKey(playerAddr), (currentTotalLockedFunds - currentGameLockedAmountForPlayer)), IntegerEntry(addressLockedFundsForGameKey(playerAddr, gameId), 0), ScriptTransfer(addressFromStringValue(playerAddr), exitStackAmount, fromBase58String(depositAssetId))], 1) | |
228 | + | } | |
229 | + | ||
230 | + | ||
231 | + | ||
232 | + | @Callable(i) | |
233 | + | func lockFundsForGame (gameId) = { | |
234 | + | let pmt = if ((size(i.payments) == 1)) | |
235 | + | then i.payments[0] | |
236 | + | else throw("Please attach exactly one payment") | |
237 | + | if ((pmt.assetId != fromBase58String(depositAssetId))) | |
238 | + | then throw("You can only deposit USDN") | |
239 | + | else { | |
240 | + | let callerAddrStr = toBase58String(i.caller.bytes) | |
241 | + | let currentTotalLockedFunds = tryGetInteger(addressTotalLockedFundsKey(callerAddrStr)) | |
242 | + | let currentLockedFundsTotalHistory = tryGetInteger(addressLockedFundsTotalHistoryKey(callerAddrStr)) | |
243 | + | $Tuple2([IntegerEntry(addressTotalLockedFundsKey(callerAddrStr), (currentTotalLockedFunds + pmt.amount)), IntegerEntry(addressLockedFundsTotalHistoryKey(callerAddrStr), (currentLockedFundsTotalHistory + pmt.amount)), IntegerEntry(addressLockedFundsForGameKey(callerAddrStr, gameId), pmt.amount)], 1) | |
244 | + | } | |
245 | + | } | |
246 | + | ||
247 | + | ||
248 | + | ||
249 | + | @Callable(i) | |
250 | + | func withdrawFunds () = { | |
251 | + | let callerAddrStr = toBase58String(i.caller.bytes) | |
252 | + | let feeCollectorAddr = addressFromStringValue(getStringValue(feeCollectorAddressKey)) | |
253 | + | let currentAvailableFunds = tryGetInteger(addressAvailableFundsKey(callerAddrStr)) | |
254 | + | let withdrawFee = fraction(currentAvailableFunds, withdrawFeePercent, 100) | |
255 | + | let actualAvailableFunds = (currentAvailableFunds - withdrawFee) | |
256 | + | if ((0 >= actualAvailableFunds)) | |
257 | + | then throw("No available funds to withdraw") | |
258 | + | else [IntegerEntry(addressAvailableFundsKey(callerAddrStr), 0), ScriptTransfer(i.caller, actualAvailableFunds, fromBase58String(depositAssetId)), ScriptTransfer(feeCollectorAddr, withdrawFee, fromBase58String(depositAssetId))] | |
259 | + | } | |
260 | + | ||
261 | + | ||
262 | + | ||
263 | + | @Callable(i) | |
264 | + | func setWinnerHeadsUp (gameId,winnerAddrStr,otherPlayerAddr) = if ((i.caller != this)) | |
265 | + | then throw("Admin Only") | |
266 | + | else { | |
267 | + | let availableRewardsKey = addressAvailableRewardsKey(winnerAddrStr) | |
268 | + | let currentAvailableRewards = tryGetInteger(availableRewardsKey) | |
269 | + | let newTicketCountWinner = consumeTicket(winnerAddrStr) | |
270 | + | let newTicketCountOtherPlayer = consumeTicket(otherPlayerAddr) | |
271 | + | [StringEntry(gameWinnerKey(gameId), winnerAddrStr), IntegerEntry(availableRewardsKey, (currentAvailableRewards + (ticketPrice * 2))), IntegerEntry(getTicketsCountKey(winnerAddrStr), newTicketCountWinner), IntegerEntry(getTicketsCountKey(otherPlayerAddr), newTicketCountOtherPlayer)] | |
272 | + | } | |
273 | + | ||
274 | + | ||
275 | + | ||
276 | + | @Callable(i) | |
277 | + | func withdrawRewards () = { | |
278 | + | let callerAddrStr = toBase58String(i.caller.bytes) | |
279 | + | let feeCollectorAddr = addressFromStringValue(getStringValue(feeCollectorAddressKey)) | |
280 | + | let currentAvailableRewards = tryGetInteger(addressAvailableRewardsKey(callerAddrStr)) | |
281 | + | let withdrawFee = fraction(currentAvailableRewards, withdrawFeePercent, 100) | |
282 | + | let actualAvailableRewards = ((currentAvailableRewards - invFee) - withdrawFee) | |
283 | + | if ((0 >= currentAvailableRewards)) | |
284 | + | then throw("No available rewards to withdraw") | |
285 | + | else [IntegerEntry(addressAvailableRewardsKey(callerAddrStr), 0), ScriptTransfer(i.caller, actualAvailableRewards, unit), ScriptTransfer(feeCollectorAddr, withdrawFee, unit)] | |
286 | + | } | |
287 | + | ||
288 | + | ||
289 | + | ||
290 | + | @Callable(i) | |
291 | + | func buyTickets () = { | |
292 | + | let pmt = if ((size(i.payments) == 1)) | |
293 | + | then i.payments[0] | |
294 | + | else throw("Please attach exactly one payment") | |
295 | + | if (isDefined(pmt.assetId)) | |
296 | + | then throw("Tickets can only ibe purchased in Waves") | |
297 | + | else if ((pmt.amount != ticketPrice)) | |
298 | + | then throw((("The payment must be of exactly " + toString(ticketPriceInt)) + " waves")) | |
299 | + | else { | |
300 | + | let callerAddrStr = toBase58String(i.caller.bytes) | |
301 | + | let currentTicketsCount = tryGetInteger(getTicketsCountKey(callerAddrStr)) | |
302 | + | $Tuple2([IntegerEntry(getTicketsCountKey(callerAddrStr), (currentTicketsCount + 1))], 1) | |
303 | + | } | |
304 | + | } | |
305 | + | ||
306 | + | ||
307 | + | @Verifier(tx) | |
308 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
309 | + |
github/deemru/w8io/026f985 23.74 ms ◑