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