tx · Cdk7XcRrAf9juYt4Zs8evbcheNVAfAqTCdjeNHidQatG 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01600000 Waves 2022.12.27 13:01 [2378533] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "Cdk7XcRrAf9juYt4Zs8evbcheNVAfAqTCdjeNHidQatG", "fee": 1600000, "feeAssetId": null, "timestamp": 1672135305797, "version": 1, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "2irAKKufh5a3bUcLy4Lws1nyqWw7JdELwQyyzNNihTLzqZ7Ye191BxMVPtjLiJr1vcFzqtbB8T9NDKsYoEfkpqKk" ], "script": "base64:AAIFAAAAAAAABrcIAhIICgYICBgBCAESABIICgYICAgICAgSAwoBGBIDCgEIEgASABIECgIICCIDU0VQIgx3YXZlc0Fzc2V0SWQiEWludmFsaWRQcmljZUFzc2V0Igh0aHJvd0VyciIDbXNnIgd0aHJvd1BEIhR0aHJvd0NyZWF0ZU5vdENhbGxlZCIRdGhyb3dZb3VOb3RJc3N1ZXIiD3Rocm93UG9vbEV4aXN0cyIVdGhyb3dBc3NldE5vdFZlcmlmaWVkIhZ0aHJvd0ludmFsaWRQcmljZUFzc2V0IhR0aHJvd0ludmFsaWRGZWVBc3NldCIXdGhyb3dJbnZhbGlkQW1vdW50QXNzZXQiEnRocm93SW52YWxpZFN0YXR1cyIfdGhyb3dDYW5BY3RpdmF0ZU9ubHlQZW5kaW5nUG9vbCIddGhyb3dGYWN0b3J5UmV0dXJuZWROb3RTdHJpbmciHHRocm93SW52YWxpZFByaWNlQXNzZXRBbW91bnQiD3Rocm93SW52YWxpZEZlZSITa2V5TWFuYWdlclB1YmxpY0tleSIaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkiD2tleUFkbWluU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CeXRlVmVjdG9yBAAAAAJhZQUAAAABVgUAAAACYWUDCQAAAQAAAAIFAAAAAVYCAAAABFVuaXQIBQAAAAJiZAAAAA9zZW5kZXJQdWJsaWNLZXkJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IJAAH0AAAAAwgFAAAAAmJkAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACYmQAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAJiZq2zsJg=", "chainId": 84, "height": 2378533, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: NE2P4uUgGGCHLjRNNrpprfmqqAxYkBwFCNaLdUrakda Next: BgGeeMic4DPdVhuaB1f3KHFZfMZ5VKbunSfru6S416Yt Diff:
Old | New | Differences | |
---|---|---|---|
281 | 281 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
282 | 282 | if ((beforePut == beforePut)) | |
283 | 283 | then { | |
284 | - | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
284 | + | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(if ((amountAssetId == "WAVES")) | |
285 | + | then unit | |
286 | + | else fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
285 | 287 | then unit | |
286 | 288 | else fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
287 | 289 | if ((put == put)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let wavesAssetId = "WAVES" | |
7 | 7 | ||
8 | 8 | let invalidPriceAsset = "Invalid price asset" | |
9 | 9 | ||
10 | 10 | func throwErr (msg) = throw(makeString(["user_pools.ride:", msg], " ")) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func throwPD () = throwErr("Permission denied") | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func throwCreateNotCalled () = throwErr("Create is not called for assets pair") | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func throwYouNotIssuer () = throwErr("You are not amountAsset issuer") | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func throwPoolExists () = throwErr("Pool with such assets already exists") | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func throwAssetNotVerified () = throwErr("Asset is not verified") | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func throwInvalidPriceAsset () = throwErr(invalidPriceAsset) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func throwInvalidFeeAsset () = throwErr("Invalid fee asset") | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func throwInvalidAmountAsset () = throwErr("Invalid amount asset attached") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func throwInvalidStatus () = throwErr("Invalid status") | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func throwCanActivateOnlyPendingPool () = throwErr("Can activate pool only in 'pending' status") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func throwFactoryReturnedNotString () = throwErr("FactoryV2 returned not string") | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func throwInvalidPriceAssetAmount () = throwErr("invalid price asset amount") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func throwInvalidFee () = throwErr("invalid fee") | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func keyAdminPubKeys () = makeString(["%s", "adminPubKeys"], SEP) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func keyStatus (amountAssetId,priceAssetId) = makeString(["%s%s%s", "status", amountAssetId, priceAssetId], SEP) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func keyFactoryContract () = makeString(["%s", "factoryContract"], SEP) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func keySuffix (amountAssetId,priceAssetId) = makeString(["%s%s%s", "suffix", amountAssetId, priceAssetId], SEP) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func keyLastIndex () = makeString(["%s", "lastIndex"], SEP) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | let indexSuffix = "u" | |
77 | 77 | ||
78 | 78 | let statusPending = "pending" | |
79 | 79 | ||
80 | 80 | let statusDeclined = "declined" | |
81 | 81 | ||
82 | 82 | let statusActive = "active" | |
83 | 83 | ||
84 | 84 | let statuses = [statusPending, statusDeclined, statusActive] | |
85 | 85 | ||
86 | 86 | func keyCreateCalled (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCalled", amountAssetId, priceAssetId], SEP) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func keyCreateCaller (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCaller", amountAssetId, priceAssetId], SEP) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func keyAmountAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "amountAssetAmount", amountAssetId, priceAssetId], SEP) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func keyPriceAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "priceAssetAmount", amountAssetId, priceAssetId], SEP) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func keyHeight (amountAssetId,priceAssetId) = makeString(["%s%s%s", "height", amountAssetId, priceAssetId], SEP) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func keyFeeAssetId () = makeString(["%s", "feeAssetId"], SEP) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func keyFeeAmount () = makeString(["%s", "feeAmount"], SEP) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func keyAmountAssetMinAmount () = makeString(["%s", "amountAssetMinAmount"], SEP) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func keyPriceAssetsMinAmount () = makeString(["%s", "priceAssetsMinAmount"], SEP) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func keyPriceAssets () = makeString(["%s", "priceAssets"], SEP) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func stringOptionToList (stringOrUnit) = match stringOrUnit { | |
120 | 120 | case s: String => | |
121 | 121 | if ((size(s) == 0)) | |
122 | 122 | then nil | |
123 | 123 | else split(s, SEP) | |
124 | 124 | case _: Unit => | |
125 | 125 | nil | |
126 | 126 | case _ => | |
127 | 127 | throw("Match error") | |
128 | 128 | } | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract())) | |
132 | 132 | ||
133 | 133 | func isCreateCalled (amountAssetId,priceAssetId) = valueOrElse(getBoolean(keyCreateCalled(amountAssetId, priceAssetId)), false) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func mustCreateCalled (amountAssetId,priceAssetId) = if (isCreateCalled(amountAssetId, priceAssetId)) | |
137 | 137 | then true | |
138 | 138 | else throwCreateNotCalled() | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
142 | 142 | case s: String => | |
143 | 143 | fromBase58String(s) | |
144 | 144 | case _: Unit => | |
145 | 145 | unit | |
146 | 146 | case _ => | |
147 | 147 | throw("Match error") | |
148 | 148 | } | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
152 | 152 | case s: String => | |
153 | 153 | fromBase58String(s) | |
154 | 154 | case _: Unit => | |
155 | 155 | unit | |
156 | 156 | case _ => | |
157 | 157 | throw("Match error") | |
158 | 158 | } | |
159 | 159 | ||
160 | 160 | ||
161 | 161 | func isManager (i) = match managerPublicKeyOrUnit() { | |
162 | 162 | case pk: ByteVector => | |
163 | 163 | (i.callerPublicKey == pk) | |
164 | 164 | case _: Unit => | |
165 | 165 | (i.caller == this) | |
166 | 166 | case _ => | |
167 | 167 | throw("Match error") | |
168 | 168 | } | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func mustManager (i) = if (isManager(i)) | |
172 | 172 | then true | |
173 | 173 | else throwPD() | |
174 | 174 | ||
175 | 175 | ||
176 | 176 | func mustAdmin (i) = { | |
177 | 177 | let adminPKs = stringOptionToList(getString(keyAdminPubKeys())) | |
178 | 178 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
179 | 179 | then true | |
180 | 180 | else mustManager(i) | |
181 | 181 | } | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(getStringOrFail(keyAssetsStoreContract())), (("status_<" + assetId) + ">")), 0) == 2) | |
185 | 185 | ||
186 | 186 | ||
187 | 187 | func getIdAndInfo (payment) = match payment.assetId { | |
188 | 188 | case id: ByteVector => | |
189 | 189 | let info = value(assetInfo(id)) | |
190 | 190 | $Tuple2(toBase58String(id), info) | |
191 | 191 | case _: Unit => | |
192 | 192 | $Tuple2(wavesAssetId, unit) | |
193 | 193 | case _ => | |
194 | 194 | throw("Match error") | |
195 | 195 | } | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func validStatus (status) = containsElement(statuses, status) | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | @Callable(i) | |
202 | 202 | func constructor (factoryV2Address,assetsStoreAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
203 | 203 | let checkCaller = mustManager(i) | |
204 | 204 | if ((checkCaller == checkCaller)) | |
205 | 205 | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
206 | 206 | else throw("Strict value is not equal to itself.") | |
207 | 207 | } | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | 211 | @Callable(i) | |
212 | 212 | func create () = { | |
213 | 213 | let amountAssetPayment = value(i.payments[0]) | |
214 | 214 | let priceAssetPayment = value(i.payments[1]) | |
215 | 215 | let feeAssetPayment = value(i.payments[2]) | |
216 | 216 | let $t064926564 = getIdAndInfo(amountAssetPayment) | |
217 | 217 | let amountAssetId = $t064926564._1 | |
218 | 218 | let amountAssetInfo = $t064926564._2 | |
219 | 219 | let $t065676636 = getIdAndInfo(priceAssetPayment) | |
220 | 220 | let priceAssetId = $t065676636._1 | |
221 | 221 | let priceAssetInfo = $t065676636._2 | |
222 | 222 | let $t066396702 = getIdAndInfo(feeAssetPayment) | |
223 | 223 | let feeAssetId = $t066396702._1 | |
224 | 224 | let feeAssetInfo = $t066396702._2 | |
225 | 225 | let priceAssetsList = stringOptionToList(getString(factoryContract, keyPriceAssets())) | |
226 | 226 | let managerPriceAssetMinAmount = 1 | |
227 | 227 | let priceAssetMinAmount = if (isManager(i)) | |
228 | 228 | then managerPriceAssetMinAmount | |
229 | 229 | else { | |
230 | 230 | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
231 | 231 | value(parseInt(stringOptionToList(getString(keyPriceAssetsMinAmount()))[priceAssetsIndex])) | |
232 | 232 | } | |
233 | 233 | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
234 | 234 | let curIndex = (lastIndex + 1) | |
235 | 235 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
236 | 236 | then true | |
237 | 237 | else throwPoolExists(), if (if (isManager(i)) | |
238 | 238 | then true | |
239 | 239 | else isVerified(amountAssetId)) | |
240 | 240 | then true | |
241 | 241 | else throwAssetNotVerified(), if ((getString(keyFeeAssetId()) == feeAssetId)) | |
242 | 242 | then true | |
243 | 243 | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
244 | 244 | then true | |
245 | 245 | else (amountAssetPayment.amount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
246 | 246 | then true | |
247 | 247 | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
248 | 248 | then true | |
249 | 249 | else (priceAssetPayment.amount >= priceAssetMinAmount)) | |
250 | 250 | then true | |
251 | 251 | else throwInvalidPriceAssetAmount(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
252 | 252 | then true | |
253 | 253 | else throwInvalidFee()] | |
254 | 254 | if ((checks == checks)) | |
255 | 255 | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), StringEntry(keyCreateCaller(amountAssetId, priceAssetId), toString(i.caller)), IntegerEntry(keyLastIndex(), curIndex), StringEntry(keySuffix(amountAssetId, priceAssetId), (toString(curIndex) + indexSuffix)), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetPayment.amount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetPayment.amount)] | |
256 | 256 | else throw("Strict value is not equal to itself.") | |
257 | 257 | } | |
258 | 258 | ||
259 | 259 | ||
260 | 260 | ||
261 | 261 | @Callable(i) | |
262 | 262 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker,logo) = { | |
263 | 263 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
264 | 264 | then true | |
265 | 265 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
266 | 266 | then true | |
267 | 267 | else throwCanActivateOnlyPendingPool()] | |
268 | 268 | if ((checks == checks)) | |
269 | 269 | then { | |
270 | 270 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL", logo], nil) | |
271 | 271 | if ((activateNewPoolInv == activateNewPoolInv)) | |
272 | 272 | then { | |
273 | 273 | let lpAssetId = match activateNewPoolInv { | |
274 | 274 | case id: String => | |
275 | 275 | id | |
276 | 276 | case _ => | |
277 | 277 | throwFactoryReturnedNotString() | |
278 | 278 | } | |
279 | 279 | if ((lpAssetId == lpAssetId)) | |
280 | 280 | then { | |
281 | 281 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
282 | 282 | if ((beforePut == beforePut)) | |
283 | 283 | then { | |
284 | - | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
284 | + | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(if ((amountAssetId == "WAVES")) | |
285 | + | then unit | |
286 | + | else fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
285 | 287 | then unit | |
286 | 288 | else fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
287 | 289 | if ((put == put)) | |
288 | 290 | then { | |
289 | 291 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
290 | 292 | if ((afterPut == afterPut)) | |
291 | 293 | then { | |
292 | 294 | let user = value(addressFromString(value(getString(keyCreateCaller(amountAssetId, priceAssetId))))) | |
293 | 295 | [StringEntry(keyStatus(amountAssetId, priceAssetId), statusActive), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
294 | 296 | } | |
295 | 297 | else throw("Strict value is not equal to itself.") | |
296 | 298 | } | |
297 | 299 | else throw("Strict value is not equal to itself.") | |
298 | 300 | } | |
299 | 301 | else throw("Strict value is not equal to itself.") | |
300 | 302 | } | |
301 | 303 | else throw("Strict value is not equal to itself.") | |
302 | 304 | } | |
303 | 305 | else throw("Strict value is not equal to itself.") | |
304 | 306 | } | |
305 | 307 | else throw("Strict value is not equal to itself.") | |
306 | 308 | } | |
307 | 309 | ||
308 | 310 | ||
309 | 311 | ||
310 | 312 | @Callable(i) | |
311 | 313 | func setAdmins (adminPubKeys) = { | |
312 | 314 | let checkCaller = mustManager(i) | |
313 | 315 | if ((checkCaller == checkCaller)) | |
314 | 316 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
315 | 317 | else throw("Strict value is not equal to itself.") | |
316 | 318 | } | |
317 | 319 | ||
318 | 320 | ||
319 | 321 | ||
320 | 322 | @Callable(i) | |
321 | 323 | func setManager (pendingManagerPublicKey) = { | |
322 | 324 | let checkCaller = mustManager(i) | |
323 | 325 | if ((checkCaller == checkCaller)) | |
324 | 326 | then { | |
325 | 327 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
326 | 328 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
327 | 329 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
328 | 330 | else throw("Strict value is not equal to itself.") | |
329 | 331 | } | |
330 | 332 | else throw("Strict value is not equal to itself.") | |
331 | 333 | } | |
332 | 334 | ||
333 | 335 | ||
334 | 336 | ||
335 | 337 | @Callable(i) | |
336 | 338 | func confirmManager () = { | |
337 | 339 | let pm = pendingManagerPublicKeyOrUnit() | |
338 | 340 | let hasPM = if (isDefined(pm)) | |
339 | 341 | then true | |
340 | 342 | else throw("No pending manager") | |
341 | 343 | if ((hasPM == hasPM)) | |
342 | 344 | then { | |
343 | 345 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
344 | 346 | then true | |
345 | 347 | else throw("You are not pending manager") | |
346 | 348 | if ((checkPM == checkPM)) | |
347 | 349 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
348 | 350 | else throw("Strict value is not equal to itself.") | |
349 | 351 | } | |
350 | 352 | else throw("Strict value is not equal to itself.") | |
351 | 353 | } | |
352 | 354 | ||
353 | 355 | ||
354 | 356 | ||
355 | 357 | @Callable(i) | |
356 | 358 | func priceAssetsREADONLY () = $Tuple2(nil, stringOptionToList(getString(keyPriceAssets()))) | |
357 | 359 | ||
358 | 360 | ||
359 | 361 | ||
360 | 362 | @Callable(i) | |
361 | 363 | func statusREADONLY (amountAssetId,priceAssetId) = { | |
362 | 364 | let status = match getString(keyStatus(amountAssetId, priceAssetId)) { | |
363 | 365 | case s: String => | |
364 | 366 | s | |
365 | 367 | case _ => | |
366 | 368 | unit | |
367 | 369 | } | |
368 | 370 | $Tuple2(nil, status) | |
369 | 371 | } | |
370 | 372 | ||
371 | 373 | ||
372 | 374 | @Verifier(tx) | |
373 | 375 | func verify () = { | |
374 | 376 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
375 | 377 | case pk: ByteVector => | |
376 | 378 | pk | |
377 | 379 | case _: Unit => | |
378 | 380 | tx.senderPublicKey | |
379 | 381 | case _ => | |
380 | 382 | throw("Match error") | |
381 | 383 | } | |
382 | 384 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
383 | 385 | } | |
384 | 386 |
github/deemru/w8io/fabc49c 42.39 ms ◑