tx · AVqsbv3hRTW93NmnvgHpyaDiJQxM9bige3iMXM2G4XVC

3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk:  -0.01000000 Waves

2021.10.20 10:48 [1754326] smart account 3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk > SELF 0.00000000 Waves

{ "type": 13, "id": "AVqsbv3hRTW93NmnvgHpyaDiJQxM9bige3iMXM2G4XVC", "fee": 1000000, "feeAssetId": null, "timestamp": 1634716128183, "version": 2, "chainId": 84, "sender": "3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk", "senderPublicKey": "8v9pmcXqHz9DTc5k1Z8duTYyDwykFxN3EzdZ9WAn3KXJ", "proofs": [ "4uUNjkAYnfcipovDJtaov6BGtE4UDbau2wBbtaBfm7TevD2rQBamFw3TnmCjex1JnUP2VuKsY1mit2DU6BmuWs1v" ], "script": "base64:AAIFAAAAAAAAAA0IAhIECgIBARIDCgEBAAAACAAAAAANZ2FtZU51bWJlcktleQIAAAAMJEdBTUVfTlVNQkVSAAAAAAtsYXN0UGxheUtleQIAAAAKJExBU1RfUExBWQAAAAAHdGVzdEtleQIAAAAFJFRFU1QAAAAAA1dPTgAAAAAAAAAAAQAAAAAETE9TRQAAAAAAAAAAAgEAAAAKcGF5b3V0Y2FsYwAAAAEAAAAGbnVtYmVyBAAAAAVob3VzZQAAAAAAAAAABgQAAAAEYmFzZQAAAAAAAAAnEAQAAAAEcmF0ZQkAAGkAAAACCQAAaAAAAAIFAAAABGJhc2UJAABlAAAAAgAAAAAAAAAAZAAAAAAAAAAABgkAAGgAAAACBQAAAAZudW1iZXIAAAAAAAAAAGQFAAAABHJhdGUBAAAACnJhbmRvbWl6ZXIAAAABAAAAAWkEAAAACGxhc3RQbGF5BAAAAAckbWF0Y2gwCQAEHAAAAAIFAAAABHRoaXMFAAAAC2xhc3RQbGF5S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQAAAA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ZAAAAAAAAAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEFAAAAB2Fzc2V0SWQFAAAAA25pbAAAAAIAAAABaQEAAAAJemVybzJoZXJvAAAAAgAAAApndWVzc1N0YXJ0AAAACGd1ZXNzRW5kCQEAAAAKc3RhcnRMb3R0bwAAAAMFAAAAAWkFAAAACmd1ZXNzU3RhcnQFAAAACGd1ZXNzRW5kAAAAAWkBAAAAC3BheW91dGNhbGN0AAAAAQAAAAZudW1iZXIEAAAABHJhdGUJAQAAAApwYXlvdXRjYWxjAAAAAQUAAAAGbnVtYmVyCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIFAAAAB3Rlc3RLZXkJAAGkAAAAAQUAAAAEcmF0ZQUAAAADbmlsAAAAABYq2fw=", "height": 1754326, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BdjfNv5LHc8LHdxmBA8YmhMP9J2gbvSABq65Ht9BaP89 Next: 3At9CmPFub6bK7pDm9CEiiuyr6xuPaxxfnsKvmDUKuHY Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let gameNumberKey = "$GAME_NUMBER"
3434
3535
3636 func startLotto (i,guessStart,guessEnd) = {
37- let playLimit = (wavesBalance(this) / 100)
38- let payment = extract(i.payment)
39- if (!(isDefined(i.payment)))
37+ let waves = wavesBalance(this)
38+ let playLimit = (waves.available / 100)
39+ let payment = i.payments[0]
40+ if (!(isDefined(payment)))
4041 then throw("Should be with Payment in Waves")
4142 else if (isDefined(payment.assetId))
4243 then throw("Payment should be in Waves")
7374 let str = ((((((((((toString(WON) + "_WON_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
7475 let payoutRate = payoutcalc(((guessEnd - guessStart) + 1))
7576 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)]))
77+[IntegerEntry(lastPlayKey, rand), StringEntry(gameKey, str), IntegerEntry(gameNumberKey, (gameId + 1)), StringEntry(testKey, ((((toString(payoutRate) + "_") + toString(payment.amount)) + "_") + toString(transferAmount))), ScriptTransfer(i.caller, transferAmount, unit)]
7878 }
7979 else {
8080 let str = ((((((((((toString(LOSE) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
81- let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
82- ScriptResult(writeLastPlay, TransferSet(nil))
81+ let asset = Issue("asd", "description", 1, 0, false, unit, lastBlock.height)
82+ let assetId = calculateAssetId(asset)
83+[IntegerEntry(lastPlayKey, rand), StringEntry(gameKey, str), IntegerEntry(gameNumberKey, (gameId + 1)), ScriptTransfer(i.caller, 1, assetId)]
8384 }
8485 }
8586 }
9394 @Callable(i)
9495 func payoutcalct (number) = {
9596 let rate = payoutcalc(number)
96- ScriptResult(WriteSet([DataEntry(testKey, toString(rate))]), TransferSet(nil))
97+[StringEntry(testKey, toString(rate))]
9798 }
9899
99100
Full:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
1+{-# STDLIB_VERSION 5 #-}
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) = {
37- let playLimit = (wavesBalance(this) / 100)
38- let payment = extract(i.payment)
39- if (!(isDefined(i.payment)))
37+ let waves = wavesBalance(this)
38+ let playLimit = (waves.available / 100)
39+ let payment = i.payments[0]
40+ if (!(isDefined(payment)))
4041 then throw("Should be with Payment in Waves")
4142 else if (isDefined(payment.assetId))
4243 then throw("Payment should be in Waves")
4344 else if ((payment.amount > playLimit))
4445 then throw(("Payment should be less than " + toString(playLimit)))
4546 else if ((0 > guessStart))
4647 then throw("guessStart and guessEnd Must be in between 0-99")
4748 else if ((guessEnd > 99))
4849 then throw("guessStart and guessEnd Must be in between 0-99")
4950 else if ((guessStart > guessEnd))
5051 then throw("guessStart and guessEnd Must be in between 0-99")
5152 else if ((5 > ((guessEnd - guessStart) + 1)))
5253 then throw("guessStart and guessEnd Must be at least 5 apart")
5354 else if ((((guessEnd - guessStart) + 1) > 95))
5455 then throw("guessStart and guessEnd Must not be at least 95 apart")
5556 else {
5657 let callerAddress = toBase58String(i.caller.bytes)
5758 let transactionId = toBase58String(i.transactionId)
5859 let randhash = randomizer(i)
5960 let rand = (toInt(randhash) % 100)
6061 let gameId = match getInteger(this, gameNumberKey) {
6162 case a: Int =>
6263 a
6364 case _: Unit =>
6465 1
6566 case _ =>
6667 throw("Match error")
6768 }
6869 let gameKey = ((callerAddress + "_") + toString(gameId))
6970 if (if (((guessEnd + 1) > rand))
7071 then (rand > (guessStart - 1))
7172 else false)
7273 then {
7374 let str = ((((((((((toString(WON) + "_WON_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
7475 let payoutRate = payoutcalc(((guessEnd - guessStart) + 1))
7576 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)]))
77+[IntegerEntry(lastPlayKey, rand), StringEntry(gameKey, str), IntegerEntry(gameNumberKey, (gameId + 1)), StringEntry(testKey, ((((toString(payoutRate) + "_") + toString(payment.amount)) + "_") + toString(transferAmount))), ScriptTransfer(i.caller, transferAmount, unit)]
7878 }
7979 else {
8080 let str = ((((((((((toString(LOSE) + "_LOSE_") + transactionId) + "_") + gameKey) + "_") + toString(guessStart)) + "-") + toString(guessEnd)) + "_") + toString(rand))
81- let writeLastPlay = WriteSet([DataEntry(lastPlayKey, rand), DataEntry(gameKey, str), DataEntry(gameNumberKey, (gameId + 1))])
82- ScriptResult(writeLastPlay, TransferSet(nil))
81+ let asset = Issue("asd", "description", 1, 0, false, unit, lastBlock.height)
82+ let assetId = calculateAssetId(asset)
83+[IntegerEntry(lastPlayKey, rand), StringEntry(gameKey, str), IntegerEntry(gameNumberKey, (gameId + 1)), ScriptTransfer(i.caller, 1, assetId)]
8384 }
8485 }
8586 }
8687
8788
8889 @Callable(i)
8990 func zero2hero (guessStart,guessEnd) = startLotto(i, guessStart, guessEnd)
9091
9192
9293
9394 @Callable(i)
9495 func payoutcalct (number) = {
9596 let rate = payoutcalc(number)
96- ScriptResult(WriteSet([DataEntry(testKey, toString(rate))]), TransferSet(nil))
97+[StringEntry(testKey, toString(rate))]
9798 }
9899
99100

github/deemru/w8io/169f3d6 
80.58 ms