tx · 3QC6LXWqgbeGjsau8BkuVdzwmPJ68uZNMKKXXT53qeim 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx: -0.01000000 Waves 2023.02.17 10:12 [2453296] smart account 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx > SELF 0.00000000 Waves
{ "type": 13, "id": "3QC6LXWqgbeGjsau8BkuVdzwmPJ68uZNMKKXXT53qeim", "fee": 1000000, "feeAssetId": null, "timestamp": 1676617989215, "version": 2, "chainId": 84, "sender": "3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx", "senderPublicKey": "D35PGQCSSdrp9pvujggj7b2DaCK1BhcU3kho7tikKJYs", "proofs": [ "5TH8m2PYWYbsDUNRUKRdxdT3xpZCtBFBrYGFQstUMPFDWDH9yFz3hirb6mLR6gK2UmQwk2DxEUyyx6ihaHq8F8iT" ], "script": "base64:BgIaCAISABIDCgEBEgQKAhgREgQKAggBEgMKAQgBAAR0VVNEASCrJEpqtkJG69L843mwYbrDrmlXTVJ6ykUcp0AdEbApDgUBaQEHZGVwb3NpdAADCQAAAgkAkAMBCAUBaQhwYXltZW50cwAACQACAQIUUGF5bWVudCBub3QgYXR0YWNoZWQEA3BtdAkAkQMCCQEFdmFsdWUBCAUBaQhwYXltZW50cwAAAwkBAiE9AggFA3BtdAdhc3NldElkBQR0VVNECQACAQIXaG9sZGVkIHBheW1lbnQgbm90IHRVU0QDCQBmAgDoBwgFA3BtdAZhbW91bnQJAAIBAhdob2xkZWQgcGF5bWVudCBub3QgdFVTRAQKY3VycmVudEtleQkA2AQBCAgFAWkGY2FsbGVyBWJ5dGVzBA1jdXJyZW50QW1vdW50BAckbWF0Y2gwCQCaCAIFBHRoaXMFCmN1cnJlbnRLZXkDCQABAgUHJG1hdGNoMAIDSW50BAFhBQckbWF0Y2gwBQFhAAAECW5ld0Ftb3VudAkAZAIFDWN1cnJlbnRBbW91bnQIBQNwbXQGYW1vdW50CQDMCAIJAQxJbnRlZ2V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wgCQACAQIQVW5zZXQgYWRtaW4gbGlzdAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXnhgmej", "height": 2453296, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4q1xdM2iyqiSDxLytspKghbxdJXXWkhaA3hbPT1wRMqD Next: BkiLHpjdec5nztZ8vBr7DMwfHqynV1tyLS8zMM8NkFeC Diff:
Old | New | Differences | |
---|---|---|---|
10 | 10 | let pmt = value(i.payments)[0] | |
11 | 11 | if ((pmt.assetId != tUSD)) | |
12 | 12 | then throw("holded payment not tUSD") | |
13 | - | else { | |
14 | - | let currentKey = toBase58String(i.caller.bytes) | |
15 | - | let currentAmount = match getInteger(this, currentKey) { | |
16 | - | case a: Int => | |
17 | - | a | |
18 | - | case _ => | |
19 | - | 0 | |
20 | - | } | |
21 | - | let newAmount = (currentAmount + pmt.amount) | |
13 | + | else if ((1000 > pmt.amount)) | |
14 | + | then throw("holded payment not tUSD") | |
15 | + | else { | |
16 | + | let currentKey = toBase58String(i.caller.bytes) | |
17 | + | let currentAmount = match getInteger(this, currentKey) { | |
18 | + | case a: Int => | |
19 | + | a | |
20 | + | case _ => | |
21 | + | 0 | |
22 | + | } | |
23 | + | let newAmount = (currentAmount + pmt.amount) | |
22 | 24 | [IntegerEntry(currentKey, newAmount)] | |
23 | - | } | |
25 | + | } | |
24 | 26 | } | |
25 | 27 | ||
26 | 28 | ||
59 | 61 | throw("Match error") | |
60 | 62 | } | |
61 | 63 | func addStringEntry (accum,nextValue) = { | |
62 | - | let $ | |
63 | - | let result = $ | |
64 | - | let j = $ | |
64 | + | let $t027042727 = accum | |
65 | + | let result = $t027042727._1 | |
66 | + | let j = $t027042727._2 | |
65 | 67 | $Tuple2((result :+ IntegerEntry(opts[j], nextValue)), (j + 1)) | |
66 | 68 | } | |
67 | 69 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let tUSD = base58'CX4p6XcuSBUvv44r1avCqYka5PYAVzBK5hSXaT7maU85' | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func deposit () = if ((size(i.payments) == 0)) | |
8 | 8 | then throw("Payment not attached") | |
9 | 9 | else { | |
10 | 10 | let pmt = value(i.payments)[0] | |
11 | 11 | if ((pmt.assetId != tUSD)) | |
12 | 12 | then throw("holded payment not tUSD") | |
13 | - | else { | |
14 | - | let currentKey = toBase58String(i.caller.bytes) | |
15 | - | let currentAmount = match getInteger(this, currentKey) { | |
16 | - | case a: Int => | |
17 | - | a | |
18 | - | case _ => | |
19 | - | 0 | |
20 | - | } | |
21 | - | let newAmount = (currentAmount + pmt.amount) | |
13 | + | else if ((1000 > pmt.amount)) | |
14 | + | then throw("holded payment not tUSD") | |
15 | + | else { | |
16 | + | let currentKey = toBase58String(i.caller.bytes) | |
17 | + | let currentAmount = match getInteger(this, currentKey) { | |
18 | + | case a: Int => | |
19 | + | a | |
20 | + | case _ => | |
21 | + | 0 | |
22 | + | } | |
23 | + | let newAmount = (currentAmount + pmt.amount) | |
22 | 24 | [IntegerEntry(currentKey, newAmount)] | |
23 | - | } | |
25 | + | } | |
24 | 26 | } | |
25 | 27 | ||
26 | 28 | ||
27 | 29 | ||
28 | 30 | @Callable(i) | |
29 | 31 | func withdraw (amount) = { | |
30 | 32 | let currentKey = toBase58String(i.caller.bytes) | |
31 | 33 | let currentAmount = match getInteger(this, currentKey) { | |
32 | 34 | case a: Int => | |
33 | 35 | a | |
34 | 36 | case _ => | |
35 | 37 | 0 | |
36 | 38 | } | |
37 | 39 | let newAmount = (currentAmount - amount) | |
38 | 40 | if ((0 > amount)) | |
39 | 41 | then throw("Can't withdraw negative amount") | |
40 | 42 | else if ((0 > newAmount)) | |
41 | 43 | then throw("Not enough balance") | |
42 | 44 | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)], unit) | |
43 | 45 | } | |
44 | 46 | ||
45 | 47 | ||
46 | 48 | ||
47 | 49 | @Callable(i) | |
48 | 50 | func setOptions (opts,vals) = { | |
49 | 51 | let opt_size = size(opts) | |
50 | 52 | if ((100 >= opt_size)) | |
51 | 53 | then { | |
52 | 54 | let options_addr = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
53 | 55 | let adminList = match getString(options_addr, "admin_list") { | |
54 | 56 | case _: Unit => | |
55 | 57 | "unset" | |
56 | 58 | case x: String => | |
57 | 59 | x | |
58 | 60 | case _ => | |
59 | 61 | throw("Match error") | |
60 | 62 | } | |
61 | 63 | func addStringEntry (accum,nextValue) = { | |
62 | - | let $ | |
63 | - | let result = $ | |
64 | - | let j = $ | |
64 | + | let $t027042727 = accum | |
65 | + | let result = $t027042727._1 | |
66 | + | let j = $t027042727._2 | |
65 | 67 | $Tuple2((result :+ IntegerEntry(opts[j], nextValue)), (j + 1)) | |
66 | 68 | } | |
67 | 69 | ||
68 | 70 | let r = { | |
69 | 71 | let $l = vals | |
70 | 72 | let $s = size($l) | |
71 | 73 | let $acc0 = $Tuple2(nil, 0) | |
72 | 74 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
73 | 75 | then $a | |
74 | 76 | else addStringEntry($a, $l[$i]) | |
75 | 77 | ||
76 | 78 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
77 | 79 | then $a | |
78 | 80 | else throw("List size exceeds 100") | |
79 | 81 | ||
80 | 82 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
81 | 83 | } | |
82 | 84 | let callerAddressStr = toString(i.caller) | |
83 | 85 | if ((adminList != "unset")) | |
84 | 86 | then { | |
85 | 87 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
86 | 88 | let isAdmin = match test { | |
87 | 89 | case x: String => | |
88 | 90 | x | |
89 | 91 | case _: Unit => | |
90 | 92 | "no admin" | |
91 | 93 | case _ => | |
92 | 94 | throw("Match error") | |
93 | 95 | } | |
94 | 96 | func add_elm (options) = { | |
95 | 97 | let opt = split(options, "|") | |
96 | 98 | StringEntry(opt[0], opt[1]) | |
97 | 99 | } | |
98 | 100 | ||
99 | 101 | if ((isAdmin != "no admin")) | |
100 | 102 | then r | |
101 | 103 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
102 | 104 | } | |
103 | 105 | else throw("Unset admin list") | |
104 | 106 | } | |
105 | 107 | else throw("The number of list elements must not exceed 100") | |
106 | 108 | } | |
107 | 109 | ||
108 | 110 | ||
109 | 111 | ||
110 | 112 | @Callable(i) | |
111 | 113 | func setOption (variable,value) = { | |
112 | 114 | let options_addr = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
113 | 115 | let adminList = match getString(options_addr, "admin_list") { | |
114 | 116 | case _: Unit => | |
115 | 117 | "unset" | |
116 | 118 | case x: String => | |
117 | 119 | x | |
118 | 120 | case _ => | |
119 | 121 | throw("Match error") | |
120 | 122 | } | |
121 | 123 | let callerAddressStr = toString(i.caller) | |
122 | 124 | if ((adminList != "unset")) | |
123 | 125 | then { | |
124 | 126 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
125 | 127 | let isAdmin = match test { | |
126 | 128 | case x: String => | |
127 | 129 | x | |
128 | 130 | case _: Unit => | |
129 | 131 | "no admin" | |
130 | 132 | case _ => | |
131 | 133 | throw("Match error") | |
132 | 134 | } | |
133 | 135 | if ((isAdmin != "no admin")) | |
134 | 136 | then $Tuple2([IntegerEntry(variable, value)], unit) | |
135 | 137 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
136 | 138 | } | |
137 | 139 | else throw("Unset admin list") | |
138 | 140 | } | |
139 | 141 | ||
140 | 142 | ||
141 | 143 | ||
142 | 144 | @Callable(i) | |
143 | 145 | func delOption (variable) = { | |
144 | 146 | let options_addr = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
145 | 147 | let adminList = match getString(options_addr, "admin_list") { | |
146 | 148 | case _: Unit => | |
147 | 149 | "unset" | |
148 | 150 | case x: String => | |
149 | 151 | x | |
150 | 152 | case _ => | |
151 | 153 | throw("Match error") | |
152 | 154 | } | |
153 | 155 | let callerAddressStr = toString(i.caller) | |
154 | 156 | if ((adminList != "unset")) | |
155 | 157 | then { | |
156 | 158 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
157 | 159 | let isAdmin = match test { | |
158 | 160 | case x: String => | |
159 | 161 | x | |
160 | 162 | case _: Unit => | |
161 | 163 | "no admin" | |
162 | 164 | case _ => | |
163 | 165 | throw("Match error") | |
164 | 166 | } | |
165 | 167 | if ((isAdmin != "no admin")) | |
166 | 168 | then $Tuple2([DeleteEntry(variable)], unit) | |
167 | 169 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
168 | 170 | } | |
169 | 171 | else throw("Unset admin list") | |
170 | 172 | } | |
171 | 173 | ||
172 | 174 | ||
173 | 175 | @Verifier(tx) | |
174 | 176 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
175 | 177 |
github/deemru/w8io/169f3d6 29.48 ms ◑