tx · 3xdgn5HftbjmQoJa5ao3AypK5rrSQmkZXK4BjLvajARm

3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs:  -0.01400000 Waves

2019.09.07 02:57 [664898] smart account 3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs > SELF 0.00000000 Waves

{ "type": 13, "id": "3xdgn5HftbjmQoJa5ao3AypK5rrSQmkZXK4BjLvajARm", "fee": 1400000, "feeAssetId": null, "timestamp": 1567814200283, "version": 1, "sender": "3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs", "senderPublicKey": "HSTmdhPrJF81ozDBaqVn8QVtV76oD7gzDfcHPQRdxdwW", "proofs": [ "4JnHnAizazbWmU5YJTm5DfDFYLENFYaLAKbR6NuuXdqj2Fz7s3XkCS6SLCECQboaafNZRUHVNMaFT7RvaGxqGdqe" ], "script": "base64:AAIDAAAAAAAAAAAAAAALAAAAABJTZXJ2ZXJCZXRQdWJsaWNLZXkJAAJZAAAAAQIAAAAsN2ltOWNhaUNtRTRTTDZqVG00S1RpY0hINGJHUGY1djU5cm5mVUEzY0NSRGoAAAAAB1dBVkVMRVQJAABoAAAAAgkAAGgAAAACAAAAAAAAAABkAAAAAAAAAAPoAAAAAAAAAAPoAAAAAApDT01NSVNTSU9OCQAAaQAAAAIJAABoAAAAAgAAAAAAAAAABQUAAAAHV0FWRUxFVAAAAAAAAAAD6AAAAAAOVGlja2V0c1BlcldhdmUAAAAAAAAAAGQAAAAAC0NVUlJFTlRHQU1FAgAAAA0kQ1VSUkVOVF9HQU1FAAAAAA9HQU1FU0NPVU5URVJLRVkCAAAACSRHQU1FX05VTQAAAAAKTEFTVFRJQ0tFVAIAAAAMJExBU1RfVElDS0VUAQAAAA5nZXRQbGF5ZXJzTGlzdAAAAAIAAAAGZ2FtZUlkAAAADWN1cnJlbnRQbGF5ZXIEAAAAEHBsYXllcnNQcmVzZW50ZWQJAQAAAAlpc0RlZmluZWQAAAABCQEAAAARQGV4dHJOYX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ZXREYXRhCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAtDVVJSRU5UR0FNRQUAAAAGZ2FtZUlkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAZnYW1lSWQCAAAAAV8FAAAAEHBsYXllckFkZHJlc3NTdHICAAAACF90aWNrZXRzCQEAAAAKZ2V0VGlja2V0cwAAAAEIBQAAAANwbXQAAAAGYW1vdW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAABmdhbWVJZAIAAAAIX3BsYXllcnMJAQAAAA5nZXRQbGF5ZXJzTGlzdAAAAAIFAAAABmdhbWVJZAUAAAAQcGxheWVyQWRkcmVzc1N0cgUAAAADbmlsCQEAAAAIV3JpdGVTZXQAAAABBQAAAAdiZXREYXRhAAAAAJSzZ/M=", "chainId": 84, "height": 664898, "spentComplexity": 0 } View: original | compacted Prev: 49gdCNhqeTzWhmk5Cbi9Nbko4BbSuwZNXXLt8xyC72L4 Next: 942HiodPA16FECR6g6LttxXovqdhobUs8A6eMdJbab8e Diff:
OldNewDifferences
4646
4747 func getCurrentGame (txId) = {
4848 let gameId = getStringValue(this, CURRENTGAME)
49- if ((gameId == ""))
50- then txId
51- else gameId
49+ let gameStillOpen = isDefined(getString(this, (gameId + "_result")))
50+ if (gameStillOpen)
51+ then gameId
52+ else txId
5253 }
53-
54-
55-@Callable(i)
56-func gameEnd () = {
57- let gameData = [DataEntry(CURRENTGAME, "")]
58- WriteSet(gameData)
59- }
60-
6154
6255
6356 @Callable(i)
6962 let feeNotInWaves = isDefined(pmt.assetId)
7063 let playerPubKey58 = toBase58String(i.callerPublicKey)
7164 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
72- let gameStillOpen = isDefined(getString(this, (gameId + "_result")))
73- if (!(gameStillOpen))
74- then if (betNotInWaves)
75- then throw("Bet amount must be in Waves")
76- else if (feeNotInWaves)
77- then throw("Transaction's fee must be in Waves")
78- else {
79- let playerAddressStr = toString(playerAddress)
80- let betData = [DataEntry(CURRENTGAME, gameId), DataEntry((((gameId + "_") + playerAddressStr) + "_tickets"), getTickets(pmt.amount)), DataEntry((gameId + "_players"), getPlayersList(gameId, playerAddressStr))]
81- WriteSet(betData)
82- }
83- else throw("This game already end, try make bet again")
65+ if (betNotInWaves)
66+ then throw("Bet amount must be in Waves")
67+ else if (feeNotInWaves)
68+ then throw("Transaction's fee must be in Waves")
69+ else {
70+ let playerAddressStr = toString(playerAddress)
71+ let betData = [DataEntry(CURRENTGAME, gameId), DataEntry((((gameId + "_") + playerAddressStr) + "_tickets"), getTickets(pmt.amount)), DataEntry((gameId + "_players"), getPlayersList(gameId, playerAddressStr))]
72+ WriteSet(betData)
73+ }
8474 }
8575
8676
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ServerBetPublicKey = fromBase58String("7im9caiCmE4SL6jTm4KTicHH4bGPf5v59rnfUA3cCRDj")
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(getStringValue(this, (gameId + "_players")))
2020 if (!(playersPresented))
2121 then currentPlayer
2222 else if (isDefined(getStringValue(this, (((gameId + "_") + currentPlayer) + "_tickets"))))
2323 then getStringValue(this, (gameId + "_players"))
2424 else ((getStringValue(this, (gameId + "_players")) + "_") + currentPlayer)
2525 }
2626
2727
2828 func getTickets (paymentAmt) = {
2929 let lastTicket = getIntegerValue(this, LASTTICKET)
3030 let wavesPayment = (paymentAmt / WAVELET)
3131 let tickets = "011_03100__03101_03300__010_010__010_010__010_010"
3232 tickets
3333 }
3434
3535
3636 func IncrementGameNum () = {
3737 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
3838 case num: Int =>
3939 num
4040 case _ =>
4141 0
4242 }
4343 (gameNum + 1)
4444 }
4545
4646
4747 func getCurrentGame (txId) = {
4848 let gameId = getStringValue(this, CURRENTGAME)
49- if ((gameId == ""))
50- then txId
51- else gameId
49+ let gameStillOpen = isDefined(getString(this, (gameId + "_result")))
50+ if (gameStillOpen)
51+ then gameId
52+ else txId
5253 }
53-
54-
55-@Callable(i)
56-func gameEnd () = {
57- let gameData = [DataEntry(CURRENTGAME, "")]
58- WriteSet(gameData)
59- }
60-
6154
6255
6356 @Callable(i)
6457 func bet () = {
6558 let txId = toBase58String(i.transactionId)
6659 let gameId = getCurrentGame(txId)
6760 let pmt = extract(i.payment)
6861 let betNotInWaves = isDefined(pmt.assetId)
6962 let feeNotInWaves = isDefined(pmt.assetId)
7063 let playerPubKey58 = toBase58String(i.callerPublicKey)
7164 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
72- let gameStillOpen = isDefined(getString(this, (gameId + "_result")))
73- if (!(gameStillOpen))
74- then if (betNotInWaves)
75- then throw("Bet amount must be in Waves")
76- else if (feeNotInWaves)
77- then throw("Transaction's fee must be in Waves")
78- else {
79- let playerAddressStr = toString(playerAddress)
80- let betData = [DataEntry(CURRENTGAME, gameId), DataEntry((((gameId + "_") + playerAddressStr) + "_tickets"), getTickets(pmt.amount)), DataEntry((gameId + "_players"), getPlayersList(gameId, playerAddressStr))]
81- WriteSet(betData)
82- }
83- else throw("This game already end, try make bet again")
65+ if (betNotInWaves)
66+ then throw("Bet amount must be in Waves")
67+ else if (feeNotInWaves)
68+ then throw("Transaction's fee must be in Waves")
69+ else {
70+ let playerAddressStr = toString(playerAddress)
71+ let betData = [DataEntry(CURRENTGAME, gameId), DataEntry((((gameId + "_") + playerAddressStr) + "_tickets"), getTickets(pmt.amount)), DataEntry((gameId + "_players"), getPlayersList(gameId, playerAddressStr))]
72+ WriteSet(betData)
73+ }
8474 }
8575
8676

github/deemru/w8io/026f985 
34.77 ms