tx · 4HnJUdhRFsoCD9ymTfmfSDQbJXFayBp3Gh6Cu9aCggR4 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh: -0.01000000 Waves 2021.07.15 19:58 [1614989] smart account 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh > SELF 0.00000000 Waves
{ "type": 13, "id": "4HnJUdhRFsoCD9ymTfmfSDQbJXFayBp3Gh6Cu9aCggR4", "fee": 1000000, "feeAssetId": null, "timestamp": 1626368328191, "version": 2, "chainId": 84, "sender": "3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh", "senderPublicKey": "D7edN6TZzQ6PbyWHGFdGMPJkkRNjR1Y32g7MmU7AXR73", "proofs": [ "4LVx2i9zs9GYfGC4iaQb3NBttR1ioJo8tnmCAAkJRbCRtKJXgE7W4JpumPLwLmHTkpkdko6Va1mS8Y8aXqRFct5U" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAEAAAAAAlCTE9DS1NURVAAAAAAAAAAAAoAAAAACUlOR09UQ09TVAAAAAAAAAAACgAAAAADUkVTAQAAACD3MI5LvZDW9hdsE5mwaJiKnQDcPy9bxLj3SQ9cNYQcswEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAAhsYXN0UGxheQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAEAAAAOR29sZE1pbmVyczIwMjEJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACBQAAAAhsYXN0UGxheQgFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAAAADaW52AAAAD2NhbGxlclB1YmxpY0tleQgFAAAACWxhc3RC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AAAAAAAAAAAAHCQAETAAAAAIJAQAAAARCdXJuAAAAAgUAAAADUkVTAAAAAAAAAAAKCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAADbmZ0CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAxpbmdvdHNfY291bnQFAAAACW5ld0luZ290cwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAABmluZ290XwkAAaQAAAABBQAAAAluZXdJbmdvdHMJAAJYAAAAAQUAAAADbmZ0BQAAAANuaWwAAAAAUmuXVw==", "height": 1614989, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9p3A64kThR1jptuYhX8eTKvY4t1sgsLkHoD676d7dNRy Next: FwZQ6ea5UhPUtCnr3doyWupnW42F2tgFR4UATXKjPm3d Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 10 | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = 10 | |
7 | 7 | ||
8 | - | func c (d) = { | |
9 | - | let e = { | |
10 | - | let f = getBinary(this, "lastPlay") | |
11 | - | if ($isInstanceOf(f, "ByteVector")) | |
8 | + | let c = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4' | |
9 | + | ||
10 | + | func d (e) = { | |
11 | + | let f = { | |
12 | + | let g = getBinary(this, "lastPlay") | |
13 | + | if ($isInstanceOf(g, "ByteVector")) | |
12 | 14 | then { | |
13 | - | let | |
14 | - | | |
15 | + | let h = g | |
16 | + | h | |
15 | 17 | } | |
16 | - | else if ($isInstanceOf( | |
18 | + | else if ($isInstanceOf(g, "Unit")) | |
17 | 19 | then base58'TGCTLFoHxJ8U7rcUofN' | |
18 | 20 | else throw("Match error") | |
19 | 21 | } | |
20 | - | let | |
21 | - | sha256( | |
22 | + | let i = (((((f + e.transactionId) + e.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
23 | + | sha256(i) | |
22 | 24 | } | |
23 | 25 | ||
24 | 26 | ||
25 | - | @Callable( | |
27 | + | @Callable(j) | |
26 | 28 | func goToMine () = { | |
27 | - | let | |
28 | - | let | |
29 | - | let | |
30 | - | if ($isInstanceOf( | |
29 | + | let k = toBase58String(j.caller.bytes) | |
30 | + | let l = { | |
31 | + | let g = getInteger(this, ("wait_" + k)) | |
32 | + | if ($isInstanceOf(g, "Int")) | |
31 | 33 | then { | |
32 | - | let | |
33 | - | | |
34 | + | let m = g | |
35 | + | m | |
34 | 36 | } | |
35 | 37 | else 0 | |
36 | 38 | } | |
37 | - | let | |
38 | - | let | |
39 | - | let | |
40 | - | if (( | |
39 | + | let n = (lastBlock.height + a) | |
40 | + | let o = d(j) | |
41 | + | let p = (toInt(o) % 1000) | |
42 | + | if ((l > lastBlock.height)) | |
41 | 43 | then throw((("Still wait block " + toString(lastBlock.height)) + " for mining")) | |
42 | - | else [IntegerEntry(("wait_" + | |
44 | + | else [IntegerEntry(("wait_" + k), n), ScriptTransfer(j.caller, p, c)] | |
43 | 45 | } | |
44 | 46 | ||
45 | 47 | ||
46 | 48 | ||
47 | - | @Callable( | |
49 | + | @Callable(j) | |
48 | 50 | func craftIngot () = { | |
49 | - | let | |
50 | - | let | |
51 | - | let | |
52 | - | if ($isInstanceOf( | |
51 | + | let k = toBase58String(j.caller.bytes) | |
52 | + | let q = { | |
53 | + | let g = getInteger(this, ("craft_" + k)) | |
54 | + | if ($isInstanceOf(g, "Int")) | |
53 | 55 | then { | |
54 | - | let | |
55 | - | | |
56 | + | let m = g | |
57 | + | m | |
56 | 58 | } | |
57 | 59 | else 0 | |
58 | 60 | } | |
59 | - | let | |
60 | - | let | |
61 | - | if ($isInstanceOf( | |
61 | + | let r = { | |
62 | + | let g = getInteger(this, "ingots_count") | |
63 | + | if ($isInstanceOf(g, "Int")) | |
62 | 64 | then { | |
63 | - | let | |
64 | - | | |
65 | + | let m = g | |
66 | + | m | |
65 | 67 | } | |
66 | 68 | else 0 | |
67 | 69 | } | |
68 | - | let r = (q + 1) | |
69 | - | let s = assetBalance(i.caller, b) | |
70 | - | if ((10 > s)) | |
71 | - | then throw("Not enough, need 1000 pieces") | |
70 | + | let s = (r + 1) | |
71 | + | if ((size(j.payments) == 0)) | |
72 | + | then throw("Payment not attached") | |
72 | 73 | else { | |
73 | - | let t = Issue("DEMO", "DEMO", 1, 0, false) | |
74 | - | let u = calculateAssetId(t) | |
75 | - | [Issue("DEMO", "DEMO", 1, 0, false), Burn(b, 10), ScriptTransfer(i.caller, 1, u), IntegerEntry("ingots_count", r), StringEntry(("ingot_" + toString(r)), toBase58String(u))] | |
74 | + | let t = j.payments[0] | |
75 | + | if ((t.assetId != c)) | |
76 | + | then throw("PAY IN RES TOKEN ONLY") | |
77 | + | else if ((t.amount != b)) | |
78 | + | then throw((("PAY " + toString(b)) + " RES TOKEN ONLY")) | |
79 | + | else { | |
80 | + | let u = Issue("DEMO", "DEMO", 1, 0, false) | |
81 | + | let v = calculateAssetId(u) | |
82 | + | [Issue(("INGOT" + toString(s)), ("INGOT" + toString(s)), 1, 0, false), Burn(c, 10), ScriptTransfer(j.caller, 1, v), IntegerEntry("ingots_count", s), StringEntry(("ingot_" + toString(s)), toBase58String(v))] | |
83 | + | } | |
76 | 84 | } | |
77 | 85 | } | |
78 | 86 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 10 | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = 10 | |
7 | 7 | ||
8 | - | func c (d) = { | |
9 | - | let e = { | |
10 | - | let f = getBinary(this, "lastPlay") | |
11 | - | if ($isInstanceOf(f, "ByteVector")) | |
8 | + | let c = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4' | |
9 | + | ||
10 | + | func d (e) = { | |
11 | + | let f = { | |
12 | + | let g = getBinary(this, "lastPlay") | |
13 | + | if ($isInstanceOf(g, "ByteVector")) | |
12 | 14 | then { | |
13 | - | let | |
14 | - | | |
15 | + | let h = g | |
16 | + | h | |
15 | 17 | } | |
16 | - | else if ($isInstanceOf( | |
18 | + | else if ($isInstanceOf(g, "Unit")) | |
17 | 19 | then base58'TGCTLFoHxJ8U7rcUofN' | |
18 | 20 | else throw("Match error") | |
19 | 21 | } | |
20 | - | let | |
21 | - | sha256( | |
22 | + | let i = (((((f + e.transactionId) + e.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
23 | + | sha256(i) | |
22 | 24 | } | |
23 | 25 | ||
24 | 26 | ||
25 | - | @Callable( | |
27 | + | @Callable(j) | |
26 | 28 | func goToMine () = { | |
27 | - | let | |
28 | - | let | |
29 | - | let | |
30 | - | if ($isInstanceOf( | |
29 | + | let k = toBase58String(j.caller.bytes) | |
30 | + | let l = { | |
31 | + | let g = getInteger(this, ("wait_" + k)) | |
32 | + | if ($isInstanceOf(g, "Int")) | |
31 | 33 | then { | |
32 | - | let | |
33 | - | | |
34 | + | let m = g | |
35 | + | m | |
34 | 36 | } | |
35 | 37 | else 0 | |
36 | 38 | } | |
37 | - | let | |
38 | - | let | |
39 | - | let | |
40 | - | if (( | |
39 | + | let n = (lastBlock.height + a) | |
40 | + | let o = d(j) | |
41 | + | let p = (toInt(o) % 1000) | |
42 | + | if ((l > lastBlock.height)) | |
41 | 43 | then throw((("Still wait block " + toString(lastBlock.height)) + " for mining")) | |
42 | - | else [IntegerEntry(("wait_" + | |
44 | + | else [IntegerEntry(("wait_" + k), n), ScriptTransfer(j.caller, p, c)] | |
43 | 45 | } | |
44 | 46 | ||
45 | 47 | ||
46 | 48 | ||
47 | - | @Callable( | |
49 | + | @Callable(j) | |
48 | 50 | func craftIngot () = { | |
49 | - | let | |
50 | - | let | |
51 | - | let | |
52 | - | if ($isInstanceOf( | |
51 | + | let k = toBase58String(j.caller.bytes) | |
52 | + | let q = { | |
53 | + | let g = getInteger(this, ("craft_" + k)) | |
54 | + | if ($isInstanceOf(g, "Int")) | |
53 | 55 | then { | |
54 | - | let | |
55 | - | | |
56 | + | let m = g | |
57 | + | m | |
56 | 58 | } | |
57 | 59 | else 0 | |
58 | 60 | } | |
59 | - | let | |
60 | - | let | |
61 | - | if ($isInstanceOf( | |
61 | + | let r = { | |
62 | + | let g = getInteger(this, "ingots_count") | |
63 | + | if ($isInstanceOf(g, "Int")) | |
62 | 64 | then { | |
63 | - | let | |
64 | - | | |
65 | + | let m = g | |
66 | + | m | |
65 | 67 | } | |
66 | 68 | else 0 | |
67 | 69 | } | |
68 | - | let r = (q + 1) | |
69 | - | let s = assetBalance(i.caller, b) | |
70 | - | if ((10 > s)) | |
71 | - | then throw("Not enough, need 1000 pieces") | |
70 | + | let s = (r + 1) | |
71 | + | if ((size(j.payments) == 0)) | |
72 | + | then throw("Payment not attached") | |
72 | 73 | else { | |
73 | - | let t = Issue("DEMO", "DEMO", 1, 0, false) | |
74 | - | let u = calculateAssetId(t) | |
75 | - | [Issue("DEMO", "DEMO", 1, 0, false), Burn(b, 10), ScriptTransfer(i.caller, 1, u), IntegerEntry("ingots_count", r), StringEntry(("ingot_" + toString(r)), toBase58String(u))] | |
74 | + | let t = j.payments[0] | |
75 | + | if ((t.assetId != c)) | |
76 | + | then throw("PAY IN RES TOKEN ONLY") | |
77 | + | else if ((t.amount != b)) | |
78 | + | then throw((("PAY " + toString(b)) + " RES TOKEN ONLY")) | |
79 | + | else { | |
80 | + | let u = Issue("DEMO", "DEMO", 1, 0, false) | |
81 | + | let v = calculateAssetId(u) | |
82 | + | [Issue(("INGOT" + toString(s)), ("INGOT" + toString(s)), 1, 0, false), Burn(c, 10), ScriptTransfer(j.caller, 1, v), IntegerEntry("ingots_count", s), StringEntry(("ingot_" + toString(s)), toBase58String(v))] | |
83 | + | } | |
76 | 84 | } | |
77 | 85 | } | |
78 | 86 | ||
79 | 87 |
github/deemru/w8io/169f3d6 39.61 ms ◑