tx · HyfQWhLYxAiTacCB8Ph37vSPjBpr9GjN4kr7crJ2kHAS 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh: -0.01000000 Waves 2021.07.22 19:58 [1625122] smart account 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh > SELF 0.00000000 Waves
{ "type": 13, "id": "HyfQWhLYxAiTacCB8Ph37vSPjBpr9GjN4kr7crJ2kHAS", "fee": 1000000, "feeAssetId": null, "timestamp": 1626973174281, "version": 2, "chainId": 84, "sender": "3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh", "senderPublicKey": "D7edN6TZzQ6PbyWHGFdGMPJkkRNjR1Y32g7MmU7AXR73", "proofs": [ "2ULh7qkms9hrSVMXqjkVs1inaCg2octvh5VJnbD95VkuHqv24ZkFAzz6s1gqgGmgrhpUSiCNrR1ai7AcDfg4o2YZ" ], "script": "base64:AAIFAAAAAAAAABAIAhIAEgMKAQESAwoBARIAAAAABQAAAAAJQkxPQ0tTVEVQAAAAAAAAAAAKAAAAAAlJTkdPVENPU1QAAAAAAAAAA+gAAAAACFBMT1RDT1NUAAAAAAAAAYagAAAAAAVnTHVtcAEAAAAg9zCOS72Q1vYXbBOZsGiYip0A3D8vW8S490kPXDWEHLMBAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAIbGFzdFBsYXkEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwIAAAAIbGFzdE1pbmUDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAXMFAAAAByRtYXRjaDAFAAAAAXMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQBAAAADkdvbGRNaW5lcnMyMDIxCQAAAgAAAAECAAAAC01hdGNoIGVycm9yBAAAAARyYW5kCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgUAAAAIbGFzdFBsYXkIBQAAAANpbnYAAAANdHJhbnNhY3Rpb25JZAgFAAA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YWl0XwUAAAAGY2FsbGVyBQAAAAduZXdXYWl0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAD6AUAAAAFZ0x1bXAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAFcGxvdF8FAAAABmNhbGxlcgUAAAALbmV3UGxvdFNpemUFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V55GIrhA==", "height": 1625122, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3skRifYSV37wido7xWA1oU3f8fF67gCf8JVRXzsGRLT7 Next: 6mq5L6dkUimHL3U3ZCL1djSUzUTiGakGEr5oPaY2r61p Diff:
Old | New | Differences | |
---|---|---|---|
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | + | @Verifier(tx) | |
143 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
144 | + |
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 INGOTCOST = 1000 | |
7 | 7 | ||
8 | 8 | let PLOTCOST = 100000 | |
9 | 9 | ||
10 | 10 | let gLump = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4' | |
11 | 11 | ||
12 | 12 | func randomizer (inv) = { | |
13 | 13 | let lastPlay = match getBinary(this, "lastMine") { | |
14 | 14 | case s: ByteVector => | |
15 | 15 | s | |
16 | 16 | case _: Unit => | |
17 | 17 | base58'TGCTLFoHxJ8U7rcUofN' | |
18 | 18 | case _ => | |
19 | 19 | throw("Match error") | |
20 | 20 | } | |
21 | 21 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
22 | 22 | sha256(rand) | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | @Callable(i) | |
27 | 27 | func goToMine () = { | |
28 | 28 | let caller = toBase58String(i.caller.bytes) | |
29 | 29 | let wait = match getInteger(this, ("wait_" + caller)) { | |
30 | 30 | case a: Int => | |
31 | 31 | a | |
32 | 32 | case _ => | |
33 | 33 | 0 | |
34 | 34 | } | |
35 | 35 | let newWait = (lastBlock.height + BLOCKSTEP) | |
36 | 36 | let randhash = randomizer(i) | |
37 | 37 | let count = (toInt(randhash) % 1000) | |
38 | 38 | if ((wait > lastBlock.height)) | |
39 | 39 | then throw((("Wait block " + toString(wait)) + " for mining again")) | |
40 | 40 | else [IntegerEntry(("wait_" + caller), newWait), ScriptTransfer(i.caller, count, gLump), BinaryEntry("lastMine", randhash)] | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | 46 | func craftIngot (count) = { | |
47 | 47 | let caller = toBase58String(i.caller.bytes) | |
48 | 48 | let craft = match getInteger(this, ("craft_" + caller)) { | |
49 | 49 | case a: Int => | |
50 | 50 | a | |
51 | 51 | case _ => | |
52 | 52 | 0 | |
53 | 53 | } | |
54 | 54 | let ingots = match getInteger(this, "ingots_count") { | |
55 | 55 | case a: Int => | |
56 | 56 | a | |
57 | 57 | case _ => | |
58 | 58 | 0 | |
59 | 59 | } | |
60 | 60 | let newIngots = (ingots + 1) | |
61 | 61 | let newCraft = (lastBlock.height + BLOCKSTEP) | |
62 | 62 | if ((size(i.payments) == 0)) | |
63 | 63 | then throw("Payment wasn't attached") | |
64 | 64 | else if ((craft > lastBlock.height)) | |
65 | 65 | then throw((("Wait block " + toString(craft)) + " for crafting again")) | |
66 | 66 | else if (if (if ((count != 1)) | |
67 | 67 | then (count != 10) | |
68 | 68 | else false) | |
69 | 69 | then (count != 50) | |
70 | 70 | else false) | |
71 | 71 | then throw("Wrong ingot's weight!") | |
72 | 72 | else { | |
73 | 73 | let payment = i.payments[0] | |
74 | 74 | if ((payment.assetId != gLump)) | |
75 | 75 | then throw("Payment only in gLump") | |
76 | 76 | else if ((payment.amount != (INGOTCOST * count))) | |
77 | 77 | then throw((("Payment expected " + toString((INGOTCOST * count))) + " gLump")) | |
78 | 78 | else { | |
79 | 79 | let issueName = ("INGOT" + toString(newIngots)) | |
80 | 80 | let issueDesc = (((((("{\"weight\":" + toString(count)) + ",\"uid\":") + toString(newIngots)) + ",\"made_by\":\"") + caller) + "\"}") | |
81 | 81 | let issue = Issue(issueName, issueDesc, 1, 0, false) | |
82 | 82 | let nft = calculateAssetId(issue) | |
83 | 83 | [Burn(gLump, (INGOTCOST * count)), Issue(issueName, issueDesc, 1, 0, false), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft)), IntegerEntry(("craft_" + caller), newCraft)] | |
84 | 84 | } | |
85 | 85 | } | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(i) | |
91 | 91 | func buyPlot (pSize) = { | |
92 | 92 | let caller = toBase58String(i.caller.bytes) | |
93 | 93 | let plotSize = match getInteger(this, ("plot_" + caller)) { | |
94 | 94 | case a: Int => | |
95 | 95 | a | |
96 | 96 | case _ => | |
97 | 97 | 0 | |
98 | 98 | } | |
99 | 99 | if ((plotSize > 0)) | |
100 | 100 | then throw("You already have a plot!") | |
101 | 101 | else if (if ((0 > plotSize)) | |
102 | 102 | then true | |
103 | 103 | else (plotSize > 1000)) | |
104 | 104 | then throw("Correct size value from 1 to 1000") | |
105 | 105 | else { | |
106 | 106 | let payment = i.payments[0] | |
107 | 107 | if (isDefined(payment.assetId)) | |
108 | 108 | then throw("Payment only in WAVES") | |
109 | 109 | else if ((payment.amount != (pSize * PLOTCOST))) | |
110 | 110 | then throw((("Payment expected " + toString((pSize * PLOTCOST))) + " WAVELET")) | |
111 | 111 | else [IntegerEntry(("plot_" + caller), pSize)] | |
112 | 112 | } | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | ||
117 | 117 | @Callable(i) | |
118 | 118 | func goToPlot () = { | |
119 | 119 | let caller = toBase58String(i.caller.bytes) | |
120 | 120 | let plotSize = match getInteger(this, ("plot_" + caller)) { | |
121 | 121 | case a: Int => | |
122 | 122 | a | |
123 | 123 | case _ => | |
124 | 124 | 0 | |
125 | 125 | } | |
126 | 126 | let wait = match getInteger(this, ("wait_" + caller)) { | |
127 | 127 | case a: Int => | |
128 | 128 | a | |
129 | 129 | case _ => | |
130 | 130 | 0 | |
131 | 131 | } | |
132 | 132 | let newWait = (lastBlock.height + BLOCKSTEP) | |
133 | 133 | let newPlotSize = (plotSize - 1) | |
134 | 134 | if ((0 >= plotSize)) | |
135 | 135 | then throw("Plot is empty, buy new!") | |
136 | 136 | else if ((wait > lastBlock.height)) | |
137 | 137 | then throw((("Wait block " + toString(wait)) + " for mining again")) | |
138 | 138 | else [IntegerEntry(("wait_" + caller), newWait), ScriptTransfer(i.caller, 1000, gLump), IntegerEntry(("plot_" + caller), newPlotSize)] | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | + | @Verifier(tx) | |
143 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
144 | + |
github/deemru/w8io/169f3d6 28.09 ms ◑