tx · HPfwiPJ9w9SUK82yV952ZqAcGjpZKUQydNo7dqCpudPB 3Mp3uUKsY4LnTo3j4N7dJAfqRfMJ6Rgr35Q: -0.07500000 Waves 2023.01.30 10:00 [2427371] smart account 3Mp3uUKsY4LnTo3j4N7dJAfqRfMJ6Rgr35Q > SELF 0.00000000 Waves
{ "type": 13, "id": "HPfwiPJ9w9SUK82yV952ZqAcGjpZKUQydNo7dqCpudPB", "fee": 7500000, "feeAssetId": null, "timestamp": 1675062145348, "version": 2, "chainId": 84, "sender": "3Mp3uUKsY4LnTo3j4N7dJAfqRfMJ6Rgr35Q", "senderPublicKey": "EiYReiiFX6CXEuz35wibBnvZ8LjJHZrgFwR73fomjgzy", "proofs": [ "QQzq3QKUNB2v1ypjmbAqjvXLL6LjwX4ugAo1T7X1qzLyQqkyGJ7B13TiiZm1u3RkBxWT6enwuStMj9v2CoxoVc5" ], "script": "base64:BgJyCAISABIAEgASABIDCgEBEgMKAQESDwoNAQEBAQEBAQEBAQEBARIUChIBAQEBAQEBCAgIAQEBAQEBAQESBgoEAQEBCBIAEgMKAQESBQoDAQEEEgMKAQgSABIAEgASAwoBCBIDCgEBEgASABIAEgQKAggIwgEADGtfYmFzZU9yYWNsZQIMa19iYXNlT3JhY2xlAA1rX3F1b3RlT3JhY2xlAg1rX3F1b3RlT3JhY2xlAAlrX2JhbGFuY2UCCWtfYmFsYW5jZQAKa19zZXF1ZW5jZQIKa19zZXF1ZW5jZQAOa19wb3NpdGlvblNpemUCDmtfcG9zaXRpb25TaXplABBrX3Bvc2l0aW9uTWFyZ2luAhBrX3Bvc2l0aW9uTWFyZ2luABZrX3Bvc2l0aW9uT3Blbk5vdGlvbmFsAhZrX3Bvc2l0aW9uT3Blbk5vdGlvbmFsAC5rX3Bvc2l0aW9uTGFzdFVwZGF0ZWRDdW11bGF0aXZlUHJlbWl1bUZyYWN0aW9uAhJrX3Bvc2l0aW9uRnJhY3Rpb24AEmtfcG9zaXRpb25TZXF1ZW5jZQISa19wb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yV2l0aEFydGlmYWN0AgUHX3RyYWRlcgULX2FydGlmYWN0SWQJAJQKAgUDbmlsBQZyZXN1bHQBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACQEOYWRtaW5QdWJsaWNLZXkAUYjcGQ==", "height": 2427371, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GTwMSEdf7N6vNo2AxkDG5tGP6xLDJMzwj6wEsdZCu96J Next: 858z2JZZsF7GEpGKxhSwRxoJhjU3XzsbQmve6h1bZXd4 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = "k_ | |
4 | + | let a = "k_baseOracle" | |
5 | 5 | ||
6 | - | let b = "k_ | |
6 | + | let b = "k_quoteOracle" | |
7 | 7 | ||
8 | - | let c = "k_ | |
8 | + | let c = "k_balance" | |
9 | 9 | ||
10 | - | let d = "k_ | |
10 | + | let d = "k_sequence" | |
11 | 11 | ||
12 | - | let e = "k_ | |
12 | + | let e = "k_positionSize" | |
13 | 13 | ||
14 | - | let f = "k_ | |
14 | + | let f = "k_positionMargin" | |
15 | 15 | ||
16 | - | let g = "k_ | |
16 | + | let g = "k_positionOpenNotional" | |
17 | 17 | ||
18 | - | let h = "k_ | |
18 | + | let h = "k_positionFraction" | |
19 | 19 | ||
20 | - | let i = "k_ | |
20 | + | let i = "k_positionSequence" | |
21 | 21 | ||
22 | - | let j = "k_ | |
22 | + | let j = "k_positionAsset" | |
23 | 23 | ||
24 | - | let k = "k_ | |
24 | + | let k = "k_positionFee" | |
25 | 25 | ||
26 | - | let l = "k_ | |
26 | + | let l = "k_positionTimestamp" | |
27 | 27 | ||
28 | - | let m = "k_ | |
28 | + | let m = "k_initialized" | |
29 | 29 | ||
30 | - | let n = "k_ | |
30 | + | let n = "k_paused" | |
31 | 31 | ||
32 | - | let o = "k_ | |
32 | + | let o = "k_closeOnly" | |
33 | 33 | ||
34 | - | let p = "k_ | |
34 | + | let p = "k_fee" | |
35 | 35 | ||
36 | - | let q = "k_fee" | |
36 | + | let q = "k_rollover_fee" | |
37 | 37 | ||
38 | 38 | let r = "k_fundingPeriod" | |
39 | 39 | ||
97 | 97 | ||
98 | 98 | let V = "k_openInterestLong" | |
99 | 99 | ||
100 | - | let W = "k_ | |
100 | + | let W = "k_lastTx" | |
101 | 101 | ||
102 | - | let X = "k_ | |
102 | + | let X = "k_coordinatorAddress" | |
103 | 103 | ||
104 | - | let Y = "k_ | |
104 | + | let Y = "k_vault_address" | |
105 | 105 | ||
106 | - | let Z = "k_admin_ | |
106 | + | let Z = "k_admin_address" | |
107 | 107 | ||
108 | - | let aa = "k_ | |
108 | + | let aa = "k_admin_public_key" | |
109 | 109 | ||
110 | - | let ab = "k_quote_ | |
110 | + | let ab = "k_quote_asset" | |
111 | 111 | ||
112 | - | let ac = "k_staking | |
112 | + | let ac = "k_quote_staking" | |
113 | 113 | ||
114 | - | let ad = "k_ | |
114 | + | let ad = "k_staking_address" | |
115 | 115 | ||
116 | - | let ae = "k_ | |
116 | + | let ae = "k_miner_address" | |
117 | 117 | ||
118 | - | let af = "k_ | |
118 | + | let af = "k_orders_address" | |
119 | 119 | ||
120 | - | let ag = "k_ | |
120 | + | let ag = "k_referral_address" | |
121 | 121 | ||
122 | 122 | let ah = "k_exchange_address" | |
123 | 123 | ||
124 | 124 | let ai = "k_nft_manager_address" | |
125 | 125 | ||
126 | - | let aj = "k_trader_market_asset_collateral" | |
127 | - | ||
128 | - | func ak (al,am) = ((al + "_") + am) | |
126 | + | func aj (ak,al) = ((ak + "_") + al) | |
129 | 127 | ||
130 | 128 | ||
131 | - | func | |
129 | + | func am () = valueOrErrorMessage(addressFromString(getStringValue(this, X)), "Coordinator not set") | |
132 | 130 | ||
133 | 131 | ||
134 | - | func | |
132 | + | func an () = addressFromString(getStringValue(am(), Z)) | |
135 | 133 | ||
136 | 134 | ||
137 | - | func | |
135 | + | func ao () = fromBase58String(getStringValue(am(), aa)) | |
138 | 136 | ||
139 | 137 | ||
140 | - | func | |
138 | + | func ap () = fromBase58String(getStringValue(am(), ab)) | |
141 | 139 | ||
142 | 140 | ||
143 | - | func | |
141 | + | func aq () = valueOrErrorMessage(addressFromString(getStringValue(am(), ac)), "Quote asset staking not set") | |
144 | 142 | ||
145 | 143 | ||
146 | - | func | |
144 | + | func ar () = valueOrErrorMessage(addressFromString(getStringValue(am(), ad)), "Staking not set") | |
147 | 145 | ||
148 | 146 | ||
149 | - | func | |
147 | + | func as () = valueOrErrorMessage(addressFromString(getStringValue(am(), Y)), "Vault not set") | |
150 | 148 | ||
151 | 149 | ||
152 | - | func | |
150 | + | func at () = valueOrErrorMessage(addressFromString(getStringValue(am(), ae)), "Miner not set") | |
153 | 151 | ||
154 | 152 | ||
155 | - | func | |
153 | + | func au () = valueOrErrorMessage(addressFromString(getStringValue(am(), af)), "Orders not set") | |
156 | 154 | ||
157 | 155 | ||
158 | - | func | |
156 | + | func av () = valueOrErrorMessage(addressFromString(getStringValue(am(), ag)), "Referral not set") | |
159 | 157 | ||
160 | 158 | ||
161 | - | func | |
159 | + | func aw () = valueOrErrorMessage(addressFromString(getStringValue(am(), ai)), "NFT Manager not set") | |
162 | 160 | ||
163 | 161 | ||
164 | - | func ay () = valueOrErrorMessage(addressFromString(getStringValue(an(), ag)), "Collateral Manager not set") | |
162 | + | let ax = "k_token_param" | |
163 | + | ||
164 | + | let ay = "k_token_type" | |
165 | + | ||
166 | + | let az = "fee_reduction" | |
167 | + | ||
168 | + | let aA = 1 | |
169 | + | ||
170 | + | let aB = 2 | |
171 | + | ||
172 | + | let aC = 15 | |
173 | + | ||
174 | + | let aD = 1000 | |
175 | + | ||
176 | + | let aE = 6 | |
177 | + | ||
178 | + | let aF = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
179 | + | ||
180 | + | let aG = (525600 * aF) | |
181 | + | ||
182 | + | let aH = (86400 * aF) | |
183 | + | ||
184 | + | let aI = 1 | |
185 | + | ||
186 | + | let aJ = 2 | |
187 | + | ||
188 | + | func aK (aL) = (toString(aL) + ",") | |
165 | 189 | ||
166 | 190 | ||
167 | - | func | |
191 | + | func aM (aL,aN) = fraction(aL, aF, aN, HALFEVEN) | |
168 | 192 | ||
169 | 193 | ||
170 | - | let aA = "k_whitelist_asset" | |
171 | - | ||
172 | - | func aB (aC) = valueOrElse(getBoolean(ay(), ak(aA, aC)), false) | |
194 | + | func aO (aL,aN) = fraction(aL, aN, aF, HALFEVEN) | |
173 | 195 | ||
174 | 196 | ||
175 | - | let aD = "k_token_param" | |
176 | - | ||
177 | - | let aE = "k_token_type" | |
178 | - | ||
179 | - | let aF = "fee_reduction" | |
180 | - | ||
181 | - | let aG = 1 | |
182 | - | ||
183 | - | let aH = 2 | |
184 | - | ||
185 | - | let aI = 15 | |
186 | - | ||
187 | - | let aJ = 15 | |
188 | - | ||
189 | - | let aK = 1000 | |
190 | - | ||
191 | - | let aL = 6 | |
192 | - | ||
193 | - | let aM = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
194 | - | ||
195 | - | let aN = (86400 * aM) | |
196 | - | ||
197 | - | let aO = 100 | |
198 | - | ||
199 | - | let aP = 1 | |
200 | - | ||
201 | - | let aQ = 2 | |
202 | - | ||
203 | - | func aR (aS) = (toString(aS) + ",") | |
197 | + | func aP (aL) = sqrt(aL, aE, aE, HALFEVEN) | |
204 | 198 | ||
205 | 199 | ||
206 | - | func | |
200 | + | func aQ (aL,aN) = pow(aL, aE, aN, aE, aE, HALFEVEN) | |
207 | 201 | ||
208 | 202 | ||
209 | - | func | |
203 | + | func aR (aL,aN) = fraction(aL, toBigInt(aF), aN, HALFEVEN) | |
210 | 204 | ||
211 | 205 | ||
212 | - | func | |
206 | + | func aS (aL,aN) = fraction(aL, aN, toBigInt(aF), HALFEVEN) | |
213 | 207 | ||
214 | 208 | ||
215 | - | func | |
209 | + | func aT (aL) = sqrtBigInt(aL, aE, aE, HALFEVEN) | |
216 | 210 | ||
217 | 211 | ||
218 | - | func | |
212 | + | func aU (aL,aN) = pow(aL, aE, aN, aE, aE, HALFEVEN) | |
219 | 213 | ||
220 | 214 | ||
221 | - | func aZ (aS,aU) = fraction(aS, aU, toBigInt(aM), HALFEVEN) | |
215 | + | func aV (aL) = if ((aL > 0)) | |
216 | + | then aL | |
217 | + | else -(aL) | |
222 | 218 | ||
223 | 219 | ||
224 | - | func ba (aS) = sqrtBigInt(aS, aL, aL, HALFEVEN) | |
220 | + | func aW (aL,aN) = if ((aL >= aN)) | |
221 | + | then aL | |
222 | + | else aN | |
225 | 223 | ||
226 | 224 | ||
227 | - | func bb (aS,aU) = pow(aS, aL, aU, aL, aL, HALFEVEN) | |
225 | + | func aX (aY) = if ((size(aY) == 0)) | |
226 | + | then "" | |
227 | + | else makeString(aY, ",") | |
228 | 228 | ||
229 | 229 | ||
230 | - | func | |
231 | - | then | |
232 | - | else | |
230 | + | func aZ (ba) = if ((ba == "")) | |
231 | + | then nil | |
232 | + | else split(ba, ",") | |
233 | 233 | ||
234 | 234 | ||
235 | - | func | |
236 | - | then | |
237 | - | else | |
235 | + | func bb (aY,bc,bd) = if ((size(aY) > bc)) | |
236 | + | then (removeByIndex(aY, 0) :+ bd) | |
237 | + | else (aY :+ bd) | |
238 | 238 | ||
239 | 239 | ||
240 | - | func be (bf) = { | |
241 | - | func bg (bh,bi) = ((bh + bi) + ",") | |
240 | + | func be (bf) = valueOrErrorMessage(getInteger(this, bf), ("no value for " + bf)) | |
242 | 241 | ||
243 | - | let bj = { | |
244 | - | let bk = bf | |
245 | - | let bl = size(bk) | |
246 | - | let bm = "" | |
247 | - | func bn (bo,bp) = if ((bp >= bl)) | |
248 | - | then bo | |
249 | - | else bg(bo, bk[bp]) | |
250 | 242 | ||
251 | - | func bq (bo,bp) = if ((bp >= bl)) | |
252 | - | then bo | |
253 | - | else throw("List size exceeds 20") | |
243 | + | func bg (bf,bh) = valueOrElse(getInteger(this, bf), bh) | |
254 | 244 | ||
255 | - | bq(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bm, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
256 | - | } | |
257 | - | let br = dropRight(bj, 1) | |
258 | - | let bs = if ((take(br, 1) == ",")) | |
259 | - | then drop(br, 1) | |
260 | - | else br | |
261 | - | bs | |
245 | + | ||
246 | + | func bi (al,ak) = { | |
247 | + | let bj = valueOrErrorMessage(getString(al, ak), ("No value for key " + ak)) | |
248 | + | bj | |
262 | 249 | } | |
263 | 250 | ||
264 | 251 | ||
265 | - | func bt (bu) = split(bu, ",") | |
266 | - | ||
267 | - | ||
268 | - | func bv (bf,bw,bx) = if ((size(bf) > bw)) | |
269 | - | then (removeByIndex(bf, 0) :+ bx) | |
270 | - | else (bf :+ bx) | |
271 | - | ||
272 | - | ||
273 | - | func by (bz) = valueOrErrorMessage(getInteger(this, bz), ("no value for " + bz)) | |
274 | - | ||
275 | - | ||
276 | - | func bA (bz,bB) = valueOrElse(getInteger(this, bz), bB) | |
277 | - | ||
278 | - | ||
279 | - | func bC (am,al) = { | |
280 | - | let bi = valueOrErrorMessage(getString(am, al), ("No value for key " + al)) | |
281 | - | bi | |
252 | + | func bk (al,ak) = { | |
253 | + | let bj = valueOrErrorMessage(getInteger(al, ak), ("No value for key " + ak)) | |
254 | + | bj | |
282 | 255 | } | |
283 | 256 | ||
284 | 257 | ||
285 | - | func bD (am,al) = { | |
286 | - | let bi = valueOrErrorMessage(getInteger(am, al), ("No value for key " + al)) | |
287 | - | bi | |
288 | - | } | |
258 | + | func bl () = be(c) | |
289 | 259 | ||
290 | 260 | ||
291 | - | func | |
261 | + | func bm () = be(p) | |
292 | 262 | ||
293 | 263 | ||
294 | - | func | |
264 | + | func bn () = be(q) | |
295 | 265 | ||
296 | 266 | ||
297 | - | func | |
267 | + | func bo () = be(s) | |
298 | 268 | ||
299 | 269 | ||
300 | - | func | |
270 | + | func bp () = be(M) | |
301 | 271 | ||
302 | 272 | ||
303 | - | func | |
273 | + | func bq () = be(N) | |
304 | 274 | ||
305 | 275 | ||
306 | - | func | |
276 | + | func br () = bg(O, aF) | |
307 | 277 | ||
308 | 278 | ||
309 | - | func | |
279 | + | func bs () = bg(P, aF) | |
310 | 280 | ||
311 | 281 | ||
312 | - | func | |
282 | + | func bt () = be(Q) | |
313 | 283 | ||
314 | 284 | ||
315 | - | func | |
285 | + | func bu () = be(T) | |
316 | 286 | ||
317 | 287 | ||
318 | - | func | |
288 | + | func bv () = be(U) | |
319 | 289 | ||
320 | 290 | ||
321 | - | func | |
291 | + | func bw () = be(V) | |
322 | 292 | ||
323 | 293 | ||
324 | - | func | |
294 | + | func bx () = be(J) | |
325 | 295 | ||
326 | 296 | ||
327 | - | func | |
297 | + | func by () = be(r) | |
328 | 298 | ||
329 | 299 | ||
330 | - | func | |
300 | + | func bz () = (by() * aF) | |
331 | 301 | ||
332 | 302 | ||
333 | - | func | |
303 | + | func bA () = (by() * aD) | |
334 | 304 | ||
335 | 305 | ||
336 | - | func | |
306 | + | func bB () = be(t) | |
337 | 307 | ||
338 | 308 | ||
339 | - | func | |
309 | + | func bC () = be(u) | |
340 | 310 | ||
341 | 311 | ||
342 | - | func | |
312 | + | func bD () = be(v) | |
343 | 313 | ||
344 | 314 | ||
345 | - | func | |
315 | + | func bE () = be(w) | |
346 | 316 | ||
347 | 317 | ||
348 | - | func | |
318 | + | func bF () = be(x) | |
349 | 319 | ||
350 | 320 | ||
351 | - | func | |
321 | + | func bG () = be(y) | |
352 | 322 | ||
353 | 323 | ||
354 | - | func | |
324 | + | func bH () = be(z) | |
355 | 325 | ||
356 | 326 | ||
357 | - | func | |
327 | + | func bI () = be(H) | |
358 | 328 | ||
359 | 329 | ||
360 | - | func | |
330 | + | func bJ () = be(I) | |
361 | 331 | ||
362 | 332 | ||
363 | - | func | |
333 | + | func bK () = be(S) | |
364 | 334 | ||
365 | 335 | ||
366 | - | func | |
336 | + | func bL () = be(R) | |
367 | 337 | ||
368 | 338 | ||
369 | - | func | |
339 | + | func bM () = bg(d, 0) | |
370 | 340 | ||
371 | 341 | ||
372 | - | func | |
342 | + | func bN () = be(A) | |
373 | 343 | ||
374 | 344 | ||
375 | - | func | |
345 | + | func bO () = be(B) | |
376 | 346 | ||
377 | 347 | ||
378 | - | func | |
348 | + | func bP () = lastBlock.timestamp | |
379 | 349 | ||
380 | 350 | ||
381 | - | func cj (ck,cl,cm) = { | |
382 | - | let cn = (ck - cl) | |
383 | - | if (if (cm) | |
384 | - | then (0 > cn) | |
351 | + | func bQ (bR) = valueOrElse(getString(au(), "k_sender"), toString(bR.caller)) | |
352 | + | ||
353 | + | ||
354 | + | func bS (bT,bU,bV) = { | |
355 | + | let bW = (bT - bU) | |
356 | + | if (if (bV) | |
357 | + | then (0 > bW) | |
385 | 358 | else false) | |
386 | - | then throw(((("Invalid margin: " + toString( | |
387 | - | else if (if (!( | |
388 | - | then ( | |
359 | + | then throw(((("Invalid margin: " + toString(bT)) + " < ") + toString(bU))) | |
360 | + | else if (if (!(bV)) | |
361 | + | then (bW >= 0) | |
389 | 362 | else false) | |
390 | - | then throw(((("Invalid margin: " + toString( | |
363 | + | then throw(((("Invalid margin: " + toString(bT)) + " > ") + toString(bU))) | |
391 | 364 | else true | |
392 | 365 | } | |
393 | 366 | ||
394 | 367 | ||
395 | - | func | |
368 | + | func bX (bY) = if ((bY == 0)) | |
396 | 369 | then throw("Should not be called with _positionSize == 0") | |
397 | - | else if (( | |
398 | - | then | |
399 | - | else | |
370 | + | else if ((bY > 0)) | |
371 | + | then bI() | |
372 | + | else bJ() | |
400 | 373 | ||
401 | 374 | ||
402 | - | func | |
403 | - | let | |
404 | - | let | |
405 | - | if ($isInstanceOf( | |
375 | + | func bZ (ca) = { | |
376 | + | let cb = getInteger(this, aj(e, ca)) | |
377 | + | let cc = cb | |
378 | + | if ($isInstanceOf(cc, "Int")) | |
406 | 379 | then { | |
407 | - | let | |
408 | - | $ | |
380 | + | let cd = cc | |
381 | + | $Tuple5(cd, getIntegerValue(this, aj(f, ca)), getIntegerValue(this, aj(g, ca)), getIntegerValue(this, aj(h, ca)), getIntegerValue(this, aj(l, ca))) | |
409 | 382 | } | |
410 | - | else $ | |
383 | + | else $Tuple5(0, 0, 0, 0, 0) | |
411 | 384 | } | |
412 | 385 | ||
413 | 386 | ||
414 | - | func | |
415 | - | let | |
416 | - | let | |
417 | - | if ($isInstanceOf( | |
387 | + | func ce (ca) = { | |
388 | + | let cf = getString(this, aj(j, ca)) | |
389 | + | let cc = cf | |
390 | + | if ($isInstanceOf(cc, "String")) | |
418 | 391 | then { | |
419 | - | let | |
420 | - | | |
392 | + | let cg = cc | |
393 | + | cg | |
421 | 394 | } | |
422 | - | else toBase58String( | |
395 | + | else toBase58String(ap()) | |
423 | 396 | } | |
424 | 397 | ||
425 | 398 | ||
426 | - | func | |
427 | - | let | |
428 | - | let | |
429 | - | if ($isInstanceOf( | |
399 | + | func ch (ca) = { | |
400 | + | let ci = getInteger(this, aj(k, ca)) | |
401 | + | let cc = ci | |
402 | + | if ($isInstanceOf(cc, "Int")) | |
430 | 403 | then { | |
431 | - | let | |
432 | - | | |
404 | + | let cj = cc | |
405 | + | cj | |
433 | 406 | } | |
434 | - | else | |
407 | + | else bm() | |
435 | 408 | } | |
436 | 409 | ||
437 | 410 | ||
438 | - | func | |
411 | + | func ck (ca) = if ((bZ(ca)._1 == 0)) | |
439 | 412 | then throw("No open position") | |
440 | 413 | else true | |
441 | 414 | ||
442 | 415 | ||
443 | - | func cC () = valueOrElse(getBoolean(this, n), false) | |
416 | + | func cl (cm) = { | |
417 | + | let cn = getString(this, cm) | |
418 | + | if (if (isDefined(cn)) | |
419 | + | then (value(cn) != "") | |
420 | + | else false) | |
421 | + | then { | |
422 | + | let co = split(value(cn), ",") | |
423 | + | let cp = valueOrErrorMessage(addressFromString(co[0]), ("Invalid oracle address in: " + value(cn))) | |
424 | + | let cq = co[1] | |
425 | + | let cr = co[2] | |
426 | + | let cs = co[3] | |
427 | + | $Tuple4(cp, cq, cr, cs) | |
428 | + | } | |
429 | + | else unit | |
430 | + | } | |
444 | 431 | ||
445 | 432 | ||
446 | - | func | |
433 | + | func ct () = valueOrElse(getBoolean(this, m), false) | |
447 | 434 | ||
448 | 435 | ||
449 | - | func | |
436 | + | func cu () = valueOrElse(getBoolean(this, n), false) | |
450 | 437 | ||
451 | 438 | ||
452 | - | func cF (cG,cH,cI) = if (cG) | |
439 | + | func cv () = valueOrElse(getBoolean(this, o), false) | |
440 | + | ||
441 | + | ||
442 | + | func cw (cx,cy,cz) = if (cx) | |
453 | 443 | then { | |
454 | - | let | |
455 | - | if ((0 >= | |
444 | + | let cA = (bq() - cz) | |
445 | + | if ((0 >= cA)) | |
456 | 446 | then throw("Tx lead to base asset reserve <= 0, revert") | |
457 | - | else $Tuple3(( | |
447 | + | else $Tuple3((bp() + cy), cA, (bt() + cz)) | |
458 | 448 | } | |
459 | 449 | else { | |
460 | - | let | |
461 | - | if ((0 >= | |
450 | + | let cB = (bp() - cy) | |
451 | + | if ((0 >= cB)) | |
462 | 452 | then throw("Tx lead to base quote reserve <= 0, revert") | |
463 | - | else $Tuple3( | |
453 | + | else $Tuple3(cB, (bq() + cz), (bt() - cz)) | |
464 | 454 | } | |
465 | 455 | ||
466 | 456 | ||
467 | - | func | |
468 | - | let | |
469 | - | let | |
470 | - | | |
457 | + | func cC (cD,cE) = { | |
458 | + | let cF = toBigInt(cD) | |
459 | + | let cG = toBigInt(cE) | |
460 | + | aS(cF, cG) | |
471 | 461 | } | |
472 | 462 | ||
473 | 463 | ||
474 | - | func | |
475 | - | let | |
476 | - | let | |
477 | - | let | |
478 | - | let | |
479 | - | let | |
480 | - | let | |
481 | - | let | |
482 | - | then ( | |
483 | - | else ( | |
484 | - | let | |
485 | - | let | |
486 | - | let | |
487 | - | then | |
488 | - | else -( | |
489 | - | let | |
490 | - | let | |
491 | - | let | |
492 | - | let | |
493 | - | let | |
494 | - | let | |
495 | - | let | |
496 | - | let | |
497 | - | let | |
498 | - | if (( | |
499 | - | then throw(((((((((((((("Price impact " + toString( | |
500 | - | else $Tuple4( | |
464 | + | func cH (cx,cy) = { | |
465 | + | let cD = bp() | |
466 | + | let cE = bq() | |
467 | + | let cI = br() | |
468 | + | let cJ = bs() | |
469 | + | let cK = aM(cy, cI) | |
470 | + | let bf = cC(cD, cE) | |
471 | + | let cL = if (cx) | |
472 | + | then (cD + cK) | |
473 | + | else (cD - cK) | |
474 | + | let cM = toInt(aR(bf, toBigInt(cL))) | |
475 | + | let cN = aV((cM - cE)) | |
476 | + | let cO = if (cx) | |
477 | + | then cN | |
478 | + | else -(cN) | |
479 | + | let cP = cw(cx, cK, cN) | |
480 | + | let cQ = cP._1 | |
481 | + | let cR = cP._2 | |
482 | + | let cS = cP._3 | |
483 | + | let cT = aM(aO(cD, cI), aO(cE, cJ)) | |
484 | + | let cU = aM(cy, cN) | |
485 | + | let cV = aV((cT - cU)) | |
486 | + | let cW = (aF - aM(cT, (cT + cV))) | |
487 | + | let cX = bF() | |
488 | + | if ((cW > cX)) | |
489 | + | then throw(((((((((((((("Price impact " + toString(cW)) + " > max price impact ") + toString(cX)) + " before quote asset: ") + toString(cD)) + " before base asset: ") + toString(cE)) + " quote asset amount to exchange: ") + toString(cy)) + " price before: ") + toString(cT)) + " marketPrice: ") + toString(cU))) | |
490 | + | else $Tuple4(cO, cQ, cR, cS) | |
501 | 491 | } | |
502 | 492 | ||
503 | 493 | ||
504 | - | func dh (di,dj,dk,dl) = { | |
505 | - | let dm = if ((di != 0)) | |
506 | - | then { | |
507 | - | let dn = co(di) | |
508 | - | aV((dn - dk), di) | |
509 | - | } | |
510 | - | else 0 | |
511 | - | let do = ((dl - dm) + dj) | |
512 | - | let dp = if ((0 > do)) | |
513 | - | then $Tuple2(0, bc(do)) | |
514 | - | else $Tuple2(bc(do), 0) | |
515 | - | let dq = dp._1 | |
516 | - | let dr = dp._2 | |
517 | - | $Tuple3(dq, dr, dm) | |
494 | + | func cY (cZ,da) = { | |
495 | + | let db = ((((bP() - da) / 1000) / 60) * aF) | |
496 | + | let dc = aM(aO(aO(cZ, db), bn()), aG) | |
497 | + | dc | |
518 | 498 | } | |
519 | 499 | ||
520 | 500 | ||
521 | - | func ds (cG,cI,dt,du,dv,dw,dx) = { | |
522 | - | let dc = aT(aV(du, dv), aV(dw, dx)) | |
523 | - | if ((cI == 0)) | |
501 | + | func dd (de,cZ,df,da,dg) = { | |
502 | + | let dh = if ((de != 0)) | |
503 | + | then { | |
504 | + | let di = bX(de) | |
505 | + | aO((di - df), de) | |
506 | + | } | |
507 | + | else 0 | |
508 | + | let dc = cY(cZ, da) | |
509 | + | let dj = (((dg - dc) - dh) + cZ) | |
510 | + | let dk = if ((0 > dj)) | |
511 | + | then $Tuple2(0, aV(dj)) | |
512 | + | else $Tuple2(aV(dj), 0) | |
513 | + | let dl = dk._1 | |
514 | + | let dm = dk._2 | |
515 | + | $Tuple4(dl, dm, dh, dc) | |
516 | + | } | |
517 | + | ||
518 | + | ||
519 | + | func dn (cx,cz,do,dp,dq,dr,ds) = { | |
520 | + | let cT = aM(aO(dp, dq), aO(dr, ds)) | |
521 | + | if ((cz == 0)) | |
524 | 522 | then throw("Invalid base asset amount") | |
525 | 523 | else { | |
526 | - | let | |
527 | - | let | |
528 | - | then ( | |
529 | - | else ( | |
530 | - | let | |
531 | - | let | |
532 | - | let | |
533 | - | let | |
534 | - | let | |
535 | - | let | |
536 | - | let | |
537 | - | let | |
538 | - | let | |
539 | - | let | |
540 | - | let | |
541 | - | if (if (( | |
542 | - | then | |
524 | + | let bf = cC(dp, dr) | |
525 | + | let dt = if (cx) | |
526 | + | then (dr + cz) | |
527 | + | else (dr - cz) | |
528 | + | let du = toInt(aR(bf, toBigInt(dt))) | |
529 | + | let dv = aV((du - dp)) | |
530 | + | let dw = aO(dv, dq) | |
531 | + | let cX = bF() | |
532 | + | let dx = cw(!(cx), dv, cz) | |
533 | + | let cQ = dx._1 | |
534 | + | let cR = dx._2 | |
535 | + | let cS = dx._3 | |
536 | + | let cU = aM(dw, cz) | |
537 | + | let cV = aV((cT - cU)) | |
538 | + | let cW = (aF - aM(cT, (cT + cV))) | |
539 | + | if (if ((cW > cX)) | |
540 | + | then do | |
543 | 541 | else false) | |
544 | - | then throw(((((((((((((("Price impact " + toString( | |
545 | - | else $Tuple7( | |
546 | - | then | |
547 | - | else 0)), ( | |
548 | - | then | |
549 | - | else 0)), | |
542 | + | then throw(((((((((((((("Price impact " + toString(cW)) + " > max price impact ") + toString(cX)) + " before quote asset: ") + toString(dp)) + " before base asset: ") + toString(dr)) + " base asset amount to exchange: ") + toString(cz)) + " price before: ") + toString(cT)) + " market price: ") + toString(cU))) | |
543 | + | else $Tuple7(dw, cQ, cR, cS, (bL() - (if (cx) | |
544 | + | then aV(cz) | |
545 | + | else 0)), (bK() - (if (!(cx)) | |
546 | + | then aV(cz) | |
547 | + | else 0)), cW) | |
550 | 548 | } | |
551 | 549 | } | |
552 | 550 | ||
553 | 551 | ||
554 | - | func dD (cG,cI,dt) = ds(cG, cI, dt, bH(), bJ(), bI(), bK()) | |
552 | + | func dy (cx,cz,do) = dn(cx, cz, do, bp(), br(), bq(), bs()) | |
553 | + | ||
554 | + | ||
555 | + | func dz (dA,cq,cr) = { | |
556 | + | let dB = valueOrErrorMessage(getInteger(dA, cq), ((("Can not get oracle price. Oracle: " + toString(dA)) + " key: ") + cq)) | |
557 | + | if ((cr != "")) | |
558 | + | then { | |
559 | + | let dC = lastBlock.height | |
560 | + | let dD = valueOrErrorMessage(getInteger(dA, cr), ((("Can not get oracle block. Oracle: " + toString(dA)) + " key: ") + cr)) | |
561 | + | if (((dC - dD) > bO())) | |
562 | + | then throw(((("Oracle stale data. Last oracle block: " + toString(dD)) + " current block: ") + toString(dC))) | |
563 | + | else dB | |
564 | + | } | |
565 | + | else dB | |
566 | + | } | |
555 | 567 | ||
556 | 568 | ||
557 | 569 | func dE () = { | |
558 | - | let dF = valueOrErrorMessage(addressFromString(getStringValue(this, d)), "") | |
559 | - | let dG = getStringValue(this, a) | |
560 | - | let dH = valueOrErrorMessage(getInteger(dF, dG), ((("Can not get oracle price. Oracle: " + toString(dF)) + " key: ") + dG)) | |
561 | - | let dI = valueOrElse(getString(this, b), "") | |
562 | - | if ((dI != "")) | |
570 | + | let dF = valueOrErrorMessage(cl(a), "No base asset oracle data") | |
571 | + | let dG = dz(dF._1, dF._2, dF._3) | |
572 | + | let dH = cl(b) | |
573 | + | let dI = if (isDefined(dH)) | |
563 | 574 | then { | |
564 | - | let dJ = lastBlock.height | |
565 | - | let dK = valueOrErrorMessage(getInteger(dF, dI), ((("Can not get oracle block. Oracle: " + toString(dF)) + " key: ") + dI)) | |
566 | - | if (((dJ - dK) > cg())) | |
567 | - | then throw(((("Oracle stale data. Last oracle block: " + toString(dK)) + " current block: ") + toString(dJ))) | |
568 | - | else dH | |
575 | + | let dJ = value(dH) | |
576 | + | dz(dJ._1, dJ._2, dJ._3) | |
569 | 577 | } | |
570 | - | else dH | |
578 | + | else aF | |
579 | + | aM(dG, dI) | |
571 | 580 | } | |
572 | 581 | ||
573 | 582 | ||
574 | - | func dL () = { | |
575 | - | let dF = valueOrErrorMessage(addressFromString(getStringValue(this, d)), "") | |
576 | - | let dM = valueOrElse(getString(this, c), "") | |
577 | - | if ((dM != "")) | |
583 | + | func dK () = { | |
584 | + | let dF = valueOrErrorMessage(cl(a), "No base asset oracle data") | |
585 | + | let dA = dF._1 | |
586 | + | let cs = dF._4 | |
587 | + | if ((cs != "")) | |
578 | 588 | then { | |
579 | - | let | |
580 | - | !( | |
589 | + | let dL = valueOrErrorMessage(getBoolean(dA, cs), ((("Can not get oracle is open/closed. Oracle: " + toString(dA)) + " key: ") + cs)) | |
590 | + | !(dL) | |
581 | 591 | } | |
582 | 592 | else false | |
583 | 593 | } | |
584 | 594 | ||
585 | 595 | ||
586 | - | func | |
587 | - | let | |
588 | - | let | |
589 | - | let | |
590 | - | | |
596 | + | func dM (dN,dp,dr,cI,cJ) = { | |
597 | + | let dO = aM(aO(dp, cI), aO(dr, cJ)) | |
598 | + | let dP = aM((dN + dO), (2 * aF)) | |
599 | + | let dM = aM(aV((dN - dO)), dP) | |
600 | + | dM | |
591 | 601 | } | |
592 | 602 | ||
593 | 603 | ||
594 | - | func | |
595 | - | let | |
596 | - | let | |
597 | - | let | |
598 | - | let | |
599 | - | let | |
600 | - | if (if (( | |
601 | - | then ( | |
604 | + | func dQ (dp,dr) = { | |
605 | + | let dR = dE() | |
606 | + | let cI = br() | |
607 | + | let cJ = bs() | |
608 | + | let dS = dM(dR, bp(), bq(), cI, cJ) | |
609 | + | let dT = dM(dR, dp, dr, cI, cJ) | |
610 | + | if (if ((dT > bG())) | |
611 | + | then (dT > dS) | |
602 | 612 | else false) | |
603 | - | then throw(((("Price spread " + toString( | |
613 | + | then throw(((("Price spread " + toString(dT)) + " > max price spread ") + toString(bG()))) | |
604 | 614 | else true | |
605 | 615 | } | |
606 | 616 | ||
607 | 617 | ||
608 | - | func | |
609 | - | let | |
610 | - | if (( | |
611 | - | then throw(((("Long open notional " + toString( | |
612 | - | else if (( | |
613 | - | then throw(((("Short open notional " + toString( | |
618 | + | func dU (dV,dW) = { | |
619 | + | let dX = bH() | |
620 | + | if ((dV > dX)) | |
621 | + | then throw(((("Long open notional " + toString(dV)) + " > max open notional ") + toString(dX))) | |
622 | + | else if ((dW > dX)) | |
623 | + | then throw(((("Short open notional " + toString(dW)) + " > max open notional ") + toString(dX))) | |
614 | 624 | else true | |
615 | 625 | } | |
616 | 626 | ||
617 | 627 | ||
618 | - | func | |
619 | - | let | |
620 | - | let | |
621 | - | let | |
622 | - | let | |
623 | - | | |
628 | + | func dY () = { | |
629 | + | let dp = bp() | |
630 | + | let dr = bq() | |
631 | + | let cI = br() | |
632 | + | let cJ = bs() | |
633 | + | aM(aO(dp, cI), aO(dr, cJ)) | |
624 | 634 | } | |
625 | 635 | ||
626 | 636 | ||
627 | - | func | |
628 | - | let | |
629 | - | let | |
630 | - | ( | |
637 | + | func dZ () = { | |
638 | + | let dR = dE() | |
639 | + | let ea = dY() | |
640 | + | (aM(aV((dR - ea)), dR) > bE()) | |
631 | 641 | } | |
632 | 642 | ||
633 | 643 | ||
634 | - | func | |
635 | - | let | |
636 | - | let | |
637 | - | let | |
644 | + | func eb (bY,ec,dp,dq,dr,ds) = { | |
645 | + | let ed = aV(bY) | |
646 | + | let ee = (0 > bY) | |
647 | + | let ef = if ((ec == aI)) | |
638 | 648 | then { | |
639 | - | let ei = ds(!(eg), ef, false, du, dv, dw, dx) | |
640 | - | let ej = ei._1 | |
641 | - | let ek = ei._2 | |
642 | - | let el = ei._3 | |
643 | - | let em = ei._4 | |
644 | - | ej | |
649 | + | let eg = dn(!(ee), ed, false, dp, dq, dr, ds)._1 | |
650 | + | eg | |
645 | 651 | } | |
646 | - | else | |
647 | - | | |
652 | + | else aO(ed, dE()) | |
653 | + | ef | |
648 | 654 | } | |
649 | 655 | ||
650 | 656 | ||
651 | - | func | |
657 | + | func eh (bY,ei,dp,dq,dr,ds,ec) = if ((bY == 0)) | |
652 | 658 | then throw("Invalid position size") | |
653 | 659 | else { | |
654 | - | let | |
655 | - | let | |
656 | - | let | |
657 | - | then ( | |
658 | - | else ( | |
659 | - | $Tuple2( | |
660 | + | let ee = (0 > bY) | |
661 | + | let ef = eb(bY, ec, dp, dq, dr, ds) | |
662 | + | let ej = if (ee) | |
663 | + | then (ei - ef) | |
664 | + | else (ef - ei) | |
665 | + | $Tuple2(ef, ej) | |
660 | 666 | } | |
661 | 667 | ||
662 | 668 | ||
663 | - | func | |
664 | - | let | |
665 | - | let | |
666 | - | let | |
667 | - | let | |
668 | - | let | |
669 | - | | |
669 | + | func ek (ca,ec) = { | |
670 | + | let el = bZ(ca) | |
671 | + | let cd = el._1 | |
672 | + | let em = el._2 | |
673 | + | let en = el._3 | |
674 | + | let eo = el._4 | |
675 | + | eh(cd, en, bp(), br(), bq(), bs(), ec) | |
670 | 676 | } | |
671 | 677 | ||
672 | 678 | ||
673 | - | func | |
679 | + | func ep (eq,er,es) = aM((eq - er), es) | |
674 | 680 | ||
675 | 681 | ||
676 | - | func ez (cr,ee) = { | |
677 | - | let eA = cq(cr) | |
678 | - | let cu = eA._1 | |
679 | - | let es = eA._2 | |
680 | - | let eB = eA._3 | |
681 | - | let eu = eA._4 | |
682 | - | let eC = eq(cr, ee) | |
683 | - | let eh = eC._1 | |
684 | - | let ep = eC._2 | |
685 | - | let eD = dh(cu, es, eu, ep) | |
686 | - | let dq = eD._1 | |
687 | - | let dr = eD._2 | |
688 | - | ev(dq, dr, eh) | |
682 | + | func et (ca,ec) = { | |
683 | + | let eu = bZ(ca) | |
684 | + | let cd = eu._1 | |
685 | + | let em = eu._2 | |
686 | + | let ev = eu._3 | |
687 | + | let ew = eu._4 | |
688 | + | let ex = eu._5 | |
689 | + | let ey = ek(ca, ec) | |
690 | + | let ef = ey._1 | |
691 | + | let ej = ey._2 | |
692 | + | let ez = dd(cd, em, ew, ex, ej) | |
693 | + | let dl = ez._1 | |
694 | + | let dm = ez._2 | |
695 | + | ep(dl, dm, ef) | |
689 | 696 | } | |
690 | 697 | ||
691 | 698 | ||
692 | - | func | |
699 | + | func eA (ca) = et(ca, aI) | |
693 | 700 | ||
694 | 701 | ||
695 | - | func eF (cr,cp) = { | |
696 | - | let eG = bd(bV(), (aM - aT(eE(cr), bT()))) | |
697 | - | let eH = aV(bc(cp), eG) | |
698 | - | let eI = dD((cp > 0), eH, false) | |
699 | - | let eJ = eI._1 | |
700 | - | let df = eI._7 | |
701 | - | if ((bX() > df)) | |
702 | - | then eJ | |
702 | + | func eB (ca,bY) = { | |
703 | + | let eC = aW(bD(), (aF - aM(eA(ca), bB()))) | |
704 | + | let eD = aO(aV(bY), eC) | |
705 | + | let eE = dy((bY > 0), eD, false) | |
706 | + | let eF = eE._1 | |
707 | + | let cW = eE._7 | |
708 | + | if ((bF() > cW)) | |
709 | + | then eD | |
710 | + | else aO(aV(bY), bD()) | |
711 | + | } | |
712 | + | ||
713 | + | ||
714 | + | func eG (ca,eH,eI,eJ,eK,do) = { | |
715 | + | let eL = bZ(ca) | |
716 | + | let eM = eL._1 | |
717 | + | let eN = eL._2 | |
718 | + | let eO = eL._3 | |
719 | + | let eP = eL._4 | |
720 | + | let eQ = eL._5 | |
721 | + | let eR = (eM > 0) | |
722 | + | let eS = aV(eM) | |
723 | + | if (if ((eS >= eH)) | |
724 | + | then (eH > 0) | |
725 | + | else false) | |
726 | + | then { | |
727 | + | let eT = (eS > eH) | |
728 | + | let eU = dy((eM > 0), eH, do) | |
729 | + | let eV = eU._1 | |
730 | + | let cL = eU._2 | |
731 | + | let cM = eU._3 | |
732 | + | let eW = eU._4 | |
733 | + | let eX = if ((eM > 0)) | |
734 | + | then -(eH) | |
735 | + | else eH | |
736 | + | let eY = ek(ca, aI) | |
737 | + | let eZ = eY._1 | |
738 | + | let ej = eY._2 | |
739 | + | let fa = aM(aV(eX), eS) | |
740 | + | let fb = aO(ej, fa) | |
741 | + | let fc = dd(eM, eN, eP, eQ, ej) | |
742 | + | let fd = fc._1 | |
743 | + | let fe = fc._2 | |
744 | + | let ff = fc._3 | |
745 | + | let dc = fc._4 | |
746 | + | let fg = dd(eM, eN, eP, eQ, fb)._2 | |
747 | + | let fh = aO(aO(eZ, fa), eI) | |
748 | + | let fi = (ej - fb) | |
749 | + | let fj = if ((eM > 0)) | |
750 | + | then ((eZ - eV) - fi) | |
751 | + | else ((fi + eZ) - eV) | |
752 | + | let fk = (eM + eX) | |
753 | + | let fl = if ((fk == 0)) | |
754 | + | then $Tuple2(0, 0) | |
755 | + | else $Tuple2(aV(fj), bX(fk)) | |
756 | + | let fm = fl._1 | |
757 | + | let fn = fl._2 | |
758 | + | let fo = (eO - fm) | |
759 | + | let fp = et(ca, aI) | |
760 | + | let fq = if ((eM > 0)) | |
761 | + | then (aO((fm + fi), fp) - fi) | |
762 | + | else (aO((fm - fi), fp) - fi) | |
763 | + | let fr = ((fd - (fq + fi)) - fh) | |
764 | + | let fs = if ((0 > fr)) | |
765 | + | then throw("Invalid internalClosePosition params: unable to pay fee") | |
766 | + | else fr | |
767 | + | let ft = if (eK) | |
768 | + | then (fq + fs) | |
769 | + | else fq | |
770 | + | if (if ((eJ != 0)) | |
771 | + | then (eJ > eV) | |
772 | + | else false) | |
773 | + | then throw(((("Limit error: " + toString(eV)) + " < ") + toString(eJ))) | |
774 | + | else $Tuple17(fk, ft, fm, fn, fg, fb, if (if (eK) | |
775 | + | then eT | |
776 | + | else false) | |
777 | + | then 0 | |
778 | + | else fs, cL, cM, eW, (bu() - fo), (bL() - (if (eR) | |
779 | + | then aV(eX) | |
780 | + | else 0)), (bK() - (if (!(eR)) | |
781 | + | then aV(eX) | |
782 | + | else 0)), (bw() - (if (eR) | |
783 | + | then fo | |
784 | + | else 0)), (bv() - (if (!(eR)) | |
785 | + | then fo | |
786 | + | else 0)), (fh + dc), eV) | |
787 | + | } | |
788 | + | else throw("Invalid internalClosePosition params: invalid position size") | |
789 | + | } | |
790 | + | ||
791 | + | ||
792 | + | func fu () = { | |
793 | + | let fv = ((bP() / 1000) / 60) | |
794 | + | let fw = (fv - aC) | |
795 | + | let fx = valueOrElse(getString(this, C), "") | |
796 | + | let fy = split(fx, ",") | |
797 | + | func fz (fA,fB) = if ((fw >= valueOrErrorMessage(parseInt(fB), ("getTwapSpotPrice: invalid int: " + fx)))) | |
798 | + | then (fA :+ parseIntValue(fB)) | |
799 | + | else fA | |
800 | + | ||
801 | + | let fC = { | |
802 | + | let fD = fy | |
803 | + | let fE = size(fD) | |
804 | + | let fF = nil | |
805 | + | func fG (fH,fI) = if ((fI >= fE)) | |
806 | + | then fH | |
807 | + | else fz(fH, fD[fI]) | |
808 | + | ||
809 | + | func fJ (fH,fI) = if ((fI >= fE)) | |
810 | + | then fH | |
811 | + | else throw("List size exceeds 20") | |
812 | + | ||
813 | + | fJ(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fF, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
814 | + | } | |
815 | + | let fK = if ((size(fC) > 0)) | |
816 | + | then max(fC) | |
817 | + | else valueOrErrorMessage(parseInt(fy[0]), ("getTwapSpotPrice: invalid int: " + fx)) | |
818 | + | let fL = valueOrElse(getInteger(this, D), 0) | |
819 | + | let fM = valueOrElse(getInteger(this, ((E + "_") + toString(fL))), 0) | |
820 | + | let fN = valueOrElse(getInteger(this, ((F + "_") + toString(fL))), 0) | |
821 | + | let fO = (fM + ((fv - fL) * fN)) | |
822 | + | let fP = valueOrElse(getInteger(this, ((E + "_") + toString(fK))), 0) | |
823 | + | let fQ = valueOrElse(getInteger(this, ((F + "_") + toString(fK))), 0) | |
824 | + | let fR = (fP + ((fw - fK) * fQ)) | |
825 | + | ((fO - fR) / aC) | |
826 | + | } | |
827 | + | ||
828 | + | ||
829 | + | func fS () = { | |
830 | + | let bY = bt() | |
831 | + | if ((bY == 0)) | |
832 | + | then $Tuple2(bp(), bq()) | |
703 | 833 | else { | |
704 | - | let eK = aV(bc(cp), bV()) | |
705 | - | let eL = dD((cp > 0), eK, false)._1 | |
706 | - | eL | |
834 | + | let fT = (bY > 0) | |
835 | + | let fU = dy(fT, aV(bY), false) | |
836 | + | let fV = fU._1 | |
837 | + | let fW = fU._2 | |
838 | + | let fX = fU._3 | |
839 | + | $Tuple2(fW, fX) | |
707 | 840 | } | |
708 | 841 | } | |
709 | 842 | ||
710 | 843 | ||
711 | - | func eM (cr,dt) = { | |
712 | - | let eN = cq(cr) | |
713 | - | let cu = eN._1 | |
714 | - | let es = eN._2 | |
715 | - | let et = eN._3 | |
716 | - | let eu = eN._4 | |
717 | - | let ep = eq(cr, aP)._2 | |
718 | - | let eO = dh(cu, es, eu, ep) | |
719 | - | let dq = eO._1 | |
720 | - | let dr = eO._2 | |
721 | - | let eK = -(cu) | |
722 | - | let eP = ep | |
723 | - | let eQ = -(dq) | |
724 | - | let eR = dD((cu > 0), bc(cu), dt) | |
725 | - | let eL = eR._1 | |
726 | - | let cU = eR._2 | |
727 | - | let cV = eR._3 | |
728 | - | let eS = eR._4 | |
729 | - | let eT = eR._5 | |
730 | - | let eU = eR._6 | |
731 | - | let eV = (bM() - et) | |
732 | - | $Tuple13(eK, dr, eP, eQ, cU, cV, eS, eV, eL, eT, eU, (bO() - (if ((cu > 0)) | |
733 | - | then et | |
734 | - | else 0)), (bN() - (if ((0 > cu)) | |
735 | - | then et | |
736 | - | else 0))) | |
844 | + | func fY (fZ,bt,ga,gb) = { | |
845 | + | let gc = toBigInt(fZ) | |
846 | + | let gd = toBigInt(bt) | |
847 | + | let ge = toBigInt(ga) | |
848 | + | let gf = toBigInt(gb) | |
849 | + | let bf = aS(ge, gc) | |
850 | + | let gg = (gc + gd) | |
851 | + | let gh = aR(bf, gg) | |
852 | + | let gi = aR(gh, gg) | |
853 | + | let gj = aR(gf, gi) | |
854 | + | toInt(gj) | |
737 | 855 | } | |
738 | 856 | ||
739 | 857 | ||
740 | - | func eW () = { | |
741 | - | let eX = ((lastBlock.timestamp / 1000) / 60) | |
742 | - | let eY = (eX - aI) | |
743 | - | let eZ = valueOrElse(getString(this, C), "") | |
744 | - | let fa = split(eZ, ",") | |
745 | - | func fb (bh,fc) = if ((eY >= parseIntValue(fc))) | |
746 | - | then (bh :+ parseIntValue(fc)) | |
747 | - | else bh | |
748 | - | ||
749 | - | let fd = { | |
750 | - | let bk = fa | |
751 | - | let bl = size(bk) | |
752 | - | let bm = nil | |
753 | - | func bn (bo,bp) = if ((bp >= bl)) | |
754 | - | then bo | |
755 | - | else fb(bo, bk[bp]) | |
756 | - | ||
757 | - | func bq (bo,bp) = if ((bp >= bl)) | |
758 | - | then bo | |
759 | - | else throw("List size exceeds 20") | |
760 | - | ||
761 | - | bq(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bm, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
762 | - | } | |
763 | - | let fe = if ((size(fd) > 0)) | |
764 | - | then max(fd) | |
765 | - | else parseIntValue(fa[0]) | |
766 | - | let ff = valueOrElse(getInteger(this, D), 0) | |
767 | - | let fg = valueOrElse(getInteger(this, ((E + "_") + toString(ff))), 0) | |
768 | - | let fh = valueOrElse(getInteger(this, ((F + "_") + toString(ff))), 0) | |
769 | - | let fi = (fg + ((eX - ff) * fh)) | |
770 | - | let fj = valueOrElse(getInteger(this, ((E + "_") + toString(fe))), 0) | |
771 | - | let fk = valueOrElse(getInteger(this, ((F + "_") + toString(fe))), 0) | |
772 | - | let fl = (fj + ((eY - fe) * fk)) | |
773 | - | ((fi - fl) / aI) | |
774 | - | } | |
775 | - | ||
776 | - | ||
777 | - | func fm () = { | |
778 | - | let cp = bL() | |
779 | - | if ((cp == 0)) | |
780 | - | then $Tuple2(bH(), bI()) | |
858 | + | func gk (gl,cD,cE) = { | |
859 | + | let bY = bt() | |
860 | + | if ((bY == 0)) | |
861 | + | then { | |
862 | + | let gm = aM(aO(gl, cE), cD) | |
863 | + | $Tuple3(gm, aF, 0) | |
864 | + | } | |
781 | 865 | else { | |
782 | - | let | |
783 | - | let | |
784 | - | let | |
785 | - | let | |
786 | - | let | |
787 | - | $ | |
866 | + | let fT = (bY > 0) | |
867 | + | let fV = dy(fT, aV(bY), false)._1 | |
868 | + | let gm = fY(cE, bY, cD, gl) | |
869 | + | let gn = aF | |
870 | + | let go = eh(bY, fV, cD, gm, cE, gn, aI)._2 | |
871 | + | $Tuple3(gm, gn, go) | |
788 | 872 | } | |
789 | 873 | } | |
790 | 874 | ||
791 | 875 | ||
792 | - | func fs (ft,bL,fu,fv) = { | |
793 | - | let fw = toBigInt(ft) | |
794 | - | let fx = toBigInt(bL) | |
795 | - | let fy = toBigInt(fu) | |
796 | - | let fz = toBigInt(fv) | |
797 | - | let bz = aZ(fy, fw) | |
798 | - | let fA = (fw + fx) | |
799 | - | let fB = aY(bz, fA) | |
800 | - | let fC = aY(fB, fA) | |
801 | - | let fD = aY(fz, fC) | |
802 | - | toInt(fD) | |
803 | - | } | |
804 | - | ||
805 | - | ||
806 | - | func fE (fF,cM,cN) = { | |
807 | - | let cp = bL() | |
808 | - | if ((cp == 0)) | |
809 | - | then { | |
810 | - | let fG = aT(aV(fF, cN), cM) | |
811 | - | $Tuple3(fG, aM, 0) | |
812 | - | } | |
813 | - | else { | |
814 | - | let fn = (cp > 0) | |
815 | - | let fp = dD(fn, bc(cp), false)._1 | |
816 | - | let fG = fs(cN, cp, cM, fF) | |
817 | - | let fH = aM | |
818 | - | let eQ = en(cp, fp, cM, fG, cN, fH, aP)._2 | |
819 | - | $Tuple3(fG, fH, eQ) | |
820 | - | } | |
821 | - | } | |
822 | - | ||
823 | - | ||
824 | - | func fI () = { | |
825 | - | let fJ = dE() | |
826 | - | let fK = eW() | |
827 | - | let fL = (fK - fJ) | |
828 | - | if (if (if ((cc() == 0)) | |
876 | + | func gp () = { | |
877 | + | let gq = dE() | |
878 | + | let gr = fu() | |
879 | + | let gs = (gr - gq) | |
880 | + | if (if (if ((bK() == 0)) | |
829 | 881 | then true | |
830 | - | else ( | |
882 | + | else (bL() == 0)) | |
831 | 883 | then true | |
832 | - | else | |
884 | + | else dK()) | |
833 | 885 | then $Tuple2(0, 0) | |
834 | - | else if ((0 > | |
886 | + | else if ((0 > gs)) | |
835 | 887 | then { | |
836 | - | let | |
837 | - | let | |
838 | - | $Tuple2( | |
888 | + | let gt = aM(aO(gs, bz()), aH) | |
889 | + | let gu = aM(aO(gt, bK()), bL()) | |
890 | + | $Tuple2(gt, gu) | |
839 | 891 | } | |
840 | 892 | else { | |
841 | - | let | |
842 | - | let | |
843 | - | $Tuple2( | |
893 | + | let gu = aM(aO(gs, bz()), aH) | |
894 | + | let gt = aM(aO(gu, bL()), bK()) | |
895 | + | $Tuple2(gt, gu) | |
844 | 896 | } | |
845 | 897 | } | |
846 | 898 | ||
847 | 899 | ||
848 | - | func | |
849 | - | let | |
850 | - | let | |
851 | - | let | |
900 | + | func gv (gw,gx) = { | |
901 | + | let gy = bm() | |
902 | + | let gz = aO(gy, gx) | |
903 | + | let gA = if ((gw != "")) | |
852 | 904 | then { | |
853 | - | let | |
854 | - | if (( | |
905 | + | let gB = bi(aw(), aj(ay, gw)) | |
906 | + | if ((gB == az)) | |
855 | 907 | then { | |
856 | - | let | |
857 | - | let | |
858 | - | $Tuple2( | |
908 | + | let gC = bk(aw(), aj(ax, gw)) | |
909 | + | let gD = aO(gz, gC) | |
910 | + | $Tuple2(gD, true) | |
859 | 911 | } | |
860 | 912 | else throw("Invalid attached artifact") | |
861 | 913 | } | |
862 | - | else $Tuple2( | |
863 | - | let | |
864 | - | let | |
865 | - | $Tuple2( | |
914 | + | else $Tuple2(gz, false) | |
915 | + | let gD = gA._1 | |
916 | + | let gE = gA._2 | |
917 | + | $Tuple2(gD, gE) | |
866 | 918 | } | |
867 | 919 | ||
868 | 920 | ||
869 | - | func | |
870 | - | let | |
871 | - | if (( | |
921 | + | func gF (ca,gG) = { | |
922 | + | let eM = bZ(ca)._1 | |
923 | + | if ((eM == 0)) | |
872 | 924 | then true | |
873 | - | else ( | |
925 | + | else (ce(ca) == gG) | |
874 | 926 | } | |
875 | 927 | ||
876 | 928 | ||
877 | - | func | |
929 | + | func gH (ca,gG) = (ce(ca) == gG) | |
878 | 930 | ||
879 | 931 | ||
880 | - | func gb (gc,aC,cr) = ((((((aj + "_") + gc) + "_") + aC) + "_") + cr) | |
881 | - | ||
882 | - | ||
883 | - | func gd (cr) = { | |
884 | - | let cx = cv(cr) | |
885 | - | if ((cx == toBase58String(aq()))) | |
886 | - | then $Tuple2(0, cx) | |
887 | - | else { | |
888 | - | let ge = gb(toString(this), cx, cr) | |
889 | - | let gf = valueOrElse(getInteger(ay(), ge), 0) | |
890 | - | $Tuple2(gf, cx) | |
891 | - | } | |
892 | - | } | |
893 | - | ||
894 | - | ||
895 | - | func gg (cr,fP) = { | |
896 | - | let gh = invoke(au(), "computeFeeDiscount", [cr], nil) | |
897 | - | if ((gh == gh)) | |
932 | + | func gI (ca,gw) = { | |
933 | + | let gJ = invoke(at(), "computeFeeDiscount", [ca], nil) | |
934 | + | if ((gJ == gJ)) | |
898 | 935 | then { | |
899 | - | let | |
900 | - | let | |
901 | - | if ($isInstanceOf( | |
936 | + | let gK = { | |
937 | + | let cc = gJ | |
938 | + | if ($isInstanceOf(cc, "Int")) | |
902 | 939 | then { | |
903 | - | let | |
904 | - | | |
940 | + | let gL = cc | |
941 | + | gL | |
905 | 942 | } | |
906 | 943 | else throw("Invalid computeFeeDiscount result") | |
907 | 944 | } | |
908 | - | let | |
909 | - | let | |
910 | - | let | |
911 | - | $Tuple2( | |
945 | + | let gM = gv(gw, gK) | |
946 | + | let gD = gM._1 | |
947 | + | let gE = gM._2 | |
948 | + | $Tuple2(gD, gE) | |
912 | 949 | } | |
913 | 950 | else throw("Strict value is not equal to itself.") | |
914 | 951 | } | |
915 | 952 | ||
916 | 953 | ||
917 | - | func | |
918 | - | let | |
919 | - | then toBase58String(valueOrErrorMessage( | |
954 | + | func gN (bR) = { | |
955 | + | let gO = if ((size(bR.payments) > 1)) | |
956 | + | then toBase58String(valueOrErrorMessage(bR.payments[1].assetId, "Invalid artifactId")) | |
920 | 957 | else "" | |
921 | - | | |
958 | + | gO | |
922 | 959 | } | |
923 | 960 | ||
924 | 961 | ||
925 | - | func | |
926 | - | let | |
927 | - | let | |
928 | - | $Tuple2( | |
962 | + | func gP (gQ) = { | |
963 | + | let gR = aO(gQ, bN()) | |
964 | + | let gS = (gQ - gR) | |
965 | + | $Tuple2(gR, gS) | |
929 | 966 | } | |
930 | 967 | ||
931 | 968 | ||
932 | - | func | |
969 | + | func gT (gU,gV,gW,gX,eI,gY,gZ,ha,hb,dX,hc,hd,he) = [IntegerEntry(s, gU), IntegerEntry(t, gV), IntegerEntry(u, gW), IntegerEntry(r, gX), IntegerEntry(p, eI), IntegerEntry(w, gY), IntegerEntry(x, gZ), IntegerEntry(v, ha), IntegerEntry(y, hb), IntegerEntry(z, dX), IntegerEntry(A, hc), IntegerEntry(B, hc), IntegerEntry(q, he)] | |
933 | 970 | ||
934 | 971 | ||
935 | - | func | |
972 | + | func hf (hg,hh,hi,hj,hk) = [IntegerEntry(J, hg), IntegerEntry(H, hh), IntegerEntry(I, hi), IntegerEntry(K, hj), IntegerEntry(L, hk)] | |
936 | 973 | ||
937 | 974 | ||
938 | - | func gJ (am,aC) = [StringEntry(ak(l, am), aC)] | |
939 | - | ||
940 | - | ||
941 | - | func gK (gL,am) = if (gL) | |
975 | + | func hl (hm,al) = if (hm) | |
942 | 976 | then { | |
943 | - | let | |
944 | - | [IntegerEntry( | |
977 | + | let hn = bM() | |
978 | + | [IntegerEntry(aj(i, al), (hn + 1)), IntegerEntry(d, (hn + 1))] | |
945 | 979 | } | |
946 | 980 | else nil | |
947 | 981 | ||
948 | 982 | ||
949 | - | func | |
950 | - | then [IntegerEntry( | |
983 | + | func ho (hm,al,eI) = if (hm) | |
984 | + | then [IntegerEntry(aj(k, al), eI)] | |
951 | 985 | else nil | |
952 | 986 | ||
953 | 987 | ||
954 | - | func | |
988 | + | func hp (al,eH,hq,hr,di,hs) = [IntegerEntry(aj(e, al), eH), IntegerEntry(aj(f, al), hq), IntegerEntry(aj(g, al), hr), IntegerEntry(aj(h, al), di), IntegerEntry(aj(l, al), hs)] | |
955 | 989 | ||
956 | 990 | ||
957 | - | func | |
958 | - | let | |
959 | - | let | |
960 | - | if (( | |
991 | + | func ht (hu) = { | |
992 | + | let fv = ((bP() / 1000) / 60) | |
993 | + | let hv = valueOrElse(getInteger(this, D), 0) | |
994 | + | if ((hv > fv)) | |
961 | 995 | then throw("TWAP out-of-order") | |
962 | 996 | else { | |
963 | - | let | |
964 | - | then | |
965 | - | else | |
966 | - | if (( | |
997 | + | let fL = if ((hv == 0)) | |
998 | + | then fv | |
999 | + | else hv | |
1000 | + | if ((fv > hv)) | |
967 | 1001 | then { | |
968 | - | let | |
969 | - | let | |
970 | - | let | |
971 | - | let | |
972 | - | [IntegerEntry( | |
1002 | + | let hw = valueOrElse(getInteger(this, ((E + "_") + toString(hv))), 0) | |
1003 | + | let hx = valueOrElse(getInteger(this, ((F + "_") + toString(hv))), hu) | |
1004 | + | let hy = (hw + ((fv - fL) * hx)) | |
1005 | + | let fy = bb(aZ(valueOrElse(getString(this, C), "")), aC, toString(fv)) | |
1006 | + | [IntegerEntry(aj(E, toString(fv)), hy), IntegerEntry(aj(F, toString(fv)), hu), IntegerEntry(aj(G, toString(fv)), hv), IntegerEntry(D, fv), StringEntry(C, aX(fy))] | |
973 | 1007 | } | |
974 | 1008 | else { | |
975 | - | let | |
976 | - | let | |
977 | - | let | |
978 | - | let | |
979 | - | [IntegerEntry( | |
1009 | + | let hz = valueOrElse(getInteger(this, aj(G, toString(fv))), 0) | |
1010 | + | let hw = valueOrElse(getInteger(this, aj(E, toString(hz))), 0) | |
1011 | + | let hx = valueOrElse(getInteger(this, aj(F, toString(hz))), hu) | |
1012 | + | let hy = (hw + ((fv - hz) * hx)) | |
1013 | + | [IntegerEntry(aj(E, toString(fv)), hy), IntegerEntry(aj(F, toString(fv)), hu)] | |
980 | 1014 | } | |
981 | 1015 | } | |
982 | 1016 | } | |
983 | 1017 | ||
984 | 1018 | ||
985 | - | func | |
1019 | + | func hA (cD,cE) = [IntegerEntry(M, cD), IntegerEntry(N, cE)] | |
986 | 1020 | ||
987 | 1021 | ||
988 | - | func | |
1022 | + | func hB (cI,cJ) = [IntegerEntry(O, cI), IntegerEntry(P, cJ)] | |
989 | 1023 | ||
990 | 1024 | ||
991 | - | func | |
992 | - | let | |
993 | - | let | |
994 | - | if ((( | |
995 | - | then throw(((((("Invalid AMM state data: " + toString( | |
996 | - | else (( | |
1025 | + | func hC (cD,cE,hD,hE,hF,hG,hH,hI) = { | |
1026 | + | let cI = br() | |
1027 | + | let cJ = bs() | |
1028 | + | if (((hF - hG) != hD)) | |
1029 | + | then throw(((((("Invalid AMM state data: " + toString(hF)) + " + ") + toString(hG)) + " != ") + toString(hD))) | |
1030 | + | else ((hA(cD, cE) ++ [IntegerEntry(Q, hD), IntegerEntry(T, hE), IntegerEntry(R, hF), IntegerEntry(S, hG), IntegerEntry(V, hH), IntegerEntry(U, hI)]) ++ ht(aM(aO(cD, cI), aO(cE, cJ)))) | |
997 | 1031 | } | |
998 | 1032 | ||
999 | 1033 | ||
1000 | - | func | |
1034 | + | func hJ (al) = [DeleteEntry(aj(e, al)), DeleteEntry(aj(f, al)), DeleteEntry(aj(g, al)), DeleteEntry(aj(h, al)), DeleteEntry(aj(j, al)), DeleteEntry(aj(k, al)), DeleteEntry(aj(l, al))] | |
1001 | 1035 | ||
1002 | 1036 | ||
1003 | - | func | |
1004 | - | let | |
1005 | - | if (( | |
1006 | - | then throw(((("Unable to withdraw " + toString( | |
1007 | - | else [ScriptTransfer( | |
1037 | + | func hK (al,hL) = { | |
1038 | + | let hM = assetBalance(this, ap()) | |
1039 | + | if ((hL > hM)) | |
1040 | + | then throw(((("Unable to withdraw " + toString(hL)) + " from contract balance ") + toString(hM))) | |
1041 | + | else [ScriptTransfer(al, hL, ap())] | |
1008 | 1042 | } | |
1009 | 1043 | ||
1010 | 1044 | ||
1011 | - | func | |
1045 | + | func hN (bR) = if ((0 > bR)) | |
1012 | 1046 | then throw("Balance") | |
1013 | - | else [IntegerEntry( | |
1047 | + | else [IntegerEntry(c, bR)] | |
1014 | 1048 | ||
1015 | 1049 | ||
1016 | - | func | |
1050 | + | func hO (bR) = [ScriptTransfer(ar(), bR, ap())] | |
1017 | 1051 | ||
1018 | 1052 | ||
1019 | - | func | |
1020 | - | then [Burn(valueOrErrorMessage( | |
1053 | + | func hP (hQ,bR) = if (hQ) | |
1054 | + | then [Burn(valueOrErrorMessage(bR.payments[1].assetId, "Invalid artifact"), 1)] | |
1021 | 1055 | else nil | |
1022 | 1056 | ||
1023 | 1057 | ||
1024 | - | @Callable( | |
1025 | - | func pause () = if (( | |
1058 | + | @Callable(bR) | |
1059 | + | func pause () = if ((bR.caller != an())) | |
1026 | 1060 | then throw("Invalid pause params") | |
1061 | + | else [BooleanEntry(n, true)] | |
1062 | + | ||
1063 | + | ||
1064 | + | ||
1065 | + | @Callable(bR) | |
1066 | + | func unpause () = if ((bR.caller != an())) | |
1067 | + | then throw("Invalid unpause params") | |
1068 | + | else [BooleanEntry(n, false)] | |
1069 | + | ||
1070 | + | ||
1071 | + | ||
1072 | + | @Callable(bR) | |
1073 | + | func setCloseOnly () = if ((bR.caller != an())) | |
1074 | + | then throw("Invalid setCloseOnly params") | |
1027 | 1075 | else [BooleanEntry(o, true)] | |
1028 | 1076 | ||
1029 | 1077 | ||
1030 | 1078 | ||
1031 | - | @Callable( | |
1032 | - | func | |
1033 | - | then throw("Invalid | |
1079 | + | @Callable(bR) | |
1080 | + | func unsetCloseOnly () = if ((bR.caller != an())) | |
1081 | + | then throw("Invalid unsetCloseOnly params") | |
1034 | 1082 | else [BooleanEntry(o, false)] | |
1035 | 1083 | ||
1036 | 1084 | ||
1037 | 1085 | ||
1038 | - | @Callable(ci) | |
1039 | - | func setCloseOnly () = if ((ci.caller != ao())) | |
1040 | - | then throw("Invalid setCloseOnly params") | |
1041 | - | else [BooleanEntry(p, true)] | |
1042 | - | ||
1043 | - | ||
1044 | - | ||
1045 | - | @Callable(ci) | |
1046 | - | func unsetCloseOnly () = if ((ci.caller != ao())) | |
1047 | - | then throw("Invalid unsetCloseOnly params") | |
1048 | - | else [BooleanEntry(p, false)] | |
1049 | - | ||
1050 | - | ||
1051 | - | ||
1052 | - | @Callable(ci) | |
1053 | - | func addLiquidity (cH) = if (if ((ci.caller != ao())) | |
1086 | + | @Callable(bR) | |
1087 | + | func addLiquidity (cy) = if (if ((bR.caller != an())) | |
1054 | 1088 | then true | |
1055 | - | else (0 >= | |
1089 | + | else (0 >= cy)) | |
1056 | 1090 | then throw("Invalid addLiquidity params") | |
1057 | 1091 | else { | |
1058 | - | let | |
1059 | - | let | |
1060 | - | let | |
1061 | - | let | |
1062 | - | let | |
1063 | - | let | |
1064 | - | let | |
1065 | - | let | |
1066 | - | let | |
1067 | - | let | |
1068 | - | let | |
1069 | - | let | |
1070 | - | let | |
1092 | + | let cD = bp() | |
1093 | + | let cE = bq() | |
1094 | + | let cI = br() | |
1095 | + | let cJ = bs() | |
1096 | + | let hR = aM(aO(cD, cI), aO(cE, cJ)) | |
1097 | + | let hS = (cD + cy) | |
1098 | + | let hT = (aM(aO(hS, cI), hR) - cE) | |
1099 | + | let hU = (cE + hT) | |
1100 | + | let hV = gk(dE(), hS, hU) | |
1101 | + | let hW = hV._1 | |
1102 | + | let hX = hV._2 | |
1103 | + | let go = hV._3 | |
1104 | + | let hY = if ((go != 0)) | |
1071 | 1105 | then { | |
1072 | - | let | |
1073 | - | if (( | |
1106 | + | let hY = invoke(as(), "exchangeFreeAndLocked", [go], nil) | |
1107 | + | if ((hY == hY)) | |
1074 | 1108 | then nil | |
1075 | 1109 | else throw("Strict value is not equal to itself.") | |
1076 | 1110 | } | |
1077 | 1111 | else nil | |
1078 | - | if (( | |
1079 | - | then ( | |
1112 | + | if ((hY == hY)) | |
1113 | + | then (hA(hS, hU) ++ hB(hW, hX)) | |
1080 | 1114 | else throw("Strict value is not equal to itself.") | |
1081 | 1115 | } | |
1082 | 1116 | ||
1083 | 1117 | ||
1084 | 1118 | ||
1085 | - | @Callable( | |
1086 | - | func removeLiquidity ( | |
1119 | + | @Callable(bR) | |
1120 | + | func removeLiquidity (cy) = if (if ((bR.caller != an())) | |
1087 | 1121 | then true | |
1088 | - | else ( | |
1122 | + | else (cy >= 0)) | |
1089 | 1123 | then throw("Invalid removeLiquidity params") | |
1090 | 1124 | else { | |
1091 | - | let | |
1092 | - | let | |
1093 | - | let | |
1094 | - | let | |
1095 | - | let | |
1096 | - | let | |
1097 | - | let | |
1098 | - | let | |
1099 | - | let | |
1100 | - | let | |
1101 | - | let | |
1102 | - | let | |
1103 | - | let | |
1125 | + | let cD = bp() | |
1126 | + | let cE = bq() | |
1127 | + | let cI = br() | |
1128 | + | let cJ = bs() | |
1129 | + | let hR = aM(aO(cD, cI), aO(cE, cJ)) | |
1130 | + | let hS = (cD - cy) | |
1131 | + | let hZ = aV((aM(aO(hS, cI), hR) - cE)) | |
1132 | + | let hU = (cE - hZ) | |
1133 | + | let ia = gk(dE(), hS, hU) | |
1134 | + | let hW = ia._1 | |
1135 | + | let hX = ia._2 | |
1136 | + | let go = ia._3 | |
1137 | + | let hY = if ((go != 0)) | |
1104 | 1138 | then { | |
1105 | - | let | |
1106 | - | if (( | |
1139 | + | let hY = invoke(as(), "exchangeFreeAndLocked", [go], nil) | |
1140 | + | if ((hY == hY)) | |
1107 | 1141 | then nil | |
1108 | 1142 | else throw("Strict value is not equal to itself.") | |
1109 | 1143 | } | |
1110 | 1144 | else nil | |
1111 | - | if (( | |
1112 | - | then ( | |
1145 | + | if ((hY == hY)) | |
1146 | + | then (hA(hS, hU) ++ hB(hW, hX)) | |
1113 | 1147 | else throw("Strict value is not equal to itself.") | |
1114 | 1148 | } | |
1115 | 1149 | ||
1116 | 1150 | ||
1117 | 1151 | ||
1118 | - | @Callable( | |
1119 | - | func changeSettings ( | |
1152 | + | @Callable(bR) | |
1153 | + | func changeSettings (gU,gV,gW,gX,eI,gY,gZ,ha,hb,dX,hc,hd,he) = if ((bR.caller != an())) | |
1120 | 1154 | then throw("Invalid changeSettings params") | |
1121 | - | else | |
1155 | + | else gT(gU, gV, gW, gX, eI, gY, gZ, ha, hb, dX, hc, hd, he) | |
1122 | 1156 | ||
1123 | 1157 | ||
1124 | 1158 | ||
1125 | - | @Callable( | |
1126 | - | func initialize ( | |
1159 | + | @Callable(bR) | |
1160 | + | func initialize (cD,cE,gX,gU,gV,gW,eI,ib,ic,id,gY,gZ,ha,hb,dX,hc,hd,he) = if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ((0 >= cD)) | |
1127 | 1161 | then true | |
1128 | - | else (0 >= | |
1162 | + | else (0 >= cE)) | |
1129 | 1163 | then true | |
1130 | - | else (0 >= | |
1164 | + | else (0 >= gX)) | |
1131 | 1165 | then true | |
1132 | - | else (0 >= | |
1166 | + | else (0 >= gU)) | |
1133 | 1167 | then true | |
1134 | - | else (0 >= | |
1168 | + | else (0 >= gV)) | |
1135 | 1169 | then true | |
1136 | - | else (0 >= | |
1170 | + | else (0 >= gW)) | |
1137 | 1171 | then true | |
1138 | - | else (0 >= | |
1172 | + | else (0 >= eI)) | |
1139 | 1173 | then true | |
1140 | - | else (0 >= | |
1174 | + | else (0 >= gY)) | |
1141 | 1175 | then true | |
1142 | - | else (0 >= | |
1176 | + | else (0 >= gZ)) | |
1143 | 1177 | then true | |
1144 | - | else (0 >= | |
1178 | + | else (0 >= ha)) | |
1145 | 1179 | then true | |
1146 | - | else (0 >= | |
1180 | + | else (0 >= hb)) | |
1147 | 1181 | then true | |
1148 | - | else (0 >= | |
1182 | + | else (0 >= dX)) | |
1149 | 1183 | then true | |
1150 | - | else (0 >= | |
1184 | + | else (0 >= hc)) | |
1151 | 1185 | then true | |
1152 | - | else ( | |
1186 | + | else (hc > aF)) | |
1153 | 1187 | then true | |
1154 | - | else (0 >= | |
1188 | + | else (0 >= hd)) | |
1155 | 1189 | then true | |
1156 | - | else cC()) | |
1190 | + | else (0 >= he)) | |
1191 | + | then true | |
1192 | + | else ct()) | |
1157 | 1193 | then throw("Invalid initialize parameters") | |
1158 | - | else (((( | |
1194 | + | else ((((hC(cD, cE, 0, 0, 0, 0, 0, 0) ++ gT(gU, gV, gW, gX, eI, gY, gZ, ha, hb, dX, hc, hd, he)) ++ hf((bP() + gX), 0, 0, 0, 0)) ++ hN(0)) ++ [BooleanEntry(m, true), StringEntry(a, ib), StringEntry(b, ic), StringEntry(X, id)]) | |
1159 | 1195 | ||
1160 | 1196 | ||
1161 | 1197 | ||
1162 | - | @Callable( | |
1163 | - | func increasePosition ( | |
1164 | - | let | |
1165 | - | if (( | |
1198 | + | @Callable(bR) | |
1199 | + | func increasePosition (ie,if,ig,ih) = { | |
1200 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1201 | + | if ((ii == ii)) | |
1166 | 1202 | then { | |
1167 | - | let cr = ch(ci) | |
1168 | - | let hJ = ci.payments[0].amount | |
1169 | - | let aC = ci.payments[0].assetId | |
1170 | - | let hK = toBase58String(value(aC)) | |
1171 | - | let hL = (aC == aq()) | |
1172 | - | let hM = aB(hK) | |
1173 | - | if (if (if (if (if (if (if (if (if (if ((hE != aG)) | |
1174 | - | then (hE != aH) | |
1175 | - | else false) | |
1176 | - | then true | |
1177 | - | else (0 >= hJ)) | |
1178 | - | then true | |
1179 | - | else !(cC())) | |
1180 | - | then true | |
1181 | - | else if (!(hL)) | |
1182 | - | then !(hM) | |
1183 | - | else false) | |
1184 | - | then true | |
1185 | - | else !(fY(cr, hK))) | |
1186 | - | then true | |
1187 | - | else !(cj(aT(aM, hF), bG(), true))) | |
1188 | - | then true | |
1189 | - | else cD()) | |
1190 | - | then true | |
1191 | - | else cE()) | |
1192 | - | then true | |
1193 | - | else dL()) | |
1194 | - | then throw("Invalid increasePosition parameters") | |
1195 | - | else { | |
1196 | - | let hN = gg(cr, gl(ci)) | |
1197 | - | let fW = hN._1 | |
1198 | - | let fX = hN._2 | |
1199 | - | let hk = aT(hJ, (aV(fW, hF) + aM)) | |
1200 | - | let hO = (hJ - hk) | |
1201 | - | let hP = if (hM) | |
1202 | - | then { | |
1203 | - | let hQ = invoke(ay(), "borrow", [cr], [AttachedPayment(aC, hk)]) | |
1204 | - | if ((hQ == hQ)) | |
1203 | + | let ij = invoke(this, "ensureCalledOnce", nil, nil) | |
1204 | + | if ((ij == ij)) | |
1205 | + | then { | |
1206 | + | let ca = bQ(bR) | |
1207 | + | let ik = bR.payments[0].amount | |
1208 | + | let gG = bR.payments[0].assetId | |
1209 | + | let il = toBase58String(value(gG)) | |
1210 | + | let im = (gG == ap()) | |
1211 | + | if (if (if (if (if (if (if (if (if (if ((ie != aA)) | |
1212 | + | then (ie != aB) | |
1213 | + | else false) | |
1214 | + | then true | |
1215 | + | else (0 >= ik)) | |
1216 | + | then true | |
1217 | + | else !(ct())) | |
1218 | + | then true | |
1219 | + | else !(im)) | |
1220 | + | then true | |
1221 | + | else !(gF(ca, il))) | |
1222 | + | then true | |
1223 | + | else !(bS(aM(aF, if), bo(), true))) | |
1224 | + | then true | |
1225 | + | else cu()) | |
1226 | + | then true | |
1227 | + | else cv()) | |
1228 | + | then true | |
1229 | + | else dK()) | |
1230 | + | then throw("Invalid increasePosition parameters") | |
1231 | + | else { | |
1232 | + | let in = gI(ca, gN(bR)) | |
1233 | + | let gD = in._1 | |
1234 | + | let gE = in._2 | |
1235 | + | let hL = aM(ik, (aO(gD, if) + aF)) | |
1236 | + | let io = (ik - hL) | |
1237 | + | let ip = invoke(av(), "acceptPaymentWithLink", [ca, ih], [AttachedPayment(ap(), io)]) | |
1238 | + | if ((ip == ip)) | |
1205 | 1239 | then { | |
1206 | - | let hR = assetBalance(this, aq()) | |
1207 | - | if ((hR == hR)) | |
1240 | + | let iq = { | |
1241 | + | let cc = ip | |
1242 | + | if ($isInstanceOf(cc, "Int")) | |
1243 | + | then { | |
1244 | + | let gL = cc | |
1245 | + | gL | |
1246 | + | } | |
1247 | + | else throw("Invalid referrerFee") | |
1248 | + | } | |
1249 | + | let ir = (io - iq) | |
1250 | + | let is = bZ(ca) | |
1251 | + | let eM = is._1 | |
1252 | + | let eN = is._2 | |
1253 | + | let eO = is._3 | |
1254 | + | let eP = is._4 | |
1255 | + | let eQ = is._5 | |
1256 | + | let it = (eM == 0) | |
1257 | + | let iu = if ((eM > 0)) | |
1258 | + | then (ie == aA) | |
1259 | + | else (ie == aB) | |
1260 | + | let iv = if (!(it)) | |
1261 | + | then iu | |
1262 | + | else false | |
1263 | + | let iw = (ie == aA) | |
1264 | + | let ix = if (if (it) | |
1265 | + | then true | |
1266 | + | else iv) | |
1208 | 1267 | then { | |
1209 | - | let hS = invoke(az(), "swap", [toBase58String(aq()), 0], [AttachedPayment(aC, hO)]) | |
1210 | - | if ((hS == hS)) | |
1268 | + | let iy = aO(hL, if) | |
1269 | + | let iz = cH(iw, iy) | |
1270 | + | let cO = iz._1 | |
1271 | + | let cL = iz._2 | |
1272 | + | let cM = iz._3 | |
1273 | + | let eW = iz._4 | |
1274 | + | if (if ((ig != 0)) | |
1275 | + | then (ig > aV(cO)) | |
1276 | + | else false) | |
1277 | + | then throw(((("Limit error: " + toString(aV(cO))) + " < ") + toString(ig))) | |
1278 | + | else { | |
1279 | + | let fk = (eM + cO) | |
1280 | + | let iA = (bw() + (if ((fk > 0)) | |
1281 | + | then iy | |
1282 | + | else 0)) | |
1283 | + | let iB = (bv() + (if ((0 > fk)) | |
1284 | + | then iy | |
1285 | + | else 0)) | |
1286 | + | let iC = dd(eM, eN, eP, eQ, hL) | |
1287 | + | let dl = iC._1 | |
1288 | + | let fe = iC._2 | |
1289 | + | let ff = iC._3 | |
1290 | + | let dc = iC._4 | |
1291 | + | if (!(dQ(cL, cM))) | |
1292 | + | then throw("Over max spread limit") | |
1293 | + | else if (!(dU(iA, iB))) | |
1294 | + | then throw("Over max open notional") | |
1295 | + | else $Tuple14(fk, dl, (eO + iy), bX(fk), bP(), cM, cL, eW, (bu() + iy), (bL() + (if ((fk > 0)) | |
1296 | + | then aV(cO) | |
1297 | + | else 0)), (bK() + (if ((0 > fk)) | |
1298 | + | then aV(cO) | |
1299 | + | else 0)), iA, iB, dc) | |
1300 | + | } | |
1301 | + | } | |
1302 | + | else { | |
1303 | + | let iy = aO(hL, if) | |
1304 | + | let iD = ek(toString(bR.caller), aI) | |
1305 | + | let eZ = iD._1 | |
1306 | + | let ej = iD._2 | |
1307 | + | if ((eZ > iy)) | |
1308 | + | then throw("Use decreasePosition to decrease position size") | |
1309 | + | else throw("Close position first") | |
1310 | + | } | |
1311 | + | let fk = ix._1 | |
1312 | + | let iE = ix._2 | |
1313 | + | let fm = ix._3 | |
1314 | + | let iF = ix._4 | |
1315 | + | let iG = ix._5 | |
1316 | + | let cM = ix._6 | |
1317 | + | let cL = ix._7 | |
1318 | + | let eW = ix._8 | |
1319 | + | let iH = ix._9 | |
1320 | + | let iI = ix._10 | |
1321 | + | let iJ = ix._11 | |
1322 | + | let iA = ix._12 | |
1323 | + | let iB = ix._13 | |
1324 | + | let dc = ix._14 | |
1325 | + | let iK = gP((ir + dc)) | |
1326 | + | let gR = iK._1 | |
1327 | + | let gS = iK._2 | |
1328 | + | let iL = if ((hL >= dc)) | |
1329 | + | then invoke(as(), "addLocked", nil, [AttachedPayment(ap(), (hL - dc))]) | |
1330 | + | else invoke(as(), "withdrawLocked", [(dc - hL)], nil) | |
1331 | + | if ((iL == iL)) | |
1332 | + | then { | |
1333 | + | let iM = invoke(as(), "addFree", nil, [AttachedPayment(ap(), gS)]) | |
1334 | + | if ((iM == iM)) | |
1211 | 1335 | then { | |
1212 | - | let | |
1213 | - | if (( | |
1336 | + | let iN = invoke(at(), "notifyFees", [ca, ir], nil) | |
1337 | + | if ((iN == iN)) | |
1214 | 1338 | then { | |
1215 | - | let | |
1216 | - | if (( | |
1217 | - | then | |
1339 | + | let iO = invoke(at(), "notifyNotional", [ca, fm], nil) | |
1340 | + | if ((iO == iO)) | |
1341 | + | then ((((((hp(ca, fk, iE, fm, iF, iG) ++ hl(it, ca)) ++ ho(it, ca, gD)) ++ hC(cL, cM, eW, iH, iI, iJ, iA, iB)) ++ hO(gR)) ++ hN(((bl() + hL) - dc))) ++ hP(gE, bR)) | |
1218 | 1342 | else throw("Strict value is not equal to itself.") | |
1219 | 1343 | } | |
1220 | 1344 | else throw("Strict value is not equal to itself.") | |
1225 | 1349 | } | |
1226 | 1350 | else throw("Strict value is not equal to itself.") | |
1227 | 1351 | } | |
1228 | - | else hO | |
1229 | - | if ((hP == hP)) | |
1230 | - | then { | |
1231 | - | let hV = invoke(aw(), "acceptPaymentWithLink", [cr, hH], [AttachedPayment(aq(), hP)]) | |
1232 | - | if ((hV == hV)) | |
1352 | + | } | |
1353 | + | else throw("Strict value is not equal to itself.") | |
1354 | + | } | |
1355 | + | else throw("Strict value is not equal to itself.") | |
1356 | + | } | |
1357 | + | ||
1358 | + | ||
1359 | + | ||
1360 | + | @Callable(bR) | |
1361 | + | func addMargin () = { | |
1362 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1363 | + | if ((ii == ii)) | |
1364 | + | then { | |
1365 | + | let ij = invoke(this, "ensureCalledOnce", nil, nil) | |
1366 | + | if ((ij == ij)) | |
1367 | + | then { | |
1368 | + | let ca = toString(bR.caller) | |
1369 | + | let hL = bR.payments[0].amount | |
1370 | + | let gG = bR.payments[0].assetId | |
1371 | + | let il = toBase58String(value(gG)) | |
1372 | + | let im = (gG == ap()) | |
1373 | + | if (if (if (if (if (if (if (!(im)) | |
1374 | + | then true | |
1375 | + | else !(ck(toString(bR.caller)))) | |
1376 | + | then true | |
1377 | + | else !(gH(ca, il))) | |
1378 | + | then true | |
1379 | + | else !(ct())) | |
1380 | + | then true | |
1381 | + | else cu()) | |
1382 | + | then true | |
1383 | + | else cv()) | |
1384 | + | then true | |
1385 | + | else dK()) | |
1386 | + | then throw("Invalid addMargin parameters") | |
1387 | + | else { | |
1388 | + | let iP = bZ(ca) | |
1389 | + | let eM = iP._1 | |
1390 | + | let eN = iP._2 | |
1391 | + | let eO = iP._3 | |
1392 | + | let eP = iP._4 | |
1393 | + | let eQ = iP._5 | |
1394 | + | let iL = invoke(as(), "addLocked", nil, [AttachedPayment(ap(), hL)]) | |
1395 | + | if ((iL == iL)) | |
1233 | 1396 | then { | |
1234 | - | let hW = { | |
1235 | - | let ct = hV | |
1236 | - | if ($isInstanceOf(ct, "Int")) | |
1237 | - | then { | |
1238 | - | let gj = ct | |
1239 | - | gj | |
1240 | - | } | |
1241 | - | else throw("Invalid referrerFee") | |
1242 | - | } | |
1243 | - | let hX = (hP - hW) | |
1244 | - | let hY = cq(cr) | |
1245 | - | let fZ = hY._1 | |
1246 | - | let hZ = hY._2 | |
1247 | - | let ia = hY._3 | |
1248 | - | let ib = hY._4 | |
1249 | - | let ic = (fZ == 0) | |
1250 | - | let id = if ((fZ > 0)) | |
1251 | - | then (hE == aG) | |
1252 | - | else (hE == aH) | |
1253 | - | let ie = if (!(ic)) | |
1254 | - | then id | |
1255 | - | else false | |
1256 | - | let if = (hE == aG) | |
1257 | - | let ig = if (if (ic) | |
1258 | - | then true | |
1259 | - | else ie) | |
1397 | + | let dc = cY(eN, eQ) | |
1398 | + | let iQ = if ((dc > 0)) | |
1260 | 1399 | then { | |
1261 | - | let ih = aV(hk, hF) | |
1262 | - | let ii = cQ(if, ih) | |
1263 | - | let cX = ii._1 | |
1264 | - | let cU = ii._2 | |
1265 | - | let cV = ii._3 | |
1266 | - | let eS = ii._4 | |
1267 | - | if (if ((hG != 0)) | |
1268 | - | then (hG > bc(cX)) | |
1269 | - | else false) | |
1270 | - | then throw(((("Limit error: " + toString(bc(cX))) + " < ") + toString(hG))) | |
1271 | - | else { | |
1272 | - | let ij = (fZ + cX) | |
1273 | - | let ik = (bO() + (if ((ij > 0)) | |
1274 | - | then ih | |
1275 | - | else 0)) | |
1276 | - | let il = (bN() + (if ((0 > ij)) | |
1277 | - | then ih | |
1278 | - | else 0)) | |
1279 | - | let im = dh(fZ, hZ, ib, hk) | |
1280 | - | let dq = im._1 | |
1281 | - | let ek = im._2 | |
1282 | - | let el = im._3 | |
1283 | - | if (!(dS(cU, cV))) | |
1284 | - | then throw("Over max spread limit") | |
1285 | - | else if (!(dW(ik, il))) | |
1286 | - | then throw("Over max open notional") | |
1287 | - | else $Tuple12(ij, dq, (ia + ih), co(ij), cV, cU, eS, (bM() + ih), (cd() + (if ((ij > 0)) | |
1288 | - | then bc(cX) | |
1289 | - | else 0)), (cc() + (if ((0 > ij)) | |
1290 | - | then bc(cX) | |
1291 | - | else 0)), ik, il) | |
1400 | + | let iR = gP(dc) | |
1401 | + | let gR = iR._1 | |
1402 | + | let gS = iR._2 | |
1403 | + | let iS = invoke(as(), "withdrawLocked", [gR], nil) | |
1404 | + | if ((iS == iS)) | |
1405 | + | then { | |
1406 | + | let iT = invoke(as(), "exchangeFreeAndLocked", [-(gS)], nil) | |
1407 | + | if ((iT == iT)) | |
1408 | + | then hO(gR) | |
1409 | + | else throw("Strict value is not equal to itself.") | |
1292 | 1410 | } | |
1293 | - | } | |
1294 | - | else { | |
1295 | - | let ih = aV(hk, hF) | |
1296 | - | let in = eq(toString(ci.caller), aP) | |
1297 | - | let io = in._1 | |
1298 | - | let ep = in._2 | |
1299 | - | if ((io > ih)) | |
1300 | - | then throw("Use decreasePosition to decrease position size") | |
1301 | - | else throw("Close position first") | |
1302 | - | } | |
1303 | - | let ij = ig._1 | |
1304 | - | let ip = ig._2 | |
1305 | - | let iq = ig._3 | |
1306 | - | let ir = ig._4 | |
1307 | - | let cV = ig._5 | |
1308 | - | let cU = ig._6 | |
1309 | - | let eS = ig._7 | |
1310 | - | let eV = ig._8 | |
1311 | - | let eT = ig._9 | |
1312 | - | let eU = ig._10 | |
1313 | - | let ik = ig._11 | |
1314 | - | let il = ig._12 | |
1315 | - | let is = gn(hX) | |
1316 | - | let gp = is._1 | |
1317 | - | let gq = is._2 | |
1318 | - | let it = if (hL) | |
1319 | - | then { | |
1320 | - | let it = invoke(at(), "addLocked", [false], [AttachedPayment(aq(), hk)]) | |
1321 | - | if ((it == it)) | |
1322 | - | then nil | |
1323 | 1411 | else throw("Strict value is not equal to itself.") | |
1324 | 1412 | } | |
1325 | 1413 | else nil | |
1326 | - | if ((it == it)) | |
1327 | - | then { | |
1328 | - | let iu = invoke(at(), "addFree", nil, [AttachedPayment(aq(), gq)]) | |
1329 | - | if ((iu == iu)) | |
1414 | + | if ((iQ == iQ)) | |
1415 | + | then ((hp(ca, eM, ((eN - dc) + hL), eO, eP, bP()) ++ hN(((bl() + hL) - dc))) ++ iQ) | |
1416 | + | else throw("Strict value is not equal to itself.") | |
1417 | + | } | |
1418 | + | else throw("Strict value is not equal to itself.") | |
1419 | + | } | |
1420 | + | } | |
1421 | + | else throw("Strict value is not equal to itself.") | |
1422 | + | } | |
1423 | + | else throw("Strict value is not equal to itself.") | |
1424 | + | } | |
1425 | + | ||
1426 | + | ||
1427 | + | ||
1428 | + | @Callable(bR) | |
1429 | + | func removeMargin (hL) = { | |
1430 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1431 | + | if ((ii == ii)) | |
1432 | + | then { | |
1433 | + | let ij = invoke(this, "ensureCalledOnce", nil, nil) | |
1434 | + | if ((ij == ij)) | |
1435 | + | then { | |
1436 | + | let ca = toString(bR.caller) | |
1437 | + | if (if (if (if (if ((0 >= hL)) | |
1438 | + | then true | |
1439 | + | else !(ck(ca))) | |
1440 | + | then true | |
1441 | + | else !(ct())) | |
1442 | + | then true | |
1443 | + | else cu()) | |
1444 | + | then true | |
1445 | + | else dK()) | |
1446 | + | then throw("Invalid removeMargin parameters") | |
1447 | + | else { | |
1448 | + | let iU = bZ(ca) | |
1449 | + | let eM = iU._1 | |
1450 | + | let eN = iU._2 | |
1451 | + | let eO = iU._3 | |
1452 | + | let eP = iU._4 | |
1453 | + | let eQ = iU._5 | |
1454 | + | let iV = dd(eM, eN, eP, eQ, -(hL)) | |
1455 | + | let dl = iV._1 | |
1456 | + | let dm = iV._2 | |
1457 | + | let dh = iV._3 | |
1458 | + | let dc = iV._4 | |
1459 | + | if ((dm != 0)) | |
1460 | + | then throw("Invalid removed margin amount") | |
1461 | + | else { | |
1462 | + | let fp = ep(dl, dm, eO) | |
1463 | + | if (!(bS(fp, bo(), true))) | |
1464 | + | then throw(((("Too much margin removed: " + toString(fp)) + " < ") + toString(bo()))) | |
1465 | + | else { | |
1466 | + | let iW = gP(dc) | |
1467 | + | let gR = iW._1 | |
1468 | + | let gS = iW._2 | |
1469 | + | let iQ = if ((dc > 0)) | |
1330 | 1470 | then { | |
1331 | - | let iv = invoke(au(), "notifyFees", [cr, hX], nil) | |
1332 | - | if ((iv == iv)) | |
1333 | - | then { | |
1334 | - | let iw = invoke(au(), "notifyNotional", [cr, iq], nil) | |
1335 | - | if ((iw == iw)) | |
1336 | - | then (((((((gO(cr, ij, ip, iq, ir) ++ gK(ic, cr)) ++ gN(ic, cr, fW)) ++ gJ(cr, hK)) ++ hb(cU, cV, eS, eV, eT, eU, ik, il)) ++ hn(gp)) ++ hm((bE() + hk))) ++ ho(fX, ci)) | |
1337 | - | else throw("Strict value is not equal to itself.") | |
1338 | - | } | |
1471 | + | let iT = invoke(as(), "exchangeFreeAndLocked", [-(gS)], nil) | |
1472 | + | if ((iT == iT)) | |
1473 | + | then hO(gR) | |
1339 | 1474 | else throw("Strict value is not equal to itself.") | |
1340 | 1475 | } | |
1476 | + | else nil | |
1477 | + | if ((iQ == iQ)) | |
1478 | + | then { | |
1479 | + | let iS = invoke(as(), "withdrawLocked", [(hL + gR)], nil) | |
1480 | + | if ((iS == iS)) | |
1481 | + | then (((hp(ca, eM, dl, eO, bX(eM), bP()) ++ hK(bR.caller, hL)) ++ hN(((bl() - hL) - dc))) ++ iQ) | |
1482 | + | else throw("Strict value is not equal to itself.") | |
1483 | + | } | |
1484 | + | else throw("Strict value is not equal to itself.") | |
1485 | + | } | |
1486 | + | } | |
1487 | + | } | |
1488 | + | } | |
1489 | + | else throw("Strict value is not equal to itself.") | |
1490 | + | } | |
1491 | + | else throw("Strict value is not equal to itself.") | |
1492 | + | } | |
1493 | + | ||
1494 | + | ||
1495 | + | ||
1496 | + | @Callable(bR) | |
1497 | + | func closePosition (eH,eJ,eK) = { | |
1498 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1499 | + | if ((ii == ii)) | |
1500 | + | then { | |
1501 | + | let ij = invoke(this, "ensureCalledOnce", nil, nil) | |
1502 | + | if ((ij == ij)) | |
1503 | + | then { | |
1504 | + | let ca = bQ(bR) | |
1505 | + | let iX = valueOrErrorMessage(addressFromString(ca), "Invalid caller") | |
1506 | + | let cj = ch(ca) | |
1507 | + | if (if (if (if (if (if (!(ck(ca))) | |
1508 | + | then true | |
1509 | + | else !(ct())) | |
1510 | + | then true | |
1511 | + | else cu()) | |
1512 | + | then true | |
1513 | + | else (0 >= eH)) | |
1514 | + | then true | |
1515 | + | else (0 > eJ)) | |
1516 | + | then true | |
1517 | + | else dK()) | |
1518 | + | then throw("Invalid closePosition parameters") | |
1519 | + | else { | |
1520 | + | let eQ = bZ(ca)._5 | |
1521 | + | let iY = eG(ca, eH, cj, eJ, eK, true) | |
1522 | + | let fk = iY._1 | |
1523 | + | let ft = iY._2 | |
1524 | + | let fm = iY._3 | |
1525 | + | let fn = iY._4 | |
1526 | + | let fg = iY._5 | |
1527 | + | let fb = iY._6 | |
1528 | + | let fs = iY._7 | |
1529 | + | let cL = iY._8 | |
1530 | + | let cM = iY._9 | |
1531 | + | let eW = iY._10 | |
1532 | + | let iH = iY._11 | |
1533 | + | let iI = iY._12 | |
1534 | + | let iJ = iY._13 | |
1535 | + | let iA = iY._14 | |
1536 | + | let iB = iY._15 | |
1537 | + | let iZ = iY._16 | |
1538 | + | if ((fg > 0)) | |
1539 | + | then throw("Invalid closePosition parameters: bad debt") | |
1540 | + | else if ((eQ >= bP())) | |
1541 | + | then throw("Invalid closePosition parameters: wait at least 1 block before closing the position") | |
1542 | + | else { | |
1543 | + | let eT = (fk != 0) | |
1544 | + | let ja = (fs + iZ) | |
1545 | + | let jb = (bl() - ja) | |
1546 | + | let jc = if ((0 > jb)) | |
1547 | + | then 0 | |
1548 | + | else jb | |
1549 | + | let iS = invoke(as(), "withdrawLocked", [ja], nil) | |
1550 | + | if ((iS == iS)) | |
1551 | + | then { | |
1552 | + | let jd = gP(iZ) | |
1553 | + | let gR = jd._1 | |
1554 | + | let gS = jd._2 | |
1555 | + | let iM = invoke(as(), "addFree", nil, [AttachedPayment(ap(), gS)]) | |
1556 | + | if ((iM == iM)) | |
1557 | + | then { | |
1558 | + | let iN = invoke(at(), "notifyFees", [ca, iZ], nil) | |
1559 | + | if ((iN == iN)) | |
1560 | + | then { | |
1561 | + | let iO = invoke(at(), "notifyNotional", [ca, fm], nil) | |
1562 | + | if ((iO == iO)) | |
1563 | + | then (((((if (eT) | |
1564 | + | then hp(ca, fk, ft, fm, fn, bP()) | |
1565 | + | else hJ(ca)) ++ hC(cL, cM, eW, iH, iI, iJ, iA, iB)) ++ (if ((fs > 0)) | |
1566 | + | then hK(iX, fs) | |
1567 | + | else nil)) ++ hN(jc)) ++ hO(gR)) | |
1568 | + | else throw("Strict value is not equal to itself.") | |
1569 | + | } | |
1570 | + | else throw("Strict value is not equal to itself.") | |
1571 | + | } | |
1572 | + | else throw("Strict value is not equal to itself.") | |
1573 | + | } | |
1574 | + | else throw("Strict value is not equal to itself.") | |
1575 | + | } | |
1576 | + | } | |
1577 | + | } | |
1578 | + | else throw("Strict value is not equal to itself.") | |
1579 | + | } | |
1580 | + | else throw("Strict value is not equal to itself.") | |
1581 | + | } | |
1582 | + | ||
1583 | + | ||
1584 | + | ||
1585 | + | @Callable(bR) | |
1586 | + | func liquidate (ca) = { | |
1587 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1588 | + | if ((ii == ii)) | |
1589 | + | then { | |
1590 | + | let je = et(ca, aI) | |
1591 | + | let jf = if (dZ()) | |
1592 | + | then { | |
1593 | + | let jg = et(ca, aJ) | |
1594 | + | aW(je, jg) | |
1595 | + | } | |
1596 | + | else je | |
1597 | + | if (if (if (if (if (!(bS(jf, bB(), false))) | |
1598 | + | then true | |
1599 | + | else !(ck(ca))) | |
1600 | + | then true | |
1601 | + | else !(ct())) | |
1602 | + | then true | |
1603 | + | else cu()) | |
1604 | + | then true | |
1605 | + | else dK()) | |
1606 | + | then throw("Unable to liquidate") | |
1607 | + | else { | |
1608 | + | let jh = if (if ((je > bC())) | |
1609 | + | then true | |
1610 | + | else (bD() > 0)) | |
1611 | + | then true | |
1612 | + | else (aF > bD()) | |
1613 | + | let eM = bZ(ca)._1 | |
1614 | + | let ed = aV(eM) | |
1615 | + | let ji = if (jh) | |
1616 | + | then { | |
1617 | + | let jj = eB(ca, eM) | |
1618 | + | let jk = aM(aV(jj), ed) | |
1619 | + | $Tuple2(jk, aV(jj)) | |
1620 | + | } | |
1621 | + | else $Tuple2(0, ed) | |
1622 | + | let jk = ji._1 | |
1623 | + | let jj = ji._2 | |
1624 | + | let jl = eG(ca, if (jh) | |
1625 | + | then jj | |
1626 | + | else ed, bC(), 0, true, false) | |
1627 | + | let fk = jl._1 | |
1628 | + | let ft = jl._2 | |
1629 | + | let fm = jl._3 | |
1630 | + | let fn = jl._4 | |
1631 | + | let fg = jl._5 | |
1632 | + | let fb = jl._6 | |
1633 | + | let fs = jl._7 | |
1634 | + | let cL = jl._8 | |
1635 | + | let cM = jl._9 | |
1636 | + | let eW = jl._10 | |
1637 | + | let iH = jl._11 | |
1638 | + | let iI = jl._12 | |
1639 | + | let iJ = jl._13 | |
1640 | + | let iA = jl._14 | |
1641 | + | let iB = jl._15 | |
1642 | + | let jm = jl._16 | |
1643 | + | let jn = (jm / 2) | |
1644 | + | let gS = (jm - jn) | |
1645 | + | let jb = (bl() - jm) | |
1646 | + | let jo = if ((0 > jb)) | |
1647 | + | then 0 | |
1648 | + | else jb | |
1649 | + | let iT = if ((fg > 0)) | |
1650 | + | then { | |
1651 | + | let iT = invoke(as(), "exchangeFreeAndLocked", [fg], nil) | |
1652 | + | if ((iT == iT)) | |
1653 | + | then nil | |
1654 | + | else throw("Strict value is not equal to itself.") | |
1655 | + | } | |
1656 | + | else nil | |
1657 | + | if ((iT == iT)) | |
1658 | + | then { | |
1659 | + | let iS = invoke(as(), "withdrawLocked", [jm], nil) | |
1660 | + | if ((iS == iS)) | |
1661 | + | then { | |
1662 | + | let jp = invoke(as(), "addFree", nil, [AttachedPayment(ap(), gS)]) | |
1663 | + | if ((jp == jp)) | |
1664 | + | then { | |
1665 | + | let iO = invoke(at(), "notifyNotional", [ca, fm], nil) | |
1666 | + | if ((iO == iO)) | |
1667 | + | then ((((if (jh) | |
1668 | + | then hp(ca, fk, ft, fm, fn, bP()) | |
1669 | + | else hJ(ca)) ++ hC(cL, cM, eW, iH, iI, iJ, iA, iB)) ++ hK(bR.caller, jn)) ++ hN(jo)) | |
1341 | 1670 | else throw("Strict value is not equal to itself.") | |
1342 | 1671 | } | |
1343 | 1672 | else throw("Strict value is not equal to itself.") | |
1352 | 1681 | ||
1353 | 1682 | ||
1354 | 1683 | ||
1355 | - | @Callable( | |
1356 | - | func | |
1357 | - | let | |
1358 | - | if (( | |
1684 | + | @Callable(bR) | |
1685 | + | func payFunding () = { | |
1686 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1687 | + | if ((ii == ii)) | |
1359 | 1688 | then { | |
1360 | - | let cr = toString(ci.caller) | |
1361 | - | let hk = ci.payments[0].amount | |
1362 | - | let aC = ci.payments[0].assetId | |
1363 | - | let hK = toBase58String(value(aC)) | |
1364 | - | let hL = (aC == aq()) | |
1365 | - | let hM = aB(hK) | |
1366 | - | if (if (if (if (if (if (if (if (!(hL)) | |
1367 | - | then !(hM) | |
1368 | - | else false) | |
1689 | + | let jq = bx() | |
1690 | + | if (if (if ((jq > bP())) | |
1369 | 1691 | then true | |
1370 | - | else !( | |
1692 | + | else !(ct())) | |
1371 | 1693 | then true | |
1372 | - | else !(ga(cr, hK))) | |
1373 | - | then true | |
1374 | - | else !(cC())) | |
1375 | - | then true | |
1376 | - | else cD()) | |
1377 | - | then true | |
1378 | - | else cE()) | |
1379 | - | then true | |
1380 | - | else dL()) | |
1381 | - | then throw("Invalid addMargin parameters") | |
1694 | + | else cu()) | |
1695 | + | then throw(((("Invalid funding block timestamp: " + toString(bP())) + " < ") + toString(jq))) | |
1382 | 1696 | else { | |
1383 | - | let ix = cq(cr) | |
1384 | - | let fZ = ix._1 | |
1385 | - | let hZ = ix._2 | |
1386 | - | let ia = ix._3 | |
1387 | - | let ib = ix._4 | |
1388 | - | let it = if (hL) | |
1389 | - | then { | |
1390 | - | let it = invoke(at(), "addLocked", [false], [AttachedPayment(aq(), hk)]) | |
1391 | - | if ((it == it)) | |
1392 | - | then nil | |
1393 | - | else throw("Strict value is not equal to itself.") | |
1394 | - | } | |
1395 | - | else nil | |
1396 | - | if ((it == it)) | |
1397 | - | then (gO(cr, fZ, (hZ + hk), ia, ib) ++ hm((bE() + hk))) | |
1398 | - | else throw("Strict value is not equal to itself.") | |
1697 | + | let gq = dE() | |
1698 | + | let jr = gp() | |
1699 | + | let gt = jr._1 | |
1700 | + | let gu = jr._2 | |
1701 | + | hf((jq + bA()), (bI() + gu), (bJ() + gt), aM(gu, gq), aM(gt, gq)) | |
1399 | 1702 | } | |
1400 | 1703 | } | |
1401 | 1704 | else throw("Strict value is not equal to itself.") | |
1403 | 1706 | ||
1404 | 1707 | ||
1405 | 1708 | ||
1406 | - | @Callable(ci) | |
1407 | - | func removeMargin (hk) = { | |
1408 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1409 | - | if ((hI == hI)) | |
1709 | + | @Callable(bR) | |
1710 | + | func syncTerminalPriceToOracle () = { | |
1711 | + | let cD = bp() | |
1712 | + | let cE = bq() | |
1713 | + | let js = gk(dE(), cD, cE) | |
1714 | + | let hW = js._1 | |
1715 | + | let hX = js._2 | |
1716 | + | let go = js._3 | |
1717 | + | let hY = if ((go != 0)) | |
1410 | 1718 | then { | |
1411 | - | let cr = toString(ci.caller) | |
1412 | - | if (if (if (if (if ((0 >= hk)) | |
1413 | - | then true | |
1414 | - | else !(cB(cr))) | |
1415 | - | then true | |
1416 | - | else !(cC())) | |
1417 | - | then true | |
1418 | - | else cD()) | |
1419 | - | then true | |
1420 | - | else dL()) | |
1421 | - | then throw("Invalid removeMargin parameters") | |
1422 | - | else { | |
1423 | - | let iy = cq(cr) | |
1424 | - | let fZ = iy._1 | |
1425 | - | let hZ = iy._2 | |
1426 | - | let ia = iy._3 | |
1427 | - | let ib = iy._4 | |
1428 | - | let iz = -(hk) | |
1429 | - | let iA = dh(fZ, hZ, ib, iz) | |
1430 | - | let dq = iA._1 | |
1431 | - | let dr = iA._2 | |
1432 | - | if ((dr != 0)) | |
1433 | - | then throw("Invalid removed margin amount") | |
1434 | - | else { | |
1435 | - | let iB = ev(dq, dr, ia) | |
1436 | - | if (!(cj(iB, bG(), true))) | |
1437 | - | then throw(((("Too much margin removed: " + toString(iB)) + " < ") + toString(bG()))) | |
1438 | - | else { | |
1439 | - | let iC = toBase58String(aq()) | |
1440 | - | let iD = gd(cr) | |
1441 | - | let iE = iD._1 | |
1442 | - | let iF = iD._2 | |
1443 | - | let iG = if ((hk > iE)) | |
1444 | - | then iE | |
1445 | - | else hk | |
1446 | - | let iH = if ((iE > hk)) | |
1447 | - | then 0 | |
1448 | - | else (hk - iE) | |
1449 | - | let iI = (iE - iG) | |
1450 | - | let iJ = if ((iI > 0)) | |
1451 | - | then nil | |
1452 | - | else gJ(cr, iC) | |
1453 | - | let iK = if (((iG + iH) != hk)) | |
1454 | - | then throw(((((("toRepay=" + toString(iG)) + " + toWithdraw=") + toString(iH)) + " != ") + toString(hk))) | |
1455 | - | else nil | |
1456 | - | if ((iK == iK)) | |
1457 | - | then { | |
1458 | - | let iL = if ((iH > 0)) | |
1459 | - | then { | |
1460 | - | let iL = invoke(at(), "withdrawLocked", [iH], nil) | |
1461 | - | if ((iL == iL)) | |
1462 | - | then nil | |
1463 | - | else throw("Strict value is not equal to itself.") | |
1464 | - | } | |
1465 | - | else nil | |
1466 | - | if ((iL == iL)) | |
1467 | - | then { | |
1468 | - | let iM = if ((iG > 0)) | |
1469 | - | then { | |
1470 | - | let iN = invoke(ay(), "repay", [cr, iG, iF], nil) | |
1471 | - | if ((iN == iN)) | |
1472 | - | then [ScriptTransfer(ci.caller, iG, fromBase58String(iF))] | |
1473 | - | else throw("Strict value is not equal to itself.") | |
1474 | - | } | |
1475 | - | else nil | |
1476 | - | if ((iM == iM)) | |
1477 | - | then ((((gO(cr, fZ, dq, ia, co(fZ)) ++ (if ((iH > 0)) | |
1478 | - | then hj(ci.caller, iH) | |
1479 | - | else nil)) ++ hm((bE() - hk))) ++ iJ) ++ iM) | |
1480 | - | else throw("Strict value is not equal to itself.") | |
1481 | - | } | |
1482 | - | else throw("Strict value is not equal to itself.") | |
1483 | - | } | |
1484 | - | else throw("Strict value is not equal to itself.") | |
1485 | - | } | |
1486 | - | } | |
1487 | - | } | |
1719 | + | let hY = invoke(as(), "exchangeFreeAndLocked", [go], nil) | |
1720 | + | if ((hY == hY)) | |
1721 | + | then nil | |
1722 | + | else throw("Strict value is not equal to itself.") | |
1723 | + | } | |
1724 | + | else nil | |
1725 | + | if ((hY == hY)) | |
1726 | + | then ((hN((bl() + go)) ++ hB(hW, hX)) ++ ht(aM(aO(cD, hW), aO(cE, hX)))) | |
1727 | + | else throw("Strict value is not equal to itself.") | |
1728 | + | } | |
1729 | + | ||
1730 | + | ||
1731 | + | ||
1732 | + | @Callable(bR) | |
1733 | + | func ensureCalledOnce () = if ((bR.caller != this)) | |
1734 | + | then throw("Invalid saveCurrentTxId parameters") | |
1735 | + | else { | |
1736 | + | let jt = valueOrElse(getString(this, W), "") | |
1737 | + | if ((jt != toBase58String(bR.transactionId))) | |
1738 | + | then [StringEntry(W, jt)] | |
1739 | + | else throw("Can not call vAMM methods twice in one tx") | |
1740 | + | } | |
1741 | + | ||
1742 | + | ||
1743 | + | ||
1744 | + | @Callable(bR) | |
1745 | + | func view_calcRemainMarginWithFundingPayment (ca) = { | |
1746 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1747 | + | if ((ii == ii)) | |
1748 | + | then { | |
1749 | + | let ju = bZ(ca) | |
1750 | + | let cd = ju._1 | |
1751 | + | let em = ju._2 | |
1752 | + | let ev = ju._3 | |
1753 | + | let eo = ju._4 | |
1754 | + | let ex = ju._5 | |
1755 | + | let jv = ek(ca, aI) | |
1756 | + | let ef = jv._1 | |
1757 | + | let ej = jv._2 | |
1758 | + | let jw = dd(cd, em, eo, ex, ej) | |
1759 | + | let dl = jw._1 | |
1760 | + | let dm = jw._2 | |
1761 | + | let dh = jw._3 | |
1762 | + | let dc = jw._4 | |
1763 | + | throw(((((((aK(dl) + aK(dh)) + aK(eA(ca))) + aK(ej)) + aK(dm)) + aK(ef)) + aK(dc))) | |
1488 | 1764 | } | |
1489 | 1765 | else throw("Strict value is not equal to itself.") | |
1490 | 1766 | } | |
1491 | 1767 | ||
1492 | 1768 | ||
1493 | 1769 | ||
1494 | - | @Callable(ci) | |
1495 | - | func closePosition (gP,iO,iP) = { | |
1496 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1497 | - | if ((hI == hI)) | |
1770 | + | @Callable(bR) | |
1771 | + | func view_getPegAdjustCost (hu) = { | |
1772 | + | let cD = bp() | |
1773 | + | let cE = bq() | |
1774 | + | let gj = gk(hu, cD, cE) | |
1775 | + | throw(toString(gj._3)) | |
1776 | + | } | |
1777 | + | ||
1778 | + | ||
1779 | + | ||
1780 | + | @Callable(bR) | |
1781 | + | func view_getTerminalAmmPrice () = { | |
1782 | + | let jx = fS() | |
1783 | + | let fW = jx._1 | |
1784 | + | let fX = jx._2 | |
1785 | + | let hR = aM(aO(fW, br()), aO(fX, bs())) | |
1786 | + | throw(toString(hR)) | |
1787 | + | } | |
1788 | + | ||
1789 | + | ||
1790 | + | ||
1791 | + | @Callable(bR) | |
1792 | + | func view_getFunding () = { | |
1793 | + | let gq = dE() | |
1794 | + | let jy = gp() | |
1795 | + | let gt = jy._1 | |
1796 | + | let gu = jy._2 | |
1797 | + | let jz = aM(gu, gq) | |
1798 | + | let jA = aM(gt, gq) | |
1799 | + | throw((((aK(jz) + aK(jA)) + aK(fu())) + aK(dE()))) | |
1800 | + | } | |
1801 | + | ||
1802 | + | ||
1803 | + | ||
1804 | + | @Callable(bR) | |
1805 | + | func computeSpotPrice () = { | |
1806 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1807 | + | if ((ii == ii)) | |
1498 | 1808 | then { | |
1499 | - | let cr = ch(ci) | |
1500 | - | let iQ = valueOrErrorMessage(addressFromString(cr), "Invalid caller") | |
1501 | - | let cA = cy(cr) | |
1502 | - | if (if (if (if (if (if (!(cB(cr))) | |
1503 | - | then true | |
1504 | - | else !(cC())) | |
1505 | - | then true | |
1506 | - | else cD()) | |
1507 | - | then true | |
1508 | - | else (0 >= gP)) | |
1509 | - | then true | |
1510 | - | else (0 > iO)) | |
1511 | - | then true | |
1512 | - | else dL()) | |
1513 | - | then throw("Invalid closePosition parameters") | |
1514 | - | else { | |
1515 | - | let iR = cq(cr) | |
1516 | - | let fZ = iR._1 | |
1517 | - | let hZ = iR._2 | |
1518 | - | let ia = iR._3 | |
1519 | - | let ib = iR._4 | |
1520 | - | let iS = if ((bc(fZ) > gP)) | |
1521 | - | then { | |
1522 | - | let hE = if ((fZ > 0)) | |
1523 | - | then aH | |
1524 | - | else aG | |
1525 | - | let if = (hE == aG) | |
1526 | - | let iT = dD((fZ > 0), gP, true) | |
1527 | - | let eL = iT._1 | |
1528 | - | let cU = iT._2 | |
1529 | - | let cV = iT._3 | |
1530 | - | let eS = iT._4 | |
1531 | - | let eK = if ((fZ > 0)) | |
1532 | - | then -(gP) | |
1533 | - | else gP | |
1534 | - | let iU = eq(cr, aP) | |
1535 | - | let io = iU._1 | |
1536 | - | let ep = iU._2 | |
1537 | - | let iV = ez(cr, aP) | |
1538 | - | let iW = aT(bc(eK), bc(fZ)) | |
1539 | - | let eP = aV(ep, iW) | |
1540 | - | let iX = aV(aV(io, iW), cA) | |
1541 | - | let iY = dh(fZ, hZ, ib, ep)._1 | |
1542 | - | let iZ = dh(fZ, hZ, ib, eP)._2 | |
1543 | - | let ja = (ep - eP) | |
1544 | - | let jb = if ((fZ > 0)) | |
1545 | - | then ((io - eL) - ja) | |
1546 | - | else ((ja + io) - eL) | |
1547 | - | let iq = bc(jb) | |
1548 | - | let ij = (fZ + eK) | |
1549 | - | let jc = co(ij) | |
1550 | - | let jd = (ia - iq) | |
1551 | - | let eV = (bM() - jd) | |
1552 | - | let je = if ((fZ > 0)) | |
1553 | - | then (aV((iq + ja), iV) - ja) | |
1554 | - | else (aV((iq - ja), iV) - ja) | |
1555 | - | let jf = ((iY - (je + ja)) - iX) | |
1556 | - | let jg = if ((0 > jf)) | |
1557 | - | then throw("Margin error: unable to pay close fee") | |
1558 | - | else jf | |
1559 | - | if (if ((iO != 0)) | |
1560 | - | then (iO > eL) | |
1561 | - | else false) | |
1562 | - | then throw(((("Limit error: " + toString(eL)) + " < ") + toString(iO))) | |
1563 | - | else $Tuple16(ij, if (iP) | |
1564 | - | then (je + jg) | |
1565 | - | else je, iq, jc, iZ, eP, if (iP) | |
1566 | - | then 0 | |
1567 | - | else jg, cU, cV, eS, eV, (cd() - (if ((ij > 0)) | |
1568 | - | then bc(eK) | |
1569 | - | else 0)), (cc() - (if ((0 > ij)) | |
1570 | - | then bc(eK) | |
1571 | - | else 0)), (bO() - (if ((ij > 0)) | |
1572 | - | then jd | |
1573 | - | else 0)), (bN() - (if ((0 > ij)) | |
1574 | - | then jd | |
1575 | - | else 0)), iX) | |
1576 | - | } | |
1577 | - | else if ((gP > bc(fZ))) | |
1578 | - | then throw("Invalid closePosition parameters") | |
1579 | - | else { | |
1580 | - | let jh = eM(cr, true) | |
1581 | - | let el = jh._1 | |
1582 | - | let iZ = jh._2 | |
1583 | - | let eP = jh._3 | |
1584 | - | let ji = jh._4 | |
1585 | - | let cU = jh._5 | |
1586 | - | let cV = jh._6 | |
1587 | - | let eS = jh._7 | |
1588 | - | let eV = jh._8 | |
1589 | - | let eL = jh._9 | |
1590 | - | let eT = jh._10 | |
1591 | - | let eU = jh._11 | |
1592 | - | let ik = jh._12 | |
1593 | - | let il = jh._13 | |
1594 | - | let iX = aV(eL, cA) | |
1595 | - | let jf = (bc(ji) - iX) | |
1596 | - | let jg = if ((0 > jf)) | |
1597 | - | then throw(((((((("Margin error: unable to pay close fee: " + toString(iX)) + " margin: ") + toString(ji)) + " fee percent: ") + toString(cA)) + " notional: ") + toString(eL))) | |
1598 | - | else jf | |
1599 | - | if (if ((iO != 0)) | |
1600 | - | then (iO > eL) | |
1601 | - | else false) | |
1602 | - | then throw(((("Limit error: " + toString(eL)) + " < ") + toString(iO))) | |
1603 | - | else $Tuple16(0, 0, 0, 0, iZ, eP, jg, cU, cV, eS, eV, eT, eU, ik, il, iX) | |
1604 | - | } | |
1605 | - | let ij = iS._1 | |
1606 | - | let je = iS._2 | |
1607 | - | let iq = iS._3 | |
1608 | - | let jc = iS._4 | |
1609 | - | let iZ = iS._5 | |
1610 | - | let eP = iS._6 | |
1611 | - | let jg = iS._7 | |
1612 | - | let cU = iS._8 | |
1613 | - | let cV = iS._9 | |
1614 | - | let eS = iS._10 | |
1615 | - | let eV = iS._11 | |
1616 | - | let eT = iS._12 | |
1617 | - | let eU = iS._13 | |
1618 | - | let ik = iS._14 | |
1619 | - | let il = iS._15 | |
1620 | - | let iX = iS._16 | |
1621 | - | if ((iZ > 0)) | |
1622 | - | then throw("Unable to close position with bad debt") | |
1623 | - | else { | |
1624 | - | let jj = (ij != 0) | |
1625 | - | let jk = (jg + iX) | |
1626 | - | let jl = (bE() - jk) | |
1627 | - | let jm = if ((0 > jl)) | |
1628 | - | then $Tuple2(0, bc(jl)) | |
1629 | - | else $Tuple2(jl, 0) | |
1630 | - | let jn = jm._1 | |
1631 | - | let jo = jm._2 | |
1632 | - | let jp = gd(cr) | |
1633 | - | let iE = jp._1 | |
1634 | - | let iF = jp._2 | |
1635 | - | let jq = if ((iE > 0)) | |
1636 | - | then if ((jk >= iE)) | |
1637 | - | then { | |
1638 | - | let iN = invoke(ay(), "repay", [cr, iE, iF], nil) | |
1639 | - | if ((iN == iN)) | |
1640 | - | then $Tuple3(iE, (jk - iE), jj) | |
1641 | - | else throw("Strict value is not equal to itself.") | |
1642 | - | } | |
1643 | - | else { | |
1644 | - | let jr = invoke(ay(), if (jj) | |
1645 | - | then "repay" | |
1646 | - | else "realizePartiallyAndClose", [cr, jk, iF], nil) | |
1647 | - | if ((jr == jr)) | |
1648 | - | then $Tuple3(jk, 0, false) | |
1649 | - | else throw("Strict value is not equal to itself.") | |
1650 | - | } | |
1651 | - | else $Tuple3(0, jk, false) | |
1652 | - | if ((jq == jq)) | |
1653 | - | then { | |
1654 | - | let js = jq._3 | |
1655 | - | let jt = jq._2 | |
1656 | - | let ju = jq._1 | |
1657 | - | let jv = if ((jt >= iX)) | |
1658 | - | then $Tuple3(ju, (jt - iX), iX) | |
1659 | - | else { | |
1660 | - | let jw = (iX - jt) | |
1661 | - | let jx = (ju - jw) | |
1662 | - | let hR = assetBalance(this, aq()) | |
1663 | - | if ((hR == hR)) | |
1664 | - | then { | |
1665 | - | let hS = invoke(az(), "swap", [toBase58String(aq()), 0], [AttachedPayment(fromBase58String(iF), jw)]) | |
1666 | - | if ((hS == hS)) | |
1667 | - | then { | |
1668 | - | let hT = assetBalance(this, aq()) | |
1669 | - | if ((hT == hT)) | |
1670 | - | then { | |
1671 | - | let hU = (hT - hR) | |
1672 | - | if ((hU == hU)) | |
1673 | - | then $Tuple3(jx, 0, (jt + hU)) | |
1674 | - | else throw("Strict value is not equal to itself.") | |
1675 | - | } | |
1676 | - | else throw("Strict value is not equal to itself.") | |
1677 | - | } | |
1678 | - | else throw("Strict value is not equal to itself.") | |
1679 | - | } | |
1680 | - | else throw("Strict value is not equal to itself.") | |
1681 | - | } | |
1682 | - | if ((jv == jv)) | |
1683 | - | then { | |
1684 | - | let jy = jv._3 | |
1685 | - | let jz = jv._2 | |
1686 | - | let jx = jv._1 | |
1687 | - | let jA = if ((jt > 0)) | |
1688 | - | then { | |
1689 | - | let jA = invoke(at(), "withdrawLocked", [jt], nil) | |
1690 | - | if ((jA == jA)) | |
1691 | - | then nil | |
1692 | - | else throw("Strict value is not equal to itself.") | |
1693 | - | } | |
1694 | - | else nil | |
1695 | - | if ((jA == jA)) | |
1696 | - | then { | |
1697 | - | let jB = gn(jy) | |
1698 | - | let gp = jB._1 | |
1699 | - | let gq = jB._2 | |
1700 | - | let iu = invoke(at(), "addFree", nil, [AttachedPayment(aq(), gq)]) | |
1701 | - | if ((iu == iu)) | |
1702 | - | then { | |
1703 | - | let iv = invoke(au(), "notifyFees", [cr, iX], nil) | |
1704 | - | if ((iv == iv)) | |
1705 | - | then { | |
1706 | - | let iw = invoke(au(), "notifyNotional", [cr, iq], nil) | |
1707 | - | if ((iw == iw)) | |
1708 | - | then (((((((if (jj) | |
1709 | - | then gO(cr, ij, je, iq, jc) | |
1710 | - | else hi(cr)) ++ (if (js) | |
1711 | - | then { | |
1712 | - | let iC = toBase58String(aq()) | |
1713 | - | gJ(cr, iC) | |
1714 | - | } | |
1715 | - | else nil)) ++ hb(cU, cV, eS, eV, eT, eU, ik, il)) ++ hn(gp)) ++ (if ((jz > 0)) | |
1716 | - | then hj(iQ, jz) | |
1717 | - | else nil)) ++ hm(jn)) ++ (if ((jx > 0)) | |
1718 | - | then [ScriptTransfer(iQ, jx, fromBase58String(iF))] | |
1719 | - | else nil)) | |
1720 | - | else throw("Strict value is not equal to itself.") | |
1721 | - | } | |
1722 | - | else throw("Strict value is not equal to itself.") | |
1723 | - | } | |
1724 | - | else throw("Strict value is not equal to itself.") | |
1725 | - | } | |
1726 | - | else throw("Strict value is not equal to itself.") | |
1727 | - | } | |
1728 | - | else throw("Strict value is not equal to itself.") | |
1729 | - | } | |
1730 | - | else throw("Strict value is not equal to itself.") | |
1731 | - | } | |
1732 | - | } | |
1809 | + | let gj = dY() | |
1810 | + | $Tuple2(nil, gj) | |
1733 | 1811 | } | |
1734 | 1812 | else throw("Strict value is not equal to itself.") | |
1735 | 1813 | } | |
1736 | 1814 | ||
1737 | 1815 | ||
1738 | 1816 | ||
1739 | - | @Callable(ci) | |
1740 | - | func liquidate (cr) = { | |
1741 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1742 | - | if ((hI == hI)) | |
1743 | - | then { | |
1744 | - | let jC = ez(cr, aP) | |
1745 | - | let iB = if (eb()) | |
1746 | - | then { | |
1747 | - | let jD = ez(cr, aQ) | |
1748 | - | bd(jC, jD) | |
1749 | - | } | |
1750 | - | else jC | |
1751 | - | if (if (if (if (if (!(cj(iB, bT(), false))) | |
1752 | - | then true | |
1753 | - | else !(cB(cr))) | |
1754 | - | then true | |
1755 | - | else !(cC())) | |
1756 | - | then true | |
1757 | - | else cD()) | |
1758 | - | then true | |
1759 | - | else dL()) | |
1760 | - | then throw("Unable to liquidate") | |
1761 | - | else if (if (if ((jC > bU())) | |
1762 | - | then (bV() > 0) | |
1763 | - | else false) | |
1764 | - | then (aM > bV()) | |
1765 | - | else false) | |
1766 | - | then { | |
1767 | - | let jE = cq(cr) | |
1768 | - | let fZ = jE._1 | |
1769 | - | let hZ = jE._2 | |
1770 | - | let ia = jE._3 | |
1771 | - | let ib = jE._4 | |
1772 | - | let hE = if ((fZ > 0)) | |
1773 | - | then aH | |
1774 | - | else aG | |
1775 | - | let if = (hE == aG) | |
1776 | - | let eL = eF(cr, fZ) | |
1777 | - | let jF = eq(cr, aP) | |
1778 | - | let io = jF._1 | |
1779 | - | let ep = jF._2 | |
1780 | - | let jG = cQ(if, eL) | |
1781 | - | let eK = jG._1 | |
1782 | - | let cU = jG._2 | |
1783 | - | let cV = jG._3 | |
1784 | - | let eS = jG._4 | |
1785 | - | let jH = aT(bc(eK), bc(fZ)) | |
1786 | - | let eP = aV(ep, jH) | |
1787 | - | let jI = dh(fZ, hZ, ib, eP) | |
1788 | - | let dq = jI._1 | |
1789 | - | let dr = jI._2 | |
1790 | - | let dm = jI._3 | |
1791 | - | let ja = (ep - eP) | |
1792 | - | let jb = if ((fZ > 0)) | |
1793 | - | then ((io - eL) - ja) | |
1794 | - | else ((ja + io) - eL) | |
1795 | - | let jJ = aV(eL, bU()) | |
1796 | - | let jK = (jJ / 2) | |
1797 | - | let gq = (jJ - jK) | |
1798 | - | let je = (dq - jJ) | |
1799 | - | let ij = (fZ + eK) | |
1800 | - | let iq = bc(jb) | |
1801 | - | let jd = (ia - iq) | |
1802 | - | let jc = co(ij) | |
1803 | - | let eV = (bM() - jd) | |
1804 | - | let jl = (bE() - jJ) | |
1805 | - | let jL = if ((0 > jl)) | |
1806 | - | then $Tuple2(0, bc(jl)) | |
1807 | - | else $Tuple2(jl, 0) | |
1808 | - | let jM = jL._1 | |
1809 | - | let jo = jL._2 | |
1810 | - | let jN = gd(cr) | |
1811 | - | let iE = jN._1 | |
1812 | - | let iF = jN._2 | |
1813 | - | let jO = if ((iE > 0)) | |
1814 | - | then { | |
1815 | - | let jP = aV(iE, jH) | |
1816 | - | let jr = invoke(ay(), "realizePartially", [cr, iF, jP], nil) | |
1817 | - | if ((jr == jr)) | |
1818 | - | then nil | |
1819 | - | else throw("Strict value is not equal to itself.") | |
1820 | - | } | |
1821 | - | else nil | |
1822 | - | if ((jO == jO)) | |
1823 | - | then { | |
1824 | - | let jA = invoke(at(), "withdrawLocked", [jJ], nil) | |
1825 | - | if ((jA == jA)) | |
1826 | - | then { | |
1827 | - | let jQ = invoke(at(), "addFree", nil, [AttachedPayment(aq(), gq)]) | |
1828 | - | if ((jQ == jQ)) | |
1829 | - | then { | |
1830 | - | let iw = invoke(au(), "notifyNotional", [cr, iq], nil) | |
1831 | - | if ((iw == iw)) | |
1832 | - | then (((gO(cr, ij, je, iq, jc) ++ hb(cU, cV, eS, eV, (cd() - (if ((ij > 0)) | |
1833 | - | then bc(eK) | |
1834 | - | else 0)), (cc() - (if ((0 > ij)) | |
1835 | - | then bc(eK) | |
1836 | - | else 0)), (bO() - (if ((ij > 0)) | |
1837 | - | then jd | |
1838 | - | else 0)), (bN() - (if ((0 > ij)) | |
1839 | - | then jd | |
1840 | - | else 0)))) ++ hj(ci.caller, jK)) ++ hm(jM)) | |
1841 | - | else throw("Strict value is not equal to itself.") | |
1842 | - | } | |
1843 | - | else throw("Strict value is not equal to itself.") | |
1844 | - | } | |
1845 | - | else throw("Strict value is not equal to itself.") | |
1846 | - | } | |
1847 | - | else throw("Strict value is not equal to itself.") | |
1848 | - | } | |
1849 | - | else { | |
1850 | - | let jR = eM(cr, false) | |
1851 | - | let ek = jR._1 | |
1852 | - | let dr = jR._2 | |
1853 | - | let el = jR._3 | |
1854 | - | let em = jR._4 | |
1855 | - | let cU = jR._5 | |
1856 | - | let cV = jR._6 | |
1857 | - | let eS = jR._7 | |
1858 | - | let eV = jR._8 | |
1859 | - | let eL = jR._9 | |
1860 | - | let eT = jR._10 | |
1861 | - | let eU = jR._11 | |
1862 | - | let ik = jR._12 | |
1863 | - | let il = jR._13 | |
1864 | - | let jJ = aV(eL, bU()) | |
1865 | - | let jK = (jJ / 2) | |
1866 | - | let gq = (jJ - jK) | |
1867 | - | let jl = (bE() - jJ) | |
1868 | - | let jS = if ((0 > jl)) | |
1869 | - | then $Tuple2(0, bc(jl)) | |
1870 | - | else $Tuple2(jl, 0) | |
1871 | - | let jM = jS._1 | |
1872 | - | let jo = jS._2 | |
1873 | - | let jT = gd(cr) | |
1874 | - | let iE = jT._1 | |
1875 | - | let iF = jT._2 | |
1876 | - | let jO = if ((iE > 0)) | |
1877 | - | then { | |
1878 | - | let jr = invoke(ay(), "realizePartiallyAndClose", [cr, 0, iF], nil) | |
1879 | - | if ((jr == jr)) | |
1880 | - | then nil | |
1881 | - | else throw("Strict value is not equal to itself.") | |
1882 | - | } | |
1883 | - | else nil | |
1884 | - | if ((jO == jO)) | |
1885 | - | then { | |
1886 | - | let gj = if ((dr > 0)) | |
1887 | - | then { | |
1888 | - | let jU = invoke(at(), "exchangeFreeAndLocked", [dr], nil) | |
1889 | - | if ((jU == jU)) | |
1890 | - | then nil | |
1891 | - | else throw("Strict value is not equal to itself.") | |
1892 | - | } | |
1893 | - | else nil | |
1894 | - | if ((gj == gj)) | |
1895 | - | then { | |
1896 | - | let jA = invoke(at(), "withdrawLocked", [jJ], nil) | |
1897 | - | if ((jA == jA)) | |
1898 | - | then { | |
1899 | - | let jQ = invoke(at(), "addFree", nil, [AttachedPayment(aq(), gq)]) | |
1900 | - | if ((jQ == jQ)) | |
1901 | - | then { | |
1902 | - | let iw = invoke(au(), "notifyNotional", [cr, 0], nil) | |
1903 | - | if ((iw == iw)) | |
1904 | - | then (((hi(cr) ++ hb(cU, cV, eS, eV, eT, eU, ik, il)) ++ hj(ci.caller, jK)) ++ hm(jM)) | |
1905 | - | else throw("Strict value is not equal to itself.") | |
1906 | - | } | |
1907 | - | else throw("Strict value is not equal to itself.") | |
1908 | - | } | |
1909 | - | else throw("Strict value is not equal to itself.") | |
1910 | - | } | |
1911 | - | else throw("Strict value is not equal to itself.") | |
1912 | - | } | |
1913 | - | else throw("Strict value is not equal to itself.") | |
1914 | - | } | |
1915 | - | } | |
1916 | - | else throw("Strict value is not equal to itself.") | |
1817 | + | @Callable(bR) | |
1818 | + | func computeFeeForTraderWithArtifact (ca,gw) = { | |
1819 | + | let gj = gI(ca, gw) | |
1820 | + | $Tuple2(nil, gj) | |
1917 | 1821 | } | |
1918 | 1822 | ||
1919 | 1823 | ||
1920 | - | ||
1921 | - | @Callable(ci) | |
1922 | - | func payFunding () = { | |
1923 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1924 | - | if ((hI == hI)) | |
1925 | - | then { | |
1926 | - | let jV = bP() | |
1927 | - | if (if (if ((jV > lastBlock.timestamp)) | |
1928 | - | then true | |
1929 | - | else !(cC())) | |
1930 | - | then true | |
1931 | - | else cD()) | |
1932 | - | then throw(((("Invalid funding block timestamp: " + toString(lastBlock.timestamp)) + " < ") + toString(jV))) | |
1933 | - | else { | |
1934 | - | let fJ = dE() | |
1935 | - | let jW = fI() | |
1936 | - | let fM = jW._1 | |
1937 | - | let fN = jW._2 | |
1938 | - | gD((jV + bS()), (ca() + fN), (cb() + fM), aT(fN, fJ), aT(fM, fJ)) | |
1939 | - | } | |
1940 | - | } | |
1941 | - | else throw("Strict value is not equal to itself.") | |
1942 | - | } | |
1943 | - | ||
1944 | - | ||
1945 | - | ||
1946 | - | @Callable(ci) | |
1947 | - | func syncTerminalPriceToOracle () = { | |
1948 | - | let cM = bH() | |
1949 | - | let cN = bI() | |
1950 | - | let jX = fE(dE(), cM, cN) | |
1951 | - | let hv = jX._1 | |
1952 | - | let hw = jX._2 | |
1953 | - | let eQ = jX._3 | |
1954 | - | let hx = if ((eQ != 0)) | |
1955 | - | then { | |
1956 | - | let hx = invoke(at(), "exchangeFreeAndLocked", [eQ], nil) | |
1957 | - | if ((hx == hx)) | |
1958 | - | then nil | |
1959 | - | else throw("Strict value is not equal to itself.") | |
1960 | - | } | |
1961 | - | else nil | |
1962 | - | if ((hx == hx)) | |
1963 | - | then (ha(hv, hw) ++ gS(aT(aV(cM, hv), aV(cN, hw)))) | |
1964 | - | else throw("Strict value is not equal to itself.") | |
1965 | - | } | |
1966 | - | ||
1967 | - | ||
1968 | - | ||
1969 | - | @Callable(ci) | |
1970 | - | func view_calcRemainMarginWithFundingPayment (cr) = { | |
1971 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1972 | - | if ((hI == hI)) | |
1973 | - | then { | |
1974 | - | let jY = cq(cr) | |
1975 | - | let cu = jY._1 | |
1976 | - | let es = jY._2 | |
1977 | - | let eB = jY._3 | |
1978 | - | let eu = jY._4 | |
1979 | - | let jZ = eq(cr, aP) | |
1980 | - | let eh = jZ._1 | |
1981 | - | let ep = jZ._2 | |
1982 | - | let ka = dh(cu, es, eu, ep) | |
1983 | - | let dq = ka._1 | |
1984 | - | let dr = ka._2 | |
1985 | - | let dm = ka._3 | |
1986 | - | throw((((((aR(dq) + aR(dm)) + aR(eE(cr))) + aR(ep)) + aR(dr)) + aR(eh))) | |
1987 | - | } | |
1988 | - | else throw("Strict value is not equal to itself.") | |
1989 | - | } | |
1990 | - | ||
1991 | - | ||
1992 | - | ||
1993 | - | @Callable(ci) | |
1994 | - | func view_getPegAdjustCost (gT) = { | |
1995 | - | let cM = bH() | |
1996 | - | let cN = bI() | |
1997 | - | let fD = fE(gT, cM, cN) | |
1998 | - | throw(toString(fD._3)) | |
1999 | - | } | |
2000 | - | ||
2001 | - | ||
2002 | - | ||
2003 | - | @Callable(ci) | |
2004 | - | func view_getTerminalAmmPrice () = { | |
2005 | - | let kb = fm() | |
2006 | - | let fq = kb._1 | |
2007 | - | let fr = kb._2 | |
2008 | - | let hq = aT(aV(fq, bJ()), aV(fr, bK())) | |
2009 | - | throw(toString(hq)) | |
2010 | - | } | |
2011 | - | ||
2012 | - | ||
2013 | - | ||
2014 | - | @Callable(ci) | |
2015 | - | func view_getFunding () = { | |
2016 | - | let fJ = dE() | |
2017 | - | let kc = fI() | |
2018 | - | let fM = kc._1 | |
2019 | - | let fN = kc._2 | |
2020 | - | let kd = aT(fN, fJ) | |
2021 | - | let ke = aT(fM, fJ) | |
2022 | - | throw((((aR(kd) + aR(ke)) + aR(eW())) + aR(dE()))) | |
2023 | - | } | |
2024 | - | ||
2025 | - | ||
2026 | - | ||
2027 | - | @Callable(ci) | |
2028 | - | func view_getBorrowedByTrader (cr) = { | |
2029 | - | let kf = gd(cr) | |
2030 | - | let iE = kf._1 | |
2031 | - | let iF = kf._2 | |
2032 | - | throw((aR(iE) + iF)) | |
2033 | - | } | |
2034 | - | ||
2035 | - | ||
2036 | - | ||
2037 | - | @Callable(ci) | |
2038 | - | func computeSpotPrice () = { | |
2039 | - | let fD = ea() | |
2040 | - | $Tuple2(nil, fD) | |
2041 | - | } | |
2042 | - | ||
2043 | - | ||
2044 | - | ||
2045 | - | @Callable(ci) | |
2046 | - | func computeFeeForTraderWithArtifact (cr,fP) = { | |
2047 | - | let fD = gg(cr, fP) | |
2048 | - | $Tuple2(nil, fD) | |
2049 | - | } | |
2050 | - | ||
2051 | - | ||
2052 | - | @Verifier(kg) | |
2053 | - | func kh () = sigVerify(kg.bodyBytes, kg.proofs[0], ap()) | |
1824 | + | @Verifier(jB) | |
1825 | + | func jC () = sigVerify(jB.bodyBytes, jB.proofs[0], ao()) | |
2054 | 1826 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = "k_ | |
4 | + | let a = "k_baseOracle" | |
5 | 5 | ||
6 | - | let b = "k_ | |
6 | + | let b = "k_quoteOracle" | |
7 | 7 | ||
8 | - | let c = "k_ | |
8 | + | let c = "k_balance" | |
9 | 9 | ||
10 | - | let d = "k_ | |
10 | + | let d = "k_sequence" | |
11 | 11 | ||
12 | - | let e = "k_ | |
12 | + | let e = "k_positionSize" | |
13 | 13 | ||
14 | - | let f = "k_ | |
14 | + | let f = "k_positionMargin" | |
15 | 15 | ||
16 | - | let g = "k_ | |
16 | + | let g = "k_positionOpenNotional" | |
17 | 17 | ||
18 | - | let h = "k_ | |
18 | + | let h = "k_positionFraction" | |
19 | 19 | ||
20 | - | let i = "k_ | |
20 | + | let i = "k_positionSequence" | |
21 | 21 | ||
22 | - | let j = "k_ | |
22 | + | let j = "k_positionAsset" | |
23 | 23 | ||
24 | - | let k = "k_ | |
24 | + | let k = "k_positionFee" | |
25 | 25 | ||
26 | - | let l = "k_ | |
26 | + | let l = "k_positionTimestamp" | |
27 | 27 | ||
28 | - | let m = "k_ | |
28 | + | let m = "k_initialized" | |
29 | 29 | ||
30 | - | let n = "k_ | |
30 | + | let n = "k_paused" | |
31 | 31 | ||
32 | - | let o = "k_ | |
32 | + | let o = "k_closeOnly" | |
33 | 33 | ||
34 | - | let p = "k_ | |
34 | + | let p = "k_fee" | |
35 | 35 | ||
36 | - | let q = "k_fee" | |
36 | + | let q = "k_rollover_fee" | |
37 | 37 | ||
38 | 38 | let r = "k_fundingPeriod" | |
39 | 39 | ||
40 | 40 | let s = "k_initMarginRatio" | |
41 | 41 | ||
42 | 42 | let t = "k_mmr" | |
43 | 43 | ||
44 | 44 | let u = "k_liquidationFeeRatio" | |
45 | 45 | ||
46 | 46 | let v = "k_partLiquidationRatio" | |
47 | 47 | ||
48 | 48 | let w = "k_spreadLimit" | |
49 | 49 | ||
50 | 50 | let x = "k_maxPriceImpact" | |
51 | 51 | ||
52 | 52 | let y = "k_maxPriceSpread" | |
53 | 53 | ||
54 | 54 | let z = "k_maxOpenNotional" | |
55 | 55 | ||
56 | 56 | let A = "k_feeToStakersPercent" | |
57 | 57 | ||
58 | 58 | let B = "k_maxOracleDelay" | |
59 | 59 | ||
60 | 60 | let C = "k_lastDataStr" | |
61 | 61 | ||
62 | 62 | let D = "k_lastMinuteId" | |
63 | 63 | ||
64 | 64 | let E = "k_twapDataLastCumulativePrice" | |
65 | 65 | ||
66 | 66 | let F = "k_twapDataLastPrice" | |
67 | 67 | ||
68 | 68 | let G = "k_twapDataPreviousMinuteId" | |
69 | 69 | ||
70 | 70 | let H = "k_latestLongPremiumFraction" | |
71 | 71 | ||
72 | 72 | let I = "k_latestShortPremiumFraction" | |
73 | 73 | ||
74 | 74 | let J = "k_nextFundingBlockMinTimestamp" | |
75 | 75 | ||
76 | 76 | let K = "k_longFundingRate" | |
77 | 77 | ||
78 | 78 | let L = "k_shortFundingRate" | |
79 | 79 | ||
80 | 80 | let M = "k_qtAstR" | |
81 | 81 | ||
82 | 82 | let N = "k_bsAstR" | |
83 | 83 | ||
84 | 84 | let O = "k_qtAstW" | |
85 | 85 | ||
86 | 86 | let P = "k_bsAstW" | |
87 | 87 | ||
88 | 88 | let Q = "k_totalPositionSize" | |
89 | 89 | ||
90 | 90 | let R = "k_totalLongPositionSize" | |
91 | 91 | ||
92 | 92 | let S = "k_totalShortPositionSize" | |
93 | 93 | ||
94 | 94 | let T = "k_openInterestNotional" | |
95 | 95 | ||
96 | 96 | let U = "k_openInterestShort" | |
97 | 97 | ||
98 | 98 | let V = "k_openInterestLong" | |
99 | 99 | ||
100 | - | let W = "k_ | |
100 | + | let W = "k_lastTx" | |
101 | 101 | ||
102 | - | let X = "k_ | |
102 | + | let X = "k_coordinatorAddress" | |
103 | 103 | ||
104 | - | let Y = "k_ | |
104 | + | let Y = "k_vault_address" | |
105 | 105 | ||
106 | - | let Z = "k_admin_ | |
106 | + | let Z = "k_admin_address" | |
107 | 107 | ||
108 | - | let aa = "k_ | |
108 | + | let aa = "k_admin_public_key" | |
109 | 109 | ||
110 | - | let ab = "k_quote_ | |
110 | + | let ab = "k_quote_asset" | |
111 | 111 | ||
112 | - | let ac = "k_staking | |
112 | + | let ac = "k_quote_staking" | |
113 | 113 | ||
114 | - | let ad = "k_ | |
114 | + | let ad = "k_staking_address" | |
115 | 115 | ||
116 | - | let ae = "k_ | |
116 | + | let ae = "k_miner_address" | |
117 | 117 | ||
118 | - | let af = "k_ | |
118 | + | let af = "k_orders_address" | |
119 | 119 | ||
120 | - | let ag = "k_ | |
120 | + | let ag = "k_referral_address" | |
121 | 121 | ||
122 | 122 | let ah = "k_exchange_address" | |
123 | 123 | ||
124 | 124 | let ai = "k_nft_manager_address" | |
125 | 125 | ||
126 | - | let aj = "k_trader_market_asset_collateral" | |
127 | - | ||
128 | - | func ak (al,am) = ((al + "_") + am) | |
126 | + | func aj (ak,al) = ((ak + "_") + al) | |
129 | 127 | ||
130 | 128 | ||
131 | - | func | |
129 | + | func am () = valueOrErrorMessage(addressFromString(getStringValue(this, X)), "Coordinator not set") | |
132 | 130 | ||
133 | 131 | ||
134 | - | func | |
132 | + | func an () = addressFromString(getStringValue(am(), Z)) | |
135 | 133 | ||
136 | 134 | ||
137 | - | func | |
135 | + | func ao () = fromBase58String(getStringValue(am(), aa)) | |
138 | 136 | ||
139 | 137 | ||
140 | - | func | |
138 | + | func ap () = fromBase58String(getStringValue(am(), ab)) | |
141 | 139 | ||
142 | 140 | ||
143 | - | func | |
141 | + | func aq () = valueOrErrorMessage(addressFromString(getStringValue(am(), ac)), "Quote asset staking not set") | |
144 | 142 | ||
145 | 143 | ||
146 | - | func | |
144 | + | func ar () = valueOrErrorMessage(addressFromString(getStringValue(am(), ad)), "Staking not set") | |
147 | 145 | ||
148 | 146 | ||
149 | - | func | |
147 | + | func as () = valueOrErrorMessage(addressFromString(getStringValue(am(), Y)), "Vault not set") | |
150 | 148 | ||
151 | 149 | ||
152 | - | func | |
150 | + | func at () = valueOrErrorMessage(addressFromString(getStringValue(am(), ae)), "Miner not set") | |
153 | 151 | ||
154 | 152 | ||
155 | - | func | |
153 | + | func au () = valueOrErrorMessage(addressFromString(getStringValue(am(), af)), "Orders not set") | |
156 | 154 | ||
157 | 155 | ||
158 | - | func | |
156 | + | func av () = valueOrErrorMessage(addressFromString(getStringValue(am(), ag)), "Referral not set") | |
159 | 157 | ||
160 | 158 | ||
161 | - | func | |
159 | + | func aw () = valueOrErrorMessage(addressFromString(getStringValue(am(), ai)), "NFT Manager not set") | |
162 | 160 | ||
163 | 161 | ||
164 | - | func ay () = valueOrErrorMessage(addressFromString(getStringValue(an(), ag)), "Collateral Manager not set") | |
162 | + | let ax = "k_token_param" | |
163 | + | ||
164 | + | let ay = "k_token_type" | |
165 | + | ||
166 | + | let az = "fee_reduction" | |
167 | + | ||
168 | + | let aA = 1 | |
169 | + | ||
170 | + | let aB = 2 | |
171 | + | ||
172 | + | let aC = 15 | |
173 | + | ||
174 | + | let aD = 1000 | |
175 | + | ||
176 | + | let aE = 6 | |
177 | + | ||
178 | + | let aF = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
179 | + | ||
180 | + | let aG = (525600 * aF) | |
181 | + | ||
182 | + | let aH = (86400 * aF) | |
183 | + | ||
184 | + | let aI = 1 | |
185 | + | ||
186 | + | let aJ = 2 | |
187 | + | ||
188 | + | func aK (aL) = (toString(aL) + ",") | |
165 | 189 | ||
166 | 190 | ||
167 | - | func | |
191 | + | func aM (aL,aN) = fraction(aL, aF, aN, HALFEVEN) | |
168 | 192 | ||
169 | 193 | ||
170 | - | let aA = "k_whitelist_asset" | |
171 | - | ||
172 | - | func aB (aC) = valueOrElse(getBoolean(ay(), ak(aA, aC)), false) | |
194 | + | func aO (aL,aN) = fraction(aL, aN, aF, HALFEVEN) | |
173 | 195 | ||
174 | 196 | ||
175 | - | let aD = "k_token_param" | |
176 | - | ||
177 | - | let aE = "k_token_type" | |
178 | - | ||
179 | - | let aF = "fee_reduction" | |
180 | - | ||
181 | - | let aG = 1 | |
182 | - | ||
183 | - | let aH = 2 | |
184 | - | ||
185 | - | let aI = 15 | |
186 | - | ||
187 | - | let aJ = 15 | |
188 | - | ||
189 | - | let aK = 1000 | |
190 | - | ||
191 | - | let aL = 6 | |
192 | - | ||
193 | - | let aM = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
194 | - | ||
195 | - | let aN = (86400 * aM) | |
196 | - | ||
197 | - | let aO = 100 | |
198 | - | ||
199 | - | let aP = 1 | |
200 | - | ||
201 | - | let aQ = 2 | |
202 | - | ||
203 | - | func aR (aS) = (toString(aS) + ",") | |
197 | + | func aP (aL) = sqrt(aL, aE, aE, HALFEVEN) | |
204 | 198 | ||
205 | 199 | ||
206 | - | func | |
200 | + | func aQ (aL,aN) = pow(aL, aE, aN, aE, aE, HALFEVEN) | |
207 | 201 | ||
208 | 202 | ||
209 | - | func | |
203 | + | func aR (aL,aN) = fraction(aL, toBigInt(aF), aN, HALFEVEN) | |
210 | 204 | ||
211 | 205 | ||
212 | - | func | |
206 | + | func aS (aL,aN) = fraction(aL, aN, toBigInt(aF), HALFEVEN) | |
213 | 207 | ||
214 | 208 | ||
215 | - | func | |
209 | + | func aT (aL) = sqrtBigInt(aL, aE, aE, HALFEVEN) | |
216 | 210 | ||
217 | 211 | ||
218 | - | func | |
212 | + | func aU (aL,aN) = pow(aL, aE, aN, aE, aE, HALFEVEN) | |
219 | 213 | ||
220 | 214 | ||
221 | - | func aZ (aS,aU) = fraction(aS, aU, toBigInt(aM), HALFEVEN) | |
215 | + | func aV (aL) = if ((aL > 0)) | |
216 | + | then aL | |
217 | + | else -(aL) | |
222 | 218 | ||
223 | 219 | ||
224 | - | func ba (aS) = sqrtBigInt(aS, aL, aL, HALFEVEN) | |
220 | + | func aW (aL,aN) = if ((aL >= aN)) | |
221 | + | then aL | |
222 | + | else aN | |
225 | 223 | ||
226 | 224 | ||
227 | - | func bb (aS,aU) = pow(aS, aL, aU, aL, aL, HALFEVEN) | |
225 | + | func aX (aY) = if ((size(aY) == 0)) | |
226 | + | then "" | |
227 | + | else makeString(aY, ",") | |
228 | 228 | ||
229 | 229 | ||
230 | - | func | |
231 | - | then | |
232 | - | else | |
230 | + | func aZ (ba) = if ((ba == "")) | |
231 | + | then nil | |
232 | + | else split(ba, ",") | |
233 | 233 | ||
234 | 234 | ||
235 | - | func | |
236 | - | then | |
237 | - | else | |
235 | + | func bb (aY,bc,bd) = if ((size(aY) > bc)) | |
236 | + | then (removeByIndex(aY, 0) :+ bd) | |
237 | + | else (aY :+ bd) | |
238 | 238 | ||
239 | 239 | ||
240 | - | func be (bf) = { | |
241 | - | func bg (bh,bi) = ((bh + bi) + ",") | |
240 | + | func be (bf) = valueOrErrorMessage(getInteger(this, bf), ("no value for " + bf)) | |
242 | 241 | ||
243 | - | let bj = { | |
244 | - | let bk = bf | |
245 | - | let bl = size(bk) | |
246 | - | let bm = "" | |
247 | - | func bn (bo,bp) = if ((bp >= bl)) | |
248 | - | then bo | |
249 | - | else bg(bo, bk[bp]) | |
250 | 242 | ||
251 | - | func bq (bo,bp) = if ((bp >= bl)) | |
252 | - | then bo | |
253 | - | else throw("List size exceeds 20") | |
243 | + | func bg (bf,bh) = valueOrElse(getInteger(this, bf), bh) | |
254 | 244 | ||
255 | - | bq(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bm, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
256 | - | } | |
257 | - | let br = dropRight(bj, 1) | |
258 | - | let bs = if ((take(br, 1) == ",")) | |
259 | - | then drop(br, 1) | |
260 | - | else br | |
261 | - | bs | |
245 | + | ||
246 | + | func bi (al,ak) = { | |
247 | + | let bj = valueOrErrorMessage(getString(al, ak), ("No value for key " + ak)) | |
248 | + | bj | |
262 | 249 | } | |
263 | 250 | ||
264 | 251 | ||
265 | - | func bt (bu) = split(bu, ",") | |
266 | - | ||
267 | - | ||
268 | - | func bv (bf,bw,bx) = if ((size(bf) > bw)) | |
269 | - | then (removeByIndex(bf, 0) :+ bx) | |
270 | - | else (bf :+ bx) | |
271 | - | ||
272 | - | ||
273 | - | func by (bz) = valueOrErrorMessage(getInteger(this, bz), ("no value for " + bz)) | |
274 | - | ||
275 | - | ||
276 | - | func bA (bz,bB) = valueOrElse(getInteger(this, bz), bB) | |
277 | - | ||
278 | - | ||
279 | - | func bC (am,al) = { | |
280 | - | let bi = valueOrErrorMessage(getString(am, al), ("No value for key " + al)) | |
281 | - | bi | |
252 | + | func bk (al,ak) = { | |
253 | + | let bj = valueOrErrorMessage(getInteger(al, ak), ("No value for key " + ak)) | |
254 | + | bj | |
282 | 255 | } | |
283 | 256 | ||
284 | 257 | ||
285 | - | func bD (am,al) = { | |
286 | - | let bi = valueOrErrorMessage(getInteger(am, al), ("No value for key " + al)) | |
287 | - | bi | |
288 | - | } | |
258 | + | func bl () = be(c) | |
289 | 259 | ||
290 | 260 | ||
291 | - | func | |
261 | + | func bm () = be(p) | |
292 | 262 | ||
293 | 263 | ||
294 | - | func | |
264 | + | func bn () = be(q) | |
295 | 265 | ||
296 | 266 | ||
297 | - | func | |
267 | + | func bo () = be(s) | |
298 | 268 | ||
299 | 269 | ||
300 | - | func | |
270 | + | func bp () = be(M) | |
301 | 271 | ||
302 | 272 | ||
303 | - | func | |
273 | + | func bq () = be(N) | |
304 | 274 | ||
305 | 275 | ||
306 | - | func | |
276 | + | func br () = bg(O, aF) | |
307 | 277 | ||
308 | 278 | ||
309 | - | func | |
279 | + | func bs () = bg(P, aF) | |
310 | 280 | ||
311 | 281 | ||
312 | - | func | |
282 | + | func bt () = be(Q) | |
313 | 283 | ||
314 | 284 | ||
315 | - | func | |
285 | + | func bu () = be(T) | |
316 | 286 | ||
317 | 287 | ||
318 | - | func | |
288 | + | func bv () = be(U) | |
319 | 289 | ||
320 | 290 | ||
321 | - | func | |
291 | + | func bw () = be(V) | |
322 | 292 | ||
323 | 293 | ||
324 | - | func | |
294 | + | func bx () = be(J) | |
325 | 295 | ||
326 | 296 | ||
327 | - | func | |
297 | + | func by () = be(r) | |
328 | 298 | ||
329 | 299 | ||
330 | - | func | |
300 | + | func bz () = (by() * aF) | |
331 | 301 | ||
332 | 302 | ||
333 | - | func | |
303 | + | func bA () = (by() * aD) | |
334 | 304 | ||
335 | 305 | ||
336 | - | func | |
306 | + | func bB () = be(t) | |
337 | 307 | ||
338 | 308 | ||
339 | - | func | |
309 | + | func bC () = be(u) | |
340 | 310 | ||
341 | 311 | ||
342 | - | func | |
312 | + | func bD () = be(v) | |
343 | 313 | ||
344 | 314 | ||
345 | - | func | |
315 | + | func bE () = be(w) | |
346 | 316 | ||
347 | 317 | ||
348 | - | func | |
318 | + | func bF () = be(x) | |
349 | 319 | ||
350 | 320 | ||
351 | - | func | |
321 | + | func bG () = be(y) | |
352 | 322 | ||
353 | 323 | ||
354 | - | func | |
324 | + | func bH () = be(z) | |
355 | 325 | ||
356 | 326 | ||
357 | - | func | |
327 | + | func bI () = be(H) | |
358 | 328 | ||
359 | 329 | ||
360 | - | func | |
330 | + | func bJ () = be(I) | |
361 | 331 | ||
362 | 332 | ||
363 | - | func | |
333 | + | func bK () = be(S) | |
364 | 334 | ||
365 | 335 | ||
366 | - | func | |
336 | + | func bL () = be(R) | |
367 | 337 | ||
368 | 338 | ||
369 | - | func | |
339 | + | func bM () = bg(d, 0) | |
370 | 340 | ||
371 | 341 | ||
372 | - | func | |
342 | + | func bN () = be(A) | |
373 | 343 | ||
374 | 344 | ||
375 | - | func | |
345 | + | func bO () = be(B) | |
376 | 346 | ||
377 | 347 | ||
378 | - | func | |
348 | + | func bP () = lastBlock.timestamp | |
379 | 349 | ||
380 | 350 | ||
381 | - | func cj (ck,cl,cm) = { | |
382 | - | let cn = (ck - cl) | |
383 | - | if (if (cm) | |
384 | - | then (0 > cn) | |
351 | + | func bQ (bR) = valueOrElse(getString(au(), "k_sender"), toString(bR.caller)) | |
352 | + | ||
353 | + | ||
354 | + | func bS (bT,bU,bV) = { | |
355 | + | let bW = (bT - bU) | |
356 | + | if (if (bV) | |
357 | + | then (0 > bW) | |
385 | 358 | else false) | |
386 | - | then throw(((("Invalid margin: " + toString( | |
387 | - | else if (if (!( | |
388 | - | then ( | |
359 | + | then throw(((("Invalid margin: " + toString(bT)) + " < ") + toString(bU))) | |
360 | + | else if (if (!(bV)) | |
361 | + | then (bW >= 0) | |
389 | 362 | else false) | |
390 | - | then throw(((("Invalid margin: " + toString( | |
363 | + | then throw(((("Invalid margin: " + toString(bT)) + " > ") + toString(bU))) | |
391 | 364 | else true | |
392 | 365 | } | |
393 | 366 | ||
394 | 367 | ||
395 | - | func | |
368 | + | func bX (bY) = if ((bY == 0)) | |
396 | 369 | then throw("Should not be called with _positionSize == 0") | |
397 | - | else if (( | |
398 | - | then | |
399 | - | else | |
370 | + | else if ((bY > 0)) | |
371 | + | then bI() | |
372 | + | else bJ() | |
400 | 373 | ||
401 | 374 | ||
402 | - | func | |
403 | - | let | |
404 | - | let | |
405 | - | if ($isInstanceOf( | |
375 | + | func bZ (ca) = { | |
376 | + | let cb = getInteger(this, aj(e, ca)) | |
377 | + | let cc = cb | |
378 | + | if ($isInstanceOf(cc, "Int")) | |
406 | 379 | then { | |
407 | - | let | |
408 | - | $ | |
380 | + | let cd = cc | |
381 | + | $Tuple5(cd, getIntegerValue(this, aj(f, ca)), getIntegerValue(this, aj(g, ca)), getIntegerValue(this, aj(h, ca)), getIntegerValue(this, aj(l, ca))) | |
409 | 382 | } | |
410 | - | else $ | |
383 | + | else $Tuple5(0, 0, 0, 0, 0) | |
411 | 384 | } | |
412 | 385 | ||
413 | 386 | ||
414 | - | func | |
415 | - | let | |
416 | - | let | |
417 | - | if ($isInstanceOf( | |
387 | + | func ce (ca) = { | |
388 | + | let cf = getString(this, aj(j, ca)) | |
389 | + | let cc = cf | |
390 | + | if ($isInstanceOf(cc, "String")) | |
418 | 391 | then { | |
419 | - | let | |
420 | - | | |
392 | + | let cg = cc | |
393 | + | cg | |
421 | 394 | } | |
422 | - | else toBase58String( | |
395 | + | else toBase58String(ap()) | |
423 | 396 | } | |
424 | 397 | ||
425 | 398 | ||
426 | - | func | |
427 | - | let | |
428 | - | let | |
429 | - | if ($isInstanceOf( | |
399 | + | func ch (ca) = { | |
400 | + | let ci = getInteger(this, aj(k, ca)) | |
401 | + | let cc = ci | |
402 | + | if ($isInstanceOf(cc, "Int")) | |
430 | 403 | then { | |
431 | - | let | |
432 | - | | |
404 | + | let cj = cc | |
405 | + | cj | |
433 | 406 | } | |
434 | - | else | |
407 | + | else bm() | |
435 | 408 | } | |
436 | 409 | ||
437 | 410 | ||
438 | - | func | |
411 | + | func ck (ca) = if ((bZ(ca)._1 == 0)) | |
439 | 412 | then throw("No open position") | |
440 | 413 | else true | |
441 | 414 | ||
442 | 415 | ||
443 | - | func cC () = valueOrElse(getBoolean(this, n), false) | |
416 | + | func cl (cm) = { | |
417 | + | let cn = getString(this, cm) | |
418 | + | if (if (isDefined(cn)) | |
419 | + | then (value(cn) != "") | |
420 | + | else false) | |
421 | + | then { | |
422 | + | let co = split(value(cn), ",") | |
423 | + | let cp = valueOrErrorMessage(addressFromString(co[0]), ("Invalid oracle address in: " + value(cn))) | |
424 | + | let cq = co[1] | |
425 | + | let cr = co[2] | |
426 | + | let cs = co[3] | |
427 | + | $Tuple4(cp, cq, cr, cs) | |
428 | + | } | |
429 | + | else unit | |
430 | + | } | |
444 | 431 | ||
445 | 432 | ||
446 | - | func | |
433 | + | func ct () = valueOrElse(getBoolean(this, m), false) | |
447 | 434 | ||
448 | 435 | ||
449 | - | func | |
436 | + | func cu () = valueOrElse(getBoolean(this, n), false) | |
450 | 437 | ||
451 | 438 | ||
452 | - | func cF (cG,cH,cI) = if (cG) | |
439 | + | func cv () = valueOrElse(getBoolean(this, o), false) | |
440 | + | ||
441 | + | ||
442 | + | func cw (cx,cy,cz) = if (cx) | |
453 | 443 | then { | |
454 | - | let | |
455 | - | if ((0 >= | |
444 | + | let cA = (bq() - cz) | |
445 | + | if ((0 >= cA)) | |
456 | 446 | then throw("Tx lead to base asset reserve <= 0, revert") | |
457 | - | else $Tuple3(( | |
447 | + | else $Tuple3((bp() + cy), cA, (bt() + cz)) | |
458 | 448 | } | |
459 | 449 | else { | |
460 | - | let | |
461 | - | if ((0 >= | |
450 | + | let cB = (bp() - cy) | |
451 | + | if ((0 >= cB)) | |
462 | 452 | then throw("Tx lead to base quote reserve <= 0, revert") | |
463 | - | else $Tuple3( | |
453 | + | else $Tuple3(cB, (bq() + cz), (bt() - cz)) | |
464 | 454 | } | |
465 | 455 | ||
466 | 456 | ||
467 | - | func | |
468 | - | let | |
469 | - | let | |
470 | - | | |
457 | + | func cC (cD,cE) = { | |
458 | + | let cF = toBigInt(cD) | |
459 | + | let cG = toBigInt(cE) | |
460 | + | aS(cF, cG) | |
471 | 461 | } | |
472 | 462 | ||
473 | 463 | ||
474 | - | func | |
475 | - | let | |
476 | - | let | |
477 | - | let | |
478 | - | let | |
479 | - | let | |
480 | - | let | |
481 | - | let | |
482 | - | then ( | |
483 | - | else ( | |
484 | - | let | |
485 | - | let | |
486 | - | let | |
487 | - | then | |
488 | - | else -( | |
489 | - | let | |
490 | - | let | |
491 | - | let | |
492 | - | let | |
493 | - | let | |
494 | - | let | |
495 | - | let | |
496 | - | let | |
497 | - | let | |
498 | - | if (( | |
499 | - | then throw(((((((((((((("Price impact " + toString( | |
500 | - | else $Tuple4( | |
464 | + | func cH (cx,cy) = { | |
465 | + | let cD = bp() | |
466 | + | let cE = bq() | |
467 | + | let cI = br() | |
468 | + | let cJ = bs() | |
469 | + | let cK = aM(cy, cI) | |
470 | + | let bf = cC(cD, cE) | |
471 | + | let cL = if (cx) | |
472 | + | then (cD + cK) | |
473 | + | else (cD - cK) | |
474 | + | let cM = toInt(aR(bf, toBigInt(cL))) | |
475 | + | let cN = aV((cM - cE)) | |
476 | + | let cO = if (cx) | |
477 | + | then cN | |
478 | + | else -(cN) | |
479 | + | let cP = cw(cx, cK, cN) | |
480 | + | let cQ = cP._1 | |
481 | + | let cR = cP._2 | |
482 | + | let cS = cP._3 | |
483 | + | let cT = aM(aO(cD, cI), aO(cE, cJ)) | |
484 | + | let cU = aM(cy, cN) | |
485 | + | let cV = aV((cT - cU)) | |
486 | + | let cW = (aF - aM(cT, (cT + cV))) | |
487 | + | let cX = bF() | |
488 | + | if ((cW > cX)) | |
489 | + | then throw(((((((((((((("Price impact " + toString(cW)) + " > max price impact ") + toString(cX)) + " before quote asset: ") + toString(cD)) + " before base asset: ") + toString(cE)) + " quote asset amount to exchange: ") + toString(cy)) + " price before: ") + toString(cT)) + " marketPrice: ") + toString(cU))) | |
490 | + | else $Tuple4(cO, cQ, cR, cS) | |
501 | 491 | } | |
502 | 492 | ||
503 | 493 | ||
504 | - | func dh (di,dj,dk,dl) = { | |
505 | - | let dm = if ((di != 0)) | |
506 | - | then { | |
507 | - | let dn = co(di) | |
508 | - | aV((dn - dk), di) | |
509 | - | } | |
510 | - | else 0 | |
511 | - | let do = ((dl - dm) + dj) | |
512 | - | let dp = if ((0 > do)) | |
513 | - | then $Tuple2(0, bc(do)) | |
514 | - | else $Tuple2(bc(do), 0) | |
515 | - | let dq = dp._1 | |
516 | - | let dr = dp._2 | |
517 | - | $Tuple3(dq, dr, dm) | |
494 | + | func cY (cZ,da) = { | |
495 | + | let db = ((((bP() - da) / 1000) / 60) * aF) | |
496 | + | let dc = aM(aO(aO(cZ, db), bn()), aG) | |
497 | + | dc | |
518 | 498 | } | |
519 | 499 | ||
520 | 500 | ||
521 | - | func ds (cG,cI,dt,du,dv,dw,dx) = { | |
522 | - | let dc = aT(aV(du, dv), aV(dw, dx)) | |
523 | - | if ((cI == 0)) | |
501 | + | func dd (de,cZ,df,da,dg) = { | |
502 | + | let dh = if ((de != 0)) | |
503 | + | then { | |
504 | + | let di = bX(de) | |
505 | + | aO((di - df), de) | |
506 | + | } | |
507 | + | else 0 | |
508 | + | let dc = cY(cZ, da) | |
509 | + | let dj = (((dg - dc) - dh) + cZ) | |
510 | + | let dk = if ((0 > dj)) | |
511 | + | then $Tuple2(0, aV(dj)) | |
512 | + | else $Tuple2(aV(dj), 0) | |
513 | + | let dl = dk._1 | |
514 | + | let dm = dk._2 | |
515 | + | $Tuple4(dl, dm, dh, dc) | |
516 | + | } | |
517 | + | ||
518 | + | ||
519 | + | func dn (cx,cz,do,dp,dq,dr,ds) = { | |
520 | + | let cT = aM(aO(dp, dq), aO(dr, ds)) | |
521 | + | if ((cz == 0)) | |
524 | 522 | then throw("Invalid base asset amount") | |
525 | 523 | else { | |
526 | - | let | |
527 | - | let | |
528 | - | then ( | |
529 | - | else ( | |
530 | - | let | |
531 | - | let | |
532 | - | let | |
533 | - | let | |
534 | - | let | |
535 | - | let | |
536 | - | let | |
537 | - | let | |
538 | - | let | |
539 | - | let | |
540 | - | let | |
541 | - | if (if (( | |
542 | - | then | |
524 | + | let bf = cC(dp, dr) | |
525 | + | let dt = if (cx) | |
526 | + | then (dr + cz) | |
527 | + | else (dr - cz) | |
528 | + | let du = toInt(aR(bf, toBigInt(dt))) | |
529 | + | let dv = aV((du - dp)) | |
530 | + | let dw = aO(dv, dq) | |
531 | + | let cX = bF() | |
532 | + | let dx = cw(!(cx), dv, cz) | |
533 | + | let cQ = dx._1 | |
534 | + | let cR = dx._2 | |
535 | + | let cS = dx._3 | |
536 | + | let cU = aM(dw, cz) | |
537 | + | let cV = aV((cT - cU)) | |
538 | + | let cW = (aF - aM(cT, (cT + cV))) | |
539 | + | if (if ((cW > cX)) | |
540 | + | then do | |
543 | 541 | else false) | |
544 | - | then throw(((((((((((((("Price impact " + toString( | |
545 | - | else $Tuple7( | |
546 | - | then | |
547 | - | else 0)), ( | |
548 | - | then | |
549 | - | else 0)), | |
542 | + | then throw(((((((((((((("Price impact " + toString(cW)) + " > max price impact ") + toString(cX)) + " before quote asset: ") + toString(dp)) + " before base asset: ") + toString(dr)) + " base asset amount to exchange: ") + toString(cz)) + " price before: ") + toString(cT)) + " market price: ") + toString(cU))) | |
543 | + | else $Tuple7(dw, cQ, cR, cS, (bL() - (if (cx) | |
544 | + | then aV(cz) | |
545 | + | else 0)), (bK() - (if (!(cx)) | |
546 | + | then aV(cz) | |
547 | + | else 0)), cW) | |
550 | 548 | } | |
551 | 549 | } | |
552 | 550 | ||
553 | 551 | ||
554 | - | func dD (cG,cI,dt) = ds(cG, cI, dt, bH(), bJ(), bI(), bK()) | |
552 | + | func dy (cx,cz,do) = dn(cx, cz, do, bp(), br(), bq(), bs()) | |
553 | + | ||
554 | + | ||
555 | + | func dz (dA,cq,cr) = { | |
556 | + | let dB = valueOrErrorMessage(getInteger(dA, cq), ((("Can not get oracle price. Oracle: " + toString(dA)) + " key: ") + cq)) | |
557 | + | if ((cr != "")) | |
558 | + | then { | |
559 | + | let dC = lastBlock.height | |
560 | + | let dD = valueOrErrorMessage(getInteger(dA, cr), ((("Can not get oracle block. Oracle: " + toString(dA)) + " key: ") + cr)) | |
561 | + | if (((dC - dD) > bO())) | |
562 | + | then throw(((("Oracle stale data. Last oracle block: " + toString(dD)) + " current block: ") + toString(dC))) | |
563 | + | else dB | |
564 | + | } | |
565 | + | else dB | |
566 | + | } | |
555 | 567 | ||
556 | 568 | ||
557 | 569 | func dE () = { | |
558 | - | let dF = valueOrErrorMessage(addressFromString(getStringValue(this, d)), "") | |
559 | - | let dG = getStringValue(this, a) | |
560 | - | let dH = valueOrErrorMessage(getInteger(dF, dG), ((("Can not get oracle price. Oracle: " + toString(dF)) + " key: ") + dG)) | |
561 | - | let dI = valueOrElse(getString(this, b), "") | |
562 | - | if ((dI != "")) | |
570 | + | let dF = valueOrErrorMessage(cl(a), "No base asset oracle data") | |
571 | + | let dG = dz(dF._1, dF._2, dF._3) | |
572 | + | let dH = cl(b) | |
573 | + | let dI = if (isDefined(dH)) | |
563 | 574 | then { | |
564 | - | let dJ = lastBlock.height | |
565 | - | let dK = valueOrErrorMessage(getInteger(dF, dI), ((("Can not get oracle block. Oracle: " + toString(dF)) + " key: ") + dI)) | |
566 | - | if (((dJ - dK) > cg())) | |
567 | - | then throw(((("Oracle stale data. Last oracle block: " + toString(dK)) + " current block: ") + toString(dJ))) | |
568 | - | else dH | |
575 | + | let dJ = value(dH) | |
576 | + | dz(dJ._1, dJ._2, dJ._3) | |
569 | 577 | } | |
570 | - | else dH | |
578 | + | else aF | |
579 | + | aM(dG, dI) | |
571 | 580 | } | |
572 | 581 | ||
573 | 582 | ||
574 | - | func dL () = { | |
575 | - | let dF = valueOrErrorMessage(addressFromString(getStringValue(this, d)), "") | |
576 | - | let dM = valueOrElse(getString(this, c), "") | |
577 | - | if ((dM != "")) | |
583 | + | func dK () = { | |
584 | + | let dF = valueOrErrorMessage(cl(a), "No base asset oracle data") | |
585 | + | let dA = dF._1 | |
586 | + | let cs = dF._4 | |
587 | + | if ((cs != "")) | |
578 | 588 | then { | |
579 | - | let | |
580 | - | !( | |
589 | + | let dL = valueOrErrorMessage(getBoolean(dA, cs), ((("Can not get oracle is open/closed. Oracle: " + toString(dA)) + " key: ") + cs)) | |
590 | + | !(dL) | |
581 | 591 | } | |
582 | 592 | else false | |
583 | 593 | } | |
584 | 594 | ||
585 | 595 | ||
586 | - | func | |
587 | - | let | |
588 | - | let | |
589 | - | let | |
590 | - | | |
596 | + | func dM (dN,dp,dr,cI,cJ) = { | |
597 | + | let dO = aM(aO(dp, cI), aO(dr, cJ)) | |
598 | + | let dP = aM((dN + dO), (2 * aF)) | |
599 | + | let dM = aM(aV((dN - dO)), dP) | |
600 | + | dM | |
591 | 601 | } | |
592 | 602 | ||
593 | 603 | ||
594 | - | func | |
595 | - | let | |
596 | - | let | |
597 | - | let | |
598 | - | let | |
599 | - | let | |
600 | - | if (if (( | |
601 | - | then ( | |
604 | + | func dQ (dp,dr) = { | |
605 | + | let dR = dE() | |
606 | + | let cI = br() | |
607 | + | let cJ = bs() | |
608 | + | let dS = dM(dR, bp(), bq(), cI, cJ) | |
609 | + | let dT = dM(dR, dp, dr, cI, cJ) | |
610 | + | if (if ((dT > bG())) | |
611 | + | then (dT > dS) | |
602 | 612 | else false) | |
603 | - | then throw(((("Price spread " + toString( | |
613 | + | then throw(((("Price spread " + toString(dT)) + " > max price spread ") + toString(bG()))) | |
604 | 614 | else true | |
605 | 615 | } | |
606 | 616 | ||
607 | 617 | ||
608 | - | func | |
609 | - | let | |
610 | - | if (( | |
611 | - | then throw(((("Long open notional " + toString( | |
612 | - | else if (( | |
613 | - | then throw(((("Short open notional " + toString( | |
618 | + | func dU (dV,dW) = { | |
619 | + | let dX = bH() | |
620 | + | if ((dV > dX)) | |
621 | + | then throw(((("Long open notional " + toString(dV)) + " > max open notional ") + toString(dX))) | |
622 | + | else if ((dW > dX)) | |
623 | + | then throw(((("Short open notional " + toString(dW)) + " > max open notional ") + toString(dX))) | |
614 | 624 | else true | |
615 | 625 | } | |
616 | 626 | ||
617 | 627 | ||
618 | - | func | |
619 | - | let | |
620 | - | let | |
621 | - | let | |
622 | - | let | |
623 | - | | |
628 | + | func dY () = { | |
629 | + | let dp = bp() | |
630 | + | let dr = bq() | |
631 | + | let cI = br() | |
632 | + | let cJ = bs() | |
633 | + | aM(aO(dp, cI), aO(dr, cJ)) | |
624 | 634 | } | |
625 | 635 | ||
626 | 636 | ||
627 | - | func | |
628 | - | let | |
629 | - | let | |
630 | - | ( | |
637 | + | func dZ () = { | |
638 | + | let dR = dE() | |
639 | + | let ea = dY() | |
640 | + | (aM(aV((dR - ea)), dR) > bE()) | |
631 | 641 | } | |
632 | 642 | ||
633 | 643 | ||
634 | - | func | |
635 | - | let | |
636 | - | let | |
637 | - | let | |
644 | + | func eb (bY,ec,dp,dq,dr,ds) = { | |
645 | + | let ed = aV(bY) | |
646 | + | let ee = (0 > bY) | |
647 | + | let ef = if ((ec == aI)) | |
638 | 648 | then { | |
639 | - | let ei = ds(!(eg), ef, false, du, dv, dw, dx) | |
640 | - | let ej = ei._1 | |
641 | - | let ek = ei._2 | |
642 | - | let el = ei._3 | |
643 | - | let em = ei._4 | |
644 | - | ej | |
649 | + | let eg = dn(!(ee), ed, false, dp, dq, dr, ds)._1 | |
650 | + | eg | |
645 | 651 | } | |
646 | - | else | |
647 | - | | |
652 | + | else aO(ed, dE()) | |
653 | + | ef | |
648 | 654 | } | |
649 | 655 | ||
650 | 656 | ||
651 | - | func | |
657 | + | func eh (bY,ei,dp,dq,dr,ds,ec) = if ((bY == 0)) | |
652 | 658 | then throw("Invalid position size") | |
653 | 659 | else { | |
654 | - | let | |
655 | - | let | |
656 | - | let | |
657 | - | then ( | |
658 | - | else ( | |
659 | - | $Tuple2( | |
660 | + | let ee = (0 > bY) | |
661 | + | let ef = eb(bY, ec, dp, dq, dr, ds) | |
662 | + | let ej = if (ee) | |
663 | + | then (ei - ef) | |
664 | + | else (ef - ei) | |
665 | + | $Tuple2(ef, ej) | |
660 | 666 | } | |
661 | 667 | ||
662 | 668 | ||
663 | - | func | |
664 | - | let | |
665 | - | let | |
666 | - | let | |
667 | - | let | |
668 | - | let | |
669 | - | | |
669 | + | func ek (ca,ec) = { | |
670 | + | let el = bZ(ca) | |
671 | + | let cd = el._1 | |
672 | + | let em = el._2 | |
673 | + | let en = el._3 | |
674 | + | let eo = el._4 | |
675 | + | eh(cd, en, bp(), br(), bq(), bs(), ec) | |
670 | 676 | } | |
671 | 677 | ||
672 | 678 | ||
673 | - | func | |
679 | + | func ep (eq,er,es) = aM((eq - er), es) | |
674 | 680 | ||
675 | 681 | ||
676 | - | func ez (cr,ee) = { | |
677 | - | let eA = cq(cr) | |
678 | - | let cu = eA._1 | |
679 | - | let es = eA._2 | |
680 | - | let eB = eA._3 | |
681 | - | let eu = eA._4 | |
682 | - | let eC = eq(cr, ee) | |
683 | - | let eh = eC._1 | |
684 | - | let ep = eC._2 | |
685 | - | let eD = dh(cu, es, eu, ep) | |
686 | - | let dq = eD._1 | |
687 | - | let dr = eD._2 | |
688 | - | ev(dq, dr, eh) | |
682 | + | func et (ca,ec) = { | |
683 | + | let eu = bZ(ca) | |
684 | + | let cd = eu._1 | |
685 | + | let em = eu._2 | |
686 | + | let ev = eu._3 | |
687 | + | let ew = eu._4 | |
688 | + | let ex = eu._5 | |
689 | + | let ey = ek(ca, ec) | |
690 | + | let ef = ey._1 | |
691 | + | let ej = ey._2 | |
692 | + | let ez = dd(cd, em, ew, ex, ej) | |
693 | + | let dl = ez._1 | |
694 | + | let dm = ez._2 | |
695 | + | ep(dl, dm, ef) | |
689 | 696 | } | |
690 | 697 | ||
691 | 698 | ||
692 | - | func | |
699 | + | func eA (ca) = et(ca, aI) | |
693 | 700 | ||
694 | 701 | ||
695 | - | func eF (cr,cp) = { | |
696 | - | let eG = bd(bV(), (aM - aT(eE(cr), bT()))) | |
697 | - | let eH = aV(bc(cp), eG) | |
698 | - | let eI = dD((cp > 0), eH, false) | |
699 | - | let eJ = eI._1 | |
700 | - | let df = eI._7 | |
701 | - | if ((bX() > df)) | |
702 | - | then eJ | |
702 | + | func eB (ca,bY) = { | |
703 | + | let eC = aW(bD(), (aF - aM(eA(ca), bB()))) | |
704 | + | let eD = aO(aV(bY), eC) | |
705 | + | let eE = dy((bY > 0), eD, false) | |
706 | + | let eF = eE._1 | |
707 | + | let cW = eE._7 | |
708 | + | if ((bF() > cW)) | |
709 | + | then eD | |
710 | + | else aO(aV(bY), bD()) | |
711 | + | } | |
712 | + | ||
713 | + | ||
714 | + | func eG (ca,eH,eI,eJ,eK,do) = { | |
715 | + | let eL = bZ(ca) | |
716 | + | let eM = eL._1 | |
717 | + | let eN = eL._2 | |
718 | + | let eO = eL._3 | |
719 | + | let eP = eL._4 | |
720 | + | let eQ = eL._5 | |
721 | + | let eR = (eM > 0) | |
722 | + | let eS = aV(eM) | |
723 | + | if (if ((eS >= eH)) | |
724 | + | then (eH > 0) | |
725 | + | else false) | |
726 | + | then { | |
727 | + | let eT = (eS > eH) | |
728 | + | let eU = dy((eM > 0), eH, do) | |
729 | + | let eV = eU._1 | |
730 | + | let cL = eU._2 | |
731 | + | let cM = eU._3 | |
732 | + | let eW = eU._4 | |
733 | + | let eX = if ((eM > 0)) | |
734 | + | then -(eH) | |
735 | + | else eH | |
736 | + | let eY = ek(ca, aI) | |
737 | + | let eZ = eY._1 | |
738 | + | let ej = eY._2 | |
739 | + | let fa = aM(aV(eX), eS) | |
740 | + | let fb = aO(ej, fa) | |
741 | + | let fc = dd(eM, eN, eP, eQ, ej) | |
742 | + | let fd = fc._1 | |
743 | + | let fe = fc._2 | |
744 | + | let ff = fc._3 | |
745 | + | let dc = fc._4 | |
746 | + | let fg = dd(eM, eN, eP, eQ, fb)._2 | |
747 | + | let fh = aO(aO(eZ, fa), eI) | |
748 | + | let fi = (ej - fb) | |
749 | + | let fj = if ((eM > 0)) | |
750 | + | then ((eZ - eV) - fi) | |
751 | + | else ((fi + eZ) - eV) | |
752 | + | let fk = (eM + eX) | |
753 | + | let fl = if ((fk == 0)) | |
754 | + | then $Tuple2(0, 0) | |
755 | + | else $Tuple2(aV(fj), bX(fk)) | |
756 | + | let fm = fl._1 | |
757 | + | let fn = fl._2 | |
758 | + | let fo = (eO - fm) | |
759 | + | let fp = et(ca, aI) | |
760 | + | let fq = if ((eM > 0)) | |
761 | + | then (aO((fm + fi), fp) - fi) | |
762 | + | else (aO((fm - fi), fp) - fi) | |
763 | + | let fr = ((fd - (fq + fi)) - fh) | |
764 | + | let fs = if ((0 > fr)) | |
765 | + | then throw("Invalid internalClosePosition params: unable to pay fee") | |
766 | + | else fr | |
767 | + | let ft = if (eK) | |
768 | + | then (fq + fs) | |
769 | + | else fq | |
770 | + | if (if ((eJ != 0)) | |
771 | + | then (eJ > eV) | |
772 | + | else false) | |
773 | + | then throw(((("Limit error: " + toString(eV)) + " < ") + toString(eJ))) | |
774 | + | else $Tuple17(fk, ft, fm, fn, fg, fb, if (if (eK) | |
775 | + | then eT | |
776 | + | else false) | |
777 | + | then 0 | |
778 | + | else fs, cL, cM, eW, (bu() - fo), (bL() - (if (eR) | |
779 | + | then aV(eX) | |
780 | + | else 0)), (bK() - (if (!(eR)) | |
781 | + | then aV(eX) | |
782 | + | else 0)), (bw() - (if (eR) | |
783 | + | then fo | |
784 | + | else 0)), (bv() - (if (!(eR)) | |
785 | + | then fo | |
786 | + | else 0)), (fh + dc), eV) | |
787 | + | } | |
788 | + | else throw("Invalid internalClosePosition params: invalid position size") | |
789 | + | } | |
790 | + | ||
791 | + | ||
792 | + | func fu () = { | |
793 | + | let fv = ((bP() / 1000) / 60) | |
794 | + | let fw = (fv - aC) | |
795 | + | let fx = valueOrElse(getString(this, C), "") | |
796 | + | let fy = split(fx, ",") | |
797 | + | func fz (fA,fB) = if ((fw >= valueOrErrorMessage(parseInt(fB), ("getTwapSpotPrice: invalid int: " + fx)))) | |
798 | + | then (fA :+ parseIntValue(fB)) | |
799 | + | else fA | |
800 | + | ||
801 | + | let fC = { | |
802 | + | let fD = fy | |
803 | + | let fE = size(fD) | |
804 | + | let fF = nil | |
805 | + | func fG (fH,fI) = if ((fI >= fE)) | |
806 | + | then fH | |
807 | + | else fz(fH, fD[fI]) | |
808 | + | ||
809 | + | func fJ (fH,fI) = if ((fI >= fE)) | |
810 | + | then fH | |
811 | + | else throw("List size exceeds 20") | |
812 | + | ||
813 | + | fJ(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fG(fF, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
814 | + | } | |
815 | + | let fK = if ((size(fC) > 0)) | |
816 | + | then max(fC) | |
817 | + | else valueOrErrorMessage(parseInt(fy[0]), ("getTwapSpotPrice: invalid int: " + fx)) | |
818 | + | let fL = valueOrElse(getInteger(this, D), 0) | |
819 | + | let fM = valueOrElse(getInteger(this, ((E + "_") + toString(fL))), 0) | |
820 | + | let fN = valueOrElse(getInteger(this, ((F + "_") + toString(fL))), 0) | |
821 | + | let fO = (fM + ((fv - fL) * fN)) | |
822 | + | let fP = valueOrElse(getInteger(this, ((E + "_") + toString(fK))), 0) | |
823 | + | let fQ = valueOrElse(getInteger(this, ((F + "_") + toString(fK))), 0) | |
824 | + | let fR = (fP + ((fw - fK) * fQ)) | |
825 | + | ((fO - fR) / aC) | |
826 | + | } | |
827 | + | ||
828 | + | ||
829 | + | func fS () = { | |
830 | + | let bY = bt() | |
831 | + | if ((bY == 0)) | |
832 | + | then $Tuple2(bp(), bq()) | |
703 | 833 | else { | |
704 | - | let eK = aV(bc(cp), bV()) | |
705 | - | let eL = dD((cp > 0), eK, false)._1 | |
706 | - | eL | |
834 | + | let fT = (bY > 0) | |
835 | + | let fU = dy(fT, aV(bY), false) | |
836 | + | let fV = fU._1 | |
837 | + | let fW = fU._2 | |
838 | + | let fX = fU._3 | |
839 | + | $Tuple2(fW, fX) | |
707 | 840 | } | |
708 | 841 | } | |
709 | 842 | ||
710 | 843 | ||
711 | - | func eM (cr,dt) = { | |
712 | - | let eN = cq(cr) | |
713 | - | let cu = eN._1 | |
714 | - | let es = eN._2 | |
715 | - | let et = eN._3 | |
716 | - | let eu = eN._4 | |
717 | - | let ep = eq(cr, aP)._2 | |
718 | - | let eO = dh(cu, es, eu, ep) | |
719 | - | let dq = eO._1 | |
720 | - | let dr = eO._2 | |
721 | - | let eK = -(cu) | |
722 | - | let eP = ep | |
723 | - | let eQ = -(dq) | |
724 | - | let eR = dD((cu > 0), bc(cu), dt) | |
725 | - | let eL = eR._1 | |
726 | - | let cU = eR._2 | |
727 | - | let cV = eR._3 | |
728 | - | let eS = eR._4 | |
729 | - | let eT = eR._5 | |
730 | - | let eU = eR._6 | |
731 | - | let eV = (bM() - et) | |
732 | - | $Tuple13(eK, dr, eP, eQ, cU, cV, eS, eV, eL, eT, eU, (bO() - (if ((cu > 0)) | |
733 | - | then et | |
734 | - | else 0)), (bN() - (if ((0 > cu)) | |
735 | - | then et | |
736 | - | else 0))) | |
844 | + | func fY (fZ,bt,ga,gb) = { | |
845 | + | let gc = toBigInt(fZ) | |
846 | + | let gd = toBigInt(bt) | |
847 | + | let ge = toBigInt(ga) | |
848 | + | let gf = toBigInt(gb) | |
849 | + | let bf = aS(ge, gc) | |
850 | + | let gg = (gc + gd) | |
851 | + | let gh = aR(bf, gg) | |
852 | + | let gi = aR(gh, gg) | |
853 | + | let gj = aR(gf, gi) | |
854 | + | toInt(gj) | |
737 | 855 | } | |
738 | 856 | ||
739 | 857 | ||
740 | - | func eW () = { | |
741 | - | let eX = ((lastBlock.timestamp / 1000) / 60) | |
742 | - | let eY = (eX - aI) | |
743 | - | let eZ = valueOrElse(getString(this, C), "") | |
744 | - | let fa = split(eZ, ",") | |
745 | - | func fb (bh,fc) = if ((eY >= parseIntValue(fc))) | |
746 | - | then (bh :+ parseIntValue(fc)) | |
747 | - | else bh | |
748 | - | ||
749 | - | let fd = { | |
750 | - | let bk = fa | |
751 | - | let bl = size(bk) | |
752 | - | let bm = nil | |
753 | - | func bn (bo,bp) = if ((bp >= bl)) | |
754 | - | then bo | |
755 | - | else fb(bo, bk[bp]) | |
756 | - | ||
757 | - | func bq (bo,bp) = if ((bp >= bl)) | |
758 | - | then bo | |
759 | - | else throw("List size exceeds 20") | |
760 | - | ||
761 | - | bq(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(bm, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
762 | - | } | |
763 | - | let fe = if ((size(fd) > 0)) | |
764 | - | then max(fd) | |
765 | - | else parseIntValue(fa[0]) | |
766 | - | let ff = valueOrElse(getInteger(this, D), 0) | |
767 | - | let fg = valueOrElse(getInteger(this, ((E + "_") + toString(ff))), 0) | |
768 | - | let fh = valueOrElse(getInteger(this, ((F + "_") + toString(ff))), 0) | |
769 | - | let fi = (fg + ((eX - ff) * fh)) | |
770 | - | let fj = valueOrElse(getInteger(this, ((E + "_") + toString(fe))), 0) | |
771 | - | let fk = valueOrElse(getInteger(this, ((F + "_") + toString(fe))), 0) | |
772 | - | let fl = (fj + ((eY - fe) * fk)) | |
773 | - | ((fi - fl) / aI) | |
774 | - | } | |
775 | - | ||
776 | - | ||
777 | - | func fm () = { | |
778 | - | let cp = bL() | |
779 | - | if ((cp == 0)) | |
780 | - | then $Tuple2(bH(), bI()) | |
858 | + | func gk (gl,cD,cE) = { | |
859 | + | let bY = bt() | |
860 | + | if ((bY == 0)) | |
861 | + | then { | |
862 | + | let gm = aM(aO(gl, cE), cD) | |
863 | + | $Tuple3(gm, aF, 0) | |
864 | + | } | |
781 | 865 | else { | |
782 | - | let | |
783 | - | let | |
784 | - | let | |
785 | - | let | |
786 | - | let | |
787 | - | $ | |
866 | + | let fT = (bY > 0) | |
867 | + | let fV = dy(fT, aV(bY), false)._1 | |
868 | + | let gm = fY(cE, bY, cD, gl) | |
869 | + | let gn = aF | |
870 | + | let go = eh(bY, fV, cD, gm, cE, gn, aI)._2 | |
871 | + | $Tuple3(gm, gn, go) | |
788 | 872 | } | |
789 | 873 | } | |
790 | 874 | ||
791 | 875 | ||
792 | - | func fs (ft,bL,fu,fv) = { | |
793 | - | let fw = toBigInt(ft) | |
794 | - | let fx = toBigInt(bL) | |
795 | - | let fy = toBigInt(fu) | |
796 | - | let fz = toBigInt(fv) | |
797 | - | let bz = aZ(fy, fw) | |
798 | - | let fA = (fw + fx) | |
799 | - | let fB = aY(bz, fA) | |
800 | - | let fC = aY(fB, fA) | |
801 | - | let fD = aY(fz, fC) | |
802 | - | toInt(fD) | |
803 | - | } | |
804 | - | ||
805 | - | ||
806 | - | func fE (fF,cM,cN) = { | |
807 | - | let cp = bL() | |
808 | - | if ((cp == 0)) | |
809 | - | then { | |
810 | - | let fG = aT(aV(fF, cN), cM) | |
811 | - | $Tuple3(fG, aM, 0) | |
812 | - | } | |
813 | - | else { | |
814 | - | let fn = (cp > 0) | |
815 | - | let fp = dD(fn, bc(cp), false)._1 | |
816 | - | let fG = fs(cN, cp, cM, fF) | |
817 | - | let fH = aM | |
818 | - | let eQ = en(cp, fp, cM, fG, cN, fH, aP)._2 | |
819 | - | $Tuple3(fG, fH, eQ) | |
820 | - | } | |
821 | - | } | |
822 | - | ||
823 | - | ||
824 | - | func fI () = { | |
825 | - | let fJ = dE() | |
826 | - | let fK = eW() | |
827 | - | let fL = (fK - fJ) | |
828 | - | if (if (if ((cc() == 0)) | |
876 | + | func gp () = { | |
877 | + | let gq = dE() | |
878 | + | let gr = fu() | |
879 | + | let gs = (gr - gq) | |
880 | + | if (if (if ((bK() == 0)) | |
829 | 881 | then true | |
830 | - | else ( | |
882 | + | else (bL() == 0)) | |
831 | 883 | then true | |
832 | - | else | |
884 | + | else dK()) | |
833 | 885 | then $Tuple2(0, 0) | |
834 | - | else if ((0 > | |
886 | + | else if ((0 > gs)) | |
835 | 887 | then { | |
836 | - | let | |
837 | - | let | |
838 | - | $Tuple2( | |
888 | + | let gt = aM(aO(gs, bz()), aH) | |
889 | + | let gu = aM(aO(gt, bK()), bL()) | |
890 | + | $Tuple2(gt, gu) | |
839 | 891 | } | |
840 | 892 | else { | |
841 | - | let | |
842 | - | let | |
843 | - | $Tuple2( | |
893 | + | let gu = aM(aO(gs, bz()), aH) | |
894 | + | let gt = aM(aO(gu, bL()), bK()) | |
895 | + | $Tuple2(gt, gu) | |
844 | 896 | } | |
845 | 897 | } | |
846 | 898 | ||
847 | 899 | ||
848 | - | func | |
849 | - | let | |
850 | - | let | |
851 | - | let | |
900 | + | func gv (gw,gx) = { | |
901 | + | let gy = bm() | |
902 | + | let gz = aO(gy, gx) | |
903 | + | let gA = if ((gw != "")) | |
852 | 904 | then { | |
853 | - | let | |
854 | - | if (( | |
905 | + | let gB = bi(aw(), aj(ay, gw)) | |
906 | + | if ((gB == az)) | |
855 | 907 | then { | |
856 | - | let | |
857 | - | let | |
858 | - | $Tuple2( | |
908 | + | let gC = bk(aw(), aj(ax, gw)) | |
909 | + | let gD = aO(gz, gC) | |
910 | + | $Tuple2(gD, true) | |
859 | 911 | } | |
860 | 912 | else throw("Invalid attached artifact") | |
861 | 913 | } | |
862 | - | else $Tuple2( | |
863 | - | let | |
864 | - | let | |
865 | - | $Tuple2( | |
914 | + | else $Tuple2(gz, false) | |
915 | + | let gD = gA._1 | |
916 | + | let gE = gA._2 | |
917 | + | $Tuple2(gD, gE) | |
866 | 918 | } | |
867 | 919 | ||
868 | 920 | ||
869 | - | func | |
870 | - | let | |
871 | - | if (( | |
921 | + | func gF (ca,gG) = { | |
922 | + | let eM = bZ(ca)._1 | |
923 | + | if ((eM == 0)) | |
872 | 924 | then true | |
873 | - | else ( | |
925 | + | else (ce(ca) == gG) | |
874 | 926 | } | |
875 | 927 | ||
876 | 928 | ||
877 | - | func | |
929 | + | func gH (ca,gG) = (ce(ca) == gG) | |
878 | 930 | ||
879 | 931 | ||
880 | - | func gb (gc,aC,cr) = ((((((aj + "_") + gc) + "_") + aC) + "_") + cr) | |
881 | - | ||
882 | - | ||
883 | - | func gd (cr) = { | |
884 | - | let cx = cv(cr) | |
885 | - | if ((cx == toBase58String(aq()))) | |
886 | - | then $Tuple2(0, cx) | |
887 | - | else { | |
888 | - | let ge = gb(toString(this), cx, cr) | |
889 | - | let gf = valueOrElse(getInteger(ay(), ge), 0) | |
890 | - | $Tuple2(gf, cx) | |
891 | - | } | |
892 | - | } | |
893 | - | ||
894 | - | ||
895 | - | func gg (cr,fP) = { | |
896 | - | let gh = invoke(au(), "computeFeeDiscount", [cr], nil) | |
897 | - | if ((gh == gh)) | |
932 | + | func gI (ca,gw) = { | |
933 | + | let gJ = invoke(at(), "computeFeeDiscount", [ca], nil) | |
934 | + | if ((gJ == gJ)) | |
898 | 935 | then { | |
899 | - | let | |
900 | - | let | |
901 | - | if ($isInstanceOf( | |
936 | + | let gK = { | |
937 | + | let cc = gJ | |
938 | + | if ($isInstanceOf(cc, "Int")) | |
902 | 939 | then { | |
903 | - | let | |
904 | - | | |
940 | + | let gL = cc | |
941 | + | gL | |
905 | 942 | } | |
906 | 943 | else throw("Invalid computeFeeDiscount result") | |
907 | 944 | } | |
908 | - | let | |
909 | - | let | |
910 | - | let | |
911 | - | $Tuple2( | |
945 | + | let gM = gv(gw, gK) | |
946 | + | let gD = gM._1 | |
947 | + | let gE = gM._2 | |
948 | + | $Tuple2(gD, gE) | |
912 | 949 | } | |
913 | 950 | else throw("Strict value is not equal to itself.") | |
914 | 951 | } | |
915 | 952 | ||
916 | 953 | ||
917 | - | func | |
918 | - | let | |
919 | - | then toBase58String(valueOrErrorMessage( | |
954 | + | func gN (bR) = { | |
955 | + | let gO = if ((size(bR.payments) > 1)) | |
956 | + | then toBase58String(valueOrErrorMessage(bR.payments[1].assetId, "Invalid artifactId")) | |
920 | 957 | else "" | |
921 | - | | |
958 | + | gO | |
922 | 959 | } | |
923 | 960 | ||
924 | 961 | ||
925 | - | func | |
926 | - | let | |
927 | - | let | |
928 | - | $Tuple2( | |
962 | + | func gP (gQ) = { | |
963 | + | let gR = aO(gQ, bN()) | |
964 | + | let gS = (gQ - gR) | |
965 | + | $Tuple2(gR, gS) | |
929 | 966 | } | |
930 | 967 | ||
931 | 968 | ||
932 | - | func | |
969 | + | func gT (gU,gV,gW,gX,eI,gY,gZ,ha,hb,dX,hc,hd,he) = [IntegerEntry(s, gU), IntegerEntry(t, gV), IntegerEntry(u, gW), IntegerEntry(r, gX), IntegerEntry(p, eI), IntegerEntry(w, gY), IntegerEntry(x, gZ), IntegerEntry(v, ha), IntegerEntry(y, hb), IntegerEntry(z, dX), IntegerEntry(A, hc), IntegerEntry(B, hc), IntegerEntry(q, he)] | |
933 | 970 | ||
934 | 971 | ||
935 | - | func | |
972 | + | func hf (hg,hh,hi,hj,hk) = [IntegerEntry(J, hg), IntegerEntry(H, hh), IntegerEntry(I, hi), IntegerEntry(K, hj), IntegerEntry(L, hk)] | |
936 | 973 | ||
937 | 974 | ||
938 | - | func gJ (am,aC) = [StringEntry(ak(l, am), aC)] | |
939 | - | ||
940 | - | ||
941 | - | func gK (gL,am) = if (gL) | |
975 | + | func hl (hm,al) = if (hm) | |
942 | 976 | then { | |
943 | - | let | |
944 | - | [IntegerEntry( | |
977 | + | let hn = bM() | |
978 | + | [IntegerEntry(aj(i, al), (hn + 1)), IntegerEntry(d, (hn + 1))] | |
945 | 979 | } | |
946 | 980 | else nil | |
947 | 981 | ||
948 | 982 | ||
949 | - | func | |
950 | - | then [IntegerEntry( | |
983 | + | func ho (hm,al,eI) = if (hm) | |
984 | + | then [IntegerEntry(aj(k, al), eI)] | |
951 | 985 | else nil | |
952 | 986 | ||
953 | 987 | ||
954 | - | func | |
988 | + | func hp (al,eH,hq,hr,di,hs) = [IntegerEntry(aj(e, al), eH), IntegerEntry(aj(f, al), hq), IntegerEntry(aj(g, al), hr), IntegerEntry(aj(h, al), di), IntegerEntry(aj(l, al), hs)] | |
955 | 989 | ||
956 | 990 | ||
957 | - | func | |
958 | - | let | |
959 | - | let | |
960 | - | if (( | |
991 | + | func ht (hu) = { | |
992 | + | let fv = ((bP() / 1000) / 60) | |
993 | + | let hv = valueOrElse(getInteger(this, D), 0) | |
994 | + | if ((hv > fv)) | |
961 | 995 | then throw("TWAP out-of-order") | |
962 | 996 | else { | |
963 | - | let | |
964 | - | then | |
965 | - | else | |
966 | - | if (( | |
997 | + | let fL = if ((hv == 0)) | |
998 | + | then fv | |
999 | + | else hv | |
1000 | + | if ((fv > hv)) | |
967 | 1001 | then { | |
968 | - | let | |
969 | - | let | |
970 | - | let | |
971 | - | let | |
972 | - | [IntegerEntry( | |
1002 | + | let hw = valueOrElse(getInteger(this, ((E + "_") + toString(hv))), 0) | |
1003 | + | let hx = valueOrElse(getInteger(this, ((F + "_") + toString(hv))), hu) | |
1004 | + | let hy = (hw + ((fv - fL) * hx)) | |
1005 | + | let fy = bb(aZ(valueOrElse(getString(this, C), "")), aC, toString(fv)) | |
1006 | + | [IntegerEntry(aj(E, toString(fv)), hy), IntegerEntry(aj(F, toString(fv)), hu), IntegerEntry(aj(G, toString(fv)), hv), IntegerEntry(D, fv), StringEntry(C, aX(fy))] | |
973 | 1007 | } | |
974 | 1008 | else { | |
975 | - | let | |
976 | - | let | |
977 | - | let | |
978 | - | let | |
979 | - | [IntegerEntry( | |
1009 | + | let hz = valueOrElse(getInteger(this, aj(G, toString(fv))), 0) | |
1010 | + | let hw = valueOrElse(getInteger(this, aj(E, toString(hz))), 0) | |
1011 | + | let hx = valueOrElse(getInteger(this, aj(F, toString(hz))), hu) | |
1012 | + | let hy = (hw + ((fv - hz) * hx)) | |
1013 | + | [IntegerEntry(aj(E, toString(fv)), hy), IntegerEntry(aj(F, toString(fv)), hu)] | |
980 | 1014 | } | |
981 | 1015 | } | |
982 | 1016 | } | |
983 | 1017 | ||
984 | 1018 | ||
985 | - | func | |
1019 | + | func hA (cD,cE) = [IntegerEntry(M, cD), IntegerEntry(N, cE)] | |
986 | 1020 | ||
987 | 1021 | ||
988 | - | func | |
1022 | + | func hB (cI,cJ) = [IntegerEntry(O, cI), IntegerEntry(P, cJ)] | |
989 | 1023 | ||
990 | 1024 | ||
991 | - | func | |
992 | - | let | |
993 | - | let | |
994 | - | if ((( | |
995 | - | then throw(((((("Invalid AMM state data: " + toString( | |
996 | - | else (( | |
1025 | + | func hC (cD,cE,hD,hE,hF,hG,hH,hI) = { | |
1026 | + | let cI = br() | |
1027 | + | let cJ = bs() | |
1028 | + | if (((hF - hG) != hD)) | |
1029 | + | then throw(((((("Invalid AMM state data: " + toString(hF)) + " + ") + toString(hG)) + " != ") + toString(hD))) | |
1030 | + | else ((hA(cD, cE) ++ [IntegerEntry(Q, hD), IntegerEntry(T, hE), IntegerEntry(R, hF), IntegerEntry(S, hG), IntegerEntry(V, hH), IntegerEntry(U, hI)]) ++ ht(aM(aO(cD, cI), aO(cE, cJ)))) | |
997 | 1031 | } | |
998 | 1032 | ||
999 | 1033 | ||
1000 | - | func | |
1034 | + | func hJ (al) = [DeleteEntry(aj(e, al)), DeleteEntry(aj(f, al)), DeleteEntry(aj(g, al)), DeleteEntry(aj(h, al)), DeleteEntry(aj(j, al)), DeleteEntry(aj(k, al)), DeleteEntry(aj(l, al))] | |
1001 | 1035 | ||
1002 | 1036 | ||
1003 | - | func | |
1004 | - | let | |
1005 | - | if (( | |
1006 | - | then throw(((("Unable to withdraw " + toString( | |
1007 | - | else [ScriptTransfer( | |
1037 | + | func hK (al,hL) = { | |
1038 | + | let hM = assetBalance(this, ap()) | |
1039 | + | if ((hL > hM)) | |
1040 | + | then throw(((("Unable to withdraw " + toString(hL)) + " from contract balance ") + toString(hM))) | |
1041 | + | else [ScriptTransfer(al, hL, ap())] | |
1008 | 1042 | } | |
1009 | 1043 | ||
1010 | 1044 | ||
1011 | - | func | |
1045 | + | func hN (bR) = if ((0 > bR)) | |
1012 | 1046 | then throw("Balance") | |
1013 | - | else [IntegerEntry( | |
1047 | + | else [IntegerEntry(c, bR)] | |
1014 | 1048 | ||
1015 | 1049 | ||
1016 | - | func | |
1050 | + | func hO (bR) = [ScriptTransfer(ar(), bR, ap())] | |
1017 | 1051 | ||
1018 | 1052 | ||
1019 | - | func | |
1020 | - | then [Burn(valueOrErrorMessage( | |
1053 | + | func hP (hQ,bR) = if (hQ) | |
1054 | + | then [Burn(valueOrErrorMessage(bR.payments[1].assetId, "Invalid artifact"), 1)] | |
1021 | 1055 | else nil | |
1022 | 1056 | ||
1023 | 1057 | ||
1024 | - | @Callable( | |
1025 | - | func pause () = if (( | |
1058 | + | @Callable(bR) | |
1059 | + | func pause () = if ((bR.caller != an())) | |
1026 | 1060 | then throw("Invalid pause params") | |
1061 | + | else [BooleanEntry(n, true)] | |
1062 | + | ||
1063 | + | ||
1064 | + | ||
1065 | + | @Callable(bR) | |
1066 | + | func unpause () = if ((bR.caller != an())) | |
1067 | + | then throw("Invalid unpause params") | |
1068 | + | else [BooleanEntry(n, false)] | |
1069 | + | ||
1070 | + | ||
1071 | + | ||
1072 | + | @Callable(bR) | |
1073 | + | func setCloseOnly () = if ((bR.caller != an())) | |
1074 | + | then throw("Invalid setCloseOnly params") | |
1027 | 1075 | else [BooleanEntry(o, true)] | |
1028 | 1076 | ||
1029 | 1077 | ||
1030 | 1078 | ||
1031 | - | @Callable( | |
1032 | - | func | |
1033 | - | then throw("Invalid | |
1079 | + | @Callable(bR) | |
1080 | + | func unsetCloseOnly () = if ((bR.caller != an())) | |
1081 | + | then throw("Invalid unsetCloseOnly params") | |
1034 | 1082 | else [BooleanEntry(o, false)] | |
1035 | 1083 | ||
1036 | 1084 | ||
1037 | 1085 | ||
1038 | - | @Callable(ci) | |
1039 | - | func setCloseOnly () = if ((ci.caller != ao())) | |
1040 | - | then throw("Invalid setCloseOnly params") | |
1041 | - | else [BooleanEntry(p, true)] | |
1042 | - | ||
1043 | - | ||
1044 | - | ||
1045 | - | @Callable(ci) | |
1046 | - | func unsetCloseOnly () = if ((ci.caller != ao())) | |
1047 | - | then throw("Invalid unsetCloseOnly params") | |
1048 | - | else [BooleanEntry(p, false)] | |
1049 | - | ||
1050 | - | ||
1051 | - | ||
1052 | - | @Callable(ci) | |
1053 | - | func addLiquidity (cH) = if (if ((ci.caller != ao())) | |
1086 | + | @Callable(bR) | |
1087 | + | func addLiquidity (cy) = if (if ((bR.caller != an())) | |
1054 | 1088 | then true | |
1055 | - | else (0 >= | |
1089 | + | else (0 >= cy)) | |
1056 | 1090 | then throw("Invalid addLiquidity params") | |
1057 | 1091 | else { | |
1058 | - | let | |
1059 | - | let | |
1060 | - | let | |
1061 | - | let | |
1062 | - | let | |
1063 | - | let | |
1064 | - | let | |
1065 | - | let | |
1066 | - | let | |
1067 | - | let | |
1068 | - | let | |
1069 | - | let | |
1070 | - | let | |
1092 | + | let cD = bp() | |
1093 | + | let cE = bq() | |
1094 | + | let cI = br() | |
1095 | + | let cJ = bs() | |
1096 | + | let hR = aM(aO(cD, cI), aO(cE, cJ)) | |
1097 | + | let hS = (cD + cy) | |
1098 | + | let hT = (aM(aO(hS, cI), hR) - cE) | |
1099 | + | let hU = (cE + hT) | |
1100 | + | let hV = gk(dE(), hS, hU) | |
1101 | + | let hW = hV._1 | |
1102 | + | let hX = hV._2 | |
1103 | + | let go = hV._3 | |
1104 | + | let hY = if ((go != 0)) | |
1071 | 1105 | then { | |
1072 | - | let | |
1073 | - | if (( | |
1106 | + | let hY = invoke(as(), "exchangeFreeAndLocked", [go], nil) | |
1107 | + | if ((hY == hY)) | |
1074 | 1108 | then nil | |
1075 | 1109 | else throw("Strict value is not equal to itself.") | |
1076 | 1110 | } | |
1077 | 1111 | else nil | |
1078 | - | if (( | |
1079 | - | then ( | |
1112 | + | if ((hY == hY)) | |
1113 | + | then (hA(hS, hU) ++ hB(hW, hX)) | |
1080 | 1114 | else throw("Strict value is not equal to itself.") | |
1081 | 1115 | } | |
1082 | 1116 | ||
1083 | 1117 | ||
1084 | 1118 | ||
1085 | - | @Callable( | |
1086 | - | func removeLiquidity ( | |
1119 | + | @Callable(bR) | |
1120 | + | func removeLiquidity (cy) = if (if ((bR.caller != an())) | |
1087 | 1121 | then true | |
1088 | - | else ( | |
1122 | + | else (cy >= 0)) | |
1089 | 1123 | then throw("Invalid removeLiquidity params") | |
1090 | 1124 | else { | |
1091 | - | let | |
1092 | - | let | |
1093 | - | let | |
1094 | - | let | |
1095 | - | let | |
1096 | - | let | |
1097 | - | let | |
1098 | - | let | |
1099 | - | let | |
1100 | - | let | |
1101 | - | let | |
1102 | - | let | |
1103 | - | let | |
1125 | + | let cD = bp() | |
1126 | + | let cE = bq() | |
1127 | + | let cI = br() | |
1128 | + | let cJ = bs() | |
1129 | + | let hR = aM(aO(cD, cI), aO(cE, cJ)) | |
1130 | + | let hS = (cD - cy) | |
1131 | + | let hZ = aV((aM(aO(hS, cI), hR) - cE)) | |
1132 | + | let hU = (cE - hZ) | |
1133 | + | let ia = gk(dE(), hS, hU) | |
1134 | + | let hW = ia._1 | |
1135 | + | let hX = ia._2 | |
1136 | + | let go = ia._3 | |
1137 | + | let hY = if ((go != 0)) | |
1104 | 1138 | then { | |
1105 | - | let | |
1106 | - | if (( | |
1139 | + | let hY = invoke(as(), "exchangeFreeAndLocked", [go], nil) | |
1140 | + | if ((hY == hY)) | |
1107 | 1141 | then nil | |
1108 | 1142 | else throw("Strict value is not equal to itself.") | |
1109 | 1143 | } | |
1110 | 1144 | else nil | |
1111 | - | if (( | |
1112 | - | then ( | |
1145 | + | if ((hY == hY)) | |
1146 | + | then (hA(hS, hU) ++ hB(hW, hX)) | |
1113 | 1147 | else throw("Strict value is not equal to itself.") | |
1114 | 1148 | } | |
1115 | 1149 | ||
1116 | 1150 | ||
1117 | 1151 | ||
1118 | - | @Callable( | |
1119 | - | func changeSettings ( | |
1152 | + | @Callable(bR) | |
1153 | + | func changeSettings (gU,gV,gW,gX,eI,gY,gZ,ha,hb,dX,hc,hd,he) = if ((bR.caller != an())) | |
1120 | 1154 | then throw("Invalid changeSettings params") | |
1121 | - | else | |
1155 | + | else gT(gU, gV, gW, gX, eI, gY, gZ, ha, hb, dX, hc, hd, he) | |
1122 | 1156 | ||
1123 | 1157 | ||
1124 | 1158 | ||
1125 | - | @Callable( | |
1126 | - | func initialize ( | |
1159 | + | @Callable(bR) | |
1160 | + | func initialize (cD,cE,gX,gU,gV,gW,eI,ib,ic,id,gY,gZ,ha,hb,dX,hc,hd,he) = if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ((0 >= cD)) | |
1127 | 1161 | then true | |
1128 | - | else (0 >= | |
1162 | + | else (0 >= cE)) | |
1129 | 1163 | then true | |
1130 | - | else (0 >= | |
1164 | + | else (0 >= gX)) | |
1131 | 1165 | then true | |
1132 | - | else (0 >= | |
1166 | + | else (0 >= gU)) | |
1133 | 1167 | then true | |
1134 | - | else (0 >= | |
1168 | + | else (0 >= gV)) | |
1135 | 1169 | then true | |
1136 | - | else (0 >= | |
1170 | + | else (0 >= gW)) | |
1137 | 1171 | then true | |
1138 | - | else (0 >= | |
1172 | + | else (0 >= eI)) | |
1139 | 1173 | then true | |
1140 | - | else (0 >= | |
1174 | + | else (0 >= gY)) | |
1141 | 1175 | then true | |
1142 | - | else (0 >= | |
1176 | + | else (0 >= gZ)) | |
1143 | 1177 | then true | |
1144 | - | else (0 >= | |
1178 | + | else (0 >= ha)) | |
1145 | 1179 | then true | |
1146 | - | else (0 >= | |
1180 | + | else (0 >= hb)) | |
1147 | 1181 | then true | |
1148 | - | else (0 >= | |
1182 | + | else (0 >= dX)) | |
1149 | 1183 | then true | |
1150 | - | else (0 >= | |
1184 | + | else (0 >= hc)) | |
1151 | 1185 | then true | |
1152 | - | else ( | |
1186 | + | else (hc > aF)) | |
1153 | 1187 | then true | |
1154 | - | else (0 >= | |
1188 | + | else (0 >= hd)) | |
1155 | 1189 | then true | |
1156 | - | else cC()) | |
1190 | + | else (0 >= he)) | |
1191 | + | then true | |
1192 | + | else ct()) | |
1157 | 1193 | then throw("Invalid initialize parameters") | |
1158 | - | else (((( | |
1194 | + | else ((((hC(cD, cE, 0, 0, 0, 0, 0, 0) ++ gT(gU, gV, gW, gX, eI, gY, gZ, ha, hb, dX, hc, hd, he)) ++ hf((bP() + gX), 0, 0, 0, 0)) ++ hN(0)) ++ [BooleanEntry(m, true), StringEntry(a, ib), StringEntry(b, ic), StringEntry(X, id)]) | |
1159 | 1195 | ||
1160 | 1196 | ||
1161 | 1197 | ||
1162 | - | @Callable( | |
1163 | - | func increasePosition ( | |
1164 | - | let | |
1165 | - | if (( | |
1198 | + | @Callable(bR) | |
1199 | + | func increasePosition (ie,if,ig,ih) = { | |
1200 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1201 | + | if ((ii == ii)) | |
1166 | 1202 | then { | |
1167 | - | let cr = ch(ci) | |
1168 | - | let hJ = ci.payments[0].amount | |
1169 | - | let aC = ci.payments[0].assetId | |
1170 | - | let hK = toBase58String(value(aC)) | |
1171 | - | let hL = (aC == aq()) | |
1172 | - | let hM = aB(hK) | |
1173 | - | if (if (if (if (if (if (if (if (if (if ((hE != aG)) | |
1174 | - | then (hE != aH) | |
1175 | - | else false) | |
1176 | - | then true | |
1177 | - | else (0 >= hJ)) | |
1178 | - | then true | |
1179 | - | else !(cC())) | |
1180 | - | then true | |
1181 | - | else if (!(hL)) | |
1182 | - | then !(hM) | |
1183 | - | else false) | |
1184 | - | then true | |
1185 | - | else !(fY(cr, hK))) | |
1186 | - | then true | |
1187 | - | else !(cj(aT(aM, hF), bG(), true))) | |
1188 | - | then true | |
1189 | - | else cD()) | |
1190 | - | then true | |
1191 | - | else cE()) | |
1192 | - | then true | |
1193 | - | else dL()) | |
1194 | - | then throw("Invalid increasePosition parameters") | |
1195 | - | else { | |
1196 | - | let hN = gg(cr, gl(ci)) | |
1197 | - | let fW = hN._1 | |
1198 | - | let fX = hN._2 | |
1199 | - | let hk = aT(hJ, (aV(fW, hF) + aM)) | |
1200 | - | let hO = (hJ - hk) | |
1201 | - | let hP = if (hM) | |
1202 | - | then { | |
1203 | - | let hQ = invoke(ay(), "borrow", [cr], [AttachedPayment(aC, hk)]) | |
1204 | - | if ((hQ == hQ)) | |
1203 | + | let ij = invoke(this, "ensureCalledOnce", nil, nil) | |
1204 | + | if ((ij == ij)) | |
1205 | + | then { | |
1206 | + | let ca = bQ(bR) | |
1207 | + | let ik = bR.payments[0].amount | |
1208 | + | let gG = bR.payments[0].assetId | |
1209 | + | let il = toBase58String(value(gG)) | |
1210 | + | let im = (gG == ap()) | |
1211 | + | if (if (if (if (if (if (if (if (if (if ((ie != aA)) | |
1212 | + | then (ie != aB) | |
1213 | + | else false) | |
1214 | + | then true | |
1215 | + | else (0 >= ik)) | |
1216 | + | then true | |
1217 | + | else !(ct())) | |
1218 | + | then true | |
1219 | + | else !(im)) | |
1220 | + | then true | |
1221 | + | else !(gF(ca, il))) | |
1222 | + | then true | |
1223 | + | else !(bS(aM(aF, if), bo(), true))) | |
1224 | + | then true | |
1225 | + | else cu()) | |
1226 | + | then true | |
1227 | + | else cv()) | |
1228 | + | then true | |
1229 | + | else dK()) | |
1230 | + | then throw("Invalid increasePosition parameters") | |
1231 | + | else { | |
1232 | + | let in = gI(ca, gN(bR)) | |
1233 | + | let gD = in._1 | |
1234 | + | let gE = in._2 | |
1235 | + | let hL = aM(ik, (aO(gD, if) + aF)) | |
1236 | + | let io = (ik - hL) | |
1237 | + | let ip = invoke(av(), "acceptPaymentWithLink", [ca, ih], [AttachedPayment(ap(), io)]) | |
1238 | + | if ((ip == ip)) | |
1205 | 1239 | then { | |
1206 | - | let hR = assetBalance(this, aq()) | |
1207 | - | if ((hR == hR)) | |
1240 | + | let iq = { | |
1241 | + | let cc = ip | |
1242 | + | if ($isInstanceOf(cc, "Int")) | |
1243 | + | then { | |
1244 | + | let gL = cc | |
1245 | + | gL | |
1246 | + | } | |
1247 | + | else throw("Invalid referrerFee") | |
1248 | + | } | |
1249 | + | let ir = (io - iq) | |
1250 | + | let is = bZ(ca) | |
1251 | + | let eM = is._1 | |
1252 | + | let eN = is._2 | |
1253 | + | let eO = is._3 | |
1254 | + | let eP = is._4 | |
1255 | + | let eQ = is._5 | |
1256 | + | let it = (eM == 0) | |
1257 | + | let iu = if ((eM > 0)) | |
1258 | + | then (ie == aA) | |
1259 | + | else (ie == aB) | |
1260 | + | let iv = if (!(it)) | |
1261 | + | then iu | |
1262 | + | else false | |
1263 | + | let iw = (ie == aA) | |
1264 | + | let ix = if (if (it) | |
1265 | + | then true | |
1266 | + | else iv) | |
1208 | 1267 | then { | |
1209 | - | let hS = invoke(az(), "swap", [toBase58String(aq()), 0], [AttachedPayment(aC, hO)]) | |
1210 | - | if ((hS == hS)) | |
1268 | + | let iy = aO(hL, if) | |
1269 | + | let iz = cH(iw, iy) | |
1270 | + | let cO = iz._1 | |
1271 | + | let cL = iz._2 | |
1272 | + | let cM = iz._3 | |
1273 | + | let eW = iz._4 | |
1274 | + | if (if ((ig != 0)) | |
1275 | + | then (ig > aV(cO)) | |
1276 | + | else false) | |
1277 | + | then throw(((("Limit error: " + toString(aV(cO))) + " < ") + toString(ig))) | |
1278 | + | else { | |
1279 | + | let fk = (eM + cO) | |
1280 | + | let iA = (bw() + (if ((fk > 0)) | |
1281 | + | then iy | |
1282 | + | else 0)) | |
1283 | + | let iB = (bv() + (if ((0 > fk)) | |
1284 | + | then iy | |
1285 | + | else 0)) | |
1286 | + | let iC = dd(eM, eN, eP, eQ, hL) | |
1287 | + | let dl = iC._1 | |
1288 | + | let fe = iC._2 | |
1289 | + | let ff = iC._3 | |
1290 | + | let dc = iC._4 | |
1291 | + | if (!(dQ(cL, cM))) | |
1292 | + | then throw("Over max spread limit") | |
1293 | + | else if (!(dU(iA, iB))) | |
1294 | + | then throw("Over max open notional") | |
1295 | + | else $Tuple14(fk, dl, (eO + iy), bX(fk), bP(), cM, cL, eW, (bu() + iy), (bL() + (if ((fk > 0)) | |
1296 | + | then aV(cO) | |
1297 | + | else 0)), (bK() + (if ((0 > fk)) | |
1298 | + | then aV(cO) | |
1299 | + | else 0)), iA, iB, dc) | |
1300 | + | } | |
1301 | + | } | |
1302 | + | else { | |
1303 | + | let iy = aO(hL, if) | |
1304 | + | let iD = ek(toString(bR.caller), aI) | |
1305 | + | let eZ = iD._1 | |
1306 | + | let ej = iD._2 | |
1307 | + | if ((eZ > iy)) | |
1308 | + | then throw("Use decreasePosition to decrease position size") | |
1309 | + | else throw("Close position first") | |
1310 | + | } | |
1311 | + | let fk = ix._1 | |
1312 | + | let iE = ix._2 | |
1313 | + | let fm = ix._3 | |
1314 | + | let iF = ix._4 | |
1315 | + | let iG = ix._5 | |
1316 | + | let cM = ix._6 | |
1317 | + | let cL = ix._7 | |
1318 | + | let eW = ix._8 | |
1319 | + | let iH = ix._9 | |
1320 | + | let iI = ix._10 | |
1321 | + | let iJ = ix._11 | |
1322 | + | let iA = ix._12 | |
1323 | + | let iB = ix._13 | |
1324 | + | let dc = ix._14 | |
1325 | + | let iK = gP((ir + dc)) | |
1326 | + | let gR = iK._1 | |
1327 | + | let gS = iK._2 | |
1328 | + | let iL = if ((hL >= dc)) | |
1329 | + | then invoke(as(), "addLocked", nil, [AttachedPayment(ap(), (hL - dc))]) | |
1330 | + | else invoke(as(), "withdrawLocked", [(dc - hL)], nil) | |
1331 | + | if ((iL == iL)) | |
1332 | + | then { | |
1333 | + | let iM = invoke(as(), "addFree", nil, [AttachedPayment(ap(), gS)]) | |
1334 | + | if ((iM == iM)) | |
1211 | 1335 | then { | |
1212 | - | let | |
1213 | - | if (( | |
1336 | + | let iN = invoke(at(), "notifyFees", [ca, ir], nil) | |
1337 | + | if ((iN == iN)) | |
1214 | 1338 | then { | |
1215 | - | let | |
1216 | - | if (( | |
1217 | - | then | |
1339 | + | let iO = invoke(at(), "notifyNotional", [ca, fm], nil) | |
1340 | + | if ((iO == iO)) | |
1341 | + | then ((((((hp(ca, fk, iE, fm, iF, iG) ++ hl(it, ca)) ++ ho(it, ca, gD)) ++ hC(cL, cM, eW, iH, iI, iJ, iA, iB)) ++ hO(gR)) ++ hN(((bl() + hL) - dc))) ++ hP(gE, bR)) | |
1218 | 1342 | else throw("Strict value is not equal to itself.") | |
1219 | 1343 | } | |
1220 | 1344 | else throw("Strict value is not equal to itself.") | |
1221 | 1345 | } | |
1222 | 1346 | else throw("Strict value is not equal to itself.") | |
1223 | 1347 | } | |
1224 | 1348 | else throw("Strict value is not equal to itself.") | |
1225 | 1349 | } | |
1226 | 1350 | else throw("Strict value is not equal to itself.") | |
1227 | 1351 | } | |
1228 | - | else hO | |
1229 | - | if ((hP == hP)) | |
1230 | - | then { | |
1231 | - | let hV = invoke(aw(), "acceptPaymentWithLink", [cr, hH], [AttachedPayment(aq(), hP)]) | |
1232 | - | if ((hV == hV)) | |
1352 | + | } | |
1353 | + | else throw("Strict value is not equal to itself.") | |
1354 | + | } | |
1355 | + | else throw("Strict value is not equal to itself.") | |
1356 | + | } | |
1357 | + | ||
1358 | + | ||
1359 | + | ||
1360 | + | @Callable(bR) | |
1361 | + | func addMargin () = { | |
1362 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1363 | + | if ((ii == ii)) | |
1364 | + | then { | |
1365 | + | let ij = invoke(this, "ensureCalledOnce", nil, nil) | |
1366 | + | if ((ij == ij)) | |
1367 | + | then { | |
1368 | + | let ca = toString(bR.caller) | |
1369 | + | let hL = bR.payments[0].amount | |
1370 | + | let gG = bR.payments[0].assetId | |
1371 | + | let il = toBase58String(value(gG)) | |
1372 | + | let im = (gG == ap()) | |
1373 | + | if (if (if (if (if (if (if (!(im)) | |
1374 | + | then true | |
1375 | + | else !(ck(toString(bR.caller)))) | |
1376 | + | then true | |
1377 | + | else !(gH(ca, il))) | |
1378 | + | then true | |
1379 | + | else !(ct())) | |
1380 | + | then true | |
1381 | + | else cu()) | |
1382 | + | then true | |
1383 | + | else cv()) | |
1384 | + | then true | |
1385 | + | else dK()) | |
1386 | + | then throw("Invalid addMargin parameters") | |
1387 | + | else { | |
1388 | + | let iP = bZ(ca) | |
1389 | + | let eM = iP._1 | |
1390 | + | let eN = iP._2 | |
1391 | + | let eO = iP._3 | |
1392 | + | let eP = iP._4 | |
1393 | + | let eQ = iP._5 | |
1394 | + | let iL = invoke(as(), "addLocked", nil, [AttachedPayment(ap(), hL)]) | |
1395 | + | if ((iL == iL)) | |
1233 | 1396 | then { | |
1234 | - | let hW = { | |
1235 | - | let ct = hV | |
1236 | - | if ($isInstanceOf(ct, "Int")) | |
1237 | - | then { | |
1238 | - | let gj = ct | |
1239 | - | gj | |
1240 | - | } | |
1241 | - | else throw("Invalid referrerFee") | |
1242 | - | } | |
1243 | - | let hX = (hP - hW) | |
1244 | - | let hY = cq(cr) | |
1245 | - | let fZ = hY._1 | |
1246 | - | let hZ = hY._2 | |
1247 | - | let ia = hY._3 | |
1248 | - | let ib = hY._4 | |
1249 | - | let ic = (fZ == 0) | |
1250 | - | let id = if ((fZ > 0)) | |
1251 | - | then (hE == aG) | |
1252 | - | else (hE == aH) | |
1253 | - | let ie = if (!(ic)) | |
1254 | - | then id | |
1255 | - | else false | |
1256 | - | let if = (hE == aG) | |
1257 | - | let ig = if (if (ic) | |
1258 | - | then true | |
1259 | - | else ie) | |
1397 | + | let dc = cY(eN, eQ) | |
1398 | + | let iQ = if ((dc > 0)) | |
1260 | 1399 | then { | |
1261 | - | let ih = aV(hk, hF) | |
1262 | - | let ii = cQ(if, ih) | |
1263 | - | let cX = ii._1 | |
1264 | - | let cU = ii._2 | |
1265 | - | let cV = ii._3 | |
1266 | - | let eS = ii._4 | |
1267 | - | if (if ((hG != 0)) | |
1268 | - | then (hG > bc(cX)) | |
1269 | - | else false) | |
1270 | - | then throw(((("Limit error: " + toString(bc(cX))) + " < ") + toString(hG))) | |
1271 | - | else { | |
1272 | - | let ij = (fZ + cX) | |
1273 | - | let ik = (bO() + (if ((ij > 0)) | |
1274 | - | then ih | |
1275 | - | else 0)) | |
1276 | - | let il = (bN() + (if ((0 > ij)) | |
1277 | - | then ih | |
1278 | - | else 0)) | |
1279 | - | let im = dh(fZ, hZ, ib, hk) | |
1280 | - | let dq = im._1 | |
1281 | - | let ek = im._2 | |
1282 | - | let el = im._3 | |
1283 | - | if (!(dS(cU, cV))) | |
1284 | - | then throw("Over max spread limit") | |
1285 | - | else if (!(dW(ik, il))) | |
1286 | - | then throw("Over max open notional") | |
1287 | - | else $Tuple12(ij, dq, (ia + ih), co(ij), cV, cU, eS, (bM() + ih), (cd() + (if ((ij > 0)) | |
1288 | - | then bc(cX) | |
1289 | - | else 0)), (cc() + (if ((0 > ij)) | |
1290 | - | then bc(cX) | |
1291 | - | else 0)), ik, il) | |
1400 | + | let iR = gP(dc) | |
1401 | + | let gR = iR._1 | |
1402 | + | let gS = iR._2 | |
1403 | + | let iS = invoke(as(), "withdrawLocked", [gR], nil) | |
1404 | + | if ((iS == iS)) | |
1405 | + | then { | |
1406 | + | let iT = invoke(as(), "exchangeFreeAndLocked", [-(gS)], nil) | |
1407 | + | if ((iT == iT)) | |
1408 | + | then hO(gR) | |
1409 | + | else throw("Strict value is not equal to itself.") | |
1292 | 1410 | } | |
1293 | - | } | |
1294 | - | else { | |
1295 | - | let ih = aV(hk, hF) | |
1296 | - | let in = eq(toString(ci.caller), aP) | |
1297 | - | let io = in._1 | |
1298 | - | let ep = in._2 | |
1299 | - | if ((io > ih)) | |
1300 | - | then throw("Use decreasePosition to decrease position size") | |
1301 | - | else throw("Close position first") | |
1302 | - | } | |
1303 | - | let ij = ig._1 | |
1304 | - | let ip = ig._2 | |
1305 | - | let iq = ig._3 | |
1306 | - | let ir = ig._4 | |
1307 | - | let cV = ig._5 | |
1308 | - | let cU = ig._6 | |
1309 | - | let eS = ig._7 | |
1310 | - | let eV = ig._8 | |
1311 | - | let eT = ig._9 | |
1312 | - | let eU = ig._10 | |
1313 | - | let ik = ig._11 | |
1314 | - | let il = ig._12 | |
1315 | - | let is = gn(hX) | |
1316 | - | let gp = is._1 | |
1317 | - | let gq = is._2 | |
1318 | - | let it = if (hL) | |
1319 | - | then { | |
1320 | - | let it = invoke(at(), "addLocked", [false], [AttachedPayment(aq(), hk)]) | |
1321 | - | if ((it == it)) | |
1322 | - | then nil | |
1323 | 1411 | else throw("Strict value is not equal to itself.") | |
1324 | 1412 | } | |
1325 | 1413 | else nil | |
1326 | - | if ((it == it)) | |
1327 | - | then { | |
1328 | - | let iu = invoke(at(), "addFree", nil, [AttachedPayment(aq(), gq)]) | |
1329 | - | if ((iu == iu)) | |
1414 | + | if ((iQ == iQ)) | |
1415 | + | then ((hp(ca, eM, ((eN - dc) + hL), eO, eP, bP()) ++ hN(((bl() + hL) - dc))) ++ iQ) | |
1416 | + | else throw("Strict value is not equal to itself.") | |
1417 | + | } | |
1418 | + | else throw("Strict value is not equal to itself.") | |
1419 | + | } | |
1420 | + | } | |
1421 | + | else throw("Strict value is not equal to itself.") | |
1422 | + | } | |
1423 | + | else throw("Strict value is not equal to itself.") | |
1424 | + | } | |
1425 | + | ||
1426 | + | ||
1427 | + | ||
1428 | + | @Callable(bR) | |
1429 | + | func removeMargin (hL) = { | |
1430 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1431 | + | if ((ii == ii)) | |
1432 | + | then { | |
1433 | + | let ij = invoke(this, "ensureCalledOnce", nil, nil) | |
1434 | + | if ((ij == ij)) | |
1435 | + | then { | |
1436 | + | let ca = toString(bR.caller) | |
1437 | + | if (if (if (if (if ((0 >= hL)) | |
1438 | + | then true | |
1439 | + | else !(ck(ca))) | |
1440 | + | then true | |
1441 | + | else !(ct())) | |
1442 | + | then true | |
1443 | + | else cu()) | |
1444 | + | then true | |
1445 | + | else dK()) | |
1446 | + | then throw("Invalid removeMargin parameters") | |
1447 | + | else { | |
1448 | + | let iU = bZ(ca) | |
1449 | + | let eM = iU._1 | |
1450 | + | let eN = iU._2 | |
1451 | + | let eO = iU._3 | |
1452 | + | let eP = iU._4 | |
1453 | + | let eQ = iU._5 | |
1454 | + | let iV = dd(eM, eN, eP, eQ, -(hL)) | |
1455 | + | let dl = iV._1 | |
1456 | + | let dm = iV._2 | |
1457 | + | let dh = iV._3 | |
1458 | + | let dc = iV._4 | |
1459 | + | if ((dm != 0)) | |
1460 | + | then throw("Invalid removed margin amount") | |
1461 | + | else { | |
1462 | + | let fp = ep(dl, dm, eO) | |
1463 | + | if (!(bS(fp, bo(), true))) | |
1464 | + | then throw(((("Too much margin removed: " + toString(fp)) + " < ") + toString(bo()))) | |
1465 | + | else { | |
1466 | + | let iW = gP(dc) | |
1467 | + | let gR = iW._1 | |
1468 | + | let gS = iW._2 | |
1469 | + | let iQ = if ((dc > 0)) | |
1330 | 1470 | then { | |
1331 | - | let iv = invoke(au(), "notifyFees", [cr, hX], nil) | |
1332 | - | if ((iv == iv)) | |
1333 | - | then { | |
1334 | - | let iw = invoke(au(), "notifyNotional", [cr, iq], nil) | |
1335 | - | if ((iw == iw)) | |
1336 | - | then (((((((gO(cr, ij, ip, iq, ir) ++ gK(ic, cr)) ++ gN(ic, cr, fW)) ++ gJ(cr, hK)) ++ hb(cU, cV, eS, eV, eT, eU, ik, il)) ++ hn(gp)) ++ hm((bE() + hk))) ++ ho(fX, ci)) | |
1337 | - | else throw("Strict value is not equal to itself.") | |
1338 | - | } | |
1471 | + | let iT = invoke(as(), "exchangeFreeAndLocked", [-(gS)], nil) | |
1472 | + | if ((iT == iT)) | |
1473 | + | then hO(gR) | |
1339 | 1474 | else throw("Strict value is not equal to itself.") | |
1340 | 1475 | } | |
1476 | + | else nil | |
1477 | + | if ((iQ == iQ)) | |
1478 | + | then { | |
1479 | + | let iS = invoke(as(), "withdrawLocked", [(hL + gR)], nil) | |
1480 | + | if ((iS == iS)) | |
1481 | + | then (((hp(ca, eM, dl, eO, bX(eM), bP()) ++ hK(bR.caller, hL)) ++ hN(((bl() - hL) - dc))) ++ iQ) | |
1482 | + | else throw("Strict value is not equal to itself.") | |
1483 | + | } | |
1484 | + | else throw("Strict value is not equal to itself.") | |
1485 | + | } | |
1486 | + | } | |
1487 | + | } | |
1488 | + | } | |
1489 | + | else throw("Strict value is not equal to itself.") | |
1490 | + | } | |
1491 | + | else throw("Strict value is not equal to itself.") | |
1492 | + | } | |
1493 | + | ||
1494 | + | ||
1495 | + | ||
1496 | + | @Callable(bR) | |
1497 | + | func closePosition (eH,eJ,eK) = { | |
1498 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1499 | + | if ((ii == ii)) | |
1500 | + | then { | |
1501 | + | let ij = invoke(this, "ensureCalledOnce", nil, nil) | |
1502 | + | if ((ij == ij)) | |
1503 | + | then { | |
1504 | + | let ca = bQ(bR) | |
1505 | + | let iX = valueOrErrorMessage(addressFromString(ca), "Invalid caller") | |
1506 | + | let cj = ch(ca) | |
1507 | + | if (if (if (if (if (if (!(ck(ca))) | |
1508 | + | then true | |
1509 | + | else !(ct())) | |
1510 | + | then true | |
1511 | + | else cu()) | |
1512 | + | then true | |
1513 | + | else (0 >= eH)) | |
1514 | + | then true | |
1515 | + | else (0 > eJ)) | |
1516 | + | then true | |
1517 | + | else dK()) | |
1518 | + | then throw("Invalid closePosition parameters") | |
1519 | + | else { | |
1520 | + | let eQ = bZ(ca)._5 | |
1521 | + | let iY = eG(ca, eH, cj, eJ, eK, true) | |
1522 | + | let fk = iY._1 | |
1523 | + | let ft = iY._2 | |
1524 | + | let fm = iY._3 | |
1525 | + | let fn = iY._4 | |
1526 | + | let fg = iY._5 | |
1527 | + | let fb = iY._6 | |
1528 | + | let fs = iY._7 | |
1529 | + | let cL = iY._8 | |
1530 | + | let cM = iY._9 | |
1531 | + | let eW = iY._10 | |
1532 | + | let iH = iY._11 | |
1533 | + | let iI = iY._12 | |
1534 | + | let iJ = iY._13 | |
1535 | + | let iA = iY._14 | |
1536 | + | let iB = iY._15 | |
1537 | + | let iZ = iY._16 | |
1538 | + | if ((fg > 0)) | |
1539 | + | then throw("Invalid closePosition parameters: bad debt") | |
1540 | + | else if ((eQ >= bP())) | |
1541 | + | then throw("Invalid closePosition parameters: wait at least 1 block before closing the position") | |
1542 | + | else { | |
1543 | + | let eT = (fk != 0) | |
1544 | + | let ja = (fs + iZ) | |
1545 | + | let jb = (bl() - ja) | |
1546 | + | let jc = if ((0 > jb)) | |
1547 | + | then 0 | |
1548 | + | else jb | |
1549 | + | let iS = invoke(as(), "withdrawLocked", [ja], nil) | |
1550 | + | if ((iS == iS)) | |
1551 | + | then { | |
1552 | + | let jd = gP(iZ) | |
1553 | + | let gR = jd._1 | |
1554 | + | let gS = jd._2 | |
1555 | + | let iM = invoke(as(), "addFree", nil, [AttachedPayment(ap(), gS)]) | |
1556 | + | if ((iM == iM)) | |
1557 | + | then { | |
1558 | + | let iN = invoke(at(), "notifyFees", [ca, iZ], nil) | |
1559 | + | if ((iN == iN)) | |
1560 | + | then { | |
1561 | + | let iO = invoke(at(), "notifyNotional", [ca, fm], nil) | |
1562 | + | if ((iO == iO)) | |
1563 | + | then (((((if (eT) | |
1564 | + | then hp(ca, fk, ft, fm, fn, bP()) | |
1565 | + | else hJ(ca)) ++ hC(cL, cM, eW, iH, iI, iJ, iA, iB)) ++ (if ((fs > 0)) | |
1566 | + | then hK(iX, fs) | |
1567 | + | else nil)) ++ hN(jc)) ++ hO(gR)) | |
1568 | + | else throw("Strict value is not equal to itself.") | |
1569 | + | } | |
1570 | + | else throw("Strict value is not equal to itself.") | |
1571 | + | } | |
1572 | + | else throw("Strict value is not equal to itself.") | |
1573 | + | } | |
1574 | + | else throw("Strict value is not equal to itself.") | |
1575 | + | } | |
1576 | + | } | |
1577 | + | } | |
1578 | + | else throw("Strict value is not equal to itself.") | |
1579 | + | } | |
1580 | + | else throw("Strict value is not equal to itself.") | |
1581 | + | } | |
1582 | + | ||
1583 | + | ||
1584 | + | ||
1585 | + | @Callable(bR) | |
1586 | + | func liquidate (ca) = { | |
1587 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1588 | + | if ((ii == ii)) | |
1589 | + | then { | |
1590 | + | let je = et(ca, aI) | |
1591 | + | let jf = if (dZ()) | |
1592 | + | then { | |
1593 | + | let jg = et(ca, aJ) | |
1594 | + | aW(je, jg) | |
1595 | + | } | |
1596 | + | else je | |
1597 | + | if (if (if (if (if (!(bS(jf, bB(), false))) | |
1598 | + | then true | |
1599 | + | else !(ck(ca))) | |
1600 | + | then true | |
1601 | + | else !(ct())) | |
1602 | + | then true | |
1603 | + | else cu()) | |
1604 | + | then true | |
1605 | + | else dK()) | |
1606 | + | then throw("Unable to liquidate") | |
1607 | + | else { | |
1608 | + | let jh = if (if ((je > bC())) | |
1609 | + | then true | |
1610 | + | else (bD() > 0)) | |
1611 | + | then true | |
1612 | + | else (aF > bD()) | |
1613 | + | let eM = bZ(ca)._1 | |
1614 | + | let ed = aV(eM) | |
1615 | + | let ji = if (jh) | |
1616 | + | then { | |
1617 | + | let jj = eB(ca, eM) | |
1618 | + | let jk = aM(aV(jj), ed) | |
1619 | + | $Tuple2(jk, aV(jj)) | |
1620 | + | } | |
1621 | + | else $Tuple2(0, ed) | |
1622 | + | let jk = ji._1 | |
1623 | + | let jj = ji._2 | |
1624 | + | let jl = eG(ca, if (jh) | |
1625 | + | then jj | |
1626 | + | else ed, bC(), 0, true, false) | |
1627 | + | let fk = jl._1 | |
1628 | + | let ft = jl._2 | |
1629 | + | let fm = jl._3 | |
1630 | + | let fn = jl._4 | |
1631 | + | let fg = jl._5 | |
1632 | + | let fb = jl._6 | |
1633 | + | let fs = jl._7 | |
1634 | + | let cL = jl._8 | |
1635 | + | let cM = jl._9 | |
1636 | + | let eW = jl._10 | |
1637 | + | let iH = jl._11 | |
1638 | + | let iI = jl._12 | |
1639 | + | let iJ = jl._13 | |
1640 | + | let iA = jl._14 | |
1641 | + | let iB = jl._15 | |
1642 | + | let jm = jl._16 | |
1643 | + | let jn = (jm / 2) | |
1644 | + | let gS = (jm - jn) | |
1645 | + | let jb = (bl() - jm) | |
1646 | + | let jo = if ((0 > jb)) | |
1647 | + | then 0 | |
1648 | + | else jb | |
1649 | + | let iT = if ((fg > 0)) | |
1650 | + | then { | |
1651 | + | let iT = invoke(as(), "exchangeFreeAndLocked", [fg], nil) | |
1652 | + | if ((iT == iT)) | |
1653 | + | then nil | |
1654 | + | else throw("Strict value is not equal to itself.") | |
1655 | + | } | |
1656 | + | else nil | |
1657 | + | if ((iT == iT)) | |
1658 | + | then { | |
1659 | + | let iS = invoke(as(), "withdrawLocked", [jm], nil) | |
1660 | + | if ((iS == iS)) | |
1661 | + | then { | |
1662 | + | let jp = invoke(as(), "addFree", nil, [AttachedPayment(ap(), gS)]) | |
1663 | + | if ((jp == jp)) | |
1664 | + | then { | |
1665 | + | let iO = invoke(at(), "notifyNotional", [ca, fm], nil) | |
1666 | + | if ((iO == iO)) | |
1667 | + | then ((((if (jh) | |
1668 | + | then hp(ca, fk, ft, fm, fn, bP()) | |
1669 | + | else hJ(ca)) ++ hC(cL, cM, eW, iH, iI, iJ, iA, iB)) ++ hK(bR.caller, jn)) ++ hN(jo)) | |
1341 | 1670 | else throw("Strict value is not equal to itself.") | |
1342 | 1671 | } | |
1343 | 1672 | else throw("Strict value is not equal to itself.") | |
1344 | 1673 | } | |
1345 | 1674 | else throw("Strict value is not equal to itself.") | |
1346 | 1675 | } | |
1347 | 1676 | else throw("Strict value is not equal to itself.") | |
1348 | 1677 | } | |
1349 | 1678 | } | |
1350 | 1679 | else throw("Strict value is not equal to itself.") | |
1351 | 1680 | } | |
1352 | 1681 | ||
1353 | 1682 | ||
1354 | 1683 | ||
1355 | - | @Callable( | |
1356 | - | func | |
1357 | - | let | |
1358 | - | if (( | |
1684 | + | @Callable(bR) | |
1685 | + | func payFunding () = { | |
1686 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1687 | + | if ((ii == ii)) | |
1359 | 1688 | then { | |
1360 | - | let cr = toString(ci.caller) | |
1361 | - | let hk = ci.payments[0].amount | |
1362 | - | let aC = ci.payments[0].assetId | |
1363 | - | let hK = toBase58String(value(aC)) | |
1364 | - | let hL = (aC == aq()) | |
1365 | - | let hM = aB(hK) | |
1366 | - | if (if (if (if (if (if (if (if (!(hL)) | |
1367 | - | then !(hM) | |
1368 | - | else false) | |
1689 | + | let jq = bx() | |
1690 | + | if (if (if ((jq > bP())) | |
1369 | 1691 | then true | |
1370 | - | else !( | |
1692 | + | else !(ct())) | |
1371 | 1693 | then true | |
1372 | - | else !(ga(cr, hK))) | |
1373 | - | then true | |
1374 | - | else !(cC())) | |
1375 | - | then true | |
1376 | - | else cD()) | |
1377 | - | then true | |
1378 | - | else cE()) | |
1379 | - | then true | |
1380 | - | else dL()) | |
1381 | - | then throw("Invalid addMargin parameters") | |
1694 | + | else cu()) | |
1695 | + | then throw(((("Invalid funding block timestamp: " + toString(bP())) + " < ") + toString(jq))) | |
1382 | 1696 | else { | |
1383 | - | let ix = cq(cr) | |
1384 | - | let fZ = ix._1 | |
1385 | - | let hZ = ix._2 | |
1386 | - | let ia = ix._3 | |
1387 | - | let ib = ix._4 | |
1388 | - | let it = if (hL) | |
1389 | - | then { | |
1390 | - | let it = invoke(at(), "addLocked", [false], [AttachedPayment(aq(), hk)]) | |
1391 | - | if ((it == it)) | |
1392 | - | then nil | |
1393 | - | else throw("Strict value is not equal to itself.") | |
1394 | - | } | |
1395 | - | else nil | |
1396 | - | if ((it == it)) | |
1397 | - | then (gO(cr, fZ, (hZ + hk), ia, ib) ++ hm((bE() + hk))) | |
1398 | - | else throw("Strict value is not equal to itself.") | |
1697 | + | let gq = dE() | |
1698 | + | let jr = gp() | |
1699 | + | let gt = jr._1 | |
1700 | + | let gu = jr._2 | |
1701 | + | hf((jq + bA()), (bI() + gu), (bJ() + gt), aM(gu, gq), aM(gt, gq)) | |
1399 | 1702 | } | |
1400 | 1703 | } | |
1401 | 1704 | else throw("Strict value is not equal to itself.") | |
1402 | 1705 | } | |
1403 | 1706 | ||
1404 | 1707 | ||
1405 | 1708 | ||
1406 | - | @Callable(ci) | |
1407 | - | func removeMargin (hk) = { | |
1408 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1409 | - | if ((hI == hI)) | |
1709 | + | @Callable(bR) | |
1710 | + | func syncTerminalPriceToOracle () = { | |
1711 | + | let cD = bp() | |
1712 | + | let cE = bq() | |
1713 | + | let js = gk(dE(), cD, cE) | |
1714 | + | let hW = js._1 | |
1715 | + | let hX = js._2 | |
1716 | + | let go = js._3 | |
1717 | + | let hY = if ((go != 0)) | |
1410 | 1718 | then { | |
1411 | - | let cr = toString(ci.caller) | |
1412 | - | if (if (if (if (if ((0 >= hk)) | |
1413 | - | then true | |
1414 | - | else !(cB(cr))) | |
1415 | - | then true | |
1416 | - | else !(cC())) | |
1417 | - | then true | |
1418 | - | else cD()) | |
1419 | - | then true | |
1420 | - | else dL()) | |
1421 | - | then throw("Invalid removeMargin parameters") | |
1422 | - | else { | |
1423 | - | let iy = cq(cr) | |
1424 | - | let fZ = iy._1 | |
1425 | - | let hZ = iy._2 | |
1426 | - | let ia = iy._3 | |
1427 | - | let ib = iy._4 | |
1428 | - | let iz = -(hk) | |
1429 | - | let iA = dh(fZ, hZ, ib, iz) | |
1430 | - | let dq = iA._1 | |
1431 | - | let dr = iA._2 | |
1432 | - | if ((dr != 0)) | |
1433 | - | then throw("Invalid removed margin amount") | |
1434 | - | else { | |
1435 | - | let iB = ev(dq, dr, ia) | |
1436 | - | if (!(cj(iB, bG(), true))) | |
1437 | - | then throw(((("Too much margin removed: " + toString(iB)) + " < ") + toString(bG()))) | |
1438 | - | else { | |
1439 | - | let iC = toBase58String(aq()) | |
1440 | - | let iD = gd(cr) | |
1441 | - | let iE = iD._1 | |
1442 | - | let iF = iD._2 | |
1443 | - | let iG = if ((hk > iE)) | |
1444 | - | then iE | |
1445 | - | else hk | |
1446 | - | let iH = if ((iE > hk)) | |
1447 | - | then 0 | |
1448 | - | else (hk - iE) | |
1449 | - | let iI = (iE - iG) | |
1450 | - | let iJ = if ((iI > 0)) | |
1451 | - | then nil | |
1452 | - | else gJ(cr, iC) | |
1453 | - | let iK = if (((iG + iH) != hk)) | |
1454 | - | then throw(((((("toRepay=" + toString(iG)) + " + toWithdraw=") + toString(iH)) + " != ") + toString(hk))) | |
1455 | - | else nil | |
1456 | - | if ((iK == iK)) | |
1457 | - | then { | |
1458 | - | let iL = if ((iH > 0)) | |
1459 | - | then { | |
1460 | - | let iL = invoke(at(), "withdrawLocked", [iH], nil) | |
1461 | - | if ((iL == iL)) | |
1462 | - | then nil | |
1463 | - | else throw("Strict value is not equal to itself.") | |
1464 | - | } | |
1465 | - | else nil | |
1466 | - | if ((iL == iL)) | |
1467 | - | then { | |
1468 | - | let iM = if ((iG > 0)) | |
1469 | - | then { | |
1470 | - | let iN = invoke(ay(), "repay", [cr, iG, iF], nil) | |
1471 | - | if ((iN == iN)) | |
1472 | - | then [ScriptTransfer(ci.caller, iG, fromBase58String(iF))] | |
1473 | - | else throw("Strict value is not equal to itself.") | |
1474 | - | } | |
1475 | - | else nil | |
1476 | - | if ((iM == iM)) | |
1477 | - | then ((((gO(cr, fZ, dq, ia, co(fZ)) ++ (if ((iH > 0)) | |
1478 | - | then hj(ci.caller, iH) | |
1479 | - | else nil)) ++ hm((bE() - hk))) ++ iJ) ++ iM) | |
1480 | - | else throw("Strict value is not equal to itself.") | |
1481 | - | } | |
1482 | - | else throw("Strict value is not equal to itself.") | |
1483 | - | } | |
1484 | - | else throw("Strict value is not equal to itself.") | |
1485 | - | } | |
1486 | - | } | |
1487 | - | } | |
1719 | + | let hY = invoke(as(), "exchangeFreeAndLocked", [go], nil) | |
1720 | + | if ((hY == hY)) | |
1721 | + | then nil | |
1722 | + | else throw("Strict value is not equal to itself.") | |
1723 | + | } | |
1724 | + | else nil | |
1725 | + | if ((hY == hY)) | |
1726 | + | then ((hN((bl() + go)) ++ hB(hW, hX)) ++ ht(aM(aO(cD, hW), aO(cE, hX)))) | |
1727 | + | else throw("Strict value is not equal to itself.") | |
1728 | + | } | |
1729 | + | ||
1730 | + | ||
1731 | + | ||
1732 | + | @Callable(bR) | |
1733 | + | func ensureCalledOnce () = if ((bR.caller != this)) | |
1734 | + | then throw("Invalid saveCurrentTxId parameters") | |
1735 | + | else { | |
1736 | + | let jt = valueOrElse(getString(this, W), "") | |
1737 | + | if ((jt != toBase58String(bR.transactionId))) | |
1738 | + | then [StringEntry(W, jt)] | |
1739 | + | else throw("Can not call vAMM methods twice in one tx") | |
1740 | + | } | |
1741 | + | ||
1742 | + | ||
1743 | + | ||
1744 | + | @Callable(bR) | |
1745 | + | func view_calcRemainMarginWithFundingPayment (ca) = { | |
1746 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1747 | + | if ((ii == ii)) | |
1748 | + | then { | |
1749 | + | let ju = bZ(ca) | |
1750 | + | let cd = ju._1 | |
1751 | + | let em = ju._2 | |
1752 | + | let ev = ju._3 | |
1753 | + | let eo = ju._4 | |
1754 | + | let ex = ju._5 | |
1755 | + | let jv = ek(ca, aI) | |
1756 | + | let ef = jv._1 | |
1757 | + | let ej = jv._2 | |
1758 | + | let jw = dd(cd, em, eo, ex, ej) | |
1759 | + | let dl = jw._1 | |
1760 | + | let dm = jw._2 | |
1761 | + | let dh = jw._3 | |
1762 | + | let dc = jw._4 | |
1763 | + | throw(((((((aK(dl) + aK(dh)) + aK(eA(ca))) + aK(ej)) + aK(dm)) + aK(ef)) + aK(dc))) | |
1488 | 1764 | } | |
1489 | 1765 | else throw("Strict value is not equal to itself.") | |
1490 | 1766 | } | |
1491 | 1767 | ||
1492 | 1768 | ||
1493 | 1769 | ||
1494 | - | @Callable(ci) | |
1495 | - | func closePosition (gP,iO,iP) = { | |
1496 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1497 | - | if ((hI == hI)) | |
1770 | + | @Callable(bR) | |
1771 | + | func view_getPegAdjustCost (hu) = { | |
1772 | + | let cD = bp() | |
1773 | + | let cE = bq() | |
1774 | + | let gj = gk(hu, cD, cE) | |
1775 | + | throw(toString(gj._3)) | |
1776 | + | } | |
1777 | + | ||
1778 | + | ||
1779 | + | ||
1780 | + | @Callable(bR) | |
1781 | + | func view_getTerminalAmmPrice () = { | |
1782 | + | let jx = fS() | |
1783 | + | let fW = jx._1 | |
1784 | + | let fX = jx._2 | |
1785 | + | let hR = aM(aO(fW, br()), aO(fX, bs())) | |
1786 | + | throw(toString(hR)) | |
1787 | + | } | |
1788 | + | ||
1789 | + | ||
1790 | + | ||
1791 | + | @Callable(bR) | |
1792 | + | func view_getFunding () = { | |
1793 | + | let gq = dE() | |
1794 | + | let jy = gp() | |
1795 | + | let gt = jy._1 | |
1796 | + | let gu = jy._2 | |
1797 | + | let jz = aM(gu, gq) | |
1798 | + | let jA = aM(gt, gq) | |
1799 | + | throw((((aK(jz) + aK(jA)) + aK(fu())) + aK(dE()))) | |
1800 | + | } | |
1801 | + | ||
1802 | + | ||
1803 | + | ||
1804 | + | @Callable(bR) | |
1805 | + | func computeSpotPrice () = { | |
1806 | + | let ii = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1807 | + | if ((ii == ii)) | |
1498 | 1808 | then { | |
1499 | - | let cr = ch(ci) | |
1500 | - | let iQ = valueOrErrorMessage(addressFromString(cr), "Invalid caller") | |
1501 | - | let cA = cy(cr) | |
1502 | - | if (if (if (if (if (if (!(cB(cr))) | |
1503 | - | then true | |
1504 | - | else !(cC())) | |
1505 | - | then true | |
1506 | - | else cD()) | |
1507 | - | then true | |
1508 | - | else (0 >= gP)) | |
1509 | - | then true | |
1510 | - | else (0 > iO)) | |
1511 | - | then true | |
1512 | - | else dL()) | |
1513 | - | then throw("Invalid closePosition parameters") | |
1514 | - | else { | |
1515 | - | let iR = cq(cr) | |
1516 | - | let fZ = iR._1 | |
1517 | - | let hZ = iR._2 | |
1518 | - | let ia = iR._3 | |
1519 | - | let ib = iR._4 | |
1520 | - | let iS = if ((bc(fZ) > gP)) | |
1521 | - | then { | |
1522 | - | let hE = if ((fZ > 0)) | |
1523 | - | then aH | |
1524 | - | else aG | |
1525 | - | let if = (hE == aG) | |
1526 | - | let iT = dD((fZ > 0), gP, true) | |
1527 | - | let eL = iT._1 | |
1528 | - | let cU = iT._2 | |
1529 | - | let cV = iT._3 | |
1530 | - | let eS = iT._4 | |
1531 | - | let eK = if ((fZ > 0)) | |
1532 | - | then -(gP) | |
1533 | - | else gP | |
1534 | - | let iU = eq(cr, aP) | |
1535 | - | let io = iU._1 | |
1536 | - | let ep = iU._2 | |
1537 | - | let iV = ez(cr, aP) | |
1538 | - | let iW = aT(bc(eK), bc(fZ)) | |
1539 | - | let eP = aV(ep, iW) | |
1540 | - | let iX = aV(aV(io, iW), cA) | |
1541 | - | let iY = dh(fZ, hZ, ib, ep)._1 | |
1542 | - | let iZ = dh(fZ, hZ, ib, eP)._2 | |
1543 | - | let ja = (ep - eP) | |
1544 | - | let jb = if ((fZ > 0)) | |
1545 | - | then ((io - eL) - ja) | |
1546 | - | else ((ja + io) - eL) | |
1547 | - | let iq = bc(jb) | |
1548 | - | let ij = (fZ + eK) | |
1549 | - | let jc = co(ij) | |
1550 | - | let jd = (ia - iq) | |
1551 | - | let eV = (bM() - jd) | |
1552 | - | let je = if ((fZ > 0)) | |
1553 | - | then (aV((iq + ja), iV) - ja) | |
1554 | - | else (aV((iq - ja), iV) - ja) | |
1555 | - | let jf = ((iY - (je + ja)) - iX) | |
1556 | - | let jg = if ((0 > jf)) | |
1557 | - | then throw("Margin error: unable to pay close fee") | |
1558 | - | else jf | |
1559 | - | if (if ((iO != 0)) | |
1560 | - | then (iO > eL) | |
1561 | - | else false) | |
1562 | - | then throw(((("Limit error: " + toString(eL)) + " < ") + toString(iO))) | |
1563 | - | else $Tuple16(ij, if (iP) | |
1564 | - | then (je + jg) | |
1565 | - | else je, iq, jc, iZ, eP, if (iP) | |
1566 | - | then 0 | |
1567 | - | else jg, cU, cV, eS, eV, (cd() - (if ((ij > 0)) | |
1568 | - | then bc(eK) | |
1569 | - | else 0)), (cc() - (if ((0 > ij)) | |
1570 | - | then bc(eK) | |
1571 | - | else 0)), (bO() - (if ((ij > 0)) | |
1572 | - | then jd | |
1573 | - | else 0)), (bN() - (if ((0 > ij)) | |
1574 | - | then jd | |
1575 | - | else 0)), iX) | |
1576 | - | } | |
1577 | - | else if ((gP > bc(fZ))) | |
1578 | - | then throw("Invalid closePosition parameters") | |
1579 | - | else { | |
1580 | - | let jh = eM(cr, true) | |
1581 | - | let el = jh._1 | |
1582 | - | let iZ = jh._2 | |
1583 | - | let eP = jh._3 | |
1584 | - | let ji = jh._4 | |
1585 | - | let cU = jh._5 | |
1586 | - | let cV = jh._6 | |
1587 | - | let eS = jh._7 | |
1588 | - | let eV = jh._8 | |
1589 | - | let eL = jh._9 | |
1590 | - | let eT = jh._10 | |
1591 | - | let eU = jh._11 | |
1592 | - | let ik = jh._12 | |
1593 | - | let il = jh._13 | |
1594 | - | let iX = aV(eL, cA) | |
1595 | - | let jf = (bc(ji) - iX) | |
1596 | - | let jg = if ((0 > jf)) | |
1597 | - | then throw(((((((("Margin error: unable to pay close fee: " + toString(iX)) + " margin: ") + toString(ji)) + " fee percent: ") + toString(cA)) + " notional: ") + toString(eL))) | |
1598 | - | else jf | |
1599 | - | if (if ((iO != 0)) | |
1600 | - | then (iO > eL) | |
1601 | - | else false) | |
1602 | - | then throw(((("Limit error: " + toString(eL)) + " < ") + toString(iO))) | |
1603 | - | else $Tuple16(0, 0, 0, 0, iZ, eP, jg, cU, cV, eS, eV, eT, eU, ik, il, iX) | |
1604 | - | } | |
1605 | - | let ij = iS._1 | |
1606 | - | let je = iS._2 | |
1607 | - | let iq = iS._3 | |
1608 | - | let jc = iS._4 | |
1609 | - | let iZ = iS._5 | |
1610 | - | let eP = iS._6 | |
1611 | - | let jg = iS._7 | |
1612 | - | let cU = iS._8 | |
1613 | - | let cV = iS._9 | |
1614 | - | let eS = iS._10 | |
1615 | - | let eV = iS._11 | |
1616 | - | let eT = iS._12 | |
1617 | - | let eU = iS._13 | |
1618 | - | let ik = iS._14 | |
1619 | - | let il = iS._15 | |
1620 | - | let iX = iS._16 | |
1621 | - | if ((iZ > 0)) | |
1622 | - | then throw("Unable to close position with bad debt") | |
1623 | - | else { | |
1624 | - | let jj = (ij != 0) | |
1625 | - | let jk = (jg + iX) | |
1626 | - | let jl = (bE() - jk) | |
1627 | - | let jm = if ((0 > jl)) | |
1628 | - | then $Tuple2(0, bc(jl)) | |
1629 | - | else $Tuple2(jl, 0) | |
1630 | - | let jn = jm._1 | |
1631 | - | let jo = jm._2 | |
1632 | - | let jp = gd(cr) | |
1633 | - | let iE = jp._1 | |
1634 | - | let iF = jp._2 | |
1635 | - | let jq = if ((iE > 0)) | |
1636 | - | then if ((jk >= iE)) | |
1637 | - | then { | |
1638 | - | let iN = invoke(ay(), "repay", [cr, iE, iF], nil) | |
1639 | - | if ((iN == iN)) | |
1640 | - | then $Tuple3(iE, (jk - iE), jj) | |
1641 | - | else throw("Strict value is not equal to itself.") | |
1642 | - | } | |
1643 | - | else { | |
1644 | - | let jr = invoke(ay(), if (jj) | |
1645 | - | then "repay" | |
1646 | - | else "realizePartiallyAndClose", [cr, jk, iF], nil) | |
1647 | - | if ((jr == jr)) | |
1648 | - | then $Tuple3(jk, 0, false) | |
1649 | - | else throw("Strict value is not equal to itself.") | |
1650 | - | } | |
1651 | - | else $Tuple3(0, jk, false) | |
1652 | - | if ((jq == jq)) | |
1653 | - | then { | |
1654 | - | let js = jq._3 | |
1655 | - | let jt = jq._2 | |
1656 | - | let ju = jq._1 | |
1657 | - | let jv = if ((jt >= iX)) | |
1658 | - | then $Tuple3(ju, (jt - iX), iX) | |
1659 | - | else { | |
1660 | - | let jw = (iX - jt) | |
1661 | - | let jx = (ju - jw) | |
1662 | - | let hR = assetBalance(this, aq()) | |
1663 | - | if ((hR == hR)) | |
1664 | - | then { | |
1665 | - | let hS = invoke(az(), "swap", [toBase58String(aq()), 0], [AttachedPayment(fromBase58String(iF), jw)]) | |
1666 | - | if ((hS == hS)) | |
1667 | - | then { | |
1668 | - | let hT = assetBalance(this, aq()) | |
1669 | - | if ((hT == hT)) | |
1670 | - | then { | |
1671 | - | let hU = (hT - hR) | |
1672 | - | if ((hU == hU)) | |
1673 | - | then $Tuple3(jx, 0, (jt + hU)) | |
1674 | - | else throw("Strict value is not equal to itself.") | |
1675 | - | } | |
1676 | - | else throw("Strict value is not equal to itself.") | |
1677 | - | } | |
1678 | - | else throw("Strict value is not equal to itself.") | |
1679 | - | } | |
1680 | - | else throw("Strict value is not equal to itself.") | |
1681 | - | } | |
1682 | - | if ((jv == jv)) | |
1683 | - | then { | |
1684 | - | let jy = jv._3 | |
1685 | - | let jz = jv._2 | |
1686 | - | let jx = jv._1 | |
1687 | - | let jA = if ((jt > 0)) | |
1688 | - | then { | |
1689 | - | let jA = invoke(at(), "withdrawLocked", [jt], nil) | |
1690 | - | if ((jA == jA)) | |
1691 | - | then nil | |
1692 | - | else throw("Strict value is not equal to itself.") | |
1693 | - | } | |
1694 | - | else nil | |
1695 | - | if ((jA == jA)) | |
1696 | - | then { | |
1697 | - | let jB = gn(jy) | |
1698 | - | let gp = jB._1 | |
1699 | - | let gq = jB._2 | |
1700 | - | let iu = invoke(at(), "addFree", nil, [AttachedPayment(aq(), gq)]) | |
1701 | - | if ((iu == iu)) | |
1702 | - | then { | |
1703 | - | let iv = invoke(au(), "notifyFees", [cr, iX], nil) | |
1704 | - | if ((iv == iv)) | |
1705 | - | then { | |
1706 | - | let iw = invoke(au(), "notifyNotional", [cr, iq], nil) | |
1707 | - | if ((iw == iw)) | |
1708 | - | then (((((((if (jj) | |
1709 | - | then gO(cr, ij, je, iq, jc) | |
1710 | - | else hi(cr)) ++ (if (js) | |
1711 | - | then { | |
1712 | - | let iC = toBase58String(aq()) | |
1713 | - | gJ(cr, iC) | |
1714 | - | } | |
1715 | - | else nil)) ++ hb(cU, cV, eS, eV, eT, eU, ik, il)) ++ hn(gp)) ++ (if ((jz > 0)) | |
1716 | - | then hj(iQ, jz) | |
1717 | - | else nil)) ++ hm(jn)) ++ (if ((jx > 0)) | |
1718 | - | then [ScriptTransfer(iQ, jx, fromBase58String(iF))] | |
1719 | - | else nil)) | |
1720 | - | else throw("Strict value is not equal to itself.") | |
1721 | - | } | |
1722 | - | else throw("Strict value is not equal to itself.") | |
1723 | - | } | |
1724 | - | else throw("Strict value is not equal to itself.") | |
1725 | - | } | |
1726 | - | else throw("Strict value is not equal to itself.") | |
1727 | - | } | |
1728 | - | else throw("Strict value is not equal to itself.") | |
1729 | - | } | |
1730 | - | else throw("Strict value is not equal to itself.") | |
1731 | - | } | |
1732 | - | } | |
1809 | + | let gj = dY() | |
1810 | + | $Tuple2(nil, gj) | |
1733 | 1811 | } | |
1734 | 1812 | else throw("Strict value is not equal to itself.") | |
1735 | 1813 | } | |
1736 | 1814 | ||
1737 | 1815 | ||
1738 | 1816 | ||
1739 | - | @Callable(ci) | |
1740 | - | func liquidate (cr) = { | |
1741 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1742 | - | if ((hI == hI)) | |
1743 | - | then { | |
1744 | - | let jC = ez(cr, aP) | |
1745 | - | let iB = if (eb()) | |
1746 | - | then { | |
1747 | - | let jD = ez(cr, aQ) | |
1748 | - | bd(jC, jD) | |
1749 | - | } | |
1750 | - | else jC | |
1751 | - | if (if (if (if (if (!(cj(iB, bT(), false))) | |
1752 | - | then true | |
1753 | - | else !(cB(cr))) | |
1754 | - | then true | |
1755 | - | else !(cC())) | |
1756 | - | then true | |
1757 | - | else cD()) | |
1758 | - | then true | |
1759 | - | else dL()) | |
1760 | - | then throw("Unable to liquidate") | |
1761 | - | else if (if (if ((jC > bU())) | |
1762 | - | then (bV() > 0) | |
1763 | - | else false) | |
1764 | - | then (aM > bV()) | |
1765 | - | else false) | |
1766 | - | then { | |
1767 | - | let jE = cq(cr) | |
1768 | - | let fZ = jE._1 | |
1769 | - | let hZ = jE._2 | |
1770 | - | let ia = jE._3 | |
1771 | - | let ib = jE._4 | |
1772 | - | let hE = if ((fZ > 0)) | |
1773 | - | then aH | |
1774 | - | else aG | |
1775 | - | let if = (hE == aG) | |
1776 | - | let eL = eF(cr, fZ) | |
1777 | - | let jF = eq(cr, aP) | |
1778 | - | let io = jF._1 | |
1779 | - | let ep = jF._2 | |
1780 | - | let jG = cQ(if, eL) | |
1781 | - | let eK = jG._1 | |
1782 | - | let cU = jG._2 | |
1783 | - | let cV = jG._3 | |
1784 | - | let eS = jG._4 | |
1785 | - | let jH = aT(bc(eK), bc(fZ)) | |
1786 | - | let eP = aV(ep, jH) | |
1787 | - | let jI = dh(fZ, hZ, ib, eP) | |
1788 | - | let dq = jI._1 | |
1789 | - | let dr = jI._2 | |
1790 | - | let dm = jI._3 | |
1791 | - | let ja = (ep - eP) | |
1792 | - | let jb = if ((fZ > 0)) | |
1793 | - | then ((io - eL) - ja) | |
1794 | - | else ((ja + io) - eL) | |
1795 | - | let jJ = aV(eL, bU()) | |
1796 | - | let jK = (jJ / 2) | |
1797 | - | let gq = (jJ - jK) | |
1798 | - | let je = (dq - jJ) | |
1799 | - | let ij = (fZ + eK) | |
1800 | - | let iq = bc(jb) | |
1801 | - | let jd = (ia - iq) | |
1802 | - | let jc = co(ij) | |
1803 | - | let eV = (bM() - jd) | |
1804 | - | let jl = (bE() - jJ) | |
1805 | - | let jL = if ((0 > jl)) | |
1806 | - | then $Tuple2(0, bc(jl)) | |
1807 | - | else $Tuple2(jl, 0) | |
1808 | - | let jM = jL._1 | |
1809 | - | let jo = jL._2 | |
1810 | - | let jN = gd(cr) | |
1811 | - | let iE = jN._1 | |
1812 | - | let iF = jN._2 | |
1813 | - | let jO = if ((iE > 0)) | |
1814 | - | then { | |
1815 | - | let jP = aV(iE, jH) | |
1816 | - | let jr = invoke(ay(), "realizePartially", [cr, iF, jP], nil) | |
1817 | - | if ((jr == jr)) | |
1818 | - | then nil | |
1819 | - | else throw("Strict value is not equal to itself.") | |
1820 | - | } | |
1821 | - | else nil | |
1822 | - | if ((jO == jO)) | |
1823 | - | then { | |
1824 | - | let jA = invoke(at(), "withdrawLocked", [jJ], nil) | |
1825 | - | if ((jA == jA)) | |
1826 | - | then { | |
1827 | - | let jQ = invoke(at(), "addFree", nil, [AttachedPayment(aq(), gq)]) | |
1828 | - | if ((jQ == jQ)) | |
1829 | - | then { | |
1830 | - | let iw = invoke(au(), "notifyNotional", [cr, iq], nil) | |
1831 | - | if ((iw == iw)) | |
1832 | - | then (((gO(cr, ij, je, iq, jc) ++ hb(cU, cV, eS, eV, (cd() - (if ((ij > 0)) | |
1833 | - | then bc(eK) | |
1834 | - | else 0)), (cc() - (if ((0 > ij)) | |
1835 | - | then bc(eK) | |
1836 | - | else 0)), (bO() - (if ((ij > 0)) | |
1837 | - | then jd | |
1838 | - | else 0)), (bN() - (if ((0 > ij)) | |
1839 | - | then jd | |
1840 | - | else 0)))) ++ hj(ci.caller, jK)) ++ hm(jM)) | |
1841 | - | else throw("Strict value is not equal to itself.") | |
1842 | - | } | |
1843 | - | else throw("Strict value is not equal to itself.") | |
1844 | - | } | |
1845 | - | else throw("Strict value is not equal to itself.") | |
1846 | - | } | |
1847 | - | else throw("Strict value is not equal to itself.") | |
1848 | - | } | |
1849 | - | else { | |
1850 | - | let jR = eM(cr, false) | |
1851 | - | let ek = jR._1 | |
1852 | - | let dr = jR._2 | |
1853 | - | let el = jR._3 | |
1854 | - | let em = jR._4 | |
1855 | - | let cU = jR._5 | |
1856 | - | let cV = jR._6 | |
1857 | - | let eS = jR._7 | |
1858 | - | let eV = jR._8 | |
1859 | - | let eL = jR._9 | |
1860 | - | let eT = jR._10 | |
1861 | - | let eU = jR._11 | |
1862 | - | let ik = jR._12 | |
1863 | - | let il = jR._13 | |
1864 | - | let jJ = aV(eL, bU()) | |
1865 | - | let jK = (jJ / 2) | |
1866 | - | let gq = (jJ - jK) | |
1867 | - | let jl = (bE() - jJ) | |
1868 | - | let jS = if ((0 > jl)) | |
1869 | - | then $Tuple2(0, bc(jl)) | |
1870 | - | else $Tuple2(jl, 0) | |
1871 | - | let jM = jS._1 | |
1872 | - | let jo = jS._2 | |
1873 | - | let jT = gd(cr) | |
1874 | - | let iE = jT._1 | |
1875 | - | let iF = jT._2 | |
1876 | - | let jO = if ((iE > 0)) | |
1877 | - | then { | |
1878 | - | let jr = invoke(ay(), "realizePartiallyAndClose", [cr, 0, iF], nil) | |
1879 | - | if ((jr == jr)) | |
1880 | - | then nil | |
1881 | - | else throw("Strict value is not equal to itself.") | |
1882 | - | } | |
1883 | - | else nil | |
1884 | - | if ((jO == jO)) | |
1885 | - | then { | |
1886 | - | let gj = if ((dr > 0)) | |
1887 | - | then { | |
1888 | - | let jU = invoke(at(), "exchangeFreeAndLocked", [dr], nil) | |
1889 | - | if ((jU == jU)) | |
1890 | - | then nil | |
1891 | - | else throw("Strict value is not equal to itself.") | |
1892 | - | } | |
1893 | - | else nil | |
1894 | - | if ((gj == gj)) | |
1895 | - | then { | |
1896 | - | let jA = invoke(at(), "withdrawLocked", [jJ], nil) | |
1897 | - | if ((jA == jA)) | |
1898 | - | then { | |
1899 | - | let jQ = invoke(at(), "addFree", nil, [AttachedPayment(aq(), gq)]) | |
1900 | - | if ((jQ == jQ)) | |
1901 | - | then { | |
1902 | - | let iw = invoke(au(), "notifyNotional", [cr, 0], nil) | |
1903 | - | if ((iw == iw)) | |
1904 | - | then (((hi(cr) ++ hb(cU, cV, eS, eV, eT, eU, ik, il)) ++ hj(ci.caller, jK)) ++ hm(jM)) | |
1905 | - | else throw("Strict value is not equal to itself.") | |
1906 | - | } | |
1907 | - | else throw("Strict value is not equal to itself.") | |
1908 | - | } | |
1909 | - | else throw("Strict value is not equal to itself.") | |
1910 | - | } | |
1911 | - | else throw("Strict value is not equal to itself.") | |
1912 | - | } | |
1913 | - | else throw("Strict value is not equal to itself.") | |
1914 | - | } | |
1915 | - | } | |
1916 | - | else throw("Strict value is not equal to itself.") | |
1817 | + | @Callable(bR) | |
1818 | + | func computeFeeForTraderWithArtifact (ca,gw) = { | |
1819 | + | let gj = gI(ca, gw) | |
1820 | + | $Tuple2(nil, gj) | |
1917 | 1821 | } | |
1918 | 1822 | ||
1919 | 1823 | ||
1920 | - | ||
1921 | - | @Callable(ci) | |
1922 | - | func payFunding () = { | |
1923 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1924 | - | if ((hI == hI)) | |
1925 | - | then { | |
1926 | - | let jV = bP() | |
1927 | - | if (if (if ((jV > lastBlock.timestamp)) | |
1928 | - | then true | |
1929 | - | else !(cC())) | |
1930 | - | then true | |
1931 | - | else cD()) | |
1932 | - | then throw(((("Invalid funding block timestamp: " + toString(lastBlock.timestamp)) + " < ") + toString(jV))) | |
1933 | - | else { | |
1934 | - | let fJ = dE() | |
1935 | - | let jW = fI() | |
1936 | - | let fM = jW._1 | |
1937 | - | let fN = jW._2 | |
1938 | - | gD((jV + bS()), (ca() + fN), (cb() + fM), aT(fN, fJ), aT(fM, fJ)) | |
1939 | - | } | |
1940 | - | } | |
1941 | - | else throw("Strict value is not equal to itself.") | |
1942 | - | } | |
1943 | - | ||
1944 | - | ||
1945 | - | ||
1946 | - | @Callable(ci) | |
1947 | - | func syncTerminalPriceToOracle () = { | |
1948 | - | let cM = bH() | |
1949 | - | let cN = bI() | |
1950 | - | let jX = fE(dE(), cM, cN) | |
1951 | - | let hv = jX._1 | |
1952 | - | let hw = jX._2 | |
1953 | - | let eQ = jX._3 | |
1954 | - | let hx = if ((eQ != 0)) | |
1955 | - | then { | |
1956 | - | let hx = invoke(at(), "exchangeFreeAndLocked", [eQ], nil) | |
1957 | - | if ((hx == hx)) | |
1958 | - | then nil | |
1959 | - | else throw("Strict value is not equal to itself.") | |
1960 | - | } | |
1961 | - | else nil | |
1962 | - | if ((hx == hx)) | |
1963 | - | then (ha(hv, hw) ++ gS(aT(aV(cM, hv), aV(cN, hw)))) | |
1964 | - | else throw("Strict value is not equal to itself.") | |
1965 | - | } | |
1966 | - | ||
1967 | - | ||
1968 | - | ||
1969 | - | @Callable(ci) | |
1970 | - | func view_calcRemainMarginWithFundingPayment (cr) = { | |
1971 | - | let hI = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1972 | - | if ((hI == hI)) | |
1973 | - | then { | |
1974 | - | let jY = cq(cr) | |
1975 | - | let cu = jY._1 | |
1976 | - | let es = jY._2 | |
1977 | - | let eB = jY._3 | |
1978 | - | let eu = jY._4 | |
1979 | - | let jZ = eq(cr, aP) | |
1980 | - | let eh = jZ._1 | |
1981 | - | let ep = jZ._2 | |
1982 | - | let ka = dh(cu, es, eu, ep) | |
1983 | - | let dq = ka._1 | |
1984 | - | let dr = ka._2 | |
1985 | - | let dm = ka._3 | |
1986 | - | throw((((((aR(dq) + aR(dm)) + aR(eE(cr))) + aR(ep)) + aR(dr)) + aR(eh))) | |
1987 | - | } | |
1988 | - | else throw("Strict value is not equal to itself.") | |
1989 | - | } | |
1990 | - | ||
1991 | - | ||
1992 | - | ||
1993 | - | @Callable(ci) | |
1994 | - | func view_getPegAdjustCost (gT) = { | |
1995 | - | let cM = bH() | |
1996 | - | let cN = bI() | |
1997 | - | let fD = fE(gT, cM, cN) | |
1998 | - | throw(toString(fD._3)) | |
1999 | - | } | |
2000 | - | ||
2001 | - | ||
2002 | - | ||
2003 | - | @Callable(ci) | |
2004 | - | func view_getTerminalAmmPrice () = { | |
2005 | - | let kb = fm() | |
2006 | - | let fq = kb._1 | |
2007 | - | let fr = kb._2 | |
2008 | - | let hq = aT(aV(fq, bJ()), aV(fr, bK())) | |
2009 | - | throw(toString(hq)) | |
2010 | - | } | |
2011 | - | ||
2012 | - | ||
2013 | - | ||
2014 | - | @Callable(ci) | |
2015 | - | func view_getFunding () = { | |
2016 | - | let fJ = dE() | |
2017 | - | let kc = fI() | |
2018 | - | let fM = kc._1 | |
2019 | - | let fN = kc._2 | |
2020 | - | let kd = aT(fN, fJ) | |
2021 | - | let ke = aT(fM, fJ) | |
2022 | - | throw((((aR(kd) + aR(ke)) + aR(eW())) + aR(dE()))) | |
2023 | - | } | |
2024 | - | ||
2025 | - | ||
2026 | - | ||
2027 | - | @Callable(ci) | |
2028 | - | func view_getBorrowedByTrader (cr) = { | |
2029 | - | let kf = gd(cr) | |
2030 | - | let iE = kf._1 | |
2031 | - | let iF = kf._2 | |
2032 | - | throw((aR(iE) + iF)) | |
2033 | - | } | |
2034 | - | ||
2035 | - | ||
2036 | - | ||
2037 | - | @Callable(ci) | |
2038 | - | func computeSpotPrice () = { | |
2039 | - | let fD = ea() | |
2040 | - | $Tuple2(nil, fD) | |
2041 | - | } | |
2042 | - | ||
2043 | - | ||
2044 | - | ||
2045 | - | @Callable(ci) | |
2046 | - | func computeFeeForTraderWithArtifact (cr,fP) = { | |
2047 | - | let fD = gg(cr, fP) | |
2048 | - | $Tuple2(nil, fD) | |
2049 | - | } | |
2050 | - | ||
2051 | - | ||
2052 | - | @Verifier(kg) | |
2053 | - | func kh () = sigVerify(kg.bodyBytes, kg.proofs[0], ap()) | |
1824 | + | @Verifier(jB) | |
1825 | + | func jC () = sigVerify(jB.bodyBytes, jB.proofs[0], ao()) | |
2054 | 1826 |
github/deemru/w8io/026f985 514.17 ms ◑