tx · 81qmenHvn9stujupSeJn1VUswjzVfcE3eh8oDLg21kaV 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx: -0.01000000 Waves 2023.03.02 01:42 [2471620] smart account 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx > SELF 0.00000000 Waves
{ "type": 13, "id": "81qmenHvn9stujupSeJn1VUswjzVfcE3eh8oDLg21kaV", "fee": 1000000, "feeAssetId": null, "timestamp": 1677710587779, "version": 2, "chainId": 84, "sender": "3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx", "senderPublicKey": "D35PGQCSSdrp9pvujggj7b2DaCK1BhcU3kho7tikKJYs", "proofs": [ "3oED5NpzXbvv6p49k1eyB5PrzoycZxkUgzMvhN9y28icXqwK1yGgoqM2z8YCeud8ZXSg2951LbLEjhkz2ryqe8mK" ], "script": "base64:BgIfCAISAwoBARIAEgMKAQESBAoCGBESBAoCCAgSAwoBCAIADG9wdGlvbnNfYWRkcgkBB0FkZHJlc3MBARoBVEFb+Cv2F+oqocvEivH7x7uyIGEx/ocgwQAEdFVTRAEgqyRKarZCRuvS/ON5sGG6w65pV01SespFHKdAHRGwKQ4GAWkBCWlzc3VlQmlsbAEJcHJvdmlkaW5nBApjdXJyZW50S2V5CQDYBAEICAUBaQZjYWxsZXIFYnl0ZXMEDWN1cnJlbnRBbW91bnQEByRtYXRjaDAJAJoIAgUEdGhpcwUKY3VycmVudEtleQMJAAECBQckbWF0Y2gwAgNJbnQEAWEFByRtYXRjaDAFAWEAAAQRbWluQmlsbERlcG9zaXRTdHIEByRtYXRjaDAJAJ0IAgUMb3B0aW9uc19hZGRyAhBtaW5fYmlsbF9kZXBvc2l0AwkAAQIFByRtYXRjaDACBFVuaXQCATADCQABAgUHJG1hdGNoMAIGU3RyaW5nBAF4BQckbWF0Y2gwBQF4CQACAQILTWF0Y2ggZXJyb3IEDm1pbkJpbGxEZXBvc2l0BAckbWF0Y2gwCQC2CQEJAJEDAgkAtQkCB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ECIT0CBQlhZG1pbkxpc3QCBXVuc2V0BAR0ZXN0CQCdCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFCWFkbWluTGlzdAUQY2FsbGVyQWRkcmVzc1N0cgQHaXNBZG1pbgQHJG1hdGNoMAUEdGVzdAMJAAECBQckbWF0Y2gwAgZTdHJpbmcEAXgFByRtYXRjaDAFAXgDCQABAgUHJG1hdGNoMAIEVW5pdAIIbm8gYWRtaW4JAAIBAgtNYXRjaCBlcnJvcgMJAQIhPQIFB2lzQWRtaW4CCG5vIGFkbWluCQCUCgIJAMwIAgkBC0RlbGV0ZUVudHJ5AQUIdmFyaWFibGUFA25pbAUEdW5pdAkAAgEJAKwCAgkArAICCQCsAgIJAKwCAgkArAICCQCsAgICD1lvdSBub3QgYWRtaW46IAUJYWRtaW5MaXN0AgssIGlzQWRtaW46IAUHaXNBZG1pbgIULCBjYWxsZXJBZGRyZXNzU3RyOiAFEGNhbGxlckFkZHJlc3NTdHICAiwgCQACAQIQVW5zZXQgYWRtaW4gbGlzdAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXmSmd5t", "height": 2471620, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GD6KdATuGQAnjuxNi4UmyokT9rp14dLCCEkFznxRUUsr Next: FYbhrQuEAZvTQQFr7sWW5Y4Aks4B7phqBCs9vnCTZym3 Diff:
Old | New | Differences | |
---|---|---|---|
167 | 167 | ||
168 | 168 | @Callable(i) | |
169 | 169 | func setOption (variable,value) = { | |
170 | - | let adminList = match getString( | |
170 | + | let adminList = match getString(this, "admin_list") { | |
171 | 171 | case _: Unit => | |
172 | 172 | "unset" | |
173 | 173 | case x: String => | |
188 | 188 | throw("Match error") | |
189 | 189 | } | |
190 | 190 | if ((isAdmin != "no admin")) | |
191 | - | then $Tuple2([ | |
191 | + | then $Tuple2([StringEntry(variable, value)], unit) | |
192 | 192 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
193 | 193 | } | |
194 | 194 | else throw("Unset admin list") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let options_addr = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
5 | 5 | ||
6 | 6 | let tUSD = base58'CX4p6XcuSBUvv44r1avCqYka5PYAVzBK5hSXaT7maU85' | |
7 | 7 | ||
8 | 8 | @Callable(i) | |
9 | 9 | func issueBill (providing) = { | |
10 | 10 | let currentKey = toBase58String(i.caller.bytes) | |
11 | 11 | let currentAmount = match getInteger(this, currentKey) { | |
12 | 12 | case a: Int => | |
13 | 13 | a | |
14 | 14 | case _ => | |
15 | 15 | 0 | |
16 | 16 | } | |
17 | 17 | let minBillDepositStr = match getString(options_addr, "min_bill_deposit") { | |
18 | 18 | case _: Unit => | |
19 | 19 | "0" | |
20 | 20 | case x: String => | |
21 | 21 | x | |
22 | 22 | case _ => | |
23 | 23 | throw("Match error") | |
24 | 24 | } | |
25 | 25 | let minBillDeposit = match parseInt(split(minBillDepositStr, ".")[0]) { | |
26 | 26 | case _: Unit => | |
27 | 27 | 0 | |
28 | 28 | case t: Int => | |
29 | 29 | t | |
30 | 30 | case _ => | |
31 | 31 | throw("Match error") | |
32 | 32 | } | |
33 | 33 | let newAmount = (currentAmount - providing) | |
34 | 34 | if (((minBillDeposit * 100) > providing)) | |
35 | 35 | then throw((((("The security deposit must be more than " + minBillDepositStr) + ". You set the size: ") + toString((providing / 100))) + ".00")) | |
36 | 36 | else if ((0 > newAmount)) | |
37 | 37 | then throw("Not enough balance") | |
38 | 38 | else { | |
39 | 39 | let issue = Issue(("bill for:" + toString((providing / 100))), currentKey, 1, 0, false) | |
40 | 40 | let id = calculateAssetId(issue) | |
41 | 41 | $Tuple2([IntegerEntry(currentKey, newAmount), issue, ScriptTransfer(i.caller, 1, id), IntegerEntry(("l_" + toBase58String(id)), providing)], unit) | |
42 | 42 | } | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func deposit () = if ((size(i.payments) == 0)) | |
49 | 49 | then throw("Payment not attached") | |
50 | 50 | else { | |
51 | 51 | let pmt = value(i.payments)[0] | |
52 | 52 | let minDepositStr = match getString(options_addr, "min_deposit") { | |
53 | 53 | case _: Unit => | |
54 | 54 | "0" | |
55 | 55 | case x: String => | |
56 | 56 | x | |
57 | 57 | case _ => | |
58 | 58 | throw("Match error") | |
59 | 59 | } | |
60 | 60 | let minDeposit = match parseInt(split(minDepositStr, ".")[0]) { | |
61 | 61 | case _: Unit => | |
62 | 62 | 0 | |
63 | 63 | case t: Int => | |
64 | 64 | t | |
65 | 65 | case _ => | |
66 | 66 | throw("Match error") | |
67 | 67 | } | |
68 | 68 | if ((pmt.assetId != tUSD)) | |
69 | 69 | then throw("holded payment not tUSD") | |
70 | 70 | else if (((minDeposit * 100) > pmt.amount)) | |
71 | 71 | then throw((((("You have set the deposit amount to " + toString((pmt.amount / 100))) + ".00, which is less than the minimum (") + minDepositStr) + ")")) | |
72 | 72 | else { | |
73 | 73 | let currentKey = toBase58String(i.caller.bytes) | |
74 | 74 | let currentAmount = match getInteger(this, currentKey) { | |
75 | 75 | case a: Int => | |
76 | 76 | a | |
77 | 77 | case _ => | |
78 | 78 | 0 | |
79 | 79 | } | |
80 | 80 | let newAmount = (currentAmount + pmt.amount) | |
81 | 81 | [IntegerEntry(currentKey, newAmount)] | |
82 | 82 | } | |
83 | 83 | } | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
87 | 87 | @Callable(i) | |
88 | 88 | func withdraw (amount) = { | |
89 | 89 | let currentKey = toBase58String(i.caller.bytes) | |
90 | 90 | let currentAmount = match getInteger(this, currentKey) { | |
91 | 91 | case a: Int => | |
92 | 92 | a | |
93 | 93 | case _ => | |
94 | 94 | 0 | |
95 | 95 | } | |
96 | 96 | let newAmount = (currentAmount - amount) | |
97 | 97 | if ((0 > amount)) | |
98 | 98 | then throw("Can't withdraw negative amount") | |
99 | 99 | else if ((0 > newAmount)) | |
100 | 100 | then throw("Not enough balance") | |
101 | 101 | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, tUSD)], unit) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | ||
106 | 106 | @Callable(i) | |
107 | 107 | func setOptions (opts,vals) = { | |
108 | 108 | let opt_size = size(opts) | |
109 | 109 | if ((100 >= opt_size)) | |
110 | 110 | then { | |
111 | 111 | let adminList = match getString(options_addr, "admin_list") { | |
112 | 112 | case _: Unit => | |
113 | 113 | "unset" | |
114 | 114 | case x: String => | |
115 | 115 | x | |
116 | 116 | case _ => | |
117 | 117 | throw("Match error") | |
118 | 118 | } | |
119 | 119 | func addStringEntry (accum,nextValue) = { | |
120 | 120 | let $t046484671 = accum | |
121 | 121 | let result = $t046484671._1 | |
122 | 122 | let j = $t046484671._2 | |
123 | 123 | $Tuple2((result :+ IntegerEntry(opts[j], nextValue)), (j + 1)) | |
124 | 124 | } | |
125 | 125 | ||
126 | 126 | let r = { | |
127 | 127 | let $l = vals | |
128 | 128 | let $s = size($l) | |
129 | 129 | let $acc0 = $Tuple2(nil, 0) | |
130 | 130 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
131 | 131 | then $a | |
132 | 132 | else addStringEntry($a, $l[$i]) | |
133 | 133 | ||
134 | 134 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
135 | 135 | then $a | |
136 | 136 | else throw("List size exceeds 100") | |
137 | 137 | ||
138 | 138 | $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) | |
139 | 139 | } | |
140 | 140 | let callerAddressStr = toString(i.caller) | |
141 | 141 | if ((adminList != "unset")) | |
142 | 142 | then { | |
143 | 143 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
144 | 144 | let isAdmin = match test { | |
145 | 145 | case x: String => | |
146 | 146 | x | |
147 | 147 | case _: Unit => | |
148 | 148 | "no admin" | |
149 | 149 | case _ => | |
150 | 150 | throw("Match error") | |
151 | 151 | } | |
152 | 152 | func add_elm (options) = { | |
153 | 153 | let opt = split(options, "|") | |
154 | 154 | StringEntry(opt[0], opt[1]) | |
155 | 155 | } | |
156 | 156 | ||
157 | 157 | if ((isAdmin != "no admin")) | |
158 | 158 | then r | |
159 | 159 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
160 | 160 | } | |
161 | 161 | else throw("Unset admin list") | |
162 | 162 | } | |
163 | 163 | else throw("The number of list elements must not exceed 100") | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | ||
168 | 168 | @Callable(i) | |
169 | 169 | func setOption (variable,value) = { | |
170 | - | let adminList = match getString( | |
170 | + | let adminList = match getString(this, "admin_list") { | |
171 | 171 | case _: Unit => | |
172 | 172 | "unset" | |
173 | 173 | case x: String => | |
174 | 174 | x | |
175 | 175 | case _ => | |
176 | 176 | throw("Match error") | |
177 | 177 | } | |
178 | 178 | let callerAddressStr = toString(i.caller) | |
179 | 179 | if ((adminList != "unset")) | |
180 | 180 | then { | |
181 | 181 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
182 | 182 | let isAdmin = match test { | |
183 | 183 | case x: String => | |
184 | 184 | x | |
185 | 185 | case _: Unit => | |
186 | 186 | "no admin" | |
187 | 187 | case _ => | |
188 | 188 | throw("Match error") | |
189 | 189 | } | |
190 | 190 | if ((isAdmin != "no admin")) | |
191 | - | then $Tuple2([ | |
191 | + | then $Tuple2([StringEntry(variable, value)], unit) | |
192 | 192 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
193 | 193 | } | |
194 | 194 | else throw("Unset admin list") | |
195 | 195 | } | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | ||
199 | 199 | @Callable(i) | |
200 | 200 | func delOption (variable) = { | |
201 | 201 | let adminList = match getString(options_addr, "admin_list") { | |
202 | 202 | case _: Unit => | |
203 | 203 | "unset" | |
204 | 204 | case x: String => | |
205 | 205 | x | |
206 | 206 | case _ => | |
207 | 207 | throw("Match error") | |
208 | 208 | } | |
209 | 209 | let callerAddressStr = toString(i.caller) | |
210 | 210 | if ((adminList != "unset")) | |
211 | 211 | then { | |
212 | 212 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
213 | 213 | let isAdmin = match test { | |
214 | 214 | case x: String => | |
215 | 215 | x | |
216 | 216 | case _: Unit => | |
217 | 217 | "no admin" | |
218 | 218 | case _ => | |
219 | 219 | throw("Match error") | |
220 | 220 | } | |
221 | 221 | if ((isAdmin != "no admin")) | |
222 | 222 | then $Tuple2([DeleteEntry(variable)], unit) | |
223 | 223 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
224 | 224 | } | |
225 | 225 | else throw("Unset admin list") | |
226 | 226 | } | |
227 | 227 | ||
228 | 228 | ||
229 | 229 | @Verifier(tx) | |
230 | 230 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
231 | 231 |
github/deemru/w8io/169f3d6 53.46 ms ◑