2023.02.22 13:07 [3526216] smart account 3PBy5csSnjgkieeF9dRTXN2AwG3SXBsVpww > SELF 0.00000000 Waves
{ "type": 13, "id": "CNJD6DuJeZYTpXxL5VBoWhtL9iR7CUEfq2ptoSu8mTn7", "fee": 1200000, "feeAssetId": null, "timestamp": 1677060481654, "version": 2, "chainId": 87, "sender": "3PBy5csSnjgkieeF9dRTXN2AwG3SXBsVpww", "senderPublicKey": "ACUCrsKGyXXF5qHMFHPnQRbm5dQ619jBk5r4xWgex9TE", "proofs": [ "3KormH9ctYz98SnGgijiybqP7rszE3eaDUSdpQznPrmYCZDu8TCt3gpjbiJnMZed1Er6RPjgyhEhqt7fG3VcLEze" ], "script": "base64:BgLDBQgCEgMKAQESBAoCCAgSBAoCCAgiACIEYm9zcyIRdXNkdEFzc2V0SWRTdHJpbmciEXVzZGNBc3NldElkU3RyaW5nIhF1c2RuQXNzZXRJZFN0cmluZyIOYWRtaW5QdWJsaWNLZXkiDmdldFN0cmluZ0J5S2V5IgNrZXkiD2dldEludGVnZXJCeUtleSIDYW10Ig5kZWNpbWFsc19tdWx0aSIHZ2V0QmFzZSIJZnVuY19uYW1lIgRkYXRhIgJwMSICcDIiAmxwIgNhaWQiBGFpZDIiBHdhaWQiBGFpZHMiBWFpZDJzIgpnZXRCYXNlQmFsIgZhaWQyYmIiBWFpZGJiIglnZXRQdXRHZXQiB3B1dEZ1bmMiB2dldEZ1bmMiCGZpbmFsaXplIgdlcnJfc3RyIgdkZWNpbWFsIgZhaWQyYmEiCHRyZXNob2xkIgZhbW91bnQiDGdldEJhbFRvU3dhcCIHYWlkX3N0ciIPZ2V0QXNzZXREZWNpbWFsIgF4IgckbWF0Y2gwIgVhc3NldCICcHciAWkiCyR0MDI2MzMyNzAwIgxhaWQyX2RlY2ltYWwiCyR0MDI4NDMyOTAyIgRzd2FwIgliYWxUb1N3YXAiCyR0MDMwOTQzMTM0IgNwdXQiA2xwYiIDZ2V0IgJ3cCILJHQwMzUwMzM1NzAiCyR0MD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zZWxmLgMBUAEIc2V0QW1vdXQBAmFzAwkBAiE9AggFAVAGY2FsbGVyBQR0aGlzCQACAQIbeW91IGFyZSBub3QgYWxsb3dlZCB0byBzZXQhCQDMCAIJAQxJbnRlZ2VyRW50cnkCAgdtb250YW50BQJhcwUDbmlsAVABD3NldEtleVZhbFN0cmluZwIBaAJhdAMJAQIhPQIIBQFQBmNhbGxlcgUEdGhpcwkAAgECG3lvdSBhcmUgbm90IGFsbG93ZWQgdG8gc2V0IQkAzAgCCQELU3RyaW5nRW50cnkCBQFoBQJhdAUDbmlsAVABAWECAmFzAmF1AwkAAAIFAmF1AgJwdwkBAU8CBQFQBQJhcwMJAAACBQJhdQICd3AJAQFaAgUBUAUCYXMDCQAAAgUCYXUCAnBzCQECYWQCBQFQBQJhcwMJAAACBQJhdQICc3AJAQJhaAIFAVAFAmFzAwkAAAIFAmF1AgJ3cwkBAmFrAgUBUAUCYXMDCQAAAgUCYXUCAnN3CQECYW8CBQFQBQJhcwkAAgECDlR5cGUgbm90IGZvdW5kAQJhdgECYXcAAwkAyBMDCAUCYXYJYm9keUJ5dGVzCQCRAwIIBQJhdgZwcm9vZnMAAAgFAmF2D3NlbmRlclB1YmxpY0tleQYJAMgTAwgFAmF2CWJvZHlCeXRlcwkAkQMCCAUCYXYGcHJvb2ZzAAAFAWaKUY1Z", "height": 3526216, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GQDWmeCoKzLAQugVbUvF3NHWcNRRUuGTWNeRYZ9UUH8N Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let boss = addressFromStringValue("3PRE5KH9oPGfFPs7fGnQcJ4wNshEDUPGj1t") | |
5 | 5 | ||
6 | - | let | |
6 | + | let usdtAssetIdString = "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ" | |
7 | 7 | ||
8 | - | let boss = addressFromStringValue("3PRE5KH9oPGfFPs7fGnQcJ4wNshEDUPGj1t") | |
8 | + | let usdcAssetIdString = "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ" | |
9 | + | ||
10 | + | let usdnAssetIdString = "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p" | |
9 | 11 | ||
10 | 12 | let adminPublicKey = base58'Cr1ybL2JGg9GwJHA2JwqxBPfSW6Q7Jg4HvNrsEiCsHu6' | |
11 | 13 | ||
12 | - | func getPutGet (is_stable) = { | |
13 | - | let putFunc = if ((is_stable == 1)) | |
14 | + | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
15 | + | ||
16 | + | ||
17 | + | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 25) | |
18 | + | ||
19 | + | ||
20 | + | let amt = getIntegerByKey("montant") | |
21 | + | ||
22 | + | let decimals_multi = [10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000] | |
23 | + | ||
24 | + | func getBase (func_name) = { | |
25 | + | let data = split(getStringByKey(func_name), "_") | |
26 | + | let p1 = addressFromStringValue(data[0]) | |
27 | + | let p2 = addressFromStringValue(data[1]) | |
28 | + | let lp = fromBase58String(data[2]) | |
29 | + | let aid = fromBase58String(data[3]) | |
30 | + | let aid2 = fromBase58String(data[4]) | |
31 | + | let waid = unit | |
32 | + | let aids = if ((data[3] == "WAVES")) | |
33 | + | then "WAVES" | |
34 | + | else data[3] | |
35 | + | let aid2s = if ((data[4] == "WAVES")) | |
36 | + | then "WAVES" | |
37 | + | else data[4] | |
38 | + | $Tuple8(p1, p2, lp, aid, aid2, waid, aids, aid2s) | |
39 | + | } | |
40 | + | ||
41 | + | ||
42 | + | func getBaseBal (aid,aids,aid2,aid2s) = { | |
43 | + | let aid2bb = if ((aid2s == "WAVES")) | |
44 | + | then wavesBalance(this).available | |
45 | + | else assetBalance(this, aid2) | |
46 | + | if ((aid2bb == aid2bb)) | |
47 | + | then { | |
48 | + | let aidbb = if ((aids == "WAVES")) | |
49 | + | then wavesBalance(this).available | |
50 | + | else assetBalance(this, aid) | |
51 | + | if ((aidbb == aidbb)) | |
52 | + | then $Tuple2(aidbb, aid2bb) | |
53 | + | else throw("Strict value is not equal to itself.") | |
54 | + | } | |
55 | + | else throw("Strict value is not equal to itself.") | |
56 | + | } | |
57 | + | ||
58 | + | ||
59 | + | func getPutGet (aids) = { | |
60 | + | let putFunc = if (if ((usdtAssetIdString == aids)) | |
61 | + | then true | |
62 | + | else (usdcAssetIdString == aids)) | |
14 | 63 | then "putOneTknV2" | |
15 | 64 | else "putOneTkn" | |
16 | - | let getFunc = if ((is_stable == 1)) | |
65 | + | let getFunc = if (if ((usdtAssetIdString == aids)) | |
66 | + | then true | |
67 | + | else (usdcAssetIdString == aids)) | |
17 | 68 | then "getOneTknV2" | |
18 | 69 | else "getOneTkn" | |
19 | 70 | $Tuple2(putFunc, getFunc) | |
20 | 71 | } | |
21 | 72 | ||
22 | 73 | ||
23 | - | func getBalance (assetId) = match assetId { | |
24 | - | case b: ByteVector => | |
25 | - | assetBalance(this, b) | |
26 | - | case _ => | |
27 | - | wavesBalance(this).available | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | func getBase1 (data) = { | |
32 | - | let p_data = split(data, "_") | |
33 | - | let a = p_data[0] | |
34 | - | let a2 = p_data[1] | |
35 | - | let assetIn = p_data[2] | |
36 | - | let amountIn = p_data[3] | |
37 | - | let amount_1 = p_data[4] | |
38 | - | let amount_2 = p_data[5] | |
39 | - | let amount_3 = p_data[6] | |
40 | - | $Tuple7(a, a2, assetIn, amountIn, amount_1, amount_2, amount_3) | |
41 | - | } | |
42 | - | ||
43 | - | ||
44 | - | func getBase2 (data) = { | |
45 | - | let p_data = split(data, "_") | |
46 | - | let p1 = p_data[0] | |
47 | - | let lp1 = p_data[1] | |
48 | - | let is_stable_1 = p_data[2] | |
49 | - | let t = p_data[3] | |
50 | - | $Tuple4(p1, lp1, is_stable_1, t) | |
51 | - | } | |
52 | - | ||
53 | - | ||
54 | - | func getAssetBytes (assetId) = if ((assetId == "WAVES")) | |
55 | - | then unit | |
56 | - | else fromBase58String(assetId) | |
57 | - | ||
58 | - | ||
59 | - | func swap_wx (p,lp,asset,amount,putFunc1,getFunc1,a) = { | |
60 | - | let put1 = invoke(Address(fromBase58String(p)), putFunc1, [1, false], [AttachedPayment(getAssetBytes(asset), amount)]) | |
61 | - | if ((put1 == put1)) | |
74 | + | func finalize (aid2bb,aid2s,aid2,err_str,decimal) = { | |
75 | + | let aid2ba = if ((aid2s == "WAVES")) | |
76 | + | then wavesBalance(this).available | |
77 | + | else assetBalance(this, aid2) | |
78 | + | if ((aid2ba == aid2ba)) | |
62 | 79 | then { | |
63 | - | let lp1_assetid = fromBase58String(lp) | |
64 | - | let lpBalance_1 = getBalance(lp1_assetid) | |
65 | - | if ((lpBalance_1 == lpBalance_1)) | |
66 | - | then { | |
67 | - | let get1 = invoke(Address(fromBase58String(p)), getFunc1, [a, 1], [AttachedPayment(lp1_assetid, lpBalance_1)]) | |
68 | - | if ((get1 == get1)) | |
69 | - | then nil | |
80 | + | let treshold = if ((aid2s == usdnAssetIdString)) | |
81 | + | then 80000 | |
82 | + | else 0 | |
83 | + | if ((treshold >= (aid2ba - aid2bb))) | |
84 | + | then throw(err_str) | |
85 | + | else { | |
86 | + | let amount = (aid2ba - (amt * decimal)) | |
87 | + | if ((amount == amount)) | |
88 | + | then [ScriptTransfer(boss, amount, if ((aid2s == "WAVES")) | |
89 | + | then unit | |
90 | + | else aid2)] | |
70 | 91 | else throw("Strict value is not equal to itself.") | |
71 | 92 | } | |
72 | - | else throw("Strict value is not equal to itself.") | |
73 | 93 | } | |
74 | 94 | else throw("Strict value is not equal to itself.") | |
75 | 95 | } | |
76 | 96 | ||
77 | 97 | ||
78 | - | func swap_swop (p,asset,amount,stable,est,min) = if ((stable == 1)) | |
79 | - | then { | |
80 | - | let swap1 = invoke(Address(fromBase58String(p)), "exchange", [est, min], [AttachedPayment(getAssetBytes(asset), amount)]) | |
81 | - | if ((swap1 == swap1)) | |
82 | - | then nil | |
83 | - | else throw("Strict value is not equal to itself.") | |
84 | - | } | |
85 | - | else { | |
86 | - | let swap2 = invoke(Address(fromBase58String(p)), "exchange", [1], [AttachedPayment(getAssetBytes(asset), amount)]) | |
87 | - | if ((swap2 == swap2)) | |
88 | - | then nil | |
89 | - | else throw("Strict value is not equal to itself.") | |
90 | - | } | |
98 | + | func getBalToSwap (aid_str,aidbb,aid) = if ((aid_str == "WAVES")) | |
99 | + | then (wavesBalance(this).available - aidbb) | |
100 | + | else (assetBalance(this, aid) - aidbb) | |
91 | 101 | ||
92 | 102 | ||
93 | - | func swap_puzzle (p,asset,amount,assetOut) = { | |
94 | - | let swap = invoke(Address(fromBase58String(p)), "swap", [assetOut, 1], [AttachedPayment(getAssetBytes(asset), amount)]) | |
95 | - | if ((swap == swap)) | |
96 | - | then nil | |
97 | - | else throw("Strict value is not equal to itself.") | |
103 | + | func getAssetDecimal (aid) = { | |
104 | + | let x = match assetInfo(aid) { | |
105 | + | case asset: Asset => | |
106 | + | decimals_multi[(asset.decimals - 1)] | |
107 | + | case _ => | |
108 | + | decimals_multi[7] | |
109 | + | } | |
110 | + | x | |
98 | 111 | } | |
99 | 112 | ||
100 | 113 | ||
101 | - | func getIntegerByKey (address,key) = valueOrElse(getInteger(address, key), 0) | |
114 | + | func pw (i,func_name) = { | |
115 | + | let $t026332700 = getBase(func_name) | |
116 | + | let p1 = $t026332700._1 | |
117 | + | let p2 = $t026332700._2 | |
118 | + | let lp = $t026332700._3 | |
119 | + | let aid = $t026332700._4 | |
120 | + | let aid2 = $t026332700._5 | |
121 | + | let waid = $t026332700._6 | |
122 | + | let aids = $t026332700._7 | |
123 | + | let aid2s = $t026332700._8 | |
124 | + | let aid2_decimal = getAssetDecimal(aid2) | |
125 | + | if (if ((i.caller != this)) | |
126 | + | then (i.caller != boss) | |
127 | + | else false) | |
128 | + | then throw("you are not allowed to arb!") | |
129 | + | else { | |
130 | + | let $t028432902 = getBaseBal(aid, aids, aid2, aid2s) | |
131 | + | if (($t028432902 == $t028432902)) | |
132 | + | then { | |
133 | + | let aid2bb = $t028432902._2 | |
134 | + | let aidbb = $t028432902._1 | |
135 | + | let swap = invoke(p1, "swap", [aids, 1], [AttachedPayment(if ((aid2s == "WAVES")) | |
136 | + | then waid | |
137 | + | else aid2, (amt * aid2_decimal))]) | |
138 | + | if ((swap == swap)) | |
139 | + | then { | |
140 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
141 | + | let $t030943134 = getPutGet(aids) | |
142 | + | let putFunc = $t030943134._1 | |
143 | + | let getFunc = $t030943134._2 | |
144 | + | let put = invoke(p2, putFunc, [1, false], [AttachedPayment(if ((aids == "WAVES")) | |
145 | + | then waid | |
146 | + | else aid, balToSwap)]) | |
147 | + | if ((put == put)) | |
148 | + | then { | |
149 | + | let lpb = assetBalance(this, lp) | |
150 | + | if ((lpb == lpb)) | |
151 | + | then { | |
152 | + | let get = invoke(p2, getFunc, [aid2s, 1], [AttachedPayment(lp, lpb)]) | |
153 | + | if ((get == get)) | |
154 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
155 | + | else throw("Strict value is not equal to itself.") | |
156 | + | } | |
157 | + | else throw("Strict value is not equal to itself.") | |
158 | + | } | |
159 | + | else throw("Strict value is not equal to itself.") | |
160 | + | } | |
161 | + | else throw("Strict value is not equal to itself.") | |
162 | + | } | |
163 | + | else throw("Strict value is not equal to itself.") | |
164 | + | } | |
165 | + | } | |
102 | 166 | ||
103 | 167 | ||
104 | - | func getMinToReceive (amountWithoutFee,pool) = { | |
105 | - | let fee = getIntegerByKey(Address(fromBase58String(pool)), "commission") | |
106 | - | let feeScale6 = 1000000 | |
107 | - | let amountWithFee = fraction(amountWithoutFee, (feeScale6 - fee), feeScale6) | |
108 | - | let minToReceiveWithSleepage = (amountWithFee - fraction(amountWithFee, 15000, 1000000)) | |
109 | - | $Tuple2(amountWithFee, minToReceiveWithSleepage) | |
168 | + | func wp (i,func_name) = { | |
169 | + | let $t035033570 = getBase(func_name) | |
170 | + | let p1 = $t035033570._1 | |
171 | + | let p2 = $t035033570._2 | |
172 | + | let lp = $t035033570._3 | |
173 | + | let aid = $t035033570._4 | |
174 | + | let aid2 = $t035033570._5 | |
175 | + | let waid = $t035033570._6 | |
176 | + | let aids = $t035033570._7 | |
177 | + | let aid2s = $t035033570._8 | |
178 | + | let aid2_decimal = getAssetDecimal(aid2) | |
179 | + | if (if ((i.caller != this)) | |
180 | + | then (i.caller != boss) | |
181 | + | else false) | |
182 | + | then throw("you are not allowed to arb!") | |
183 | + | else { | |
184 | + | let $t037133772 = getBaseBal(aid, aids, aid2, aid2s) | |
185 | + | if (($t037133772 == $t037133772)) | |
186 | + | then { | |
187 | + | let aid2bb = $t037133772._2 | |
188 | + | let aidbb = $t037133772._1 | |
189 | + | let $t037773817 = getPutGet(aids) | |
190 | + | let putFunc = $t037773817._1 | |
191 | + | let getFunc = $t037773817._2 | |
192 | + | let put = invoke(p1, putFunc, [1, false], [AttachedPayment(if ((aid2s == "WAVES")) | |
193 | + | then waid | |
194 | + | else aid2, (amt * aid2_decimal))]) | |
195 | + | if ((put == put)) | |
196 | + | then { | |
197 | + | let lpb = assetBalance(this, lp) | |
198 | + | if ((lpb == lpb)) | |
199 | + | then { | |
200 | + | let get = invoke(p1, getFunc, [aids, 1], [AttachedPayment(lp, lpb)]) | |
201 | + | if ((get == get)) | |
202 | + | then { | |
203 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
204 | + | let swap = invoke(p2, "swap", [aid2s, 1], [AttachedPayment(if ((aids == "WAVES")) | |
205 | + | then waid | |
206 | + | else aid, balToSwap)]) | |
207 | + | if ((swap == swap)) | |
208 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
209 | + | else throw("Strict value is not equal to itself.") | |
210 | + | } | |
211 | + | else throw("Strict value is not equal to itself.") | |
212 | + | } | |
213 | + | else throw("Strict value is not equal to itself.") | |
214 | + | } | |
215 | + | else throw("Strict value is not equal to itself.") | |
216 | + | } | |
217 | + | else throw("Strict value is not equal to itself.") | |
218 | + | } | |
219 | + | } | |
220 | + | ||
221 | + | ||
222 | + | func ps (i,func_name) = { | |
223 | + | let $t043754442 = getBase(func_name) | |
224 | + | let p1 = $t043754442._1 | |
225 | + | let p2 = $t043754442._2 | |
226 | + | let lp = $t043754442._3 | |
227 | + | let aid = $t043754442._4 | |
228 | + | let aid2 = $t043754442._5 | |
229 | + | let waid = $t043754442._6 | |
230 | + | let aids = $t043754442._7 | |
231 | + | let aid2s = $t043754442._8 | |
232 | + | let aid2_decimal = getAssetDecimal(aid2) | |
233 | + | if (if ((i.caller != this)) | |
234 | + | then (i.caller != boss) | |
235 | + | else false) | |
236 | + | then throw("you are not allowed to arb!") | |
237 | + | else { | |
238 | + | let $t045854644 = getBaseBal(aid, aids, aid2, aid2s) | |
239 | + | if (($t045854644 == $t045854644)) | |
240 | + | then { | |
241 | + | let aid2bb = $t045854644._2 | |
242 | + | let aidbb = $t045854644._1 | |
243 | + | let swap = invoke(p1, "swap", [aids, 1], [AttachedPayment(if ((aid2s == "WAVES")) | |
244 | + | then waid | |
245 | + | else aid2, (amt * aid2_decimal))]) | |
246 | + | if ((swap == swap)) | |
247 | + | then { | |
248 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
249 | + | let swap2 = invoke(p2, "exchange", [1], [AttachedPayment(if ((aids == "WAVES")) | |
250 | + | then waid | |
251 | + | else aid, balToSwap)]) | |
252 | + | if ((swap2 == swap2)) | |
253 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
254 | + | else throw("Strict value is not equal to itself.") | |
255 | + | } | |
256 | + | else throw("Strict value is not equal to itself.") | |
257 | + | } | |
258 | + | else throw("Strict value is not equal to itself.") | |
259 | + | } | |
260 | + | } | |
261 | + | ||
262 | + | ||
263 | + | func sp (i,func_name) = { | |
264 | + | let $t050775144 = getBase(func_name) | |
265 | + | let p1 = $t050775144._1 | |
266 | + | let p2 = $t050775144._2 | |
267 | + | let lp = $t050775144._3 | |
268 | + | let aid = $t050775144._4 | |
269 | + | let aid2 = $t050775144._5 | |
270 | + | let waid = $t050775144._6 | |
271 | + | let aids = $t050775144._7 | |
272 | + | let aid2s = $t050775144._8 | |
273 | + | let aid2_decimal = getAssetDecimal(aid2) | |
274 | + | if (if ((i.caller != this)) | |
275 | + | then (i.caller != boss) | |
276 | + | else false) | |
277 | + | then throw("you are not allowed to arb!") | |
278 | + | else { | |
279 | + | let $t052875346 = getBaseBal(aid, aids, aid2, aid2s) | |
280 | + | if (($t052875346 == $t052875346)) | |
281 | + | then { | |
282 | + | let aid2bb = $t052875346._2 | |
283 | + | let aidbb = $t052875346._1 | |
284 | + | let swap = invoke(p1, "exchange", [1], [AttachedPayment(if ((aid2s == "WAVES")) | |
285 | + | then waid | |
286 | + | else aid2, (amt * aid2_decimal))]) | |
287 | + | if ((swap == swap)) | |
288 | + | then { | |
289 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
290 | + | let swap2 = invoke(p2, "swap", [aid2s, 1], [AttachedPayment(if ((aids == "WAVES")) | |
291 | + | then waid | |
292 | + | else aid, balToSwap)]) | |
293 | + | if ((swap2 == swap2)) | |
294 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
295 | + | else throw("Strict value is not equal to itself.") | |
296 | + | } | |
297 | + | else throw("Strict value is not equal to itself.") | |
298 | + | } | |
299 | + | else throw("Strict value is not equal to itself.") | |
300 | + | } | |
301 | + | } | |
302 | + | ||
303 | + | ||
304 | + | func ws (i,func_name) = { | |
305 | + | let $t057765843 = getBase(func_name) | |
306 | + | let p1 = $t057765843._1 | |
307 | + | let p2 = $t057765843._2 | |
308 | + | let lp = $t057765843._3 | |
309 | + | let aid = $t057765843._4 | |
310 | + | let aid2 = $t057765843._5 | |
311 | + | let waid = $t057765843._6 | |
312 | + | let aids = $t057765843._7 | |
313 | + | let aid2s = $t057765843._8 | |
314 | + | let aid2_decimal = getAssetDecimal(aid2) | |
315 | + | if (if ((i.caller != this)) | |
316 | + | then (i.caller != boss) | |
317 | + | else false) | |
318 | + | then throw("you are not allowed to arb!") | |
319 | + | else { | |
320 | + | let $t059866045 = getBaseBal(aid, aids, aid2, aid2s) | |
321 | + | if (($t059866045 == $t059866045)) | |
322 | + | then { | |
323 | + | let aid2bb = $t059866045._2 | |
324 | + | let aidbb = $t059866045._1 | |
325 | + | let $t060506090 = getPutGet(aids) | |
326 | + | let putFunc = $t060506090._1 | |
327 | + | let getFunc = $t060506090._2 | |
328 | + | let put = invoke(p1, putFunc, [1, false], [AttachedPayment(if ((aid2s == "WAVES")) | |
329 | + | then waid | |
330 | + | else aid2, (amt * aid2_decimal))]) | |
331 | + | if ((put == put)) | |
332 | + | then { | |
333 | + | let lpb = assetBalance(this, lp) | |
334 | + | if ((lpb == lpb)) | |
335 | + | then { | |
336 | + | let get = invoke(p1, getFunc, [aids, 1], [AttachedPayment(lp, lpb)]) | |
337 | + | if ((get == get)) | |
338 | + | then { | |
339 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
340 | + | let swap = invoke(p2, "exchange", [1], [AttachedPayment(if ((aids == "WAVES")) | |
341 | + | then waid | |
342 | + | else aid, balToSwap)]) | |
343 | + | if ((swap == swap)) | |
344 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
345 | + | else throw("Strict value is not equal to itself.") | |
346 | + | } | |
347 | + | else throw("Strict value is not equal to itself.") | |
348 | + | } | |
349 | + | else throw("Strict value is not equal to itself.") | |
350 | + | } | |
351 | + | else throw("Strict value is not equal to itself.") | |
352 | + | } | |
353 | + | else throw("Strict value is not equal to itself.") | |
354 | + | } | |
355 | + | } | |
356 | + | ||
357 | + | ||
358 | + | func sw (i,func_name) = { | |
359 | + | let $t066356702 = getBase(func_name) | |
360 | + | let p1 = $t066356702._1 | |
361 | + | let p2 = $t066356702._2 | |
362 | + | let lp = $t066356702._3 | |
363 | + | let aid = $t066356702._4 | |
364 | + | let aid2 = $t066356702._5 | |
365 | + | let waid = $t066356702._6 | |
366 | + | let aids = $t066356702._7 | |
367 | + | let aid2s = $t066356702._8 | |
368 | + | let aid2_decimal = getAssetDecimal(aid2) | |
369 | + | if (if ((i.caller != this)) | |
370 | + | then (i.caller != boss) | |
371 | + | else false) | |
372 | + | then throw("you are not allowed to arb!") | |
373 | + | else { | |
374 | + | let $t068456904 = getBaseBal(aid, aids, aid2, aid2s) | |
375 | + | if (($t068456904 == $t068456904)) | |
376 | + | then { | |
377 | + | let aid2bb = $t068456904._2 | |
378 | + | let aidbb = $t068456904._1 | |
379 | + | let $t069096949 = getPutGet(aids) | |
380 | + | let putFunc = $t069096949._1 | |
381 | + | let getFunc = $t069096949._2 | |
382 | + | let swap = invoke(p1, "exchange", [1], [AttachedPayment(if ((aid2s == "WAVES")) | |
383 | + | then waid | |
384 | + | else aid2, (amt * aid2_decimal))]) | |
385 | + | if ((swap == swap)) | |
386 | + | then { | |
387 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
388 | + | let put = invoke(p2, putFunc, [1, false], [AttachedPayment(if ((aids == "WAVES")) | |
389 | + | then waid | |
390 | + | else aid, balToSwap)]) | |
391 | + | if ((put == put)) | |
392 | + | then { | |
393 | + | let lpb = assetBalance(this, lp) | |
394 | + | if ((lpb == lpb)) | |
395 | + | then { | |
396 | + | let get = invoke(p2, getFunc, [aid2s, 1], [AttachedPayment(lp, lpb)]) | |
397 | + | if ((get == get)) | |
398 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
399 | + | else throw("Strict value is not equal to itself.") | |
400 | + | } | |
401 | + | else throw("Strict value is not equal to itself.") | |
402 | + | } | |
403 | + | else throw("Strict value is not equal to itself.") | |
404 | + | } | |
405 | + | else throw("Strict value is not equal to itself.") | |
406 | + | } | |
407 | + | else throw("Strict value is not equal to itself.") | |
408 | + | } | |
110 | 409 | } | |
111 | 410 | ||
112 | 411 | ||
113 | 412 | @Callable(i) | |
114 | - | func borrow (amnt) = if (if ((i.caller != boss)) | |
115 | - | then (i.caller != free_to_borrom) | |
116 | - | else false) | |
117 | - | then throw("you are not allowed to borrow!") | |
118 | - | else { | |
119 | - | let currentBal = getBalance(USDN_ASSET_ID) | |
120 | - | if ((amnt > currentBal)) | |
121 | - | then throw("You cannnot borrow that much") | |
122 | - | else [ScriptTransfer(i.caller, amnt, USDN_ASSET_ID)] | |
123 | - | } | |
413 | + | func setAmout (a) = if ((i.caller != this)) | |
414 | + | then throw("you are not allowed to set!") | |
415 | + | else [IntegerEntry("montant", a)] | |
124 | 416 | ||
125 | 417 | ||
126 | 418 | ||
127 | 419 | @Callable(i) | |
128 | - | func y (data) = if (if ((i.caller != this)) | |
129 | - | then (i.caller != boss) | |
130 | - | else false) | |
131 | - | then throw("you are not allowed to arb!") | |
132 | - | else { | |
133 | - | let data_array = split_4C(data, "|") | |
134 | - | let $t035473633 = getBase1(data_array[0]) | |
135 | - | let a = $t035473633._1 | |
136 | - | let a2 = $t035473633._2 | |
137 | - | let assetIn = $t035473633._3 | |
138 | - | let amountIn = $t035473633._4 | |
139 | - | let amount_1 = $t035473633._5 | |
140 | - | let amount_2 = $t035473633._6 | |
141 | - | let amount_3 = $t035473633._7 | |
142 | - | let $t036383694 = getBase2(data_array[1]) | |
143 | - | let p1 = $t036383694._1 | |
144 | - | let lp1 = $t036383694._2 | |
145 | - | let is_stable_1 = $t036383694._3 | |
146 | - | let t1 = $t036383694._4 | |
147 | - | let $t036993755 = getBase2(data_array[2]) | |
148 | - | let p2 = $t036993755._1 | |
149 | - | let lp2 = $t036993755._2 | |
150 | - | let is_stable_2 = $t036993755._3 | |
151 | - | let t2 = $t036993755._4 | |
152 | - | let $t037603816 = getBase2(data_array[3]) | |
153 | - | let p3 = $t037603816._1 | |
154 | - | let lp3 = $t037603816._2 | |
155 | - | let is_stable_3 = $t037603816._3 | |
156 | - | let t3 = $t037603816._4 | |
157 | - | let $t038223888 = getPutGet(value(parseInt(is_stable_1))) | |
158 | - | let putFunc1 = $t038223888._1 | |
159 | - | let getFunc1 = $t038223888._2 | |
160 | - | let $t038933959 = getPutGet(value(parseInt(is_stable_2))) | |
161 | - | let putFunc2 = $t038933959._1 | |
162 | - | let getFunc2 = $t038933959._2 | |
163 | - | let $t039644030 = getPutGet(value(parseInt(is_stable_3))) | |
164 | - | let putFunc3 = $t039644030._1 | |
165 | - | let getFunc3 = $t039644030._2 | |
166 | - | let amount_bef_assetIn = getBalance(getAssetBytes(assetIn)) | |
167 | - | if ((amount_bef_assetIn == amount_bef_assetIn)) | |
168 | - | then { | |
169 | - | let new_amountIn = if ((value(parseInt(amountIn)) > amount_bef_assetIn)) | |
170 | - | then amount_bef_assetIn | |
171 | - | else value(parseInt(amountIn)) | |
172 | - | if ((new_amountIn == new_amountIn)) | |
173 | - | then { | |
174 | - | let $t042364370 = if (if ((t1 == "S")) | |
175 | - | then (value(parseInt(is_stable_1)) == 1) | |
176 | - | else false) | |
177 | - | then getMinToReceive(value(parseInt(amount_1)), p1) | |
178 | - | else $Tuple2(0, 0) | |
179 | - | let est_1 = $t042364370._1 | |
180 | - | let min_1 = $t042364370._2 | |
181 | - | let amount_bef_asset1 = getBalance(getAssetBytes(a)) | |
182 | - | if ((amount_bef_asset1 == amount_bef_asset1)) | |
183 | - | then { | |
184 | - | let swap1 = if ((t1 == "W")) | |
185 | - | then swap_wx(p1, lp1, assetIn, new_amountIn, putFunc1, getFunc1, a) | |
186 | - | else if ((t1 == "S")) | |
187 | - | then swap_swop(p1, assetIn, new_amountIn, value(parseInt(is_stable_1)), est_1, min_1) | |
188 | - | else swap_puzzle(p1, assetIn, new_amountIn, a) | |
189 | - | if ((swap1 == swap1)) | |
190 | - | then { | |
191 | - | let nb = (getBalance(getAssetBytes(a)) - amount_bef_asset1) | |
192 | - | if ((nb == nb)) | |
193 | - | then { | |
194 | - | let $t047654899 = if (if ((t2 == "S")) | |
195 | - | then (value(parseInt(is_stable_2)) == 1) | |
196 | - | else false) | |
197 | - | then getMinToReceive(value(parseInt(amount_2)), p2) | |
198 | - | else $Tuple2(0, 0) | |
199 | - | let est_2 = $t047654899._1 | |
200 | - | let min_2 = $t047654899._2 | |
201 | - | let amount_bef_asset2 = getBalance(getAssetBytes(a2)) | |
202 | - | if ((amount_bef_asset2 == amount_bef_asset2)) | |
203 | - | then { | |
204 | - | let swap2 = if ((t2 == "W")) | |
205 | - | then swap_wx(p2, lp2, a, nb, putFunc2, getFunc2, a2) | |
206 | - | else if ((t2 == "S")) | |
207 | - | then swap_swop(p2, a, nb, value(parseInt(is_stable_2)), est_2, min_2) | |
208 | - | else swap_puzzle(p2, a, nb, a2) | |
209 | - | if ((swap2 == swap2)) | |
210 | - | then { | |
211 | - | let nb2 = (getBalance(getAssetBytes(a2)) - amount_bef_asset2) | |
212 | - | if ((nb2 == nb2)) | |
213 | - | then { | |
214 | - | let $t055875721 = if (if ((t3 == "S")) | |
215 | - | then (value(parseInt(is_stable_3)) == 1) | |
216 | - | else false) | |
217 | - | then getMinToReceive(value(parseInt(amount_3)), p3) | |
218 | - | else $Tuple2(0, 0) | |
219 | - | let est_3 = $t055875721._1 | |
220 | - | let min_3 = $t055875721._2 | |
221 | - | let amount_bef_base_asset = getBalance(getAssetBytes(assetIn)) | |
222 | - | if ((amount_bef_base_asset == amount_bef_base_asset)) | |
223 | - | then { | |
224 | - | let swap3 = if ((t3 == "W")) | |
225 | - | then swap_wx(p3, lp3, a2, nb2, putFunc3, getFunc3, assetIn) | |
226 | - | else if ((t3 == "S")) | |
227 | - | then swap_swop(p3, a2, nb2, value(parseInt(is_stable_3)), est_3, min_3) | |
228 | - | else swap_puzzle(p3, a2, nb2, assetIn) | |
229 | - | if ((swap3 == swap3)) | |
230 | - | then { | |
231 | - | let nb3 = (getBalance(getAssetBytes(assetIn)) - amount_bef_base_asset) | |
232 | - | if ((nb3 == nb3)) | |
233 | - | then if ((nb3 > (new_amountIn + 150000))) | |
234 | - | then [ScriptTransfer(i.caller, (nb3 - new_amountIn), getAssetBytes(assetIn))] | |
235 | - | else throw(((((((((("origin amountIn = " + amountIn) + ", new_amountIn = ") + toString(new_amountIn)) + ", newBal_1: ") + toString(nb)) + ", newBal_2: ") + toString(nb2)) + ", newBal_3: ") + toString(nb3))) | |
236 | - | else throw("Strict value is not equal to itself.") | |
237 | - | } | |
238 | - | else throw("Strict value is not equal to itself.") | |
239 | - | } | |
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 | - | else throw("Strict value is not equal to itself.") | |
251 | - | } | |
252 | - | else throw("Strict value is not equal to itself.") | |
253 | - | } | |
254 | - | else throw("Strict value is not equal to itself.") | |
255 | - | } | |
256 | - | else throw("Strict value is not equal to itself.") | |
257 | - | } | |
420 | + | func setKeyValString (key,val) = if ((i.caller != this)) | |
421 | + | then throw("you are not allowed to set!") | |
422 | + | else [StringEntry(key, val)] | |
423 | + | ||
424 | + | ||
425 | + | ||
426 | + | @Callable(i) | |
427 | + | func a (a,t) = if ((t == "pw")) | |
428 | + | then pw(i, a) | |
429 | + | else if ((t == "wp")) | |
430 | + | then wp(i, a) | |
431 | + | else if ((t == "ps")) | |
432 | + | then ps(i, a) | |
433 | + | else if ((t == "sp")) | |
434 | + | then sp(i, a) | |
435 | + | else if ((t == "ws")) | |
436 | + | then ws(i, a) | |
437 | + | else if ((t == "sw")) | |
438 | + | then sw(i, a) | |
439 | + | else throw("Type not found") | |
258 | 440 | ||
259 | 441 | ||
260 | 442 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let boss = addressFromStringValue("3PRE5KH9oPGfFPs7fGnQcJ4wNshEDUPGj1t") | |
5 | 5 | ||
6 | - | let | |
6 | + | let usdtAssetIdString = "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ" | |
7 | 7 | ||
8 | - | let boss = addressFromStringValue("3PRE5KH9oPGfFPs7fGnQcJ4wNshEDUPGj1t") | |
8 | + | let usdcAssetIdString = "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ" | |
9 | + | ||
10 | + | let usdnAssetIdString = "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p" | |
9 | 11 | ||
10 | 12 | let adminPublicKey = base58'Cr1ybL2JGg9GwJHA2JwqxBPfSW6Q7Jg4HvNrsEiCsHu6' | |
11 | 13 | ||
12 | - | func getPutGet (is_stable) = { | |
13 | - | let putFunc = if ((is_stable == 1)) | |
14 | + | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
15 | + | ||
16 | + | ||
17 | + | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 25) | |
18 | + | ||
19 | + | ||
20 | + | let amt = getIntegerByKey("montant") | |
21 | + | ||
22 | + | let decimals_multi = [10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000] | |
23 | + | ||
24 | + | func getBase (func_name) = { | |
25 | + | let data = split(getStringByKey(func_name), "_") | |
26 | + | let p1 = addressFromStringValue(data[0]) | |
27 | + | let p2 = addressFromStringValue(data[1]) | |
28 | + | let lp = fromBase58String(data[2]) | |
29 | + | let aid = fromBase58String(data[3]) | |
30 | + | let aid2 = fromBase58String(data[4]) | |
31 | + | let waid = unit | |
32 | + | let aids = if ((data[3] == "WAVES")) | |
33 | + | then "WAVES" | |
34 | + | else data[3] | |
35 | + | let aid2s = if ((data[4] == "WAVES")) | |
36 | + | then "WAVES" | |
37 | + | else data[4] | |
38 | + | $Tuple8(p1, p2, lp, aid, aid2, waid, aids, aid2s) | |
39 | + | } | |
40 | + | ||
41 | + | ||
42 | + | func getBaseBal (aid,aids,aid2,aid2s) = { | |
43 | + | let aid2bb = if ((aid2s == "WAVES")) | |
44 | + | then wavesBalance(this).available | |
45 | + | else assetBalance(this, aid2) | |
46 | + | if ((aid2bb == aid2bb)) | |
47 | + | then { | |
48 | + | let aidbb = if ((aids == "WAVES")) | |
49 | + | then wavesBalance(this).available | |
50 | + | else assetBalance(this, aid) | |
51 | + | if ((aidbb == aidbb)) | |
52 | + | then $Tuple2(aidbb, aid2bb) | |
53 | + | else throw("Strict value is not equal to itself.") | |
54 | + | } | |
55 | + | else throw("Strict value is not equal to itself.") | |
56 | + | } | |
57 | + | ||
58 | + | ||
59 | + | func getPutGet (aids) = { | |
60 | + | let putFunc = if (if ((usdtAssetIdString == aids)) | |
61 | + | then true | |
62 | + | else (usdcAssetIdString == aids)) | |
14 | 63 | then "putOneTknV2" | |
15 | 64 | else "putOneTkn" | |
16 | - | let getFunc = if ((is_stable == 1)) | |
65 | + | let getFunc = if (if ((usdtAssetIdString == aids)) | |
66 | + | then true | |
67 | + | else (usdcAssetIdString == aids)) | |
17 | 68 | then "getOneTknV2" | |
18 | 69 | else "getOneTkn" | |
19 | 70 | $Tuple2(putFunc, getFunc) | |
20 | 71 | } | |
21 | 72 | ||
22 | 73 | ||
23 | - | func getBalance (assetId) = match assetId { | |
24 | - | case b: ByteVector => | |
25 | - | assetBalance(this, b) | |
26 | - | case _ => | |
27 | - | wavesBalance(this).available | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | func getBase1 (data) = { | |
32 | - | let p_data = split(data, "_") | |
33 | - | let a = p_data[0] | |
34 | - | let a2 = p_data[1] | |
35 | - | let assetIn = p_data[2] | |
36 | - | let amountIn = p_data[3] | |
37 | - | let amount_1 = p_data[4] | |
38 | - | let amount_2 = p_data[5] | |
39 | - | let amount_3 = p_data[6] | |
40 | - | $Tuple7(a, a2, assetIn, amountIn, amount_1, amount_2, amount_3) | |
41 | - | } | |
42 | - | ||
43 | - | ||
44 | - | func getBase2 (data) = { | |
45 | - | let p_data = split(data, "_") | |
46 | - | let p1 = p_data[0] | |
47 | - | let lp1 = p_data[1] | |
48 | - | let is_stable_1 = p_data[2] | |
49 | - | let t = p_data[3] | |
50 | - | $Tuple4(p1, lp1, is_stable_1, t) | |
51 | - | } | |
52 | - | ||
53 | - | ||
54 | - | func getAssetBytes (assetId) = if ((assetId == "WAVES")) | |
55 | - | then unit | |
56 | - | else fromBase58String(assetId) | |
57 | - | ||
58 | - | ||
59 | - | func swap_wx (p,lp,asset,amount,putFunc1,getFunc1,a) = { | |
60 | - | let put1 = invoke(Address(fromBase58String(p)), putFunc1, [1, false], [AttachedPayment(getAssetBytes(asset), amount)]) | |
61 | - | if ((put1 == put1)) | |
74 | + | func finalize (aid2bb,aid2s,aid2,err_str,decimal) = { | |
75 | + | let aid2ba = if ((aid2s == "WAVES")) | |
76 | + | then wavesBalance(this).available | |
77 | + | else assetBalance(this, aid2) | |
78 | + | if ((aid2ba == aid2ba)) | |
62 | 79 | then { | |
63 | - | let lp1_assetid = fromBase58String(lp) | |
64 | - | let lpBalance_1 = getBalance(lp1_assetid) | |
65 | - | if ((lpBalance_1 == lpBalance_1)) | |
66 | - | then { | |
67 | - | let get1 = invoke(Address(fromBase58String(p)), getFunc1, [a, 1], [AttachedPayment(lp1_assetid, lpBalance_1)]) | |
68 | - | if ((get1 == get1)) | |
69 | - | then nil | |
80 | + | let treshold = if ((aid2s == usdnAssetIdString)) | |
81 | + | then 80000 | |
82 | + | else 0 | |
83 | + | if ((treshold >= (aid2ba - aid2bb))) | |
84 | + | then throw(err_str) | |
85 | + | else { | |
86 | + | let amount = (aid2ba - (amt * decimal)) | |
87 | + | if ((amount == amount)) | |
88 | + | then [ScriptTransfer(boss, amount, if ((aid2s == "WAVES")) | |
89 | + | then unit | |
90 | + | else aid2)] | |
70 | 91 | else throw("Strict value is not equal to itself.") | |
71 | 92 | } | |
72 | - | else throw("Strict value is not equal to itself.") | |
73 | 93 | } | |
74 | 94 | else throw("Strict value is not equal to itself.") | |
75 | 95 | } | |
76 | 96 | ||
77 | 97 | ||
78 | - | func swap_swop (p,asset,amount,stable,est,min) = if ((stable == 1)) | |
79 | - | then { | |
80 | - | let swap1 = invoke(Address(fromBase58String(p)), "exchange", [est, min], [AttachedPayment(getAssetBytes(asset), amount)]) | |
81 | - | if ((swap1 == swap1)) | |
82 | - | then nil | |
83 | - | else throw("Strict value is not equal to itself.") | |
84 | - | } | |
85 | - | else { | |
86 | - | let swap2 = invoke(Address(fromBase58String(p)), "exchange", [1], [AttachedPayment(getAssetBytes(asset), amount)]) | |
87 | - | if ((swap2 == swap2)) | |
88 | - | then nil | |
89 | - | else throw("Strict value is not equal to itself.") | |
90 | - | } | |
98 | + | func getBalToSwap (aid_str,aidbb,aid) = if ((aid_str == "WAVES")) | |
99 | + | then (wavesBalance(this).available - aidbb) | |
100 | + | else (assetBalance(this, aid) - aidbb) | |
91 | 101 | ||
92 | 102 | ||
93 | - | func swap_puzzle (p,asset,amount,assetOut) = { | |
94 | - | let swap = invoke(Address(fromBase58String(p)), "swap", [assetOut, 1], [AttachedPayment(getAssetBytes(asset), amount)]) | |
95 | - | if ((swap == swap)) | |
96 | - | then nil | |
97 | - | else throw("Strict value is not equal to itself.") | |
103 | + | func getAssetDecimal (aid) = { | |
104 | + | let x = match assetInfo(aid) { | |
105 | + | case asset: Asset => | |
106 | + | decimals_multi[(asset.decimals - 1)] | |
107 | + | case _ => | |
108 | + | decimals_multi[7] | |
109 | + | } | |
110 | + | x | |
98 | 111 | } | |
99 | 112 | ||
100 | 113 | ||
101 | - | func getIntegerByKey (address,key) = valueOrElse(getInteger(address, key), 0) | |
114 | + | func pw (i,func_name) = { | |
115 | + | let $t026332700 = getBase(func_name) | |
116 | + | let p1 = $t026332700._1 | |
117 | + | let p2 = $t026332700._2 | |
118 | + | let lp = $t026332700._3 | |
119 | + | let aid = $t026332700._4 | |
120 | + | let aid2 = $t026332700._5 | |
121 | + | let waid = $t026332700._6 | |
122 | + | let aids = $t026332700._7 | |
123 | + | let aid2s = $t026332700._8 | |
124 | + | let aid2_decimal = getAssetDecimal(aid2) | |
125 | + | if (if ((i.caller != this)) | |
126 | + | then (i.caller != boss) | |
127 | + | else false) | |
128 | + | then throw("you are not allowed to arb!") | |
129 | + | else { | |
130 | + | let $t028432902 = getBaseBal(aid, aids, aid2, aid2s) | |
131 | + | if (($t028432902 == $t028432902)) | |
132 | + | then { | |
133 | + | let aid2bb = $t028432902._2 | |
134 | + | let aidbb = $t028432902._1 | |
135 | + | let swap = invoke(p1, "swap", [aids, 1], [AttachedPayment(if ((aid2s == "WAVES")) | |
136 | + | then waid | |
137 | + | else aid2, (amt * aid2_decimal))]) | |
138 | + | if ((swap == swap)) | |
139 | + | then { | |
140 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
141 | + | let $t030943134 = getPutGet(aids) | |
142 | + | let putFunc = $t030943134._1 | |
143 | + | let getFunc = $t030943134._2 | |
144 | + | let put = invoke(p2, putFunc, [1, false], [AttachedPayment(if ((aids == "WAVES")) | |
145 | + | then waid | |
146 | + | else aid, balToSwap)]) | |
147 | + | if ((put == put)) | |
148 | + | then { | |
149 | + | let lpb = assetBalance(this, lp) | |
150 | + | if ((lpb == lpb)) | |
151 | + | then { | |
152 | + | let get = invoke(p2, getFunc, [aid2s, 1], [AttachedPayment(lp, lpb)]) | |
153 | + | if ((get == get)) | |
154 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
155 | + | else throw("Strict value is not equal to itself.") | |
156 | + | } | |
157 | + | else throw("Strict value is not equal to itself.") | |
158 | + | } | |
159 | + | else throw("Strict value is not equal to itself.") | |
160 | + | } | |
161 | + | else throw("Strict value is not equal to itself.") | |
162 | + | } | |
163 | + | else throw("Strict value is not equal to itself.") | |
164 | + | } | |
165 | + | } | |
102 | 166 | ||
103 | 167 | ||
104 | - | func getMinToReceive (amountWithoutFee,pool) = { | |
105 | - | let fee = getIntegerByKey(Address(fromBase58String(pool)), "commission") | |
106 | - | let feeScale6 = 1000000 | |
107 | - | let amountWithFee = fraction(amountWithoutFee, (feeScale6 - fee), feeScale6) | |
108 | - | let minToReceiveWithSleepage = (amountWithFee - fraction(amountWithFee, 15000, 1000000)) | |
109 | - | $Tuple2(amountWithFee, minToReceiveWithSleepage) | |
168 | + | func wp (i,func_name) = { | |
169 | + | let $t035033570 = getBase(func_name) | |
170 | + | let p1 = $t035033570._1 | |
171 | + | let p2 = $t035033570._2 | |
172 | + | let lp = $t035033570._3 | |
173 | + | let aid = $t035033570._4 | |
174 | + | let aid2 = $t035033570._5 | |
175 | + | let waid = $t035033570._6 | |
176 | + | let aids = $t035033570._7 | |
177 | + | let aid2s = $t035033570._8 | |
178 | + | let aid2_decimal = getAssetDecimal(aid2) | |
179 | + | if (if ((i.caller != this)) | |
180 | + | then (i.caller != boss) | |
181 | + | else false) | |
182 | + | then throw("you are not allowed to arb!") | |
183 | + | else { | |
184 | + | let $t037133772 = getBaseBal(aid, aids, aid2, aid2s) | |
185 | + | if (($t037133772 == $t037133772)) | |
186 | + | then { | |
187 | + | let aid2bb = $t037133772._2 | |
188 | + | let aidbb = $t037133772._1 | |
189 | + | let $t037773817 = getPutGet(aids) | |
190 | + | let putFunc = $t037773817._1 | |
191 | + | let getFunc = $t037773817._2 | |
192 | + | let put = invoke(p1, putFunc, [1, false], [AttachedPayment(if ((aid2s == "WAVES")) | |
193 | + | then waid | |
194 | + | else aid2, (amt * aid2_decimal))]) | |
195 | + | if ((put == put)) | |
196 | + | then { | |
197 | + | let lpb = assetBalance(this, lp) | |
198 | + | if ((lpb == lpb)) | |
199 | + | then { | |
200 | + | let get = invoke(p1, getFunc, [aids, 1], [AttachedPayment(lp, lpb)]) | |
201 | + | if ((get == get)) | |
202 | + | then { | |
203 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
204 | + | let swap = invoke(p2, "swap", [aid2s, 1], [AttachedPayment(if ((aids == "WAVES")) | |
205 | + | then waid | |
206 | + | else aid, balToSwap)]) | |
207 | + | if ((swap == swap)) | |
208 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
209 | + | else throw("Strict value is not equal to itself.") | |
210 | + | } | |
211 | + | else throw("Strict value is not equal to itself.") | |
212 | + | } | |
213 | + | else throw("Strict value is not equal to itself.") | |
214 | + | } | |
215 | + | else throw("Strict value is not equal to itself.") | |
216 | + | } | |
217 | + | else throw("Strict value is not equal to itself.") | |
218 | + | } | |
219 | + | } | |
220 | + | ||
221 | + | ||
222 | + | func ps (i,func_name) = { | |
223 | + | let $t043754442 = getBase(func_name) | |
224 | + | let p1 = $t043754442._1 | |
225 | + | let p2 = $t043754442._2 | |
226 | + | let lp = $t043754442._3 | |
227 | + | let aid = $t043754442._4 | |
228 | + | let aid2 = $t043754442._5 | |
229 | + | let waid = $t043754442._6 | |
230 | + | let aids = $t043754442._7 | |
231 | + | let aid2s = $t043754442._8 | |
232 | + | let aid2_decimal = getAssetDecimal(aid2) | |
233 | + | if (if ((i.caller != this)) | |
234 | + | then (i.caller != boss) | |
235 | + | else false) | |
236 | + | then throw("you are not allowed to arb!") | |
237 | + | else { | |
238 | + | let $t045854644 = getBaseBal(aid, aids, aid2, aid2s) | |
239 | + | if (($t045854644 == $t045854644)) | |
240 | + | then { | |
241 | + | let aid2bb = $t045854644._2 | |
242 | + | let aidbb = $t045854644._1 | |
243 | + | let swap = invoke(p1, "swap", [aids, 1], [AttachedPayment(if ((aid2s == "WAVES")) | |
244 | + | then waid | |
245 | + | else aid2, (amt * aid2_decimal))]) | |
246 | + | if ((swap == swap)) | |
247 | + | then { | |
248 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
249 | + | let swap2 = invoke(p2, "exchange", [1], [AttachedPayment(if ((aids == "WAVES")) | |
250 | + | then waid | |
251 | + | else aid, balToSwap)]) | |
252 | + | if ((swap2 == swap2)) | |
253 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
254 | + | else throw("Strict value is not equal to itself.") | |
255 | + | } | |
256 | + | else throw("Strict value is not equal to itself.") | |
257 | + | } | |
258 | + | else throw("Strict value is not equal to itself.") | |
259 | + | } | |
260 | + | } | |
261 | + | ||
262 | + | ||
263 | + | func sp (i,func_name) = { | |
264 | + | let $t050775144 = getBase(func_name) | |
265 | + | let p1 = $t050775144._1 | |
266 | + | let p2 = $t050775144._2 | |
267 | + | let lp = $t050775144._3 | |
268 | + | let aid = $t050775144._4 | |
269 | + | let aid2 = $t050775144._5 | |
270 | + | let waid = $t050775144._6 | |
271 | + | let aids = $t050775144._7 | |
272 | + | let aid2s = $t050775144._8 | |
273 | + | let aid2_decimal = getAssetDecimal(aid2) | |
274 | + | if (if ((i.caller != this)) | |
275 | + | then (i.caller != boss) | |
276 | + | else false) | |
277 | + | then throw("you are not allowed to arb!") | |
278 | + | else { | |
279 | + | let $t052875346 = getBaseBal(aid, aids, aid2, aid2s) | |
280 | + | if (($t052875346 == $t052875346)) | |
281 | + | then { | |
282 | + | let aid2bb = $t052875346._2 | |
283 | + | let aidbb = $t052875346._1 | |
284 | + | let swap = invoke(p1, "exchange", [1], [AttachedPayment(if ((aid2s == "WAVES")) | |
285 | + | then waid | |
286 | + | else aid2, (amt * aid2_decimal))]) | |
287 | + | if ((swap == swap)) | |
288 | + | then { | |
289 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
290 | + | let swap2 = invoke(p2, "swap", [aid2s, 1], [AttachedPayment(if ((aids == "WAVES")) | |
291 | + | then waid | |
292 | + | else aid, balToSwap)]) | |
293 | + | if ((swap2 == swap2)) | |
294 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
295 | + | else throw("Strict value is not equal to itself.") | |
296 | + | } | |
297 | + | else throw("Strict value is not equal to itself.") | |
298 | + | } | |
299 | + | else throw("Strict value is not equal to itself.") | |
300 | + | } | |
301 | + | } | |
302 | + | ||
303 | + | ||
304 | + | func ws (i,func_name) = { | |
305 | + | let $t057765843 = getBase(func_name) | |
306 | + | let p1 = $t057765843._1 | |
307 | + | let p2 = $t057765843._2 | |
308 | + | let lp = $t057765843._3 | |
309 | + | let aid = $t057765843._4 | |
310 | + | let aid2 = $t057765843._5 | |
311 | + | let waid = $t057765843._6 | |
312 | + | let aids = $t057765843._7 | |
313 | + | let aid2s = $t057765843._8 | |
314 | + | let aid2_decimal = getAssetDecimal(aid2) | |
315 | + | if (if ((i.caller != this)) | |
316 | + | then (i.caller != boss) | |
317 | + | else false) | |
318 | + | then throw("you are not allowed to arb!") | |
319 | + | else { | |
320 | + | let $t059866045 = getBaseBal(aid, aids, aid2, aid2s) | |
321 | + | if (($t059866045 == $t059866045)) | |
322 | + | then { | |
323 | + | let aid2bb = $t059866045._2 | |
324 | + | let aidbb = $t059866045._1 | |
325 | + | let $t060506090 = getPutGet(aids) | |
326 | + | let putFunc = $t060506090._1 | |
327 | + | let getFunc = $t060506090._2 | |
328 | + | let put = invoke(p1, putFunc, [1, false], [AttachedPayment(if ((aid2s == "WAVES")) | |
329 | + | then waid | |
330 | + | else aid2, (amt * aid2_decimal))]) | |
331 | + | if ((put == put)) | |
332 | + | then { | |
333 | + | let lpb = assetBalance(this, lp) | |
334 | + | if ((lpb == lpb)) | |
335 | + | then { | |
336 | + | let get = invoke(p1, getFunc, [aids, 1], [AttachedPayment(lp, lpb)]) | |
337 | + | if ((get == get)) | |
338 | + | then { | |
339 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
340 | + | let swap = invoke(p2, "exchange", [1], [AttachedPayment(if ((aids == "WAVES")) | |
341 | + | then waid | |
342 | + | else aid, balToSwap)]) | |
343 | + | if ((swap == swap)) | |
344 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
345 | + | else throw("Strict value is not equal to itself.") | |
346 | + | } | |
347 | + | else throw("Strict value is not equal to itself.") | |
348 | + | } | |
349 | + | else throw("Strict value is not equal to itself.") | |
350 | + | } | |
351 | + | else throw("Strict value is not equal to itself.") | |
352 | + | } | |
353 | + | else throw("Strict value is not equal to itself.") | |
354 | + | } | |
355 | + | } | |
356 | + | ||
357 | + | ||
358 | + | func sw (i,func_name) = { | |
359 | + | let $t066356702 = getBase(func_name) | |
360 | + | let p1 = $t066356702._1 | |
361 | + | let p2 = $t066356702._2 | |
362 | + | let lp = $t066356702._3 | |
363 | + | let aid = $t066356702._4 | |
364 | + | let aid2 = $t066356702._5 | |
365 | + | let waid = $t066356702._6 | |
366 | + | let aids = $t066356702._7 | |
367 | + | let aid2s = $t066356702._8 | |
368 | + | let aid2_decimal = getAssetDecimal(aid2) | |
369 | + | if (if ((i.caller != this)) | |
370 | + | then (i.caller != boss) | |
371 | + | else false) | |
372 | + | then throw("you are not allowed to arb!") | |
373 | + | else { | |
374 | + | let $t068456904 = getBaseBal(aid, aids, aid2, aid2s) | |
375 | + | if (($t068456904 == $t068456904)) | |
376 | + | then { | |
377 | + | let aid2bb = $t068456904._2 | |
378 | + | let aidbb = $t068456904._1 | |
379 | + | let $t069096949 = getPutGet(aids) | |
380 | + | let putFunc = $t069096949._1 | |
381 | + | let getFunc = $t069096949._2 | |
382 | + | let swap = invoke(p1, "exchange", [1], [AttachedPayment(if ((aid2s == "WAVES")) | |
383 | + | then waid | |
384 | + | else aid2, (amt * aid2_decimal))]) | |
385 | + | if ((swap == swap)) | |
386 | + | then { | |
387 | + | let balToSwap = getBalToSwap(aids, aidbb, aid) | |
388 | + | let put = invoke(p2, putFunc, [1, false], [AttachedPayment(if ((aids == "WAVES")) | |
389 | + | then waid | |
390 | + | else aid, balToSwap)]) | |
391 | + | if ((put == put)) | |
392 | + | then { | |
393 | + | let lpb = assetBalance(this, lp) | |
394 | + | if ((lpb == lpb)) | |
395 | + | then { | |
396 | + | let get = invoke(p2, getFunc, [aid2s, 1], [AttachedPayment(lp, lpb)]) | |
397 | + | if ((get == get)) | |
398 | + | then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal) | |
399 | + | else throw("Strict value is not equal to itself.") | |
400 | + | } | |
401 | + | else throw("Strict value is not equal to itself.") | |
402 | + | } | |
403 | + | else throw("Strict value is not equal to itself.") | |
404 | + | } | |
405 | + | else throw("Strict value is not equal to itself.") | |
406 | + | } | |
407 | + | else throw("Strict value is not equal to itself.") | |
408 | + | } | |
110 | 409 | } | |
111 | 410 | ||
112 | 411 | ||
113 | 412 | @Callable(i) | |
114 | - | func borrow (amnt) = if (if ((i.caller != boss)) | |
115 | - | then (i.caller != free_to_borrom) | |
116 | - | else false) | |
117 | - | then throw("you are not allowed to borrow!") | |
118 | - | else { | |
119 | - | let currentBal = getBalance(USDN_ASSET_ID) | |
120 | - | if ((amnt > currentBal)) | |
121 | - | then throw("You cannnot borrow that much") | |
122 | - | else [ScriptTransfer(i.caller, amnt, USDN_ASSET_ID)] | |
123 | - | } | |
413 | + | func setAmout (a) = if ((i.caller != this)) | |
414 | + | then throw("you are not allowed to set!") | |
415 | + | else [IntegerEntry("montant", a)] | |
124 | 416 | ||
125 | 417 | ||
126 | 418 | ||
127 | 419 | @Callable(i) | |
128 | - | func y (data) = if (if ((i.caller != this)) | |
129 | - | then (i.caller != boss) | |
130 | - | else false) | |
131 | - | then throw("you are not allowed to arb!") | |
132 | - | else { | |
133 | - | let data_array = split_4C(data, "|") | |
134 | - | let $t035473633 = getBase1(data_array[0]) | |
135 | - | let a = $t035473633._1 | |
136 | - | let a2 = $t035473633._2 | |
137 | - | let assetIn = $t035473633._3 | |
138 | - | let amountIn = $t035473633._4 | |
139 | - | let amount_1 = $t035473633._5 | |
140 | - | let amount_2 = $t035473633._6 | |
141 | - | let amount_3 = $t035473633._7 | |
142 | - | let $t036383694 = getBase2(data_array[1]) | |
143 | - | let p1 = $t036383694._1 | |
144 | - | let lp1 = $t036383694._2 | |
145 | - | let is_stable_1 = $t036383694._3 | |
146 | - | let t1 = $t036383694._4 | |
147 | - | let $t036993755 = getBase2(data_array[2]) | |
148 | - | let p2 = $t036993755._1 | |
149 | - | let lp2 = $t036993755._2 | |
150 | - | let is_stable_2 = $t036993755._3 | |
151 | - | let t2 = $t036993755._4 | |
152 | - | let $t037603816 = getBase2(data_array[3]) | |
153 | - | let p3 = $t037603816._1 | |
154 | - | let lp3 = $t037603816._2 | |
155 | - | let is_stable_3 = $t037603816._3 | |
156 | - | let t3 = $t037603816._4 | |
157 | - | let $t038223888 = getPutGet(value(parseInt(is_stable_1))) | |
158 | - | let putFunc1 = $t038223888._1 | |
159 | - | let getFunc1 = $t038223888._2 | |
160 | - | let $t038933959 = getPutGet(value(parseInt(is_stable_2))) | |
161 | - | let putFunc2 = $t038933959._1 | |
162 | - | let getFunc2 = $t038933959._2 | |
163 | - | let $t039644030 = getPutGet(value(parseInt(is_stable_3))) | |
164 | - | let putFunc3 = $t039644030._1 | |
165 | - | let getFunc3 = $t039644030._2 | |
166 | - | let amount_bef_assetIn = getBalance(getAssetBytes(assetIn)) | |
167 | - | if ((amount_bef_assetIn == amount_bef_assetIn)) | |
168 | - | then { | |
169 | - | let new_amountIn = if ((value(parseInt(amountIn)) > amount_bef_assetIn)) | |
170 | - | then amount_bef_assetIn | |
171 | - | else value(parseInt(amountIn)) | |
172 | - | if ((new_amountIn == new_amountIn)) | |
173 | - | then { | |
174 | - | let $t042364370 = if (if ((t1 == "S")) | |
175 | - | then (value(parseInt(is_stable_1)) == 1) | |
176 | - | else false) | |
177 | - | then getMinToReceive(value(parseInt(amount_1)), p1) | |
178 | - | else $Tuple2(0, 0) | |
179 | - | let est_1 = $t042364370._1 | |
180 | - | let min_1 = $t042364370._2 | |
181 | - | let amount_bef_asset1 = getBalance(getAssetBytes(a)) | |
182 | - | if ((amount_bef_asset1 == amount_bef_asset1)) | |
183 | - | then { | |
184 | - | let swap1 = if ((t1 == "W")) | |
185 | - | then swap_wx(p1, lp1, assetIn, new_amountIn, putFunc1, getFunc1, a) | |
186 | - | else if ((t1 == "S")) | |
187 | - | then swap_swop(p1, assetIn, new_amountIn, value(parseInt(is_stable_1)), est_1, min_1) | |
188 | - | else swap_puzzle(p1, assetIn, new_amountIn, a) | |
189 | - | if ((swap1 == swap1)) | |
190 | - | then { | |
191 | - | let nb = (getBalance(getAssetBytes(a)) - amount_bef_asset1) | |
192 | - | if ((nb == nb)) | |
193 | - | then { | |
194 | - | let $t047654899 = if (if ((t2 == "S")) | |
195 | - | then (value(parseInt(is_stable_2)) == 1) | |
196 | - | else false) | |
197 | - | then getMinToReceive(value(parseInt(amount_2)), p2) | |
198 | - | else $Tuple2(0, 0) | |
199 | - | let est_2 = $t047654899._1 | |
200 | - | let min_2 = $t047654899._2 | |
201 | - | let amount_bef_asset2 = getBalance(getAssetBytes(a2)) | |
202 | - | if ((amount_bef_asset2 == amount_bef_asset2)) | |
203 | - | then { | |
204 | - | let swap2 = if ((t2 == "W")) | |
205 | - | then swap_wx(p2, lp2, a, nb, putFunc2, getFunc2, a2) | |
206 | - | else if ((t2 == "S")) | |
207 | - | then swap_swop(p2, a, nb, value(parseInt(is_stable_2)), est_2, min_2) | |
208 | - | else swap_puzzle(p2, a, nb, a2) | |
209 | - | if ((swap2 == swap2)) | |
210 | - | then { | |
211 | - | let nb2 = (getBalance(getAssetBytes(a2)) - amount_bef_asset2) | |
212 | - | if ((nb2 == nb2)) | |
213 | - | then { | |
214 | - | let $t055875721 = if (if ((t3 == "S")) | |
215 | - | then (value(parseInt(is_stable_3)) == 1) | |
216 | - | else false) | |
217 | - | then getMinToReceive(value(parseInt(amount_3)), p3) | |
218 | - | else $Tuple2(0, 0) | |
219 | - | let est_3 = $t055875721._1 | |
220 | - | let min_3 = $t055875721._2 | |
221 | - | let amount_bef_base_asset = getBalance(getAssetBytes(assetIn)) | |
222 | - | if ((amount_bef_base_asset == amount_bef_base_asset)) | |
223 | - | then { | |
224 | - | let swap3 = if ((t3 == "W")) | |
225 | - | then swap_wx(p3, lp3, a2, nb2, putFunc3, getFunc3, assetIn) | |
226 | - | else if ((t3 == "S")) | |
227 | - | then swap_swop(p3, a2, nb2, value(parseInt(is_stable_3)), est_3, min_3) | |
228 | - | else swap_puzzle(p3, a2, nb2, assetIn) | |
229 | - | if ((swap3 == swap3)) | |
230 | - | then { | |
231 | - | let nb3 = (getBalance(getAssetBytes(assetIn)) - amount_bef_base_asset) | |
232 | - | if ((nb3 == nb3)) | |
233 | - | then if ((nb3 > (new_amountIn + 150000))) | |
234 | - | then [ScriptTransfer(i.caller, (nb3 - new_amountIn), getAssetBytes(assetIn))] | |
235 | - | else throw(((((((((("origin amountIn = " + amountIn) + ", new_amountIn = ") + toString(new_amountIn)) + ", newBal_1: ") + toString(nb)) + ", newBal_2: ") + toString(nb2)) + ", newBal_3: ") + toString(nb3))) | |
236 | - | else throw("Strict value is not equal to itself.") | |
237 | - | } | |
238 | - | else throw("Strict value is not equal to itself.") | |
239 | - | } | |
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 | - | else throw("Strict value is not equal to itself.") | |
251 | - | } | |
252 | - | else throw("Strict value is not equal to itself.") | |
253 | - | } | |
254 | - | else throw("Strict value is not equal to itself.") | |
255 | - | } | |
256 | - | else throw("Strict value is not equal to itself.") | |
257 | - | } | |
420 | + | func setKeyValString (key,val) = if ((i.caller != this)) | |
421 | + | then throw("you are not allowed to set!") | |
422 | + | else [StringEntry(key, val)] | |
423 | + | ||
424 | + | ||
425 | + | ||
426 | + | @Callable(i) | |
427 | + | func a (a,t) = if ((t == "pw")) | |
428 | + | then pw(i, a) | |
429 | + | else if ((t == "wp")) | |
430 | + | then wp(i, a) | |
431 | + | else if ((t == "ps")) | |
432 | + | then ps(i, a) | |
433 | + | else if ((t == "sp")) | |
434 | + | then sp(i, a) | |
435 | + | else if ((t == "ws")) | |
436 | + | then ws(i, a) | |
437 | + | else if ((t == "sw")) | |
438 | + | then sw(i, a) | |
439 | + | else throw("Type not found") | |
258 | 440 | ||
259 | 441 | ||
260 | 442 | @Verifier(tx) | |
261 | 443 | func verify () = if (sigVerify_128Kb(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
262 | 444 | then true | |
263 | 445 | else sigVerify_128Kb(tx.bodyBytes, tx.proofs[0], adminPublicKey) | |
264 | 446 |
github/deemru/w8io/786bc32 66.42 ms ◑