tx · 6ZSMqTQUBJnEvvh33Miu94mjqeLMyKVbNQWpTCcgMZDX

3PDJc9h1FLiFhGttjbgf9RmxvNQdu3UEHXo:  -0.00100000 Waves

2023.04.18 16:22 [3605599] smart account 3PDJc9h1FLiFhGttjbgf9RmxvNQdu3UEHXo > SELF 0.00000000 Waves

{ "type": 13, "id": "6ZSMqTQUBJnEvvh33Miu94mjqeLMyKVbNQWpTCcgMZDX", "fee": 100000, "feeAssetId": null, "timestamp": 1681824213299, "version": 1, "sender": "3PDJc9h1FLiFhGttjbgf9RmxvNQdu3UEHXo", "senderPublicKey": "6DvZVREyBEZ6tV4YxzomDG9txdVs2LA6exEnWechoass", "proofs": [ "e9oMZJf1EZEPLkoTGViVpctyqSQEhWopuE8aYDRPAtxuXiFuRmRaL4bu5V48c3338LQZJkqdyQr7MsrtVMTMNUp" ], "script": "base64:BgIECAISAAQADHBvd2VyQWRkcmVzcwkBB0FkZHJlc3MBARoBV0Ov1RrltOOKrDIfaMeqY/GOXgFS7CVs9QAMb3duZXJBZGRyZXNzCQEHQWRkcmVzcwEBGgFX/xVftiNN6UUUtTRLHHU2/GG/YduSmsFFAAVQT1dFUgEgHBqDoMT3Lh6CR3PXRUPBKIbTqsytzoIzH7EhqJqevEoBBWFzSW50AQF2BAckbWF0Y2gwBQF2AwkAAQIFByRtYXRjaDACA0ludAQBeAUHJG1hdGNoMAUBeAQBdAUHJG1hdGNoMAkAAgECBCNlcnIBAWkBDXVuc3Rha2VfcG93ZXIABAxwb3dlcl9hbW91bnQJAQVhc0ludAEJAPwHBAUMcG93ZXJBZGRyZXNzAgl1c2VyUG93ZXIJAMwIAgkApQgBBQR0aGlzBQNuaWwFA25pbAMJAAACBQxwb3dlcl9hbW91bnQFDHBvd2VyX2Ftb3VudAQHdW5zdGFrZQkA/AcEBQxwb3dlckFkZHJlc3MCB3Vuc3Rha2UJAMwIAgUMcG93ZXJfYW1vdW50BQNuaWwFA25pbAMJAAACBQd1bnN0YWtlBQd1bnN0YWtlCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMFDG93bmVyQWRkcmVzcwkA8AcCBQR0aGlzBQVQT1dFUgUFUE9XRVIFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgBp02z4", "chainId": 87, "height": 3605599, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 74ZsDdLd2rqF2KeEUKgEG1TqFtpmzLK9Pqz5uBPL5HCN Next: ADuNsb6mccGhG2F4xaZM3zGaZVGukQgpNo1cGYF54UHc Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let USDN = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
4+let powerAddress = Address(base58'3P86ne9inVG1Cf4smrEGSdcXyBuEApPcMAc')
55
6-let SURF = base58'At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL'
6+let ownerAddress = Address(base58'3PRBeeFD64wvTMfS3HEoDDFPXfJs3gFdAxk')
77
8-let adminAddress = Address(base58'3P6gGsVQbD2xgmaNxN7Rj3arohPsBxvo5GC')
9-
10-let aggrAddress = Address(base58'3P5T88oGg47FEsJcpC2o43BSF34Bs5dcFpP')
11-
12-let usdnAggrAddress = Address(base58'3P2cpE7nusQRRFt3Tg22WtKfdi6bUKwmqVM')
13-
14-let zeftAddress = Address(base58'3PC51qgNQz4xx7m1DhLdCDYESaeNKT6zeFt')
15-
16-func asAnyList (v) = match v {
17- case l: List[Any] =>
18- l
19- case _ =>
20- throw("#err")
21-}
22-
8+let POWER = base58'2thsACuHmzDMuNezPM32wg9a3BwUzBWDeSKakgz3cw21'
239
2410 func asInt (v) = match v {
2511 case x: Int =>
3016
3117
3218 @Callable(i)
33-func usdn_100 (amount) = {
34- let usdnAmountOnStart = assetBalance(this, USDN)
35- if ((usdnAmountOnStart == usdnAmountOnStart))
19+func unstake_power () = {
20+ let power_amount = asInt(invoke(powerAddress, "userPower", [toString(this)], nil))
21+ if ((power_amount == power_amount))
3622 then {
37- let inv = invoke(addressFromStringValue("3PCbvPVQfSvVu88ip8Fm5YjwJhjEYk1Txhk"), "withdrawVestedAllUSDN", [false, true], nil)
38- if ((inv == inv))
39- then {
40- let usdnAmountAfterWithdraw = assetBalance(this, USDN)
41- if ((usdnAmountAfterWithdraw == usdnAmountAfterWithdraw))
42- then [ScriptTransfer(aggrAddress, (usdnAmountAfterWithdraw - usdnAmountOnStart), USDN)]
43- else throw("Strict value is not equal to itself.")
44- }
23+ let unstake = invoke(powerAddress, "unstake", [power_amount], nil)
24+ if ((unstake == unstake))
25+ then [ScriptTransfer(ownerAddress, assetBalance(this, POWER), POWER)]
4526 else throw("Strict value is not equal to itself.")
4627 }
4728 else throw("Strict value is not equal to itself.")
4829 }
4930
5031
51-
52-@Callable(i)
53-func surf (w) = if (if ((i.caller != adminAddress))
54- then (i.caller != this)
55- else false)
56- then throw("only admin can do")
57- else {
58- let neutrinoMetrics = asAnyList(invoke(addressFromStringValue("3P77iUusNwMMzWFdC8f7bftwpHyG1PBs1gq"), "calcNeutinoMetricsREADONLY", nil, nil))
59- let BR = asInt(neutrinoMetrics[8])
60- if ((w > BR))
61- then {
62- let inv = invoke(Address(base58'3PCbvPVQfSvVu88ip8Fm5YjwJhjEYk1Txhk'), "withdrawVestedAllSURF", [false, true], nil)
63- if ((inv == inv))
64- then {
65- let aAmount = assetBalance(this, SURF)
66-[ScriptTransfer(aggrAddress, aAmount, SURF)]
67- }
68- else throw("Strict value is not equal to itself.")
69- }
70- else throw(("br is bad. " + toString(BR)))
71- }
72-
73-
74-
75-@Callable(i)
76-func toVesting (b) = if (if (if ((i.originCaller != adminAddress))
77- then (i.originCaller != this)
78- else false)
79- then (i.originCaller != aggrAddress)
80- else false)
81- then throw("only admin can do")
82- else if ((size(i.payments) != 1))
83- then throw("bad payment")
84- else {
85- let repayAmount = i.payments[0].amount
86- let repayAsset = i.payments[0].assetId
87- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "repay", [b], [AttachedPayment(repayAsset, repayAmount)])
88- if ((inv1 == inv1))
89- then {
90- let inv2 = invoke(Address(base58'3PCbvPVQfSvVu88ip8Fm5YjwJhjEYk1Txhk'), "convertToUSDN", nil, nil)
91- if ((inv2 == inv2))
92- then {
93- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", ["DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", -1], nil)
94- if ((inv3 == inv3))
95- then {
96- let balance = assetBalance(this, value(repayAsset))
97- if ((balance == balance))
98- then [ScriptTransfer(aggrAddress, balance, repayAsset), ScriptTransfer(usdnAggrAddress, assetBalance(this, USDN), USDN)]
99- else throw("Strict value is not equal to itself.")
100- }
101- else throw("Strict value is not equal to itself.")
102- }
103- else throw("Strict value is not equal to itself.")
104- }
105- else throw("Strict value is not equal to itself.")
106- }
107-
108-
109-
110-@Callable(i)
111-func rewards_vesting (strAddress) = if (if ((i.originCaller != adminAddress))
112- then (i.originCaller != this)
113- else false)
114- then throw("only admin can do")
115- else {
116- let toAddress = if ((strAddress == "3PC51qgNQz4xx7m1DhLdCDYESaeNKT6zeFt"))
117- then zeftAddress
118- else usdnAggrAddress
119- let usdnAmountOnStart = assetBalance(this, USDN)
120- if ((usdnAmountOnStart == usdnAmountOnStart))
121- then {
122- let inv = invoke(addressFromStringValue("3PKZk5TdPCLP2GZviipLFfK46ExTnwkRCBd"), "claimRewards", nil, nil)
123- if ((inv == inv))
124- then {
125- let usdnAmountAfterWithdraw = assetBalance(this, USDN)
126- if ((usdnAmountAfterWithdraw == usdnAmountAfterWithdraw))
127- then [ScriptTransfer(toAddress, (usdnAmountAfterWithdraw - usdnAmountOnStart), USDN)]
128- else throw("Strict value is not equal to itself.")
129- }
130- else throw("Strict value is not equal to itself.")
131- }
132- else throw("Strict value is not equal to itself.")
133- }
134-
135-
136-
137-@Callable(i)
138-func import_lp () = if (if (if (if ((i.originCaller != adminAddress))
139- then (i.originCaller != this)
140- else false)
141- then (i.originCaller != aggrAddress)
142- else false)
143- then (i.originCaller != usdnAggrAddress)
144- else false)
145- then throw("only admin can do")
146- else if ((size(i.payments) != 1))
147- then throw("bad payment")
148- else {
149- let repayAmount = i.payments[0].amount
150- let repayAsset = i.payments[0].assetId
151- let inv = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "replenishWithAtoken", nil, i.payments)
152- if ((inv == inv))
153- then nil
154- else throw("Strict value is not equal to itself.")
155- }
156-
157-
158-
159-@Callable(i)
160-func itsmine (br,cr,v,la,w,wa) = if (if (if ((i.originCaller != adminAddress))
161- then (i.originCaller != this)
162- else false)
163- then (i.originCaller != aggrAddress)
164- else false)
165- then throw("only admin can do")
166- else if ((size(i.payments) != 1))
167- then throw("bad payment")
168- else {
169- let supplyAmount = i.payments[0].amount
170- let supplyAsset = i.payments[0].assetId
171- if ((supplyAsset != USDN))
172- then throw("bad deposit asset")
173- else {
174- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "deposit", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", true], [AttachedPayment(supplyAsset, supplyAmount)])
175- if ((inv1 == inv1))
176- then {
177- let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil)
178- if ((inv2 == inv2))
179- then {
180- let amountOnStart = assetBalance(this, fromBase58String(w))
181- if ((amountOnStart == amountOnStart))
182- then {
183- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [w, -1], nil)
184- if ((inv3 == inv3))
185- then {
186- let balance = assetBalance(this, fromBase58String(w))
187- if ((balance == balance))
188- then if ((wa == 0))
189- then throw(toString((balance - amountOnStart)))
190- else if ((wa > (balance - amountOnStart)))
191- then throw("low")
192- else [ScriptTransfer(i.caller, (balance - amountOnStart), fromBase58String(w))]
193- else throw("Strict value is not equal to itself.")
194- }
195- else throw("Strict value is not equal to itself.")
196- }
197- else throw("Strict value is not equal to itself.")
198- }
199- else throw("Strict value is not equal to itself.")
200- }
201- else throw("Strict value is not equal to itself.")
202- }
203- }
204-
205-
206-
207-@Callable(i)
208-func itsminewi (br,cr,v,la,w,wa) = if (if (if (if ((i.originCaller != adminAddress))
209- then (i.originCaller != this)
210- else false)
211- then (i.originCaller != aggrAddress)
212- else false)
213- then (i.originCaller != usdnAggrAddress)
214- else false)
215- then throw("only admin can do")
216- else if ((size(i.payments) != 1))
217- then throw("bad payment")
218- else {
219- let repayAmount = i.payments[0].amount
220- let repayAsset = i.payments[0].assetId
221- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "replenishWithAtoken", nil, i.payments)
222- if ((inv1 == inv1))
223- then {
224- let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil)
225- if ((inv2 == inv2))
226- then {
227- let amountOnStart = assetBalance(this, fromBase58String(w))
228- if ((amountOnStart == amountOnStart))
229- then {
230- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [w, -1], nil)
231- if ((inv3 == inv3))
232- then {
233- let balance = assetBalance(this, fromBase58String(w))
234- if ((balance == balance))
235- then if ((wa == 0))
236- then throw(toString((balance - amountOnStart)))
237- else if ((wa > (balance - amountOnStart)))
238- then throw("low")
239- else [ScriptTransfer(i.caller, (balance - amountOnStart), fromBase58String(w))]
240- else throw("Strict value is not equal to itself.")
241- }
242- else throw("Strict value is not equal to itself.")
243- }
244- else throw("Strict value is not equal to itself.")
245- }
246- else throw("Strict value is not equal to itself.")
247- }
248- else throw("Strict value is not equal to itself.")
249- }
250-
251-
252-
253-@Callable(i)
254-func itsminewod (br,cr,v,la,w,wa) = if (if (if ((i.originCaller != adminAddress))
255- then (i.originCaller != this)
256- else false)
257- then (i.originCaller != aggrAddress)
258- else false)
259- then throw("only admin can do")
260- else if ((1 != 1))
261- then throw("bad payment")
262- else if ((1 != 1))
263- then throw("bad deposit asset")
264- else {
265- let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil)
266- if ((inv2 == inv2))
267- then {
268- let amountOnStart = assetBalance(this, fromBase58String(w))
269- if ((amountOnStart == amountOnStart))
270- then {
271- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [w, -1], nil)
272- if ((inv3 == inv3))
273- then {
274- let balance = assetBalance(this, fromBase58String(w))
275- if ((balance == balance))
276- then if ((wa == 0))
277- then throw(toString((balance - amountOnStart)))
278- else if ((wa > (balance - amountOnStart)))
279- then throw("low")
280- else [ScriptTransfer(i.caller, (balance - amountOnStart), fromBase58String(w))]
281- else throw("Strict value is not equal to itself.")
282- }
283- else throw("Strict value is not equal to itself.")
284- }
285- else throw("Strict value is not equal to itself.")
286- }
287- else throw("Strict value is not equal to itself.")
288- }
289-
290-
291-
292-@Callable(i)
293-func itsminewiwol (wa) = if (if (if (if ((i.originCaller != adminAddress))
294- then (i.originCaller != this)
295- else false)
296- then (i.originCaller != aggrAddress)
297- else false)
298- then (i.originCaller != usdnAggrAddress)
299- else false)
300- then throw("only admin can do")
301- else if ((size(i.payments) != 1))
302- then throw("bad payment")
303- else {
304- let repayAmount = i.payments[0].amount
305- let repayAsset = i.payments[0].assetId
306- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "replenishWithAtoken", nil, i.payments)
307- if ((inv1 == inv1))
308- then {
309- let amountOnStart = assetBalance(this, USDN)
310- if ((amountOnStart == amountOnStart))
311- then {
312- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [toBase58String(USDN), wa], nil)
313- if ((inv3 == inv3))
314- then {
315- let balance = assetBalance(this, USDN)
316- if ((balance == balance))
317- then [ScriptTransfer(i.caller, (balance - amountOnStart), USDN)]
318- else throw("Strict value is not equal to itself.")
319- }
320- else throw("Strict value is not equal to itself.")
321- }
322- else throw("Strict value is not equal to itself.")
323- }
324- else throw("Strict value is not equal to itself.")
325- }
326-
327-
328-
329-@Callable(i)
330-func itsminemint (ma,mw) = if (if (if (if ((i.originCaller != adminAddress))
331- then (i.originCaller != this)
332- else false)
333- then (i.originCaller != aggrAddress)
334- else false)
335- then (i.originCaller != usdnAggrAddress)
336- else false)
337- then throw("only admin can do")
338- else if ((size(i.payments) != 1))
339- then throw("bad payment")
340- else {
341- let repayAmount = i.payments[0].amount
342- let repayAsset = i.payments[0].assetId
343- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "replenishWithAtoken", nil, i.payments)
344- if ((inv1 == inv1))
345- then {
346- let amountOnStart = assetBalance(this, fromBase58String(mw))
347- if ((amountOnStart == amountOnStart))
348- then {
349- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "mintAtoken", [mw, ma], nil)
350- if ((inv3 == inv3))
351- then {
352- let balance = assetBalance(this, fromBase58String(mw))
353- if ((balance == balance))
354- then [ScriptTransfer(i.caller, (balance - amountOnStart), fromBase58String(mw))]
355- else throw("Strict value is not equal to itself.")
356- }
357- else throw("Strict value is not equal to itself.")
358- }
359- else throw("Strict value is not equal to itself.")
360- }
361- else throw("Strict value is not equal to itself.")
362- }
363-
364-
365-
366-@Callable(i)
367-func liq (br,cr,v,la) = if (if (if ((i.originCaller != adminAddress))
368- then (i.originCaller != this)
369- else false)
370- then (i.originCaller != aggrAddress)
371- else false)
372- then throw("only admin can do")
373- else if ((size(i.payments) != 1))
374- then throw("bad payment")
375- else {
376- let supplyAmount = i.payments[0].amount
377- let supplyAsset = i.payments[0].assetId
378- if ((supplyAsset != USDN))
379- then throw("bad deposit asset")
380- else {
381- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "deposit", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", true], [AttachedPayment(supplyAsset, supplyAmount)])
382- if ((inv1 == inv1))
383- then {
384- let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil)
385- if ((inv2 == inv2))
386- then nil
387- else throw("Strict value is not equal to itself.")
388- }
389- else throw("Strict value is not equal to itself.")
390- }
391- }
392-
393-
394-
395-@Callable(i)
396-func repay () = if (if (if ((i.originCaller != adminAddress))
397- then (i.originCaller != this)
398- else false)
399- then (i.originCaller != aggrAddress)
400- else false)
401- then throw("only admin can do")
402- else if ((size(i.payments) != 1))
403- then throw("bad payment")
404- else {
405- let repayAmount = i.payments[0].amount
406- let repayAsset = i.payments[0].assetId
407- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "repay", ["3PPdeWwrzaxqgr6BuReoF3sWfxW8SYv743D"], [AttachedPayment(repayAsset, repayAmount)])
408- if ((inv1 == inv1))
409- then {
410- let inv2 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw2", ["3PN1LXdwuFWH3paF3fpMNCWk7oWRzXCeMSC", -1], nil)
411- if ((inv2 == inv2))
412- then {
413- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw2", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", -1], nil)
414- if ((inv3 == inv3))
415- then [ScriptTransfer(i.caller, assetBalance(this, value(repayAsset)), repayAsset), ScriptTransfer(i.caller, assetBalance(this, fromBase58String("6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ")), fromBase58String("6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ")), ScriptTransfer(i.caller, assetBalance(this, fromBase58String("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p")), fromBase58String("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"))]
416- else throw("Strict value is not equal to itself.")
417- }
418- else throw("Strict value is not equal to itself.")
419- }
420- else throw("Strict value is not equal to itself.")
421- }
422-
423-
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let USDN = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
4+let powerAddress = Address(base58'3P86ne9inVG1Cf4smrEGSdcXyBuEApPcMAc')
55
6-let SURF = base58'At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL'
6+let ownerAddress = Address(base58'3PRBeeFD64wvTMfS3HEoDDFPXfJs3gFdAxk')
77
8-let adminAddress = Address(base58'3P6gGsVQbD2xgmaNxN7Rj3arohPsBxvo5GC')
9-
10-let aggrAddress = Address(base58'3P5T88oGg47FEsJcpC2o43BSF34Bs5dcFpP')
11-
12-let usdnAggrAddress = Address(base58'3P2cpE7nusQRRFt3Tg22WtKfdi6bUKwmqVM')
13-
14-let zeftAddress = Address(base58'3PC51qgNQz4xx7m1DhLdCDYESaeNKT6zeFt')
15-
16-func asAnyList (v) = match v {
17- case l: List[Any] =>
18- l
19- case _ =>
20- throw("#err")
21-}
22-
8+let POWER = base58'2thsACuHmzDMuNezPM32wg9a3BwUzBWDeSKakgz3cw21'
239
2410 func asInt (v) = match v {
2511 case x: Int =>
2612 x
2713 case t =>
2814 throw("#err")
2915 }
3016
3117
3218 @Callable(i)
33-func usdn_100 (amount) = {
34- let usdnAmountOnStart = assetBalance(this, USDN)
35- if ((usdnAmountOnStart == usdnAmountOnStart))
19+func unstake_power () = {
20+ let power_amount = asInt(invoke(powerAddress, "userPower", [toString(this)], nil))
21+ if ((power_amount == power_amount))
3622 then {
37- let inv = invoke(addressFromStringValue("3PCbvPVQfSvVu88ip8Fm5YjwJhjEYk1Txhk"), "withdrawVestedAllUSDN", [false, true], nil)
38- if ((inv == inv))
39- then {
40- let usdnAmountAfterWithdraw = assetBalance(this, USDN)
41- if ((usdnAmountAfterWithdraw == usdnAmountAfterWithdraw))
42- then [ScriptTransfer(aggrAddress, (usdnAmountAfterWithdraw - usdnAmountOnStart), USDN)]
43- else throw("Strict value is not equal to itself.")
44- }
23+ let unstake = invoke(powerAddress, "unstake", [power_amount], nil)
24+ if ((unstake == unstake))
25+ then [ScriptTransfer(ownerAddress, assetBalance(this, POWER), POWER)]
4526 else throw("Strict value is not equal to itself.")
4627 }
4728 else throw("Strict value is not equal to itself.")
4829 }
4930
5031
51-
52-@Callable(i)
53-func surf (w) = if (if ((i.caller != adminAddress))
54- then (i.caller != this)
55- else false)
56- then throw("only admin can do")
57- else {
58- let neutrinoMetrics = asAnyList(invoke(addressFromStringValue("3P77iUusNwMMzWFdC8f7bftwpHyG1PBs1gq"), "calcNeutinoMetricsREADONLY", nil, nil))
59- let BR = asInt(neutrinoMetrics[8])
60- if ((w > BR))
61- then {
62- let inv = invoke(Address(base58'3PCbvPVQfSvVu88ip8Fm5YjwJhjEYk1Txhk'), "withdrawVestedAllSURF", [false, true], nil)
63- if ((inv == inv))
64- then {
65- let aAmount = assetBalance(this, SURF)
66-[ScriptTransfer(aggrAddress, aAmount, SURF)]
67- }
68- else throw("Strict value is not equal to itself.")
69- }
70- else throw(("br is bad. " + toString(BR)))
71- }
72-
73-
74-
75-@Callable(i)
76-func toVesting (b) = if (if (if ((i.originCaller != adminAddress))
77- then (i.originCaller != this)
78- else false)
79- then (i.originCaller != aggrAddress)
80- else false)
81- then throw("only admin can do")
82- else if ((size(i.payments) != 1))
83- then throw("bad payment")
84- else {
85- let repayAmount = i.payments[0].amount
86- let repayAsset = i.payments[0].assetId
87- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "repay", [b], [AttachedPayment(repayAsset, repayAmount)])
88- if ((inv1 == inv1))
89- then {
90- let inv2 = invoke(Address(base58'3PCbvPVQfSvVu88ip8Fm5YjwJhjEYk1Txhk'), "convertToUSDN", nil, nil)
91- if ((inv2 == inv2))
92- then {
93- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", ["DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", -1], nil)
94- if ((inv3 == inv3))
95- then {
96- let balance = assetBalance(this, value(repayAsset))
97- if ((balance == balance))
98- then [ScriptTransfer(aggrAddress, balance, repayAsset), ScriptTransfer(usdnAggrAddress, assetBalance(this, USDN), USDN)]
99- else throw("Strict value is not equal to itself.")
100- }
101- else throw("Strict value is not equal to itself.")
102- }
103- else throw("Strict value is not equal to itself.")
104- }
105- else throw("Strict value is not equal to itself.")
106- }
107-
108-
109-
110-@Callable(i)
111-func rewards_vesting (strAddress) = if (if ((i.originCaller != adminAddress))
112- then (i.originCaller != this)
113- else false)
114- then throw("only admin can do")
115- else {
116- let toAddress = if ((strAddress == "3PC51qgNQz4xx7m1DhLdCDYESaeNKT6zeFt"))
117- then zeftAddress
118- else usdnAggrAddress
119- let usdnAmountOnStart = assetBalance(this, USDN)
120- if ((usdnAmountOnStart == usdnAmountOnStart))
121- then {
122- let inv = invoke(addressFromStringValue("3PKZk5TdPCLP2GZviipLFfK46ExTnwkRCBd"), "claimRewards", nil, nil)
123- if ((inv == inv))
124- then {
125- let usdnAmountAfterWithdraw = assetBalance(this, USDN)
126- if ((usdnAmountAfterWithdraw == usdnAmountAfterWithdraw))
127- then [ScriptTransfer(toAddress, (usdnAmountAfterWithdraw - usdnAmountOnStart), USDN)]
128- else throw("Strict value is not equal to itself.")
129- }
130- else throw("Strict value is not equal to itself.")
131- }
132- else throw("Strict value is not equal to itself.")
133- }
134-
135-
136-
137-@Callable(i)
138-func import_lp () = if (if (if (if ((i.originCaller != adminAddress))
139- then (i.originCaller != this)
140- else false)
141- then (i.originCaller != aggrAddress)
142- else false)
143- then (i.originCaller != usdnAggrAddress)
144- else false)
145- then throw("only admin can do")
146- else if ((size(i.payments) != 1))
147- then throw("bad payment")
148- else {
149- let repayAmount = i.payments[0].amount
150- let repayAsset = i.payments[0].assetId
151- let inv = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "replenishWithAtoken", nil, i.payments)
152- if ((inv == inv))
153- then nil
154- else throw("Strict value is not equal to itself.")
155- }
156-
157-
158-
159-@Callable(i)
160-func itsmine (br,cr,v,la,w,wa) = if (if (if ((i.originCaller != adminAddress))
161- then (i.originCaller != this)
162- else false)
163- then (i.originCaller != aggrAddress)
164- else false)
165- then throw("only admin can do")
166- else if ((size(i.payments) != 1))
167- then throw("bad payment")
168- else {
169- let supplyAmount = i.payments[0].amount
170- let supplyAsset = i.payments[0].assetId
171- if ((supplyAsset != USDN))
172- then throw("bad deposit asset")
173- else {
174- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "deposit", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", true], [AttachedPayment(supplyAsset, supplyAmount)])
175- if ((inv1 == inv1))
176- then {
177- let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil)
178- if ((inv2 == inv2))
179- then {
180- let amountOnStart = assetBalance(this, fromBase58String(w))
181- if ((amountOnStart == amountOnStart))
182- then {
183- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [w, -1], nil)
184- if ((inv3 == inv3))
185- then {
186- let balance = assetBalance(this, fromBase58String(w))
187- if ((balance == balance))
188- then if ((wa == 0))
189- then throw(toString((balance - amountOnStart)))
190- else if ((wa > (balance - amountOnStart)))
191- then throw("low")
192- else [ScriptTransfer(i.caller, (balance - amountOnStart), fromBase58String(w))]
193- else throw("Strict value is not equal to itself.")
194- }
195- else throw("Strict value is not equal to itself.")
196- }
197- else throw("Strict value is not equal to itself.")
198- }
199- else throw("Strict value is not equal to itself.")
200- }
201- else throw("Strict value is not equal to itself.")
202- }
203- }
204-
205-
206-
207-@Callable(i)
208-func itsminewi (br,cr,v,la,w,wa) = if (if (if (if ((i.originCaller != adminAddress))
209- then (i.originCaller != this)
210- else false)
211- then (i.originCaller != aggrAddress)
212- else false)
213- then (i.originCaller != usdnAggrAddress)
214- else false)
215- then throw("only admin can do")
216- else if ((size(i.payments) != 1))
217- then throw("bad payment")
218- else {
219- let repayAmount = i.payments[0].amount
220- let repayAsset = i.payments[0].assetId
221- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "replenishWithAtoken", nil, i.payments)
222- if ((inv1 == inv1))
223- then {
224- let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil)
225- if ((inv2 == inv2))
226- then {
227- let amountOnStart = assetBalance(this, fromBase58String(w))
228- if ((amountOnStart == amountOnStart))
229- then {
230- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [w, -1], nil)
231- if ((inv3 == inv3))
232- then {
233- let balance = assetBalance(this, fromBase58String(w))
234- if ((balance == balance))
235- then if ((wa == 0))
236- then throw(toString((balance - amountOnStart)))
237- else if ((wa > (balance - amountOnStart)))
238- then throw("low")
239- else [ScriptTransfer(i.caller, (balance - amountOnStart), fromBase58String(w))]
240- else throw("Strict value is not equal to itself.")
241- }
242- else throw("Strict value is not equal to itself.")
243- }
244- else throw("Strict value is not equal to itself.")
245- }
246- else throw("Strict value is not equal to itself.")
247- }
248- else throw("Strict value is not equal to itself.")
249- }
250-
251-
252-
253-@Callable(i)
254-func itsminewod (br,cr,v,la,w,wa) = if (if (if ((i.originCaller != adminAddress))
255- then (i.originCaller != this)
256- else false)
257- then (i.originCaller != aggrAddress)
258- else false)
259- then throw("only admin can do")
260- else if ((1 != 1))
261- then throw("bad payment")
262- else if ((1 != 1))
263- then throw("bad deposit asset")
264- else {
265- let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil)
266- if ((inv2 == inv2))
267- then {
268- let amountOnStart = assetBalance(this, fromBase58String(w))
269- if ((amountOnStart == amountOnStart))
270- then {
271- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [w, -1], nil)
272- if ((inv3 == inv3))
273- then {
274- let balance = assetBalance(this, fromBase58String(w))
275- if ((balance == balance))
276- then if ((wa == 0))
277- then throw(toString((balance - amountOnStart)))
278- else if ((wa > (balance - amountOnStart)))
279- then throw("low")
280- else [ScriptTransfer(i.caller, (balance - amountOnStart), fromBase58String(w))]
281- else throw("Strict value is not equal to itself.")
282- }
283- else throw("Strict value is not equal to itself.")
284- }
285- else throw("Strict value is not equal to itself.")
286- }
287- else throw("Strict value is not equal to itself.")
288- }
289-
290-
291-
292-@Callable(i)
293-func itsminewiwol (wa) = if (if (if (if ((i.originCaller != adminAddress))
294- then (i.originCaller != this)
295- else false)
296- then (i.originCaller != aggrAddress)
297- else false)
298- then (i.originCaller != usdnAggrAddress)
299- else false)
300- then throw("only admin can do")
301- else if ((size(i.payments) != 1))
302- then throw("bad payment")
303- else {
304- let repayAmount = i.payments[0].amount
305- let repayAsset = i.payments[0].assetId
306- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "replenishWithAtoken", nil, i.payments)
307- if ((inv1 == inv1))
308- then {
309- let amountOnStart = assetBalance(this, USDN)
310- if ((amountOnStart == amountOnStart))
311- then {
312- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [toBase58String(USDN), wa], nil)
313- if ((inv3 == inv3))
314- then {
315- let balance = assetBalance(this, USDN)
316- if ((balance == balance))
317- then [ScriptTransfer(i.caller, (balance - amountOnStart), USDN)]
318- else throw("Strict value is not equal to itself.")
319- }
320- else throw("Strict value is not equal to itself.")
321- }
322- else throw("Strict value is not equal to itself.")
323- }
324- else throw("Strict value is not equal to itself.")
325- }
326-
327-
328-
329-@Callable(i)
330-func itsminemint (ma,mw) = if (if (if (if ((i.originCaller != adminAddress))
331- then (i.originCaller != this)
332- else false)
333- then (i.originCaller != aggrAddress)
334- else false)
335- then (i.originCaller != usdnAggrAddress)
336- else false)
337- then throw("only admin can do")
338- else if ((size(i.payments) != 1))
339- then throw("bad payment")
340- else {
341- let repayAmount = i.payments[0].amount
342- let repayAsset = i.payments[0].assetId
343- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "replenishWithAtoken", nil, i.payments)
344- if ((inv1 == inv1))
345- then {
346- let amountOnStart = assetBalance(this, fromBase58String(mw))
347- if ((amountOnStart == amountOnStart))
348- then {
349- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "mintAtoken", [mw, ma], nil)
350- if ((inv3 == inv3))
351- then {
352- let balance = assetBalance(this, fromBase58String(mw))
353- if ((balance == balance))
354- then [ScriptTransfer(i.caller, (balance - amountOnStart), fromBase58String(mw))]
355- else throw("Strict value is not equal to itself.")
356- }
357- else throw("Strict value is not equal to itself.")
358- }
359- else throw("Strict value is not equal to itself.")
360- }
361- else throw("Strict value is not equal to itself.")
362- }
363-
364-
365-
366-@Callable(i)
367-func liq (br,cr,v,la) = if (if (if ((i.originCaller != adminAddress))
368- then (i.originCaller != this)
369- else false)
370- then (i.originCaller != aggrAddress)
371- else false)
372- then throw("only admin can do")
373- else if ((size(i.payments) != 1))
374- then throw("bad payment")
375- else {
376- let supplyAmount = i.payments[0].amount
377- let supplyAsset = i.payments[0].assetId
378- if ((supplyAsset != USDN))
379- then throw("bad deposit asset")
380- else {
381- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "deposit", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", true], [AttachedPayment(supplyAsset, supplyAmount)])
382- if ((inv1 == inv1))
383- then {
384- let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil)
385- if ((inv2 == inv2))
386- then nil
387- else throw("Strict value is not equal to itself.")
388- }
389- else throw("Strict value is not equal to itself.")
390- }
391- }
392-
393-
394-
395-@Callable(i)
396-func repay () = if (if (if ((i.originCaller != adminAddress))
397- then (i.originCaller != this)
398- else false)
399- then (i.originCaller != aggrAddress)
400- else false)
401- then throw("only admin can do")
402- else if ((size(i.payments) != 1))
403- then throw("bad payment")
404- else {
405- let repayAmount = i.payments[0].amount
406- let repayAsset = i.payments[0].assetId
407- let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "repay", ["3PPdeWwrzaxqgr6BuReoF3sWfxW8SYv743D"], [AttachedPayment(repayAsset, repayAmount)])
408- if ((inv1 == inv1))
409- then {
410- let inv2 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw2", ["3PN1LXdwuFWH3paF3fpMNCWk7oWRzXCeMSC", -1], nil)
411- if ((inv2 == inv2))
412- then {
413- let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw2", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", -1], nil)
414- if ((inv3 == inv3))
415- then [ScriptTransfer(i.caller, assetBalance(this, value(repayAsset)), repayAsset), ScriptTransfer(i.caller, assetBalance(this, fromBase58String("6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ")), fromBase58String("6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ")), ScriptTransfer(i.caller, assetBalance(this, fromBase58String("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p")), fromBase58String("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"))]
416- else throw("Strict value is not equal to itself.")
417- }
418- else throw("Strict value is not equal to itself.")
419- }
420- else throw("Strict value is not equal to itself.")
421- }
422-
423-

github/deemru/w8io/6500d08 
45.78 ms