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