tx · 97iEzscZb2Ntqmg32RWyvVYdZ7tiPWG1Do4UL5uHycLX 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh: -0.01400000 Waves 2021.07.22 21:10 [1625190] smart account 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh > SELF 0.00000000 Waves
{ "type": 13, "id": "97iEzscZb2Ntqmg32RWyvVYdZ7tiPWG1Do4UL5uHycLX", "fee": 1400000, "feeAssetId": null, "timestamp": 1626977487326, "version": 2, "chainId": 84, "sender": "3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh", "senderPublicKey": "D7edN6TZzQ6PbyWHGFdGMPJkkRNjR1Y32g7MmU7AXR73", "proofs": [ "E3AGT7o9bc1H7M8WdmQgEgVfqxxTErAhTHHV8zmSFDqsJfQpdnesMv3aWU6jmA3VoTfeSqhVPvMdFeCErcSba2j" ], "script": "base64:AAIFAAAAAAAAABUIAhIAEgMKAQESAwoBARIAEgMKAQEAAAAFAAAAAAlCTE9DS1NURVAAAAAAAAAAAAoAAAAACUlOR09UQ09TVAAAAAAAAAAD6AAAAAAIUExPVENPU1QAAAAAAAABhqAAAAAABWdMdW1wAQAAACD3MI5LvZDW9hdsE5mwaJiKnQDcPy9bxLj3SQ9cNYQcswEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAAhsYXN0TWluZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAEAAAAOR29sZE1pbmVyczIwMjEJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACBQAAAAhsYXN0UGxheQgFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAAA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AAACAAAAAQIAAAAbTkZUIFBheW1lbnQgd2Fzbid0IGF0dGFjaGVkAwkAAAAAAAACBQAAAAdhc3NldElkAgAAAAAJAAACAAAAAQkAASwAAAACAgAAABBDYW4ndCBmaW5kIElOR09UCQABpAAAAAEFAAAAA3VpZAQAAAAHcGF5bWVudAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAMJAAAAAAAAAgkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQHCQAAAgAAAAECAAAAATEDCQEAAAACIT0AAAACCAUAAAAHcGF5bWVudAAAAAdhc3NldElkCQACWQAAAAEFAAAAB2Fzc2V0SWQJAAACAAAAAQkAASwAAAACAgAAABdXcm9uZyBJbmdvdCBpbiBQYXltZW50IAUAAAAHYXNzZXRJZAMJAQAAAAIhPQAAAAIIBQAAAAdwYXltZW50AAAABmFtb3VudAAAAAAAAAAAAQkAAAIAAAABAgAAABNXcm9uZyBpbmdvdCdzIGNvdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAICAAAACWdpdmVuX2J5XwUAAAAGY2FsbGVyBQAAAAhuZXdHaXZlbgUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnYgAAy", "height": 1625190, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DXXGmwcSycnyiaGqiKofSLZ4mb7NcmjhMwW9yJFHZJsf Next: Cjpgr9RroPaobTJ5VFMjrxxqdBrdsz7zvb7N2F8mUwYG Diff:
Old | New | Differences | |
---|---|---|---|
170 | 170 | let payment = i.payments[0] | |
171 | 171 | if ((isDefined(payment.assetId) == false)) | |
172 | 172 | then throw("1") | |
173 | - | else if ((payment.assetId != | |
173 | + | else if ((payment.assetId != fromBase58String(assetId))) | |
174 | 174 | then throw(("Wrong Ingot in Payment " + assetId)) | |
175 | 175 | else if ((payment.amount != 1)) | |
176 | 176 | then throw("Wrong ingot's count") |
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), IntegerEntry(("weight_" + toBase58String(nft)), count)] | |
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 | 142 | ||
143 | 143 | @Callable(i) | |
144 | 144 | func giveIngot (uid) = { | |
145 | 145 | let caller = toBase58String(i.caller.bytes) | |
146 | 146 | let assetId = match getString(this, ("ingot_" + toString(uid))) { | |
147 | 147 | case a: String => | |
148 | 148 | a | |
149 | 149 | case _ => | |
150 | 150 | "" | |
151 | 151 | } | |
152 | 152 | let given = match getInteger(this, ("given_by_" + caller)) { | |
153 | 153 | case a: Int => | |
154 | 154 | a | |
155 | 155 | case _ => | |
156 | 156 | 0 | |
157 | 157 | } | |
158 | 158 | let weight = match getInteger(this, ("weight_" + assetId)) { | |
159 | 159 | case a: Int => | |
160 | 160 | a | |
161 | 161 | case _ => | |
162 | 162 | 0 | |
163 | 163 | } | |
164 | 164 | let newGiven = (given + weight) | |
165 | 165 | if ((size(i.payments) == 0)) | |
166 | 166 | then throw("NFT Payment wasn't attached") | |
167 | 167 | else if ((assetId == "")) | |
168 | 168 | then throw(("Can't find INGOT" + toString(uid))) | |
169 | 169 | else { | |
170 | 170 | let payment = i.payments[0] | |
171 | 171 | if ((isDefined(payment.assetId) == false)) | |
172 | 172 | then throw("1") | |
173 | - | else if ((payment.assetId != | |
173 | + | else if ((payment.assetId != fromBase58String(assetId))) | |
174 | 174 | then throw(("Wrong Ingot in Payment " + assetId)) | |
175 | 175 | else if ((payment.amount != 1)) | |
176 | 176 | then throw("Wrong ingot's count") | |
177 | 177 | else [IntegerEntry(("given_by_" + caller), newGiven)] | |
178 | 178 | } | |
179 | 179 | } | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | @Verifier(tx) | |
183 | 183 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
184 | 184 |
github/deemru/w8io/026f985 28.32 ms ◑