tx · 6n49im8RPRiNuUdQ9D6tozggzDwEwtPPPfVd5JPaZDRb 3N5817sxSDYjf2ZLXWeg7CeTTL5eb5RUGfZ: -0.01000000 Waves 2021.07.23 03:00 [1625536] smart account 3N5817sxSDYjf2ZLXWeg7CeTTL5eb5RUGfZ > SELF 0.00000000 Waves
{ "type": 13, "id": "6n49im8RPRiNuUdQ9D6tozggzDwEwtPPPfVd5JPaZDRb", "fee": 1000000, "feeAssetId": null, "timestamp": 1626998447202, "version": 2, "chainId": 84, "sender": "3N5817sxSDYjf2ZLXWeg7CeTTL5eb5RUGfZ", "senderPublicKey": "J7rxZzeYSPADJy4erG5pvXRfkEStFn2ytek6F4Xx2VPY", "proofs": [ "655uvnhjBxgscDNH8Wkp94uHGtCzPbMZ1RNaWeK1g8rWqpD9n3GMwmYLnyoFYRsncgnVjMQ1Te4gfXpFWa64QNT8" ], "script": "base64:AAIDAAAAAAAAABAIARIMCgoBAQEBAQEBAQEBAAAAAgEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAARnYW1lAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0AQAAABNTb2xkaWVySHVudGVyQm9zc3YxCQAAAgAAAAECAAAAC01hdGNoIGVycm9yBAAAAARyYW5kCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgUAAAAIbGFzdFBsYXkIBQAAAANpbnYAAAANdHJhbnNhY3Rpb25JZAgFAAAAA2ludgAAAA9jYWxsZXJQdWJsaWNLZXkIBQAAAAlsYXN0QmxvY2sAAAATZ2VuZXJhdGlvblNpZ25hdHVyZQkAAZoAAAABCAUAAAAJbGFzdEJsb2NrAAAACXRpbWVzdGFtcAkAAZoAAAABCAUAAAA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AAAJc29sZGllcjAyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAlzb2xkaWVyMDMFAAAACXNvbGRpZXIwMwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAJc29sZGllcjA0BQAAAAlzb2xkaWVyMDQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAACGh1bnRlcjAxBQAAAAhodW50ZXIwMQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAIaHVudGVyMDIFAAAACGh1bnRlcjAyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAhodW50ZXIwMwUAAAAIaHVudGVyMDMJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAACGh1bnRlcjA0BQAAAAhodW50ZXIwNAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAGYm9zczAxBQAAAAZib3NzMDEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABmJvc3MwMgUAAAAGYm9zczAyBQAAAANuaWwEAAAADXBsYXlHYW1lU3RhcnQJAQAAAAhwbGF5R2FtZQAAAAMFAAAAD2N1cnJlbnRLZXlCeXRlcwgFAAAACWJ0Y0Ftb3VudAAAAAZhbW91bnQJAASxAAAAAQUAAAAIcmFuZGhhc2gFAAAADXBsYXlHYW1lU3RhcnQAAAAAuiYIQQ==", "height": 1625536, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8m9bSik2u5WZ7K2R1aVhPNYyU7FUQErDqiKGb4hygNG9 Next: LLJ8oPNXnt73fvCmuyMHFJqP4Va7qV9E1nyaXHTjFun Diff:
Old | New | Differences | |
---|---|---|---|
35 | 35 | let deckCards = [soldier01, soldier02, soldier03, soldier04, hunter01, hunter02, hunter03, hunter04, boss01, boss02] | |
36 | 36 | let currentKeyBytes = toBase58String(inv.caller.bytes) | |
37 | 37 | let undead = base58'DdM4S3gFdTGCTPeNH1xRE3KjaUNDosoXCKvEY76VfP4o' | |
38 | - | let | |
38 | + | let kingOftheArena = match getString(this, "kingOftheArena") { | |
39 | 39 | case a: String => | |
40 | 40 | a | |
41 | 41 | case _ => | |
43 | 43 | } | |
44 | 44 | if ((0 > assetBalance(currentKey, undead))) | |
45 | 45 | then throw("E necessário ter o token do deck em sua carteira! Para adquirir, realize a troca em Swap Decks.") | |
46 | - | else if (( | |
46 | + | else if ((kingOftheArena == "")) | |
47 | 47 | then WriteSet([DataEntry("kingOftheArena", currentKeyBytes), DataEntry("btcAmount", btcAmount.amount), DataEntry("soldier01", soldier01), DataEntry("soldier02", soldier02), DataEntry("soldier03", soldier03), DataEntry("soldier04", soldier04), DataEntry("hunter01", hunter01), DataEntry("hunter02", hunter02), DataEntry("hunter03", hunter03), DataEntry("hunter04", hunter04), DataEntry("boss01", boss01), DataEntry("boss02", boss02)]) | |
48 | 48 | else { | |
49 | 49 | let playGameStart = playGame(currentKeyBytes, btcAmount.amount, toInt(randhash)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func randomizer (inv) = { | |
5 | 5 | let lastPlay = match getBinary(this, "game") { | |
6 | 6 | case s: ByteVector => | |
7 | 7 | s | |
8 | 8 | case _: Unit => | |
9 | 9 | base58'GGvfcHWwd2azCVLaeeQzr6Ccyn' | |
10 | 10 | case _ => | |
11 | 11 | throw("Match error") | |
12 | 12 | } | |
13 | 13 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
14 | 14 | sha256(rand) | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func playGame (currentKeyBytes,amountBtc,randomNumber) = { | |
19 | 19 | let soldiersAndHunters = toString((randomNumber % 4)) | |
20 | 20 | let soldiersBatle = match getInteger(this, ("soldier" + soldiersAndHunters)) { | |
21 | 21 | case a: Int => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | "" | |
25 | 25 | } | |
26 | 26 | WriteSet([DataEntry("playerWaiting", ""), DataEntry("btcAmount", soldiersBatle)]) | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | @Callable(inv) | |
31 | 31 | func play (soldier01,soldier02,soldier03,soldier04,hunter01,hunter02,hunter03,hunter04,boss01,boss02) = { | |
32 | 32 | let randhash = randomizer(inv) | |
33 | 33 | let currentKey = inv.caller | |
34 | 34 | let btcAmount = extract(inv.payment) | |
35 | 35 | let deckCards = [soldier01, soldier02, soldier03, soldier04, hunter01, hunter02, hunter03, hunter04, boss01, boss02] | |
36 | 36 | let currentKeyBytes = toBase58String(inv.caller.bytes) | |
37 | 37 | let undead = base58'DdM4S3gFdTGCTPeNH1xRE3KjaUNDosoXCKvEY76VfP4o' | |
38 | - | let | |
38 | + | let kingOftheArena = match getString(this, "kingOftheArena") { | |
39 | 39 | case a: String => | |
40 | 40 | a | |
41 | 41 | case _ => | |
42 | 42 | "" | |
43 | 43 | } | |
44 | 44 | if ((0 > assetBalance(currentKey, undead))) | |
45 | 45 | then throw("E necessário ter o token do deck em sua carteira! Para adquirir, realize a troca em Swap Decks.") | |
46 | - | else if (( | |
46 | + | else if ((kingOftheArena == "")) | |
47 | 47 | then WriteSet([DataEntry("kingOftheArena", currentKeyBytes), DataEntry("btcAmount", btcAmount.amount), DataEntry("soldier01", soldier01), DataEntry("soldier02", soldier02), DataEntry("soldier03", soldier03), DataEntry("soldier04", soldier04), DataEntry("hunter01", hunter01), DataEntry("hunter02", hunter02), DataEntry("hunter03", hunter03), DataEntry("hunter04", hunter04), DataEntry("boss01", boss01), DataEntry("boss02", boss02)]) | |
48 | 48 | else { | |
49 | 49 | let playGameStart = playGame(currentKeyBytes, btcAmount.amount, toInt(randhash)) | |
50 | 50 | playGameStart | |
51 | 51 | } | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 |
github/deemru/w8io/169f3d6 38.20 ms ◑