tx · 4BuD23wT1PCZ9SadC6BpUAYeVA84G4nUuwTdhkhCm5nE 3MvVZ5AroXL8DZKAmuENPSLDrgcfcvzdVSj: -0.01400000 Waves 2019.12.09 15:22 [801236] smart account 3MvVZ5AroXL8DZKAmuENPSLDrgcfcvzdVSj > SELF 0.00000000 Waves
{ "type": 13, "id": "4BuD23wT1PCZ9SadC6BpUAYeVA84G4nUuwTdhkhCm5nE", "fee": 1400000, "feeAssetId": null, "timestamp": 1575894203909, "version": 1, "sender": "3MvVZ5AroXL8DZKAmuENPSLDrgcfcvzdVSj", "senderPublicKey": "2UynDMb6k4udKULdb2QVAXTd6ppGoe8VnAeSjJqNYfRz", "proofs": [ "5xXSVQnFUWicffBray31PdSLv9x8BrEj9MAABQ4gRabjie2y4zNuqjHtHsB55aFyXBCYEZyXu5NzzJb1bQArKReD" ], "script": "base64:AAIDAAAAAAAAABAIARIFCgMIAQgSAwoBCBIAAAAADQAAAAAETk9ORQIAAAAEbm9uZQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQUAAAADc3RyAQAAAA9nZXRLZXlJdGVtUHJpY2UAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAGX3ByaWNlAQAAABFnZXRWYWx1ZUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkBAAAADmdldE51bWJlckJ5S2V5AAAAAQkB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sYW5jZVN1cHBsaWVyAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzAwkAAGcAAAACAAAAAAAAAAAABQAAAAdiYWxhbmNlCQAAAgAAAAECAAAAFGluc3VmZmljaWVudCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFWdldEtleUJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAAAdiYWxhbmNlBQAAAAR1bml0BQAAAANuaWwAAAAA6nOiyw==", "chainId": 84, "height": 801236, "spentComplexity": 0 } View: original | compacted Prev: none Next: BaCnbzkWrq5fZxWFTKA5ZQo27tYLKfP92Ti7RQqfzG4q Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = "none" | |
5 | + | ||
6 | + | func b (c) = { | |
7 | + | let d = { | |
8 | + | let e = getInteger(this, c) | |
9 | + | if ($isInstanceOf(e, "Int")) | |
10 | + | then { | |
11 | + | let f = e | |
12 | + | f | |
13 | + | } | |
14 | + | else 0 | |
15 | + | } | |
16 | + | d | |
17 | + | } | |
18 | + | ||
19 | + | ||
20 | + | func g (c) = { | |
21 | + | let h = { | |
22 | + | let e = getString(this, c) | |
23 | + | if ($isInstanceOf(e, "String")) | |
24 | + | then { | |
25 | + | let f = e | |
26 | + | f | |
27 | + | } | |
28 | + | else a | |
29 | + | } | |
30 | + | h | |
31 | + | } | |
32 | + | ||
33 | + | ||
34 | + | func i (j) = (j + "_price") | |
35 | + | ||
36 | + | ||
37 | + | func k (j) = b(i(j)) | |
38 | + | ||
39 | + | ||
40 | + | func l (m,j) = (((j + "_") + m) + "_cnt") | |
41 | + | ||
42 | + | ||
43 | + | func n (m,j) = b(l(m, j)) | |
44 | + | ||
45 | + | ||
46 | + | func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q))))) | |
47 | + | ||
48 | + | ||
49 | + | func r (j) = (j + "_data") | |
50 | + | ||
51 | + | ||
52 | + | func s (j) = (j + "_owner") | |
53 | + | ||
54 | + | ||
55 | + | func t (j) = g(s(j)) | |
56 | + | ||
57 | + | ||
58 | + | func u (v) = (v + "_balance") | |
59 | + | ||
60 | + | ||
61 | + | func w (v) = b(u(v)) | |
62 | + | ||
63 | + | ||
64 | + | @Callable(x) | |
65 | + | func addItem (q,y,z) = { | |
66 | + | let A = toBase58String(x.caller.bytes) | |
67 | + | let j = o(A, q) | |
68 | + | if ((0 >= y)) | |
69 | + | then throw("purchase amount cannot be less than item price") | |
70 | + | else if ((t(j) != a)) | |
71 | + | then throw("an item is already exist") | |
72 | + | else WriteSet([DataEntry(s(j), A), DataEntry(i(j), y), DataEntry(r(j), z)]) | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(x) | |
78 | + | func purchase (j) = { | |
79 | + | let B = extract(x.payment) | |
80 | + | if (isDefined(B.assetId)) | |
81 | + | then throw("WAVES tokens only at the moment") | |
82 | + | else { | |
83 | + | let C = toBase58String(x.caller.bytes) | |
84 | + | let y = k(j) | |
85 | + | let A = t(j) | |
86 | + | if ((y > B.amount)) | |
87 | + | then throw("purchase amount cannot be less than item price") | |
88 | + | else if ((B.amount > y)) | |
89 | + | then throw("purchase amount cannot be higher than item price") | |
90 | + | else if ((A == a)) | |
91 | + | then throw("supplier does not exist") | |
92 | + | else WriteSet([DataEntry(l(C, j), (n(C, j) + 1)), DataEntry(u(A), (w(A) + B.amount))]) | |
93 | + | } | |
94 | + | } | |
95 | + | ||
96 | + | ||
97 | + | ||
98 | + | @Callable(x) | |
99 | + | func withdraw () = { | |
100 | + | let A = toBase58String(x.caller.bytes) | |
101 | + | let D = w(A) | |
102 | + | if ((0 >= D)) | |
103 | + | then throw("insufficient balance") | |
104 | + | else ScriptResult(WriteSet([DataEntry(u(A), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(A), D, unit)])) | |
105 | + | } | |
106 | + | ||
107 | + |
github/deemru/w8io/026f985 20.89 ms ◑