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