tx · F4LhcqZYvbaG74MnUZNpdS4iM6rMcfBaF5c3ZLTdKpyM 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx: -0.01000000 Waves 2023.02.17 09:28 [2453257] smart account 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx > SELF 0.00000000 Waves
{ "type": 13, "id": "F4LhcqZYvbaG74MnUZNpdS4iM6rMcfBaF5c3ZLTdKpyM", "fee": 1000000, "feeAssetId": null, "timestamp": 1676615324744, "version": 2, "chainId": 84, "sender": "3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx", "senderPublicKey": "D35PGQCSSdrp9pvujggj7b2DaCK1BhcU3kho7tikKJYs", "proofs": [ "2igQPWLaTEBBa3kwt8sunk3ER45KhjbpGJqro42jU1hyFnrQKvzDsYQgv8L23wG59fhmyd31GjN2Z4UnD1TmHmX7" ], "script": "base64:BgIaCAISABIDCgEBEgQKAhgREgQKAggBEgMKAQgBAAR0VVNEASCrJEpqtkJG69L843mwYbrDrmlXTVJ6ykUcp0AdEbApDgUBaQEHZGVwb3NpdAAEA3BtdAkAkQMCCQEFdmFsdWUBCAUBaQhwYXltZW50cwAAAwkBCWlzRGVmaW5lZAEIBQNwbXQHYXNzZXRJZAkAAgECIWNhbiBob2RsIHdhdmVzIG9ubHkgYXQgdGhlIG1vbWVudAMJAQIhPQIIBQNwbXQHYXNzZXRJZAUEdFVTRAkAAgECF2hvbGRlZCBwYXltZW50IG5vdCB0VVNEBApjdXJyZW50S2V5CQDYBAEICAUBaQZjYWxsZXIFYnl0ZXMEDWN1cnJlbnRBbW91bnQEByRtYXRjaDAJAJoIAgUEdGhpcwUKY3VycmVudEtleQMJAAECBQckbWF0Y2gwAgNJbnQEAWEFByRtYXRjaDAFAWEAAAQJbmV3QW1vdW50CQBkAgUNY3VycmVudEFtb3VudAgFA3BtdAZhbW91bnQJAMwIAgkBDEludGVnZXJFbnRyeQIFCmN1cnJlbnRLZXkFCW5ld0Ftb3VudAU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ded", "spentComplexity": 0 } View: original | compacted Prev: 63b8Fc3aNNDxvaPTY4FtDMpRAJHiuKqHjkNN3y4qUHe2 Next: 4q1xdM2iyqiSDxLytspKghbxdJXXWkhaA3hbPT1wRMqD Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = base58'CX4p6XcuSBUvv44r1avCqYka5PYAVzBK5hSXaT7maU85' | |
4 | 5 | ||
5 | - | ||
6 | - | @Callable(a) | |
6 | + | @Callable(b) | |
7 | 7 | func deposit () = { | |
8 | - | let | |
9 | - | if (isDefined( | |
8 | + | let c = value(b.payments)[0] | |
9 | + | if (isDefined(c.assetId)) | |
10 | 10 | then throw("can hodl waves only at the moment") | |
11 | - | else { | |
12 | - | let c = toBase58String(a.caller.bytes) | |
13 | - | let d = { | |
14 | - | let e = getInteger(this, c) | |
15 | - | if ($isInstanceOf(e, "Int")) | |
16 | - | then { | |
17 | - | let f = e | |
18 | - | f | |
19 | - | } | |
20 | - | else 0 | |
11 | + | else if ((c.assetId != a)) | |
12 | + | then throw("holded payment not tUSD") | |
13 | + | else { | |
14 | + | let d = toBase58String(b.caller.bytes) | |
15 | + | let e = { | |
16 | + | let f = getInteger(this, d) | |
17 | + | if ($isInstanceOf(f, "Int")) | |
18 | + | then { | |
19 | + | let g = f | |
20 | + | g | |
21 | + | } | |
22 | + | else 0 | |
23 | + | } | |
24 | + | let h = (e + c.amount) | |
25 | + | [IntegerEntry(d, h)] | |
21 | 26 | } | |
22 | - | let g = (d + b.amount) | |
23 | - | [IntegerEntry(c, g)] | |
24 | - | } | |
25 | 27 | } | |
26 | 28 | ||
27 | 29 | ||
28 | 30 | ||
29 | - | @Callable( | |
30 | - | func withdraw ( | |
31 | - | let | |
32 | - | let | |
33 | - | let | |
34 | - | if ($isInstanceOf( | |
31 | + | @Callable(b) | |
32 | + | func withdraw (i) = { | |
33 | + | let d = toBase58String(b.caller.bytes) | |
34 | + | let e = { | |
35 | + | let f = getInteger(this, d) | |
36 | + | if ($isInstanceOf(f, "Int")) | |
35 | 37 | then { | |
36 | - | let | |
37 | - | | |
38 | + | let g = f | |
39 | + | g | |
38 | 40 | } | |
39 | 41 | else 0 | |
40 | 42 | } | |
41 | - | let | |
42 | - | if ((0 > | |
43 | + | let h = (e - i) | |
44 | + | if ((0 > i)) | |
43 | 45 | then throw("Can't withdraw negative amount") | |
44 | - | else if ((0 > | |
46 | + | else if ((0 > h)) | |
45 | 47 | then throw("Not enough balance") | |
46 | - | else $Tuple2([IntegerEntry( | |
48 | + | else $Tuple2([IntegerEntry(d, h), ScriptTransfer(b.caller, i, unit)], unit) | |
47 | 49 | } | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | ||
51 | - | @Callable( | |
52 | - | func setOptions ( | |
53 | - | let | |
54 | - | if ((100 >= | |
53 | + | @Callable(b) | |
54 | + | func setOptions (j,k) = { | |
55 | + | let l = size(j) | |
56 | + | if ((100 >= l)) | |
55 | 57 | then { | |
56 | - | let | |
57 | - | let | |
58 | - | let | |
59 | - | if ($isInstanceOf( | |
58 | + | let m = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
59 | + | let n = { | |
60 | + | let f = getString(m, "admin_list") | |
61 | + | if ($isInstanceOf(f, "Unit")) | |
60 | 62 | then "unset" | |
61 | - | else if ($isInstanceOf( | |
63 | + | else if ($isInstanceOf(f, "String")) | |
62 | 64 | then { | |
63 | - | let | |
64 | - | | |
65 | + | let o = f | |
66 | + | o | |
65 | 67 | } | |
66 | 68 | else throw("Match error") | |
67 | 69 | } | |
68 | - | func | |
69 | - | let | |
70 | - | let | |
71 | - | let | |
72 | - | $Tuple2(( | |
70 | + | func p (q,r) = { | |
71 | + | let s = q | |
72 | + | let t = s._1 | |
73 | + | let u = s._2 | |
74 | + | $Tuple2((t :+ IntegerEntry(j[u], r)), (u + 1)) | |
73 | 75 | } | |
74 | 76 | ||
75 | - | let | |
76 | - | let | |
77 | - | let | |
78 | - | let | |
79 | - | func | |
80 | - | then | |
81 | - | else | |
77 | + | let v = { | |
78 | + | let w = k | |
79 | + | let x = size(w) | |
80 | + | let y = $Tuple2(nil, 0) | |
81 | + | func z (A,B) = if ((B >= x)) | |
82 | + | then A | |
83 | + | else p(A, w[B]) | |
82 | 84 | ||
83 | - | func | |
84 | - | then | |
85 | + | func C (A,B) = if ((B >= x)) | |
86 | + | then A | |
85 | 87 | else throw("List size exceeds 100") | |
86 | 88 | ||
87 | - | | |
89 | + | C(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(y, 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) | |
88 | 90 | } | |
89 | - | let | |
90 | - | if (( | |
91 | + | let D = toString(b.caller) | |
92 | + | if ((n != "unset")) | |
91 | 93 | then { | |
92 | - | let | |
93 | - | let | |
94 | - | let | |
95 | - | if ($isInstanceOf( | |
94 | + | let E = getString(addressFromStringValue(n), D) | |
95 | + | let F = { | |
96 | + | let f = E | |
97 | + | if ($isInstanceOf(f, "String")) | |
96 | 98 | then { | |
97 | - | let | |
98 | - | | |
99 | + | let o = f | |
100 | + | o | |
99 | 101 | } | |
100 | - | else if ($isInstanceOf( | |
102 | + | else if ($isInstanceOf(f, "Unit")) | |
101 | 103 | then "no admin" | |
102 | 104 | else throw("Match error") | |
103 | 105 | } | |
104 | - | func | |
105 | - | let | |
106 | - | StringEntry( | |
106 | + | func G (H) = { | |
107 | + | let I = split(H, "|") | |
108 | + | StringEntry(I[0], I[1]) | |
107 | 109 | } | |
108 | 110 | ||
109 | - | if (( | |
110 | - | then | |
111 | - | else throw((((((("You not admin: " + | |
111 | + | if ((F != "no admin")) | |
112 | + | then v | |
113 | + | else throw((((((("You not admin: " + n) + ", isAdmin: ") + F) + ", callerAddressStr: ") + D) + ", ")) | |
112 | 114 | } | |
113 | 115 | else throw("Unset admin list") | |
114 | 116 | } | |
117 | 119 | ||
118 | 120 | ||
119 | 121 | ||
120 | - | @Callable( | |
121 | - | func setOption ( | |
122 | - | let | |
123 | - | let | |
124 | - | let | |
125 | - | if ($isInstanceOf( | |
122 | + | @Callable(b) | |
123 | + | func setOption (J,K) = { | |
124 | + | let m = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
125 | + | let n = { | |
126 | + | let f = getString(m, "admin_list") | |
127 | + | if ($isInstanceOf(f, "Unit")) | |
126 | 128 | then "unset" | |
127 | - | else if ($isInstanceOf( | |
129 | + | else if ($isInstanceOf(f, "String")) | |
128 | 130 | then { | |
129 | - | let | |
130 | - | | |
131 | + | let o = f | |
132 | + | o | |
131 | 133 | } | |
132 | 134 | else throw("Match error") | |
133 | 135 | } | |
134 | - | let | |
135 | - | if (( | |
136 | + | let D = toString(b.caller) | |
137 | + | if ((n != "unset")) | |
136 | 138 | then { | |
137 | - | let | |
138 | - | let | |
139 | - | let | |
140 | - | if ($isInstanceOf( | |
139 | + | let E = getString(addressFromStringValue(n), D) | |
140 | + | let F = { | |
141 | + | let f = E | |
142 | + | if ($isInstanceOf(f, "String")) | |
141 | 143 | then { | |
142 | - | let | |
143 | - | | |
144 | + | let o = f | |
145 | + | o | |
144 | 146 | } | |
145 | - | else if ($isInstanceOf( | |
147 | + | else if ($isInstanceOf(f, "Unit")) | |
146 | 148 | then "no admin" | |
147 | 149 | else throw("Match error") | |
148 | 150 | } | |
149 | - | if (( | |
150 | - | then $Tuple2([IntegerEntry( | |
151 | - | else throw((((((("You not admin: " + | |
151 | + | if ((F != "no admin")) | |
152 | + | then $Tuple2([IntegerEntry(J, K)], unit) | |
153 | + | else throw((((((("You not admin: " + n) + ", isAdmin: ") + F) + ", callerAddressStr: ") + D) + ", ")) | |
152 | 154 | } | |
153 | 155 | else throw("Unset admin list") | |
154 | 156 | } | |
155 | 157 | ||
156 | 158 | ||
157 | 159 | ||
158 | - | @Callable( | |
159 | - | func delOption ( | |
160 | - | let | |
161 | - | let | |
162 | - | let | |
163 | - | if ($isInstanceOf( | |
160 | + | @Callable(b) | |
161 | + | func delOption (J) = { | |
162 | + | let m = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
163 | + | let n = { | |
164 | + | let f = getString(m, "admin_list") | |
165 | + | if ($isInstanceOf(f, "Unit")) | |
164 | 166 | then "unset" | |
165 | - | else if ($isInstanceOf( | |
167 | + | else if ($isInstanceOf(f, "String")) | |
166 | 168 | then { | |
167 | - | let | |
168 | - | | |
169 | + | let o = f | |
170 | + | o | |
169 | 171 | } | |
170 | 172 | else throw("Match error") | |
171 | 173 | } | |
172 | - | let | |
173 | - | if (( | |
174 | + | let D = toString(b.caller) | |
175 | + | if ((n != "unset")) | |
174 | 176 | then { | |
175 | - | let | |
176 | - | let | |
177 | - | let | |
178 | - | if ($isInstanceOf( | |
177 | + | let E = getString(addressFromStringValue(n), D) | |
178 | + | let F = { | |
179 | + | let f = E | |
180 | + | if ($isInstanceOf(f, "String")) | |
179 | 181 | then { | |
180 | - | let | |
181 | - | | |
182 | + | let o = f | |
183 | + | o | |
182 | 184 | } | |
183 | - | else if ($isInstanceOf( | |
185 | + | else if ($isInstanceOf(f, "Unit")) | |
184 | 186 | then "no admin" | |
185 | 187 | else throw("Match error") | |
186 | 188 | } | |
187 | - | if (( | |
188 | - | then $Tuple2([DeleteEntry( | |
189 | - | else throw((((((("You not admin: " + | |
189 | + | if ((F != "no admin")) | |
190 | + | then $Tuple2([DeleteEntry(J)], unit) | |
191 | + | else throw((((((("You not admin: " + n) + ", isAdmin: ") + F) + ", callerAddressStr: ") + D) + ", ")) | |
190 | 192 | } | |
191 | 193 | else throw("Unset admin list") | |
192 | 194 | } | |
193 | 195 | ||
194 | 196 | ||
195 | - | @Verifier( | |
196 | - | func | |
197 | + | @Verifier(L) | |
198 | + | func M () = sigVerify(L.bodyBytes, L.proofs[0], L.senderPublicKey) | |
197 | 199 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = base58'CX4p6XcuSBUvv44r1avCqYka5PYAVzBK5hSXaT7maU85' | |
4 | 5 | ||
5 | - | ||
6 | - | @Callable(a) | |
6 | + | @Callable(b) | |
7 | 7 | func deposit () = { | |
8 | - | let | |
9 | - | if (isDefined( | |
8 | + | let c = value(b.payments)[0] | |
9 | + | if (isDefined(c.assetId)) | |
10 | 10 | then throw("can hodl waves only at the moment") | |
11 | - | else { | |
12 | - | let c = toBase58String(a.caller.bytes) | |
13 | - | let d = { | |
14 | - | let e = getInteger(this, c) | |
15 | - | if ($isInstanceOf(e, "Int")) | |
16 | - | then { | |
17 | - | let f = e | |
18 | - | f | |
19 | - | } | |
20 | - | else 0 | |
11 | + | else if ((c.assetId != a)) | |
12 | + | then throw("holded payment not tUSD") | |
13 | + | else { | |
14 | + | let d = toBase58String(b.caller.bytes) | |
15 | + | let e = { | |
16 | + | let f = getInteger(this, d) | |
17 | + | if ($isInstanceOf(f, "Int")) | |
18 | + | then { | |
19 | + | let g = f | |
20 | + | g | |
21 | + | } | |
22 | + | else 0 | |
23 | + | } | |
24 | + | let h = (e + c.amount) | |
25 | + | [IntegerEntry(d, h)] | |
21 | 26 | } | |
22 | - | let g = (d + b.amount) | |
23 | - | [IntegerEntry(c, g)] | |
24 | - | } | |
25 | 27 | } | |
26 | 28 | ||
27 | 29 | ||
28 | 30 | ||
29 | - | @Callable( | |
30 | - | func withdraw ( | |
31 | - | let | |
32 | - | let | |
33 | - | let | |
34 | - | if ($isInstanceOf( | |
31 | + | @Callable(b) | |
32 | + | func withdraw (i) = { | |
33 | + | let d = toBase58String(b.caller.bytes) | |
34 | + | let e = { | |
35 | + | let f = getInteger(this, d) | |
36 | + | if ($isInstanceOf(f, "Int")) | |
35 | 37 | then { | |
36 | - | let | |
37 | - | | |
38 | + | let g = f | |
39 | + | g | |
38 | 40 | } | |
39 | 41 | else 0 | |
40 | 42 | } | |
41 | - | let | |
42 | - | if ((0 > | |
43 | + | let h = (e - i) | |
44 | + | if ((0 > i)) | |
43 | 45 | then throw("Can't withdraw negative amount") | |
44 | - | else if ((0 > | |
46 | + | else if ((0 > h)) | |
45 | 47 | then throw("Not enough balance") | |
46 | - | else $Tuple2([IntegerEntry( | |
48 | + | else $Tuple2([IntegerEntry(d, h), ScriptTransfer(b.caller, i, unit)], unit) | |
47 | 49 | } | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | ||
51 | - | @Callable( | |
52 | - | func setOptions ( | |
53 | - | let | |
54 | - | if ((100 >= | |
53 | + | @Callable(b) | |
54 | + | func setOptions (j,k) = { | |
55 | + | let l = size(j) | |
56 | + | if ((100 >= l)) | |
55 | 57 | then { | |
56 | - | let | |
57 | - | let | |
58 | - | let | |
59 | - | if ($isInstanceOf( | |
58 | + | let m = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
59 | + | let n = { | |
60 | + | let f = getString(m, "admin_list") | |
61 | + | if ($isInstanceOf(f, "Unit")) | |
60 | 62 | then "unset" | |
61 | - | else if ($isInstanceOf( | |
63 | + | else if ($isInstanceOf(f, "String")) | |
62 | 64 | then { | |
63 | - | let | |
64 | - | | |
65 | + | let o = f | |
66 | + | o | |
65 | 67 | } | |
66 | 68 | else throw("Match error") | |
67 | 69 | } | |
68 | - | func | |
69 | - | let | |
70 | - | let | |
71 | - | let | |
72 | - | $Tuple2(( | |
70 | + | func p (q,r) = { | |
71 | + | let s = q | |
72 | + | let t = s._1 | |
73 | + | let u = s._2 | |
74 | + | $Tuple2((t :+ IntegerEntry(j[u], r)), (u + 1)) | |
73 | 75 | } | |
74 | 76 | ||
75 | - | let | |
76 | - | let | |
77 | - | let | |
78 | - | let | |
79 | - | func | |
80 | - | then | |
81 | - | else | |
77 | + | let v = { | |
78 | + | let w = k | |
79 | + | let x = size(w) | |
80 | + | let y = $Tuple2(nil, 0) | |
81 | + | func z (A,B) = if ((B >= x)) | |
82 | + | then A | |
83 | + | else p(A, w[B]) | |
82 | 84 | ||
83 | - | func | |
84 | - | then | |
85 | + | func C (A,B) = if ((B >= x)) | |
86 | + | then A | |
85 | 87 | else throw("List size exceeds 100") | |
86 | 88 | ||
87 | - | | |
89 | + | C(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(z(y, 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) | |
88 | 90 | } | |
89 | - | let | |
90 | - | if (( | |
91 | + | let D = toString(b.caller) | |
92 | + | if ((n != "unset")) | |
91 | 93 | then { | |
92 | - | let | |
93 | - | let | |
94 | - | let | |
95 | - | if ($isInstanceOf( | |
94 | + | let E = getString(addressFromStringValue(n), D) | |
95 | + | let F = { | |
96 | + | let f = E | |
97 | + | if ($isInstanceOf(f, "String")) | |
96 | 98 | then { | |
97 | - | let | |
98 | - | | |
99 | + | let o = f | |
100 | + | o | |
99 | 101 | } | |
100 | - | else if ($isInstanceOf( | |
102 | + | else if ($isInstanceOf(f, "Unit")) | |
101 | 103 | then "no admin" | |
102 | 104 | else throw("Match error") | |
103 | 105 | } | |
104 | - | func | |
105 | - | let | |
106 | - | StringEntry( | |
106 | + | func G (H) = { | |
107 | + | let I = split(H, "|") | |
108 | + | StringEntry(I[0], I[1]) | |
107 | 109 | } | |
108 | 110 | ||
109 | - | if (( | |
110 | - | then | |
111 | - | else throw((((((("You not admin: " + | |
111 | + | if ((F != "no admin")) | |
112 | + | then v | |
113 | + | else throw((((((("You not admin: " + n) + ", isAdmin: ") + F) + ", callerAddressStr: ") + D) + ", ")) | |
112 | 114 | } | |
113 | 115 | else throw("Unset admin list") | |
114 | 116 | } | |
115 | 117 | else throw("The number of list elements must not exceed 100") | |
116 | 118 | } | |
117 | 119 | ||
118 | 120 | ||
119 | 121 | ||
120 | - | @Callable( | |
121 | - | func setOption ( | |
122 | - | let | |
123 | - | let | |
124 | - | let | |
125 | - | if ($isInstanceOf( | |
122 | + | @Callable(b) | |
123 | + | func setOption (J,K) = { | |
124 | + | let m = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
125 | + | let n = { | |
126 | + | let f = getString(m, "admin_list") | |
127 | + | if ($isInstanceOf(f, "Unit")) | |
126 | 128 | then "unset" | |
127 | - | else if ($isInstanceOf( | |
129 | + | else if ($isInstanceOf(f, "String")) | |
128 | 130 | then { | |
129 | - | let | |
130 | - | | |
131 | + | let o = f | |
132 | + | o | |
131 | 133 | } | |
132 | 134 | else throw("Match error") | |
133 | 135 | } | |
134 | - | let | |
135 | - | if (( | |
136 | + | let D = toString(b.caller) | |
137 | + | if ((n != "unset")) | |
136 | 138 | then { | |
137 | - | let | |
138 | - | let | |
139 | - | let | |
140 | - | if ($isInstanceOf( | |
139 | + | let E = getString(addressFromStringValue(n), D) | |
140 | + | let F = { | |
141 | + | let f = E | |
142 | + | if ($isInstanceOf(f, "String")) | |
141 | 143 | then { | |
142 | - | let | |
143 | - | | |
144 | + | let o = f | |
145 | + | o | |
144 | 146 | } | |
145 | - | else if ($isInstanceOf( | |
147 | + | else if ($isInstanceOf(f, "Unit")) | |
146 | 148 | then "no admin" | |
147 | 149 | else throw("Match error") | |
148 | 150 | } | |
149 | - | if (( | |
150 | - | then $Tuple2([IntegerEntry( | |
151 | - | else throw((((((("You not admin: " + | |
151 | + | if ((F != "no admin")) | |
152 | + | then $Tuple2([IntegerEntry(J, K)], unit) | |
153 | + | else throw((((((("You not admin: " + n) + ", isAdmin: ") + F) + ", callerAddressStr: ") + D) + ", ")) | |
152 | 154 | } | |
153 | 155 | else throw("Unset admin list") | |
154 | 156 | } | |
155 | 157 | ||
156 | 158 | ||
157 | 159 | ||
158 | - | @Callable( | |
159 | - | func delOption ( | |
160 | - | let | |
161 | - | let | |
162 | - | let | |
163 | - | if ($isInstanceOf( | |
160 | + | @Callable(b) | |
161 | + | func delOption (J) = { | |
162 | + | let m = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
163 | + | let n = { | |
164 | + | let f = getString(m, "admin_list") | |
165 | + | if ($isInstanceOf(f, "Unit")) | |
164 | 166 | then "unset" | |
165 | - | else if ($isInstanceOf( | |
167 | + | else if ($isInstanceOf(f, "String")) | |
166 | 168 | then { | |
167 | - | let | |
168 | - | | |
169 | + | let o = f | |
170 | + | o | |
169 | 171 | } | |
170 | 172 | else throw("Match error") | |
171 | 173 | } | |
172 | - | let | |
173 | - | if (( | |
174 | + | let D = toString(b.caller) | |
175 | + | if ((n != "unset")) | |
174 | 176 | then { | |
175 | - | let | |
176 | - | let | |
177 | - | let | |
178 | - | if ($isInstanceOf( | |
177 | + | let E = getString(addressFromStringValue(n), D) | |
178 | + | let F = { | |
179 | + | let f = E | |
180 | + | if ($isInstanceOf(f, "String")) | |
179 | 181 | then { | |
180 | - | let | |
181 | - | | |
182 | + | let o = f | |
183 | + | o | |
182 | 184 | } | |
183 | - | else if ($isInstanceOf( | |
185 | + | else if ($isInstanceOf(f, "Unit")) | |
184 | 186 | then "no admin" | |
185 | 187 | else throw("Match error") | |
186 | 188 | } | |
187 | - | if (( | |
188 | - | then $Tuple2([DeleteEntry( | |
189 | - | else throw((((((("You not admin: " + | |
189 | + | if ((F != "no admin")) | |
190 | + | then $Tuple2([DeleteEntry(J)], unit) | |
191 | + | else throw((((((("You not admin: " + n) + ", isAdmin: ") + F) + ", callerAddressStr: ") + D) + ", ")) | |
190 | 192 | } | |
191 | 193 | else throw("Unset admin list") | |
192 | 194 | } | |
193 | 195 | ||
194 | 196 | ||
195 | - | @Verifier( | |
196 | - | func | |
197 | + | @Verifier(L) | |
198 | + | func M () = sigVerify(L.bodyBytes, L.proofs[0], L.senderPublicKey) | |
197 | 199 |
github/deemru/w8io/169f3d6 113.34 ms ◑