tx · H47ZfSoWPVGQURQHGgKe5Kubb6PJBcdkewNZdjkU3QhT

3PJ1kc4EAPL6fxuz3UZL68LPz1G9u4ptjYT:  -0.01000000 Waves

2022.03.23 12:43 [3041561] smart account 3PJ1kc4EAPL6fxuz3UZL68LPz1G9u4ptjYT > SELF 0.00000000 Waves

{ "type": 13, "id": "H47ZfSoWPVGQURQHGgKe5Kubb6PJBcdkewNZdjkU3QhT", "fee": 1000000, "feeAssetId": null, "timestamp": 1648028620416, "version": 1, "sender": "3PJ1kc4EAPL6fxuz3UZL68LPz1G9u4ptjYT", "senderPublicKey": "63yPdGgtMkXurqVCQe6LbXBK4CvV6xWe3zwquqhtaENU", "proofs": [ "RYzV3cwwJuHwqZL1QzzCkFvveaoZ88vBifxUfnAMBp5VdrvMjUJ8PAPebtATNYYhvaymLNiB9AVucDFh5iRmpc5" ], "script": null, "chainId": 87, "height": 3041561, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ef7egdYFT3nVGFx7P2vasjzAJQBSxnEtQ8uSoyn7YyGh Next: none Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-func writeString (key,value) = StringEntry(key, value)
5-
6-
7-func writeConstString (key,value) = if (!(isDefined(getString(this, key))))
8- then StringEntry(key, value)
9- else throw(("already initialized: " + key))
10-
11-
12-func writeInt (key,value) = IntegerEntry(key, value)
13-
14-
15-func writeConstInt (key,value) = if (!(isDefined(getInteger(this, key))))
16- then IntegerEntry(key, value)
17- else throw(("already initialized: " + key))
18-
19-
20-let adminStore = "admin"
21-
22-let divAdminsStore = "divAdmins"
23-
24-let mainStore = "main"
25-
26-let pausableByStore = "pausableBy"
27-
28-func APointStore (assetId) = (assetId + "_APoint")
29-
30-
31-func BPointStore (assetId) = (assetId + "_BPoint")
32-
33-
34-func CPointStore (assetId) = (assetId + "_CPoint")
35-
36-
37-func DPointStore (assetId) = (assetId + "_DPoint")
38-
39-
40-func collateralFactorStore (assetId) = (assetId + "_CollateralFactor")
41-
42-
43-func reserveFactorStore (assetId) = (assetId + "_ReserveFactor")
44-
45-
46-func liquidationThresholdStore (assetId) = (assetId + "_LiquidationThreshold")
47-
48-
49-func liquidationPenaltyStore (assetId) = (assetId + "_LiquidationPenalty")
50-
51-
52-let ops = ["deposit", "withdraw", "borrow", "repay", "atokens", "collapse", "transfer_debt", "use_as_col", "force_collapse", "stake_vires", "unstake_vires", "claim_vires_distribution", "claim_vires_eb", "realloc", "lock_vires", "withdraw_unlocked_vires", "claim_dividends", "share_dividends_manually", "staker_migrate", "supply_protected_collateral", "withdraw_protected_collateral", "collapse_protected_collateral", "set_delegation_claim"]
53-
54-func reserveOpControlStore (assetId,op) = (((("op_" + op) + "_") + assetId) + "_paused")
55-
56-
57-func opControlStore (op) = (("op_" + op) + "_paused")
58-
59-
60-let systemControlStore = "system_paused"
61-
62-func adminOnly (i) = if ((toString(i.caller) != valueOrElse(getString(this, adminStore), "no admin")))
63- then throw("only admin can do")
64- else true
65-
66-
67-func inRange (value,min,max) = if (if ((min > value))
68- then true
69- else (value > max))
70- then throw(((((("value: " + toString(value)) + " not in range: ") + toString(min)) + " - ") + toString(max)))
71- else true
72-
73-
74-func canPause (i) = contains(valueOrErrorMessage(getString(this, pausableByStore), "pausableByStore not configured"), toString(i.caller))
75-
76-
77-@Callable(i)
78-func initialize (main,pausableBy) = [writeConstString(adminStore, toString(i.caller)), writeConstString(mainStore, main), writeConstString(pausableByStore, pausableBy)]
79-
80-
81-
82-@Callable(i)
83-func setDivAdmins (divAdmins) = {
84- let checks = adminOnly(i)
85- if ((checks == checks))
86- then [writeString(divAdminsStore, divAdmins)]
87- else throw("Strict value is not equal to itself.")
88- }
89-
90-
91-
92-@Callable(i)
93-func setPausableAdmins (pausableBy) = {
94- let checks = adminOnly(i)
95- if ((checks == checks))
96- then [writeString(pausableByStore, pausableBy)]
97- else throw("Strict value is not equal to itself.")
98- }
99-
100-
101-
102-@Callable(i)
103-func setReserveFactor (reserveAssetId,reserveFactor) = {
104- let checks = adminOnly(i)
105- if ((checks == checks))
106- then [writeInt(reserveFactorStore(reserveAssetId), reserveFactor)]
107- else throw("Strict value is not equal to itself.")
108- }
109-
110-
111-
112-@Callable(i)
113-func setCollateralFactor (reserveAssetId,collateralFactor) = {
114- let checks = adminOnly(i)
115- if ((checks == checks))
116- then [writeInt(collateralFactorStore(reserveAssetId), collateralFactor)]
117- else throw("Strict value is not equal to itself.")
118- }
119-
120-
121-
122-@Callable(i)
123-func setLiquidationThreshold (reserveAssetId,threshold) = {
124- let checks = adminOnly(i)
125- if ((checks == checks))
126- then [writeInt(liquidationThresholdStore(reserveAssetId), threshold)]
127- else throw("Strict value is not equal to itself.")
128- }
129-
130-
131-
132-@Callable(i)
133-func setLiquidationPenalty (reserveAssetId,discount) = {
134- let checks = adminOnly(i)
135- if ((checks == checks))
136- then [writeInt(liquidationPenaltyStore(reserveAssetId), discount)]
137- else throw("Strict value is not equal to itself.")
138- }
139-
140-
141-
142-@Callable(i)
143-func setReserveUtilizationPoints (reserveAssetId,A,B,C,D) = {
144- let checks = if (if (if (if (adminOnly(i))
145- then inRange(A, 0, 1000)
146- else false)
147- then inRange(B, 0, 1000)
148- else false)
149- then inRange(C, 0, 1000)
150- else false)
151- then inRange(D, 0, 1000)
152- else false
153- if ((checks == checks))
154- then [writeInt(APointStore(reserveAssetId), A), writeInt(BPointStore(reserveAssetId), B), writeInt(CPointStore(reserveAssetId), C), writeInt(DPointStore(reserveAssetId), D)]
155- else throw("Strict value is not equal to itself.")
156- }
157-
158-
159-
160-@Callable(i)
161-func pauseAssetOp (assetId,op) = if (!(isDefined(indexOf(ops, op))))
162- then throw(("unknown op: " + op))
163- else if (!(canPause(i)))
164- then throw("only pausableBy can do")
165- else [BooleanEntry(reserveOpControlStore(assetId, op), false)]
166-
167-
168-
169-@Callable(i)
170-func pauseOp (op) = if (!(isDefined(indexOf(ops, op))))
171- then throw(("unknown op: " + op))
172- else if (!(canPause(i)))
173- then throw("only pausableBy can do")
174- else [BooleanEntry(opControlStore(op), false)]
175-
176-
177-
178-@Callable(i)
179-func pauseSystem () = if (!(canPause(i)))
180- then throw("only pausableBy can do")
181- else [BooleanEntry(systemControlStore, false)]
182-
183-
184-
185-@Callable(i)
186-func resume (key) = {
187- let checks = adminOnly(i)
188- if ((checks == checks))
189- then [BooleanEntry(key, true)]
190- else throw("Strict value is not equal to itself.")
191- }
192-
193-
194-
195-@Callable(i)
196-func opAllowed (assetId,op) = if (!(isDefined(indexOf(ops, op))))
197- then throw(("unknown op: " + op))
198- else {
199- let enabled0 = valueOrElse(getBoolean(this, systemControlStore), true)
200- let enabled1 = valueOrElse(getBoolean(this, opControlStore(op)), true)
201- let enabled2 = valueOrElse(getBoolean(this, reserveOpControlStore(assetId, op)), true)
202- if (!(enabled0))
203- then throw(("operation paused by " + systemControlStore))
204- else if (!(enabled1))
205- then throw(("operation paused by " + opControlStore(op)))
206- else if (!(enabled2))
207- then throw(("operation paused by " + reserveOpControlStore(assetId, op)))
208- else $Tuple2(nil, true)
209- }
210-
211-
212-
213-@Callable(i)
214-func enableStaking (assetId) = {
215- let checks = adminOnly(i)
216- if ((checks == checks))
217- then [BooleanEntry(("staking_enabled_" + assetId), true)]
218- else throw("Strict value is not equal to itself.")
219- }
220-
221-
222-
223-@Callable(i)
224-func disableStaking (assetId) = {
225- let checks = adminOnly(i)
226- if ((checks == checks))
227- then [BooleanEntry(("staking_enabled_" + assetId), false)]
228- else throw("Strict value is not equal to itself.")
229- }
230-
231-
232-
233-@Callable(i)
234-func configStaking (assetId,address) = {
235- let checks = adminOnly(i)
236- if ((checks == checks))
237- then [StringEntry(("staking_config_" + assetId), address)]
238- else throw("Strict value is not equal to itself.")
239- }
240-
241-
242-
243-@Callable(i)
244-func setAccountHealthThreshold (threshold) = {
245- let checks = adminOnly(i)
246- if ((checks == checks))
247- then [IntegerEntry("account_health_threshold", threshold)]
248- else throw("Strict value is not equal to itself.")
249- }
250-
251-
252-
253-@Callable(i)
254-func setAccountHealthOverlap (overlap) = {
255- let checks = adminOnly(i)
256- if ((checks == checks))
257- then [IntegerEntry("account_health_overlap", overlap)]
258- else throw("Strict value is not equal to itself.")
259- }
260-
261-
262-
263-@Callable(i)
264-func setCollapsePenalty (overlap) = {
265- let checks = adminOnly(i)
266- if ((checks == checks))
267- then [IntegerEntry("collapse_penalty", overlap)]
268- else throw("Strict value is not equal to itself.")
269- }
270-
271-
272-
273-@Callable(i)
274-func setLiquidatorDapps (liquidatorDapps) = {
275- let checks = adminOnly(i)
276- if ((checks == checks))
277- then [StringEntry("liquidators", liquidatorDapps)]
278- else throw("Strict value is not equal to itself.")
279- }
280-
281-
282-
283-@Callable(i)
284-func setDepositToBorrowRatio (reserve,dtoBRatio) = {
285- let checks = adminOnly(i)
286- if ((checks == checks))
287- then if (if ((0 > dtoBRatio))
288- then true
289- else (dtoBRatio > 1000))
290- then throw(("invalid dtoBRatio: " + toString(dtoBRatio)))
291- else [IntegerEntry((reserve + "_depositToBorrowRatio"), dtoBRatio)]
292- else throw("Strict value is not equal to itself.")
293- }
294-
295-
296-
297-@Callable(i)
298-func setTotalSpeed (speed) = {
299- let checks = adminOnly(i)
300- if ((checks == checks))
301- then [IntegerEntry("total_speed", speed)]
302- else throw("Strict value is not equal to itself.")
303- }
304-
305-
306-
307-@Callable(i)
308-func setViresMinter (address) = {
309- let checks = adminOnly(i)
310- if ((checks == checks))
311- then [StringEntry("vires_minter", address)]
312- else throw("Strict value is not equal to itself.")
313- }
314-
315-
316-
317-@Callable(i)
318-func setEbRewards (address) = {
319- let checks = adminOnly(i)
320- if ((checks == checks))
321- then [StringEntry("eb_rewards", address)]
322- else throw("Strict value is not equal to itself.")
323- }
324-
325-
326-
327-@Callable(i)
328-func setViresDistributor (address) = {
329- let checks = adminOnly(i)
330- if ((checks == checks))
331- then [StringEntry("vires_distributor", address)]
332- else throw("Strict value is not equal to itself.")
333- }
334-
335-
336-
337-@Callable(i)
338-func setViresStaker (address) = {
339- let checks = adminOnly(i)
340- if ((checks == checks))
341- then [StringEntry("vires_staker", address)]
342- else throw("Strict value is not equal to itself.")
343- }
344-
345-
346-
347-@Callable(i)
348-func setViresStakerAPR (apr) = {
349- let checks = adminOnly(i)
350- if ((checks == checks))
351- then if (if ((0 > apr))
352- then true
353- else (apr > 1000))
354- then throw(("invalid apr: " + toString(apr)))
355- else [IntegerEntry("vires_staker_apr", apr)]
356- else throw("Strict value is not equal to itself.")
357- }
358-
359-
360-
361-@Callable(i)
362-func setSoftMintCap (amt) = {
363- let checks = adminOnly(i)
364- if ((checks == checks))
365- then [IntegerEntry("soft_mint_cap", amt)]
366- else throw("Strict value is not equal to itself.")
367- }
368-
369-
370-
371-@Callable(i)
372-func setHalfLifeBlocks (blocks) = {
373- let checks = adminOnly(i)
374- if ((checks == checks))
375- then [IntegerEntry("vires_lock_half_life", blocks)]
376- else throw("Strict value is not equal to itself.")
377- }
378-
379-
380-
381-@Callable(i)
382-func setDividendableReserves (reserves) = {
383- let checks = adminOnly(i)
384- if ((checks == checks))
385- then {
386- let tokens = {
387- func fold (acc,reserve) = ((if ((acc == ""))
388- then ""
389- else (acc + "|")) + valueOrErrorMessage(getString(addressFromStringValue(reserve), "assetId"), "bad reserve: no assetId"))
390-
391- let $l = split(reserves, "|")
392- let $s = size($l)
393- let $acc0 = ""
394- func $f0_1 ($a,$i) = if (($i >= $s))
395- then $a
396- else fold($a, $l[$i])
397-
398- func $f0_2 ($a,$i) = if (($i >= $s))
399- then $a
400- else throw("List size exceeds 10")
401-
402- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
403- }
404-[StringEntry("dividendableReserves", reserves), StringEntry("dividendableTokens", tokens)]
405- }
406- else throw("Strict value is not equal to itself.")
407- }
408-
409-
410-
411-@Callable(i)
412-func setDividendsContract (address) = {
413- let checks = adminOnly(i)
414- if ((checks == checks))
415- then [StringEntry("dividends_contract", address)]
416- else throw("Strict value is not equal to itself.")
417- }
418-
419-
420-
421-@Callable(i)
422-func allowBoost (allow) = {
423- let checks = adminOnly(i)
424- if ((checks == checks))
425- then [BooleanEntry("allow_boost", allow)]
426- else throw("Strict value is not equal to itself.")
427- }
428-
429-
430-
431-@Callable(i)
432-func setProtectedReserve (address) = {
433- let checks = adminOnly(i)
434- if ((checks == checks))
435- then [StringEntry("protected_reserve", address)]
436- else throw("Strict value is not equal to itself.")
437- }
438-
439-
440-
441-@Callable(i)
442-func setProtectedAssets (assets) = {
443- let checks = adminOnly(i)
444- if ((checks == checks))
445- then [StringEntry("protected_reserve_assets", assets)]
446- else throw("Strict value is not equal to itself.")
447- }
448-
449-
450-
451-@Callable(i)
452-func enableProtectedStaking (assetId) = {
453- let checks = adminOnly(i)
454- if ((checks == checks))
455- then [BooleanEntry(("protected_staking_enabled_" + assetId), true)]
456- else throw("Strict value is not equal to itself.")
457- }
458-
459-
460-
461-@Callable(i)
462-func disableProtectedStaking (assetId) = {
463- let checks = adminOnly(i)
464- if ((checks == checks))
465- then [BooleanEntry(("protected_staking_enabled_" + assetId), false)]
466- else throw("Strict value is not equal to itself.")
467- }
468-
469-
470-
471-@Callable(i)
472-func configProtectedStaking (assetId,address) = {
473- let checks = adminOnly(i)
474- if ((checks == checks))
475- then [StringEntry(("protected_staking_config_" + assetId), address)]
476- else throw("Strict value is not equal to itself.")
477- }
478-
479-
1+# no script

github/deemru/w8io/6500d08 
38.85 ms