tx · GrJFFUtEq6y4ZuBfjbu9cciygRhWH7j28cL4datferHs 3PBgZDQFcRgVsti29Qx5a6Eysqreuo4vG1E: -0.00100000 Waves 2023.04.18 16:22 [3605599] smart account 3PBgZDQFcRgVsti29Qx5a6Eysqreuo4vG1E > SELF 0.00000000 Waves
{ "type": 13, "id": "GrJFFUtEq6y4ZuBfjbu9cciygRhWH7j28cL4datferHs", "fee": 100000, "feeAssetId": null, "timestamp": 1681824212015, "version": 1, "sender": "3PBgZDQFcRgVsti29Qx5a6Eysqreuo4vG1E", "senderPublicKey": "8nU2xw1szvsabBKfZSzh7y2tHEaWsU655CBpKtzW8gwh", "proofs": [ "FCxgPXK8XSMTBcJmyg8oURrWzxge51QM3wsgrPE7EPVyfbv1JdxRyRg4QqLcP1p2snwzE9SYNKTsF17aeQ6LQ2n" ], "script": "base64:BgIECAISAAQADHBvd2VyQWRkcmVzcwkBB0FkZHJlc3MBARoBV0Ov1RrltOOKrDIfaMeqY/GOXgFS7CVs9QAMb3duZXJBZGRyZXNzCQEHQWRkcmVzcwEBGgFX/xVftiNN6UUUtTRLHHU2/GG/YduSmsFFAAVQT1dFUgEgHBqDoMT3Lh6CR3PXRUPBKIbTqsytzoIzH7EhqJqevEoBBWFzSW50AQF2BAckbWF0Y2gwBQF2AwkAAQIFByRtYXRjaDACA0ludAQBeAUHJG1hdGNoMAUBeAQBdAUHJG1hdGNoMAkAAgECBCNlcnIBAWkBDXVuc3Rha2VfcG93ZXIABAxwb3dlcl9hbW91bnQJAQVhc0ludAEJAPwHBAUMcG93ZXJBZGRyZXNzAgl1c2VyUG93ZXIJAMwIAgkApQgBBQR0aGlzBQNuaWwFA25pbAMJAAACBQxwb3dlcl9hbW91bnQFDHBvd2VyX2Ftb3VudAQHdW5zdGFrZQkA/AcEBQxwb3dlckFkZHJlc3MCB3Vuc3Rha2UJAMwIAgUMcG93ZXJfYW1vdW50BQNuaWwFA25pbAMJAAACBQd1bnN0YWtlBQd1bnN0YWtlCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMFDG93bmVyQWRkcmVzcwkA8AcCBQR0aGlzBQVQT1dFUgUFUE9XRVIFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgBp02z4", "chainId": 87, "height": 3605599, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8QhvCwNtvoQkffQBU6G4fKCjNJcQjraXavoDePa8rb9P Next: CPxBnsg3DK4nWcBFLHa3QeK3V2nnZr9FCgg54rA77ts5 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let powerAddress = Address(base58'3P86ne9inVG1Cf4smrEGSdcXyBuEApPcMAc') | |
5 | 5 | ||
6 | - | let | |
6 | + | let ownerAddress = Address(base58'3PRBeeFD64wvTMfS3HEoDDFPXfJs3gFdAxk') | |
7 | 7 | ||
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' | |
23 | 9 | ||
24 | 10 | func asInt (v) = match v { | |
25 | 11 | case x: Int => | |
30 | 16 | ||
31 | 17 | ||
32 | 18 | @Callable(i) | |
33 | - | func | |
34 | - | let | |
35 | - | if (( | |
19 | + | func unstake_power () = { | |
20 | + | let power_amount = asInt(invoke(powerAddress, "userPower", [toString(this)], nil)) | |
21 | + | if ((power_amount == power_amount)) | |
36 | 22 | 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)] | |
45 | 26 | else throw("Strict value is not equal to itself.") | |
46 | 27 | } | |
47 | 28 | else throw("Strict value is not equal to itself.") | |
48 | 29 | } | |
49 | 30 | ||
50 | 31 | ||
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 itsmine2 (br,cr,v,la,w,wa) = if (if (if ((i.originCaller != adminAddress)) | |
209 | - | then (i.originCaller != this) | |
210 | - | else false) | |
211 | - | then (i.originCaller != aggrAddress) | |
212 | - | else false) | |
213 | - | then throw("only admin can do") | |
214 | - | else if ((1 != 1)) | |
215 | - | then throw("bad payment") | |
216 | - | else if ((1 != 1)) | |
217 | - | then throw("bad deposit asset") | |
218 | - | else { | |
219 | - | let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil) | |
220 | - | if ((inv2 == inv2)) | |
221 | - | then { | |
222 | - | let amountOnStart = assetBalance(this, fromBase58String(w)) | |
223 | - | if ((amountOnStart == amountOnStart)) | |
224 | - | then { | |
225 | - | let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [w, -1], nil) | |
226 | - | if ((inv3 == inv3)) | |
227 | - | then { | |
228 | - | let balance = assetBalance(this, fromBase58String(w)) | |
229 | - | if ((balance == balance)) | |
230 | - | then if ((wa == 0)) | |
231 | - | then throw(toString((balance - amountOnStart))) | |
232 | - | else if ((wa > (balance - amountOnStart))) | |
233 | - | then throw("low") | |
234 | - | else nil | |
235 | - | else throw("Strict value is not equal to itself.") | |
236 | - | } | |
237 | - | else throw("Strict value is not equal to itself.") | |
238 | - | } | |
239 | - | else throw("Strict value is not equal to itself.") | |
240 | - | } | |
241 | - | else throw("Strict value is not equal to itself.") | |
242 | - | } | |
243 | - | ||
244 | - | ||
245 | - | ||
246 | - | @Callable(i) | |
247 | - | func liq1 (br,cr,v,la) = if (if (if ((i.originCaller != adminAddress)) | |
248 | - | then (i.originCaller != this) | |
249 | - | else false) | |
250 | - | then (i.originCaller != aggrAddress) | |
251 | - | else false) | |
252 | - | then throw("only admin can do") | |
253 | - | else if ((size(i.payments) != 1)) | |
254 | - | then throw("bad payment") | |
255 | - | else { | |
256 | - | let supplyAmount = i.payments[0].amount | |
257 | - | let supplyAsset = i.payments[0].assetId | |
258 | - | if ((supplyAsset != USDN)) | |
259 | - | then throw("bad deposit asset") | |
260 | - | else { | |
261 | - | let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "deposit", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", true], [AttachedPayment(supplyAsset, supplyAmount)]) | |
262 | - | if ((inv1 == inv1)) | |
263 | - | then { | |
264 | - | let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil) | |
265 | - | if ((inv2 == inv2)) | |
266 | - | then nil | |
267 | - | else throw("Strict value is not equal to itself.") | |
268 | - | } | |
269 | - | else throw("Strict value is not equal to itself.") | |
270 | - | } | |
271 | - | } | |
272 | - | ||
273 | - | ||
274 | - | ||
275 | - | @Callable(i) | |
276 | - | func liq2 (br,cr,v,la) = if (if (if ((i.originCaller != adminAddress)) | |
277 | - | then (i.originCaller != this) | |
278 | - | else false) | |
279 | - | then (i.originCaller != aggrAddress) | |
280 | - | else false) | |
281 | - | then throw("only admin can do") | |
282 | - | else if ((size(i.payments) != 1)) | |
283 | - | then throw("bad payment") | |
284 | - | else { | |
285 | - | let supplyAmount = i.payments[0].amount | |
286 | - | let supplyAsset = i.payments[0].assetId | |
287 | - | if ((supplyAsset != USDN)) | |
288 | - | then throw("bad deposit asset") | |
289 | - | else { | |
290 | - | let inv11 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "deposit", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", false], [AttachedPayment(supplyAsset, supplyAmount)]) | |
291 | - | if ((inv11 == inv11)) | |
292 | - | then { | |
293 | - | let inv12 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "protectCollateral", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce"], nil) | |
294 | - | if ((inv12 == inv12)) | |
295 | - | then { | |
296 | - | let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil) | |
297 | - | if ((inv2 == inv2)) | |
298 | - | then nil | |
299 | - | else throw("Strict value is not equal to itself.") | |
300 | - | } | |
301 | - | else throw("Strict value is not equal to itself.") | |
302 | - | } | |
303 | - | else throw("Strict value is not equal to itself.") | |
304 | - | } | |
305 | - | } | |
306 | - | ||
307 | - |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let powerAddress = Address(base58'3P86ne9inVG1Cf4smrEGSdcXyBuEApPcMAc') | |
5 | 5 | ||
6 | - | let | |
6 | + | let ownerAddress = Address(base58'3PRBeeFD64wvTMfS3HEoDDFPXfJs3gFdAxk') | |
7 | 7 | ||
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' | |
23 | 9 | ||
24 | 10 | func asInt (v) = match v { | |
25 | 11 | case x: Int => | |
26 | 12 | x | |
27 | 13 | case t => | |
28 | 14 | throw("#err") | |
29 | 15 | } | |
30 | 16 | ||
31 | 17 | ||
32 | 18 | @Callable(i) | |
33 | - | func | |
34 | - | let | |
35 | - | if (( | |
19 | + | func unstake_power () = { | |
20 | + | let power_amount = asInt(invoke(powerAddress, "userPower", [toString(this)], nil)) | |
21 | + | if ((power_amount == power_amount)) | |
36 | 22 | 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)] | |
45 | 26 | else throw("Strict value is not equal to itself.") | |
46 | 27 | } | |
47 | 28 | else throw("Strict value is not equal to itself.") | |
48 | 29 | } | |
49 | 30 | ||
50 | 31 | ||
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 itsmine2 (br,cr,v,la,w,wa) = if (if (if ((i.originCaller != adminAddress)) | |
209 | - | then (i.originCaller != this) | |
210 | - | else false) | |
211 | - | then (i.originCaller != aggrAddress) | |
212 | - | else false) | |
213 | - | then throw("only admin can do") | |
214 | - | else if ((1 != 1)) | |
215 | - | then throw("bad payment") | |
216 | - | else if ((1 != 1)) | |
217 | - | then throw("bad deposit asset") | |
218 | - | else { | |
219 | - | let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil) | |
220 | - | if ((inv2 == inv2)) | |
221 | - | then { | |
222 | - | let amountOnStart = assetBalance(this, fromBase58String(w)) | |
223 | - | if ((amountOnStart == amountOnStart)) | |
224 | - | then { | |
225 | - | let inv3 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "withdraw", [w, -1], nil) | |
226 | - | if ((inv3 == inv3)) | |
227 | - | then { | |
228 | - | let balance = assetBalance(this, fromBase58String(w)) | |
229 | - | if ((balance == balance)) | |
230 | - | then if ((wa == 0)) | |
231 | - | then throw(toString((balance - amountOnStart))) | |
232 | - | else if ((wa > (balance - amountOnStart))) | |
233 | - | then throw("low") | |
234 | - | else nil | |
235 | - | else throw("Strict value is not equal to itself.") | |
236 | - | } | |
237 | - | else throw("Strict value is not equal to itself.") | |
238 | - | } | |
239 | - | else throw("Strict value is not equal to itself.") | |
240 | - | } | |
241 | - | else throw("Strict value is not equal to itself.") | |
242 | - | } | |
243 | - | ||
244 | - | ||
245 | - | ||
246 | - | @Callable(i) | |
247 | - | func liq1 (br,cr,v,la) = if (if (if ((i.originCaller != adminAddress)) | |
248 | - | then (i.originCaller != this) | |
249 | - | else false) | |
250 | - | then (i.originCaller != aggrAddress) | |
251 | - | else false) | |
252 | - | then throw("only admin can do") | |
253 | - | else if ((size(i.payments) != 1)) | |
254 | - | then throw("bad payment") | |
255 | - | else { | |
256 | - | let supplyAmount = i.payments[0].amount | |
257 | - | let supplyAsset = i.payments[0].assetId | |
258 | - | if ((supplyAsset != USDN)) | |
259 | - | then throw("bad deposit asset") | |
260 | - | else { | |
261 | - | let inv1 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "deposit", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", true], [AttachedPayment(supplyAsset, supplyAmount)]) | |
262 | - | if ((inv1 == inv1)) | |
263 | - | then { | |
264 | - | let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil) | |
265 | - | if ((inv2 == inv2)) | |
266 | - | then nil | |
267 | - | else throw("Strict value is not equal to itself.") | |
268 | - | } | |
269 | - | else throw("Strict value is not equal to itself.") | |
270 | - | } | |
271 | - | } | |
272 | - | ||
273 | - | ||
274 | - | ||
275 | - | @Callable(i) | |
276 | - | func liq2 (br,cr,v,la) = if (if (if ((i.originCaller != adminAddress)) | |
277 | - | then (i.originCaller != this) | |
278 | - | else false) | |
279 | - | then (i.originCaller != aggrAddress) | |
280 | - | else false) | |
281 | - | then throw("only admin can do") | |
282 | - | else if ((size(i.payments) != 1)) | |
283 | - | then throw("bad payment") | |
284 | - | else { | |
285 | - | let supplyAmount = i.payments[0].amount | |
286 | - | let supplyAsset = i.payments[0].assetId | |
287 | - | if ((supplyAsset != USDN)) | |
288 | - | then throw("bad deposit asset") | |
289 | - | else { | |
290 | - | let inv11 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "deposit", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce", false], [AttachedPayment(supplyAsset, supplyAmount)]) | |
291 | - | if ((inv11 == inv11)) | |
292 | - | then { | |
293 | - | let inv12 = invoke(Address(base58'3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT'), "protectCollateral", ["3PCwFXSq8vj8iKitA5zrrLRbuqehfmimpce"], nil) | |
294 | - | if ((inv12 == inv12)) | |
295 | - | then { | |
296 | - | let inv2 = invoke(Address(base58'3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw'), "transferDebt", [br, cr, v, la], nil) | |
297 | - | if ((inv2 == inv2)) | |
298 | - | then nil | |
299 | - | else throw("Strict value is not equal to itself.") | |
300 | - | } | |
301 | - | else throw("Strict value is not equal to itself.") | |
302 | - | } | |
303 | - | else throw("Strict value is not equal to itself.") | |
304 | - | } | |
305 | - | } | |
306 | - | ||
307 | - |
github/deemru/w8io/6500d08 50.00 ms ◑