tx · 8ZpwoXb6QNkssXRBiiiQA75wQC6cdwbpRagafWLKgM5e 3N5Z4dAWzfkEp4kNJZKQk6zf3uTVFFz5MFF: -0.01500000 Waves 2024.04.01 18:17 [3043883] smart account 3N5Z4dAWzfkEp4kNJZKQk6zf3uTVFFz5MFF > SELF 0.00000000 Waves
{ "type": 13, "id": "8ZpwoXb6QNkssXRBiiiQA75wQC6cdwbpRagafWLKgM5e", "fee": 1500000, "feeAssetId": null, "timestamp": 1711984692530, "version": 2, "chainId": 84, "sender": "3N5Z4dAWzfkEp4kNJZKQk6zf3uTVFFz5MFF", "senderPublicKey": "8Vp8fmB3ZGVRre7Cw5j9z6qXo3yD8ohPQ6agZ9mtVY5E", "proofs": [ "49P826mheNWpfvUHT6pZHU5RySxJ31Hjd8na4ospZ57HG2b9M4cxShQK71LKCMuNpNNVEFFpbDVoB2DDzFAMgSRZ" ], "script": "base64:BwIxCAISBgoEAQgICBIAEgMKAQgSBAoCCAESAwoBARIFCgMICAgSABIAEgMKAQgSAwoBCDcACVNFUEFSQVRPUgICX18ADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAIS0VZX0lOSVQCBElOSVQACktFWV9QQVVTRUQCBlBBVVNFRAAKS0VZX1BBVVNFUgIGUEFVU0VSAAlLRVlfQ0hBSU4CBUNIQUlOABRLRVlfR0FURVdBWV9DT05UUkFDVAIQR0FURVdBWV9DT05UUkFDVAATS0VZX1NXQVZFU19DT05UUkFDVAIPU1dBVkVTX0NPTlRSQUNUABBLRVlfU1dBVkVTX0FTU0VUAgVBU1NFVAAMS0VZX1JFU0VSVkVTAghSRVNFUlZFUwAMRlVOQ19ERVBPU0lUAgdkZXBvc2l0ABdGVU5DX1JFUVVFU1RfV0lUSERSQVdBTAIRcmVxdWVzdFdpdGhkcmF3YWwAF0ZVTkNfRVhFQ1VURV9XSVRIRFJBV0FMAhFleGVjdXRlV2l0aGRyYXdhbAANRlVOQ19HRVRfUkFURQIH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hdGl2ZSgxMDYyKQEFCG11bHRpc2lnCQC5CQIJAMwIAgUKS0VZX1NUQVRVUwkAzAgCCQClCAEFBHRoaXMJAMwIAgkA2AQBCAUCdHgCaWQFA25pbAUJU0VQQVJBVE9SBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleUiyOMw=", "height": 3043883, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: GiVAXqKK9S95Kuu9jMqqdBeXcL1WCRBLc3Xk6yq5HFuL Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 7 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEPARATOR = "__" | |
5 | + | ||
6 | + | let KEY_MULTISIG = "MULTISIG" | |
7 | + | ||
8 | + | let KEY_STATUS = "STATUS" | |
9 | + | ||
10 | + | let KEY_INIT = "INIT" | |
11 | + | ||
12 | + | let KEY_PAUSED = "PAUSED" | |
13 | + | ||
14 | + | let KEY_PAUSER = "PAUSER" | |
15 | + | ||
16 | + | let KEY_CHAIN = "CHAIN" | |
17 | + | ||
18 | + | let KEY_GATEWAY_CONTRACT = "GATEWAY_CONTRACT" | |
19 | + | ||
20 | + | let KEY_SWAVES_CONTRACT = "SWAVES_CONTRACT" | |
21 | + | ||
22 | + | let KEY_SWAVES_ASSET = "ASSET" | |
23 | + | ||
24 | + | let KEY_RESERVES = "RESERVES" | |
25 | + | ||
26 | + | let FUNC_DEPOSIT = "deposit" | |
27 | + | ||
28 | + | let FUNC_REQUEST_WITHDRAWAL = "requestWithdrawal" | |
29 | + | ||
30 | + | let FUNC_EXECUTE_WITHDRAWAL = "executeWithdrawal" | |
31 | + | ||
32 | + | let FUNC_GET_RATE = "getRate" | |
33 | + | ||
34 | + | let FUNC_WITHDRAW = "withdraw" | |
35 | + | ||
36 | + | let WAVES = "WAVES" | |
37 | + | ||
38 | + | let WAVES_DECIMALS = 8 | |
39 | + | ||
40 | + | let DEX_DECIMALS = 8 | |
41 | + | ||
42 | + | let MAX_INT = 9223372036854775807 | |
43 | + | ||
44 | + | let SWAVES_RATE_FACTOR = toBigInt(1000000000000) | |
45 | + | ||
46 | + | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
47 | + | case a: Address => | |
48 | + | true | |
49 | + | case _ => | |
50 | + | throw(err_) | |
51 | + | } | |
52 | + | ||
53 | + | ||
54 | + | func _validateAsset (assetId_,err_) = if ((assetId_ == WAVES)) | |
55 | + | then true | |
56 | + | else match assetInfo(fromBase58String(assetId_)) { | |
57 | + | case a: Asset => | |
58 | + | true | |
59 | + | case _ => | |
60 | + | throw(err_) | |
61 | + | } | |
62 | + | ||
63 | + | ||
64 | + | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
65 | + | then true | |
66 | + | else (val_ > upperBoundary_)) | |
67 | + | then throw(err_) | |
68 | + | else true | |
69 | + | ||
70 | + | ||
71 | + | func _validateString (val_,err_) = if (if ((0 >= size(val_))) | |
72 | + | then true | |
73 | + | else contains(val_, SEPARATOR)) | |
74 | + | then throw(err_) | |
75 | + | else true | |
76 | + | ||
77 | + | ||
78 | + | func _validatePaymentsSize (payments_,target_,err_) = if ((size(payments_) != target_)) | |
79 | + | then throw(err_) | |
80 | + | else true | |
81 | + | ||
82 | + | ||
83 | + | func _assetToStr (asset_) = match asset_ { | |
84 | + | case a: ByteVector => | |
85 | + | toBase58String(a) | |
86 | + | case _ => | |
87 | + | WAVES | |
88 | + | } | |
89 | + | ||
90 | + | ||
91 | + | func _strToAsset (asset_) = if ((asset_ == WAVES)) | |
92 | + | then unit | |
93 | + | else fromBase58String(asset_) | |
94 | + | ||
95 | + | ||
96 | + | func _getDecimals (assetId_) = if ((assetId_ == WAVES)) | |
97 | + | then WAVES_DECIMALS | |
98 | + | else match assetInfo(fromBase58String(assetId_)) { | |
99 | + | case a: Asset => | |
100 | + | a.decimals | |
101 | + | case _ => | |
102 | + | throw(("_getDecimals: no asset=" + assetId_)) | |
103 | + | } | |
104 | + | ||
105 | + | ||
106 | + | func _normalizeDecimals (amount_,sourceDecimals_,targetDecimals_) = if ((sourceDecimals_ >= targetDecimals_)) | |
107 | + | then (amount_ / pow(10, 0, (sourceDecimals_ - targetDecimals_), 0, 0, DOWN)) | |
108 | + | else (amount_ * pow(10, 0, (targetDecimals_ - sourceDecimals_), 0, 0, DOWN)) | |
109 | + | ||
110 | + | ||
111 | + | func _loadInit () = match getBoolean(KEY_INIT) { | |
112 | + | case a: Boolean => | |
113 | + | a | |
114 | + | case _ => | |
115 | + | false | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
120 | + | ||
121 | + | ||
122 | + | func _loadPause () = match getBoolean(KEY_PAUSED) { | |
123 | + | case a: Boolean => | |
124 | + | a | |
125 | + | case _ => | |
126 | + | false | |
127 | + | } | |
128 | + | ||
129 | + | ||
130 | + | func _savePause (isPaused_) = [BooleanEntry(KEY_PAUSED, isPaused_)] | |
131 | + | ||
132 | + | ||
133 | + | func _loadPauser () = match getString(KEY_PAUSER) { | |
134 | + | case a: String => | |
135 | + | addressFromStringValue(a) | |
136 | + | case _ => | |
137 | + | Address(base58'') | |
138 | + | } | |
139 | + | ||
140 | + | ||
141 | + | func _savePauser (pauser_) = [StringEntry(KEY_PAUSER, toString(pauser_))] | |
142 | + | ||
143 | + | ||
144 | + | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
145 | + | case a: String => | |
146 | + | addressFromStringValue(a) | |
147 | + | case _ => | |
148 | + | Address(base58'') | |
149 | + | } | |
150 | + | ||
151 | + | ||
152 | + | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
153 | + | ||
154 | + | ||
155 | + | func _loadChainId () = match getInteger(KEY_CHAIN) { | |
156 | + | case a: Int => | |
157 | + | a | |
158 | + | case _ => | |
159 | + | 0 | |
160 | + | } | |
161 | + | ||
162 | + | ||
163 | + | func _saveChainId (chainId_) = [IntegerEntry(KEY_CHAIN, chainId_)] | |
164 | + | ||
165 | + | ||
166 | + | func _loadGatewayContract () = match getString(KEY_GATEWAY_CONTRACT) { | |
167 | + | case a: String => | |
168 | + | addressFromStringValue(a) | |
169 | + | case _ => | |
170 | + | Address(base58'') | |
171 | + | } | |
172 | + | ||
173 | + | ||
174 | + | func _saveGatewayContract (gatewayContract_) = [StringEntry(KEY_GATEWAY_CONTRACT, toString(gatewayContract_))] | |
175 | + | ||
176 | + | ||
177 | + | func _loadSWavesContract () = match getString(KEY_SWAVES_CONTRACT) { | |
178 | + | case a: String => | |
179 | + | addressFromStringValue(a) | |
180 | + | case _ => | |
181 | + | Address(base58'') | |
182 | + | } | |
183 | + | ||
184 | + | ||
185 | + | func _saveSWavesContract (sWavesContract_) = [StringEntry(KEY_SWAVES_CONTRACT, toString(sWavesContract_))] | |
186 | + | ||
187 | + | ||
188 | + | func _loadSWavesAsset (contract_) = match getString(contract_, KEY_SWAVES_ASSET) { | |
189 | + | case a: String => | |
190 | + | fromBase58String(a) | |
191 | + | case _ => | |
192 | + | throw("_loadSWavesAsset: revert") | |
193 | + | } | |
194 | + | ||
195 | + | ||
196 | + | func _loadReserves (asset_) = match getInteger(makeString([KEY_RESERVES, asset_], SEPARATOR)) { | |
197 | + | case a: Int => | |
198 | + | a | |
199 | + | case _ => | |
200 | + | 0 | |
201 | + | } | |
202 | + | ||
203 | + | ||
204 | + | func _saveReserves (asset_,reserves_) = [IntegerEntry(makeString([KEY_RESERVES, asset_], SEPARATOR), reserves_)] | |
205 | + | ||
206 | + | ||
207 | + | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
208 | + | then throw("_onlyThisContract: revert") | |
209 | + | else true | |
210 | + | ||
211 | + | ||
212 | + | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
213 | + | then throw("_whenMultisigSet: revert") | |
214 | + | else true | |
215 | + | ||
216 | + | ||
217 | + | func _whenNotInitialized () = if (_loadInit()) | |
218 | + | then throw("_whenNotInitialized: revert") | |
219 | + | else true | |
220 | + | ||
221 | + | ||
222 | + | func _whenInitialized () = if (!(_loadInit())) | |
223 | + | then throw("_whenInitialized: revert") | |
224 | + | else true | |
225 | + | ||
226 | + | ||
227 | + | func _whenNotPaused () = if (_loadPause()) | |
228 | + | then throw("_whenNotPaused: revert") | |
229 | + | else true | |
230 | + | ||
231 | + | ||
232 | + | func _whenPaused () = if (!(_loadPause())) | |
233 | + | then throw("_whenPaused: revert") | |
234 | + | else true | |
235 | + | ||
236 | + | ||
237 | + | func _onlyPauser (caller_) = if ((caller_ != _loadPauser())) | |
238 | + | then throw("_onlyPauser: revert") | |
239 | + | else true | |
240 | + | ||
241 | + | ||
242 | + | func _validateGateway (caller,err_) = if ((_loadGatewayContract() != caller)) | |
243 | + | then throw(err_) | |
244 | + | else true | |
245 | + | ||
246 | + | ||
247 | + | @Callable(i) | |
248 | + | func init (chainId_,pauser_,gatewayContract_,sWavesContract_) = { | |
249 | + | let err = if (if (if (if (if (if (_onlyThisContract(i.caller)) | |
250 | + | then _whenNotInitialized() | |
251 | + | else false) | |
252 | + | then _whenMultisigSet() | |
253 | + | else false) | |
254 | + | then _validateInt(chainId_, 0, MAX_INT, "init: invalid chainId") | |
255 | + | else false) | |
256 | + | then _validateAddress(pauser_, "init: invalid pauser") | |
257 | + | else false) | |
258 | + | then _validateAddress(gatewayContract_, "init: invalid gatewayContract") | |
259 | + | else false) | |
260 | + | then _validateAddress(sWavesContract_, "init: invalid sWavesContract") | |
261 | + | else false | |
262 | + | if ((err == err)) | |
263 | + | then $Tuple2(((((_saveInit(true) ++ _saveChainId(chainId_)) ++ _savePauser(addressFromStringValue(pauser_))) ++ _saveGatewayContract(addressFromStringValue(gatewayContract_))) ++ _saveSWavesContract(addressFromStringValue(sWavesContract_))), unit) | |
264 | + | else throw("Strict value is not equal to itself.") | |
265 | + | } | |
266 | + | ||
267 | + | ||
268 | + | ||
269 | + | @Callable(i) | |
270 | + | func deposit () = { | |
271 | + | let err = if (if (if (_whenInitialized()) | |
272 | + | then _whenNotPaused() | |
273 | + | else false) | |
274 | + | then _validatePaymentsSize(i.payments, 1, "deposit: no payment") | |
275 | + | else false) | |
276 | + | then _validateInt(i.payments[0].amount, 0, MAX_INT, "deposit: negative payment") | |
277 | + | else false | |
278 | + | if ((err == err)) | |
279 | + | then { | |
280 | + | let caller = toString(i.caller) | |
281 | + | let asset = _assetToStr(i.payments[0].assetId) | |
282 | + | let assetDecimals = _getDecimals(asset) | |
283 | + | let amount = _normalizeDecimals(i.payments[0].amount, assetDecimals, DEX_DECIMALS) | |
284 | + | let err1 = _validateInt(amount, 1, MAX_INT, "deposit: invalid payment amount") | |
285 | + | if ((err1 == err1)) | |
286 | + | then { | |
287 | + | let gatewayInvocation = invoke(_loadGatewayContract(), FUNC_DEPOSIT, [toString(this), caller, caller, toString(_loadChainId()), asset, toString(amount)], nil) | |
288 | + | if ((gatewayInvocation == gatewayInvocation)) | |
289 | + | then { | |
290 | + | let stakingInvocation = if ((asset == WAVES)) | |
291 | + | then invoke(_loadSWavesContract(), FUNC_DEPOSIT, nil, [AttachedPayment(unit, i.payments[0].amount)]) | |
292 | + | else unit | |
293 | + | if ((stakingInvocation == stakingInvocation)) | |
294 | + | then $Tuple2(_saveReserves(asset, (_loadReserves(asset) + amount)), unit) | |
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 | + | else throw("Strict value is not equal to itself.") | |
302 | + | } | |
303 | + | ||
304 | + | ||
305 | + | ||
306 | + | @Callable(i) | |
307 | + | func depositTo (to_) = { | |
308 | + | let err = if (if (if (if (_whenInitialized()) | |
309 | + | then _whenNotPaused() | |
310 | + | else false) | |
311 | + | then _validatePaymentsSize(i.payments, 1, "depositTo: no payment") | |
312 | + | else false) | |
313 | + | then _validateInt(i.payments[0].amount, 0, MAX_INT, "depositTo: negative payment") | |
314 | + | else false) | |
315 | + | then _validateString(to_, "depositTo: invalid to") | |
316 | + | else false | |
317 | + | if ((err == err)) | |
318 | + | then { | |
319 | + | let caller = toString(i.caller) | |
320 | + | let asset = _assetToStr(i.payments[0].assetId) | |
321 | + | let assetDecimals = _getDecimals(asset) | |
322 | + | let amount = _normalizeDecimals(i.payments[0].amount, assetDecimals, DEX_DECIMALS) | |
323 | + | let err1 = _validateInt(amount, 1, MAX_INT, "depositTo: invalid payment amount") | |
324 | + | if ((err1 == err1)) | |
325 | + | then { | |
326 | + | let gatewayInvocation = invoke(_loadGatewayContract(), FUNC_DEPOSIT, [toString(this), caller, to_, toString(_loadChainId()), asset, toString(amount)], nil) | |
327 | + | if ((gatewayInvocation == gatewayInvocation)) | |
328 | + | then { | |
329 | + | let stakingInvocation = if ((asset == WAVES)) | |
330 | + | then invoke(_loadSWavesContract(), FUNC_DEPOSIT, nil, [AttachedPayment(unit, i.payments[0].amount)]) | |
331 | + | else unit | |
332 | + | if ((stakingInvocation == stakingInvocation)) | |
333 | + | then $Tuple2(_saveReserves(asset, (_loadReserves(asset) + amount)), unit) | |
334 | + | else throw("Strict value is not equal to itself.") | |
335 | + | } | |
336 | + | else throw("Strict value is not equal to itself.") | |
337 | + | } | |
338 | + | else throw("Strict value is not equal to itself.") | |
339 | + | } | |
340 | + | else throw("Strict value is not equal to itself.") | |
341 | + | } | |
342 | + | ||
343 | + | ||
344 | + | ||
345 | + | @Callable(i) | |
346 | + | func requestWithdrawal (asset_,amount_) = { | |
347 | + | let err = if (if (_whenInitialized()) | |
348 | + | then _validateAsset(asset_, "requestWithdrawal: invalid asset") | |
349 | + | else false) | |
350 | + | then _validateInt(amount_, 0, MAX_INT, "requestWithdrawal: negative amount") | |
351 | + | else false | |
352 | + | if ((err == err)) | |
353 | + | then { | |
354 | + | let caller = toString(i.caller) | |
355 | + | let assetDecimals = _getDecimals(asset_) | |
356 | + | let amount = _normalizeDecimals(amount_, assetDecimals, DEX_DECIMALS) | |
357 | + | let err1 = _validateInt(amount, 1, MAX_INT, "requestWithdrawal: invalid amount") | |
358 | + | if ((err1 == err1)) | |
359 | + | then { | |
360 | + | let requestWithdrawalId = match invoke(_loadGatewayContract(), FUNC_REQUEST_WITHDRAWAL, [toString(this), caller, caller, toString(_loadChainId()), asset_, toString(amount)], nil) { | |
361 | + | case a: Int => | |
362 | + | a | |
363 | + | case _ => | |
364 | + | throw("requestWithdrawal: call reverted from gw") | |
365 | + | } | |
366 | + | if ((requestWithdrawalId == requestWithdrawalId)) | |
367 | + | then $Tuple2(nil, requestWithdrawalId) | |
368 | + | else throw("Strict value is not equal to itself.") | |
369 | + | } | |
370 | + | else throw("Strict value is not equal to itself.") | |
371 | + | } | |
372 | + | else throw("Strict value is not equal to itself.") | |
373 | + | } | |
374 | + | ||
375 | + | ||
376 | + | ||
377 | + | @Callable(i) | |
378 | + | func executeWithdrawal (requestWithdrawalId_) = { | |
379 | + | let err = if (_whenInitialized()) | |
380 | + | then _validateInt(requestWithdrawalId_, 0, MAX_INT, "executeWithdrawal: invalid requestId") | |
381 | + | else false | |
382 | + | if ((err == err)) | |
383 | + | then { | |
384 | + | let gatewayInvocation = reentrantInvoke(_loadGatewayContract(), FUNC_EXECUTE_WITHDRAWAL, [toString(this), toString(_loadChainId()), toString(requestWithdrawalId_)], nil) | |
385 | + | if ((gatewayInvocation == gatewayInvocation)) | |
386 | + | then $Tuple2(nil, unit) | |
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 | + | @Callable(i) | |
395 | + | func withdraw (to_,asset_,amount_) = { | |
396 | + | let amount = valueOrErrorMessage(parseInt(amount_), "withdraw: amount not int") | |
397 | + | let err = if (if (if (if (_whenInitialized()) | |
398 | + | then _validateGateway(i.caller, "withdraw: invalid gateway") | |
399 | + | else false) | |
400 | + | then _validateAddress(to_, "withdraw: invalid address") | |
401 | + | else false) | |
402 | + | then _validateAsset(asset_, "withdraw: invalid asset") | |
403 | + | else false) | |
404 | + | then _validateInt(amount, 0, MAX_INT, "withdraw: negative amount") | |
405 | + | else false | |
406 | + | if ((err == err)) | |
407 | + | then { | |
408 | + | let assetDecimals = _getDecimals(asset_) | |
409 | + | let amountNormalized = _normalizeDecimals(amount, DEX_DECIMALS, assetDecimals) | |
410 | + | let newReserves = (_loadReserves(asset_) - amount) | |
411 | + | let err1 = if (_validateInt(amountNormalized, 1, MAX_INT, "withdraw: invalid amount")) | |
412 | + | then _validateInt(newReserves, 0, MAX_INT, "withdraw: negative newReserves") | |
413 | + | else false | |
414 | + | if ((err1 == err1)) | |
415 | + | then { | |
416 | + | let unstakingInvocation = if ((asset_ == WAVES)) | |
417 | + | then { | |
418 | + | let sWavesContract = _loadSWavesContract() | |
419 | + | let sWavesAsset = _loadSWavesAsset(sWavesContract) | |
420 | + | let invocation = invoke(sWavesContract, FUNC_GET_RATE, nil, nil) | |
421 | + | let rate = match invocation { | |
422 | + | case a: String => | |
423 | + | parseBigIntValue(a) | |
424 | + | case _ => | |
425 | + | throw("withdraw: sWaves getRate() revert") | |
426 | + | } | |
427 | + | let sWavesToWithdraw = toInt(fraction(toBigInt(amountNormalized), SWAVES_RATE_FACTOR, rate, CEILING)) | |
428 | + | invoke(sWavesContract, FUNC_WITHDRAW, nil, [AttachedPayment(sWavesAsset, sWavesToWithdraw)]) | |
429 | + | } | |
430 | + | else unit | |
431 | + | if ((unstakingInvocation == unstakingInvocation)) | |
432 | + | then $Tuple2(([ScriptTransfer(addressFromStringValue(to_), amountNormalized, _strToAsset(asset_))] ++ _saveReserves(asset_, newReserves)), unit) | |
433 | + | else throw("Strict value is not equal to itself.") | |
434 | + | } | |
435 | + | else throw("Strict value is not equal to itself.") | |
436 | + | } | |
437 | + | else throw("Strict value is not equal to itself.") | |
438 | + | } | |
439 | + | ||
440 | + | ||
441 | + | ||
442 | + | @Callable(i) | |
443 | + | func pause () = { | |
444 | + | let err = if (if (_onlyPauser(i.caller)) | |
445 | + | then _whenInitialized() | |
446 | + | else false) | |
447 | + | then _whenNotPaused() | |
448 | + | else false | |
449 | + | if ((err == err)) | |
450 | + | then $Tuple2(_savePause(true), unit) | |
451 | + | else throw("Strict value is not equal to itself.") | |
452 | + | } | |
453 | + | ||
454 | + | ||
455 | + | ||
456 | + | @Callable(i) | |
457 | + | func unpause () = { | |
458 | + | let err = if (if (_onlyPauser(i.caller)) | |
459 | + | then _whenInitialized() | |
460 | + | else false) | |
461 | + | then _whenPaused() | |
462 | + | else false | |
463 | + | if ((err == err)) | |
464 | + | then $Tuple2(_savePause(false), unit) | |
465 | + | else throw("Strict value is not equal to itself.") | |
466 | + | } | |
467 | + | ||
468 | + | ||
469 | + | ||
470 | + | @Callable(i) | |
471 | + | func updatePauser (pauser_) = { | |
472 | + | let err = if (if (_onlyThisContract(i.caller)) | |
473 | + | then _whenInitialized() | |
474 | + | else false) | |
475 | + | then _validateAddress(pauser_, "updatePauser: invalid pauser") | |
476 | + | else false | |
477 | + | if ((err == err)) | |
478 | + | then $Tuple2(_savePauser(addressFromStringValue(pauser_)), unit) | |
479 | + | else throw("Strict value is not equal to itself.") | |
480 | + | } | |
481 | + | ||
482 | + | ||
483 | + | ||
484 | + | @Callable(i) | |
485 | + | func setMultisig (multisig_) = { | |
486 | + | let err = if (_onlyThisContract(i.caller)) | |
487 | + | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
488 | + | else false | |
489 | + | if ((err == err)) | |
490 | + | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
491 | + | else throw("Strict value is not equal to itself.") | |
492 | + | } | |
493 | + | ||
494 | + | ||
495 | + | @Verifier(tx) | |
496 | + | func verify () = match getString(KEY_MULTISIG) { | |
497 | + | case multisig: String => | |
498 | + | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
499 | + | case _ => | |
500 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
501 | + | } | |
502 | + |
github/deemru/w8io/026f985 41.21 ms ◑