tx · ADNkzFtqETK4HxEUCFSA6oNyMhtTNzzADAHd7ELHFvSW

3MxwtQTF1cHZBzHdVMmfdeeTJAoF58usNzC:  -0.04000000 Waves

2019.12.29 12:21 [830163] smart account 3MxwtQTF1cHZBzHdVMmfdeeTJAoF58usNzC > SELF 0.00000000 Waves

{ "type": 13, "id": "ADNkzFtqETK4HxEUCFSA6oNyMhtTNzzADAHd7ELHFvSW", "fee": 4000000, "feeAssetId": null, "timestamp": 1577611246172, "version": 1, "sender": "3MxwtQTF1cHZBzHdVMmfdeeTJAoF58usNzC", "senderPublicKey": "AtB1c3RaAbi5bMXf4twdpm182Pcj5tgADufjhfxjt5YP", "proofs": [ "63ZwD9p6NGEDYiRFqx46u7W6H9oZxMEx7cuUzPuw3oU1FFTMtgFJH3jD6k3aDV8HHB2ZLhCUbgQVCsVRybRAwhwp" ], "script": "base64:AAIDAAAAAAAAAA0IARIECgIBARIDCgEBAAAABwAAAAALb3duZXJQdWJLZXkBAAAAIJLVH1aKS7GiLdMgBtKumrDgMoaT5BFPrNSzSjm7iLMkAAAAAAhsdmwxUmF0ZQAAAAAAAAAADAAAAAAIbHZsMlJhdGUAAAAAAAAAAA4AAAAACGx2bDNSYXRlAAAAAAAAAAAQAQAAAApyYW5kb21pemVyAAAAAQAAAANpbnYEAAAABHJhbmQJAABqAAAAAgkABLEAAAABCQAB9wAAAAEJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAggFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAAAADaW52AAAAD2NhbGxlclB1YmxpY0tleQgFAAAACWxhc3RCbG9jawAAABNnZW5lcmF0aW9uU2lnbmF0dXJlCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAJdGltZXN0YW1wCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0AAAAAAAAAAAEAwkAAGYAAAACAAAAAAAAAAAABQAAAARyYW5kCQAAZAAAAAIJAABoAAAAAgD//////////wUAAAAEc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wkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGB6n3SDY=", "chainId": 84, "height": 830163, "spentComplexity": 0 } View: original | compacted Prev: HpgiXGSmMeh1roErunGtudBRPM6cjxFVn5kB4WQyidDo Next: 5LHCoHZy3LwanTubA5khGB5cQcsit3mJkevfYXFXsFAg Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPubKey = base58'AtB1c3RaAbi5bMXf4twdpm182Pcj5tgADufjhfxjt5YP'
5-
6-let lvl1 = 4
7-
8-let lvl2 = 3
9-
10-let lvl3 = 2
115
126 let lvl1Rate = 12
137
1610 let lvl3Rate = 16
1711
1812 func randomizer (inv) = {
19- let rand = (toInt(sha256(((((inv.transactionId + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)))) % 6)
13+ let rand = (toInt(sha256(((((inv.transactionId + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)))) % 4)
2014 if ((0 > rand))
2115 then ((-1 * rand) + 1)
2216 else (rand + 1)
2317 }
2418
2519
20+func loadGameData (gameId) = {
21+ let gameData = match getString(this, gameId) {
22+ case str: String =>
23+ str
24+ case _ =>
25+ throw(("Couldn't find game by " + gameId))
26+ }
27+ split(gameData, "_")
28+ }
29+
30+
31+func result (i,c) = {
32+ let rand = randomizer(i)
33+ let gameDataArr = loadGameData("F63eyYX6NmXE3fgdYLyiFo8KLBzdxDesFRK2zYSP4CMP")
34+ if ((rand == c))
35+ then (((((((gameDataArr[0] + "_") + gameDataArr[1]) + "_") + gameDataArr[2]) + ":") + toString(c)) + ":")
36+ else ((((gameDataArr[0] + "_") + gameDataArr[1]) + "") + gameDataArr[2])
37+ }
38+
39+
2640 @Callable(inv)
27-func start (bet) = {
41+func start (bet,lvl) = {
2842 let playerAddress = addressFromPublicKey(inv.callerPublicKey)
2943 let gameKey = toBase58String(inv.transactionId)
30- let gameData = ((toBase58String(inv.callerPublicKey) + "_") + toString(bet))
31- WriteSet([DataEntry(gameKey, (gameData + "_0"))])
44+ let gameData = ((((toBase58String(inv.callerPublicKey) + "_") + toString(bet)) + "_") + toString(lvl))
45+ WriteSet([DataEntry(gameKey, gameData)])
46+ }
47+
48+
49+
50+@Callable(inv)
51+func choice (userChoice) = {
52+ let qwerty = loadGameData("F63eyYX6NmXE3fgdYLyiFo8KLBzdxDesFRK2zYSP4CMP")
53+ WriteSet([DataEntry(toString(inv.caller), toString(userChoice))])
3254 }
3355
3456
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPubKey = base58'AtB1c3RaAbi5bMXf4twdpm182Pcj5tgADufjhfxjt5YP'
5-
6-let lvl1 = 4
7-
8-let lvl2 = 3
9-
10-let lvl3 = 2
115
126 let lvl1Rate = 12
137
148 let lvl2Rate = 14
159
1610 let lvl3Rate = 16
1711
1812 func randomizer (inv) = {
19- let rand = (toInt(sha256(((((inv.transactionId + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)))) % 6)
13+ let rand = (toInt(sha256(((((inv.transactionId + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)))) % 4)
2014 if ((0 > rand))
2115 then ((-1 * rand) + 1)
2216 else (rand + 1)
2317 }
2418
2519
20+func loadGameData (gameId) = {
21+ let gameData = match getString(this, gameId) {
22+ case str: String =>
23+ str
24+ case _ =>
25+ throw(("Couldn't find game by " + gameId))
26+ }
27+ split(gameData, "_")
28+ }
29+
30+
31+func result (i,c) = {
32+ let rand = randomizer(i)
33+ let gameDataArr = loadGameData("F63eyYX6NmXE3fgdYLyiFo8KLBzdxDesFRK2zYSP4CMP")
34+ if ((rand == c))
35+ then (((((((gameDataArr[0] + "_") + gameDataArr[1]) + "_") + gameDataArr[2]) + ":") + toString(c)) + ":")
36+ else ((((gameDataArr[0] + "_") + gameDataArr[1]) + "") + gameDataArr[2])
37+ }
38+
39+
2640 @Callable(inv)
27-func start (bet) = {
41+func start (bet,lvl) = {
2842 let playerAddress = addressFromPublicKey(inv.callerPublicKey)
2943 let gameKey = toBase58String(inv.transactionId)
30- let gameData = ((toBase58String(inv.callerPublicKey) + "_") + toString(bet))
31- WriteSet([DataEntry(gameKey, (gameData + "_0"))])
44+ let gameData = ((((toBase58String(inv.callerPublicKey) + "_") + toString(bet)) + "_") + toString(lvl))
45+ WriteSet([DataEntry(gameKey, gameData)])
46+ }
47+
48+
49+
50+@Callable(inv)
51+func choice (userChoice) = {
52+ let qwerty = loadGameData("F63eyYX6NmXE3fgdYLyiFo8KLBzdxDesFRK2zYSP4CMP")
53+ WriteSet([DataEntry(toString(inv.caller), toString(userChoice))])
3254 }
3355
3456
3557 @Verifier(tx)
3658 func verify () = match tx {
3759 case t: SetScriptTransaction =>
3860 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey)
3961 case c: InvokeScriptTransaction =>
4062 true
4163 case d: DataTransaction =>
4264 true
4365 case _ =>
4466 false
4567 }
4668

github/deemru/w8io/169f3d6 
52.09 ms