tx · BdjfNv5LHc8LHdxmBA8YmhMP9J2gbvSABq65Ht9BaP89

3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk:  -0.01000000 Waves

2021.10.18 00:13 [1750797] smart account 3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk > SELF 0.00000000 Waves

{ "type": 13, "id": "BdjfNv5LHc8LHdxmBA8YmhMP9J2gbvSABq65Ht9BaP89", "fee": 1000000, "feeAssetId": null, "timestamp": 1634505219208, "version": 2, "chainId": 84, "sender": "3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk", "senderPublicKey": "8v9pmcXqHz9DTc5k1Z8duTYyDwykFxN3EzdZ9WAn3KXJ", "proofs": [ "29jkVd7u1udambnk6YXGQgPDap3fjDLXckR3Z9n2PbSvi1RiSVFnV4w5w4KpDJrKoRHGctVvmihgQ19YB6kTv4PU" ], "script": "base64:AAIDAAAAAAAAAA0IARIECgIBARIDCgEBAAAACAAAAAANZ2FtZU51bWJlcktleQIAAAAMJEdBTUVfTlVNQkVSAAAAAAtsYXN0UGxheUtleQIAAAAKJExBU1RfUExBWQAAAAAHdGVzdEtleQIAAAAFJFRFU1QAAAAAA1dPTgAAAAAAAAAAAQAAAAAETE9TRQAAAAAAAAAAAgEAAAAKcGF5b3V0Y2FsYwAAAAEAAAAGbnVtYmVyBAAAAAVob3VzZQAAAAAAAAAABgQAAAAEYmFzZQAAAAAAAAAnEAQAAAAEcmF0ZQkAAGkAAAACCQAAaAAAAAIFAAAABGJhc2UJAABlAAAAAgAAAAAAAAAAZAAAAAAAAAAABgkAAGgAAAACBQAAAAZudW1iZXIAAAAAAAAAAGQFAAAABHJhdGUBAAAACnJhbmRvbWl6ZXIAAAABAAAAAWkEAAAACGxhc3RQbGF5BAAAAAckbWF0Y2gwCQAEHAAAAAIFAAAABHRoaXMFAAAAC2xhc3RQbGF5S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQAA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AAAAAAAEFAAAAA25pbAkBAAAADFNjcmlwdFJlc3VsdAAAAAIFAAAADXdyaXRlTGFzdFBsYXkJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAIAAAABaQEAAAAJemVybzJoZXJvAAAAAgAAAApndWVzc1N0YXJ0AAAACGd1ZXNzRW5kCQEAAAAKc3RhcnRMb3R0bwAAAAMFAAAAAWkFAAAACmd1ZXNzU3RhcnQFAAAACGd1ZXNzRW5kAAAAAWkBAAAAC3BheW91dGNhbGN0AAAAAQAAAAZudW1iZXIEAAAABHJhdGUJAQAAAApwYXlvdXRjYWxjAAAAAQUAAAAGbnVtYmVyCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAHdGVzdEtleQkAAaQAAAABBQAAAARyYXRlBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAD+hKh3", "height": 1750797, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J7AfqSYcbRhSbR7ip51YqxyajwJKRiQxaA5XQtE9PLCE Next: AVqsbv3hRTW93NmnvgHpyaDiJQxM9bige3iMXM2G4XVC Diff:
OldNewDifferences
7777 ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(i.caller, transferAmount, unit)]))
7878 }
7979 else {
80- let str = ((((((((((toString(WON) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
80+ let str = ((((((((((toString(LOSE) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
8181 let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
8282 ScriptResult(writeLastPlay, TransferSet(nil))
8383 }
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 testKey = "$TEST"
99
1010 let WON = 1
1111
1212 let LOSE = 2
1313
1414 func payoutcalc (number) = {
1515 let house = 6
1616 let base = 10000
1717 let rate = ((base * (100 - 6)) / (number * 100))
1818 rate
1919 }
2020
2121
2222 func randomizer (i) = {
2323 let lastPlay = match getBinary(this, lastPlayKey) {
2424 case s: ByteVector =>
2525 s
2626 case _: Unit =>
2727 base58'2ee4oFDYriWJ9EMeR'
2828 case _ =>
2929 throw("Match error")
3030 }
3131 let rand = (((((lastPlay + i.transactionId) + i.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
3232 sha256(rand)
3333 }
3434
3535
3636 func startLotto (i,guessStart,guessEnd) = {
3737 let playLimit = (wavesBalance(this) / 100)
3838 let payment = extract(i.payment)
3939 if (!(isDefined(i.payment)))
4040 then throw("Should be with Payment in Waves")
4141 else if (isDefined(payment.assetId))
4242 then throw("Payment should be in Waves")
4343 else if ((payment.amount > playLimit))
4444 then throw(("Payment should be less than " + toString(playLimit)))
4545 else if ((0 > guessStart))
4646 then throw("guessStart and guessEnd Must be in between 0-99")
4747 else if ((guessEnd > 99))
4848 then throw("guessStart and guessEnd Must be in between 0-99")
4949 else if ((guessStart > guessEnd))
5050 then throw("guessStart and guessEnd Must be in between 0-99")
5151 else if ((5 > ((guessEnd - guessStart) + 1)))
5252 then throw("guessStart and guessEnd Must be at least 5 apart")
5353 else if ((((guessEnd - guessStart) + 1) > 95))
5454 then throw("guessStart and guessEnd Must not be at least 95 apart")
5555 else {
5656 let callerAddress = toBase58String(i.caller.bytes)
5757 let transactionId = toBase58String(i.transactionId)
5858 let randhash = randomizer(i)
5959 let rand = (toInt(randhash) % 100)
6060 let gameId = match getInteger(this, gameNumberKey) {
6161 case a: Int =>
6262 a
6363 case _: Unit =>
6464 1
6565 case _ =>
6666 throw("Match error")
6767 }
6868 let gameKey = ((callerAddress + "_") + toString(gameId))
6969 if (if (((guessEnd + 1) > rand))
7070 then (rand > (guessStart - 1))
7171 else false)
7272 then {
7373 let str = ((((((((((toString(WON) + "_WON_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
7474 let payoutRate = payoutcalc(((guessEnd - guessStart) + 1))
7575 let transferAmount = ((payment.amount * payoutRate) / 100)
7676 let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1)), DataEntry(testKey, ((((toString(payoutRate) + "_") + toString(payment.amount)) + "_") + toString(transferAmount)))])
7777 ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(i.caller, transferAmount, unit)]))
7878 }
7979 else {
80- let str = ((((((((((toString(WON) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
80+ let str = ((((((((((toString(LOSE) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
8181 let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
8282 ScriptResult(writeLastPlay, TransferSet(nil))
8383 }
8484 }
8585 }
8686
8787
8888 @Callable(i)
8989 func zero2hero (guessStart,guessEnd) = startLotto(i, guessStart, guessEnd)
9090
9191
9292
9393 @Callable(i)
9494 func payoutcalct (number) = {
9595 let rate = payoutcalc(number)
9696 ScriptResult(WriteSet([DataEntry(testKey, toString(rate))]), TransferSet(nil))
9797 }
9898
9999

github/deemru/w8io/169f3d6 
59.97 ms