tx · DgwParyWMXzWJmSQxmDSPSYto3bfbotMZMz3zgBdWmKd

3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs:  -0.01400000 Waves

2019.09.08 04:27 [666446] smart account 3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs > SELF 0.00000000 Waves

{ "type": 13, "id": "DgwParyWMXzWJmSQxmDSPSYto3bfbotMZMz3zgBdWmKd", "fee": 1400000, "feeAssetId": null, "timestamp": 1567906053615, "version": 1, "sender": "3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs", "senderPublicKey": "HSTmdhPrJF81ozDBaqVn8QVtV76oD7gzDfcHPQRdxdwW", "proofs": [ "2RMyPCA4jaWgHoq5TbSYRDfDZsCd8fZAzKPA6iK2oD6yootkA3aj1cRygmBzEWDhZdKrxJ2GJgCVBD6o6yoDSrKi" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAlXaW5TZXJ2ZXIJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQIAAAAjM045WG55UHBXeFlvaEtIN3o1ZEV1cThycG5vYnB5elByekUAAAAAB1dBVkVMRVQJAABoAAAAAgkAAGgAAAACAAAAAAAAAABkAAAAAAAAAAPoAAAAAAAAAAPoAAAAAApDT01NSVNTSU9OCQAAaQAAAAIJAABoAAAAAgAAAAAAAAAABQUAAAAHV0FWRUxFVAAAAAAAAAAD6AAAAAAOVGlja2V0c1BlcldhdmUAAAAAAAAAAGQAAAAAC0NVUlJFTlRHQU1FAgAAAA0kQ1VSUkVOVF9HQU1FAAAAAA9HQU1FU0NPVU5URVJLRVkCAAAACSRHQU1FX05VTQAAAAAKTEFTVFRJQ0tFVAIAAAAMJExBU1RfVElDS0VUAQAAAA5nZXRQbGF5ZXJzTGlzdAAAAAIAAAAGZ2FtZUlkAAAADWN1cnJlbnRQbGF5ZXIEAAAAEHBsYXllcnNQcmVzZW50ZWQJAQAAAAlpc0RlZmluZWQAAAABCQAE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HcGF5bWVudAQAAAAKcGF5bWVudEFtdAgFAAAAA3BtdAAAAAZhbW91bnQEAAAADWJldE5vdEluV2F2ZXMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQEAAAADWZlZU5vdEluV2F2ZXMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQEAAAADnBsYXllclB1YktleTU4CQACWAAAAAEIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQQAAAANcGxheWVyQWRkcmVzcwkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQkAAlkAAAABBQAAAA5wbGF5ZXJQdWJLZXk1OAMFAAAADWJldE5vdEluV2F2ZXMJAAACAAAAAQIAAAAbQmV0IGFtb3VudCBtdXN0IGJlIGluIFdhdmVzAwUAAAANZmVlTm90SW5XYXZlcwkAAAIAAAABAgAAACJUcmFuc2FjdGlvbidzIGZlZSBtdXN0IGJlIGluIFdhdmVzBAAAABBwbGF5ZXJBZGRyZXNzU3RyCQAEJQAAAAEFAAAADXBsYXllckFkZHJlc3MEAAAAB2JldERhdGEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAC0NVUlJFTlRHQU1FBQAAAAZnYW1lSWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAD0dBTUVTQ09VTlRFUktFWQUAAAAHZ2FtZU51bQUAAAADbmlsBAAAAAt0b1dpblNlcnZlcgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlXaW5TZXJ2ZXIFAAAACnBheW1lbnRBbXQFAAAABHVuaXQFAAAAA25pbAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEFAAAAB2JldERhdGEJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAC3RvV2luU2VydmVyAAAAAIiPCCY=", "chainId": 84, "height": 666446, "spentComplexity": 0 } View: original | compacted Prev: MVUGPZee1RjcpRG2xhWt1aemYQJ6jp5AQ43ksEuGa4z Next: DDSQWoYuEzcbQ2WZqy2SiQ7u2DV8RRYjDZdchZUxCMz4 Diff:
OldNewDifferences
9999 then throw("Transaction's fee must be in Waves")
100100 else {
101101 let playerAddressStr = toString(playerAddress)
102- let dbData = [DataEntry("$Player_Address", playerAddressStr)]
103- WriteSet(dbData)
102+ let betData = [DataEntry(CURRENTGAME, gameId), DataEntry(GAMESCOUNTERKEY, gameNum)]
103+ let toWinServer = [ScriptTransfer(WinServer, paymentAmt, unit)]
104+ ScriptResult(WriteSet(betData), TransferSet(toWinServer))
104105 }
105106 }
106107
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 func getPlayersList (gameId,currentPlayer) = {
1919 let playersPresented = isDefined(getString(this, (gameId + "_players")))
2020 if (!(playersPresented))
2121 then currentPlayer
2222 else if (isDefined(getString(this, (((gameId + "_") + currentPlayer) + "_tickets"))))
2323 then getStringValue(this, (gameId + "_players"))
2424 else ((getStringValue(this, (gameId + "_players")) + "_") + currentPlayer)
2525 }
2626
2727
2828 func FormatGameDataParam (p) = {
2929 let s = size(p)
3030 if ((s == 0))
3131 then throw("Parameter size must be greater then 0")
3232 else if ((s > 99))
3333 then throw("Parameter size must be less then 100")
3434 else if ((10 > s))
3535 then (("0" + toString(s)) + p)
3636 else (toString(s) + p)
3737 }
3838
3939
4040 func getTickets (gameId,playerAddressStr,paymentAmt) = {
4141 let lastTicket = getIntegerValue(this, LASTTICKET)
4242 let wavesPayment = (paymentAmt / WAVELET)
4343 let firstNewTicket = (lastTicket + 1)
4444 let lastNewTicket = (firstNewTicket + (wavesPayment * TicketsPerWave))
4545 let newTickets = ((FormatGameDataParam(toString(firstNewTicket)) + "_") + FormatGameDataParam(toString(lastNewTicket)))
4646 let ticketsStr = isDefined(getString(this, (((gameId + "_") + playerAddressStr) + "_tickets")))
4747 if (ticketsStr)
4848 then {
4949 let currentTickets = getStringValue(this, (((gameId + "_") + playerAddressStr) + "_tickets"))
5050 ((currentTickets + " ") + newTickets)
5151 }
5252 else newTickets
5353 }
5454
5555
5656 func getLastTicket (paymentAmt) = {
5757 let lastTicket = getIntegerValue(this, LASTTICKET)
5858 let wavesPayment = (paymentAmt / WAVELET)
5959 (lastTicket + (wavesPayment * TicketsPerWave))
6060 }
6161
6262
6363 func IncrementGameNum (gameId,txId) = if ((gameId == txId))
6464 then {
6565 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
6666 case num: Int =>
6767 num
6868 case _ =>
6969 0
7070 }
7171 toString((gameNum + 1))
7272 }
7373 else toString(getIntegerValue(this, GAMESCOUNTERKEY))
7474
7575
7676 func getCurrentGame (txId) = {
7777 let gameId = getStringValue(this, CURRENTGAME)
7878 let gameStillOpen = isDefined(getString(this, (gameId + "_result")))
7979 if (gameStillOpen)
8080 then gameId
8181 else txId
8282 }
8383
8484
8585 @Callable(i)
8686 func bet () = {
8787 let txId = toBase58String(i.transactionId)
8888 let gameId = getCurrentGame(txId)
8989 let gameNum = IncrementGameNum(gameId, txId)
9090 let pmt = extract(i.payment)
9191 let paymentAmt = pmt.amount
9292 let betNotInWaves = isDefined(pmt.assetId)
9393 let feeNotInWaves = isDefined(pmt.assetId)
9494 let playerPubKey58 = toBase58String(i.callerPublicKey)
9595 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
9696 if (betNotInWaves)
9797 then throw("Bet amount must be in Waves")
9898 else if (feeNotInWaves)
9999 then throw("Transaction's fee must be in Waves")
100100 else {
101101 let playerAddressStr = toString(playerAddress)
102- let dbData = [DataEntry("$Player_Address", playerAddressStr)]
103- WriteSet(dbData)
102+ let betData = [DataEntry(CURRENTGAME, gameId), DataEntry(GAMESCOUNTERKEY, gameNum)]
103+ let toWinServer = [ScriptTransfer(WinServer, paymentAmt, unit)]
104+ ScriptResult(WriteSet(betData), TransferSet(toWinServer))
104105 }
105106 }
106107
107108

github/deemru/w8io/026f985 
38.42 ms