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