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