tx · 8fyTTicxNy8FUm7EdqywTq3einNg2xS3SFpygPNt2VnA 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq: -0.01300000 Waves 2023.01.31 17:40 [2429253] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves
{ "type": 13, "id": "8fyTTicxNy8FUm7EdqywTq3einNg2xS3SFpygPNt2VnA", "fee": 1300000, "feeAssetId": null, "timestamp": 1675176068530, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "iZZWEtRD4hLebGmJK2DmMGf43sq96qtmXB2Crvx5Fc4PZgyvC8rBH9FQu8aqshVeobWK8zrsASqbaAyk6C3Yo5K" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAVAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcACXRlc3RFcnJvcgkAAgECD1Rlc3QgZXJyb3IgaGVyZQETa2V5TWFuYWdlclB1YmxpY0tleQACFCVzX19tYW5hZ2VyUHVibGljS2V5ARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQACGyVzX19wZW5kaW5nTWFuYWdlclB1YmxpY0tleQECZmMAAhMlc19fZmFjdG9yeUNvbnRyYWN0AA9mYWN0b3J5Q29udHJhY3QJARFAZXh0ck5hdGl2ZSgxM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253, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3AkwLU2kJEjw6Vu2cSbMikZqmHjAVdYKR9Kdh7PSHp4W Next: 7fwdKZDFUwdE91XzWuwWaoYBDXXNTyU9zxYKDdkRUBhn Diff:
Old | New | Differences | |
---|---|---|---|
108 | 108 | let M = (L - K) | |
109 | 109 | let N = invoke(l, "getLpAssetFromPoolAssetsREADONLY", [G, H], nil) | |
110 | 110 | let O = invoke(l, "getLpAssetFromPoolAssetsREADONLY", [H, G], nil) | |
111 | - | let P = if ((0 == 0)) | |
112 | - | then h | |
113 | - | else h | |
114 | - | let Q = if ((N != unit)) | |
111 | + | let P = if ((N != unit)) | |
115 | 112 | then { | |
116 | - | let | |
117 | - | let | |
118 | - | let | |
119 | - | if ($isInstanceOf( | |
120 | - | then | |
121 | - | else throw(($getType( | |
113 | + | let Q = false | |
114 | + | let R = { | |
115 | + | let S = invoke(l, "getPoolAddressFromLpAssetREADONLY", [N], nil) | |
116 | + | if ($isInstanceOf(S, "Address")) | |
117 | + | then S | |
118 | + | else throw(($getType(S) + " couldn't be cast to Address")) | |
122 | 119 | } | |
123 | - | $Tuple2( | |
120 | + | $Tuple2(Q, R) | |
124 | 121 | } | |
125 | 122 | else if ((O != unit)) | |
126 | 123 | then { | |
127 | - | let | |
128 | - | let | |
129 | - | $Tuple2( | |
124 | + | let Q = true | |
125 | + | let R = invoke(l, "getPoolAddressFromLpAssetREADONLY", [O], nil) | |
126 | + | $Tuple2(Q, R) | |
130 | 127 | } | |
131 | 128 | else h | |
132 | - | let | |
133 | - | let | |
134 | - | let | |
135 | - | let | |
136 | - | if ($isInstanceOf( | |
137 | - | then | |
138 | - | else throw(($getType( | |
129 | + | let Q = P._1 | |
130 | + | let R = P._2 | |
131 | + | let T = { | |
132 | + | let S = invoke(l, "isPoolOneTokenOperationsDisabledREADONLY", [R], nil) | |
133 | + | if ($isInstanceOf(S, "Boolean")) | |
134 | + | then S | |
135 | + | else throw(($getType(S) + " couldn't be cast to Boolean")) | |
139 | 136 | } | |
140 | - | let | |
137 | + | let U = if (T) | |
141 | 138 | then true | |
142 | 139 | else e | |
143 | - | if (( | |
140 | + | if ((U == U)) | |
144 | 141 | then { | |
145 | - | let | |
146 | - | let | |
147 | - | let | |
148 | - | if ($isInstanceOf( | |
149 | - | then | |
150 | - | else throw(($getType( | |
142 | + | let V = addressFromStringValue(valueOrElse(R, "")) | |
143 | + | let W = { | |
144 | + | let S = invoke(V, "calculateAmountOutForSwapREADONLY", [M, Q], nil) | |
145 | + | if ($isInstanceOf(S, "Int")) | |
146 | + | then S | |
147 | + | else throw(($getType(S) + " couldn't be cast to Int")) | |
151 | 148 | } | |
152 | - | $Tuple2(nil, | |
149 | + | $Tuple2(nil, W) | |
153 | 150 | } | |
154 | 151 | else throw("Strict value is not equal to itself.") | |
155 | 152 | } | |
157 | 154 | ||
158 | 155 | ||
159 | 156 | @Callable(A) | |
160 | - | func swap ( | |
161 | - | let | |
162 | - | let G = if (( | |
157 | + | func swap (X,H,Y) = { | |
158 | + | let Z = value(A.payments[0]) | |
159 | + | let G = if ((Z.assetId == unit)) | |
163 | 160 | then toBytes("WAVES") | |
164 | - | else value( | |
165 | - | let F = value( | |
161 | + | else value(Z.assetId) | |
162 | + | let F = value(Z.amount) | |
166 | 163 | let I = value(getInteger(o())) | |
167 | 164 | let J = fraction(toBigInt(F), toBigInt(I), b) | |
168 | 165 | let K = fraction(toBigInt(F), toBigInt(I), b) | |
169 | 166 | let L = (toBigInt(F) - J) | |
170 | 167 | let M = (L - K) | |
171 | - | let | |
168 | + | let aa = [if ((size(A.payments) == 1)) | |
172 | 169 | then true | |
173 | 170 | else throw("exactly 1 payment are expected")] | |
174 | - | if (( | |
171 | + | if ((aa == aa)) | |
175 | 172 | then { | |
176 | 173 | let N = invoke(l, "getLpAssetFromPoolAssetsREADONLY", [G, H], nil) | |
177 | 174 | let O = invoke(l, "getLpAssetFromPoolAssetsREADONLY", [H, G], nil) | |
178 | - | let | |
175 | + | let ab = if ((N != unit)) | |
179 | 176 | then { | |
180 | - | let | |
181 | - | let | |
182 | - | let | |
183 | - | if ($isInstanceOf( | |
184 | - | then | |
185 | - | else throw(($getType( | |
177 | + | let Q = false | |
178 | + | let R = { | |
179 | + | let S = invoke(l, "getPoolAddressFromLpAssetREADONLY", [N], nil) | |
180 | + | if ($isInstanceOf(S, "Address")) | |
181 | + | then S | |
182 | + | else throw(($getType(S) + " couldn't be cast to Address")) | |
186 | 183 | } | |
187 | - | $Tuple2( | |
184 | + | $Tuple2(Q, R) | |
188 | 185 | } | |
189 | 186 | else if ((O != unit)) | |
190 | 187 | then { | |
191 | - | let | |
192 | - | let | |
193 | - | $Tuple2( | |
188 | + | let Q = true | |
189 | + | let R = invoke(l, "getPoolAddressFromLpAssetREADONLY", [O], nil) | |
190 | + | $Tuple2(Q, R) | |
194 | 191 | } | |
195 | 192 | else f | |
196 | - | let | |
197 | - | let | |
198 | - | let | |
199 | - | let | |
200 | - | if ($isInstanceOf( | |
201 | - | then | |
202 | - | else throw(($getType( | |
193 | + | let Q = ab._1 | |
194 | + | let R = ab._2 | |
195 | + | let T = { | |
196 | + | let S = invoke(l, "isPoolOneTokenOperationsDisabledREADONLY", [R], nil) | |
197 | + | if ($isInstanceOf(S, "Boolean")) | |
198 | + | then S | |
199 | + | else throw(($getType(S) + " couldn't be cast to Boolean")) | |
203 | 200 | } | |
204 | - | let | |
201 | + | let U = if (T) | |
205 | 202 | then true | |
206 | 203 | else e | |
207 | - | if (( | |
204 | + | if ((U == U)) | |
208 | 205 | then { | |
209 | - | let | |
210 | - | let | |
211 | - | let | |
212 | - | if ($isInstanceOf( | |
213 | - | then | |
214 | - | else throw(($getType( | |
206 | + | let V = addressFromStringValue(valueOrElse(R, "")) | |
207 | + | let W = { | |
208 | + | let S = invoke(V, "calculateAmountOutForSwapAndSendTokens", [M, Q, X, Y], [AttachedPayment(G, toInt(L))]) | |
209 | + | if ($isInstanceOf(S, "Boolean")) | |
210 | + | then S | |
211 | + | else throw(($getType(S) + " couldn't be cast to Boolean")) | |
215 | 212 | } | |
216 | - | $Tuple2(nil, | |
213 | + | $Tuple2(nil, W) | |
217 | 214 | } | |
218 | 215 | else throw("Strict value is not equal to itself.") | |
219 | 216 | } | |
223 | 220 | ||
224 | 221 | ||
225 | 222 | @Callable(A) | |
226 | - | func setManager ( | |
227 | - | let | |
228 | - | if (( | |
223 | + | func setManager (ac) = { | |
224 | + | let ad = C(A) | |
225 | + | if ((ad == ad)) | |
229 | 226 | then { | |
230 | - | let | |
231 | - | if (( | |
232 | - | then [StringEntry(j(), | |
227 | + | let ae = fromBase58String(ac) | |
228 | + | if ((ae == ae)) | |
229 | + | then [StringEntry(j(), ac)] | |
233 | 230 | else throw("Strict value is not equal to itself.") | |
234 | 231 | } | |
235 | 232 | else throw("Strict value is not equal to itself.") | |
239 | 236 | ||
240 | 237 | @Callable(A) | |
241 | 238 | func confirmManager () = { | |
242 | - | let | |
243 | - | let | |
239 | + | let af = y() | |
240 | + | let ag = if (isDefined(af)) | |
244 | 241 | then true | |
245 | 242 | else throw("no pending manager") | |
246 | - | if (( | |
243 | + | if ((ag == ag)) | |
247 | 244 | then { | |
248 | - | let | |
245 | + | let ah = if ((A.callerPublicKey == value(af))) | |
249 | 246 | then true | |
250 | 247 | else throw("you are not pending manager") | |
251 | - | if (( | |
252 | - | then [StringEntry(i(), toBase58String(value( | |
248 | + | if ((ah == ah)) | |
249 | + | then [StringEntry(i(), toBase58String(value(af))), DeleteEntry(j())] | |
253 | 250 | else throw("Strict value is not equal to itself.") | |
254 | 251 | } | |
255 | 252 | else throw("Strict value is not equal to itself.") | |
256 | 253 | } | |
257 | 254 | ||
258 | 255 | ||
259 | - | @Verifier( | |
260 | - | func | |
261 | - | let | |
256 | + | @Verifier(ai) | |
257 | + | func aj () = { | |
258 | + | let ak = { | |
262 | 259 | let r = w() | |
263 | 260 | if ($isInstanceOf(r, "ByteVector")) | |
264 | 261 | then { | |
266 | 263 | B | |
267 | 264 | } | |
268 | 265 | else if ($isInstanceOf(r, "Unit")) | |
269 | - | then | |
266 | + | then ai.senderPublicKey | |
270 | 267 | else throw("Match error") | |
271 | 268 | } | |
272 | - | sigVerify( | |
269 | + | sigVerify(ai.bodyBytes, ai.proofs[0], ak) | |
273 | 270 | } | |
274 | 271 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "__" | |
5 | 5 | ||
6 | 6 | let b = toBigInt(100000) | |
7 | 7 | ||
8 | 8 | func c (d) = valueOrErrorMessage(getString(this, d), ("No data for this.key=" + d)) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | let e = throw("Pool disabled") | |
12 | 12 | ||
13 | 13 | let f = throw("Pool is not exist") | |
14 | 14 | ||
15 | 15 | let g = throw("Slippage is too big") | |
16 | 16 | ||
17 | 17 | let h = throw("Test error here") | |
18 | 18 | ||
19 | 19 | func i () = "%s__managerPublicKey" | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func j () = "%s__pendingManagerPublicKey" | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func k () = "%s__factoryContract" | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | let l = addressFromStringValue(c(k())) | |
29 | 29 | ||
30 | 30 | func m () = makeString(["%s", "feeLiquidityContractAddress"], a) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func n () = makeString(["%s", "feeLiquidity"], a) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func o () = makeString(["%s", "protocolFee"], a) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func p (q) = { | |
40 | 40 | let r = q | |
41 | 41 | if ($isInstanceOf(r, "Int")) | |
42 | 42 | then { | |
43 | 43 | let s = r | |
44 | 44 | s | |
45 | 45 | } | |
46 | 46 | else throw("fail to cast into Int") | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func t (u,v) = makeString(["%d%d", toString(u), toString(v)], a) | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func w () = { | |
54 | 54 | let r = getString(i()) | |
55 | 55 | if ($isInstanceOf(r, "String")) | |
56 | 56 | then { | |
57 | 57 | let x = r | |
58 | 58 | fromBase58String(x) | |
59 | 59 | } | |
60 | 60 | else if ($isInstanceOf(r, "Unit")) | |
61 | 61 | then unit | |
62 | 62 | else throw("Match error") | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func y () = { | |
67 | 67 | let r = getString(j()) | |
68 | 68 | if ($isInstanceOf(r, "String")) | |
69 | 69 | then { | |
70 | 70 | let x = r | |
71 | 71 | fromBase58String(x) | |
72 | 72 | } | |
73 | 73 | else if ($isInstanceOf(r, "Unit")) | |
74 | 74 | then unit | |
75 | 75 | else throw("Match error") | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func z (A) = { | |
80 | 80 | let r = w() | |
81 | 81 | if ($isInstanceOf(r, "ByteVector")) | |
82 | 82 | then { | |
83 | 83 | let B = r | |
84 | 84 | (A.callerPublicKey == B) | |
85 | 85 | } | |
86 | 86 | else if ($isInstanceOf(r, "Unit")) | |
87 | 87 | then (A.caller == this) | |
88 | 88 | else throw("Match error") | |
89 | 89 | } | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func C (A) = if (z(A)) | |
93 | 93 | then true | |
94 | 94 | else throw("permission denied") | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func D (E) = if ((E == "WAVES")) | |
98 | 98 | then wavesBalance(this).available | |
99 | 99 | else assetBalance(this, fromBase58String(E)) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | @Callable(A) | |
103 | 103 | func swapCalculateREADONLY (F,G,H) = { | |
104 | 104 | let I = value(getInteger(o())) | |
105 | 105 | let J = fraction(toBigInt(F), toBigInt(I), b) | |
106 | 106 | let K = fraction(toBigInt(F), toBigInt(I), b) | |
107 | 107 | let L = (toBigInt(F) - J) | |
108 | 108 | let M = (L - K) | |
109 | 109 | let N = invoke(l, "getLpAssetFromPoolAssetsREADONLY", [G, H], nil) | |
110 | 110 | let O = invoke(l, "getLpAssetFromPoolAssetsREADONLY", [H, G], nil) | |
111 | - | let P = if ((0 == 0)) | |
112 | - | then h | |
113 | - | else h | |
114 | - | let Q = if ((N != unit)) | |
111 | + | let P = if ((N != unit)) | |
115 | 112 | then { | |
116 | - | let | |
117 | - | let | |
118 | - | let | |
119 | - | if ($isInstanceOf( | |
120 | - | then | |
121 | - | else throw(($getType( | |
113 | + | let Q = false | |
114 | + | let R = { | |
115 | + | let S = invoke(l, "getPoolAddressFromLpAssetREADONLY", [N], nil) | |
116 | + | if ($isInstanceOf(S, "Address")) | |
117 | + | then S | |
118 | + | else throw(($getType(S) + " couldn't be cast to Address")) | |
122 | 119 | } | |
123 | - | $Tuple2( | |
120 | + | $Tuple2(Q, R) | |
124 | 121 | } | |
125 | 122 | else if ((O != unit)) | |
126 | 123 | then { | |
127 | - | let | |
128 | - | let | |
129 | - | $Tuple2( | |
124 | + | let Q = true | |
125 | + | let R = invoke(l, "getPoolAddressFromLpAssetREADONLY", [O], nil) | |
126 | + | $Tuple2(Q, R) | |
130 | 127 | } | |
131 | 128 | else h | |
132 | - | let | |
133 | - | let | |
134 | - | let | |
135 | - | let | |
136 | - | if ($isInstanceOf( | |
137 | - | then | |
138 | - | else throw(($getType( | |
129 | + | let Q = P._1 | |
130 | + | let R = P._2 | |
131 | + | let T = { | |
132 | + | let S = invoke(l, "isPoolOneTokenOperationsDisabledREADONLY", [R], nil) | |
133 | + | if ($isInstanceOf(S, "Boolean")) | |
134 | + | then S | |
135 | + | else throw(($getType(S) + " couldn't be cast to Boolean")) | |
139 | 136 | } | |
140 | - | let | |
137 | + | let U = if (T) | |
141 | 138 | then true | |
142 | 139 | else e | |
143 | - | if (( | |
140 | + | if ((U == U)) | |
144 | 141 | then { | |
145 | - | let | |
146 | - | let | |
147 | - | let | |
148 | - | if ($isInstanceOf( | |
149 | - | then | |
150 | - | else throw(($getType( | |
142 | + | let V = addressFromStringValue(valueOrElse(R, "")) | |
143 | + | let W = { | |
144 | + | let S = invoke(V, "calculateAmountOutForSwapREADONLY", [M, Q], nil) | |
145 | + | if ($isInstanceOf(S, "Int")) | |
146 | + | then S | |
147 | + | else throw(($getType(S) + " couldn't be cast to Int")) | |
151 | 148 | } | |
152 | - | $Tuple2(nil, | |
149 | + | $Tuple2(nil, W) | |
153 | 150 | } | |
154 | 151 | else throw("Strict value is not equal to itself.") | |
155 | 152 | } | |
156 | 153 | ||
157 | 154 | ||
158 | 155 | ||
159 | 156 | @Callable(A) | |
160 | - | func swap ( | |
161 | - | let | |
162 | - | let G = if (( | |
157 | + | func swap (X,H,Y) = { | |
158 | + | let Z = value(A.payments[0]) | |
159 | + | let G = if ((Z.assetId == unit)) | |
163 | 160 | then toBytes("WAVES") | |
164 | - | else value( | |
165 | - | let F = value( | |
161 | + | else value(Z.assetId) | |
162 | + | let F = value(Z.amount) | |
166 | 163 | let I = value(getInteger(o())) | |
167 | 164 | let J = fraction(toBigInt(F), toBigInt(I), b) | |
168 | 165 | let K = fraction(toBigInt(F), toBigInt(I), b) | |
169 | 166 | let L = (toBigInt(F) - J) | |
170 | 167 | let M = (L - K) | |
171 | - | let | |
168 | + | let aa = [if ((size(A.payments) == 1)) | |
172 | 169 | then true | |
173 | 170 | else throw("exactly 1 payment are expected")] | |
174 | - | if (( | |
171 | + | if ((aa == aa)) | |
175 | 172 | then { | |
176 | 173 | let N = invoke(l, "getLpAssetFromPoolAssetsREADONLY", [G, H], nil) | |
177 | 174 | let O = invoke(l, "getLpAssetFromPoolAssetsREADONLY", [H, G], nil) | |
178 | - | let | |
175 | + | let ab = if ((N != unit)) | |
179 | 176 | then { | |
180 | - | let | |
181 | - | let | |
182 | - | let | |
183 | - | if ($isInstanceOf( | |
184 | - | then | |
185 | - | else throw(($getType( | |
177 | + | let Q = false | |
178 | + | let R = { | |
179 | + | let S = invoke(l, "getPoolAddressFromLpAssetREADONLY", [N], nil) | |
180 | + | if ($isInstanceOf(S, "Address")) | |
181 | + | then S | |
182 | + | else throw(($getType(S) + " couldn't be cast to Address")) | |
186 | 183 | } | |
187 | - | $Tuple2( | |
184 | + | $Tuple2(Q, R) | |
188 | 185 | } | |
189 | 186 | else if ((O != unit)) | |
190 | 187 | then { | |
191 | - | let | |
192 | - | let | |
193 | - | $Tuple2( | |
188 | + | let Q = true | |
189 | + | let R = invoke(l, "getPoolAddressFromLpAssetREADONLY", [O], nil) | |
190 | + | $Tuple2(Q, R) | |
194 | 191 | } | |
195 | 192 | else f | |
196 | - | let | |
197 | - | let | |
198 | - | let | |
199 | - | let | |
200 | - | if ($isInstanceOf( | |
201 | - | then | |
202 | - | else throw(($getType( | |
193 | + | let Q = ab._1 | |
194 | + | let R = ab._2 | |
195 | + | let T = { | |
196 | + | let S = invoke(l, "isPoolOneTokenOperationsDisabledREADONLY", [R], nil) | |
197 | + | if ($isInstanceOf(S, "Boolean")) | |
198 | + | then S | |
199 | + | else throw(($getType(S) + " couldn't be cast to Boolean")) | |
203 | 200 | } | |
204 | - | let | |
201 | + | let U = if (T) | |
205 | 202 | then true | |
206 | 203 | else e | |
207 | - | if (( | |
204 | + | if ((U == U)) | |
208 | 205 | then { | |
209 | - | let | |
210 | - | let | |
211 | - | let | |
212 | - | if ($isInstanceOf( | |
213 | - | then | |
214 | - | else throw(($getType( | |
206 | + | let V = addressFromStringValue(valueOrElse(R, "")) | |
207 | + | let W = { | |
208 | + | let S = invoke(V, "calculateAmountOutForSwapAndSendTokens", [M, Q, X, Y], [AttachedPayment(G, toInt(L))]) | |
209 | + | if ($isInstanceOf(S, "Boolean")) | |
210 | + | then S | |
211 | + | else throw(($getType(S) + " couldn't be cast to Boolean")) | |
215 | 212 | } | |
216 | - | $Tuple2(nil, | |
213 | + | $Tuple2(nil, W) | |
217 | 214 | } | |
218 | 215 | else throw("Strict value is not equal to itself.") | |
219 | 216 | } | |
220 | 217 | else throw("Strict value is not equal to itself.") | |
221 | 218 | } | |
222 | 219 | ||
223 | 220 | ||
224 | 221 | ||
225 | 222 | @Callable(A) | |
226 | - | func setManager ( | |
227 | - | let | |
228 | - | if (( | |
223 | + | func setManager (ac) = { | |
224 | + | let ad = C(A) | |
225 | + | if ((ad == ad)) | |
229 | 226 | then { | |
230 | - | let | |
231 | - | if (( | |
232 | - | then [StringEntry(j(), | |
227 | + | let ae = fromBase58String(ac) | |
228 | + | if ((ae == ae)) | |
229 | + | then [StringEntry(j(), ac)] | |
233 | 230 | else throw("Strict value is not equal to itself.") | |
234 | 231 | } | |
235 | 232 | else throw("Strict value is not equal to itself.") | |
236 | 233 | } | |
237 | 234 | ||
238 | 235 | ||
239 | 236 | ||
240 | 237 | @Callable(A) | |
241 | 238 | func confirmManager () = { | |
242 | - | let | |
243 | - | let | |
239 | + | let af = y() | |
240 | + | let ag = if (isDefined(af)) | |
244 | 241 | then true | |
245 | 242 | else throw("no pending manager") | |
246 | - | if (( | |
243 | + | if ((ag == ag)) | |
247 | 244 | then { | |
248 | - | let | |
245 | + | let ah = if ((A.callerPublicKey == value(af))) | |
249 | 246 | then true | |
250 | 247 | else throw("you are not pending manager") | |
251 | - | if (( | |
252 | - | then [StringEntry(i(), toBase58String(value( | |
248 | + | if ((ah == ah)) | |
249 | + | then [StringEntry(i(), toBase58String(value(af))), DeleteEntry(j())] | |
253 | 250 | else throw("Strict value is not equal to itself.") | |
254 | 251 | } | |
255 | 252 | else throw("Strict value is not equal to itself.") | |
256 | 253 | } | |
257 | 254 | ||
258 | 255 | ||
259 | - | @Verifier( | |
260 | - | func | |
261 | - | let | |
256 | + | @Verifier(ai) | |
257 | + | func aj () = { | |
258 | + | let ak = { | |
262 | 259 | let r = w() | |
263 | 260 | if ($isInstanceOf(r, "ByteVector")) | |
264 | 261 | then { | |
265 | 262 | let B = r | |
266 | 263 | B | |
267 | 264 | } | |
268 | 265 | else if ($isInstanceOf(r, "Unit")) | |
269 | - | then | |
266 | + | then ai.senderPublicKey | |
270 | 267 | else throw("Match error") | |
271 | 268 | } | |
272 | - | sigVerify( | |
269 | + | sigVerify(ai.bodyBytes, ai.proofs[0], ak) | |
273 | 270 | } | |
274 | 271 |
github/deemru/w8io/169f3d6 65.39 ms ◑