tx · 8AbjGkMT3aGBy3fykVjNmDr2uceHNgPxcw718pSpSUMw 3MuLm2aryXqGdLMfJ8EaiJm4fJKE9cPNo9j: -0.01400000 Waves 2021.02.01 15:49 [1379122] smart account 3MuLm2aryXqGdLMfJ8EaiJm4fJKE9cPNo9j > SELF 0.00000000 Waves
{ "type": 13, "id": "8AbjGkMT3aGBy3fykVjNmDr2uceHNgPxcw718pSpSUMw", "fee": 1400000, "feeAssetId": null, "timestamp": 1612183793431, "version": 2, "chainId": 84, "sender": "3MuLm2aryXqGdLMfJ8EaiJm4fJKE9cPNo9j", "senderPublicKey": "6dYGFWDpwyYTmng6PpHaJacEwPbHGUgJYqKfFLajJmYu", "proofs": [ "3JH1A2DydUhbnckLijAepg5U9Mka9cTLNt36UK8A4y1hRJKcJ5SubbfEvaj8zwBqHTEcPXH5gjh3XFdNfyC5smZi" ], "script": "base64:AAIEAAAAAAAAAAsIAhIDCgEBEgASAAAAAAMBAAAACGdldFByaWNlAAAAAAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAAAxXYXZlc1BlckJ0ZmMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAgEAAAAKYWNjZXB0QnRmYwAAAAIAAAADc3VtAAAAAWUDCQEAAAACIT0AAAACCAUAAAABZQAAAAdhc3NldElkAQAAACAVFYKGWi06B6BeyVk22H0zzyGZ+Y7DmBuJ2ZJxUy/RIwkAAAIAAAABAgAAACRXQVZFUzwtPkJURkMgU3dhcCBhY2NlcHRzIG9ubHkgV0FWRVMJAABkAAAAAgUAAAADc3VtCAUAAAABZQAAAAZhbW91bnQBAAAAC2FjY2VwdFdhdmVzAAAAAgAAAANzdW0AAAABZQMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAABZQAAAAdhc3NldElkCQAAAgAAAAECAAAAI0JURkM8LT5XQVZFUyBTd2FwIGFjY2VwdHMgb25seSBCVEZDCQA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AAAZjYWxsZXIAAAAFYnl0ZXMJAABpAAAAAgUAAAADc3VtCQEAAAAIZ2V0UHJpY2UAAAAAAQAAACAVFYKGWi06B6BeyVk22H0zzyGZ+Y7DmBuJ2ZJxUy/RIwUAAAADbmlsAAAAAIB+XbI=", "height": 1379122, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: JC5CEMjSoU6QAsNtixzvuPZEuA6nDciduHV3x5TGHpVZ Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getPrice () = match getInteger(this, "WavesPerBtfc") { | |
5 | + | case a: Int => | |
6 | + | a | |
7 | + | case _ => | |
8 | + | 2 | |
9 | + | } | |
10 | + | ||
11 | + | ||
12 | + | func acceptBtfc (sum,e) = if ((e.assetId != base58'2RJawE14PWhu2XYg1zsmDM46K595DdA2QQHXg9avsrTU')) | |
13 | + | then throw("WAVES<->BTFC Swap accepts only WAVES") | |
14 | + | else (sum + e.amount) | |
15 | + | ||
16 | + | ||
17 | + | func acceptWaves (sum,e) = if (isDefined(e.assetId)) | |
18 | + | then throw("BTFC<->WAVES Swap accepts only BTFC") | |
19 | + | else (sum + e.amount) | |
20 | + | ||
21 | + | ||
22 | + | @Callable(i) | |
23 | + | func setPrice (price) = if ((Address(i.caller.bytes) != this)) | |
24 | + | then throw("Non-administrators cannot set price") | |
25 | + | else [IntegerEntry("WavesPerBtfc", price)] | |
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | @Callable(i) | |
30 | + | func FromBtfcToWaves () = { | |
31 | + | let sum = { | |
32 | + | let $list765799 = i.payments | |
33 | + | let $size765799 = size($list765799) | |
34 | + | let $acc0765799 = 0 | |
35 | + | if (($size765799 == 0)) | |
36 | + | then $acc0765799 | |
37 | + | else { | |
38 | + | let $acc1765799 = acceptBtfc($acc0765799, $list765799[0]) | |
39 | + | if (($size765799 == 1)) | |
40 | + | then $acc1765799 | |
41 | + | else { | |
42 | + | let $acc2765799 = acceptBtfc($acc1765799, $list765799[1]) | |
43 | + | if (($size765799 == 2)) | |
44 | + | then $acc2765799 | |
45 | + | else { | |
46 | + | let $acc3765799 = acceptBtfc($acc2765799, $list765799[2]) | |
47 | + | throw("List size exceed 2") | |
48 | + | } | |
49 | + | } | |
50 | + | } | |
51 | + | } | |
52 | + | [ScriptTransfer(Address(i.caller.bytes), (sum * getPrice()), Unit())] | |
53 | + | } | |
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | @Callable(i) | |
58 | + | func FromWavesToBtfc () = { | |
59 | + | let sum = { | |
60 | + | let $list924959 = i.payments | |
61 | + | let $size924959 = size($list924959) | |
62 | + | let $acc0924959 = 0 | |
63 | + | if (($size924959 == 0)) | |
64 | + | then $acc0924959 | |
65 | + | else { | |
66 | + | let $acc1924959 = acceptWaves($acc0924959, $list924959[0]) | |
67 | + | if (($size924959 == 1)) | |
68 | + | then $acc1924959 | |
69 | + | else { | |
70 | + | let $acc2924959 = acceptWaves($acc1924959, $list924959[1]) | |
71 | + | if (($size924959 == 2)) | |
72 | + | then $acc2924959 | |
73 | + | else { | |
74 | + | let $acc3924959 = acceptWaves($acc2924959, $list924959[2]) | |
75 | + | throw("List size exceed 2") | |
76 | + | } | |
77 | + | } | |
78 | + | } | |
79 | + | } | |
80 | + | [ScriptTransfer(Address(i.caller.bytes), (sum / getPrice()), base58'2RJawE14PWhu2XYg1zsmDM46K595DdA2QQHXg9avsrTU')] | |
81 | + | } | |
82 | + | ||
83 | + |
github/deemru/w8io/169f3d6 17.32 ms ◑