tx · 7aLashpvzL1MedRKVKuCWzNE3CVEweNkGjd6PnsPbC4G 3N3ZrYPbUg5P2Wo8FRstbPJscPcEhDeB13b: -0.01400000 Waves 2019.08.28 11:18 [650798] smart account 3N3ZrYPbUg5P2Wo8FRstbPJscPcEhDeB13b > SELF 0.00000000 Waves
{ "type": 13, "id": "7aLashpvzL1MedRKVKuCWzNE3CVEweNkGjd6PnsPbC4G", "fee": 1400000, "feeAssetId": null, "timestamp": 1566980276382, "version": 1, "sender": "3N3ZrYPbUg5P2Wo8FRstbPJscPcEhDeB13b", "senderPublicKey": "74WRRf71Ms5ucMFsCkQ4dYQUpEiWos3VtDYMQjNwWntY", "proofs": [ "2FbDe8MmpLYjmsNko1MkJk7iGjshNVGQyYCDaMoNdsgVg2ZuvfvKPJocL9xupURuFh6Q8sPUovRCfAxkZHFFmDZN" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIWNhbiBob2RsIHdhdmVzIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZAAAAAIFAAAADWN1cnJlbnRBbW91bnQIBQAAAANwbXQAAAAGYW1vdW50CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAApjdXJyZW50S2V5BQAAAAluZXdBbW91bnQFAAAAA25pbAAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABlAAAAAgUAAAANY3VycmVudEFtb3VudAUAAAAGYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAZhbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAluZXdBbW91bnQJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHVuaXQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAH+28kpg==", "chainId": 84, "height": 650798, "spentComplexity": 0 } View: original | compacted Prev: Eg98CmkFLcRrgx94vv7pbs2R1myLFwgJwgUbQQ1L5hHV Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = base58'3MtpNV4Fin2hjw5pmA5ZJHLSPVAkVLiN3Bi' | |
5 | - | ||
6 | - | let b = 0 | |
7 | - | ||
8 | - | let c = 1 | |
9 | - | ||
10 | - | let d = 2 | |
11 | - | ||
12 | - | let e = 3 | |
13 | - | ||
14 | - | let f = 4 | |
15 | - | ||
16 | - | let g = 5 | |
17 | - | ||
18 | - | let h = "BUY" | |
19 | - | ||
20 | - | let i = "SELL" | |
21 | - | ||
22 | - | func j (k) = fraction(k, 999, 1000) | |
23 | 4 | ||
24 | 5 | ||
25 | - | func l (k) = (k - fraction(k, 999, 1000)) | |
26 | - | ||
27 | - | ||
28 | - | func m (n) = if ((size(n) > 0)) | |
29 | - | then drop(n, 1) | |
30 | - | else n | |
31 | - | ||
32 | - | ||
33 | - | func o (p) = { | |
34 | - | let q = size(p) | |
35 | - | if ((q == 0)) | |
36 | - | then throw("Parameter size must be greater then 0") | |
37 | - | else if ((q > 99)) | |
38 | - | then throw("Parameter size must be less then 100") | |
39 | - | else if ((10 > q)) | |
40 | - | then (("0" + toString(q)) + p) | |
41 | - | else (toString(q) + p) | |
42 | - | } | |
43 | - | ||
44 | - | ||
45 | - | func r (n) = { | |
46 | - | let q = size(n) | |
47 | - | if ((q > 0)) | |
48 | - | then { | |
49 | - | let s = parseIntValue(take(n, 2)) | |
50 | - | let t = take(drop(n, 2), s) | |
51 | - | let u = drop(n, (s + 2)) | |
52 | - | let v = m(u) | |
53 | - | [t, v] | |
54 | - | } | |
55 | - | else throw("Empty string was passed into parseNextAttribute func") | |
56 | - | } | |
57 | - | ||
58 | - | ||
59 | - | func w (x,y,z,A,k,B) = { | |
60 | - | let C = ((((((((((o(x) + "_") + o(y)) + "_") + o(z)) + "_") + o(toString(A))) + "_") + o(toString(k))) + "_") + o(B)) | |
61 | - | C | |
62 | - | } | |
63 | - | ||
64 | - | ||
65 | - | func D (E) = { | |
66 | - | let F = r(E) | |
67 | - | let y = r(F[1]) | |
68 | - | let z = r(y[1]) | |
69 | - | let A = r(z[1]) | |
70 | - | let k = r(A[1]) | |
71 | - | let B = r(k[1]) | |
72 | - | [A[0], k[0], F[0], z[0], y[0], B[0]] | |
73 | - | } | |
74 | - | ||
75 | - | ||
76 | - | func G (H) = if ((H == 0)) | |
77 | - | then 1 | |
78 | - | else if ((H == 1)) | |
79 | - | then 10 | |
80 | - | else if ((H == 2)) | |
81 | - | then 100 | |
82 | - | else if ((H == 3)) | |
83 | - | then 1000 | |
84 | - | else if ((H == 4)) | |
85 | - | then 10000 | |
86 | - | else if ((H == 5)) | |
87 | - | then 100000 | |
88 | - | else if ((H == 6)) | |
89 | - | then 1000000 | |
90 | - | else if ((H == 7)) | |
91 | - | then 10000000 | |
92 | - | else if ((H == 8)) | |
93 | - | then 100000000 | |
94 | - | else if ((H == 9)) | |
95 | - | then 1000000000 | |
96 | - | else if ((H == 10)) | |
97 | - | then 10000000000 | |
98 | - | else if ((H == 11)) | |
99 | - | then 100000000000 | |
100 | - | else if ((H == 12)) | |
101 | - | then 1000000000000 | |
102 | - | else throw("Pow10 more then 12 is not supported") | |
103 | - | ||
104 | - | ||
105 | - | func I (B) = if (if ((B == "WAVES")) | |
106 | - | then true | |
107 | - | else (B == "")) | |
108 | - | then unit | |
109 | - | else fromBase58String(B) | |
110 | - | ||
111 | - | ||
112 | - | @Callable(J) | |
113 | - | func order (B,A) = { | |
114 | - | let K = extract(J.payment) | |
115 | - | let L = if (isDefined(K.assetId)) | |
116 | - | then toBase58String(value(K.assetId)) | |
117 | - | else "WAVES" | |
118 | - | let M = getString(this, ((B + "/") + L)) | |
119 | - | let N = getString(this, ((L + "/") + B)) | |
120 | - | let x = if (isDefined(M)) | |
121 | - | then value(M) | |
122 | - | else if (isDefined(N)) | |
123 | - | then value(N) | |
124 | - | else throw("Traiding for that assets is not supported") | |
125 | - | let z = if (isDefined(M)) | |
126 | - | then h | |
127 | - | else i | |
128 | - | let O = w(x, toBase58String(J.caller.bytes), z, A, K.amount, L) | |
129 | - | WriteSet([DataEntry(toBase58String(J.transactionId), O)]) | |
130 | - | } | |
131 | - | ||
132 | - | ||
133 | - | ||
134 | - | @Callable(J) | |
135 | - | func matchOrders (P,Q) = { | |
136 | - | let R = D(getStringValue(this, P)) | |
137 | - | let S = D(getStringValue(this, Q)) | |
138 | - | if ((R[d] != S[d])) | |
139 | - | then throw("Trying to match orders from different trading pairs") | |
140 | - | else if ((R[e] == S[e])) | |
141 | - | then throw("Trying to match orders of the same type") | |
142 | - | else { | |
143 | - | let T = (R[e] == i) | |
144 | - | let U = if (T) | |
145 | - | then R | |
146 | - | else S | |
147 | - | let V = if (!(T)) | |
148 | - | then R | |
149 | - | else S | |
150 | - | let W = parseIntValue(U[b]) | |
151 | - | let X = parseIntValue(V[b]) | |
152 | - | let Y = parseIntValue(U[c]) | |
153 | - | let Z = parseIntValue(V[c]) | |
154 | - | if ((W > X)) | |
155 | - | then throw("Orders are not match by price") | |
156 | - | else { | |
157 | - | let aa = W | |
158 | - | let ab = if ((U[g] == "WAVES")) | |
159 | - | then 8 | |
160 | - | else value(assetInfo(value(I(U[g])))).decimals | |
161 | - | let ac = if ((V[g] == "WAVES")) | |
162 | - | then 8 | |
163 | - | else value(assetInfo(value(I(V[g])))).decimals | |
164 | - | let ad = ((Z * G(ab)) / aa) | |
165 | - | let ae = Y | |
166 | - | let af = if ((ad >= ae)) | |
167 | - | then ae | |
168 | - | else ad | |
169 | - | let ag = ((af * aa) / G(ab)) | |
170 | - | let ah = w(V[d], V[f], V[e], X, (Z - ag), U[g]) | |
171 | - | let ai = w(U[d], U[f], U[e], W, (Y - af), V[g]) | |
172 | - | ScriptResult(WriteSet([DataEntry(if (!(T)) | |
173 | - | then P | |
174 | - | else Q, ah), DataEntry(if (T) | |
175 | - | then P | |
176 | - | else Q, ai)]), TransferSet([ScriptTransfer(addressFromStringValue(V[f]), j(af), I(U[g])), ScriptTransfer(addressFromStringValue(U[f]), j(ag), I(V[g])), ScriptTransfer(J.caller, l(af), I(U[g])), ScriptTransfer(J.caller, l(ag), I(V[g]))])) | |
6 | + | @Callable(a) | |
7 | + | func deposit () = { | |
8 | + | let b = extract(a.payment) | |
9 | + | if (isDefined(b.assetId)) | |
10 | + | then throw("can hodl waves only at the moment") | |
11 | + | else { | |
12 | + | let c = toBase58String(a.caller.bytes) | |
13 | + | let d = { | |
14 | + | let e = getInteger(this, c) | |
15 | + | if ($isInstanceOf(e, "Int")) | |
16 | + | then { | |
17 | + | let f = e | |
18 | + | f | |
177 | 19 | } | |
20 | + | else 0 | |
178 | 21 | } | |
179 | - | } | |
180 | - | ||
181 | - | ||
182 | - | ||
183 | - | @Callable(J) | |
184 | - | func cancelOrder (aj) = { | |
185 | - | let ak = D(getStringValue(this, aj)) | |
186 | - | if ((addressFromStringValue(ak[f]) != J.caller)) | |
187 | - | then throw("Only order owner can cancel it") | |
188 | - | else { | |
189 | - | let al = w(ak[d], ak[f], ak[e], parseIntValue(ak[b]), 0, ak[g]) | |
190 | - | ScriptResult(WriteSet([DataEntry(aj, al)]), TransferSet([ScriptTransfer(J.caller, parseIntValue(ak[c]), I(ak[g]))])) | |
22 | + | let g = (d + b.amount) | |
23 | + | WriteSet([DataEntry(c, g)]) | |
191 | 24 | } | |
192 | 25 | } | |
193 | 26 | ||
194 | 27 | ||
195 | 28 | ||
196 | - | @Callable(J) | |
197 | - | func registerTraidPair (am,an,x) = if ((J.caller == addressFromStringValue(toBase58String(a)))) | |
198 | - | then WriteSet([DataEntry(((am + "/") + an), x)]) | |
199 | - | else throw("Only administrator can register traiding pair") | |
29 | + | @Callable(a) | |
30 | + | func withdraw (h) = { | |
31 | + | let c = toBase58String(a.caller.bytes) | |
32 | + | let d = { | |
33 | + | let e = getInteger(this, c) | |
34 | + | if ($isInstanceOf(e, "Int")) | |
35 | + | then { | |
36 | + | let f = e | |
37 | + | f | |
38 | + | } | |
39 | + | else 0 | |
40 | + | } | |
41 | + | let g = (d - h) | |
42 | + | if ((0 > h)) | |
43 | + | then throw("Can't withdraw negative amount") | |
44 | + | else if ((0 > g)) | |
45 | + | then throw("Not enough balance") | |
46 | + | else ScriptResult(WriteSet([DataEntry(c, g)]), TransferSet([ScriptTransfer(a.caller, h, unit)])) | |
47 | + | } | |
200 | 48 | ||
49 | + | ||
50 | + | @Verifier(i) | |
51 | + | func j () = false | |
201 | 52 |
github/deemru/w8io/169f3d6 33.22 ms ◑