tx · 7CF7CiMEY3DrD1a69vFXYgY2sGRyPWvigztskCf9if7y 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh: -0.01000000 Waves 2021.07.20 20:23 [1622231] smart account 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh > SELF 0.00000000 Waves
{ "type": 13, "id": "7CF7CiMEY3DrD1a69vFXYgY2sGRyPWvigztskCf9if7y", "fee": 1000000, "feeAssetId": null, "timestamp": 1626801880138, "version": 2, "chainId": 84, "sender": "3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh", "senderPublicKey": "D7edN6TZzQ6PbyWHGFdGMPJkkRNjR1Y32g7MmU7AXR73", "proofs": [ "5wUNME16PhoJYvMNJhKYTZ1q82vgfwqFJU4gwMo2rC29BUsUH6jFDhU8y8fKkYUzVzoabYdoiFdM7p9xfpT3JgB6" ], "script": "base64:AAIFAAAAAAAAAA4IAhIAEgMKAQESAwoBAQAAAAUAAAAACUJMT0NLU1RFUAAAAAAAAAAACgAAAAAJSU5HT1RDT1NUAAAAAAAAAAAKAAAAAAhQTE9UQ09TVAAAAAAAAAGGoAAAAAADUkVTAQAAACD3MI5LvZDW9hdsE5mwaJiKnQDcPy9bxLj3SQ9cNYQcswEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAAhsYXN0UGxheQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAEAAAAOR29sZE1pbmVyczIwMjEJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACBQAAAAhsYXN0UGxheQgFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAAAADaW52AAAAD2N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GVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAGY3JhZnRfBQAAAAZjYWxsZXIFAAAACG5ld0NyYWZ0BQAAAANuaWwAAAABaQEAAAAHYnV5UGxvdAAAAAEAAAAFcFNpemUEAAAABmNhbGxlcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAhwbG90U2l6ZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAICAAAABXBsb3RfBQAAAAZjYWxsZXIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAAIcGxvdFNpemUAAAAAAAAAAAAJAAACAAAAAQIAAAAYWW91IGFscmVhZHkgaGF2ZSBhIHBsb3QhBAAAAAdwYXltZW50CQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAARUGF5IGluIFdBVkVTIG9ubHkDCQEAAAACIT0AAAACCAUAAAAHcGF5bWVudAAAAAZhbW91bnQJAABoAAAAAgUAAAAFcFNpemUFAAAACFBMT1RDT1NUCQAAAgAAAAEJAAEsAAAAAgkAASwAAAACAgAAAARQYXkgCQABpAAAAAEJAABpAAAAAgkAAGgAAAACBQAAAAVwU2l6ZQUAAAAIUExPVENPU1QAAAAAAAX14QACAAAABiBXQVZFUwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAAAVwbG90XwUAAAAGY2FsbGVyBQAAAAVwU2l6ZQUAAAADbmlsAAAAAH24QGI=", "height": 1622231, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3rAPA8vAmWiikuJ8Pos8bP9vSFsctvHCB8aHVNSXiZmJ Next: 57w6JtZHw86Nq8BNcN3VkG9yQbcT2XY7Go5kBJRrsQSk Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | let BLOCKSTEP = 10 | |
5 | 5 | ||
6 | 6 | let INGOTCOST = 10 | |
7 | + | ||
8 | + | let PLOTCOST = 100000 | |
7 | 9 | ||
8 | 10 | let RES = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4' | |
9 | 11 | ||
84 | 86 | } | |
85 | 87 | ||
86 | 88 | ||
89 | + | ||
90 | + | @Callable(i) | |
91 | + | func buyPlot (pSize) = { | |
92 | + | let caller = toBase58String(i.caller.bytes) | |
93 | + | let plotSize = match getInteger(this, ("plot_" + caller)) { | |
94 | + | case a: Int => | |
95 | + | a | |
96 | + | case _ => | |
97 | + | 0 | |
98 | + | } | |
99 | + | if ((plotSize > 0)) | |
100 | + | then throw("You already have a plot!") | |
101 | + | else { | |
102 | + | let payment = i.payments[0] | |
103 | + | if (isDefined(payment.assetId)) | |
104 | + | then throw("Pay in WAVES only") | |
105 | + | else if ((payment.amount != (pSize * PLOTCOST))) | |
106 | + | then throw((("Pay " + toString(((pSize * PLOTCOST) / 100000000))) + " WAVES")) | |
107 | + | else [IntegerEntry(("plot_" + caller), pSize)] | |
108 | + | } | |
109 | + | } | |
110 | + | ||
111 | + |
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 = 10 | |
7 | + | ||
8 | + | let PLOTCOST = 100000 | |
7 | 9 | ||
8 | 10 | let RES = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4' | |
9 | 11 | ||
10 | 12 | func randomizer (inv) = { | |
11 | 13 | let lastPlay = match getBinary(this, "lastPlay") { | |
12 | 14 | case s: ByteVector => | |
13 | 15 | s | |
14 | 16 | case _: Unit => | |
15 | 17 | base58'TGCTLFoHxJ8U7rcUofN' | |
16 | 18 | case _ => | |
17 | 19 | throw("Match error") | |
18 | 20 | } | |
19 | 21 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
20 | 22 | sha256(rand) | |
21 | 23 | } | |
22 | 24 | ||
23 | 25 | ||
24 | 26 | @Callable(i) | |
25 | 27 | func goToMine () = { | |
26 | 28 | let caller = toBase58String(i.caller.bytes) | |
27 | 29 | let wait = match getInteger(this, ("wait_" + caller)) { | |
28 | 30 | case a: Int => | |
29 | 31 | a | |
30 | 32 | case _ => | |
31 | 33 | 0 | |
32 | 34 | } | |
33 | 35 | let newWait = (lastBlock.height + BLOCKSTEP) | |
34 | 36 | let randhash = randomizer(i) | |
35 | 37 | let count = (toInt(randhash) % 1000) | |
36 | 38 | if ((wait > lastBlock.height)) | |
37 | 39 | then throw((("Still wait block " + toString(wait)) + " for mining")) | |
38 | 40 | else [IntegerEntry(("wait_" + caller), newWait), ScriptTransfer(i.caller, count, RES)] | |
39 | 41 | } | |
40 | 42 | ||
41 | 43 | ||
42 | 44 | ||
43 | 45 | @Callable(i) | |
44 | 46 | func craftIngot (count) = { | |
45 | 47 | let caller = toBase58String(i.caller.bytes) | |
46 | 48 | let craft = match getInteger(this, ("craft_" + caller)) { | |
47 | 49 | case a: Int => | |
48 | 50 | a | |
49 | 51 | case _ => | |
50 | 52 | 0 | |
51 | 53 | } | |
52 | 54 | let ingots = match getInteger(this, "ingots_count") { | |
53 | 55 | case a: Int => | |
54 | 56 | a | |
55 | 57 | case _ => | |
56 | 58 | 0 | |
57 | 59 | } | |
58 | 60 | let newIngots = (ingots + 1) | |
59 | 61 | let newCraft = (lastBlock.height + BLOCKSTEP) | |
60 | 62 | if ((size(i.payments) == 0)) | |
61 | 63 | then throw("Payment not attached") | |
62 | 64 | else if ((craft > lastBlock.height)) | |
63 | 65 | then throw((("Still wait block " + toString(craft)) + " for crafting")) | |
64 | 66 | else if (if (if ((count != 1)) | |
65 | 67 | then (count != 10) | |
66 | 68 | else false) | |
67 | 69 | then (count != 50) | |
68 | 70 | else false) | |
69 | 71 | then throw("Wrong weight ingot!") | |
70 | 72 | else { | |
71 | 73 | let payment = i.payments[0] | |
72 | 74 | if ((payment.assetId != RES)) | |
73 | 75 | then throw("PAY IN RES TOKEN ONLY") | |
74 | 76 | else if ((payment.amount != (INGOTCOST * count))) | |
75 | 77 | then throw((("PAY " + toString((INGOTCOST * count))) + " RES TOKEN ONLY")) | |
76 | 78 | else { | |
77 | 79 | let issueName = ("INGOT" + toString(newIngots)) | |
78 | 80 | let issueDesc = (((((("{\"weight\":" + toString(count)) + ",\"uid\":") + toString(newIngots)) + ",\"made_by\":\"") + caller) + "\"}") | |
79 | 81 | let issue = Issue(issueName, issueDesc, 1, 0, false) | |
80 | 82 | let nft = calculateAssetId(issue) | |
81 | 83 | [Burn(RES, 10), 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)] | |
82 | 84 | } | |
83 | 85 | } | |
84 | 86 | } | |
85 | 87 | ||
86 | 88 | ||
89 | + | ||
90 | + | @Callable(i) | |
91 | + | func buyPlot (pSize) = { | |
92 | + | let caller = toBase58String(i.caller.bytes) | |
93 | + | let plotSize = match getInteger(this, ("plot_" + caller)) { | |
94 | + | case a: Int => | |
95 | + | a | |
96 | + | case _ => | |
97 | + | 0 | |
98 | + | } | |
99 | + | if ((plotSize > 0)) | |
100 | + | then throw("You already have a plot!") | |
101 | + | else { | |
102 | + | let payment = i.payments[0] | |
103 | + | if (isDefined(payment.assetId)) | |
104 | + | then throw("Pay in WAVES only") | |
105 | + | else if ((payment.amount != (pSize * PLOTCOST))) | |
106 | + | then throw((("Pay " + toString(((pSize * PLOTCOST) / 100000000))) + " WAVES")) | |
107 | + | else [IntegerEntry(("plot_" + caller), pSize)] | |
108 | + | } | |
109 | + | } | |
110 | + | ||
111 | + |
github/deemru/w8io/026f985 26.26 ms ◑