tx · Dxmmapjih7X6uXGeptDJPXbQAP5KbF5nViKqnTLqRAXk

3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk:  -0.01000000 Waves

2021.10.15 00:49 [1746502] smart account 3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk > SELF 0.00000000 Waves

{ "type": 13, "id": "Dxmmapjih7X6uXGeptDJPXbQAP5KbF5nViKqnTLqRAXk", "fee": 1000000, "feeAssetId": null, "timestamp": 1634248162978, "version": 2, "chainId": 84, "sender": "3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk", "senderPublicKey": "8v9pmcXqHz9DTc5k1Z8duTYyDwykFxN3EzdZ9WAn3KXJ", "proofs": [ "5eiqno5QwYseWxwvPsG3GYNXUmUuPbLB4h7xSsKDo67u5wNLNH4gBpwDw4scQV5DpdUjGQckMBS4zupNb32hzErP" ], "script": "base64:AAIDAAAAAAAAAAgIARIECgIBAQAAAAcAAAAADWdhbWVOdW1iZXJLZXkCAAAADCRHQU1FX05VTUJFUgAAAAALbGFzdFBsYXlLZXkCAAAACiRMQVNUX1BMQVkAAAAAA1dPTgAAAAAAAAAAAQAAAAAETE9TRQAAAAAAAAAAAgEAAAAKcGF5b3V0Y2FsYwAAAAEAAAAGbnVtYmVyBAAAAAVob3VzZQAAAAAAAAAABgQAAAAEYmFzZQAAAAAAAAAnEAkAAGkAAAACCQAAaAAAAAIFAAAABGJhc2UJAABpAAAAAgkAAGUAAAACAAAAAAAAAABkAAAAAAAAAAAGAAAAAAAAAABkBQAAAAZudW1iZXIBAAAACnJhbmRvbWl6ZXIAAAABAAAAAWkEAAAACGxhc3RQbGF5BAAAAAckbWF0Y2gwCQAEHAAAAAIFAAAABHRoaXMFAAAAC2xhc3RQbGF5S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0AQ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QEAAAAKcGF5b3V0Y2FsYwAAAAEJAABkAAAAAgkAAGUAAAACBQAAAAhndWVzc0VuZAUAAAAKZ3Vlc3NTdGFydAAAAAAAAAAAAQAAAAAAAAAAZAUAAAAEdW5pdAUAAAADbmlsBAAAAANzdHIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAAaQAAAABBQAAAANXT04CAAAABl9MT1NFXwUAAAANdHJhbnNhY3Rpb25JZAIAAAABXwUAAAAHZ2FtZUtleQIAAAABXwkAAaQAAAABBQAAAApndWVzc1N0YXJ0AgAAAAEtCQABpAAAAAEFAAAACGd1ZXNzRW5kAgAAAAFfCQABpAAAAAEFAAAABHJhbmQEAAAADXdyaXRlTGFzdFBsYXkJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAC2xhc3RQbGF5S2V5BQAAAARyYW5kCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAdnYW1lS2V5BQAAAANzdHIJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAADWdhbWVOdW1iZXJLZXkJAABkAAAAAgUAAAAGZ2FtZUlkAAAAAAAAAAABBQAAAANuaWwJAQAAAAxTY3JpcHRSZXN1bHQAAAACBQAAAA13cml0ZUxhc3RQbGF5CQEAAAALVHJhbnNmZXJTZXQAAAABBQAAAANuaWwAAAABAAAAAWkBAAAACXplcm8yaGVybwAAAAIAAAAKZ3Vlc3NTdGFydAAAAAhndWVzc0VuZAkBAAAACnN0YXJ0TG90dG8AAAADBQAAAAFpBQAAAApndWVzc1N0YXJ0BQAAAAhndWVzc0VuZAAAAABUQHCh", "height": 1746502, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E8cM5giqzw6mscXVhAKh8GjhGNrHukmGYcMWNwMN9tn7 Next: 9zyoZV4p2Zr3MGLcHxtstmu74XuMaaVpxxTzSVyzc19Q Diff:
OldNewDifferences
6262 case _ =>
6363 throw("Match error")
6464 }
65+ let gameKey = ((callerAddress + "_") + toString(gameId))
6566 if (if (((guessEnd + 1) > rand))
6667 then (rand > (guessStart - 1))
6768 else false)
6869 then {
69- let str = ((((((((((((toString(WON) + "_WON_") + transactionId) + "_") + callerAddress) + "_") + toString(gameId)) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
70- let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry((callerAddress + toString(gameId)), str), DataEntry(gameNumberKey, (gameId + 1))])
70+ let str = ((((((((((toString(WON) + "_WON_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
71+ let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
7172 ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(i.caller, ((payment.amount * payoutcalc(((guessEnd - guessStart) + 1))) / 100), unit)]))
7273 }
7374 else {
74- let str = ((((((((((((toString(WON) + "_LOSE_") + transactionId) + "_") + callerAddress) + "_") + toString(gameId)) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
75- let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry((callerAddress + toString(gameId)), str), DataEntry(gameNumberKey, (gameId + 1))])
75+ let str = ((((((((((toString(WON) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
76+ let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
7677 ScriptResult(writeLastPlay, TransferSet(nil))
7778 }
7879 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let gameNumberKey = "$GAME_NUMBER"
55
66 let lastPlayKey = "$LAST_PLAY"
77
88 let WON = 1
99
1010 let LOSE = 2
1111
1212 func payoutcalc (number) = {
1313 let house = 6
1414 let base = 10000
1515 ((base * ((100 - 6) / 100)) / number)
1616 }
1717
1818
1919 func randomizer (i) = {
2020 let lastPlay = match getBinary(this, lastPlayKey) {
2121 case s: ByteVector =>
2222 s
2323 case _: Unit =>
2424 base58'2ee4oFDYriWJ9EMeR'
2525 case _ =>
2626 throw("Match error")
2727 }
2828 let rand = (((((lastPlay + i.transactionId) + i.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
2929 sha256(rand)
3030 }
3131
3232
3333 func startLotto (i,guessStart,guessEnd) = {
3434 let playLimit = (wavesBalance(this) / 100)
3535 let payment = extract(i.payment)
3636 if (!(isDefined(i.payment)))
3737 then throw("Should be with Payment in Waves")
3838 else if (isDefined(payment.assetId))
3939 then throw("Payment should be in Waves")
4040 else if ((payment.amount > playLimit))
4141 then throw(("Payment should be less than " + toString(playLimit)))
4242 else if ((0 > guessStart))
4343 then throw("guessStart and guessEnd Must be in between 0-99")
4444 else if ((guessEnd > 99))
4545 then throw("guessStart and guessEnd Must be in between 0-99")
4646 else if ((guessStart > guessEnd))
4747 then throw("guessStart and guessEnd Must be in between 0-99")
4848 else if ((5 > ((guessEnd - guessStart) + 1)))
4949 then throw("guessStart and guessEnd Must be at least 5 apart")
5050 else if ((((guessEnd - guessStart) + 1) > 95))
5151 then throw("guessStart and guessEnd Must not be at least 95 apart")
5252 else {
5353 let callerAddress = toBase58String(i.caller.bytes)
5454 let transactionId = toBase58String(i.transactionId)
5555 let randhash = randomizer(i)
5656 let rand = (toInt(randhash) % 100)
5757 let gameId = match getInteger(this, gameNumberKey) {
5858 case a: Int =>
5959 a
6060 case _: Unit =>
6161 1
6262 case _ =>
6363 throw("Match error")
6464 }
65+ let gameKey = ((callerAddress + "_") + toString(gameId))
6566 if (if (((guessEnd + 1) > rand))
6667 then (rand > (guessStart - 1))
6768 else false)
6869 then {
69- let str = ((((((((((((toString(WON) + "_WON_") + transactionId) + "_") + callerAddress) + "_") + toString(gameId)) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
70- let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry((callerAddress + toString(gameId)), str), DataEntry(gameNumberKey, (gameId + 1))])
70+ let str = ((((((((((toString(WON) + "_WON_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
71+ let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
7172 ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(i.caller, ((payment.amount * payoutcalc(((guessEnd - guessStart) + 1))) / 100), unit)]))
7273 }
7374 else {
74- let str = ((((((((((((toString(WON) + "_LOSE_") + transactionId) + "_") + callerAddress) + "_") + toString(gameId)) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
75- let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry((callerAddress + toString(gameId)), str), DataEntry(gameNumberKey, (gameId + 1))])
75+ let str = ((((((((((toString(WON) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
76+ let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
7677 ScriptResult(writeLastPlay, TransferSet(nil))
7778 }
7879 }
7980 }
8081
8182
8283 @Callable(i)
8384 func zero2hero (guessStart,guessEnd) = startLotto(i, guessStart, guessEnd)
8485
8586

github/deemru/w8io/169f3d6 
61.54 ms