1 | | - | {-# STDLIB_VERSION 4 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let a = "2.1.9-beta_20210302" |
---|
5 | | - | |
---|
6 | | - | let b = 10000 |
---|
7 | | - | |
---|
8 | | - | let c = 1000000 |
---|
9 | | - | |
---|
10 | | - | let d = 100000000 |
---|
11 | | - | |
---|
12 | | - | let e = (604800 * 1000) |
---|
13 | | - | |
---|
14 | | - | let f = (100 * c) |
---|
15 | | - | |
---|
16 | | - | let g = ((20 * b) / 100) |
---|
17 | | - | |
---|
18 | | - | let h = base58'JDYJq5RKnSXKLYUQfL89zWPdM3QH5hW8JUTpjnTYV95k' |
---|
19 | | - | |
---|
20 | | - | let i = base58'JDYJq5RKnSXKLYUQfL89zWPdM3QH5hW8JUTpjnTYV95k' |
---|
21 | | - | |
---|
22 | | - | let j = base58'9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5' |
---|
23 | | - | |
---|
24 | | - | let k = ([valueOrElse(getBinary(this, "guarantor1"), base58''), valueOrElse(getBinary(this, "guarantor2"), base58''), valueOrElse(getBinary(this, "guarantor3"), base58'')] :+ base58'') |
---|
25 | | - | |
---|
26 | | - | let l = value(indexOf(k, base58'')) |
---|
27 | | - | |
---|
28 | | - | let m = ((l / 2) + (l % 2)) |
---|
29 | | - | |
---|
30 | | - | let n = base58'34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ' |
---|
31 | | - | |
---|
32 | | - | let o = base58'6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ' |
---|
33 | | - | |
---|
34 | | - | let p = base58'4wcCKU3Cu4ABpmfiwzufocvrQQuRX4QMHZ7TjpRwtAmn' |
---|
35 | | - | |
---|
36 | | - | let q = base58'Z7817F7hnbWYsVHykjPtn8sUjyuLLf8NPofdveb8CMD' |
---|
37 | | - | |
---|
38 | | - | let r = base58'5EMfVQiB8NF4HuhaXrZzDM637whWuVBsduq59ZaCSNqk' |
---|
39 | | - | |
---|
40 | | - | let s = [base58'34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ', base58'6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ', base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS', base58'474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu', base58'zMFqXuoyrn5w17PFurTqxB7GsS71fp9dfk6XFwxbPCy', base58'HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk', base58'B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H', base58'5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3', base58'BrjUWjndUanm5VsJkbUip8VRYy6LWJePtxya3FNv4TQa'] |
---|
41 | | - | |
---|
42 | | - | let t = [p, r, q] |
---|
43 | | - | |
---|
44 | | - | let u = 1 |
---|
45 | | - | |
---|
46 | | - | let v = 2 |
---|
47 | | - | |
---|
48 | | - | let w = valueOrElse(getInteger(this, "inactive"), 0) |
---|
49 | | - | |
---|
50 | | - | let x = (v * ((size(s) - u) - w)) |
---|
51 | | - | |
---|
52 | | - | let y = Address(base58'3PLRw83NCgHKKFfeJi8XWZ4fypqJJxm2x2x') |
---|
53 | | - | |
---|
54 | | - | let z = Address(base58'3PEPsNg7aSWSSgdC6XweyJkvDXmwVoWeNHL') |
---|
55 | | - | |
---|
56 | | - | let A = Address(base58'3P8v4dR4UD8nGeLQmorw6BmCo424GvGBXCA') |
---|
57 | | - | |
---|
58 | | - | let B = Address(base58'3PJ7RB5CC3Bnn44RNR2hceZ6wKsULnMSxPi') |
---|
59 | | - | |
---|
60 | | - | let C = (assetBalance(z, p) + assetBalance(A, p)) |
---|
61 | | - | |
---|
62 | | - | let D = (value(assetInfo(p)).quantity - C) |
---|
63 | | - | |
---|
64 | | - | let E = (assetBalance(B, q) + assetBalance(A, q)) |
---|
65 | | - | |
---|
66 | | - | let F = (value(assetInfo(q)).quantity - E) |
---|
67 | | - | |
---|
68 | | - | let G = (assetBalance(B, n) + assetBalance(B, o)) |
---|
69 | | - | |
---|
70 | | - | func H (I) = ((I + 1) / 2) |
---|
71 | | - | |
---|
72 | | - | |
---|
73 | | - | func J (K,L,M) = H(fraction((2 * K), L, M)) |
---|
74 | | - | |
---|
75 | | - | |
---|
76 | | - | func N (K,O) = if ((O > K)) |
---|
77 | | - | then O |
---|
78 | | - | else K |
---|
79 | | - | |
---|
80 | | - | |
---|
81 | | - | func P (Q) = { |
---|
82 | | - | let R = toBytes(" ") |
---|
83 | | - | let S = toBytes(" UTC") |
---|
84 | | - | let T = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365] |
---|
85 | | - | let U = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366] |
---|
86 | | - | let V = (((((1969 * 365) + (1969 / 4)) - (1969 / 100)) + (1969 / 400)) + 366) |
---|
87 | | - | let W = (Q + ((V * 86400) * 1000)) |
---|
88 | | - | if (((-12212553600 * 1000) > Q)) |
---|
89 | | - | then throw("ISO 8601: Only years after 1583 inclusive are allowed!") |
---|
90 | | - | else { |
---|
91 | | - | let X = { |
---|
92 | | - | let Y = ((W / (31556952 * 1000)) - 1) |
---|
93 | | - | let Z = ((W / (86400 * 1000)) - (((((Y * 365) + (Y / 4)) - (Y / 100)) + (Y / 400)) + 366)) |
---|
94 | | - | let aa = if (if (if ((((Y + 1) % 4) == 0)) |
---|
95 | | - | then (((Y + 1) % 100) != 0) |
---|
96 | | - | else false) |
---|
97 | | - | then true |
---|
98 | | - | else (((Y + 1) % 400) == 0)) |
---|
99 | | - | then U |
---|
100 | | - | else T |
---|
101 | | - | let ab = if (if ((0 > Z)) |
---|
102 | | - | then true |
---|
103 | | - | else (Z >= aa[12])) |
---|
104 | | - | then throw("Unexpected error: Value overflow for months!") |
---|
105 | | - | else if ((Z >= aa[11])) |
---|
106 | | - | then 11 |
---|
107 | | - | else if ((Z >= aa[10])) |
---|
108 | | - | then 10 |
---|
109 | | - | else if ((Z >= aa[9])) |
---|
110 | | - | then 9 |
---|
111 | | - | else if ((Z >= aa[8])) |
---|
112 | | - | then 8 |
---|
113 | | - | else if ((Z >= aa[7])) |
---|
114 | | - | then 7 |
---|
115 | | - | else if ((Z >= aa[6])) |
---|
116 | | - | then 6 |
---|
117 | | - | else if ((Z >= aa[5])) |
---|
118 | | - | then 5 |
---|
119 | | - | else if ((Z >= aa[4])) |
---|
120 | | - | then 4 |
---|
121 | | - | else if ((Z >= aa[3])) |
---|
122 | | - | then 3 |
---|
123 | | - | else if ((Z >= aa[2])) |
---|
124 | | - | then 2 |
---|
125 | | - | else if ((Z >= aa[1])) |
---|
126 | | - | then 1 |
---|
127 | | - | else 0 |
---|
128 | | - | let ac = (Z - aa[ab]) |
---|
129 | | - | ((((drop(toBytes(toString((Y + 1))), 0) + base58'n') + drop(toBytes(toString((ab + 101))), 1)) + base58'n') + drop(toBytes(toString((ac + 101))), 1)) |
---|
130 | | - | } |
---|
131 | | - | let ad = { |
---|
132 | | - | let ae = (W % (86400 * 1000)) |
---|
133 | | - | let af = (ae / (3600 * 1000)) |
---|
134 | | - | let ag = (ae % (3600 * 1000)) |
---|
135 | | - | let ab = (ag / (60 * 1000)) |
---|
136 | | - | let ah = (ag % (60 * 1000)) |
---|
137 | | - | let ai = (ah / 1000) |
---|
138 | | - | let aj = (ah % 1000) |
---|
139 | | - | ((((drop(toBytes(toString((af + 100))), 1) + base58'21') + drop(toBytes(toString((ab + 100))), 1)) + base58'21') + drop(toBytes(toString((ai + 100))), 1)) |
---|
140 | | - | } |
---|
141 | | - | toUtf8String((((X + R) + ad) + S)) |
---|
142 | | - | } |
---|
143 | | - | } |
---|
144 | | - | |
---|
145 | | - | |
---|
146 | | - | func ak (al) = if ((al != h)) |
---|
147 | | - | then nil |
---|
148 | | - | else [IntegerEntry("timestamp", lastBlock.timestamp)] |
---|
149 | | - | |
---|
150 | | - | |
---|
151 | | - | func am (an,ao,ap) = if ((1 > ao)) |
---|
152 | | - | then nil |
---|
153 | | - | else [ScriptTransfer(an, ao, ap)] |
---|
154 | | - | |
---|
155 | | - | |
---|
156 | | - | func aq (ap) = { |
---|
157 | | - | let ar = assetBalance(z, ap) |
---|
158 | | - | let as = (ar + assetBalance(A, ap)) |
---|
159 | | - | N((fraction(as, g, b) - ar), 0) |
---|
160 | | - | } |
---|
161 | | - | |
---|
162 | | - | |
---|
163 | | - | func at (ap) = if (containsElement((s ++ t), ap)) |
---|
164 | | - | then throw(makeString(["AirdropWasher () =>", "Please remove the asset ID:", toBase58String(ap)], " ")) |
---|
165 | | - | else if ((ap == base58'')) |
---|
166 | | - | then 0 |
---|
167 | | - | else assetBalance(this, ap) |
---|
168 | | - | |
---|
169 | | - | |
---|
170 | | - | @Callable(au) |
---|
171 | | - | func AutoFixProfit (av) = { |
---|
172 | | - | let aw = valueOrElse(getInteger(this, "fixedProfit"), 0) |
---|
173 | | - | let ax = valueOrElse(getInteger(this, "riskPercent"), (b / 100)) |
---|
174 | | - | let ay = fraction(D, f, d) |
---|
175 | | - | let az = fraction(ay, ax, (x * b)) |
---|
176 | | - | let aA = ((aw / az) + 1) |
---|
177 | | - | let aB = (av * az) |
---|
178 | | - | let aC = N((aB - aw), 0) |
---|
179 | | - | let aD = J(aC, F, G) |
---|
180 | | - | if ((aA > av)) |
---|
181 | | - | then throw(makeString([(("AutoFixProfit (" + toString(av)) + ") =>"), "Inavlid value! Min. multiplier:", toString(aA)], " ")) |
---|
182 | | - | else if ((size(au.payments) > 0)) |
---|
183 | | - | then throw(makeString(["AutoFixProfit (...) =>", "Don't attach payment when calling this function ..."], " ")) |
---|
184 | | - | else if (if ((au.callerPublicKey != h)) |
---|
185 | | - | then (au.callerPublicKey != i) |
---|
186 | | - | else false) |
---|
187 | | - | then throw(makeString(["AutoFixProfit (...) =>", "This action can only be performed by an administrator!"], " ")) |
---|
188 | | - | else ([IntegerEntry("fixedProfit", aB), ScriptTransfer(B, aC, n), ScriptTransfer(z, aD, q)] ++ ak(au.callerPublicKey)) |
---|
189 | | - | } |
---|
190 | | - | |
---|
191 | | - | |
---|
192 | | - | |
---|
193 | | - | @Callable(au) |
---|
194 | | - | func AutoRebalance () = { |
---|
195 | | - | let aE = valueOrElse(getInteger(z, "fhfsSupply"), (100 * d)) |
---|
196 | | - | let aF = N((aE - assetBalance(z, p)), 0) |
---|
197 | | - | if ((size(au.payments) > 0)) |
---|
198 | | - | then throw(makeString(["AutoRebalance () =>", "Don't attach payment when calling this function ..."], " ")) |
---|
199 | | - | else if (if (if ((au.callerPublicKey != h)) |
---|
200 | | - | then (au.callerPublicKey != i) |
---|
201 | | - | else false) |
---|
202 | | - | then !(containsElement(k, au.callerPublicKey)) |
---|
203 | | - | else false) |
---|
204 | | - | then throw(makeString(["AutoRebalance () =>", "This action can only be performed by an administrator!"], " ")) |
---|
205 | | - | else ((am(z, aF, p) ++ [ScriptTransfer(z, aq(s[0]), s[0]), ScriptTransfer(z, aq(s[2]), s[2]), ScriptTransfer(z, aq(s[3]), s[3]), ScriptTransfer(z, aq(s[4]), s[4]), ScriptTransfer(z, aq(s[5]), s[5]), ScriptTransfer(z, aq(s[6]), s[6]), ScriptTransfer(z, aq(s[7]), s[7]), ScriptTransfer(z, aq(s[8]), s[8])]) ++ ak(au.callerPublicKey)) |
---|
206 | | - | } |
---|
207 | | - | |
---|
208 | | - | |
---|
209 | | - | |
---|
210 | | - | @Callable(au) |
---|
211 | | - | func EmergencyExit () = { |
---|
212 | | - | let aG = (max([valueOrElse(getInteger(z, "timestamp"), 0), valueOrElse(getInteger(A, "timestamp"), 0), valueOrElse(getInteger(B, "timestamp"), 0)]) + e) |
---|
213 | | - | let aH = (au.callerPublicKey == h) |
---|
214 | | - | let aI = valueOrElse(getBoolean(this, "emergency"), false) |
---|
215 | | - | if (if (!(aH)) |
---|
216 | | - | then aI |
---|
217 | | - | else false) |
---|
218 | | - | then throw(makeString(["EmergencyExit () =>", "The emergency procedure has already started!"], " ")) |
---|
219 | | - | else if (if (!(aI)) |
---|
220 | | - | then (aG > lastBlock.timestamp) |
---|
221 | | - | else false) |
---|
222 | | - | then throw(makeString(["EmergencyExit () =>", "Will be allowed after the date:", P(aG)], " ")) |
---|
223 | | - | else if ((size(au.payments) > 0)) |
---|
224 | | - | then throw(makeString(["EmergencyExit () =>", "Don't attach payment when calling this function ..."], " ")) |
---|
225 | | - | else if (if (!(aH)) |
---|
226 | | - | then !(containsElement(k, au.callerPublicKey)) |
---|
227 | | - | else false) |
---|
228 | | - | then throw(makeString(["EmergencyExit () =>", "This action can only be performed by one of the guarantors!"], " ")) |
---|
229 | | - | else [BooleanEntry("emergency", !(aH)), ([ScriptTransfer(z, assetBalance(A, s[0]), s[0]), ScriptTransfer(z, assetBalance(A, s[2]), s[2]), ScriptTransfer(z, assetBalance(A, s[3]), s[3]), ScriptTransfer(z, assetBalance(A, s[4]), s[4]), ScriptTransfer(z, assetBalance(A, s[5]), s[5]), ScriptTransfer(z, assetBalance(A, s[6]), s[6]), ScriptTransfer(z, assetBalance(A, s[7]), s[7]), ScriptTransfer(z, assetBalance(A, s[8]), s[8])] ++ ak(au.callerPublicKey))] |
---|
230 | | - | } |
---|
231 | | - | |
---|
232 | | - | |
---|
233 | | - | |
---|
234 | | - | @Callable(au) |
---|
235 | | - | func AirdropWasher (aJ,aK,aL,aM,aN,aO,aP,aQ,aR,aS) = if ((size(au.payments) > 0)) |
---|
236 | | - | then throw(makeString(["AirdropWasher (...) =>", "Don't attach payment when calling this function ..."], " ")) |
---|
237 | | - | else if (if ((au.callerPublicKey != h)) |
---|
238 | | - | then !(containsElement(k, au.callerPublicKey)) |
---|
239 | | - | else false) |
---|
240 | | - | then throw(makeString(["AirdropWasher (...) =>", "This action can only be performed by an administrator!"], " ")) |
---|
241 | | - | else ((((((((((am(y, at(aJ), aJ) ++ am(y, at(aK), aK)) ++ am(y, at(aL), aL)) ++ am(y, at(aM), aM)) ++ am(y, at(aN), aN)) ++ am(y, at(aO), aO)) ++ am(y, at(aP), aP)) ++ am(y, at(aQ), aQ)) ++ am(y, at(aR), aR)) ++ am(y, at(aS), aS)) ++ ak(au.callerPublicKey)) |
---|
242 | | - | |
---|
243 | | - | |
---|
244 | | - | @Verifier(aT) |
---|
245 | | - | func aU () = { |
---|
246 | | - | let aV = sigVerify_32Kb(aT.bodyBytes, aT.proofs[0], aT.senderPublicKey) |
---|
247 | | - | let aW = if (aV) |
---|
248 | | - | then true |
---|
249 | | - | else sigVerify_32Kb(aT.bodyBytes, aT.proofs[0], h) |
---|
250 | | - | let aX = if (aV) |
---|
251 | | - | then true |
---|
252 | | - | else sigVerify_32Kb(aT.bodyBytes, aT.proofs[0], i) |
---|
253 | | - | let aY = ((((if (sigVerify_32Kb(aT.bodyBytes, aT.proofs[1], k[0])) |
---|
254 | | - | then 1 |
---|
255 | | - | else 0) + (if (sigVerify_32Kb(aT.bodyBytes, aT.proofs[2], k[1])) |
---|
256 | | - | then 1 |
---|
257 | | - | else 0)) + (if (sigVerify_32Kb(aT.bodyBytes, aT.proofs[3], k[2])) |
---|
258 | | - | then 1 |
---|
259 | | - | else 0)) >= m) |
---|
260 | | - | let aZ = aT |
---|
261 | | - | if (if ($isInstanceOf(aZ, "LeaseCancelTransaction")) |
---|
262 | | - | then true |
---|
263 | | - | else $isInstanceOf(aZ, "LeaseTransaction")) |
---|
264 | | - | then aV |
---|
265 | | - | else if ($isInstanceOf(aZ, "BurnTransaction")) |
---|
266 | | - | then { |
---|
267 | | - | let ba = aZ |
---|
268 | | - | if (if (aV) |
---|
269 | | - | then !(containsElement(s, ba.assetId)) |
---|
270 | | - | else false) |
---|
271 | | - | then !(containsElement(t, ba.assetId)) |
---|
272 | | - | else false |
---|
273 | | - | } |
---|
274 | | - | else if ($isInstanceOf(aZ, "Order")) |
---|
275 | | - | then { |
---|
276 | | - | let bb = aZ |
---|
277 | | - | if (if (if (if (if (aX) |
---|
278 | | - | then !(isDefined(bb.matcherFeeAssetId)) |
---|
279 | | - | else false) |
---|
280 | | - | then (bb.matcherPublicKey == j) |
---|
281 | | - | else false) |
---|
282 | | - | then if (if (if ((bb.orderType == Buy)) |
---|
283 | | - | then !(containsElement(s, bb.assetPair.priceAsset)) |
---|
284 | | - | else false) |
---|
285 | | - | then true |
---|
286 | | - | else if ((bb.orderType == Sell)) |
---|
287 | | - | then !(containsElement(s, bb.assetPair.amountAsset)) |
---|
288 | | - | else false) |
---|
289 | | - | then true |
---|
290 | | - | else if (!(containsElement(s, bb.assetPair.priceAsset))) |
---|
291 | | - | then !(containsElement(s, bb.assetPair.amountAsset)) |
---|
292 | | - | else false |
---|
293 | | - | else false) |
---|
294 | | - | then !(containsElement(t, bb.assetPair.priceAsset)) |
---|
295 | | - | else false) |
---|
296 | | - | then !(containsElement(t, bb.assetPair.amountAsset)) |
---|
297 | | - | else false |
---|
298 | | - | } |
---|
299 | | - | else if (if ($isInstanceOf(aZ, "MassTransferTransaction")) |
---|
300 | | - | then true |
---|
301 | | - | else $isInstanceOf(aZ, "TransferTransaction")) |
---|
302 | | - | then { |
---|
303 | | - | let bc = aZ |
---|
304 | | - | if (if (aW) |
---|
305 | | - | then aY |
---|
306 | | - | else false) |
---|
307 | | - | then !(containsElement(s, bc.assetId)) |
---|
308 | | - | else false |
---|
309 | | - | } |
---|
310 | | - | else if (if ($isInstanceOf(aZ, "SetScriptTransaction")) |
---|
311 | | - | then true |
---|
312 | | - | else $isInstanceOf(aZ, "DataTransaction")) |
---|
313 | | - | then if (aW) |
---|
314 | | - | then aY |
---|
315 | | - | else false |
---|
316 | | - | else false |
---|
317 | | - | } |
---|
318 | | - | |
---|
| 1 | + | # no script |
---|