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