tx · oLvNyjBeZwcZcPEo8j9y5PtWZzgucb4Z8A5QErBQZ6K 3MuVPd1NeQSnzumvZdaDeHwuwFUw3V3R7b1: -0.03400000 Waves 2022.09.02 16:55 [2211593] smart account 3MuVPd1NeQSnzumvZdaDeHwuwFUw3V3R7b1 > SELF 0.00000000 Waves
{ "type": 13, "id": "oLvNyjBeZwcZcPEo8j9y5PtWZzgucb4Z8A5QErBQZ6K", "fee": 3400000, "feeAssetId": null, "timestamp": 1662126932256, "version": 2, "chainId": 84, "sender": "3MuVPd1NeQSnzumvZdaDeHwuwFUw3V3R7b1", "senderPublicKey": "4btfk5pXDrFDWvshTaXTnRLU9Z6PMgAERH6LiB1Wh4xM", "proofs": [ "4B71VesWmquq2j3Q5KjQnU3WK54VQ7R4CNY7ERfXh6oH5etweAy9uasw3xpk9dBn9QzoVwx8tUivydM6FXJuu4Go" ], "script": "base64:BgIVCAISAwoBCBIAEgMKAQgSBQoDCAgIFAAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzABJrX2FkbWluX3B1YmxpY19rZXkCEmtfYWRtaW5fcHVibGljX2tleQATa19xdW90ZUFzc2V0UmVzZXJ2ZQIIa19xdEFzdFIAEmtfYmFzZUFzc2V0UmVzZXJ2ZQIIa19ic0FzdFIAFGtfcG9zaXRpb25DbG9zZWREYXRlAhRrX3Bvc2l0aW9uQ2xvc2VkRGF0ZQAQa19leGVjdXRlZE9yZGVycwIQa19leGVjdXRlZE9yZGVycwAIa19zZW5kZXICCGtfc2VuZGVyAA1rX2luaXRpYWxpemVkAg1rX2luaXRpYWxpemVkAAtUQUtFX1BST0ZJVAABAAlTVE9QX0xPU1MAAgAEVElNRQgFCWxhc3RCbG9jawl0aW1lc3RhbXAADERFQ0lNQUxfVU5JVAkAaAIAAQkAaAIJAGgCCQBoAgkAaAIJAGgCAAoACgAKAAoACgAKAQRkaXZkAgJfeAJfeQkAbgQFAl94BQxERUNJTUFMX1VOSVQFAl95BQ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plexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = "k_coordinatorAddress" | |
5 | + | ||
6 | + | let b = "k_admin_public_key" | |
7 | + | ||
8 | + | let c = "k_qtAstR" | |
9 | + | ||
10 | + | let d = "k_bsAstR" | |
11 | + | ||
12 | + | let e = "k_positionClosedDate" | |
13 | + | ||
14 | + | let f = "k_executedOrders" | |
15 | + | ||
16 | + | let g = "k_sender" | |
17 | + | ||
18 | + | let h = "k_initialized" | |
19 | + | ||
20 | + | let i = 1 | |
21 | + | ||
22 | + | let j = 2 | |
23 | + | ||
24 | + | let k = lastBlock.timestamp | |
25 | + | ||
26 | + | let l = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
27 | + | ||
28 | + | func m (n,o) = fraction(n, l, o, HALFEVEN) | |
29 | + | ||
30 | + | ||
31 | + | func p (n,o) = fraction(n, o, l, HALFEVEN) | |
32 | + | ||
33 | + | ||
34 | + | func q (r) = ((f + "_") + r) | |
35 | + | ||
36 | + | ||
37 | + | func s () = valueOrErrorMessage(addressFromString(getStringValue(this, a)), "Coordinator not set") | |
38 | + | ||
39 | + | ||
40 | + | func t () = fromBase58String(getStringValue(s(), b)) | |
41 | + | ||
42 | + | ||
43 | + | func u () = valueOrElse(getBoolean(this, h), false) | |
44 | + | ||
45 | + | ||
46 | + | func v (w,x,y,z) = { | |
47 | + | let A = toBytes((w + x)) | |
48 | + | let B = fromBase58String(y) | |
49 | + | let C = fromBase58String(z) | |
50 | + | if (sigVerify(A, B, C)) | |
51 | + | then unit | |
52 | + | else throw("Invalid order signature") | |
53 | + | } | |
54 | + | ||
55 | + | ||
56 | + | func D (r) = if (valueOrElse(getBoolean(this, q(r)), false)) | |
57 | + | then throw(("Order already executed: " + r)) | |
58 | + | else unit | |
59 | + | ||
60 | + | ||
61 | + | @Callable(E) | |
62 | + | func setContext (F) = if ((E.caller != this)) | |
63 | + | then throw("Only self-call") | |
64 | + | else [StringEntry(g, F)] | |
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | @Callable(E) | |
69 | + | func resetContext () = if ((E.caller != this)) | |
70 | + | then throw("Only self-call") | |
71 | + | else [DeleteEntry(g)] | |
72 | + | ||
73 | + | ||
74 | + | ||
75 | + | @Callable(E) | |
76 | + | func initialize (G) = if (u()) | |
77 | + | then throw("Already initialized") | |
78 | + | else [StringEntry(a, G), BooleanEntry(h, true)] | |
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | @Callable(E) | |
83 | + | func executeOrder (w,x,y) = { | |
84 | + | let H = split(x, ",") | |
85 | + | let I = valueOrErrorMessage(parseInt(H[0]), "Invalid order data [type]") | |
86 | + | let J = toBase58String(sha256(toBytes(x))) | |
87 | + | let K = D(J) | |
88 | + | if ((K == K)) | |
89 | + | then if (if ((I == i)) | |
90 | + | then true | |
91 | + | else (I == j)) | |
92 | + | then { | |
93 | + | let L = H[1] | |
94 | + | let M = H[2] | |
95 | + | let N = valueOrErrorMessage(parseInt(H[3]), "Invalid order data [price]") | |
96 | + | let O = valueOrErrorMessage(parseInt(H[4]), "Invalid order data [timestamp]") | |
97 | + | let P = valueOrErrorMessage(parseInt(H[5]), "Invalid order data [validDue]") | |
98 | + | let Q = v(w, x, y, M) | |
99 | + | if ((Q == Q)) | |
100 | + | then { | |
101 | + | let R = valueOrErrorMessage(addressFromString(L), "Invalid order data [amm]") | |
102 | + | let S = getIntegerValue(R, c) | |
103 | + | let T = getIntegerValue(R, d) | |
104 | + | let U = m(S, T) | |
105 | + | let V = if ((I == i)) | |
106 | + | then (U >= N) | |
107 | + | else (N >= U) | |
108 | + | let W = if (!(V)) | |
109 | + | then throw(((("Can not execute order [price]: AMM Price=" + toString(U)) + " Order Price=") + toString(N))) | |
110 | + | else unit | |
111 | + | if ((W == W)) | |
112 | + | then { | |
113 | + | let X = if ((P == 0)) | |
114 | + | then true | |
115 | + | else (P >= k) | |
116 | + | let Y = if (!(X)) | |
117 | + | then throw(((("Can not execute order [due]: Due=" + toString(P)) + " Time=") + toString(k))) | |
118 | + | else unit | |
119 | + | if ((Y == Y)) | |
120 | + | then { | |
121 | + | let Z = toString(addressFromPublicKey(fromBase58String(M))) | |
122 | + | let aa = valueOrElse(getInteger(R, ((e + "_") + Z)), 0) | |
123 | + | let ab = (O >= aa) | |
124 | + | let ac = if (!(ab)) | |
125 | + | then throw(((("Can not execute order [position closed]: Order Created=" + toString(O)) + " Position Closed=") + toString(aa))) | |
126 | + | else unit | |
127 | + | if ((ac == ac)) | |
128 | + | then if (if (if (V) | |
129 | + | then X | |
130 | + | else false) | |
131 | + | then ab | |
132 | + | else false) | |
133 | + | then { | |
134 | + | let ad = invoke(this, "setContext", [Z], nil) | |
135 | + | if ((ad == ad)) | |
136 | + | then { | |
137 | + | let ae = invoke(R, "closePosition", nil, nil) | |
138 | + | if ((ae == ae)) | |
139 | + | then { | |
140 | + | let af = invoke(this, "resetContext", nil, nil) | |
141 | + | if ((af == af)) | |
142 | + | then [BooleanEntry(q(J), true)] | |
143 | + | else throw("Strict value is not equal to itself.") | |
144 | + | } | |
145 | + | else throw("Strict value is not equal to itself.") | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | else throw("Invalid order execution timing") | |
150 | + | else throw("Strict value is not equal to itself.") | |
151 | + | } | |
152 | + | else throw("Strict value is not equal to itself.") | |
153 | + | } | |
154 | + | else throw("Strict value is not equal to itself.") | |
155 | + | } | |
156 | + | else throw("Strict value is not equal to itself.") | |
157 | + | } | |
158 | + | else throw(("Invalid order type: " + toString(I))) | |
159 | + | else throw("Strict value is not equal to itself.") | |
160 | + | } | |
161 | + | ||
162 | + | ||
163 | + | @Verifier(ag) | |
164 | + | func ah () = sigVerify(ag.bodyBytes, ag.proofs[0], t()) | |
165 | + |
github/deemru/w8io/169f3d6 45.88 ms ◑