tx · Fj8LyeAxMh3HyxXSCJcfdzuxbkP34QExpoCxpuGYvYrU 3N9kbR6BQEQV7pwBfDFzprJtNofgi6fSJ6Y: -0.03700000 Waves 2022.12.21 20:40 [2370372] smart account 3N9kbR6BQEQV7pwBfDFzprJtNofgi6fSJ6Y > SELF 0.00000000 Waves
{ "type": 13, "id": "Fj8LyeAxMh3HyxXSCJcfdzuxbkP34QExpoCxpuGYvYrU", "fee": 3700000, "feeAssetId": null, "timestamp": 1671644440005, "version": 2, "chainId": 84, "sender": "3N9kbR6BQEQV7pwBfDFzprJtNofgi6fSJ6Y", "senderPublicKey": "EajGg1J8duApPELWPw9gVkPwAKFC9hujhvCcne4FunUa", "proofs": [ "2b1ioECWLgjEpbDacsYGNQMb1VGcPKqNumL1NbfzChW8bP7NYMHrfzYp5GKAyB566iZTV6PWV9PYHjxoVNwkjDog" ], "script": "base64:BgJLCAISBAoCCAgSAwoBCBIAEgMKAQgSCgoICAEBAQEBAQgSCwoJCAEBAQgBAQEBEg0KCwgIAQEBAQEBCAgBEgMKAQESAwoBARIDCgEBOwAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzABJrX2FkbWluX3B1YmxpY19rZXkCEmtfYWRtaW5fcHVibGljX2tleQANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAAFa19hbW0CBWtfYW1tABFrX21hbmFnZXJfYWRkcmVzcwIRa19tYW5hZ2VyX2FkZHJlc3MAEmtfcG9zaXRpb25TZXF1ZW5jZQISa19wb3NpdGlvblNlcXVlbmNlAA5rX3Bvc2l0aW9uU2l6ZQIOa19wb3NpdGlvblNpemUABWtfZmVlAgVrX2ZlZQAQa19leGVjdXRlZE9yZGVycwIQa19leGVjdXRlZE9yZGVycwAQa19jYW5jZWxlZE9yZGVycwIQa19jYW5jZWxlZE9yZGVycwAHa19vcmRlcgIHa19vcmRlcgANa19sYXN0T3JkZXJJZAINa19sYXN0T3JkZXJJZAAQa190cmFkZXJP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1Jlc2V0Q29udGV4dAQTbmV3VHJhZGVyT3JkZXJDb3VudAkAZQIJARNnZXRUcmFkZXJPcmRlckNvdW50AgUEX2FtbQUHX3RyYWRlcgABCQDOCAIJAM4IAgkBFnVwZGF0ZVRyYWRlck9yZGVyQ291bnQDBQRfYW1tBQdfdHJhZGVyBRNuZXdUcmFkZXJPcmRlckNvdW50CQEQYWRkUmVtb3ZlT3JkZXJJZAQFCF9vcmRlcklkBQRfYW1tBQdfdHJhZGVyBwkBEG1hcmtFeGVjdXRlT3JkZXIBBQhfb3JkZXJJZAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpARR2aWV3X2NhbkV4ZWN1dGVPcmRlcgEIX29yZGVySWQEAXMJAPwHBAUEdGhpcwIMZXhlY3V0ZU9yZGVyCQDMCAIFCF9vcmRlcklkBQNuaWwFA25pbAMJAAACBQFzBQFzCQACAQIHU3VjY2VzcwkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJAQ5hZG1pblB1YmxpY0tleQC8ceGo", "height": 2370372, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9HEMv6NzTacEfbxV2S5MSzaPbbvk6qzzx3MmD4UrEe71 Next: G7FXZm7SAJJt3w4FYMYKa97zdrFBQqRBG961NkLTHbhM Diff:
Old | New | Differences | |
---|---|---|---|
27 | 27 | ||
28 | 28 | let m = "k_traderOrderCnt" | |
29 | 29 | ||
30 | - | let n = "k_ | |
30 | + | let n = "k_traderOrderIds" | |
31 | 31 | ||
32 | - | let o = "k_ | |
32 | + | let o = "k_sender" | |
33 | 33 | ||
34 | - | let p = | |
34 | + | let p = "k_initialized" | |
35 | 35 | ||
36 | - | let q = | |
36 | + | let q = 1 | |
37 | 37 | ||
38 | - | let r = | |
38 | + | let r = 2 | |
39 | 39 | ||
40 | - | let s = | |
40 | + | let s = 3 | |
41 | 41 | ||
42 | - | let t = | |
42 | + | let t = 1 | |
43 | 43 | ||
44 | - | let u = | |
44 | + | let u = 2 | |
45 | 45 | ||
46 | - | let v = | |
46 | + | let v = 1 | |
47 | 47 | ||
48 | - | let w = | |
48 | + | let w = 2 | |
49 | 49 | ||
50 | - | let x = | |
50 | + | let x = 5 | |
51 | 51 | ||
52 | - | let y = | |
52 | + | let y = lastBlock.timestamp | |
53 | 53 | ||
54 | - | let z = ( | |
54 | + | let z = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
55 | 55 | ||
56 | - | func A (B) = if ((B > 0)) | |
57 | - | then B | |
58 | - | else -(B) | |
56 | + | let A = (z / 200) | |
57 | + | ||
58 | + | func B (C) = if ((C > 0)) | |
59 | + | then C | |
60 | + | else -(C) | |
59 | 61 | ||
60 | 62 | ||
61 | - | func | |
63 | + | func D (C,E) = fraction(C, z, E, HALFEVEN) | |
62 | 64 | ||
63 | 65 | ||
64 | - | func | |
66 | + | func F (C,E) = fraction(C, E, z, HALFEVEN) | |
65 | 67 | ||
66 | 68 | ||
67 | - | func | |
68 | - | then | |
69 | - | else | |
69 | + | func G (C,E) = if ((C > E)) | |
70 | + | then E | |
71 | + | else C | |
70 | 72 | ||
71 | 73 | ||
72 | - | func | |
74 | + | func H (I,J) = ((I + "_") + J) | |
73 | 75 | ||
74 | 76 | ||
75 | - | func | |
77 | + | func K (L) = ((i + "_") + toString(L)) | |
76 | 78 | ||
77 | 79 | ||
78 | - | func | |
80 | + | func M (L) = ((j + "_") + toString(L)) | |
79 | 81 | ||
80 | 82 | ||
81 | - | func | |
83 | + | func N (L) = H(k, toString(L)) | |
82 | 84 | ||
83 | 85 | ||
84 | - | func | |
86 | + | func O (P,Q) = ((((m + "_") + P) + "_") + Q) | |
85 | 87 | ||
86 | 88 | ||
87 | - | func | |
89 | + | func R (P,Q) = ((((n + "_") + P) + "_") + Q) | |
88 | 90 | ||
89 | 91 | ||
90 | - | func | |
92 | + | func S () = valueOrErrorMessage(addressFromString(getStringValue(this, a)), "Coordinator not set") | |
91 | 93 | ||
92 | 94 | ||
93 | - | func | |
95 | + | func T () = fromBase58String(getStringValue(S(), c)) | |
94 | 96 | ||
95 | 97 | ||
96 | - | func | |
98 | + | func U () = valueOrErrorMessage(addressFromString(getStringValue(S(), e)), "Manager not set") | |
97 | 99 | ||
98 | 100 | ||
99 | - | func | |
101 | + | func V (J) = valueOrElse(getBoolean(S(), H(d, J)), false) | |
100 | 102 | ||
101 | 103 | ||
102 | - | func | |
104 | + | func W () = fromBase58String(getStringValue(S(), b)) | |
103 | 105 | ||
104 | 106 | ||
105 | - | func W (K) = if (valueOrElse(getBoolean(this, J(K)), false)) | |
106 | - | then throw(("Order already executed: " + toString(K))) | |
107 | - | else if (valueOrElse(getBoolean(this, L(K)), false)) | |
108 | - | then throw(("Order already cancelled: " + toString(K))) | |
107 | + | func X () = valueOrElse(getBoolean(this, p), false) | |
108 | + | ||
109 | + | ||
110 | + | func Y (L) = if (valueOrElse(getBoolean(this, K(L)), false)) | |
111 | + | then throw(("Order already executed: " + toString(L))) | |
112 | + | else if (valueOrElse(getBoolean(this, M(L)), false)) | |
113 | + | then throw(("Order already cancelled: " + toString(L))) | |
109 | 114 | else true | |
110 | 115 | ||
111 | 116 | ||
112 | - | func | |
117 | + | func Z () = valueOrElse(getInteger(this, l), 0) | |
113 | 118 | ||
114 | 119 | ||
115 | - | func | |
116 | - | let | |
117 | - | valueOrElse(getInteger(this, | |
120 | + | func aa (P,Q) = { | |
121 | + | let ab = O(P, Q) | |
122 | + | valueOrElse(getInteger(this, ab), 0) | |
118 | 123 | } | |
119 | 124 | ||
120 | 125 | ||
121 | - | func aa (K) = { | |
122 | - | let ab = valueOrErrorMessage(getString(this, M(K)), ("Invalid order id: " + toString(K))) | |
123 | - | let ac = split(ab, ",") | |
124 | - | let ad = ac[0] | |
125 | - | let ae = ac[1] | |
126 | - | let af = valueOrErrorMessage(parseInt(ac[2]), "Invalid amountIn") | |
127 | - | let ag = valueOrErrorMessage(parseInt(ac[3]), "Invalid leverage") | |
128 | - | let ah = valueOrErrorMessage(parseInt(ac[4]), "Invalid type") | |
129 | - | let ai = valueOrErrorMessage(parseInt(ac[5]), "Invalid triggerPrice") | |
130 | - | let aj = valueOrErrorMessage(parseInt(ac[6]), "Invalid paymentUsdn") | |
131 | - | let ak = valueOrErrorMessage(parseInt(ac[7]), "Invalid side") | |
132 | - | let al = ac[8] | |
133 | - | let am = valueOrErrorMessage(parseInt(ac[9]), "Invalid positionId") | |
134 | - | let an = valueOrErrorMessage(parseInt(ac[10]), "Invalid limitPrice") | |
135 | - | $Tuple11(ad, ae, af, ag, ah, ai, aj, ak, al, am, an) | |
126 | + | func ac (P,Q) = { | |
127 | + | let ab = R(P, Q) | |
128 | + | let ad = valueOrElse(getString(this, ab), "") | |
129 | + | if ((ad == "")) | |
130 | + | then nil | |
131 | + | else split(ad, ",") | |
136 | 132 | } | |
137 | 133 | ||
138 | 134 | ||
139 | - | func ao (O) = { | |
140 | - | let ap = invoke(addressFromStringValue(O), "computeSpotPrice", nil, nil) | |
141 | - | if ((ap == ap)) | |
135 | + | func ae (L) = { | |
136 | + | let af = valueOrErrorMessage(getString(this, N(L)), ("Invalid order id: " + toString(L))) | |
137 | + | let ag = split(af, ",") | |
138 | + | let ah = ag[0] | |
139 | + | let ai = ag[1] | |
140 | + | let aj = valueOrErrorMessage(parseInt(ag[2]), "Invalid amountIn") | |
141 | + | let ak = valueOrErrorMessage(parseInt(ag[3]), "Invalid leverage") | |
142 | + | let al = valueOrErrorMessage(parseInt(ag[4]), "Invalid type") | |
143 | + | let am = valueOrErrorMessage(parseInt(ag[5]), "Invalid triggerPrice") | |
144 | + | let an = valueOrErrorMessage(parseInt(ag[6]), "Invalid paymentUsdn") | |
145 | + | let ao = valueOrErrorMessage(parseInt(ag[7]), "Invalid side") | |
146 | + | let ap = ag[8] | |
147 | + | let aq = valueOrErrorMessage(parseInt(ag[9]), "Invalid positionId") | |
148 | + | let ar = valueOrErrorMessage(parseInt(ag[10]), "Invalid limitPrice") | |
149 | + | $Tuple11(ah, ai, aj, ak, al, am, an, ao, ap, aq, ar) | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | func as (P) = { | |
154 | + | let at = invoke(addressFromStringValue(P), "computeSpotPrice", nil, nil) | |
155 | + | if ((at == at)) | |
142 | 156 | then { | |
143 | - | let | |
144 | - | let | |
145 | - | if ($isInstanceOf( | |
157 | + | let au = { | |
158 | + | let av = at | |
159 | + | if ($isInstanceOf(av, "Int")) | |
146 | 160 | then { | |
147 | - | let | |
148 | - | | |
161 | + | let aw = av | |
162 | + | aw | |
149 | 163 | } | |
150 | 164 | else throw("Invalid computeSpotPrice result") | |
151 | 165 | } | |
152 | - | value( | |
166 | + | value(au) | |
153 | 167 | } | |
154 | 168 | else throw("Strict value is not equal to itself.") | |
155 | 169 | } | |
156 | 170 | ||
157 | 171 | ||
158 | - | func | |
159 | - | let | |
160 | - | if (( | |
172 | + | func ax (P,Q) = { | |
173 | + | let at = invoke(addressFromStringValue(P), "computeFeeForTraderWithArtifact", [Q, ""], nil) | |
174 | + | if ((at == at)) | |
161 | 175 | then { | |
162 | - | let | |
163 | - | let | |
164 | - | if ($isInstanceOf( | |
176 | + | let au = { | |
177 | + | let av = at | |
178 | + | if ($isInstanceOf(av, "(Int, Boolean)")) | |
165 | 179 | then { | |
166 | - | let | |
167 | - | | |
180 | + | let aw = av | |
181 | + | aw._1 | |
168 | 182 | } | |
169 | 183 | else throw("Invalid computeFeeForTraderWithArtifact result") | |
170 | 184 | } | |
171 | - | value( | |
185 | + | value(au) | |
172 | 186 | } | |
173 | 187 | else throw("Strict value is not equal to itself.") | |
174 | 188 | } | |
175 | 189 | ||
176 | 190 | ||
177 | - | func | |
178 | - | let | |
179 | - | let | |
180 | - | valueOrElse(getInteger( | |
191 | + | func ay (P,Q) = { | |
192 | + | let ah = addressFromStringValue(P) | |
193 | + | let az = H(g, Q) | |
194 | + | valueOrElse(getInteger(ah, az), 0) | |
181 | 195 | } | |
182 | 196 | ||
183 | 197 | ||
184 | - | func | |
185 | - | let | |
186 | - | let | |
187 | - | valueOrElse(getInteger( | |
198 | + | func aA (P,Q) = { | |
199 | + | let ah = addressFromStringValue(P) | |
200 | + | let aB = H(f, Q) | |
201 | + | valueOrElse(getInteger(ah, aB), 0) | |
188 | 202 | } | |
189 | 203 | ||
190 | 204 | ||
191 | - | func | |
205 | + | func aC (aD) = F(aD, A) | |
192 | 206 | ||
193 | 207 | ||
194 | - | func | |
195 | - | let | |
196 | - | [StringEntry( | |
208 | + | func aE (L,P,Q,aF,aG,aH,aI,aJ,aK,aL,aM,aN) = { | |
209 | + | let af = makeString([P, Q, toString(aF), toString(aG), toString(aH), toString(aI), toString(aJ), toString(aK), aL, toString(aM), toString(aN)], ",") | |
210 | + | [StringEntry(N(L), af)] | |
197 | 211 | } | |
198 | 212 | ||
199 | 213 | ||
200 | - | func aK (O,P,aL) = [IntegerEntry(N(O, P), aL)] | |
214 | + | func aO (L,P,Q,aP) = { | |
215 | + | let aQ = ac(P, Q) | |
216 | + | let aR = if (aP) | |
217 | + | then (aQ :+ toString(L)) | |
218 | + | else removeByIndex(aQ, valueOrErrorMessage(indexOf(aQ, toString(L)), ("No order with id: " + toString(L)))) | |
219 | + | let aS = makeString(aR, ",") | |
220 | + | [StringEntry(R(P, Q), aS)] | |
221 | + | } | |
201 | 222 | ||
202 | 223 | ||
203 | - | func | |
224 | + | func aT (P,Q,aU) = [IntegerEntry(O(P, Q), aU)] | |
204 | 225 | ||
205 | 226 | ||
206 | - | func | |
227 | + | func aV (aW) = [IntegerEntry(l, aW)] | |
207 | 228 | ||
208 | 229 | ||
209 | - | func | |
230 | + | func aX (L) = [BooleanEntry(H(i, toString(L)), true)] | |
210 | 231 | ||
211 | 232 | ||
212 | - | @Callable(aQ) | |
213 | - | func setContext (aR) = if ((aQ.caller != this)) | |
214 | - | then throw("Only self-call") | |
215 | - | else [StringEntry(n, aR)] | |
233 | + | func aY (L) = [BooleanEntry(H(j, toString(L)), true)] | |
216 | 234 | ||
217 | 235 | ||
218 | - | ||
219 | - | @Callable(aQ) | |
220 | - | func resetContext () = if ((aQ.caller != this)) | |
221 | - | then throw("Only self-call") | |
222 | - | else [DeleteEntry(n)] | |
223 | - | ||
224 | - | ||
225 | - | ||
226 | - | @Callable(aQ) | |
227 | - | func initialize (aS) = if (V()) | |
228 | - | then throw("Already initialized") | |
229 | - | else [StringEntry(a, aS), BooleanEntry(o, true)] | |
230 | - | ||
231 | - | ||
232 | - | ||
233 | - | @Callable(aQ) | |
234 | - | func createOrder (O,aD,aE,aJ,aB,aC,aG,aH) = if ((size(aQ.payments) > 1)) | |
235 | - | then throw("Invalid createOrder parameters: invalid payment count") | |
236 | - | else { | |
237 | - | let aT = if ((size(aQ.payments) == 1)) | |
238 | - | then $Tuple2(toBase58String(valueOrErrorMessage(aQ.payments[0].assetId, "Invalid asset id")), aQ.payments[0].amount) | |
239 | - | else $Tuple2("", 0) | |
240 | - | let aU = aT._1 | |
241 | - | let aV = aT._2 | |
242 | - | let aW = invoke(this, "internalCreateOrder", [toString(aQ.caller), O, aD, aE, aJ, aB, aC, aG, aH, aU, aV], nil) | |
243 | - | if ((aW == aW)) | |
244 | - | then nil | |
245 | - | else throw("Strict value is not equal to itself.") | |
236 | + | @Callable(aZ) | |
237 | + | func cleanUpStaleOrders (P,Q) = { | |
238 | + | let ba = ac(P, Q) | |
239 | + | func bb (bc,L) = { | |
240 | + | let bd = valueOrErrorMessage(parseInt(L), "Invalid order id") | |
241 | + | let be = ae(bd) | |
242 | + | let bf = be._1 | |
243 | + | let bg = be._2 | |
244 | + | let bh = be._3 | |
245 | + | let bi = be._4 | |
246 | + | let aH = be._5 | |
247 | + | let bj = be._6 | |
248 | + | let bk = be._7 | |
249 | + | let bl = be._8 | |
250 | + | let bm = be._9 | |
251 | + | let aM = be._10 | |
252 | + | let bn = be._11 | |
253 | + | let bo = ay(P, Q) | |
254 | + | let bp = if ((bo != 0)) | |
255 | + | then aA(P, Q) | |
256 | + | else 0 | |
257 | + | if (if (if ((aH == q)) | |
258 | + | then true | |
259 | + | else (aH == r)) | |
260 | + | then (bp != aM) | |
261 | + | else false) | |
262 | + | then { | |
263 | + | let bq = (aY(bd) ++ aO(bd, P, Q, false)) | |
264 | + | (bc ++ bq) | |
265 | + | } | |
266 | + | else bc | |
246 | 267 | } | |
247 | 268 | ||
269 | + | let br = ba | |
270 | + | let bs = size(br) | |
271 | + | let bt = nil | |
272 | + | func bu (bv,bw) = if ((bw >= bs)) | |
273 | + | then bv | |
274 | + | else bb(bv, br[bw]) | |
248 | 275 | ||
276 | + | func bx (bv,bw) = if ((bw >= bs)) | |
277 | + | then bv | |
278 | + | else throw("List size exceeds 5") | |
249 | 279 | ||
250 | - | @Callable(aQ) | |
251 | - | func increasePositionWithStopLoss (O,aX,aC,aY,aH,aZ,ba,bb,bc) = { | |
252 | - | let P = toString(aQ.caller) | |
253 | - | if (if (!(V())) | |
254 | - | then true | |
255 | - | else !(T(O))) | |
256 | - | then throw("Invalid increasePositionWithStopLoss parameters") | |
257 | - | else { | |
258 | - | let bd = au(O, P) | |
259 | - | if ((bd != 0)) | |
260 | - | then throw("Invalid increasePositionWithStopLoss parameters: only new position") | |
261 | - | else { | |
262 | - | let be = invoke(this, "setContext", [P], nil) | |
263 | - | if ((be == be)) | |
264 | - | then { | |
265 | - | let bf = invoke(addressFromStringValue(O), "increasePosition", [aX, aC, aY, aH], aQ.payments) | |
266 | - | if ((bf == bf)) | |
267 | - | then { | |
268 | - | let bg = invoke(this, "resetContext", nil, nil) | |
269 | - | if ((bg == bg)) | |
270 | - | then { | |
271 | - | let bh = au(O, P) | |
272 | - | if ((bh == bh)) | |
273 | - | then { | |
274 | - | let af = A(bh) | |
275 | - | let bi = if ((0 > bh)) | |
276 | - | then s | |
277 | - | else t | |
278 | - | let bj = if ((aZ > 0)) | |
279 | - | then { | |
280 | - | let bj = invoke(this, "internalCreateOrder", [P, O, p, aZ, ba, af, 0, bi, aH, "", 0], nil) | |
281 | - | if ((bj == bj)) | |
282 | - | then nil | |
283 | - | else throw("Strict value is not equal to itself.") | |
284 | - | } | |
285 | - | else nil | |
286 | - | if ((bj == bj)) | |
287 | - | then { | |
288 | - | let bk = if ((bb > 0)) | |
289 | - | then { | |
290 | - | let bk = invoke(this, "internalCreateOrder", [P, O, q, bb, bc, af, 0, bi, aH, "", 0], nil) | |
291 | - | if ((bk == bk)) | |
292 | - | then nil | |
293 | - | else throw("Strict value is not equal to itself.") | |
294 | - | } | |
295 | - | else nil | |
296 | - | if ((bk == bk)) | |
297 | - | then nil | |
298 | - | else throw("Strict value is not equal to itself.") | |
299 | - | } | |
300 | - | else throw("Strict value is not equal to itself.") | |
301 | - | } | |
302 | - | else throw("Strict value is not equal to itself.") | |
303 | - | } | |
304 | - | else throw("Strict value is not equal to itself.") | |
305 | - | } | |
306 | - | else throw("Strict value is not equal to itself.") | |
307 | - | } | |
308 | - | else throw("Strict value is not equal to itself.") | |
309 | - | } | |
310 | - | } | |
280 | + | bx(bu(bu(bu(bu(bu(bt, 0), 1), 2), 3), 4), 5) | |
311 | 281 | } | |
312 | 282 | ||
313 | 283 | ||
314 | 284 | ||
315 | - | @Callable(aQ) | |
316 | - | func internalCreateOrder (P,O,aD,aE,aJ,aB,aC,aG,aH,bl,bm) = if (if (if (if (if (if (if (if (if (!(V())) | |
285 | + | @Callable(aZ) | |
286 | + | func setContext (by) = if ((aZ.caller != this)) | |
287 | + | then throw("Only self-call") | |
288 | + | else [StringEntry(o, by)] | |
289 | + | ||
290 | + | ||
291 | + | ||
292 | + | @Callable(aZ) | |
293 | + | func resetContext () = if ((aZ.caller != this)) | |
294 | + | then throw("Only self-call") | |
295 | + | else [DeleteEntry(o)] | |
296 | + | ||
297 | + | ||
298 | + | ||
299 | + | @Callable(aZ) | |
300 | + | func initialize (bz) = if (X()) | |
301 | + | then throw("Already initialized") | |
302 | + | else [StringEntry(a, bz), BooleanEntry(p, true)] | |
303 | + | ||
304 | + | ||
305 | + | ||
306 | + | @Callable(aZ) | |
307 | + | func createOrder (P,aH,aI,aN,aF,aG,aK,aL) = { | |
308 | + | let Q = toString(aZ.caller) | |
309 | + | let bA = invoke(this, "cleanUpStaleOrders", [P, Q], nil) | |
310 | + | if ((bA == bA)) | |
311 | + | then if ((size(aZ.payments) > 1)) | |
312 | + | then throw("Invalid createOrder parameters: invalid payment count") | |
313 | + | else { | |
314 | + | let bB = if ((size(aZ.payments) == 1)) | |
315 | + | then $Tuple2(toBase58String(valueOrErrorMessage(aZ.payments[0].assetId, "Invalid asset id")), aZ.payments[0].amount) | |
316 | + | else $Tuple2("", 0) | |
317 | + | let bC = bB._1 | |
318 | + | let bD = bB._2 | |
319 | + | let bE = invoke(this, "internalCreateOrder", [Q, P, aH, aI, aN, aF, aG, aK, aL, bC, bD], nil) | |
320 | + | if ((bE == bE)) | |
321 | + | then nil | |
322 | + | else throw("Strict value is not equal to itself.") | |
323 | + | } | |
324 | + | else throw("Strict value is not equal to itself.") | |
325 | + | } | |
326 | + | ||
327 | + | ||
328 | + | ||
329 | + | @Callable(aZ) | |
330 | + | func increasePositionWithStopLoss (P,bF,aG,bG,aL,bH,bI,bJ,bK) = { | |
331 | + | let Q = toString(aZ.caller) | |
332 | + | let bA = invoke(this, "cleanUpStaleOrders", [P, Q], nil) | |
333 | + | if ((bA == bA)) | |
334 | + | then if (if (!(X())) | |
335 | + | then true | |
336 | + | else !(V(P))) | |
337 | + | then throw("Invalid increasePositionWithStopLoss parameters") | |
338 | + | else { | |
339 | + | let bo = ay(P, Q) | |
340 | + | if ((bo != 0)) | |
341 | + | then throw("Invalid increasePositionWithStopLoss parameters: only new position") | |
342 | + | else { | |
343 | + | let bL = invoke(this, "setContext", [Q], nil) | |
344 | + | if ((bL == bL)) | |
345 | + | then { | |
346 | + | let bM = invoke(addressFromStringValue(P), "increasePosition", [bF, aG, bG, aL], aZ.payments) | |
347 | + | if ((bM == bM)) | |
348 | + | then { | |
349 | + | let bN = invoke(this, "resetContext", nil, nil) | |
350 | + | if ((bN == bN)) | |
351 | + | then { | |
352 | + | let bO = ay(P, Q) | |
353 | + | if ((bO == bO)) | |
354 | + | then { | |
355 | + | let aj = B(bO) | |
356 | + | let bP = if ((0 > bO)) | |
357 | + | then t | |
358 | + | else u | |
359 | + | let bQ = if ((bH > 0)) | |
360 | + | then { | |
361 | + | let bQ = invoke(this, "internalCreateOrder", [Q, P, q, bH, bI, aj, 0, bP, aL, "", 0], nil) | |
362 | + | if ((bQ == bQ)) | |
363 | + | then nil | |
364 | + | else throw("Strict value is not equal to itself.") | |
365 | + | } | |
366 | + | else nil | |
367 | + | if ((bQ == bQ)) | |
368 | + | then { | |
369 | + | let bR = if ((bJ > 0)) | |
370 | + | then { | |
371 | + | let bR = invoke(this, "internalCreateOrder", [Q, P, r, bJ, bK, aj, 0, bP, aL, "", 0], nil) | |
372 | + | if ((bR == bR)) | |
373 | + | then nil | |
374 | + | else throw("Strict value is not equal to itself.") | |
375 | + | } | |
376 | + | else nil | |
377 | + | if ((bR == bR)) | |
378 | + | then nil | |
379 | + | else throw("Strict value is not equal to itself.") | |
380 | + | } | |
381 | + | else throw("Strict value is not equal to itself.") | |
382 | + | } | |
383 | + | else throw("Strict value is not equal to itself.") | |
384 | + | } | |
385 | + | else throw("Strict value is not equal to itself.") | |
386 | + | } | |
387 | + | else throw("Strict value is not equal to itself.") | |
388 | + | } | |
389 | + | else throw("Strict value is not equal to itself.") | |
390 | + | } | |
391 | + | } | |
392 | + | else throw("Strict value is not equal to itself.") | |
393 | + | } | |
394 | + | ||
395 | + | ||
396 | + | ||
397 | + | @Callable(aZ) | |
398 | + | func internalCreateOrder (Q,P,aH,aI,aN,aF,aG,aK,aL,bS,bT) = if (if (if (if (if (if (if (if (if (!(X())) | |
317 | 399 | then true | |
318 | - | else !( | |
400 | + | else !(V(P))) | |
319 | 401 | then true | |
320 | - | else (0 >= | |
402 | + | else (0 >= aI)) | |
321 | 403 | then true | |
322 | - | else (0 > | |
404 | + | else (0 > aN)) | |
323 | 405 | then true | |
324 | - | else (0 >= | |
406 | + | else (0 >= aF)) | |
325 | 407 | then true | |
326 | - | else (0 > | |
408 | + | else (0 > aG)) | |
327 | 409 | then true | |
328 | - | else !(if (( | |
410 | + | else !(if ((aK == t)) | |
329 | 411 | then true | |
330 | - | else ( | |
412 | + | else (aK == u))) | |
331 | 413 | then true | |
332 | - | else !(if (if (( | |
414 | + | else !(if (if ((aH == q)) | |
333 | 415 | then true | |
334 | - | else ( | |
416 | + | else (aH == r)) | |
335 | 417 | then true | |
336 | - | else ( | |
418 | + | else (aH == s))) | |
337 | 419 | then true | |
338 | - | else !(( | |
420 | + | else !((aZ.caller == this))) | |
339 | 421 | then throw("Invalid createOrder parameters") | |
340 | 422 | else { | |
341 | - | let | |
342 | - | let | |
343 | - | let | |
344 | - | let | |
423 | + | let bU = (Z() + 1) | |
424 | + | let bV = (aa(P, Q) + 1) | |
425 | + | let bo = ay(P, Q) | |
426 | + | let bF = if (if (if ((bo == 0)) | |
345 | 427 | then true | |
346 | - | else if (( | |
347 | - | then ( | |
428 | + | else if ((bo > 0)) | |
429 | + | then (aK == t) | |
348 | 430 | else false) | |
349 | 431 | then true | |
350 | - | else if ((0 > | |
351 | - | then ( | |
432 | + | else if ((0 > bo)) | |
433 | + | then (aK == u) | |
352 | 434 | else false) | |
353 | - | then | |
354 | - | else | |
355 | - | if (if (( | |
356 | - | then if (( | |
435 | + | then v | |
436 | + | else w | |
437 | + | if (if ((bo == 0)) | |
438 | + | then if ((aH == q)) | |
357 | 439 | then true | |
358 | - | else ( | |
440 | + | else (aH == r) | |
359 | 441 | else false) | |
360 | 442 | then throw("Can not create STOP/TAKE order: no position") | |
361 | 443 | else { | |
362 | - | let | |
363 | - | then if (if (( | |
444 | + | let bW = if ((bF == v)) | |
445 | + | then if (if ((bS != toBase58String(T()))) | |
364 | 446 | then true | |
365 | - | else ( | |
447 | + | else (bT != aF)) | |
366 | 448 | then throw("Invalid createLimitOrder parameters: invalid payment") | |
367 | 449 | else { | |
368 | - | let | |
369 | - | if (( | |
370 | - | then | |
450 | + | let bX = invoke(U(), "deposit", nil, [AttachedPayment(T(), bT)]) | |
451 | + | if ((bX == bX)) | |
452 | + | then bT | |
371 | 453 | else throw("Strict value is not equal to itself.") | |
372 | 454 | } | |
373 | 455 | else 0 | |
374 | - | if (( | |
456 | + | if ((bW == bW)) | |
375 | 457 | then { | |
376 | - | let | |
377 | - | then | |
458 | + | let aq = if ((bo != 0)) | |
459 | + | then aA(P, Q) | |
378 | 460 | else 0 | |
379 | - | if (( | |
461 | + | if ((bV > x)) | |
380 | 462 | then throw("Invalid createLimitOrder parameters: order count") | |
381 | - | else (( | |
463 | + | else (((aE(bU, P, Q, aF, aG, aH, aI, bW, aK, aL, aq, aN) ++ aO(bU, P, Q, true)) ++ aT(P, Q, bV)) ++ aV(bU)) | |
382 | 464 | } | |
383 | 465 | else throw("Strict value is not equal to itself.") | |
384 | 466 | } | |
386 | 468 | ||
387 | 469 | ||
388 | 470 | ||
389 | - | @Callable( | |
390 | - | func cancelOrder ( | |
391 | - | let | |
392 | - | let | |
393 | - | let | |
394 | - | let | |
395 | - | let | |
396 | - | let | |
397 | - | let | |
398 | - | let | |
399 | - | let | |
400 | - | let | |
401 | - | let | |
402 | - | let | |
403 | - | if (if (if (!( | |
471 | + | @Callable(aZ) | |
472 | + | func cancelOrder (L) = { | |
473 | + | let bY = ae(L) | |
474 | + | let P = bY._1 | |
475 | + | let Q = bY._2 | |
476 | + | let aF = bY._3 | |
477 | + | let aG = bY._4 | |
478 | + | let aH = bY._5 | |
479 | + | let aI = bY._6 | |
480 | + | let bZ = bY._7 | |
481 | + | let aK = bY._8 | |
482 | + | let aL = bY._9 | |
483 | + | let aM = bY._10 | |
484 | + | let aN = bY._11 | |
485 | + | if (if (if (!(X())) | |
404 | 486 | then true | |
405 | - | else !( | |
487 | + | else !(Y(L))) | |
406 | 488 | then true | |
407 | - | else !((toString( | |
489 | + | else !((toString(aZ.caller) == Q))) | |
408 | 490 | then throw("Invalid cancelOrder parameters") | |
409 | 491 | else { | |
410 | - | let | |
411 | - | | |
492 | + | let bA = invoke(this, "cleanUpStaleOrders", [P, Q], nil) | |
493 | + | if ((bA == bA)) | |
412 | 494 | then { | |
413 | - | let bu = invoke(S(), "withdraw", [toBase58String(R()), bs], nil) | |
414 | - | if ((bu == bu)) | |
415 | - | then nil | |
416 | - | else throw("Strict value is not equal to itself.") | |
417 | - | } | |
418 | - | else nil | |
419 | - | if ((bt == bt)) | |
420 | - | then ((aP(K) ++ aK(O, P, bo)) ++ (if ((bs > 0)) | |
421 | - | then [ScriptTransfer(aQ.caller, bs, R())] | |
422 | - | else nil)) | |
423 | - | else throw("Strict value is not equal to itself.") | |
424 | - | } | |
425 | - | } | |
426 | - | ||
427 | - | ||
428 | - | ||
429 | - | @Callable(aQ) | |
430 | - | func executeOrder (K) = { | |
431 | - | let bv = aa(K) | |
432 | - | let O = bv._1 | |
433 | - | let P = bv._2 | |
434 | - | let aB = bv._3 | |
435 | - | let aC = bv._4 | |
436 | - | let aD = bv._5 | |
437 | - | let aE = bv._6 | |
438 | - | let bs = bv._7 | |
439 | - | let aG = bv._8 | |
440 | - | let aH = bv._9 | |
441 | - | let aI = bv._10 | |
442 | - | let aJ = bv._11 | |
443 | - | if (if (!(V())) | |
444 | - | then true | |
445 | - | else !(W(K))) | |
446 | - | then throw("Invalid executeOrder parameters") | |
447 | - | else { | |
448 | - | let bd = au(O, P) | |
449 | - | let bw = if ((bd != 0)) | |
450 | - | then aw(O, P) | |
451 | - | else 0 | |
452 | - | let bx = if ((aD == p)) | |
453 | - | then { | |
454 | - | let by = if ((bd > 0)) | |
455 | - | then s | |
456 | - | else if ((0 > bd)) | |
457 | - | then t | |
458 | - | else throw("Can not execute STOP order: no open position") | |
459 | - | let bz = ao(O) | |
460 | - | let bA = if ((aG == by)) | |
461 | - | then throw("Can not execute STOP order: reduce only") | |
462 | - | else if ((bw != aI)) | |
463 | - | then throw("Can not execute STOP order: position closed") | |
464 | - | else if ((by == s)) | |
465 | - | then (aE >= bz) | |
466 | - | else (bz >= aE) | |
467 | - | if (bA) | |
468 | - | then $Tuple3("closePosition", [F(aB, A(bd)), E(aJ, A(bd))], nil) | |
469 | - | else throw("Can not execute STOP order: triggerPrice mismatch") | |
470 | - | } | |
471 | - | else if ((aD == q)) | |
472 | - | then { | |
473 | - | let by = if ((bd > 0)) | |
474 | - | then s | |
475 | - | else if ((0 > bd)) | |
476 | - | then t | |
477 | - | else throw("Can not execute STOP order: no open position") | |
478 | - | let bz = ao(O) | |
479 | - | let bA = if ((aG == by)) | |
480 | - | then throw("Can not execute TAKE order: reduce only") | |
481 | - | else if ((bw != aI)) | |
482 | - | then throw(((("Can not execute TAKE order: position closed " + toString(bw)) + "!=") + toString(aI))) | |
483 | - | else if ((by == s)) | |
484 | - | then (bz >= aE) | |
485 | - | else (aE >= bz) | |
486 | - | if (bA) | |
487 | - | then $Tuple3("closePosition", [F(aB, A(bd)), E(aJ, A(bd))], nil) | |
488 | - | else throw("Can not execute TAKE order: triggerPrice mismatch") | |
489 | - | } | |
490 | - | else if ((aD == r)) | |
495 | + | let bV = (aa(P, Q) - 1) | |
496 | + | let ca = if ((bZ > 0)) | |
491 | 497 | then { | |
492 | - | let bz = ao(O) | |
493 | - | let bB = if ((aJ == 0)) | |
494 | - | then ay(aE) | |
495 | - | else A((aE - aJ)) | |
496 | - | let bA = if ((bz >= (aE - bB))) | |
497 | - | then ((aE + bB) >= bz) | |
498 | - | else false | |
499 | - | if (bA) | |
500 | - | then { | |
501 | - | let by = if ((bd > 0)) | |
502 | - | then s | |
503 | - | else if ((0 > bd)) | |
504 | - | then t | |
505 | - | else -1 | |
506 | - | let bC = if ((bd == 0)) | |
507 | - | then u | |
508 | - | else if ((by == aG)) | |
509 | - | then u | |
510 | - | else v | |
511 | - | if ((bC == u)) | |
512 | - | then { | |
513 | - | let bD = (bs - E(bs, at(O, P))) | |
514 | - | $Tuple3("increasePosition", [aG, aC, if ((aJ == 0)) | |
515 | - | then 0 | |
516 | - | else C(bD, aJ), aH], [AttachedPayment(R(), bs)]) | |
517 | - | } | |
518 | - | else $Tuple3("closePosition", [aB, E(aB, aJ)], nil) | |
519 | - | } | |
520 | - | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
521 | - | } | |
522 | - | else throw(("Invalid order type: " + toString(aD))) | |
523 | - | let bE = bx._1 | |
524 | - | let bF = bx._2 | |
525 | - | let bG = bx._3 | |
526 | - | let bt = if ((size(bG) == 1)) | |
527 | - | then { | |
528 | - | let bu = invoke(S(), "withdraw", [toBase58String(R()), bG[0].amount], nil) | |
529 | - | if ((bu == bu)) | |
530 | - | then nil | |
531 | - | else throw("Strict value is not equal to itself.") | |
532 | - | } | |
533 | - | else nil | |
534 | - | if ((bt == bt)) | |
535 | - | then { | |
536 | - | let be = invoke(this, "setContext", [P], nil) | |
537 | - | if ((be == be)) | |
538 | - | then { | |
539 | - | let bf = invoke(addressFromStringValue(O), bE, bF, bG) | |
540 | - | if ((bf == bf)) | |
541 | - | then { | |
542 | - | let bg = invoke(this, "resetContext", nil, nil) | |
543 | - | if ((bg == bg)) | |
544 | - | then aO(K) | |
545 | - | else throw("Strict value is not equal to itself.") | |
546 | - | } | |
498 | + | let cb = invoke(U(), "withdraw", [toBase58String(T()), bZ], nil) | |
499 | + | if ((cb == cb)) | |
500 | + | then nil | |
547 | 501 | else throw("Strict value is not equal to itself.") | |
548 | 502 | } | |
503 | + | else nil | |
504 | + | if ((ca == ca)) | |
505 | + | then (((aY(L) ++ aO(L, P, Q, false)) ++ aT(P, Q, bV)) ++ (if ((bZ > 0)) | |
506 | + | then [ScriptTransfer(aZ.caller, bZ, T())] | |
507 | + | else nil)) | |
549 | 508 | else throw("Strict value is not equal to itself.") | |
550 | 509 | } | |
551 | 510 | else throw("Strict value is not equal to itself.") | |
554 | 513 | ||
555 | 514 | ||
556 | 515 | ||
557 | - | @Callable(aQ) | |
558 | - | func view_canExecuteOrder (K) = { | |
559 | - | let ap = invoke(this, "executeOrder", [K], nil) | |
560 | - | if ((ap == ap)) | |
516 | + | @Callable(aZ) | |
517 | + | func executeOrder (L) = { | |
518 | + | let cc = ae(L) | |
519 | + | let P = cc._1 | |
520 | + | let Q = cc._2 | |
521 | + | let aF = cc._3 | |
522 | + | let aG = cc._4 | |
523 | + | let aH = cc._5 | |
524 | + | let aI = cc._6 | |
525 | + | let bZ = cc._7 | |
526 | + | let aK = cc._8 | |
527 | + | let aL = cc._9 | |
528 | + | let aM = cc._10 | |
529 | + | let aN = cc._11 | |
530 | + | let bA = invoke(this, "cleanUpStaleOrders", [P, Q], nil) | |
531 | + | if ((bA == bA)) | |
532 | + | then if (if (!(X())) | |
533 | + | then true | |
534 | + | else !(Y(L))) | |
535 | + | then throw("Invalid executeOrder parameters") | |
536 | + | else { | |
537 | + | let bo = ay(P, Q) | |
538 | + | let bp = if ((bo != 0)) | |
539 | + | then aA(P, Q) | |
540 | + | else 0 | |
541 | + | let cd = if ((aH == q)) | |
542 | + | then { | |
543 | + | let ce = if ((bo > 0)) | |
544 | + | then t | |
545 | + | else if ((0 > bo)) | |
546 | + | then u | |
547 | + | else throw("Can not execute STOP order: no open position") | |
548 | + | let cf = as(P) | |
549 | + | let cg = if ((aK == ce)) | |
550 | + | then throw("Can not execute STOP order: reduce only") | |
551 | + | else if ((bp != aM)) | |
552 | + | then throw("Can not execute STOP order: position closed") | |
553 | + | else if ((ce == t)) | |
554 | + | then (aI >= cf) | |
555 | + | else (cf >= aI) | |
556 | + | if (cg) | |
557 | + | then $Tuple3("closePosition", [G(aF, B(bo)), F(aN, B(bo))], nil) | |
558 | + | else throw("Can not execute STOP order: triggerPrice mismatch") | |
559 | + | } | |
560 | + | else if ((aH == r)) | |
561 | + | then { | |
562 | + | let ce = if ((bo > 0)) | |
563 | + | then t | |
564 | + | else if ((0 > bo)) | |
565 | + | then u | |
566 | + | else throw("Can not execute STOP order: no open position") | |
567 | + | let cf = as(P) | |
568 | + | let cg = if ((aK == ce)) | |
569 | + | then throw("Can not execute TAKE order: reduce only") | |
570 | + | else if ((bp != aM)) | |
571 | + | then throw(((("Can not execute TAKE order: position closed " + toString(bp)) + "!=") + toString(aM))) | |
572 | + | else if ((ce == t)) | |
573 | + | then (cf >= aI) | |
574 | + | else (aI >= cf) | |
575 | + | if (cg) | |
576 | + | then $Tuple3("closePosition", [G(aF, B(bo)), F(aN, B(bo))], nil) | |
577 | + | else throw("Can not execute TAKE order: triggerPrice mismatch") | |
578 | + | } | |
579 | + | else if ((aH == s)) | |
580 | + | then { | |
581 | + | let cf = as(P) | |
582 | + | let ch = if ((aN == 0)) | |
583 | + | then aC(aI) | |
584 | + | else B((aI - aN)) | |
585 | + | let cg = if ((cf >= (aI - ch))) | |
586 | + | then ((aI + ch) >= cf) | |
587 | + | else false | |
588 | + | if (cg) | |
589 | + | then { | |
590 | + | let ce = if ((bo > 0)) | |
591 | + | then t | |
592 | + | else if ((0 > bo)) | |
593 | + | then u | |
594 | + | else -1 | |
595 | + | let ci = if ((bo == 0)) | |
596 | + | then v | |
597 | + | else if ((ce == aK)) | |
598 | + | then v | |
599 | + | else w | |
600 | + | if ((ci == v)) | |
601 | + | then { | |
602 | + | let cj = (bZ - F(bZ, ax(P, Q))) | |
603 | + | $Tuple3("increasePosition", [aK, aG, if ((aN == 0)) | |
604 | + | then 0 | |
605 | + | else D(cj, aN), aL], [AttachedPayment(T(), bZ)]) | |
606 | + | } | |
607 | + | else $Tuple3("closePosition", [aF, F(aF, aN)], nil) | |
608 | + | } | |
609 | + | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
610 | + | } | |
611 | + | else throw(("Invalid order type: " + toString(aH))) | |
612 | + | let ck = cd._1 | |
613 | + | let cl = cd._2 | |
614 | + | let cm = cd._3 | |
615 | + | let ca = if ((size(cm) == 1)) | |
616 | + | then { | |
617 | + | let cb = invoke(U(), "withdraw", [toBase58String(T()), cm[0].amount], nil) | |
618 | + | if ((cb == cb)) | |
619 | + | then nil | |
620 | + | else throw("Strict value is not equal to itself.") | |
621 | + | } | |
622 | + | else nil | |
623 | + | if ((ca == ca)) | |
624 | + | then { | |
625 | + | let bL = invoke(this, "setContext", [Q], nil) | |
626 | + | if ((bL == bL)) | |
627 | + | then { | |
628 | + | let bM = invoke(addressFromStringValue(P), ck, cl, cm) | |
629 | + | if ((bM == bM)) | |
630 | + | then { | |
631 | + | let bN = invoke(this, "resetContext", nil, nil) | |
632 | + | if ((bN == bN)) | |
633 | + | then { | |
634 | + | let bV = (aa(P, Q) - 1) | |
635 | + | ((aT(P, Q, bV) ++ aO(L, P, Q, false)) ++ aX(L)) | |
636 | + | } | |
637 | + | else throw("Strict value is not equal to itself.") | |
638 | + | } | |
639 | + | else throw("Strict value is not equal to itself.") | |
640 | + | } | |
641 | + | else throw("Strict value is not equal to itself.") | |
642 | + | } | |
643 | + | else throw("Strict value is not equal to itself.") | |
644 | + | } | |
645 | + | else throw("Strict value is not equal to itself.") | |
646 | + | } | |
647 | + | ||
648 | + | ||
649 | + | ||
650 | + | @Callable(aZ) | |
651 | + | func view_canExecuteOrder (L) = { | |
652 | + | let at = invoke(this, "executeOrder", [L], nil) | |
653 | + | if ((at == at)) | |
561 | 654 | then throw("Success") | |
562 | 655 | else throw("Strict value is not equal to itself.") | |
563 | 656 | } | |
564 | 657 | ||
565 | 658 | ||
566 | - | @Verifier( | |
567 | - | func | |
659 | + | @Verifier(cn) | |
660 | + | func co () = sigVerify(cn.bodyBytes, cn.proofs[0], W()) | |
568 | 661 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "k_coordinatorAddress" | |
5 | 5 | ||
6 | 6 | let b = "k_admin_public_key" | |
7 | 7 | ||
8 | 8 | let c = "k_quote_asset" | |
9 | 9 | ||
10 | 10 | let d = "k_amm" | |
11 | 11 | ||
12 | 12 | let e = "k_manager_address" | |
13 | 13 | ||
14 | 14 | let f = "k_positionSequence" | |
15 | 15 | ||
16 | 16 | let g = "k_positionSize" | |
17 | 17 | ||
18 | 18 | let h = "k_fee" | |
19 | 19 | ||
20 | 20 | let i = "k_executedOrders" | |
21 | 21 | ||
22 | 22 | let j = "k_canceledOrders" | |
23 | 23 | ||
24 | 24 | let k = "k_order" | |
25 | 25 | ||
26 | 26 | let l = "k_lastOrderId" | |
27 | 27 | ||
28 | 28 | let m = "k_traderOrderCnt" | |
29 | 29 | ||
30 | - | let n = "k_ | |
30 | + | let n = "k_traderOrderIds" | |
31 | 31 | ||
32 | - | let o = "k_ | |
32 | + | let o = "k_sender" | |
33 | 33 | ||
34 | - | let p = | |
34 | + | let p = "k_initialized" | |
35 | 35 | ||
36 | - | let q = | |
36 | + | let q = 1 | |
37 | 37 | ||
38 | - | let r = | |
38 | + | let r = 2 | |
39 | 39 | ||
40 | - | let s = | |
40 | + | let s = 3 | |
41 | 41 | ||
42 | - | let t = | |
42 | + | let t = 1 | |
43 | 43 | ||
44 | - | let u = | |
44 | + | let u = 2 | |
45 | 45 | ||
46 | - | let v = | |
46 | + | let v = 1 | |
47 | 47 | ||
48 | - | let w = | |
48 | + | let w = 2 | |
49 | 49 | ||
50 | - | let x = | |
50 | + | let x = 5 | |
51 | 51 | ||
52 | - | let y = | |
52 | + | let y = lastBlock.timestamp | |
53 | 53 | ||
54 | - | let z = ( | |
54 | + | let z = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
55 | 55 | ||
56 | - | func A (B) = if ((B > 0)) | |
57 | - | then B | |
58 | - | else -(B) | |
56 | + | let A = (z / 200) | |
57 | + | ||
58 | + | func B (C) = if ((C > 0)) | |
59 | + | then C | |
60 | + | else -(C) | |
59 | 61 | ||
60 | 62 | ||
61 | - | func | |
63 | + | func D (C,E) = fraction(C, z, E, HALFEVEN) | |
62 | 64 | ||
63 | 65 | ||
64 | - | func | |
66 | + | func F (C,E) = fraction(C, E, z, HALFEVEN) | |
65 | 67 | ||
66 | 68 | ||
67 | - | func | |
68 | - | then | |
69 | - | else | |
69 | + | func G (C,E) = if ((C > E)) | |
70 | + | then E | |
71 | + | else C | |
70 | 72 | ||
71 | 73 | ||
72 | - | func | |
74 | + | func H (I,J) = ((I + "_") + J) | |
73 | 75 | ||
74 | 76 | ||
75 | - | func | |
77 | + | func K (L) = ((i + "_") + toString(L)) | |
76 | 78 | ||
77 | 79 | ||
78 | - | func | |
80 | + | func M (L) = ((j + "_") + toString(L)) | |
79 | 81 | ||
80 | 82 | ||
81 | - | func | |
83 | + | func N (L) = H(k, toString(L)) | |
82 | 84 | ||
83 | 85 | ||
84 | - | func | |
86 | + | func O (P,Q) = ((((m + "_") + P) + "_") + Q) | |
85 | 87 | ||
86 | 88 | ||
87 | - | func | |
89 | + | func R (P,Q) = ((((n + "_") + P) + "_") + Q) | |
88 | 90 | ||
89 | 91 | ||
90 | - | func | |
92 | + | func S () = valueOrErrorMessage(addressFromString(getStringValue(this, a)), "Coordinator not set") | |
91 | 93 | ||
92 | 94 | ||
93 | - | func | |
95 | + | func T () = fromBase58String(getStringValue(S(), c)) | |
94 | 96 | ||
95 | 97 | ||
96 | - | func | |
98 | + | func U () = valueOrErrorMessage(addressFromString(getStringValue(S(), e)), "Manager not set") | |
97 | 99 | ||
98 | 100 | ||
99 | - | func | |
101 | + | func V (J) = valueOrElse(getBoolean(S(), H(d, J)), false) | |
100 | 102 | ||
101 | 103 | ||
102 | - | func | |
104 | + | func W () = fromBase58String(getStringValue(S(), b)) | |
103 | 105 | ||
104 | 106 | ||
105 | - | func W (K) = if (valueOrElse(getBoolean(this, J(K)), false)) | |
106 | - | then throw(("Order already executed: " + toString(K))) | |
107 | - | else if (valueOrElse(getBoolean(this, L(K)), false)) | |
108 | - | then throw(("Order already cancelled: " + toString(K))) | |
107 | + | func X () = valueOrElse(getBoolean(this, p), false) | |
108 | + | ||
109 | + | ||
110 | + | func Y (L) = if (valueOrElse(getBoolean(this, K(L)), false)) | |
111 | + | then throw(("Order already executed: " + toString(L))) | |
112 | + | else if (valueOrElse(getBoolean(this, M(L)), false)) | |
113 | + | then throw(("Order already cancelled: " + toString(L))) | |
109 | 114 | else true | |
110 | 115 | ||
111 | 116 | ||
112 | - | func | |
117 | + | func Z () = valueOrElse(getInteger(this, l), 0) | |
113 | 118 | ||
114 | 119 | ||
115 | - | func | |
116 | - | let | |
117 | - | valueOrElse(getInteger(this, | |
120 | + | func aa (P,Q) = { | |
121 | + | let ab = O(P, Q) | |
122 | + | valueOrElse(getInteger(this, ab), 0) | |
118 | 123 | } | |
119 | 124 | ||
120 | 125 | ||
121 | - | func aa (K) = { | |
122 | - | let ab = valueOrErrorMessage(getString(this, M(K)), ("Invalid order id: " + toString(K))) | |
123 | - | let ac = split(ab, ",") | |
124 | - | let ad = ac[0] | |
125 | - | let ae = ac[1] | |
126 | - | let af = valueOrErrorMessage(parseInt(ac[2]), "Invalid amountIn") | |
127 | - | let ag = valueOrErrorMessage(parseInt(ac[3]), "Invalid leverage") | |
128 | - | let ah = valueOrErrorMessage(parseInt(ac[4]), "Invalid type") | |
129 | - | let ai = valueOrErrorMessage(parseInt(ac[5]), "Invalid triggerPrice") | |
130 | - | let aj = valueOrErrorMessage(parseInt(ac[6]), "Invalid paymentUsdn") | |
131 | - | let ak = valueOrErrorMessage(parseInt(ac[7]), "Invalid side") | |
132 | - | let al = ac[8] | |
133 | - | let am = valueOrErrorMessage(parseInt(ac[9]), "Invalid positionId") | |
134 | - | let an = valueOrErrorMessage(parseInt(ac[10]), "Invalid limitPrice") | |
135 | - | $Tuple11(ad, ae, af, ag, ah, ai, aj, ak, al, am, an) | |
126 | + | func ac (P,Q) = { | |
127 | + | let ab = R(P, Q) | |
128 | + | let ad = valueOrElse(getString(this, ab), "") | |
129 | + | if ((ad == "")) | |
130 | + | then nil | |
131 | + | else split(ad, ",") | |
136 | 132 | } | |
137 | 133 | ||
138 | 134 | ||
139 | - | func ao (O) = { | |
140 | - | let ap = invoke(addressFromStringValue(O), "computeSpotPrice", nil, nil) | |
141 | - | if ((ap == ap)) | |
135 | + | func ae (L) = { | |
136 | + | let af = valueOrErrorMessage(getString(this, N(L)), ("Invalid order id: " + toString(L))) | |
137 | + | let ag = split(af, ",") | |
138 | + | let ah = ag[0] | |
139 | + | let ai = ag[1] | |
140 | + | let aj = valueOrErrorMessage(parseInt(ag[2]), "Invalid amountIn") | |
141 | + | let ak = valueOrErrorMessage(parseInt(ag[3]), "Invalid leverage") | |
142 | + | let al = valueOrErrorMessage(parseInt(ag[4]), "Invalid type") | |
143 | + | let am = valueOrErrorMessage(parseInt(ag[5]), "Invalid triggerPrice") | |
144 | + | let an = valueOrErrorMessage(parseInt(ag[6]), "Invalid paymentUsdn") | |
145 | + | let ao = valueOrErrorMessage(parseInt(ag[7]), "Invalid side") | |
146 | + | let ap = ag[8] | |
147 | + | let aq = valueOrErrorMessage(parseInt(ag[9]), "Invalid positionId") | |
148 | + | let ar = valueOrErrorMessage(parseInt(ag[10]), "Invalid limitPrice") | |
149 | + | $Tuple11(ah, ai, aj, ak, al, am, an, ao, ap, aq, ar) | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | func as (P) = { | |
154 | + | let at = invoke(addressFromStringValue(P), "computeSpotPrice", nil, nil) | |
155 | + | if ((at == at)) | |
142 | 156 | then { | |
143 | - | let | |
144 | - | let | |
145 | - | if ($isInstanceOf( | |
157 | + | let au = { | |
158 | + | let av = at | |
159 | + | if ($isInstanceOf(av, "Int")) | |
146 | 160 | then { | |
147 | - | let | |
148 | - | | |
161 | + | let aw = av | |
162 | + | aw | |
149 | 163 | } | |
150 | 164 | else throw("Invalid computeSpotPrice result") | |
151 | 165 | } | |
152 | - | value( | |
166 | + | value(au) | |
153 | 167 | } | |
154 | 168 | else throw("Strict value is not equal to itself.") | |
155 | 169 | } | |
156 | 170 | ||
157 | 171 | ||
158 | - | func | |
159 | - | let | |
160 | - | if (( | |
172 | + | func ax (P,Q) = { | |
173 | + | let at = invoke(addressFromStringValue(P), "computeFeeForTraderWithArtifact", [Q, ""], nil) | |
174 | + | if ((at == at)) | |
161 | 175 | then { | |
162 | - | let | |
163 | - | let | |
164 | - | if ($isInstanceOf( | |
176 | + | let au = { | |
177 | + | let av = at | |
178 | + | if ($isInstanceOf(av, "(Int, Boolean)")) | |
165 | 179 | then { | |
166 | - | let | |
167 | - | | |
180 | + | let aw = av | |
181 | + | aw._1 | |
168 | 182 | } | |
169 | 183 | else throw("Invalid computeFeeForTraderWithArtifact result") | |
170 | 184 | } | |
171 | - | value( | |
185 | + | value(au) | |
172 | 186 | } | |
173 | 187 | else throw("Strict value is not equal to itself.") | |
174 | 188 | } | |
175 | 189 | ||
176 | 190 | ||
177 | - | func | |
178 | - | let | |
179 | - | let | |
180 | - | valueOrElse(getInteger( | |
191 | + | func ay (P,Q) = { | |
192 | + | let ah = addressFromStringValue(P) | |
193 | + | let az = H(g, Q) | |
194 | + | valueOrElse(getInteger(ah, az), 0) | |
181 | 195 | } | |
182 | 196 | ||
183 | 197 | ||
184 | - | func | |
185 | - | let | |
186 | - | let | |
187 | - | valueOrElse(getInteger( | |
198 | + | func aA (P,Q) = { | |
199 | + | let ah = addressFromStringValue(P) | |
200 | + | let aB = H(f, Q) | |
201 | + | valueOrElse(getInteger(ah, aB), 0) | |
188 | 202 | } | |
189 | 203 | ||
190 | 204 | ||
191 | - | func | |
205 | + | func aC (aD) = F(aD, A) | |
192 | 206 | ||
193 | 207 | ||
194 | - | func | |
195 | - | let | |
196 | - | [StringEntry( | |
208 | + | func aE (L,P,Q,aF,aG,aH,aI,aJ,aK,aL,aM,aN) = { | |
209 | + | let af = makeString([P, Q, toString(aF), toString(aG), toString(aH), toString(aI), toString(aJ), toString(aK), aL, toString(aM), toString(aN)], ",") | |
210 | + | [StringEntry(N(L), af)] | |
197 | 211 | } | |
198 | 212 | ||
199 | 213 | ||
200 | - | func aK (O,P,aL) = [IntegerEntry(N(O, P), aL)] | |
214 | + | func aO (L,P,Q,aP) = { | |
215 | + | let aQ = ac(P, Q) | |
216 | + | let aR = if (aP) | |
217 | + | then (aQ :+ toString(L)) | |
218 | + | else removeByIndex(aQ, valueOrErrorMessage(indexOf(aQ, toString(L)), ("No order with id: " + toString(L)))) | |
219 | + | let aS = makeString(aR, ",") | |
220 | + | [StringEntry(R(P, Q), aS)] | |
221 | + | } | |
201 | 222 | ||
202 | 223 | ||
203 | - | func | |
224 | + | func aT (P,Q,aU) = [IntegerEntry(O(P, Q), aU)] | |
204 | 225 | ||
205 | 226 | ||
206 | - | func | |
227 | + | func aV (aW) = [IntegerEntry(l, aW)] | |
207 | 228 | ||
208 | 229 | ||
209 | - | func | |
230 | + | func aX (L) = [BooleanEntry(H(i, toString(L)), true)] | |
210 | 231 | ||
211 | 232 | ||
212 | - | @Callable(aQ) | |
213 | - | func setContext (aR) = if ((aQ.caller != this)) | |
214 | - | then throw("Only self-call") | |
215 | - | else [StringEntry(n, aR)] | |
233 | + | func aY (L) = [BooleanEntry(H(j, toString(L)), true)] | |
216 | 234 | ||
217 | 235 | ||
218 | - | ||
219 | - | @Callable(aQ) | |
220 | - | func resetContext () = if ((aQ.caller != this)) | |
221 | - | then throw("Only self-call") | |
222 | - | else [DeleteEntry(n)] | |
223 | - | ||
224 | - | ||
225 | - | ||
226 | - | @Callable(aQ) | |
227 | - | func initialize (aS) = if (V()) | |
228 | - | then throw("Already initialized") | |
229 | - | else [StringEntry(a, aS), BooleanEntry(o, true)] | |
230 | - | ||
231 | - | ||
232 | - | ||
233 | - | @Callable(aQ) | |
234 | - | func createOrder (O,aD,aE,aJ,aB,aC,aG,aH) = if ((size(aQ.payments) > 1)) | |
235 | - | then throw("Invalid createOrder parameters: invalid payment count") | |
236 | - | else { | |
237 | - | let aT = if ((size(aQ.payments) == 1)) | |
238 | - | then $Tuple2(toBase58String(valueOrErrorMessage(aQ.payments[0].assetId, "Invalid asset id")), aQ.payments[0].amount) | |
239 | - | else $Tuple2("", 0) | |
240 | - | let aU = aT._1 | |
241 | - | let aV = aT._2 | |
242 | - | let aW = invoke(this, "internalCreateOrder", [toString(aQ.caller), O, aD, aE, aJ, aB, aC, aG, aH, aU, aV], nil) | |
243 | - | if ((aW == aW)) | |
244 | - | then nil | |
245 | - | else throw("Strict value is not equal to itself.") | |
236 | + | @Callable(aZ) | |
237 | + | func cleanUpStaleOrders (P,Q) = { | |
238 | + | let ba = ac(P, Q) | |
239 | + | func bb (bc,L) = { | |
240 | + | let bd = valueOrErrorMessage(parseInt(L), "Invalid order id") | |
241 | + | let be = ae(bd) | |
242 | + | let bf = be._1 | |
243 | + | let bg = be._2 | |
244 | + | let bh = be._3 | |
245 | + | let bi = be._4 | |
246 | + | let aH = be._5 | |
247 | + | let bj = be._6 | |
248 | + | let bk = be._7 | |
249 | + | let bl = be._8 | |
250 | + | let bm = be._9 | |
251 | + | let aM = be._10 | |
252 | + | let bn = be._11 | |
253 | + | let bo = ay(P, Q) | |
254 | + | let bp = if ((bo != 0)) | |
255 | + | then aA(P, Q) | |
256 | + | else 0 | |
257 | + | if (if (if ((aH == q)) | |
258 | + | then true | |
259 | + | else (aH == r)) | |
260 | + | then (bp != aM) | |
261 | + | else false) | |
262 | + | then { | |
263 | + | let bq = (aY(bd) ++ aO(bd, P, Q, false)) | |
264 | + | (bc ++ bq) | |
265 | + | } | |
266 | + | else bc | |
246 | 267 | } | |
247 | 268 | ||
269 | + | let br = ba | |
270 | + | let bs = size(br) | |
271 | + | let bt = nil | |
272 | + | func bu (bv,bw) = if ((bw >= bs)) | |
273 | + | then bv | |
274 | + | else bb(bv, br[bw]) | |
248 | 275 | ||
276 | + | func bx (bv,bw) = if ((bw >= bs)) | |
277 | + | then bv | |
278 | + | else throw("List size exceeds 5") | |
249 | 279 | ||
250 | - | @Callable(aQ) | |
251 | - | func increasePositionWithStopLoss (O,aX,aC,aY,aH,aZ,ba,bb,bc) = { | |
252 | - | let P = toString(aQ.caller) | |
253 | - | if (if (!(V())) | |
254 | - | then true | |
255 | - | else !(T(O))) | |
256 | - | then throw("Invalid increasePositionWithStopLoss parameters") | |
257 | - | else { | |
258 | - | let bd = au(O, P) | |
259 | - | if ((bd != 0)) | |
260 | - | then throw("Invalid increasePositionWithStopLoss parameters: only new position") | |
261 | - | else { | |
262 | - | let be = invoke(this, "setContext", [P], nil) | |
263 | - | if ((be == be)) | |
264 | - | then { | |
265 | - | let bf = invoke(addressFromStringValue(O), "increasePosition", [aX, aC, aY, aH], aQ.payments) | |
266 | - | if ((bf == bf)) | |
267 | - | then { | |
268 | - | let bg = invoke(this, "resetContext", nil, nil) | |
269 | - | if ((bg == bg)) | |
270 | - | then { | |
271 | - | let bh = au(O, P) | |
272 | - | if ((bh == bh)) | |
273 | - | then { | |
274 | - | let af = A(bh) | |
275 | - | let bi = if ((0 > bh)) | |
276 | - | then s | |
277 | - | else t | |
278 | - | let bj = if ((aZ > 0)) | |
279 | - | then { | |
280 | - | let bj = invoke(this, "internalCreateOrder", [P, O, p, aZ, ba, af, 0, bi, aH, "", 0], nil) | |
281 | - | if ((bj == bj)) | |
282 | - | then nil | |
283 | - | else throw("Strict value is not equal to itself.") | |
284 | - | } | |
285 | - | else nil | |
286 | - | if ((bj == bj)) | |
287 | - | then { | |
288 | - | let bk = if ((bb > 0)) | |
289 | - | then { | |
290 | - | let bk = invoke(this, "internalCreateOrder", [P, O, q, bb, bc, af, 0, bi, aH, "", 0], nil) | |
291 | - | if ((bk == bk)) | |
292 | - | then nil | |
293 | - | else throw("Strict value is not equal to itself.") | |
294 | - | } | |
295 | - | else nil | |
296 | - | if ((bk == bk)) | |
297 | - | then nil | |
298 | - | else throw("Strict value is not equal to itself.") | |
299 | - | } | |
300 | - | else throw("Strict value is not equal to itself.") | |
301 | - | } | |
302 | - | else throw("Strict value is not equal to itself.") | |
303 | - | } | |
304 | - | else throw("Strict value is not equal to itself.") | |
305 | - | } | |
306 | - | else throw("Strict value is not equal to itself.") | |
307 | - | } | |
308 | - | else throw("Strict value is not equal to itself.") | |
309 | - | } | |
310 | - | } | |
280 | + | bx(bu(bu(bu(bu(bu(bt, 0), 1), 2), 3), 4), 5) | |
311 | 281 | } | |
312 | 282 | ||
313 | 283 | ||
314 | 284 | ||
315 | - | @Callable(aQ) | |
316 | - | func internalCreateOrder (P,O,aD,aE,aJ,aB,aC,aG,aH,bl,bm) = if (if (if (if (if (if (if (if (if (!(V())) | |
285 | + | @Callable(aZ) | |
286 | + | func setContext (by) = if ((aZ.caller != this)) | |
287 | + | then throw("Only self-call") | |
288 | + | else [StringEntry(o, by)] | |
289 | + | ||
290 | + | ||
291 | + | ||
292 | + | @Callable(aZ) | |
293 | + | func resetContext () = if ((aZ.caller != this)) | |
294 | + | then throw("Only self-call") | |
295 | + | else [DeleteEntry(o)] | |
296 | + | ||
297 | + | ||
298 | + | ||
299 | + | @Callable(aZ) | |
300 | + | func initialize (bz) = if (X()) | |
301 | + | then throw("Already initialized") | |
302 | + | else [StringEntry(a, bz), BooleanEntry(p, true)] | |
303 | + | ||
304 | + | ||
305 | + | ||
306 | + | @Callable(aZ) | |
307 | + | func createOrder (P,aH,aI,aN,aF,aG,aK,aL) = { | |
308 | + | let Q = toString(aZ.caller) | |
309 | + | let bA = invoke(this, "cleanUpStaleOrders", [P, Q], nil) | |
310 | + | if ((bA == bA)) | |
311 | + | then if ((size(aZ.payments) > 1)) | |
312 | + | then throw("Invalid createOrder parameters: invalid payment count") | |
313 | + | else { | |
314 | + | let bB = if ((size(aZ.payments) == 1)) | |
315 | + | then $Tuple2(toBase58String(valueOrErrorMessage(aZ.payments[0].assetId, "Invalid asset id")), aZ.payments[0].amount) | |
316 | + | else $Tuple2("", 0) | |
317 | + | let bC = bB._1 | |
318 | + | let bD = bB._2 | |
319 | + | let bE = invoke(this, "internalCreateOrder", [Q, P, aH, aI, aN, aF, aG, aK, aL, bC, bD], nil) | |
320 | + | if ((bE == bE)) | |
321 | + | then nil | |
322 | + | else throw("Strict value is not equal to itself.") | |
323 | + | } | |
324 | + | else throw("Strict value is not equal to itself.") | |
325 | + | } | |
326 | + | ||
327 | + | ||
328 | + | ||
329 | + | @Callable(aZ) | |
330 | + | func increasePositionWithStopLoss (P,bF,aG,bG,aL,bH,bI,bJ,bK) = { | |
331 | + | let Q = toString(aZ.caller) | |
332 | + | let bA = invoke(this, "cleanUpStaleOrders", [P, Q], nil) | |
333 | + | if ((bA == bA)) | |
334 | + | then if (if (!(X())) | |
335 | + | then true | |
336 | + | else !(V(P))) | |
337 | + | then throw("Invalid increasePositionWithStopLoss parameters") | |
338 | + | else { | |
339 | + | let bo = ay(P, Q) | |
340 | + | if ((bo != 0)) | |
341 | + | then throw("Invalid increasePositionWithStopLoss parameters: only new position") | |
342 | + | else { | |
343 | + | let bL = invoke(this, "setContext", [Q], nil) | |
344 | + | if ((bL == bL)) | |
345 | + | then { | |
346 | + | let bM = invoke(addressFromStringValue(P), "increasePosition", [bF, aG, bG, aL], aZ.payments) | |
347 | + | if ((bM == bM)) | |
348 | + | then { | |
349 | + | let bN = invoke(this, "resetContext", nil, nil) | |
350 | + | if ((bN == bN)) | |
351 | + | then { | |
352 | + | let bO = ay(P, Q) | |
353 | + | if ((bO == bO)) | |
354 | + | then { | |
355 | + | let aj = B(bO) | |
356 | + | let bP = if ((0 > bO)) | |
357 | + | then t | |
358 | + | else u | |
359 | + | let bQ = if ((bH > 0)) | |
360 | + | then { | |
361 | + | let bQ = invoke(this, "internalCreateOrder", [Q, P, q, bH, bI, aj, 0, bP, aL, "", 0], nil) | |
362 | + | if ((bQ == bQ)) | |
363 | + | then nil | |
364 | + | else throw("Strict value is not equal to itself.") | |
365 | + | } | |
366 | + | else nil | |
367 | + | if ((bQ == bQ)) | |
368 | + | then { | |
369 | + | let bR = if ((bJ > 0)) | |
370 | + | then { | |
371 | + | let bR = invoke(this, "internalCreateOrder", [Q, P, r, bJ, bK, aj, 0, bP, aL, "", 0], nil) | |
372 | + | if ((bR == bR)) | |
373 | + | then nil | |
374 | + | else throw("Strict value is not equal to itself.") | |
375 | + | } | |
376 | + | else nil | |
377 | + | if ((bR == bR)) | |
378 | + | then nil | |
379 | + | else throw("Strict value is not equal to itself.") | |
380 | + | } | |
381 | + | else throw("Strict value is not equal to itself.") | |
382 | + | } | |
383 | + | else throw("Strict value is not equal to itself.") | |
384 | + | } | |
385 | + | else throw("Strict value is not equal to itself.") | |
386 | + | } | |
387 | + | else throw("Strict value is not equal to itself.") | |
388 | + | } | |
389 | + | else throw("Strict value is not equal to itself.") | |
390 | + | } | |
391 | + | } | |
392 | + | else throw("Strict value is not equal to itself.") | |
393 | + | } | |
394 | + | ||
395 | + | ||
396 | + | ||
397 | + | @Callable(aZ) | |
398 | + | func internalCreateOrder (Q,P,aH,aI,aN,aF,aG,aK,aL,bS,bT) = if (if (if (if (if (if (if (if (if (!(X())) | |
317 | 399 | then true | |
318 | - | else !( | |
400 | + | else !(V(P))) | |
319 | 401 | then true | |
320 | - | else (0 >= | |
402 | + | else (0 >= aI)) | |
321 | 403 | then true | |
322 | - | else (0 > | |
404 | + | else (0 > aN)) | |
323 | 405 | then true | |
324 | - | else (0 >= | |
406 | + | else (0 >= aF)) | |
325 | 407 | then true | |
326 | - | else (0 > | |
408 | + | else (0 > aG)) | |
327 | 409 | then true | |
328 | - | else !(if (( | |
410 | + | else !(if ((aK == t)) | |
329 | 411 | then true | |
330 | - | else ( | |
412 | + | else (aK == u))) | |
331 | 413 | then true | |
332 | - | else !(if (if (( | |
414 | + | else !(if (if ((aH == q)) | |
333 | 415 | then true | |
334 | - | else ( | |
416 | + | else (aH == r)) | |
335 | 417 | then true | |
336 | - | else ( | |
418 | + | else (aH == s))) | |
337 | 419 | then true | |
338 | - | else !(( | |
420 | + | else !((aZ.caller == this))) | |
339 | 421 | then throw("Invalid createOrder parameters") | |
340 | 422 | else { | |
341 | - | let | |
342 | - | let | |
343 | - | let | |
344 | - | let | |
423 | + | let bU = (Z() + 1) | |
424 | + | let bV = (aa(P, Q) + 1) | |
425 | + | let bo = ay(P, Q) | |
426 | + | let bF = if (if (if ((bo == 0)) | |
345 | 427 | then true | |
346 | - | else if (( | |
347 | - | then ( | |
428 | + | else if ((bo > 0)) | |
429 | + | then (aK == t) | |
348 | 430 | else false) | |
349 | 431 | then true | |
350 | - | else if ((0 > | |
351 | - | then ( | |
432 | + | else if ((0 > bo)) | |
433 | + | then (aK == u) | |
352 | 434 | else false) | |
353 | - | then | |
354 | - | else | |
355 | - | if (if (( | |
356 | - | then if (( | |
435 | + | then v | |
436 | + | else w | |
437 | + | if (if ((bo == 0)) | |
438 | + | then if ((aH == q)) | |
357 | 439 | then true | |
358 | - | else ( | |
440 | + | else (aH == r) | |
359 | 441 | else false) | |
360 | 442 | then throw("Can not create STOP/TAKE order: no position") | |
361 | 443 | else { | |
362 | - | let | |
363 | - | then if (if (( | |
444 | + | let bW = if ((bF == v)) | |
445 | + | then if (if ((bS != toBase58String(T()))) | |
364 | 446 | then true | |
365 | - | else ( | |
447 | + | else (bT != aF)) | |
366 | 448 | then throw("Invalid createLimitOrder parameters: invalid payment") | |
367 | 449 | else { | |
368 | - | let | |
369 | - | if (( | |
370 | - | then | |
450 | + | let bX = invoke(U(), "deposit", nil, [AttachedPayment(T(), bT)]) | |
451 | + | if ((bX == bX)) | |
452 | + | then bT | |
371 | 453 | else throw("Strict value is not equal to itself.") | |
372 | 454 | } | |
373 | 455 | else 0 | |
374 | - | if (( | |
456 | + | if ((bW == bW)) | |
375 | 457 | then { | |
376 | - | let | |
377 | - | then | |
458 | + | let aq = if ((bo != 0)) | |
459 | + | then aA(P, Q) | |
378 | 460 | else 0 | |
379 | - | if (( | |
461 | + | if ((bV > x)) | |
380 | 462 | then throw("Invalid createLimitOrder parameters: order count") | |
381 | - | else (( | |
463 | + | else (((aE(bU, P, Q, aF, aG, aH, aI, bW, aK, aL, aq, aN) ++ aO(bU, P, Q, true)) ++ aT(P, Q, bV)) ++ aV(bU)) | |
382 | 464 | } | |
383 | 465 | else throw("Strict value is not equal to itself.") | |
384 | 466 | } | |
385 | 467 | } | |
386 | 468 | ||
387 | 469 | ||
388 | 470 | ||
389 | - | @Callable( | |
390 | - | func cancelOrder ( | |
391 | - | let | |
392 | - | let | |
393 | - | let | |
394 | - | let | |
395 | - | let | |
396 | - | let | |
397 | - | let | |
398 | - | let | |
399 | - | let | |
400 | - | let | |
401 | - | let | |
402 | - | let | |
403 | - | if (if (if (!( | |
471 | + | @Callable(aZ) | |
472 | + | func cancelOrder (L) = { | |
473 | + | let bY = ae(L) | |
474 | + | let P = bY._1 | |
475 | + | let Q = bY._2 | |
476 | + | let aF = bY._3 | |
477 | + | let aG = bY._4 | |
478 | + | let aH = bY._5 | |
479 | + | let aI = bY._6 | |
480 | + | let bZ = bY._7 | |
481 | + | let aK = bY._8 | |
482 | + | let aL = bY._9 | |
483 | + | let aM = bY._10 | |
484 | + | let aN = bY._11 | |
485 | + | if (if (if (!(X())) | |
404 | 486 | then true | |
405 | - | else !( | |
487 | + | else !(Y(L))) | |
406 | 488 | then true | |
407 | - | else !((toString( | |
489 | + | else !((toString(aZ.caller) == Q))) | |
408 | 490 | then throw("Invalid cancelOrder parameters") | |
409 | 491 | else { | |
410 | - | let | |
411 | - | | |
492 | + | let bA = invoke(this, "cleanUpStaleOrders", [P, Q], nil) | |
493 | + | if ((bA == bA)) | |
412 | 494 | then { | |
413 | - | let bu = invoke(S(), "withdraw", [toBase58String(R()), bs], nil) | |
414 | - | if ((bu == bu)) | |
415 | - | then nil | |
416 | - | else throw("Strict value is not equal to itself.") | |
417 | - | } | |
418 | - | else nil | |
419 | - | if ((bt == bt)) | |
420 | - | then ((aP(K) ++ aK(O, P, bo)) ++ (if ((bs > 0)) | |
421 | - | then [ScriptTransfer(aQ.caller, bs, R())] | |
422 | - | else nil)) | |
423 | - | else throw("Strict value is not equal to itself.") | |
424 | - | } | |
425 | - | } | |
426 | - | ||
427 | - | ||
428 | - | ||
429 | - | @Callable(aQ) | |
430 | - | func executeOrder (K) = { | |
431 | - | let bv = aa(K) | |
432 | - | let O = bv._1 | |
433 | - | let P = bv._2 | |
434 | - | let aB = bv._3 | |
435 | - | let aC = bv._4 | |
436 | - | let aD = bv._5 | |
437 | - | let aE = bv._6 | |
438 | - | let bs = bv._7 | |
439 | - | let aG = bv._8 | |
440 | - | let aH = bv._9 | |
441 | - | let aI = bv._10 | |
442 | - | let aJ = bv._11 | |
443 | - | if (if (!(V())) | |
444 | - | then true | |
445 | - | else !(W(K))) | |
446 | - | then throw("Invalid executeOrder parameters") | |
447 | - | else { | |
448 | - | let bd = au(O, P) | |
449 | - | let bw = if ((bd != 0)) | |
450 | - | then aw(O, P) | |
451 | - | else 0 | |
452 | - | let bx = if ((aD == p)) | |
453 | - | then { | |
454 | - | let by = if ((bd > 0)) | |
455 | - | then s | |
456 | - | else if ((0 > bd)) | |
457 | - | then t | |
458 | - | else throw("Can not execute STOP order: no open position") | |
459 | - | let bz = ao(O) | |
460 | - | let bA = if ((aG == by)) | |
461 | - | then throw("Can not execute STOP order: reduce only") | |
462 | - | else if ((bw != aI)) | |
463 | - | then throw("Can not execute STOP order: position closed") | |
464 | - | else if ((by == s)) | |
465 | - | then (aE >= bz) | |
466 | - | else (bz >= aE) | |
467 | - | if (bA) | |
468 | - | then $Tuple3("closePosition", [F(aB, A(bd)), E(aJ, A(bd))], nil) | |
469 | - | else throw("Can not execute STOP order: triggerPrice mismatch") | |
470 | - | } | |
471 | - | else if ((aD == q)) | |
472 | - | then { | |
473 | - | let by = if ((bd > 0)) | |
474 | - | then s | |
475 | - | else if ((0 > bd)) | |
476 | - | then t | |
477 | - | else throw("Can not execute STOP order: no open position") | |
478 | - | let bz = ao(O) | |
479 | - | let bA = if ((aG == by)) | |
480 | - | then throw("Can not execute TAKE order: reduce only") | |
481 | - | else if ((bw != aI)) | |
482 | - | then throw(((("Can not execute TAKE order: position closed " + toString(bw)) + "!=") + toString(aI))) | |
483 | - | else if ((by == s)) | |
484 | - | then (bz >= aE) | |
485 | - | else (aE >= bz) | |
486 | - | if (bA) | |
487 | - | then $Tuple3("closePosition", [F(aB, A(bd)), E(aJ, A(bd))], nil) | |
488 | - | else throw("Can not execute TAKE order: triggerPrice mismatch") | |
489 | - | } | |
490 | - | else if ((aD == r)) | |
495 | + | let bV = (aa(P, Q) - 1) | |
496 | + | let ca = if ((bZ > 0)) | |
491 | 497 | then { | |
492 | - | let bz = ao(O) | |
493 | - | let bB = if ((aJ == 0)) | |
494 | - | then ay(aE) | |
495 | - | else A((aE - aJ)) | |
496 | - | let bA = if ((bz >= (aE - bB))) | |
497 | - | then ((aE + bB) >= bz) | |
498 | - | else false | |
499 | - | if (bA) | |
500 | - | then { | |
501 | - | let by = if ((bd > 0)) | |
502 | - | then s | |
503 | - | else if ((0 > bd)) | |
504 | - | then t | |
505 | - | else -1 | |
506 | - | let bC = if ((bd == 0)) | |
507 | - | then u | |
508 | - | else if ((by == aG)) | |
509 | - | then u | |
510 | - | else v | |
511 | - | if ((bC == u)) | |
512 | - | then { | |
513 | - | let bD = (bs - E(bs, at(O, P))) | |
514 | - | $Tuple3("increasePosition", [aG, aC, if ((aJ == 0)) | |
515 | - | then 0 | |
516 | - | else C(bD, aJ), aH], [AttachedPayment(R(), bs)]) | |
517 | - | } | |
518 | - | else $Tuple3("closePosition", [aB, E(aB, aJ)], nil) | |
519 | - | } | |
520 | - | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
521 | - | } | |
522 | - | else throw(("Invalid order type: " + toString(aD))) | |
523 | - | let bE = bx._1 | |
524 | - | let bF = bx._2 | |
525 | - | let bG = bx._3 | |
526 | - | let bt = if ((size(bG) == 1)) | |
527 | - | then { | |
528 | - | let bu = invoke(S(), "withdraw", [toBase58String(R()), bG[0].amount], nil) | |
529 | - | if ((bu == bu)) | |
530 | - | then nil | |
531 | - | else throw("Strict value is not equal to itself.") | |
532 | - | } | |
533 | - | else nil | |
534 | - | if ((bt == bt)) | |
535 | - | then { | |
536 | - | let be = invoke(this, "setContext", [P], nil) | |
537 | - | if ((be == be)) | |
538 | - | then { | |
539 | - | let bf = invoke(addressFromStringValue(O), bE, bF, bG) | |
540 | - | if ((bf == bf)) | |
541 | - | then { | |
542 | - | let bg = invoke(this, "resetContext", nil, nil) | |
543 | - | if ((bg == bg)) | |
544 | - | then aO(K) | |
545 | - | else throw("Strict value is not equal to itself.") | |
546 | - | } | |
498 | + | let cb = invoke(U(), "withdraw", [toBase58String(T()), bZ], nil) | |
499 | + | if ((cb == cb)) | |
500 | + | then nil | |
547 | 501 | else throw("Strict value is not equal to itself.") | |
548 | 502 | } | |
503 | + | else nil | |
504 | + | if ((ca == ca)) | |
505 | + | then (((aY(L) ++ aO(L, P, Q, false)) ++ aT(P, Q, bV)) ++ (if ((bZ > 0)) | |
506 | + | then [ScriptTransfer(aZ.caller, bZ, T())] | |
507 | + | else nil)) | |
549 | 508 | else throw("Strict value is not equal to itself.") | |
550 | 509 | } | |
551 | 510 | else throw("Strict value is not equal to itself.") | |
552 | 511 | } | |
553 | 512 | } | |
554 | 513 | ||
555 | 514 | ||
556 | 515 | ||
557 | - | @Callable(aQ) | |
558 | - | func view_canExecuteOrder (K) = { | |
559 | - | let ap = invoke(this, "executeOrder", [K], nil) | |
560 | - | if ((ap == ap)) | |
516 | + | @Callable(aZ) | |
517 | + | func executeOrder (L) = { | |
518 | + | let cc = ae(L) | |
519 | + | let P = cc._1 | |
520 | + | let Q = cc._2 | |
521 | + | let aF = cc._3 | |
522 | + | let aG = cc._4 | |
523 | + | let aH = cc._5 | |
524 | + | let aI = cc._6 | |
525 | + | let bZ = cc._7 | |
526 | + | let aK = cc._8 | |
527 | + | let aL = cc._9 | |
528 | + | let aM = cc._10 | |
529 | + | let aN = cc._11 | |
530 | + | let bA = invoke(this, "cleanUpStaleOrders", [P, Q], nil) | |
531 | + | if ((bA == bA)) | |
532 | + | then if (if (!(X())) | |
533 | + | then true | |
534 | + | else !(Y(L))) | |
535 | + | then throw("Invalid executeOrder parameters") | |
536 | + | else { | |
537 | + | let bo = ay(P, Q) | |
538 | + | let bp = if ((bo != 0)) | |
539 | + | then aA(P, Q) | |
540 | + | else 0 | |
541 | + | let cd = if ((aH == q)) | |
542 | + | then { | |
543 | + | let ce = if ((bo > 0)) | |
544 | + | then t | |
545 | + | else if ((0 > bo)) | |
546 | + | then u | |
547 | + | else throw("Can not execute STOP order: no open position") | |
548 | + | let cf = as(P) | |
549 | + | let cg = if ((aK == ce)) | |
550 | + | then throw("Can not execute STOP order: reduce only") | |
551 | + | else if ((bp != aM)) | |
552 | + | then throw("Can not execute STOP order: position closed") | |
553 | + | else if ((ce == t)) | |
554 | + | then (aI >= cf) | |
555 | + | else (cf >= aI) | |
556 | + | if (cg) | |
557 | + | then $Tuple3("closePosition", [G(aF, B(bo)), F(aN, B(bo))], nil) | |
558 | + | else throw("Can not execute STOP order: triggerPrice mismatch") | |
559 | + | } | |
560 | + | else if ((aH == r)) | |
561 | + | then { | |
562 | + | let ce = if ((bo > 0)) | |
563 | + | then t | |
564 | + | else if ((0 > bo)) | |
565 | + | then u | |
566 | + | else throw("Can not execute STOP order: no open position") | |
567 | + | let cf = as(P) | |
568 | + | let cg = if ((aK == ce)) | |
569 | + | then throw("Can not execute TAKE order: reduce only") | |
570 | + | else if ((bp != aM)) | |
571 | + | then throw(((("Can not execute TAKE order: position closed " + toString(bp)) + "!=") + toString(aM))) | |
572 | + | else if ((ce == t)) | |
573 | + | then (cf >= aI) | |
574 | + | else (aI >= cf) | |
575 | + | if (cg) | |
576 | + | then $Tuple3("closePosition", [G(aF, B(bo)), F(aN, B(bo))], nil) | |
577 | + | else throw("Can not execute TAKE order: triggerPrice mismatch") | |
578 | + | } | |
579 | + | else if ((aH == s)) | |
580 | + | then { | |
581 | + | let cf = as(P) | |
582 | + | let ch = if ((aN == 0)) | |
583 | + | then aC(aI) | |
584 | + | else B((aI - aN)) | |
585 | + | let cg = if ((cf >= (aI - ch))) | |
586 | + | then ((aI + ch) >= cf) | |
587 | + | else false | |
588 | + | if (cg) | |
589 | + | then { | |
590 | + | let ce = if ((bo > 0)) | |
591 | + | then t | |
592 | + | else if ((0 > bo)) | |
593 | + | then u | |
594 | + | else -1 | |
595 | + | let ci = if ((bo == 0)) | |
596 | + | then v | |
597 | + | else if ((ce == aK)) | |
598 | + | then v | |
599 | + | else w | |
600 | + | if ((ci == v)) | |
601 | + | then { | |
602 | + | let cj = (bZ - F(bZ, ax(P, Q))) | |
603 | + | $Tuple3("increasePosition", [aK, aG, if ((aN == 0)) | |
604 | + | then 0 | |
605 | + | else D(cj, aN), aL], [AttachedPayment(T(), bZ)]) | |
606 | + | } | |
607 | + | else $Tuple3("closePosition", [aF, F(aF, aN)], nil) | |
608 | + | } | |
609 | + | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
610 | + | } | |
611 | + | else throw(("Invalid order type: " + toString(aH))) | |
612 | + | let ck = cd._1 | |
613 | + | let cl = cd._2 | |
614 | + | let cm = cd._3 | |
615 | + | let ca = if ((size(cm) == 1)) | |
616 | + | then { | |
617 | + | let cb = invoke(U(), "withdraw", [toBase58String(T()), cm[0].amount], nil) | |
618 | + | if ((cb == cb)) | |
619 | + | then nil | |
620 | + | else throw("Strict value is not equal to itself.") | |
621 | + | } | |
622 | + | else nil | |
623 | + | if ((ca == ca)) | |
624 | + | then { | |
625 | + | let bL = invoke(this, "setContext", [Q], nil) | |
626 | + | if ((bL == bL)) | |
627 | + | then { | |
628 | + | let bM = invoke(addressFromStringValue(P), ck, cl, cm) | |
629 | + | if ((bM == bM)) | |
630 | + | then { | |
631 | + | let bN = invoke(this, "resetContext", nil, nil) | |
632 | + | if ((bN == bN)) | |
633 | + | then { | |
634 | + | let bV = (aa(P, Q) - 1) | |
635 | + | ((aT(P, Q, bV) ++ aO(L, P, Q, false)) ++ aX(L)) | |
636 | + | } | |
637 | + | else throw("Strict value is not equal to itself.") | |
638 | + | } | |
639 | + | else throw("Strict value is not equal to itself.") | |
640 | + | } | |
641 | + | else throw("Strict value is not equal to itself.") | |
642 | + | } | |
643 | + | else throw("Strict value is not equal to itself.") | |
644 | + | } | |
645 | + | else throw("Strict value is not equal to itself.") | |
646 | + | } | |
647 | + | ||
648 | + | ||
649 | + | ||
650 | + | @Callable(aZ) | |
651 | + | func view_canExecuteOrder (L) = { | |
652 | + | let at = invoke(this, "executeOrder", [L], nil) | |
653 | + | if ((at == at)) | |
561 | 654 | then throw("Success") | |
562 | 655 | else throw("Strict value is not equal to itself.") | |
563 | 656 | } | |
564 | 657 | ||
565 | 658 | ||
566 | - | @Verifier( | |
567 | - | func | |
659 | + | @Verifier(cn) | |
660 | + | func co () = sigVerify(cn.bodyBytes, cn.proofs[0], W()) | |
568 | 661 |
github/deemru/w8io/026f985 111.55 ms ◑