tx · 9ABMTRP1HPMDzPZ3Cwpkvv2osy3AqKV6ZAMqcVp3jipL 3NCdyrMGZ5jfKPu79jjNiUejWRdQtEwKduD: -0.10000000 Waves 2021.02.01 15:25 [1379096] smart account 3NCdyrMGZ5jfKPu79jjNiUejWRdQtEwKduD > SELF 0.00000000 Waves
{ "type": 13, "id": "9ABMTRP1HPMDzPZ3Cwpkvv2osy3AqKV6ZAMqcVp3jipL", "fee": 10000000, "feeAssetId": null, "timestamp": 1612182377300, "version": 2, "chainId": 84, "sender": "3NCdyrMGZ5jfKPu79jjNiUejWRdQtEwKduD", "senderPublicKey": "GHCcpQWhq3KPA8MHcLKffvcHoJFXk6bdo67cHXjbpKy1", "proofs": [ "xwAPRpgcvgJDFZ6WkEeGUc12YSuz24fM2qZ9Lb6aWgP6dWGbRqn6kqaFq13bP1GHhhrVVT6YpJs7jKBTnm39naU" ], "script": "base64:AAIEAAAAAAAAAAYIAhIAEgAAAAADAQAAAAphY2NlcHRCdGZjAAAAAgAAAANzdW0AAAABZQMJAQAAAAIhPQAAAAIIBQAAAAFlAAAAB2Fzc2V0SWQBAAAAIBUVgoZaLToHoF7JWTbYfTPPIZn5jsOYG4nZknFTL9EjCQAAAgAAAAECAAAAJFdBVkVTPC0+QlRGQyBTd2FwIGFjY2VwdHMgb25seSBXQVZFUwkAAGQAAAACBQAAAANzdW0IBQAAAAFlAAAABmFtb3VudAEAAAALYWNjZXB0V2F2ZXMAAAACAAAAA3N1bQAAAAFlAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAFlAAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAjQlRGQzwtPldBVkVTIFN3YXAgYWNjZXB0cyBvbmx5IEJURkMJAABkAAAAAgUAAAADc3VtCAUAAAABZQAAAAZhbW91bnQAAAAADFdhdmVzUGVyQnRmYwAAAAAAAAAAAgAAAAIAAAABaQEAAAAPRnJvbUJ0ZmNUb1dhdmVzAAAAAAQAAAADc3VtBAAAAAskbGlzdDUwNTUzOQgF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AAAAskc2l6ZTY3NDcwOQAAAAAAAAAAAAUAAAALJGFjYzA2NzQ3MDkEAAAACyRhY2MxNjc0NzA5CQEAAAALYWNjZXB0V2F2ZXMAAAACBQAAAAskYWNjMDY3NDcwOQkAAZEAAAACBQAAAAskbGlzdDY3NDcwOQAAAAAAAAAAAAMJAAAAAAAAAgUAAAALJHNpemU2NzQ3MDkAAAAAAAAAAAEFAAAACyRhY2MxNjc0NzA5BAAAAAskYWNjMjY3NDcwOQkBAAAAC2FjY2VwdFdhdmVzAAAAAgUAAAALJGFjYzE2NzQ3MDkJAAGRAAAAAgUAAAALJGxpc3Q2NzQ3MDkAAAAAAAAAAAEDCQAAAAAAAAIFAAAACyRzaXplNjc0NzA5AAAAAAAAAAACBQAAAAskYWNjMjY3NDcwOQQAAAALJGFjYzM2NzQ3MDkJAQAAAAthY2NlcHRXYXZlcwAAAAIFAAAACyRhY2MyNjc0NzA5CQABkQAAAAIFAAAACyRsaXN0Njc0NzA5AAAAAAAAAAACCQAAAgAAAAECAAAAEkxpc3Qgc2l6ZSBleGNlZWQgMgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAHQWRkcmVzcwAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMJAABpAAAAAgUAAAADc3VtBQAAAAxXYXZlc1BlckJ0ZmMJAQAAAARVbml0AAAAAAUAAAADbmlsAAAAADLI4Jc=", "height": 1379096, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9yqZD7WnMwD5vhdrApMGf9YejRs7L5CHnLs9RJVPArAM Next: Co2fRZ6kWXBRQ3LLkf1M6JwCjj2Cv9QVKSjzqN2E5dbt Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func acceptBtfc (sum,e) = if ( | |
5 | - | then throw(" | |
4 | + | func acceptBtfc (sum,e) = if ((e.assetId != base58'2RJawE14PWhu2XYg1zsmDM46K595DdA2QQHXg9avsrTU')) | |
5 | + | then throw("WAVES<->BTFC Swap accepts only WAVES") | |
6 | 6 | else (sum + e.amount) | |
7 | 7 | ||
8 | 8 | ||
9 | - | func acceptWaves (sum,e) = if ((e.assetId | |
10 | - | then throw(" | |
9 | + | func acceptWaves (sum,e) = if (isDefined(e.assetId)) | |
10 | + | then throw("BTFC<->WAVES Swap accepts only BTFC") | |
11 | 11 | else (sum + e.amount) | |
12 | 12 | ||
13 | 13 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func acceptBtfc (sum,e) = if ( | |
5 | - | then throw(" | |
4 | + | func acceptBtfc (sum,e) = if ((e.assetId != base58'2RJawE14PWhu2XYg1zsmDM46K595DdA2QQHXg9avsrTU')) | |
5 | + | then throw("WAVES<->BTFC Swap accepts only WAVES") | |
6 | 6 | else (sum + e.amount) | |
7 | 7 | ||
8 | 8 | ||
9 | - | func acceptWaves (sum,e) = if ((e.assetId | |
10 | - | then throw(" | |
9 | + | func acceptWaves (sum,e) = if (isDefined(e.assetId)) | |
10 | + | then throw("BTFC<->WAVES Swap accepts only BTFC") | |
11 | 11 | else (sum + e.amount) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | let WavesPerBtfc = 2 | |
15 | 15 | ||
16 | 16 | @Callable(i) | |
17 | 17 | func FromBtfcToWaves () = { | |
18 | 18 | let sum = { | |
19 | 19 | let $list505539 = i.payments | |
20 | 20 | let $size505539 = size($list505539) | |
21 | 21 | let $acc0505539 = 0 | |
22 | 22 | if (($size505539 == 0)) | |
23 | 23 | then $acc0505539 | |
24 | 24 | else { | |
25 | 25 | let $acc1505539 = acceptBtfc($acc0505539, $list505539[0]) | |
26 | 26 | if (($size505539 == 1)) | |
27 | 27 | then $acc1505539 | |
28 | 28 | else { | |
29 | 29 | let $acc2505539 = acceptBtfc($acc1505539, $list505539[1]) | |
30 | 30 | if (($size505539 == 2)) | |
31 | 31 | then $acc2505539 | |
32 | 32 | else { | |
33 | 33 | let $acc3505539 = acceptBtfc($acc2505539, $list505539[2]) | |
34 | 34 | throw("List size exceed 2") | |
35 | 35 | } | |
36 | 36 | } | |
37 | 37 | } | |
38 | 38 | } | |
39 | 39 | [ScriptTransfer(Address(i.caller.bytes), (sum * WavesPerBtfc), Unit())] | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | @Callable(i) | |
45 | 45 | func FromWavesToBtfc () = { | |
46 | 46 | let sum = { | |
47 | 47 | let $list674709 = i.payments | |
48 | 48 | let $size674709 = size($list674709) | |
49 | 49 | let $acc0674709 = 0 | |
50 | 50 | if (($size674709 == 0)) | |
51 | 51 | then $acc0674709 | |
52 | 52 | else { | |
53 | 53 | let $acc1674709 = acceptWaves($acc0674709, $list674709[0]) | |
54 | 54 | if (($size674709 == 1)) | |
55 | 55 | then $acc1674709 | |
56 | 56 | else { | |
57 | 57 | let $acc2674709 = acceptWaves($acc1674709, $list674709[1]) | |
58 | 58 | if (($size674709 == 2)) | |
59 | 59 | then $acc2674709 | |
60 | 60 | else { | |
61 | 61 | let $acc3674709 = acceptWaves($acc2674709, $list674709[2]) | |
62 | 62 | throw("List size exceed 2") | |
63 | 63 | } | |
64 | 64 | } | |
65 | 65 | } | |
66 | 66 | } | |
67 | 67 | [ScriptTransfer(Address(i.caller.bytes), (sum / WavesPerBtfc), Unit())] | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 |
github/deemru/w8io/169f3d6 41.14 ms ◑