tx · 6PpWxbCb128BUze9VbxDAvspGNrFnxBhA61bn4v2mWPp 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL: -0.01000000 Waves 2022.04.24 14:53 [2022553] smart account 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL > SELF 0.00000000 Waves
{ "type": 13, "id": "6PpWxbCb128BUze9VbxDAvspGNrFnxBhA61bn4v2mWPp", "fee": 1000000, "feeAssetId": null, "timestamp": 1650801183088, "version": 2, "chainId": 84, "sender": "3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL", "senderPublicKey": "FuM9F3sAdx6ZQfJfJMCdjC9w4wzTDx6F1KgWCbAM1KRy", "proofs": [ "7obg9ahFdVNtArRa7QaaQ7QGYSUpaLQjuSgiXkPzZxXhnAeWVNcTynY8YmXUF75PGdgfjdqS4Q4Ui3XREG1f2bU" ], "script": "base64:AAIFAAAAAAAAACMIAhIECgIBCBIDCgEBEgMKAQESBAoCAQgSBAoCAQgSAwoBAQAAAAgBAAAABWFzSW50AAAAAQAAAAV2YWx1ZQQAAAAHJG1hdGNoMAUAAAAFdmFsdWUDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAADaW50BQAAAAckbWF0Y2gwBQAAAANpbnQJAAACAAAAAQIAAAANZXhwZWN0ZWQ6IEludAEAAAAEZ2V0SQAAAAEAAAADa2V5CQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQEAAAAId3JpdGVJbnQAAAACAAAAA2tleQAAAAV2YWx1ZQMJAABmAAAAAgAAAAAAAAAAAAUAAAAFdmFsdWUJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAXd3JpdGluZyBuZWdhdGl2ZSB2YWx1ZSAJAAGkAAAAAQUAAAAFdmFsdWUCAAAACSBmb3Iga2V5IAUAAAADa2V5CQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAADa2V5BQAAAAV2YWx1ZQAAAAAEbWFpbgkBAAAAEUBle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GUDCQAAZgAAAAIAAAAAAAAAAAEFAAAAAXYJAAACAAAAAQIAAAABMQkABRQAAAACBQAAAANuaWwJAQAAAAVhc0ludAAAAAEJAAP8AAAABAUAAAAEbWFpbgIAAAAId2l0aGRyYXcJAARMAAAAAgUAAAAPYXNzZXRTdHJpbmdVc2RjCQAETAAAAAIFAAAAAXYFAAAAA25pbAUAAAADbmlsAAAAABxN4qE=", "height": 2022553, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E4TaJiqbzFLuQLU8Wq98L8Ks4AS5Wjb7SDAPKdxajYtu Next: Crb2Sx4M1dQ6zLiZNsVjeEvBJaCZcCkCSWrLNxpKzwZL Full:
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 | let sender = addressFromStringValue("3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL") | |
29 | 29 | ||
30 | 30 | @Callable(i) | |
31 | 31 | func initbal (bal,key) = if ((i.caller != sender)) | |
32 | 32 | then throw("1") | |
33 | 33 | else $Tuple2([writeInt("MyBal", bal), writeInt(key, 0)], unit) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | 37 | @Callable(i) | |
38 | 38 | func byebye (lowm) = { | |
39 | 39 | let available = assetBalance(reserveUsdc, assetId) | |
40 | 40 | if ((lowm > available)) | |
41 | 41 | then throw("1") | |
42 | 42 | else { | |
43 | 43 | let uc = asInt(invoke(reserveUsdc, "userDepositUSD", [toString(this)], nil)) | |
44 | 44 | let v = if ((available > uc)) | |
45 | 45 | then uc | |
46 | 46 | else available | |
47 | 47 | if ((v == 0)) | |
48 | 48 | then throw("2") | |
49 | 49 | else $Tuple2(nil, asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil))) | |
50 | 50 | } | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func goodbye (lowm) = { | |
57 | 57 | let available = assetBalance(reserveUsdc, assetId) | |
58 | 58 | if ((lowm > available)) | |
59 | 59 | then throw("1") | |
60 | 60 | else { | |
61 | 61 | let uc = valueOrElse(getI("MyBal"), 0) | |
62 | 62 | let v = if ((available > uc)) | |
63 | 63 | then uc | |
64 | 64 | else available | |
65 | 65 | if ((v == 0)) | |
66 | 66 | then throw("2") | |
67 | 67 | else $Tuple2([writeInt("MyBal", (uc - v))], asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil))) | |
68 | 68 | } | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | @Callable(i) | |
74 | 74 | func kissmegoodbye (limitd,key) = { | |
75 | 75 | let available = assetBalance(reserveUsdc, assetId) | |
76 | 76 | if ((limitd > available)) | |
77 | 77 | then throw("1") | |
78 | 78 | else { | |
79 | 79 | let flag = valueOrElse(getI(key), 0) | |
80 | 80 | if ((flag == 1)) | |
81 | 81 | then throw("2") | |
82 | 82 | else $Tuple2([writeInt(key, 1)], asInt(invoke(main, "withdraw", [assetStringUsdc, limitd], nil))) | |
83 | 83 | } | |
84 | 84 | } | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | ||
88 | 88 | @Callable(i) | |
89 | 89 | func testkiss (limitd,key) = { | |
90 | 90 | let available = 1000000000 | |
91 | 91 | if ((limitd > available)) | |
92 | 92 | then throw("1") | |
93 | 93 | else { | |
94 | 94 | let flag = valueOrElse(getI(key), 0) | |
95 | 95 | if ((flag == 1)) | |
96 | 96 | then throw("2") | |
97 | 97 | else $Tuple2([writeInt(key, 1), writeInt("MyBal", (flag + 1))], limitd) | |
98 | 98 | } | |
99 | 99 | } | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | 103 | @Callable(i) | |
104 | 104 | func bb1 (lowm) = { | |
105 | 105 | let available = assetBalance(reserveUsdc, assetId) | |
106 | 106 | let uc = asInt(invoke(reserveUsdc, "userDepositUSD", [toString(this)], nil)) | |
107 | 107 | let v = if ((available > uc)) | |
108 | 108 | then uc | |
109 | 109 | else available | |
110 | 110 | if ((1 > v)) | |
111 | 111 | then throw("1") | |
112 | 112 | else $Tuple2(nil, asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil))) | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 |
github/deemru/w8io/026f985 33.47 ms ◑