tx · 9p3A64kThR1jptuYhX8eTKvY4t1sgsLkHoD676d7dNRy 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh: -0.01000000 Waves 2021.07.15 07:50 [1614265] smart account 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh > SELF 0.00000000 Waves
{ "type": 13, "id": "9p3A64kThR1jptuYhX8eTKvY4t1sgsLkHoD676d7dNRy", "fee": 1000000, "feeAssetId": null, "timestamp": 1626324627865, "version": 2, "chainId": 84, "sender": "3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh", "senderPublicKey": "D7edN6TZzQ6PbyWHGFdGMPJkkRNjR1Y32g7MmU7AXR73", "proofs": [ "3mPoGNP51WQdaSjoj3EdGbyi1MA4qYzhz7Ca5oE5bZ6uozAgqCmwC9xQ5MftWJnj56uJ4cUDbWLtyPwHJeJNQb36" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAADAAAAAAlCTE9DS1NURVAAAAAAAAAAAAoAAAAAA1JFUwEAAAAg9zCOS72Q1vYXbBOZsGiYip0A3D8vW8S490kPXDWEHLMBAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAIbGFzdFBsYXkEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwIAAAAIbGFzdFBsYXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAXMFAAAAByRtYXRjaDAFAAAAAXMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQBAAAADkdvbGRNaW5lcnMyMDIxCQAAAgAAAAECAAAAC01hdGNoIGVycm9yBAAAAARyYW5kCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgUAAAAIbGFzdFBsYXkIBQAAAANpbnYAAAANdHJhbnNhY3Rpb25JZAgFAAAAA2ludgAAAA9jYWxsZXJQdWJsaWNLZXkIBQAAAAlsYXN0QmxvY2sAAAATZ2VuZXJhdGlvblNpZ25hd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eded", "spentComplexity": 0 } View: original | compacted Prev: 9FrmauXha9yDCP9veavtQRMpZWwr4Ug8roZ7b1ofe5Xh Next: 4HnJUdhRFsoCD9ymTfmfSDQbJXFayBp3Gh6Cu9aCggR4 Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | case _ => | |
54 | 54 | 0 | |
55 | 55 | } | |
56 | + | let newIngots = (ingots + 1) | |
56 | 57 | let balance = assetBalance(i.caller, RES) | |
57 | 58 | if ((10 > balance)) | |
58 | 59 | then throw("Not enough, need 1000 pieces") | |
59 | 60 | else { | |
60 | 61 | let issue = Issue("DEMO", "DEMO", 1, 0, false) | |
61 | 62 | let nft = calculateAssetId(issue) | |
62 | - | [Issue("DEMO", "DEMO", 1, 0, false), Burn(RES, 10), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", | |
63 | + | [Issue("DEMO", "DEMO", 1, 0, false), Burn(RES, 10), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft))] | |
63 | 64 | } | |
64 | 65 | } | |
65 | 66 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BLOCKSTEP = 10 | |
5 | 5 | ||
6 | 6 | let RES = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4' | |
7 | 7 | ||
8 | 8 | func randomizer (inv) = { | |
9 | 9 | let lastPlay = match getBinary(this, "lastPlay") { | |
10 | 10 | case s: ByteVector => | |
11 | 11 | s | |
12 | 12 | case _: Unit => | |
13 | 13 | base58'TGCTLFoHxJ8U7rcUofN' | |
14 | 14 | case _ => | |
15 | 15 | throw("Match error") | |
16 | 16 | } | |
17 | 17 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
18 | 18 | sha256(rand) | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | @Callable(i) | |
23 | 23 | func goToMine () = { | |
24 | 24 | let caller = toBase58String(i.caller.bytes) | |
25 | 25 | let wait = match getInteger(this, ("wait_" + caller)) { | |
26 | 26 | case a: Int => | |
27 | 27 | a | |
28 | 28 | case _ => | |
29 | 29 | 0 | |
30 | 30 | } | |
31 | 31 | let newWait = (lastBlock.height + BLOCKSTEP) | |
32 | 32 | let randhash = randomizer(i) | |
33 | 33 | let count = (toInt(randhash) % 1000) | |
34 | 34 | if ((wait > lastBlock.height)) | |
35 | 35 | then throw((("Still wait block " + toString(lastBlock.height)) + " for mining")) | |
36 | 36 | else [IntegerEntry(("wait_" + caller), newWait), ScriptTransfer(i.caller, count, RES)] | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | 41 | @Callable(i) | |
42 | 42 | func craftIngot () = { | |
43 | 43 | let caller = toBase58String(i.caller.bytes) | |
44 | 44 | let craft = match getInteger(this, ("craft_" + caller)) { | |
45 | 45 | case a: Int => | |
46 | 46 | a | |
47 | 47 | case _ => | |
48 | 48 | 0 | |
49 | 49 | } | |
50 | 50 | let ingots = match getInteger(this, "ingots_count") { | |
51 | 51 | case a: Int => | |
52 | 52 | a | |
53 | 53 | case _ => | |
54 | 54 | 0 | |
55 | 55 | } | |
56 | + | let newIngots = (ingots + 1) | |
56 | 57 | let balance = assetBalance(i.caller, RES) | |
57 | 58 | if ((10 > balance)) | |
58 | 59 | then throw("Not enough, need 1000 pieces") | |
59 | 60 | else { | |
60 | 61 | let issue = Issue("DEMO", "DEMO", 1, 0, false) | |
61 | 62 | let nft = calculateAssetId(issue) | |
62 | - | [Issue("DEMO", "DEMO", 1, 0, false), Burn(RES, 10), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", | |
63 | + | [Issue("DEMO", "DEMO", 1, 0, false), Burn(RES, 10), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft))] | |
63 | 64 | } | |
64 | 65 | } | |
65 | 66 | ||
66 | 67 |
github/deemru/w8io/169f3d6 87.76 ms ◑