tx · J7AfqSYcbRhSbR7ip51YqxyajwJKRiQxaA5XQtE9PLCE

3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk:  -0.01000000 Waves

2021.10.15 21:56 [1747777] smart account 3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk > SELF 0.00000000 Waves

{ "type": 13, "id": "J7AfqSYcbRhSbR7ip51YqxyajwJKRiQxaA5XQtE9PLCE", "fee": 1000000, "feeAssetId": null, "timestamp": 1634324192900, "version": 2, "chainId": 84, "sender": "3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk", "senderPublicKey": "8v9pmcXqHz9DTc5k1Z8duTYyDwykFxN3EzdZ9WAn3KXJ", "proofs": [ "4CyrzAZmvo7XMpL5X1BQiTqakuM17kqCrTmuaty3qZvsAeBBKJAoC1BbrjGT86DcKRMMWEQnwvMvdwinbkrvR8mk" ], "script": "base64:AAIDAAAAAAAAAA0IARIECgIBARIDCgEBAAAACAAAAAANZ2FtZU51bWJlcktleQIAAAAMJEdBTUVfTlVNQkVSAAAAAAtsYXN0UGxheUtleQIAAAAKJExBU1RfUExBWQAAAAAHdGVzdEtleQIAAAAFJFRFU1QAAAAAA1dPTgAAAAAAAAAAAQAAAAAETE9TRQAAAAAAAAAAAgEAAAAKcGF5b3V0Y2FsYwAAAAEAAAAGbnVtYmVyBAAAAAVob3VzZQAAAAAAAAAABgQAAAAEYmFzZQAAAAAAAAAnEAQAAAAEcmF0ZQkAAGkAAAACCQAAaAAAAAIFAAAABGJhc2UJAABlAAAAAgAAAAAAAAAAZAAAAAAAAAAABgkAAGgAAAACBQAAAAZudW1iZXIAAAAAAAAAAGQFAAAABHJhdGUBAAAACnJhbmRvbWl6ZXIAAAABAAAAAWkEAAAACGxhc3RQbGF5BAAAAAckbWF0Y2gwCQAEHAAAAAIFAAAABHRoaXMFAAAAC2xhc3RQbGF5S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQ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AAAAQUAAAADbmlsCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgUAAAANd3JpdGVMYXN0UGxheQkBAAAAC1RyYW5zZmVyU2V0AAAAAQUAAAADbmlsAAAAAgAAAAFpAQAAAAl6ZXJvMmhlcm8AAAACAAAACmd1ZXNzU3RhcnQAAAAIZ3Vlc3NFbmQJAQAAAApzdGFydExvdHRvAAAAAwUAAAABaQUAAAAKZ3Vlc3NTdGFydAUAAAAIZ3Vlc3NFbmQAAAABaQEAAAALcGF5b3V0Y2FsY3QAAAABAAAABm51bWJlcgQAAAAEcmF0ZQkBAAAACnBheW91dGNhbGMAAAABBQAAAAZudW1iZXIJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAd0ZXN0S2V5CQABpAAAAAEFAAAABHJhdGUFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQUAAAADbmlsAAAAAAZAb1E=", "height": 1747777, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9zyoZV4p2Zr3MGLcHxtstmu74XuMaaVpxxTzSVyzc19Q Next: BdjfNv5LHc8LHdxmBA8YmhMP9J2gbvSABq65Ht9BaP89 Diff:
OldNewDifferences
1414 func payoutcalc (number) = {
1515 let house = 6
1616 let base = 10000
17- ((base * ((100 - 6) / 100)) / number)
17+ let rate = ((base * (100 - 6)) / (number * 100))
18+ rate
1819 }
1920
2021
7071 else false)
7172 then {
7273 let str = ((((((((((toString(WON) + "_WON_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
73- let payoutRate = (payoutcalc(((guessEnd - guessStart) + 1)) / 100)
74- let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1)), DataEntry(testKey, ((toString(payoutRate) + "_") + toString((payment.amount * payoutRate))))])
75- ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(i.caller, ((payment.amount * payoutcalc(((guessEnd - guessStart) + 1))) / 100), unit)]))
74+ let payoutRate = payoutcalc(((guessEnd - guessStart) + 1))
75+ let transferAmount = ((payment.amount * payoutRate) / 100)
76+ let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1)), DataEntry(testKey, ((((toString(payoutRate) + "_") + toString(payment.amount)) + "_") + toString(transferAmount)))])
77+ ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(i.caller, transferAmount, unit)]))
7678 }
7779 else {
7880 let str = ((((((((((toString(WON) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
8789 func zero2hero (guessStart,guessEnd) = startLotto(i, guessStart, guessEnd)
8890
8991
92+
93+@Callable(i)
94+func payoutcalct (number) = {
95+ let rate = payoutcalc(number)
96+ ScriptResult(WriteSet([DataEntry(testKey, toString(rate))]), TransferSet(nil))
97+ }
98+
99+
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
17- ((base * ((100 - 6) / 100)) / number)
17+ let rate = ((base * (100 - 6)) / (number * 100))
18+ rate
1819 }
1920
2021
2122 func randomizer (i) = {
2223 let lastPlay = match getBinary(this, lastPlayKey) {
2324 case s: ByteVector =>
2425 s
2526 case _: Unit =>
2627 base58'2ee4oFDYriWJ9EMeR'
2728 case _ =>
2829 throw("Match error")
2930 }
3031 let rand = (((((lastPlay + i.transactionId) + i.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
3132 sha256(rand)
3233 }
3334
3435
3536 func startLotto (i,guessStart,guessEnd) = {
3637 let playLimit = (wavesBalance(this) / 100)
3738 let payment = extract(i.payment)
3839 if (!(isDefined(i.payment)))
3940 then throw("Should be with Payment in Waves")
4041 else if (isDefined(payment.assetId))
4142 then throw("Payment should be in Waves")
4243 else if ((payment.amount > playLimit))
4344 then throw(("Payment should be less than " + toString(playLimit)))
4445 else if ((0 > guessStart))
4546 then throw("guessStart and guessEnd Must be in between 0-99")
4647 else if ((guessEnd > 99))
4748 then throw("guessStart and guessEnd Must be in between 0-99")
4849 else if ((guessStart > guessEnd))
4950 then throw("guessStart and guessEnd Must be in between 0-99")
5051 else if ((5 > ((guessEnd - guessStart) + 1)))
5152 then throw("guessStart and guessEnd Must be at least 5 apart")
5253 else if ((((guessEnd - guessStart) + 1) > 95))
5354 then throw("guessStart and guessEnd Must not be at least 95 apart")
5455 else {
5556 let callerAddress = toBase58String(i.caller.bytes)
5657 let transactionId = toBase58String(i.transactionId)
5758 let randhash = randomizer(i)
5859 let rand = (toInt(randhash) % 100)
5960 let gameId = match getInteger(this, gameNumberKey) {
6061 case a: Int =>
6162 a
6263 case _: Unit =>
6364 1
6465 case _ =>
6566 throw("Match error")
6667 }
6768 let gameKey = ((callerAddress + "_") + toString(gameId))
6869 if (if (((guessEnd + 1) > rand))
6970 then (rand > (guessStart - 1))
7071 else false)
7172 then {
7273 let str = ((((((((((toString(WON) + "_WON_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
73- let payoutRate = (payoutcalc(((guessEnd - guessStart) + 1)) / 100)
74- let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1)), DataEntry(testKey, ((toString(payoutRate) + "_") + toString((payment.amount * payoutRate))))])
75- ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(i.caller, ((payment.amount * payoutcalc(((guessEnd - guessStart) + 1))) / 100), unit)]))
74+ let payoutRate = payoutcalc(((guessEnd - guessStart) + 1))
75+ let transferAmount = ((payment.amount * payoutRate) / 100)
76+ let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1)), DataEntry(testKey, ((((toString(payoutRate) + "_") + toString(payment.amount)) + "_") + toString(transferAmount)))])
77+ ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(i.caller, transferAmount, unit)]))
7678 }
7779 else {
7880 let str = ((((((((((toString(WON) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
7981 let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
8082 ScriptResult(writeLastPlay, TransferSet(nil))
8183 }
8284 }
8385 }
8486
8587
8688 @Callable(i)
8789 func zero2hero (guessStart,guessEnd) = startLotto(i, guessStart, guessEnd)
8890
8991
92+
93+@Callable(i)
94+func payoutcalct (number) = {
95+ let rate = payoutcalc(number)
96+ ScriptResult(WriteSet([DataEntry(testKey, toString(rate))]), TransferSet(nil))
97+ }
98+
99+

github/deemru/w8io/169f3d6 
38.11 ms