tx · 71bAeZXJKHVw8VATmnqsfXWPbpJ8FsWr6j6swtPXvfHP

3N6yFJ5Z8NUUQvfGGMLp5efmevRRtTgQuun:  -0.01400000 Waves

2019.09.17 04:06 [679543] smart account 3N6yFJ5Z8NUUQvfGGMLp5efmevRRtTgQuun > SELF 0.00000000 Waves

{ "type": 13, "id": "71bAeZXJKHVw8VATmnqsfXWPbpJ8FsWr6j6swtPXvfHP", "fee": 1400000, "feeAssetId": null, "timestamp": 1568682420856, "version": 1, "sender": "3N6yFJ5Z8NUUQvfGGMLp5efmevRRtTgQuun", "senderPublicKey": "7uRSDXQUkUS7719CDA4wXghhzsWrF22gb18FGDPZyA6P", "proofs": [ "4xZTjUqZ91fwu2XC6nfnAp4Ac8MM19iNntWdedoF1yBSETYfWmDS96PtyUfJjHP4AvvsyHVssAoFdkz4FFB2qwoo" ], "script": "base64:AAIDAAAAAAAAAAAAAAASAAAAAAlXaW5TZXJ2ZXIJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQIAAAAjM045WG55UHBXeFlvaEtIN3o1ZEV1cThycG5vYnB5elByekUAAAAAB1dBVkVMRVQJAABoAAAAAgkAAGgAAAACAAAAAAAAAABkAAAAAAAAAAPoAAAAAAAAAAPoAAAAAApDT01NSVNTSU9OCQAAaQAAAAIJAABoAAAAAgAAAAAAAAAABQUAAAAHV0FWRUxFVAAAAAAAAAAD6AAAAAAOVGlja2V0c1BlcldhdmUAAAAAAAAAAGQAAAAAC0NVUlJFTlRHQU1FAgAAAA0kQ1VSUkVOVF9HQU1FAAAAAA9HQU1FU0NPVU5URVJLRVkCAAAACSRHQU1FX05VTQAAAAAKTEFTVFRJQ0tFVAIAAAAMJExBU1RfVElDS0VUAAAAAARCQU5LAgAAAAokR0FNRV9CQU5LAQAAAA5nZXRQbGF5ZXJzTGlzdAAAAAIAAAAGZ2FtZUlkAAAADWN1cnJlbnRQbGF5ZXIEAAAAEHBsYXllcnNQcmVzZW50ZWQJAQA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kAASwAAAACBQAAAAZnYW1lSWQCAAAAAV8FAAAAEHBsYXllckFkZHJlc3NTdHICAAAACl9iZXRzQ291bnQJAABkAAAAAgkBAAAAEmdldFBsYXllckJldHNDb3VudAAAAAIFAAAABmdhbWVJZAUAAAAQcGxheWVyQWRkcmVzc1N0cgAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAGZ2FtZUlkAgAAAAFfBQAAABBwbGF5ZXJBZGRyZXNzU3RyAgAAAA1fdG90YWxCZXRzQW10BQAAABVuZXdUb3RhbFBsYXllckJldHNBbXQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAGZ2FtZUlkAgAAAAhfcGxheWVycwkBAAAADmdldFBsYXllcnNMaXN0AAAAAgUAAAAGZ2FtZUlkBQAAABBwbGF5ZXJBZGRyZXNzU3RyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAGZ2FtZUlkAgAAAAFfBQAAAARCQU5LBQAAAA5uZXdCYW5rQmFsYW5jZQUAAAADbmlsBAAAAAt0b1dpblNlcnZlcgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlXaW5TZXJ2ZXIFAAAACnBheW1lbnRBbXQFAAAABHVuaXQFAAAAA25pbAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEFAAAAB2JldERhdGEJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAC3RvV2luU2VydmVyAAAAAAJmzWg=", "chainId": 84, "height": 679543, "spentComplexity": 0 } View: original | compacted Prev: 5Art3AvCP9Y6E6JTsguRqCBLVCh1Hem5XJrTdwnvF7g1 Next: 4UF2aAB8sUf8ueTmvxf7LGSBmdhBWR9G6W2JyaDU684m Diff:
OldNewDifferences
134134
135135 @Callable(i)
136136 func resetGameData (gameId) = {
137- let playerPubKey58 = toBase58String(i.callerPublicKey)
138- let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
139- let playerAddressStr = toString(playerAddress)
140- let zeroData = [DataEntry(CURRENTGAME, ""), DataEntry(GAMESCOUNTERKEY, 0), DataEntry((((gameId + "_") + playerAddressStr) + "_tickets"), ""), DataEntry((((gameId + "_") + playerAddressStr) + "_betsCount"), 0), DataEntry((((gameId + "_") + playerAddressStr) + "_totalBetsAmt"), 0), DataEntry(((gameId + "_") + BANK), 0), DataEntry((gameId + "_players"), ""), DataEntry(LASTTICKET, 0)]
137+ let zeroData = [DataEntry(CURRENTGAME, ""), DataEntry(LASTTICKET, 0)]
141138 WriteSet(zeroData)
142139 }
143140
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let WinServer = addressFromStringValue("3N9XnyPpWxYohKH7z5dEuq8rpnobpyzPrzE")
55
66 let WAVELET = ((100 * 1000) * 1000)
77
88 let COMMISSION = ((5 * WAVELET) / 1000)
99
1010 let TicketsPerWave = 100
1111
1212 let CURRENTGAME = "$CURRENT_GAME"
1313
1414 let GAMESCOUNTERKEY = "$GAME_NUM"
1515
1616 let LASTTICKET = "$LAST_TICKET"
1717
1818 let BANK = "$GAME_BANK"
1919
2020 func getPlayersList (gameId,currentPlayer) = {
2121 let playersPresented = isDefined(getString(this, (gameId + "_players")))
2222 if (!(playersPresented))
2323 then currentPlayer
2424 else if (isDefined(getString(this, (((gameId + "_") + currentPlayer) + "_tickets"))))
2525 then getStringValue(this, (gameId + "_players"))
2626 else ((getStringValue(this, (gameId + "_players")) + "_") + currentPlayer)
2727 }
2828
2929
3030 func getOrCreateLastTicket () = {
3131 let isLastTicketPresented = isDefined(getInteger(this, LASTTICKET))
3232 if (!(isLastTicketPresented))
3333 then 0
3434 else getIntegerValue(this, LASTTICKET)
3535 }
3636
3737
3838 func getPlayerBetsCount (gameId,playerAddressStr) = {
3939 let betsCount = match getInteger(this, (((gameId + "_") + playerAddressStr) + "_betsCount")) {
4040 case num: Int =>
4141 num
4242 case _ =>
4343 0
4444 }
4545 betsCount
4646 }
4747
4848
4949 func getTickets (gameId,playerAddressStr,paymentAmt) = {
5050 let lastTicket = getOrCreateLastTicket()
5151 let wavesPayment = (paymentAmt / WAVELET)
5252 let firstNewTicket = (lastTicket + 1)
5353 let lastNewTicket = ((firstNewTicket + (wavesPayment * TicketsPerWave)) - 1)
5454 let firstNewTicketStr = toString(firstNewTicket)
5555 let lastNewTicketStr = toString(lastNewTicket)
5656 let ticketsStr = isDefined(getString(this, (((gameId + "_") + playerAddressStr) + "_tickets")))
5757 if (ticketsStr)
5858 then {
5959 let currentTickets = getStringValue(this, (((gameId + "_") + playerAddressStr) + "_tickets"))
6060 let currentPlayerBetNum = getPlayerBetsCount(gameId, playerAddressStr)
6161 let CTL = split(currentTickets, "_")
6262 if ((currentPlayerBetNum == 1))
6363 then (((((((CTL[0] + "_") + CTL[1]) + "_") + firstNewTicketStr) + "_") + lastNewTicketStr) + "_0_0_0_0")
6464 else if ((currentPlayerBetNum == 2))
6565 then (((((((((((CTL[0] + "_") + CTL[1]) + "_") + CTL[2]) + "_") + CTL[3]) + "_") + firstNewTicketStr) + "_") + lastNewTicketStr) + "_0_0")
6666 else if ((currentPlayerBetNum == 3))
6767 then ((((((((((((((CTL[0] + "_") + CTL[1]) + "_") + CTL[2]) + "_") + CTL[3]) + "_") + CTL[4]) + "_") + CTL[5]) + "_") + firstNewTicketStr) + "_") + lastNewTicketStr)
6868 else throw("Error, bid limit exceeded")
6969 }
7070 else (((firstNewTicketStr + "_") + lastNewTicketStr) + "_0_0_0_0_0_0")
7171 }
7272
7373
7474 func getLastTicket (paymentAmt) = {
7575 let lastTicket = getOrCreateLastTicket()
7676 let wavesPayment = (paymentAmt / WAVELET)
7777 (lastTicket + (wavesPayment * TicketsPerWave))
7878 }
7979
8080
8181 func IncrementGameNum (gameId,txId) = {
8282 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
8383 case num: Int =>
8484 num
8585 case _ =>
8686 0
8787 }
8888 if ((gameId == txId))
8989 then (gameNum + 1)
9090 else gameNum
9191 }
9292
9393
9494 func getOrCreateCurrentGame (txId) = {
9595 let isCurrentGamePresented = isDefined(getString(this, CURRENTGAME))
9696 if (!(isCurrentGamePresented))
9797 then txId
9898 else if ((getStringValue(this, CURRENTGAME) == ""))
9999 then txId
100100 else getStringValue(this, CURRENTGAME)
101101 }
102102
103103
104104 func getCurrentGame (txId) = {
105105 let gameId = getOrCreateCurrentGame(txId)
106106 let gameAlreadyPlayed = isDefined(getString(this, (gameId + "_result")))
107107 if (gameAlreadyPlayed)
108108 then txId
109109 else gameId
110110 }
111111
112112
113113 func getBankBalance (gameId,paymentAmt) = {
114114 let bankBalance = match getInteger(this, ((gameId + "_") + BANK)) {
115115 case num: Int =>
116116 num
117117 case _ =>
118118 0
119119 }
120120 (bankBalance + paymentAmt)
121121 }
122122
123123
124124 func getTotalPlayerBetsAmt (gameId,playerAddressStr,paymentAmt) = {
125125 let totalPlayerBets = match getInteger(this, (((gameId + "_") + playerAddressStr) + "_totalBetsAmt")) {
126126 case num: Int =>
127127 num
128128 case _ =>
129129 0
130130 }
131131 (totalPlayerBets + paymentAmt)
132132 }
133133
134134
135135 @Callable(i)
136136 func resetGameData (gameId) = {
137- let playerPubKey58 = toBase58String(i.callerPublicKey)
138- let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
139- let playerAddressStr = toString(playerAddress)
140- let zeroData = [DataEntry(CURRENTGAME, ""), DataEntry(GAMESCOUNTERKEY, 0), DataEntry((((gameId + "_") + playerAddressStr) + "_tickets"), ""), DataEntry((((gameId + "_") + playerAddressStr) + "_betsCount"), 0), DataEntry((((gameId + "_") + playerAddressStr) + "_totalBetsAmt"), 0), DataEntry(((gameId + "_") + BANK), 0), DataEntry((gameId + "_players"), ""), DataEntry(LASTTICKET, 0)]
137+ let zeroData = [DataEntry(CURRENTGAME, ""), DataEntry(LASTTICKET, 0)]
141138 WriteSet(zeroData)
142139 }
143140
144141
145142
146143 @Callable(i)
147144 func bet () = {
148145 let txId = toBase58String(i.transactionId)
149146 let gameId = getCurrentGame(txId)
150147 let gameNum = IncrementGameNum(gameId, txId)
151148 let pmt = extract(i.payment)
152149 let paymentAmt = (pmt.amount - COMMISSION)
153150 let betNotInWaves = isDefined(pmt.assetId)
154151 let feeNotInWaves = isDefined(pmt.assetId)
155152 let playerPubKey58 = toBase58String(i.callerPublicKey)
156153 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
157154 if (betNotInWaves)
158155 then throw("Bet amount must be in Waves")
159156 else if (feeNotInWaves)
160157 then throw("Transaction's fee must be in Waves")
161158 else {
162159 let playerAddressStr = toString(playerAddress)
163160 let newBankBalance = getBankBalance(gameId, paymentAmt)
164161 let newTotalPlayerBetsAmt = getTotalPlayerBetsAmt(gameId, playerAddressStr, paymentAmt)
165162 let betData = [DataEntry(CURRENTGAME, gameId), DataEntry(GAMESCOUNTERKEY, gameNum), DataEntry(LASTTICKET, getLastTicket(paymentAmt)), DataEntry((((gameId + "_") + playerAddressStr) + "_tickets"), getTickets(gameId, playerAddressStr, paymentAmt)), DataEntry((((gameId + "_") + playerAddressStr) + "_betsCount"), (getPlayerBetsCount(gameId, playerAddressStr) + 1)), DataEntry((((gameId + "_") + playerAddressStr) + "_totalBetsAmt"), newTotalPlayerBetsAmt), DataEntry((gameId + "_players"), getPlayersList(gameId, playerAddressStr)), DataEntry(((gameId + "_") + BANK), newBankBalance)]
166163 let toWinServer = [ScriptTransfer(WinServer, paymentAmt, unit)]
167164 ScriptResult(WriteSet(betData), TransferSet(toWinServer))
168165 }
169166 }
170167
171168

github/deemru/w8io/026f985 
35.29 ms