tx · A112PUstuUFk6AZBXzvqiAPqYjPdJdosZ63qvimexPF7
3N7MT5t1Gmyb9tcpdoUrd47pxXtTkAcgLsR: -0.01400000 Waves
2019.07.14 04:09 [584737] smart account 3N7MT5t1Gmyb9tcpdoUrd47pxXtTkAcgLsR > SELF 0.00000000 Waves
{
"type": 13,
"id": "A112PUstuUFk6AZBXzvqiAPqYjPdJdosZ63qvimexPF7",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1563066654089,
"version": 1,
"sender": "3N7MT5t1Gmyb9tcpdoUrd47pxXtTkAcgLsR",
"senderPublicKey": "Adn8NfJZ8ZXuWNMXb9VaY6X6kh6k6G3KMb1WQUesFUV",
"proofs": [
"JDgqSGAEK9pb78gN1cDhPZHGSf2uWPYpp5jx6GaU3WuSA4hAYnjqvhLgCHW5uautyUzptmkiD1SPSXsde9RS6H5"
],
"script": "base64:AAIDAAAAAAAAAAAAAAAeAAAAAA5vd25lclB1YmxpY0tleQEAAAAgAnfP9tCFuj2k2BUY5PW9DVGxrCHBHKJwugv8WyiaGXIAAAAABE5PTkUCAAAABG5vbmUAAAAABlZPVEVSUwAAAAAAAAAAAwAAAAAGUVVPUlVNAAAAAAAAAAACAAAAAAZWT1RJTkcCAAAABnZvdGluZwAAAAAGUkVWRUFMAgAAAAZyZXZlYWwAAAAACEZFQVRVUkVEAgAAAAhmZWF0dXJlZAAAAAAIREVMSVNURUQCAAAACGRlbGlzdGVkAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUA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eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADm93bmVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgeYrMVo",
"chainId": 84,
"height": 584737,
"spentComplexity": 0
}
View: original | compacted
Prev: 894iPjxFqLcpYsmtd9R8mtGehzij8DQbRaKRQFUjnSr2
Next: GYnxM71YvMp6wtjcJX9KgVWNT4jdQUBBf6zVSZ5XRAsT
Diff:
Old | New | | Differences |
---|
5 | 5 | | |
---|
6 | 6 | | let b = "none" |
---|
7 | 7 | | |
---|
8 | | - | func c (d) = { |
---|
9 | | - | let e = { |
---|
10 | | - | let f = getInteger(this, d) |
---|
11 | | - | if ($isInstanceOf(f, "Int")) |
---|
| 8 | + | let c = 3 |
---|
| 9 | + | |
---|
| 10 | + | let d = 2 |
---|
| 11 | + | |
---|
| 12 | + | let e = "voting" |
---|
| 13 | + | |
---|
| 14 | + | let f = "reveal" |
---|
| 15 | + | |
---|
| 16 | + | let g = "featured" |
---|
| 17 | + | |
---|
| 18 | + | let h = "delisted" |
---|
| 19 | + | |
---|
| 20 | + | func i (j) = { |
---|
| 21 | + | let k = { |
---|
| 22 | + | let l = getInteger(this, j) |
---|
| 23 | + | if ($isInstanceOf(l, "Int")) |
---|
12 | 24 | | then { |
---|
13 | | - | let g = f |
---|
14 | | - | g |
---|
| 25 | + | let m = l |
---|
| 26 | + | m |
---|
15 | 27 | | } |
---|
16 | 28 | | else 0 |
---|
17 | 29 | | } |
---|
18 | | - | e |
---|
| 30 | + | k |
---|
19 | 31 | | } |
---|
20 | 32 | | |
---|
21 | 33 | | |
---|
22 | | - | func h (d) = { |
---|
23 | | - | let i = { |
---|
24 | | - | let f = getString(this, d) |
---|
25 | | - | if ($isInstanceOf(f, "String")) |
---|
| 34 | + | func n (j) = { |
---|
| 35 | + | let o = { |
---|
| 36 | + | let l = getString(this, j) |
---|
| 37 | + | if ($isInstanceOf(l, "String")) |
---|
26 | 38 | | then { |
---|
27 | | - | let g = f |
---|
28 | | - | g |
---|
| 39 | + | let m = l |
---|
| 40 | + | m |
---|
29 | 41 | | } |
---|
30 | 42 | | else b |
---|
31 | 43 | | } |
---|
32 | | - | i |
---|
| 44 | + | o |
---|
33 | 45 | | } |
---|
34 | 46 | | |
---|
35 | 47 | | |
---|
36 | | - | func j (k) = (k + "_price") |
---|
| 48 | + | func p (q,r) = (((q + "_") + r) + "_commit") |
---|
37 | 49 | | |
---|
38 | 50 | | |
---|
39 | | - | func l (k) = c(j(k)) |
---|
| 51 | + | func s (q,r) = n(p(q, r)) |
---|
40 | 52 | | |
---|
41 | 53 | | |
---|
42 | | - | func m (n,k) = (((k + "_") + n) + "_cnt") |
---|
| 54 | + | func t (q) = (q + "_comcnt") |
---|
43 | 55 | | |
---|
44 | 56 | | |
---|
45 | | - | func o (n,k) = c(m(n, k)) |
---|
| 57 | + | func u (q) = i(t(q)) |
---|
46 | 58 | | |
---|
47 | 59 | | |
---|
48 | | - | func p (q,r) = ("item_" + toBase58String(sha256(toBytes((q + r))))) |
---|
| 60 | + | func v (q,r) = (((q + "_") + r) + "_reveal") |
---|
49 | 61 | | |
---|
50 | 62 | | |
---|
51 | | - | func s (k) = (k + "_data") |
---|
| 63 | + | func w (q,r) = n(v(q, r)) |
---|
52 | 64 | | |
---|
53 | 65 | | |
---|
54 | | - | func t (k) = (k + "_owner") |
---|
| 66 | + | func x (q) = (q + "_status") |
---|
55 | 67 | | |
---|
56 | 68 | | |
---|
57 | | - | func u (k) = h(t(k)) |
---|
| 69 | + | func y (q) = n(x(q)) |
---|
58 | 70 | | |
---|
59 | 71 | | |
---|
60 | | - | func v (w) = (w + "_balance") |
---|
| 72 | + | func z (q,A) = ((q + "_res:") + A) |
---|
61 | 73 | | |
---|
62 | 74 | | |
---|
63 | | - | func x (w) = c(v(w)) |
---|
| 75 | + | func B (q,A) = i(z(q, A)) |
---|
64 | 76 | | |
---|
65 | 77 | | |
---|
66 | | - | func y (k,n) = (((k + "_") + n) + "_commit") |
---|
| 78 | + | func C (q) = (q + "_price") |
---|
67 | 79 | | |
---|
68 | 80 | | |
---|
69 | | - | func z (k,n) = h(y(k, n)) |
---|
| 81 | + | func D (q) = i(C(q)) |
---|
70 | 82 | | |
---|
71 | 83 | | |
---|
72 | | - | func A (k) = (k + "_comcnt") |
---|
| 84 | + | func E (r,q) = (((q + "_") + r) + "_cnt") |
---|
73 | 85 | | |
---|
74 | 86 | | |
---|
75 | | - | func B (k) = c(A(k)) |
---|
| 87 | + | func F (r,q) = i(E(r, q)) |
---|
76 | 88 | | |
---|
77 | 89 | | |
---|
78 | | - | func C (k,n) = (((k + "_") + n) + "_reveal") |
---|
| 90 | + | func G (H,I) = ("item_" + toBase58String(sha256(toBytes((H + I))))) |
---|
79 | 91 | | |
---|
80 | 92 | | |
---|
81 | | - | func D (k,n) = h(C(k, n)) |
---|
| 93 | + | func J (q) = (q + "_data") |
---|
82 | 94 | | |
---|
83 | 95 | | |
---|
84 | | - | func E (k) = (k + "_status") |
---|
| 96 | + | func K (q) = (q + "_owner") |
---|
85 | 97 | | |
---|
86 | 98 | | |
---|
87 | | - | func F (k) = h(E(k)) |
---|
| 99 | + | func L (q) = n(K(q)) |
---|
88 | 100 | | |
---|
89 | 101 | | |
---|
90 | | - | func G (k,H) = ((k + "_res:") + H) |
---|
| 102 | + | func M (N) = (N + "_balance") |
---|
91 | 103 | | |
---|
92 | 104 | | |
---|
93 | | - | @Callable(I) |
---|
94 | | - | func purchase (k) = { |
---|
95 | | - | let J = extract(I.payment) |
---|
96 | | - | if (isDefined(J.assetId)) |
---|
| 105 | + | func O (N) = i(M(N)) |
---|
| 106 | + | |
---|
| 107 | + | |
---|
| 108 | + | @Callable(P) |
---|
| 109 | + | func purchase (q) = { |
---|
| 110 | + | let Q = extract(P.payment) |
---|
| 111 | + | if (isDefined(Q.assetId)) |
---|
97 | 112 | | then throw("can use WAVES only at the moment") |
---|
98 | 113 | | else { |
---|
99 | | - | let K = toBase58String(I.caller.bytes) |
---|
100 | | - | let L = l(k) |
---|
101 | | - | let M = u(k) |
---|
102 | | - | if ((L > J.amount)) |
---|
| 114 | + | let R = toBase58String(P.caller.bytes) |
---|
| 115 | + | let S = D(q) |
---|
| 116 | + | let T = L(q) |
---|
| 117 | + | if ((S > Q.amount)) |
---|
103 | 118 | | then throw("purchase amount cannot be less than item price") |
---|
104 | | - | else if ((J.amount > L)) |
---|
| 119 | + | else if ((Q.amount > S)) |
---|
105 | 120 | | then throw("purchase amount cannot be higher than item price") |
---|
106 | | - | else if ((M == b)) |
---|
| 121 | + | else if ((T == b)) |
---|
107 | 122 | | then throw("supplier does not exist") |
---|
108 | | - | else WriteSet([DataEntry(m(K, k), (o(K, k) + 1)), DataEntry(v(M), (x(M) + J.amount))]) |
---|
| 123 | + | else WriteSet([DataEntry(E(R, q), (F(R, q) + 1)), DataEntry(M(T), (O(T) + Q.amount))]) |
---|
109 | 124 | | } |
---|
110 | 125 | | } |
---|
111 | 126 | | |
---|
112 | 127 | | |
---|
113 | 128 | | |
---|
114 | | - | @Callable(I) |
---|
| 129 | + | @Callable(P) |
---|
115 | 130 | | func withdraw () = { |
---|
116 | | - | let M = toBase58String(I.caller.bytes) |
---|
117 | | - | let N = x(M) |
---|
118 | | - | if ((0 >= N)) |
---|
| 131 | + | let T = toBase58String(P.caller.bytes) |
---|
| 132 | + | let U = O(T) |
---|
| 133 | + | if ((0 >= U)) |
---|
119 | 134 | | then throw("insufficient balance") |
---|
120 | | - | else ScriptResult(WriteSet([DataEntry(v(M), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(M), N, unit)])) |
---|
| 135 | + | else ScriptResult(WriteSet([DataEntry(M(T), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(T), U, unit)])) |
---|
121 | 136 | | } |
---|
122 | 137 | | |
---|
123 | 138 | | |
---|
124 | 139 | | |
---|
125 | | - | @Callable(I) |
---|
126 | | - | func addItem (r,L,O) = { |
---|
127 | | - | let M = toBase58String(I.caller.bytes) |
---|
128 | | - | let k = p(M, r) |
---|
129 | | - | if ((0 >= L)) |
---|
| 140 | + | @Callable(P) |
---|
| 141 | + | func addItem (I,S,V) = { |
---|
| 142 | + | let T = toBase58String(P.caller.bytes) |
---|
| 143 | + | let q = G(T, I) |
---|
| 144 | + | if ((0 >= S)) |
---|
130 | 145 | | then throw("purchase amount cannot be less than item price") |
---|
131 | | - | else if ((u(k) != b)) |
---|
| 146 | + | else if ((L(q) != b)) |
---|
132 | 147 | | then throw("an item is already exist") |
---|
133 | | - | else WriteSet([DataEntry(t(k), M), DataEntry(j(k), L), DataEntry(s(k), O)]) |
---|
| 148 | + | else WriteSet([DataEntry(K(q), T), DataEntry(C(q), S), DataEntry(J(q), V)]) |
---|
134 | 149 | | } |
---|
135 | 150 | | |
---|
136 | 151 | | |
---|
137 | | - | @Verifier(P) |
---|
138 | | - | func Q () = { |
---|
139 | | - | let f = P |
---|
140 | | - | if ($isInstanceOf(f, "SetScriptTransaction")) |
---|
| 152 | + | @Verifier(W) |
---|
| 153 | + | func X () = { |
---|
| 154 | + | let l = W |
---|
| 155 | + | if ($isInstanceOf(l, "SetScriptTransaction")) |
---|
141 | 156 | | then { |
---|
142 | | - | let R = f |
---|
143 | | - | sigVerify(P.bodyBytes, P.proofs[0], a) |
---|
| 157 | + | let Y = l |
---|
| 158 | + | sigVerify(W.bodyBytes, W.proofs[0], a) |
---|
144 | 159 | | } |
---|
145 | | - | else if ($isInstanceOf(f, "DataTransaction")) |
---|
| 160 | + | else if ($isInstanceOf(l, "DataTransaction")) |
---|
146 | 161 | | then { |
---|
147 | | - | let R = f |
---|
| 162 | + | let Y = l |
---|
148 | 163 | | true |
---|
149 | 164 | | } |
---|
150 | | - | else if ($isInstanceOf(f, "TransferTransaction")) |
---|
| 165 | + | else if ($isInstanceOf(l, "TransferTransaction")) |
---|
151 | 166 | | then { |
---|
152 | | - | let R = f |
---|
| 167 | + | let Y = l |
---|
153 | 168 | | true |
---|
154 | 169 | | } |
---|
155 | 170 | | else false |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let a = base58'Adn8NfJZ8ZXuWNMXb9VaY6X6kh6k6G3KMb1WQUesFUV' |
---|
5 | 5 | | |
---|
6 | 6 | | let b = "none" |
---|
7 | 7 | | |
---|
8 | | - | func c (d) = { |
---|
9 | | - | let e = { |
---|
10 | | - | let f = getInteger(this, d) |
---|
11 | | - | if ($isInstanceOf(f, "Int")) |
---|
| 8 | + | let c = 3 |
---|
| 9 | + | |
---|
| 10 | + | let d = 2 |
---|
| 11 | + | |
---|
| 12 | + | let e = "voting" |
---|
| 13 | + | |
---|
| 14 | + | let f = "reveal" |
---|
| 15 | + | |
---|
| 16 | + | let g = "featured" |
---|
| 17 | + | |
---|
| 18 | + | let h = "delisted" |
---|
| 19 | + | |
---|
| 20 | + | func i (j) = { |
---|
| 21 | + | let k = { |
---|
| 22 | + | let l = getInteger(this, j) |
---|
| 23 | + | if ($isInstanceOf(l, "Int")) |
---|
12 | 24 | | then { |
---|
13 | | - | let g = f |
---|
14 | | - | g |
---|
| 25 | + | let m = l |
---|
| 26 | + | m |
---|
15 | 27 | | } |
---|
16 | 28 | | else 0 |
---|
17 | 29 | | } |
---|
18 | | - | e |
---|
| 30 | + | k |
---|
19 | 31 | | } |
---|
20 | 32 | | |
---|
21 | 33 | | |
---|
22 | | - | func h (d) = { |
---|
23 | | - | let i = { |
---|
24 | | - | let f = getString(this, d) |
---|
25 | | - | if ($isInstanceOf(f, "String")) |
---|
| 34 | + | func n (j) = { |
---|
| 35 | + | let o = { |
---|
| 36 | + | let l = getString(this, j) |
---|
| 37 | + | if ($isInstanceOf(l, "String")) |
---|
26 | 38 | | then { |
---|
27 | | - | let g = f |
---|
28 | | - | g |
---|
| 39 | + | let m = l |
---|
| 40 | + | m |
---|
29 | 41 | | } |
---|
30 | 42 | | else b |
---|
31 | 43 | | } |
---|
32 | | - | i |
---|
| 44 | + | o |
---|
33 | 45 | | } |
---|
34 | 46 | | |
---|
35 | 47 | | |
---|
36 | | - | func j (k) = (k + "_price") |
---|
| 48 | + | func p (q,r) = (((q + "_") + r) + "_commit") |
---|
37 | 49 | | |
---|
38 | 50 | | |
---|
39 | | - | func l (k) = c(j(k)) |
---|
| 51 | + | func s (q,r) = n(p(q, r)) |
---|
40 | 52 | | |
---|
41 | 53 | | |
---|
42 | | - | func m (n,k) = (((k + "_") + n) + "_cnt") |
---|
| 54 | + | func t (q) = (q + "_comcnt") |
---|
43 | 55 | | |
---|
44 | 56 | | |
---|
45 | | - | func o (n,k) = c(m(n, k)) |
---|
| 57 | + | func u (q) = i(t(q)) |
---|
46 | 58 | | |
---|
47 | 59 | | |
---|
48 | | - | func p (q,r) = ("item_" + toBase58String(sha256(toBytes((q + r))))) |
---|
| 60 | + | func v (q,r) = (((q + "_") + r) + "_reveal") |
---|
49 | 61 | | |
---|
50 | 62 | | |
---|
51 | | - | func s (k) = (k + "_data") |
---|
| 63 | + | func w (q,r) = n(v(q, r)) |
---|
52 | 64 | | |
---|
53 | 65 | | |
---|
54 | | - | func t (k) = (k + "_owner") |
---|
| 66 | + | func x (q) = (q + "_status") |
---|
55 | 67 | | |
---|
56 | 68 | | |
---|
57 | | - | func u (k) = h(t(k)) |
---|
| 69 | + | func y (q) = n(x(q)) |
---|
58 | 70 | | |
---|
59 | 71 | | |
---|
60 | | - | func v (w) = (w + "_balance") |
---|
| 72 | + | func z (q,A) = ((q + "_res:") + A) |
---|
61 | 73 | | |
---|
62 | 74 | | |
---|
63 | | - | func x (w) = c(v(w)) |
---|
| 75 | + | func B (q,A) = i(z(q, A)) |
---|
64 | 76 | | |
---|
65 | 77 | | |
---|
66 | | - | func y (k,n) = (((k + "_") + n) + "_commit") |
---|
| 78 | + | func C (q) = (q + "_price") |
---|
67 | 79 | | |
---|
68 | 80 | | |
---|
69 | | - | func z (k,n) = h(y(k, n)) |
---|
| 81 | + | func D (q) = i(C(q)) |
---|
70 | 82 | | |
---|
71 | 83 | | |
---|
72 | | - | func A (k) = (k + "_comcnt") |
---|
| 84 | + | func E (r,q) = (((q + "_") + r) + "_cnt") |
---|
73 | 85 | | |
---|
74 | 86 | | |
---|
75 | | - | func B (k) = c(A(k)) |
---|
| 87 | + | func F (r,q) = i(E(r, q)) |
---|
76 | 88 | | |
---|
77 | 89 | | |
---|
78 | | - | func C (k,n) = (((k + "_") + n) + "_reveal") |
---|
| 90 | + | func G (H,I) = ("item_" + toBase58String(sha256(toBytes((H + I))))) |
---|
79 | 91 | | |
---|
80 | 92 | | |
---|
81 | | - | func D (k,n) = h(C(k, n)) |
---|
| 93 | + | func J (q) = (q + "_data") |
---|
82 | 94 | | |
---|
83 | 95 | | |
---|
84 | | - | func E (k) = (k + "_status") |
---|
| 96 | + | func K (q) = (q + "_owner") |
---|
85 | 97 | | |
---|
86 | 98 | | |
---|
87 | | - | func F (k) = h(E(k)) |
---|
| 99 | + | func L (q) = n(K(q)) |
---|
88 | 100 | | |
---|
89 | 101 | | |
---|
90 | | - | func G (k,H) = ((k + "_res:") + H) |
---|
| 102 | + | func M (N) = (N + "_balance") |
---|
91 | 103 | | |
---|
92 | 104 | | |
---|
93 | | - | @Callable(I) |
---|
94 | | - | func purchase (k) = { |
---|
95 | | - | let J = extract(I.payment) |
---|
96 | | - | if (isDefined(J.assetId)) |
---|
| 105 | + | func O (N) = i(M(N)) |
---|
| 106 | + | |
---|
| 107 | + | |
---|
| 108 | + | @Callable(P) |
---|
| 109 | + | func purchase (q) = { |
---|
| 110 | + | let Q = extract(P.payment) |
---|
| 111 | + | if (isDefined(Q.assetId)) |
---|
97 | 112 | | then throw("can use WAVES only at the moment") |
---|
98 | 113 | | else { |
---|
99 | | - | let K = toBase58String(I.caller.bytes) |
---|
100 | | - | let L = l(k) |
---|
101 | | - | let M = u(k) |
---|
102 | | - | if ((L > J.amount)) |
---|
| 114 | + | let R = toBase58String(P.caller.bytes) |
---|
| 115 | + | let S = D(q) |
---|
| 116 | + | let T = L(q) |
---|
| 117 | + | if ((S > Q.amount)) |
---|
103 | 118 | | then throw("purchase amount cannot be less than item price") |
---|
104 | | - | else if ((J.amount > L)) |
---|
| 119 | + | else if ((Q.amount > S)) |
---|
105 | 120 | | then throw("purchase amount cannot be higher than item price") |
---|
106 | | - | else if ((M == b)) |
---|
| 121 | + | else if ((T == b)) |
---|
107 | 122 | | then throw("supplier does not exist") |
---|
108 | | - | else WriteSet([DataEntry(m(K, k), (o(K, k) + 1)), DataEntry(v(M), (x(M) + J.amount))]) |
---|
| 123 | + | else WriteSet([DataEntry(E(R, q), (F(R, q) + 1)), DataEntry(M(T), (O(T) + Q.amount))]) |
---|
109 | 124 | | } |
---|
110 | 125 | | } |
---|
111 | 126 | | |
---|
112 | 127 | | |
---|
113 | 128 | | |
---|
114 | | - | @Callable(I) |
---|
| 129 | + | @Callable(P) |
---|
115 | 130 | | func withdraw () = { |
---|
116 | | - | let M = toBase58String(I.caller.bytes) |
---|
117 | | - | let N = x(M) |
---|
118 | | - | if ((0 >= N)) |
---|
| 131 | + | let T = toBase58String(P.caller.bytes) |
---|
| 132 | + | let U = O(T) |
---|
| 133 | + | if ((0 >= U)) |
---|
119 | 134 | | then throw("insufficient balance") |
---|
120 | | - | else ScriptResult(WriteSet([DataEntry(v(M), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(M), N, unit)])) |
---|
| 135 | + | else ScriptResult(WriteSet([DataEntry(M(T), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(T), U, unit)])) |
---|
121 | 136 | | } |
---|
122 | 137 | | |
---|
123 | 138 | | |
---|
124 | 139 | | |
---|
125 | | - | @Callable(I) |
---|
126 | | - | func addItem (r,L,O) = { |
---|
127 | | - | let M = toBase58String(I.caller.bytes) |
---|
128 | | - | let k = p(M, r) |
---|
129 | | - | if ((0 >= L)) |
---|
| 140 | + | @Callable(P) |
---|
| 141 | + | func addItem (I,S,V) = { |
---|
| 142 | + | let T = toBase58String(P.caller.bytes) |
---|
| 143 | + | let q = G(T, I) |
---|
| 144 | + | if ((0 >= S)) |
---|
130 | 145 | | then throw("purchase amount cannot be less than item price") |
---|
131 | | - | else if ((u(k) != b)) |
---|
| 146 | + | else if ((L(q) != b)) |
---|
132 | 147 | | then throw("an item is already exist") |
---|
133 | | - | else WriteSet([DataEntry(t(k), M), DataEntry(j(k), L), DataEntry(s(k), O)]) |
---|
| 148 | + | else WriteSet([DataEntry(K(q), T), DataEntry(C(q), S), DataEntry(J(q), V)]) |
---|
134 | 149 | | } |
---|
135 | 150 | | |
---|
136 | 151 | | |
---|
137 | | - | @Verifier(P) |
---|
138 | | - | func Q () = { |
---|
139 | | - | let f = P |
---|
140 | | - | if ($isInstanceOf(f, "SetScriptTransaction")) |
---|
| 152 | + | @Verifier(W) |
---|
| 153 | + | func X () = { |
---|
| 154 | + | let l = W |
---|
| 155 | + | if ($isInstanceOf(l, "SetScriptTransaction")) |
---|
141 | 156 | | then { |
---|
142 | | - | let R = f |
---|
143 | | - | sigVerify(P.bodyBytes, P.proofs[0], a) |
---|
| 157 | + | let Y = l |
---|
| 158 | + | sigVerify(W.bodyBytes, W.proofs[0], a) |
---|
144 | 159 | | } |
---|
145 | | - | else if ($isInstanceOf(f, "DataTransaction")) |
---|
| 160 | + | else if ($isInstanceOf(l, "DataTransaction")) |
---|
146 | 161 | | then { |
---|
147 | | - | let R = f |
---|
| 162 | + | let Y = l |
---|
148 | 163 | | true |
---|
149 | 164 | | } |
---|
150 | | - | else if ($isInstanceOf(f, "TransferTransaction")) |
---|
| 165 | + | else if ($isInstanceOf(l, "TransferTransaction")) |
---|
151 | 166 | | then { |
---|
152 | | - | let R = f |
---|
| 167 | + | let Y = l |
---|
153 | 168 | | true |
---|
154 | 169 | | } |
---|
155 | 170 | | else false |
---|
156 | 171 | | } |
---|
157 | 172 | | |
---|