tx · At5ie36JTGMoKjY9yft8zi7aBGFe55GmZy8NV4nTfMJ8 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01600000 Waves 2023.03.10 12:12 [2483781] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "At5ie36JTGMoKjY9yft8zi7aBGFe55GmZy8NV4nTfMJ8", "fee": 1600000, "feeAssetId": null, "timestamp": 1678439560068, "version": 2, "chainId": 84, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "28CG3Ns1HBqutqVNXnh1VUmEq2K6aXKwqRfXUq8r5y8dHfiwadP9SbxsiWreTUX4d7Te3Bfsv6teYL9L2niP2Nvc" ], "script": "base64:AAIFAAAAAAAABxAIAhIJCgcICAgYAQgBEgASCAoGCAgICAgIEgMKARgSAwoBCBIAEgASBAoCCAgiA1NFUCIMd2F2ZXNBc3NldElkIhFpbnZhbGlkUHJpY2VBc3NldCIIdGhyb3dFcnIiA21zZyIHdGhyb3dQRCIUdGhyb3dDcmVhdGVOb3RDYWxsZWQiEXRocm93WW91Tm90SXNzdWVyIg90aHJvd1Bvb2xFeGlzdHMiFXRocm93QXNzZXROb3RWZXJpZmllZCIWdGhyb3dJbnZhbGlkUHJpY2VBc3NldCIUdGhyb3dJbnZhbGlkRmVlQXNzZXQiF3Rocm93SW52YWxpZEFtb3VudEFzc2V0IhJ0aHJvd0ludmFsaWRTdGF0dXMiH3Rocm93Q2FuQWN0aXZhdGVPbmx5UGVuZGluZ1Bvb2wiHXRocm93RmFjdG9yeVJldHVybmVkTm90U3RyaW5nIhx0aHJvd0ludmFsaWRQcmljZUFzc2V0QW1vdW50Ig90aHJvd0ludmFsaWRGZWUiE2tleU1hbmFnZXJQdWJsaWNLZXkiGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS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5r6Gw==", "height": 2483781, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Cyajd2Rr8jF1ArwyNCetTfe1aSMdwsE69GbyTkdZt9YM Next: 4mxuGq5uWxUJ8vLPHGSTLsHrPCnicNcpaTC3oSs7Q1Gy Diff:
Old | New | Differences | |
---|---|---|---|
244 | 244 | } | |
245 | 245 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
246 | 246 | then true | |
247 | - | else throwPoolExists(), if (poolExists) | |
247 | + | else throwPoolExists(), if (!(poolExists)) | |
248 | 248 | then true | |
249 | 249 | else throwPoolExists(), if (if (isManager(i)) | |
250 | 250 | then true |
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 keyEmissionContract () = makeString(["%s", "emissionContract"], SEP) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func keySuffix (amountAssetId,priceAssetId) = makeString(["%s%s%s", "suffix", amountAssetId, priceAssetId], SEP) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func keyLastIndex () = makeString(["%s", "lastIndex"], SEP) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | let indexSuffix = "u" | |
80 | 80 | ||
81 | 81 | let statusPending = "pending" | |
82 | 82 | ||
83 | 83 | let statusDeclined = "declined" | |
84 | 84 | ||
85 | 85 | let statusActive = "active" | |
86 | 86 | ||
87 | 87 | let statuses = [statusPending, statusDeclined, statusActive] | |
88 | 88 | ||
89 | 89 | func keyCreateCalled (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCalled", amountAssetId, priceAssetId], SEP) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func keyCreateCaller (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCaller", amountAssetId, priceAssetId], SEP) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func keyAmountAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "amountAssetAmount", amountAssetId, priceAssetId], SEP) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func keyPriceAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "priceAssetAmount", amountAssetId, priceAssetId], SEP) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func keyHeight (amountAssetId,priceAssetId) = makeString(["%s%s%s", "height", amountAssetId, priceAssetId], SEP) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func keyFeeAssetId () = makeString(["%s", "feeAssetId"], SEP) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func keyFeeAmount () = makeString(["%s", "feeAmount"], SEP) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func keyAmountAssetMinAmount () = makeString(["%s", "amountAssetMinAmount"], SEP) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func keyPriceAssetsMinAmount () = makeString(["%s", "priceAssetsMinAmount"], SEP) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func keyPriceAssets () = makeString(["%s", "priceAssets"], SEP) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func stringOptionToList (stringOrUnit) = match stringOrUnit { | |
123 | 123 | case s: String => | |
124 | 124 | if ((size(s) == 0)) | |
125 | 125 | then nil | |
126 | 126 | else split(s, SEP) | |
127 | 127 | case _: Unit => | |
128 | 128 | nil | |
129 | 129 | case _ => | |
130 | 130 | throw("Match error") | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract())) | |
135 | 135 | ||
136 | 136 | func isCreateCalled (amountAssetId,priceAssetId) = valueOrElse(getBoolean(keyCreateCalled(amountAssetId, priceAssetId)), false) | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func mustCreateCalled (amountAssetId,priceAssetId) = if (isCreateCalled(amountAssetId, priceAssetId)) | |
140 | 140 | then true | |
141 | 141 | else throwCreateNotCalled() | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
145 | 145 | case s: String => | |
146 | 146 | fromBase58String(s) | |
147 | 147 | case _: Unit => | |
148 | 148 | unit | |
149 | 149 | case _ => | |
150 | 150 | throw("Match error") | |
151 | 151 | } | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
155 | 155 | case s: String => | |
156 | 156 | fromBase58String(s) | |
157 | 157 | case _: Unit => | |
158 | 158 | unit | |
159 | 159 | case _ => | |
160 | 160 | throw("Match error") | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | func isManager (i) = match managerPublicKeyOrUnit() { | |
165 | 165 | case pk: ByteVector => | |
166 | 166 | (i.callerPublicKey == pk) | |
167 | 167 | case _: Unit => | |
168 | 168 | (i.caller == this) | |
169 | 169 | case _ => | |
170 | 170 | throw("Match error") | |
171 | 171 | } | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func mustManager (i) = if (isManager(i)) | |
175 | 175 | then true | |
176 | 176 | else throwPD() | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | func mustAdmin (i) = { | |
180 | 180 | let adminPKs = stringOptionToList(getString(keyAdminPubKeys())) | |
181 | 181 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
182 | 182 | then true | |
183 | 183 | else mustManager(i) | |
184 | 184 | } | |
185 | 185 | ||
186 | 186 | ||
187 | 187 | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(getStringOrFail(keyAssetsStoreContract())), (("status_<" + assetId) + ">")), 0) == 2) | |
188 | 188 | ||
189 | 189 | ||
190 | 190 | func getIdAndInfo (payment) = match payment.assetId { | |
191 | 191 | case id: ByteVector => | |
192 | 192 | let info = value(assetInfo(id)) | |
193 | 193 | $Tuple2(toBase58String(id), info) | |
194 | 194 | case _: Unit => | |
195 | 195 | $Tuple2(wavesAssetId, unit) | |
196 | 196 | case _ => | |
197 | 197 | throw("Match error") | |
198 | 198 | } | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | func validStatus (status) = containsElement(statuses, status) | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | @Callable(i) | |
205 | 205 | func constructor (factoryV2Address,assetsStoreAddress,emissionAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
206 | 206 | let checkCaller = mustManager(i) | |
207 | 207 | if ((checkCaller == checkCaller)) | |
208 | 208 | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyEmissionContract(), emissionAddress), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
209 | 209 | else throw("Strict value is not equal to itself.") | |
210 | 210 | } | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | ||
214 | 214 | @Callable(i) | |
215 | 215 | func create () = { | |
216 | 216 | let amountAssetPayment = value(i.payments[0]) | |
217 | 217 | let priceAssetPayment = value(i.payments[1]) | |
218 | 218 | let feeAssetPayment = value(i.payments[2]) | |
219 | 219 | let $t066466718 = getIdAndInfo(amountAssetPayment) | |
220 | 220 | let amountAssetId = $t066466718._1 | |
221 | 221 | let amountAssetInfo = $t066466718._2 | |
222 | 222 | let $t067216790 = getIdAndInfo(priceAssetPayment) | |
223 | 223 | let priceAssetId = $t067216790._1 | |
224 | 224 | let priceAssetInfo = $t067216790._2 | |
225 | 225 | let $t067936856 = getIdAndInfo(feeAssetPayment) | |
226 | 226 | let feeAssetId = $t067936856._1 | |
227 | 227 | let feeAssetInfo = $t067936856._2 | |
228 | 228 | let priceAssetsList = stringOptionToList(getString(factoryContract, keyPriceAssets())) | |
229 | 229 | let managerPriceAssetMinAmount = 1 | |
230 | 230 | let priceAssetMinAmount = if (isManager(i)) | |
231 | 231 | then managerPriceAssetMinAmount | |
232 | 232 | else { | |
233 | 233 | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
234 | 234 | value(parseInt(stringOptionToList(getString(keyPriceAssetsMinAmount()))[priceAssetsIndex])) | |
235 | 235 | } | |
236 | 236 | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
237 | 237 | let curIndex = (lastIndex + 1) | |
238 | 238 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
239 | 239 | let poolExists = { | |
240 | 240 | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
241 | 241 | if ($isInstanceOf(@, "Boolean")) | |
242 | 242 | then @ | |
243 | 243 | else throw("Couldn't cast Any to Boolean") | |
244 | 244 | } | |
245 | 245 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
246 | 246 | then true | |
247 | - | else throwPoolExists(), if (poolExists) | |
247 | + | else throwPoolExists(), if (!(poolExists)) | |
248 | 248 | then true | |
249 | 249 | else throwPoolExists(), if (if (isManager(i)) | |
250 | 250 | then true | |
251 | 251 | else isVerified(amountAssetId)) | |
252 | 252 | then true | |
253 | 253 | else throwAssetNotVerified(), if ((getString(keyFeeAssetId()) == feeAssetId)) | |
254 | 254 | then true | |
255 | 255 | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
256 | 256 | then true | |
257 | 257 | else (amountAssetPayment.amount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
258 | 258 | then true | |
259 | 259 | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
260 | 260 | then true | |
261 | 261 | else (priceAssetPayment.amount >= priceAssetMinAmount)) | |
262 | 262 | then true | |
263 | 263 | else throwInvalidPriceAssetAmount(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
264 | 264 | then true | |
265 | 265 | else throwInvalidFee()] | |
266 | 266 | if ((checks == checks)) | |
267 | 267 | then { | |
268 | 268 | let burnEmissionInv = invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
269 | 269 | if ((burnEmissionInv == burnEmissionInv)) | |
270 | 270 | 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)] | |
271 | 271 | else throw("Strict value is not equal to itself.") | |
272 | 272 | } | |
273 | 273 | else throw("Strict value is not equal to itself.") | |
274 | 274 | } | |
275 | 275 | ||
276 | 276 | ||
277 | 277 | ||
278 | 278 | @Callable(i) | |
279 | 279 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker,logo) = { | |
280 | 280 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
281 | 281 | then true | |
282 | 282 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
283 | 283 | then true | |
284 | 284 | else throwCanActivateOnlyPendingPool()] | |
285 | 285 | if ((checks == checks)) | |
286 | 286 | then { | |
287 | 287 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL", logo], nil) | |
288 | 288 | if ((activateNewPoolInv == activateNewPoolInv)) | |
289 | 289 | then { | |
290 | 290 | let lpAssetId = match activateNewPoolInv { | |
291 | 291 | case id: String => | |
292 | 292 | id | |
293 | 293 | case _ => | |
294 | 294 | throwFactoryReturnedNotString() | |
295 | 295 | } | |
296 | 296 | if ((lpAssetId == lpAssetId)) | |
297 | 297 | then { | |
298 | 298 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
299 | 299 | if ((beforePut == beforePut)) | |
300 | 300 | then { | |
301 | 301 | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(if ((amountAssetId == "WAVES")) | |
302 | 302 | then unit | |
303 | 303 | else fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
304 | 304 | then unit | |
305 | 305 | else fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
306 | 306 | if ((put == put)) | |
307 | 307 | then { | |
308 | 308 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
309 | 309 | if ((afterPut == afterPut)) | |
310 | 310 | then { | |
311 | 311 | let user = value(addressFromString(value(getString(keyCreateCaller(amountAssetId, priceAssetId))))) | |
312 | 312 | [StringEntry(keyStatus(amountAssetId, priceAssetId), statusActive), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
313 | 313 | } | |
314 | 314 | else throw("Strict value is not equal to itself.") | |
315 | 315 | } | |
316 | 316 | else throw("Strict value is not equal to itself.") | |
317 | 317 | } | |
318 | 318 | else throw("Strict value is not equal to itself.") | |
319 | 319 | } | |
320 | 320 | else throw("Strict value is not equal to itself.") | |
321 | 321 | } | |
322 | 322 | else throw("Strict value is not equal to itself.") | |
323 | 323 | } | |
324 | 324 | else throw("Strict value is not equal to itself.") | |
325 | 325 | } | |
326 | 326 | ||
327 | 327 | ||
328 | 328 | ||
329 | 329 | @Callable(i) | |
330 | 330 | func setAdmins (adminPubKeys) = { | |
331 | 331 | let checkCaller = mustManager(i) | |
332 | 332 | if ((checkCaller == checkCaller)) | |
333 | 333 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
334 | 334 | else throw("Strict value is not equal to itself.") | |
335 | 335 | } | |
336 | 336 | ||
337 | 337 | ||
338 | 338 | ||
339 | 339 | @Callable(i) | |
340 | 340 | func setManager (pendingManagerPublicKey) = { | |
341 | 341 | let checkCaller = mustManager(i) | |
342 | 342 | if ((checkCaller == checkCaller)) | |
343 | 343 | then { | |
344 | 344 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
345 | 345 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
346 | 346 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
347 | 347 | else throw("Strict value is not equal to itself.") | |
348 | 348 | } | |
349 | 349 | else throw("Strict value is not equal to itself.") | |
350 | 350 | } | |
351 | 351 | ||
352 | 352 | ||
353 | 353 | ||
354 | 354 | @Callable(i) | |
355 | 355 | func confirmManager () = { | |
356 | 356 | let pm = pendingManagerPublicKeyOrUnit() | |
357 | 357 | let hasPM = if (isDefined(pm)) | |
358 | 358 | then true | |
359 | 359 | else throw("No pending manager") | |
360 | 360 | if ((hasPM == hasPM)) | |
361 | 361 | then { | |
362 | 362 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
363 | 363 | then true | |
364 | 364 | else throw("You are not pending manager") | |
365 | 365 | if ((checkPM == checkPM)) | |
366 | 366 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
367 | 367 | else throw("Strict value is not equal to itself.") | |
368 | 368 | } | |
369 | 369 | else throw("Strict value is not equal to itself.") | |
370 | 370 | } | |
371 | 371 | ||
372 | 372 | ||
373 | 373 | ||
374 | 374 | @Callable(i) | |
375 | 375 | func priceAssetsREADONLY () = $Tuple2(nil, stringOptionToList(getString(keyPriceAssets()))) | |
376 | 376 | ||
377 | 377 | ||
378 | 378 | ||
379 | 379 | @Callable(i) | |
380 | 380 | func statusREADONLY (amountAssetId,priceAssetId) = { | |
381 | 381 | let status = match getString(keyStatus(amountAssetId, priceAssetId)) { | |
382 | 382 | case s: String => | |
383 | 383 | s | |
384 | 384 | case _ => | |
385 | 385 | unit | |
386 | 386 | } | |
387 | 387 | $Tuple2(nil, status) | |
388 | 388 | } | |
389 | 389 | ||
390 | 390 | ||
391 | 391 | @Verifier(tx) | |
392 | 392 | func verify () = { | |
393 | 393 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
394 | 394 | case pk: ByteVector => | |
395 | 395 | pk | |
396 | 396 | case _: Unit => | |
397 | 397 | tx.senderPublicKey | |
398 | 398 | case _ => | |
399 | 399 | throw("Match error") | |
400 | 400 | } | |
401 | 401 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
402 | 402 | } | |
403 | 403 |
github/deemru/w8io/026f985 62.17 ms ◑