tx · AgKKfnEeXYjAaihuke9gRtrYUosRzBbnuL3dS1ZxWjpL 3MwnT11gaYsujkGzyqjCcmSiM9PBLMgNhv5: -0.01000000 Waves 2019.09.04 10:50 [660966] smart account 3MwnT11gaYsujkGzyqjCcmSiM9PBLMgNhv5 > SELF 0.00000000 Waves
{ "type": 13, "id": "AgKKfnEeXYjAaihuke9gRtrYUosRzBbnuL3dS1ZxWjpL", "fee": 1000000, "feeAssetId": null, "timestamp": 1567583404849, "version": 1, "sender": "3MwnT11gaYsujkGzyqjCcmSiM9PBLMgNhv5", "senderPublicKey": "3jJFistMjd5qokz2VLaD1PynRXBhDKREFZCgBibyKF7C", "proofs": [ "1wPbdVwr2hnrjf5g4HrkRfxo6iiTKMt5P4cQSkvTy1U8YBnox549cvb1nX8VH9nW9QSF29szH4onq6HyFZMJVS2" ], "script": "base64:AAIDAAAAAAAAAAAAAAAOAAAAAAtvd25lclB1YktleQEAAABBAZkWLznUd6IFdwagshj88MZgqRsgYkLqTh4N0ei+1lZPmw5tnh7y/g/7B+MZN3zq3Mc7iwEydIsASpVTzXihHpgAAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZ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AckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAC293bmVyUHViS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAF0BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAALb3duZXJQdWJLZXkH59kR2A==", "chainId": 84, "height": 660966, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = base58'9BNzoBpPncPuyfnnRMbhXipbhWyiYMQSV4NAnZYKM3jJFistMjd5qokz2VLaD1PynRXBhDKREFZCgBibyKF7CS4F' | |
5 | + | ||
6 | + | let b = "none" | |
7 | + | ||
8 | + | func c (d) = { | |
9 | + | let e = { | |
10 | + | let f = getInteger(this, d) | |
11 | + | if ($isInstanceOf(f, "Int")) | |
12 | + | then { | |
13 | + | let g = f | |
14 | + | g | |
15 | + | } | |
16 | + | else 0 | |
17 | + | } | |
18 | + | e | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func h (d) = { | |
23 | + | let i = { | |
24 | + | let f = getString(this, d) | |
25 | + | if ($isInstanceOf(f, "String")) | |
26 | + | then { | |
27 | + | let g = f | |
28 | + | g | |
29 | + | } | |
30 | + | else b | |
31 | + | } | |
32 | + | i | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func j (k) = (k + "_price") | |
37 | + | ||
38 | + | ||
39 | + | func l (k) = c(j(k)) | |
40 | + | ||
41 | + | ||
42 | + | func m (n,k) = (((k + "_") + n) + "_cnt") | |
43 | + | ||
44 | + | ||
45 | + | func o (n,k) = c(m(n, k)) | |
46 | + | ||
47 | + | ||
48 | + | func p (q,r) = ("item_" + toBase58String(sha256(toBytes((q + r))))) | |
49 | + | ||
50 | + | ||
51 | + | func s (k) = (k + "_data") | |
52 | + | ||
53 | + | ||
54 | + | func t (k) = (k + "_owner") | |
55 | + | ||
56 | + | ||
57 | + | func u (k) = h(t(k)) | |
58 | + | ||
59 | + | ||
60 | + | func v (w) = (w + "_balance") | |
61 | + | ||
62 | + | ||
63 | + | func x (w) = c(v(w)) | |
64 | + | ||
65 | + | ||
66 | + | @Callable(y) | |
67 | + | func addItem (r,z,A) = { | |
68 | + | let B = toBase58String(y.caller.bytes) | |
69 | + | let k = p(B, r) | |
70 | + | if ((0 >= z)) | |
71 | + | then throw("purchase amount cannot be less than item price") | |
72 | + | else if ((u(k) != b)) | |
73 | + | then throw("an item is already exist") | |
74 | + | else WriteSet([DataEntry(t(k), B), DataEntry(j(k), z), DataEntry(s(k), A)]) | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | @Callable(y) | |
80 | + | func purchase (k) = { | |
81 | + | let C = extract(y.payment) | |
82 | + | if (isDefined(C.assetId)) | |
83 | + | then throw("can use WAVES only at the moment") | |
84 | + | else { | |
85 | + | let D = toBase58String(y.caller.bytes) | |
86 | + | let z = l(k) | |
87 | + | let B = u(k) | |
88 | + | if ((z > C.amount)) | |
89 | + | then throw("purchase amount cannot be less than item price") | |
90 | + | else if ((C.amount > z)) | |
91 | + | then throw("purchase amount cannot be higher than item price") | |
92 | + | else if ((B == b)) | |
93 | + | then throw("supplier does not exist") | |
94 | + | else WriteSet([DataEntry(m(D, k), (o(D, k) + 1)), DataEntry(v(B), (x(B) + C.amount))]) | |
95 | + | } | |
96 | + | } | |
97 | + | ||
98 | + | ||
99 | + | @Verifier(E) | |
100 | + | func F () = { | |
101 | + | let f = E | |
102 | + | if ($isInstanceOf(f, "SetScriptTransaction")) | |
103 | + | then { | |
104 | + | let G = f | |
105 | + | sigVerify(E.bodyBytes, E.proofs[0], a) | |
106 | + | } | |
107 | + | else if ($isInstanceOf(f, "DataTransaction")) | |
108 | + | then { | |
109 | + | let G = f | |
110 | + | true | |
111 | + | } | |
112 | + | else if ($isInstanceOf(f, "TransferTransaction")) | |
113 | + | then { | |
114 | + | let H = f | |
115 | + | sigVerify(E.bodyBytes, E.proofs[0], a) | |
116 | + | } | |
117 | + | else false | |
118 | + | } | |
119 | + |
github/deemru/w8io/169f3d6 25.17 ms ◑