tx · Ff8opM7C4Eyt5bc6WZFDP1TZznkpq5puyB3bga1pqe3A

3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA:  -0.01000000 Waves

2023.06.01 10:00 [2603261] smart account 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA > SELF 0.00000000 Waves

{ "type": 13, "id": "Ff8opM7C4Eyt5bc6WZFDP1TZznkpq5puyB3bga1pqe3A", "fee": 1000000, "feeAssetId": null, "timestamp": 1685602814444, "version": 2, "chainId": 84, "sender": "3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA", "senderPublicKey": "Dx7cJVhpJb4qUDGiDnSjj6Wfjdj5nmzwVLfaggkbjDtv", "proofs": [ "3rbzum62RLQS7ugn1oxdSLyJgvrHR6MJH3Sxm3v8kvd48cUT2F6TTMHZTMrpSkMQk1yzdtZrjdDRbE2oBxfNrxu8" ], "script": "base64:BgIGCAISABIABgEKbnVtVG9XYXZlcwEDbnVtCQBoAgUDbnVtAIDC1y8BC2lzUGF5bWVudE9rAQFpBBFhY2NlcHRhYmxlQXNzZXRJZAEgIkSm54hUfVEormpXug9p+nbhDnc37ahHq1IfaU2UQkcDCQAAAgkAkAMBCAUBaQhwYXltZW50cwAACQACAQIUUGF5bWVudCBub3QgYXR0YWNoZWQEAXAJAJEDAggFAWkIcGF5bWVudHMAAAQHJG1hdGNoMAgFAXAHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAdhc3NldElkBQckbWF0Y2gwAwkAAAIFB2Fzc2V0SWQFEWFjY2VwdGFibGVBc3NldElkCQBnAggFAXAGYW1vdW50CQEKbnVtVG9XYXZlcwEAAQcJAGcCCAUBcAZhbW91bnQJAQpudW1Ub1dhdmVzAQABARNnZXRMdWNreVdoZWVsQmV0S2V5AQFpCQCsAgICD2JldF9MdWNreVdoZWVsXwkApQgBCAUBaQZjYWxsZXIBE2dldEx1Y2t5V2hlZWxXb25LZXkBAWkJAKwCAgIPd29uX0x1Y2t5V2hlZWx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AQkA9QMBBQN2cmYEDHJhbmRvbU51bWJlcgkAZAIJAGoCBQpyYW5kb21TZWVkCQBkAgkAZQIADAABAAEAAQQNd2lubmluZ0Ftb3VudAkBGWdhbWVMdWNreVdoZWVsV2hhdFVzZXJXb24BBQxyYW5kb21OdW1iZXIDCQBmAgUNd2lubmluZ0Ftb3VudAAACQDMCAIJAQtEZWxldGVFbnRyeQEJARNnZXRMdWNreVdoZWVsQmV0S2V5AQUBaQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFDXdpbm5pbmdBbW91bnQFBHVuaXQJAMwIAgkBDEludGVnZXJFbnRyeQIJARNnZXRMdWNreVdoZWVsV29uS2V5AQUBaQUNd2lubmluZ0Ftb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgkBHGdldEx1Y2t5V2hlZWxSYW5kb21OdW1iZXJLZXkBBQFpBQxyYW5kb21OdW1iZXIFA25pbAkAzAgCCQELRGVsZXRlRW50cnkBCQETZ2V0THVja3lXaGVlbEJldEtleQEFAWkJAMwIAgkBDEludGVnZXJFbnRyeQIJARNnZXRMdWNreVdoZWVsV29uS2V5AQUBaQUNd2lubmluZ0Ftb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgkBHGdldEx1Y2t5V2hlZWxSYW5kb21OdW1iZXJLZXkBBQFpBQxyYW5kb21OdW1iZXIFA25pbAC395AY", "height": 2603261, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3oskqxZztcAUS3PemdsMDntReEcyUDiBH8dV6p8teCoD Next: 4RG8Fit1vRGWGGHaBKGKsSo1gTuP8cgScYchQXv35yDK Diff:
OldNewDifferences
2626
2727
2828 func getLuckyWheelWonKey (i) = ("won_LuckyWheel_" + toString(i.caller))
29+
30+
31+func getLuckyWheelRandomNumberKey (i) = ("randomNumber_LuckyWheel_" + toString(i.caller))
2932
3033
3134 func gameLuckyWheelWhatUserWon (value) = match value {
6164 let randomNumber = ((randomSeed % ((12 - 1) + 1)) + 1)
6265 let winningAmount = gameLuckyWheelWhatUserWon(randomNumber)
6366 if ((winningAmount > 0))
64- then [DeleteEntry(getLuckyWheelBetKey(i)), ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(getLuckyWheelWonKey(i), winningAmount)]
65- else [DeleteEntry(getLuckyWheelBetKey(i)), IntegerEntry(getLuckyWheelWonKey(i), winningAmount)]
67+ then [DeleteEntry(getLuckyWheelBetKey(i)), ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(getLuckyWheelWonKey(i), winningAmount), IntegerEntry(getLuckyWheelRandomNumberKey(i), randomNumber)]
68+ else [DeleteEntry(getLuckyWheelBetKey(i)), IntegerEntry(getLuckyWheelWonKey(i), winningAmount), IntegerEntry(getLuckyWheelRandomNumberKey(i), randomNumber)]
6669 }
6770 }
6871
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func numToWaves (num) = (num * 100000000)
55
66
77 func isPaymentOk (i) = {
88 let acceptableAssetId = base58'3JmaWyFqWo8YSA8x3DXCBUW7veesxacvKx19dMv7wTMg'
99 if ((size(i.payments) == 0))
1010 then throw("Payment not attached")
1111 else {
1212 let p = i.payments[0]
1313 match p.assetId {
1414 case assetId: ByteVector =>
1515 if ((assetId == acceptableAssetId))
1616 then (p.amount >= numToWaves(1))
1717 else false
1818 case _ =>
1919 (p.amount >= numToWaves(1))
2020 }
2121 }
2222 }
2323
2424
2525 func getLuckyWheelBetKey (i) = ("bet_LuckyWheel_" + toString(i.caller))
2626
2727
2828 func getLuckyWheelWonKey (i) = ("won_LuckyWheel_" + toString(i.caller))
29+
30+
31+func getLuckyWheelRandomNumberKey (i) = ("randomNumber_LuckyWheel_" + toString(i.caller))
2932
3033
3134 func gameLuckyWheelWhatUserWon (value) = match value {
3235 case _ =>
3336 if ((1 == $match0))
3437 then numToWaves(2)
3538 else if ((5 == $match0))
3639 then numToWaves(1)
3740 else if ((7 == $match0))
3841 then numToWaves(4)
3942 else if ((11 == $match0))
4043 then numToWaves(1)
4144 else 0
4245 }
4346
4447
4548 @Callable(i)
4649 func commitLuckyWheel () = if (!(isPaymentOk(i)))
4750 then throw("Wrong payment amount or asset")
4851 else [IntegerEntry(getLuckyWheelBetKey(i), (height + 1))]
4952
5053
5154
5255 @Callable(i)
5356 func revealLuckyWheel () = {
5457 let commitHeight = valueOrErrorMessage(getIntegerValue(getLuckyWheelBetKey(i)), "Bet not found")
5558 if ((commitHeight > height))
5659 then throw((("wait " + toString((commitHeight - height))) + " blocks to reveal this id"))
5760 else {
5861 let revealBlock = valueOrErrorMessage(blockInfoByHeight(commitHeight), "unexcpected error")
5962 let vrf = valueOrErrorMessage(revealBlock.vrf, "unexcpected error")
6063 let randomSeed = toInt(keccak256(vrf))
6164 let randomNumber = ((randomSeed % ((12 - 1) + 1)) + 1)
6265 let winningAmount = gameLuckyWheelWhatUserWon(randomNumber)
6366 if ((winningAmount > 0))
64- then [DeleteEntry(getLuckyWheelBetKey(i)), ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(getLuckyWheelWonKey(i), winningAmount)]
65- else [DeleteEntry(getLuckyWheelBetKey(i)), IntegerEntry(getLuckyWheelWonKey(i), winningAmount)]
67+ then [DeleteEntry(getLuckyWheelBetKey(i)), ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(getLuckyWheelWonKey(i), winningAmount), IntegerEntry(getLuckyWheelRandomNumberKey(i), randomNumber)]
68+ else [DeleteEntry(getLuckyWheelBetKey(i)), IntegerEntry(getLuckyWheelWonKey(i), winningAmount), IntegerEntry(getLuckyWheelRandomNumberKey(i), randomNumber)]
6669 }
6770 }
6871
6972

github/deemru/w8io/169f3d6 
32.41 ms