tx · 7KQLpMahWng2xtpXT1LYgYZb3BWBtQ7J9Y6r7qAVrwWp 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL: -0.01000000 Waves 2022.04.24 14:15 [2022513] smart account 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL > SELF 0.00000000 Waves
{ "type": 13, "id": "7KQLpMahWng2xtpXT1LYgYZb3BWBtQ7J9Y6r7qAVrwWp", "fee": 1000000, "feeAssetId": null, "timestamp": 1650799022968, "version": 2, "chainId": 84, "sender": "3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL", "senderPublicKey": "FuM9F3sAdx6ZQfJfJMCdjC9w4wzTDx6F1KgWCbAM1KRy", "proofs": [ "4VJMEesuAHH9rtMxQPYg3QFMr41mkwvKfzdqAPTD991mh7P1twYxNzkeT4wGYNpXXHTshS9f7GvckxnNnMky5KeW" ], "script": "base64:AAIFAAAAAAAAACMIAhIECgIBCBIDCgEBEgMKAQESBAoCAQgSBAoCAQgSAwoBAQAAAAcBAAAABWFzSW50AAAAAQAAAAV2YWx1ZQQAAAAHJG1hdGNoMAUAAAAFdmFsdWUDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAADaW50BQAAAAckbWF0Y2gwBQAAAANpbnQJAAACAAAAAQIAAAANZXhwZWN0ZWQ6IEludAEAAAAEZ2V0SQAAAAEAAAADa2V5CQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQEAAAAId3JpdGVJbnQAAAACAAAAA2tleQAAAAV2YWx1ZQMJAABmAAAAAgAAAAAAAAAAAAUAAAAFdmFsdWUJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAXd3JpdGluZyBuZWdhdGl2ZSB2YWx1ZSAJAAGkAAAAAQUAAAAFdmFsdWUCAAAACSBmb3Iga2V5IAUAAAADa2V5CQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAADa2V5BQAAAAV2YWx1ZQAAAAAEbWFpbgkBAAA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JAARMAAAAAgUAAAABdgUAAAADbmlsBQAAAANuaWwAAAAAbcSZdg==", "height": 2022513, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2iWvKK2fE6JTabQkUfCnnSz3mQEXwZZvKiV6fbsmGBHE Next: E4TaJiqbzFLuQLU8Wq98L8Ks4AS5Wjb7SDAPKdxajYtu Diff:
Old | New | Differences | |
---|---|---|---|
90 | 90 | let flag = valueOrElse(getI(key), 0) | |
91 | 91 | if ((flag == 1)) | |
92 | 92 | then throw("2") | |
93 | - | else $Tuple2([writeInt(key, 1)], limitd) | |
93 | + | else $Tuple2([writeInt(key, 1), writeInt("MyBal", (flag + 1))], limitd) | |
94 | 94 | } | |
95 | 95 | } | |
96 | 96 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func asInt (value) = match value { | |
5 | 5 | case int: Int => | |
6 | 6 | int | |
7 | 7 | case _ => | |
8 | 8 | throw("expected: Int") | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getI (key) = getInteger(this, key) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func writeInt (key,value) = if ((0 > value)) | |
16 | 16 | then throw(((("writing negative value " + toString(value)) + " for key ") + key)) | |
17 | 17 | else IntegerEntry(key, value) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | let main = addressFromStringValue("3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT") | |
21 | 21 | ||
22 | 22 | let assetStringUsdc = "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ" | |
23 | 23 | ||
24 | 24 | let reserveUsdc = addressFromStringValue("3PGCkrHBxFMi7tz1xqnxgBpeNvn5E4M4g8S") | |
25 | 25 | ||
26 | 26 | let assetId = fromBase58String(assetStringUsdc) | |
27 | 27 | ||
28 | 28 | @Callable(i) | |
29 | 29 | func initbal (bal,key) = $Tuple2([writeInt("MyBal", bal), writeInt(key, 0)], unit) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(i) | |
34 | 34 | func byebye (lowm) = { | |
35 | 35 | let available = assetBalance(reserveUsdc, assetId) | |
36 | 36 | if ((lowm > available)) | |
37 | 37 | then throw("1") | |
38 | 38 | else { | |
39 | 39 | let uc = asInt(invoke(reserveUsdc, "userDepositUSD", [toString(this)], nil)) | |
40 | 40 | let v = if ((available > uc)) | |
41 | 41 | then uc | |
42 | 42 | else available | |
43 | 43 | if ((v == 0)) | |
44 | 44 | then throw("2") | |
45 | 45 | else $Tuple2(nil, asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil))) | |
46 | 46 | } | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | @Callable(i) | |
52 | 52 | func goodbye (lowm) = { | |
53 | 53 | let available = assetBalance(reserveUsdc, assetId) | |
54 | 54 | if ((lowm > available)) | |
55 | 55 | then throw("1") | |
56 | 56 | else { | |
57 | 57 | let uc = valueOrElse(getI("MyBal"), 0) | |
58 | 58 | let v = if ((available > uc)) | |
59 | 59 | then uc | |
60 | 60 | else available | |
61 | 61 | if ((v == 0)) | |
62 | 62 | then throw("2") | |
63 | 63 | else $Tuple2([writeInt("MyBal", (uc - v))], asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil))) | |
64 | 64 | } | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func kissmegoodbye (limitd,key) = { | |
71 | 71 | let available = assetBalance(reserveUsdc, assetId) | |
72 | 72 | if ((limitd > available)) | |
73 | 73 | then throw("1") | |
74 | 74 | else { | |
75 | 75 | let flag = valueOrElse(getI(key), 0) | |
76 | 76 | if ((flag == 1)) | |
77 | 77 | then throw("2") | |
78 | 78 | else $Tuple2([writeInt(key, 1)], asInt(invoke(main, "withdraw", [assetStringUsdc, limitd], nil))) | |
79 | 79 | } | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | ||
84 | 84 | @Callable(i) | |
85 | 85 | func testkiss (limitd,key) = { | |
86 | 86 | let available = 1000000000 | |
87 | 87 | if ((limitd > available)) | |
88 | 88 | then throw("1") | |
89 | 89 | else { | |
90 | 90 | let flag = valueOrElse(getI(key), 0) | |
91 | 91 | if ((flag == 1)) | |
92 | 92 | then throw("2") | |
93 | - | else $Tuple2([writeInt(key, 1)], limitd) | |
93 | + | else $Tuple2([writeInt(key, 1), writeInt("MyBal", (flag + 1))], limitd) | |
94 | 94 | } | |
95 | 95 | } | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Callable(i) | |
100 | 100 | func bb1 (lowm) = { | |
101 | 101 | let available = assetBalance(reserveUsdc, assetId) | |
102 | 102 | let uc = asInt(invoke(reserveUsdc, "userDepositUSD", [toString(this)], nil)) | |
103 | 103 | let v = if ((available > uc)) | |
104 | 104 | then uc | |
105 | 105 | else available | |
106 | 106 | if ((1 > v)) | |
107 | 107 | then throw("1") | |
108 | 108 | else $Tuple2(nil, asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil))) | |
109 | 109 | } | |
110 | 110 | ||
111 | 111 |
github/deemru/w8io/026f985 58.05 ms ◑