tx · 6auC8CGrFJNquH4D9jrbHuDaoPgXtB6txhBvjpkRP2zd 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01600000 Waves 2023.02.27 12:42 [2467950] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "6auC8CGrFJNquH4D9jrbHuDaoPgXtB6txhBvjpkRP2zd", "fee": 1600000, "feeAssetId": null, "timestamp": 1677490961070, "version": 1, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "2g1LBxwvW25YL4yxZvsJYVHpmLnqMx2ch8BVLzMRsuuBFUYYyFqYJdMR7drQK5kcGUWPu1scMMyAuyJvKDgxNg7P" ], "script": "base64:AAIFAAAAAAAABwEIAhIJCgcICAgYAQgBEgASCAoGCAgICAgIEgMKARgSAwoBCBIAEgASBAoCCAgiA1NFUCIMd2F2ZXNBc3NldElkIhFpbnZhbGlkUHJpY2VBc3NldCIIdGhyb3dFcnIiA21zZyIHdGhyb3dQRCIUdGhyb3dDcmVhdGVOb3RDYWxsZWQiEXRocm93WW91Tm90SXNzdWVyIg90aHJvd1Bvb2xFeGlzdHMiFXRocm93QXNzZXROb3RWZXJpZmllZCIWdGhyb3dJbnZhbGlkUHJpY2VBc3NldCIUdGhyb3dJbnZhbGlkRmVlQXNzZXQiF3Rocm93SW52YWxpZEFtb3VudEFzc2V0IhJ0aHJvd0ludmFsaWRTdGF0dXMiH3Rocm93Q2FuQWN0aXZhdGVPbmx5UGVuZGluZ1Bvb2wiHXRocm93RmFjdG9yeVJldHVybmVkTm90U3RyaW5nIhx0aHJvd0ludmFsaWRQcmljZUFzc2V0QW1vdW50Ig90aHJvd0ludmFsaWRGZWUiE2tleU1hbmFnZXJQdWJsaWNLZXkiGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5Ig9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AAAAABQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAJhZQEAAAATcHJpY2VBc3NldHNSRUFET05MWQAAAAAJAAUUAAAAAgUAAAADbmlsCQEAAAABVQAAAAEJAAQiAAAAAQkBAAAAAVIAAAAAAAAAAmFlAQAAAA5zdGF0dXNSRUFET05MWQAAAAIAAAABdwAAAAF4BAAAAAJhcQQAAAABVwkABCIAAAABCQEAAAABdgAAAAIFAAAAAXcFAAAAAXgDCQAAAQAAAAIFAAAAAVcCAAAABlN0cmluZwQAAAABWAUAAAABVwUAAAABWAUAAAAEdW5pdAkABRQAAAACBQAAAANuaWwFAAAAAmFxAAAAAQAAAAJiaAEAAAACYmkAAAAABAAAAAJiagQAAAABVwkBAAAAAmFiAAAAAAMJAAABAAAAAgUAAAABVwIAAAAKQnl0ZVZlY3RvcgQAAAACYWYFAAAAAVcFAAAAAmFmAwkAAAEAAAACBQAAAAFXAgAAAARVbml0CAUAAAACYmgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJiaAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmJoAAAABnByb29mcwAAAAAAAAAAAAUAAAACYmrck9+D", "chainId": 84, "height": 2467950, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6aYUsoKHSrQiKi3SKSsceYQMrTsYBBKxeo6BcntkytWN Next: 54mVGVjkgtmy7aY2bzYSQ8vphmgLNahztSL8T64zPRHi Diff:
Old | New | Differences | |
---|---|---|---|
236 | 236 | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
237 | 237 | let curIndex = (lastIndex + 1) | |
238 | 238 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
239 | - | let poolExists = { | |
240 | - | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
241 | - | if ($isInstanceOf(@, "Boolean")) | |
242 | - | then @ | |
243 | - | else throw("Couldn't cast Any to Boolean") | |
244 | - | } | |
245 | 239 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
246 | - | then true | |
247 | - | else throwPoolExists(), if (poolExists) | |
248 | 240 | then true | |
249 | 241 | else throwPoolExists(), if (if (isManager(i)) | |
250 | 242 | 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 | - | let poolExists = { | |
240 | - | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
241 | - | if ($isInstanceOf(@, "Boolean")) | |
242 | - | then @ | |
243 | - | else throw("Couldn't cast Any to Boolean") | |
244 | - | } | |
245 | 239 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
246 | - | then true | |
247 | - | else throwPoolExists(), if (poolExists) | |
248 | 240 | then true | |
249 | 241 | else throwPoolExists(), if (if (isManager(i)) | |
250 | 242 | then true | |
251 | 243 | else isVerified(amountAssetId)) | |
252 | 244 | then true | |
253 | 245 | else throwAssetNotVerified(), if ((getString(keyFeeAssetId()) == feeAssetId)) | |
254 | 246 | then true | |
255 | 247 | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
256 | 248 | then true | |
257 | 249 | else (amountAssetPayment.amount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
258 | 250 | then true | |
259 | 251 | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
260 | 252 | then true | |
261 | 253 | else (priceAssetPayment.amount >= priceAssetMinAmount)) | |
262 | 254 | then true | |
263 | 255 | else throwInvalidPriceAssetAmount(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
264 | 256 | then true | |
265 | 257 | else throwInvalidFee()] | |
266 | 258 | if ((checks == checks)) | |
267 | 259 | then { | |
268 | 260 | let burnEmissionInv = invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
269 | 261 | if ((burnEmissionInv == burnEmissionInv)) | |
270 | 262 | 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 | 263 | else throw("Strict value is not equal to itself.") | |
272 | 264 | } | |
273 | 265 | else throw("Strict value is not equal to itself.") | |
274 | 266 | } | |
275 | 267 | ||
276 | 268 | ||
277 | 269 | ||
278 | 270 | @Callable(i) | |
279 | 271 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker,logo) = { | |
280 | 272 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
281 | 273 | then true | |
282 | 274 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
283 | 275 | then true | |
284 | 276 | else throwCanActivateOnlyPendingPool()] | |
285 | 277 | if ((checks == checks)) | |
286 | 278 | then { | |
287 | 279 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL", logo], nil) | |
288 | 280 | if ((activateNewPoolInv == activateNewPoolInv)) | |
289 | 281 | then { | |
290 | 282 | let lpAssetId = match activateNewPoolInv { | |
291 | 283 | case id: String => | |
292 | 284 | id | |
293 | 285 | case _ => | |
294 | 286 | throwFactoryReturnedNotString() | |
295 | 287 | } | |
296 | 288 | if ((lpAssetId == lpAssetId)) | |
297 | 289 | then { | |
298 | 290 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
299 | 291 | if ((beforePut == beforePut)) | |
300 | 292 | then { | |
301 | 293 | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(if ((amountAssetId == "WAVES")) | |
302 | 294 | then unit | |
303 | 295 | else fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
304 | 296 | then unit | |
305 | 297 | else fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
306 | 298 | if ((put == put)) | |
307 | 299 | then { | |
308 | 300 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
309 | 301 | if ((afterPut == afterPut)) | |
310 | 302 | then { | |
311 | 303 | let user = value(addressFromString(value(getString(keyCreateCaller(amountAssetId, priceAssetId))))) | |
312 | 304 | [StringEntry(keyStatus(amountAssetId, priceAssetId), statusActive), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
313 | 305 | } | |
314 | 306 | else throw("Strict value is not equal to itself.") | |
315 | 307 | } | |
316 | 308 | else throw("Strict value is not equal to itself.") | |
317 | 309 | } | |
318 | 310 | else throw("Strict value is not equal to itself.") | |
319 | 311 | } | |
320 | 312 | else throw("Strict value is not equal to itself.") | |
321 | 313 | } | |
322 | 314 | else throw("Strict value is not equal to itself.") | |
323 | 315 | } | |
324 | 316 | else throw("Strict value is not equal to itself.") | |
325 | 317 | } | |
326 | 318 | ||
327 | 319 | ||
328 | 320 | ||
329 | 321 | @Callable(i) | |
330 | 322 | func setAdmins (adminPubKeys) = { | |
331 | 323 | let checkCaller = mustManager(i) | |
332 | 324 | if ((checkCaller == checkCaller)) | |
333 | 325 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
334 | 326 | else throw("Strict value is not equal to itself.") | |
335 | 327 | } | |
336 | 328 | ||
337 | 329 | ||
338 | 330 | ||
339 | 331 | @Callable(i) | |
340 | 332 | func setManager (pendingManagerPublicKey) = { | |
341 | 333 | let checkCaller = mustManager(i) | |
342 | 334 | if ((checkCaller == checkCaller)) | |
343 | 335 | then { | |
344 | 336 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
345 | 337 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
346 | 338 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
347 | 339 | else throw("Strict value is not equal to itself.") | |
348 | 340 | } | |
349 | 341 | else throw("Strict value is not equal to itself.") | |
350 | 342 | } | |
351 | 343 | ||
352 | 344 | ||
353 | 345 | ||
354 | 346 | @Callable(i) | |
355 | 347 | func confirmManager () = { | |
356 | 348 | let pm = pendingManagerPublicKeyOrUnit() | |
357 | 349 | let hasPM = if (isDefined(pm)) | |
358 | 350 | then true | |
359 | 351 | else throw("No pending manager") | |
360 | 352 | if ((hasPM == hasPM)) | |
361 | 353 | then { | |
362 | 354 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
363 | 355 | then true | |
364 | 356 | else throw("You are not pending manager") | |
365 | 357 | if ((checkPM == checkPM)) | |
366 | 358 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
367 | 359 | else throw("Strict value is not equal to itself.") | |
368 | 360 | } | |
369 | 361 | else throw("Strict value is not equal to itself.") | |
370 | 362 | } | |
371 | 363 | ||
372 | 364 | ||
373 | 365 | ||
374 | 366 | @Callable(i) | |
375 | 367 | func priceAssetsREADONLY () = $Tuple2(nil, stringOptionToList(getString(keyPriceAssets()))) | |
376 | 368 | ||
377 | 369 | ||
378 | 370 | ||
379 | 371 | @Callable(i) | |
380 | 372 | func statusREADONLY (amountAssetId,priceAssetId) = { | |
381 | 373 | let status = match getString(keyStatus(amountAssetId, priceAssetId)) { | |
382 | 374 | case s: String => | |
383 | 375 | s | |
384 | 376 | case _ => | |
385 | 377 | unit | |
386 | 378 | } | |
387 | 379 | $Tuple2(nil, status) | |
388 | 380 | } | |
389 | 381 | ||
390 | 382 | ||
391 | 383 | @Verifier(tx) | |
392 | 384 | func verify () = { | |
393 | 385 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
394 | 386 | case pk: ByteVector => | |
395 | 387 | pk | |
396 | 388 | case _: Unit => | |
397 | 389 | tx.senderPublicKey | |
398 | 390 | case _ => | |
399 | 391 | throw("Match error") | |
400 | 392 | } | |
401 | 393 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
402 | 394 | } | |
403 | 395 |
github/deemru/w8io/026f985 53.19 ms ◑