tx · C5rXC9w7saky9tsPD7H7USp8u1FsNR86eQdUj6qQgn2S

3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk:  -0.01000000 Waves

2021.10.14 21:40 [1746321] smart account 3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk > SELF 0.00000000 Waves

{ "type": 13, "id": "C5rXC9w7saky9tsPD7H7USp8u1FsNR86eQdUj6qQgn2S", "fee": 1000000, "feeAssetId": null, "timestamp": 1634236905958, "version": 2, "chainId": 84, "sender": "3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk", "senderPublicKey": "8v9pmcXqHz9DTc5k1Z8duTYyDwykFxN3EzdZ9WAn3KXJ", "proofs": [ "5DaVQjU8bVq1wTG2Pq83WeE65Kaomucqjq8rLXUAK4zwEoyiBGdjX2A2nzap6H8DSMPZwTpfL1KXJQD1aRJhxc2f" ], "script": "base64:AAIDAAAAAAAAAAgIARIECgIBAQAAAAIBAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAIbGFzdFBsYXkEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwIAAAAIbGFzdFBsYXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAXMFAAAAByRtYXRjaDAFAAAAAXMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQBAAAADFdhdmVzTG90dG9WMgkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgQAAAAEcmFuZAkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCQAAywAAAAIFAAAACGxhc3RQbGF5CAUAAAADaW52AAAADXRyYW5zYWN0aW9uSWQIBQAAAANpbnYAAAAPY2FsbGVyUHVibGljS2V5CAUAAAAJbGFzdEJsb2NrAAAAE2dlbmVyYXRpb25TaWduYXR1cmUJAAGaAAAAAQgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAJAAGaAAAAAQgFAAAACWxhc3RCbG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AAACmd1ZXNzU3RhcnQAAAAIZ3Vlc3NFbmQJAQAAAApzdGFydExvdHRvAAAAAwUAAAADaW52BQAAAApndWVzc1N0YXJ0BQAAAAhndWVzc0VuZAAAAAAFFS01", "height": 1746321, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7V2dyp9oNZPAGjFinKLfGDdnXdMa9mEpVE3oD4UuvhAJ Next: 4pxR83t4yTJeEoEXLJbuBMvD8knX9kXrRNjVA9M1UieR Diff:
OldNewDifferences
3535 let randhash = randomizer(inv)
3636 let rand = (toInt(randhash) % 101)
3737 let winAmount = getIntegerValue(this, (toBase58String(inv.caller.bytes) + "_win_amount"))
38+ let winAmountValue = if (isDefined(winAmount))
39+ then winAmount
40+ else 0
3841 let playAmount = getIntegerValue(this, (toBase58String(inv.caller.bytes) + "_play_amount"))
42+ let playAmountValue = if (isDefined(playAmount))
43+ then playAmount
44+ else 0
3945 if (if ((guessEnd > rand))
4046 then (rand > guessStart)
4147 else false)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func randomizer (inv) = {
55 let lastPlay = match getBinary(this, "lastPlay") {
66 case s: ByteVector =>
77 s
88 case _: Unit =>
99 base58'2ee4oFDYriWJ9EMeR'
1010 case _ =>
1111 throw("Match error")
1212 }
1313 let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
1414 sha256(rand)
1515 }
1616
1717
1818 func startLotto (inv,guessStart,guessEnd) = {
1919 let playLimit = (wavesBalance(this) / 100)
2020 let payment = extract(inv.payment)
2121 if (!(isDefined(inv.payment)))
2222 then throw("Should be with Payment in Waves")
2323 else if (isDefined(payment.assetId))
2424 then throw("Payment should be in Waves")
2525 else if ((payment.amount > playLimit))
2626 then throw(("Payment should be less than " + toString(playLimit)))
2727 else if ((0 > guessStart))
2828 then throw("guessStart and guessEnd Must be in between 0-100")
2929 else if ((guessEnd > 100))
3030 then throw("guessStart and guessEnd Must be in between 0-100")
3131 else if ((guessStart > guessEnd))
3232 then throw("guessStart and guessEnd Must be in between 0-100")
3333 else {
3434 let callerAddress = toBase58String(inv.caller.bytes)
3535 let randhash = randomizer(inv)
3636 let rand = (toInt(randhash) % 101)
3737 let winAmount = getIntegerValue(this, (toBase58String(inv.caller.bytes) + "_win_amount"))
38+ let winAmountValue = if (isDefined(winAmount))
39+ then winAmount
40+ else 0
3841 let playAmount = getIntegerValue(this, (toBase58String(inv.caller.bytes) + "_play_amount"))
42+ let playAmountValue = if (isDefined(playAmount))
43+ then playAmount
44+ else 0
3945 if (if ((guessEnd > rand))
4046 then (rand > guessStart)
4147 else false)
4248 then {
4349 let writeLastPlay = WriteSet([DataEntry("lastPlay", rand), DataEntry("lastbet", ((toString(guessStart) + "_") + toString(guessEnd))), DataEntry((callerAddress + "_play_amount"), (playAmount + 1)), DataEntry((callerAddress + "_win_amount"), (winAmount + 1))])
4450 ScriptResult(writeLastPlay, TransferSet([ScriptTransfer(inv.caller, ((payment.amount * 190) / 100), unit)]))
4551 }
4652 else {
4753 let writeLastPlay = WriteSet([DataEntry("lastPlay", rand), DataEntry("lastbet", ((toString(guessStart) + "_") + toString(guessEnd))), DataEntry((callerAddress + "_play_amount"), (playAmount + 1)), DataEntry((callerAddress + "_win_amount"), winAmount)])
4854 ScriptResult(writeLastPlay, TransferSet(nil))
4955 }
5056 }
5157 }
5258
5359
5460 @Callable(inv)
5561 func zero2hero (guessStart,guessEnd) = startLotto(inv, guessStart, guessEnd)
5662
5763

github/deemru/w8io/169f3d6 
30.98 ms