tx · TrRaCCk58qfzWhc2axGrmkbYVCGByZHbPxjtjoEQaFZ 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01400000 Waves 2022.04.13 14:07 [2006716] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "TrRaCCk58qfzWhc2axGrmkbYVCGByZHbPxjtjoEQaFZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1649848071088, "version": 1, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "4KiC5r3brupcsPCaNb93v77b8ANDTCvogSn3aSFypQPVEAbFoxjSFDDG9KwKeM14maVnNtCQMakCcYmSd2AQvyt2" ], "script": "base64:AAIFAAAAAAAAAC0IAhIJCgcICBgYAQgBEgASBQoDCAgIEgcKBQgICAgIEgMKARgSAwoBCBIAEgAAAAAuAAAAAANTRVACAAAAAl9fAAAAAAVFTVBUWQIAAAAAAAAAABFpbnZhbGlkUHJpY2VBc3NldAIAAAATSW52YWxpZCBwcmljZSBhc3NldAEAAAAHdGhyb3dQRAAAAAAJAAACAAAAAQIAAAARUGVybWlzc2lvbiBkZW5pZWQBAAAAFHRocm93Q3JlYXRlTm90Q2FsbGVkAAAAAAkAAAIAAAABAgAAACRDcmVhdGUgaXMgbm90IGNhbGxlZCBmb3IgYXNzZXRzIHBhaXIBAAAAEXRocm93WW91Tm90SXNzdWVyAAAAAAkAAAIAAAABAgAAAB5Zb3UgYXJlIG5vdCBhbW91bnRBc3NldCBpc3N1ZXIBAAAAD3Rocm93UG9vbEV4aXN0cwAAAAAJAAACAAAAAQIAAAAkUG9vbCB3aXRoIHN1Y2ggYXNzZXRzIGFscmVhZHkgZXhpc3RzAQAAABV0aHJvd0Fzc2V0Tm90VmVyaWZpZWQAAAAACQAAAgAAAAECAAAAFUFzc2V0IGlzIG5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CQAETAAAAAICAAAABiVzJXMlcwkABEwAAAACAgAAABFhbW91bnRBc3NldEFtb3VudAkABEwAAAACBQAAAA1hbW91bnRBc3NldElkCQAETAAAAAIFAAAADHByaWNlQXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAAE2tleVByaWNlQXNzZXRBbW91bnQAAAACAAAADWFtb3VudEFzc2V0SWQAAAAMcHJpY2VBc3NldElkCQAEuQAAAAIJAARMAAAAAgIAAAAGJXMlcyVzCQAETAAAAAICAAAAEHByaWNlQXNzZXRBbW91bnQJAARMAAAAAgUAAAANYW1vdW50QXNzZXRJZAkABEwAAAACBQAAAAxwcmljZUFzc2V0SWQFAAAAA25pbAUAAAADU0VQAQAAAAlrZXlIZWlnaHQAAAACAAAADWFtb3VudEFzc2V0SWQAAAAMcHJpY2VBc3NldElkCQAEuQAAAAIJAARMAAAAAgIAAAAGJXMlcyVzCQAETAAAAAICAAAABmhlaWdodAkABEwAAAACBQAAAA1hbW91bnRBc3NldElkCQAETAAAAAIFAAAADHByaWNlQXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAADWtleUZlZUFzc2V0SWQAAAAACQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAAKZmVlQXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAADGtleUZlZUFtb3VudAAAAAAJAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACAgAAAAlmZWVBbW91bnQFAAAAA25pbAUAAAADU0VQAQAAABdrZXlBbW91bnRBc3NldE1pbkFtb3VudAAAAAAJAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACAgAAABRhbW91bnRBc3NldE1pbkFtb3VudAUAAAADbmlsBQAAAANTRVABAAAAF2tleVByaWNlQXNzZXRzTWluQW1vdW50AAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAAFHByaWNlQXNzZXRzTWluQW1vdW50BQAAAANuaWwFAAAAA1NFUAEAAAAQa2V5UHJpY2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AAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA90YXJnZXRQdWJsaWNLZXl+h1DS", "chainId": 84, "height": 2006716, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 26oPx6bESHzC3t4nahpmcnDp1kZVmeCiT4geAvE8CmKU Next: 2Fy3EBWKijGFHWFoDvT994B2TS7NtL4hpcbsCzRwmQwq Diff:
Old | New | Differences | |
---|---|---|---|
58 | 58 | func keyStatus (amountAssetId,priceAssetId) = makeString(["%s%s%s", "status", amountAssetId, priceAssetId], SEP) | |
59 | 59 | ||
60 | 60 | ||
61 | - | let | |
61 | + | let statusPending = "pending" | |
62 | 62 | ||
63 | - | let | |
63 | + | let statusDeclined = "declined" | |
64 | 64 | ||
65 | - | let | |
65 | + | let statusCreating = "creating" | |
66 | 66 | ||
67 | - | let | |
67 | + | let statusActive = "active" | |
68 | 68 | ||
69 | - | let | |
69 | + | let statusBotDisabled = "bot_disabled" | |
70 | 70 | ||
71 | - | let | |
71 | + | let statuses = [statusPending, statusDeclined, statusCreating, statusActive, statusBotDisabled] | |
72 | 72 | ||
73 | 73 | func keyCreateCalled (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCalled", amountAssetId, priceAssetId], SEP) | |
74 | 74 | ||
167 | 167 | } | |
168 | 168 | ||
169 | 169 | ||
170 | - | func validStatus (status) = containsElement( | |
170 | + | func validStatus (status) = containsElement(statuses, status) | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | @Callable(i) | |
185 | 185 | let amountAssetPayment = value(i.payments[0]) | |
186 | 186 | let priceAssetPayment = value(i.payments[1]) | |
187 | 187 | let feeAssetPayment = value(i.payments[2]) | |
188 | - | let $ | |
189 | - | let amountAssetId = $ | |
190 | - | let amountAssetInfo = $ | |
191 | - | let $ | |
192 | - | let priceAssetId = $ | |
193 | - | let priceAssetInfo = $ | |
194 | - | let $ | |
195 | - | let feeAssetId = $ | |
196 | - | let feeAssetInfo = $ | |
188 | + | let $t058985969 = getIdAndInfo(amountAssetPayment) | |
189 | + | let amountAssetId = $t058985969._1 | |
190 | + | let amountAssetInfo = $t058985969._2 | |
191 | + | let $t059726040 = getIdAndInfo(priceAssetPayment) | |
192 | + | let priceAssetId = $t059726040._1 | |
193 | + | let priceAssetInfo = $t059726040._2 | |
194 | + | let $t060436105 = getIdAndInfo(feeAssetPayment) | |
195 | + | let feeAssetId = $t060436105._1 | |
196 | + | let feeAssetInfo = $t060436105._2 | |
197 | 197 | let priceAssetsList = split(valueOrElse(getString(keyPriceAssetIds()), EMPTY), SEP) | |
198 | 198 | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
199 | 199 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
212 | 212 | then true | |
213 | 213 | else throw()] | |
214 | 214 | if ((checks == checks)) | |
215 | - | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), | |
215 | + | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetPayment.amount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetPayment.amount)] | |
216 | 216 | else throw("Strict value is not equal to itself.") | |
217 | 217 | } | |
218 | 218 | ||
236 | 236 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker) = { | |
237 | 237 | let checks = [mustManager(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
238 | 238 | then true | |
239 | - | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == | |
239 | + | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
240 | 240 | then true | |
241 | 241 | else throwCanActivateOnlyPendingPool()] | |
242 | 242 | if ((checks == checks)) | |
262 | 262 | if ((afterPut == afterPut)) | |
263 | 263 | then { | |
264 | 264 | let user = value(assetInfo(fromBase58String(amountAssetId))).issuer | |
265 | - | [StringEntry(keyStatus(amountAssetId, priceAssetId), | |
265 | + | [StringEntry(keyStatus(amountAssetId, priceAssetId), statusCreating), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
266 | 266 | } | |
267 | 267 | else throw("Strict value is not equal to itself.") | |
268 | 268 | } | |
323 | 323 | } | |
324 | 324 | ||
325 | 325 | ||
326 | + | ||
327 | + | @Callable(i) | |
328 | + | func priceAssetsREADONLY () = $Tuple2(nil, split(valueOrElse(getString(keyPriceAssetIds()), EMPTY), SEP)) | |
329 | + | ||
330 | + | ||
326 | 331 | @Verifier(tx) | |
327 | 332 | func verify () = { | |
328 | 333 | let targetPublicKey = match managerPublicKeyOrUnit() { |
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 EMPTY = "" | |
7 | 7 | ||
8 | 8 | let invalidPriceAsset = "Invalid price asset" | |
9 | 9 | ||
10 | 10 | func throwPD () = throw("Permission denied") | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func throwCreateNotCalled () = throw("Create is not called for assets pair") | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func throwYouNotIssuer () = throw("You are not amountAsset issuer") | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func throwPoolExists () = throw("Pool with such assets already exists") | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func throwAssetNotVerified () = throw("Asset is not verified") | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func throwInvalidPriceAsset () = throw(invalidPriceAsset) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func throwInvalidFeeAsset () = throw("Invalid fee asset") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func throwInvalidAmountAsset () = throw("Invalid amount asset attached") | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func throwInvalidStatus () = throw("Invalid status") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func throwCanActivateOnlyPendingPool () = throw("Can activate pool only in 'pending' status") | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func throwFactoryReturnedNotString () = throw("FactoryV2 returned not string") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func keyAdminPubKeys () = makeString(["%s", "adminPubKeys"], SEP) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func keyFactoryContract () = makeString(["%s", "factoryContract"], SEP) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func keyStatus (amountAssetId,priceAssetId) = makeString(["%s%s%s", "status", amountAssetId, priceAssetId], SEP) | |
59 | 59 | ||
60 | 60 | ||
61 | - | let | |
61 | + | let statusPending = "pending" | |
62 | 62 | ||
63 | - | let | |
63 | + | let statusDeclined = "declined" | |
64 | 64 | ||
65 | - | let | |
65 | + | let statusCreating = "creating" | |
66 | 66 | ||
67 | - | let | |
67 | + | let statusActive = "active" | |
68 | 68 | ||
69 | - | let | |
69 | + | let statusBotDisabled = "bot_disabled" | |
70 | 70 | ||
71 | - | let | |
71 | + | let statuses = [statusPending, statusDeclined, statusCreating, statusActive, statusBotDisabled] | |
72 | 72 | ||
73 | 73 | func keyCreateCalled (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCalled", amountAssetId, priceAssetId], SEP) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func keyAmountAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "amountAssetAmount", amountAssetId, priceAssetId], SEP) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func keyPriceAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "priceAssetAmount", amountAssetId, priceAssetId], SEP) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func keyHeight (amountAssetId,priceAssetId) = makeString(["%s%s%s", "height", amountAssetId, priceAssetId], SEP) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func keyFeeAssetId () = makeString(["%s", "feeAssetId"], SEP) | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func keyFeeAmount () = makeString(["%s", "feeAmount"], SEP) | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func keyAmountAssetMinAmount () = makeString(["%s", "amountAssetMinAmount"], SEP) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func keyPriceAssetsMinAmount () = makeString(["%s", "priceAssetsMinAmount"], SEP) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func keyPriceAssetIds () = makeString(["%s", "priceAssetIds"], SEP) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract())) | |
104 | 104 | ||
105 | 105 | func isCreateCalled (amountAssetId,priceAssetId) = valueOrElse(getBoolean(keyCreateCalled(amountAssetId, priceAssetId)), false) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func mustCreateCalled (amountAssetId,priceAssetId) = if (isCreateCalled(amountAssetId, priceAssetId)) | |
109 | 109 | then true | |
110 | 110 | else throwCreateNotCalled() | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
114 | 114 | case s: String => | |
115 | 115 | fromBase58String(s) | |
116 | 116 | case _: Unit => | |
117 | 117 | unit | |
118 | 118 | case _ => | |
119 | 119 | throw("Match error") | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
124 | 124 | case s: String => | |
125 | 125 | fromBase58String(s) | |
126 | 126 | case _: Unit => | |
127 | 127 | unit | |
128 | 128 | case _ => | |
129 | 129 | throw("Match error") | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
134 | 134 | case pk: ByteVector => | |
135 | 135 | if ((i.callerPublicKey == pk)) | |
136 | 136 | then true | |
137 | 137 | else throwPD() | |
138 | 138 | case _: Unit => | |
139 | 139 | if ((i.caller == this)) | |
140 | 140 | then true | |
141 | 141 | else throwPD() | |
142 | 142 | case _ => | |
143 | 143 | throw("Match error") | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func mustAdmin (i) = { | |
148 | 148 | let adminPKs = split(valueOrElse(getString(keyAdminPubKeys()), EMPTY), SEP) | |
149 | 149 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
150 | 150 | then true | |
151 | 151 | else { | |
152 | 152 | let isManager = mustManager(i) | |
153 | 153 | if ((isManager == isManager)) | |
154 | 154 | then true | |
155 | 155 | else throw("Strict value is not equal to itself.") | |
156 | 156 | } | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(getStringOrFail(keyAssetsStoreContract())), (("status_<" + assetId) + ">")), 0) == 2) | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | func getIdAndInfo (payment) = { | |
164 | 164 | let id = value(payment.assetId) | |
165 | 165 | let info = value(assetInfo(id)) | |
166 | 166 | $Tuple2(toBase58String(id), info) | |
167 | 167 | } | |
168 | 168 | ||
169 | 169 | ||
170 | - | func validStatus (status) = containsElement( | |
170 | + | func validStatus (status) = containsElement(statuses, status) | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | @Callable(i) | |
174 | 174 | func constructor (factoryV2Address,assetsStoreAddress,priceAssetIds,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
175 | 175 | let checkCaller = mustManager(i) | |
176 | 176 | if ((checkCaller == checkCaller)) | |
177 | 177 | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyPriceAssetIds(), makeString(priceAssetIds, SEP)), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
178 | 178 | else throw("Strict value is not equal to itself.") | |
179 | 179 | } | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | ||
183 | 183 | @Callable(i) | |
184 | 184 | func create () = { | |
185 | 185 | let amountAssetPayment = value(i.payments[0]) | |
186 | 186 | let priceAssetPayment = value(i.payments[1]) | |
187 | 187 | let feeAssetPayment = value(i.payments[2]) | |
188 | - | let $ | |
189 | - | let amountAssetId = $ | |
190 | - | let amountAssetInfo = $ | |
191 | - | let $ | |
192 | - | let priceAssetId = $ | |
193 | - | let priceAssetInfo = $ | |
194 | - | let $ | |
195 | - | let feeAssetId = $ | |
196 | - | let feeAssetInfo = $ | |
188 | + | let $t058985969 = getIdAndInfo(amountAssetPayment) | |
189 | + | let amountAssetId = $t058985969._1 | |
190 | + | let amountAssetInfo = $t058985969._2 | |
191 | + | let $t059726040 = getIdAndInfo(priceAssetPayment) | |
192 | + | let priceAssetId = $t059726040._1 | |
193 | + | let priceAssetInfo = $t059726040._2 | |
194 | + | let $t060436105 = getIdAndInfo(feeAssetPayment) | |
195 | + | let feeAssetId = $t060436105._1 | |
196 | + | let feeAssetInfo = $t060436105._2 | |
197 | 197 | let priceAssetsList = split(valueOrElse(getString(keyPriceAssetIds()), EMPTY), SEP) | |
198 | 198 | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
199 | 199 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
200 | 200 | then true | |
201 | 201 | else throwPoolExists(), if ((amountAssetInfo.issuer == i.caller)) | |
202 | 202 | then true | |
203 | 203 | else throwYouNotIssuer(), if (isVerified(amountAssetId)) | |
204 | 204 | then true | |
205 | 205 | else throwAssetNotVerified(), if ((getString(keyFeeAssetId()) == feeAssetId)) | |
206 | 206 | then true | |
207 | 207 | else throwInvalidFeeAsset(), if ((amountAssetPayment.amount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
208 | 208 | then true | |
209 | 209 | else throwInvalidAmountAsset(), if ((priceAssetPayment.amount >= value(parseInt(split(valueOrElse(getString(keyPriceAssetsMinAmount()), EMPTY), SEP)[priceAssetsIndex])))) | |
210 | 210 | then true | |
211 | 211 | else throw(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
212 | 212 | then true | |
213 | 213 | else throw()] | |
214 | 214 | if ((checks == checks)) | |
215 | - | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), | |
215 | + | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetPayment.amount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetPayment.amount)] | |
216 | 216 | else throw("Strict value is not equal to itself.") | |
217 | 217 | } | |
218 | 218 | ||
219 | 219 | ||
220 | 220 | ||
221 | 221 | @Callable(i) | |
222 | 222 | func setStatus (amountAssetId,priceAssetId,newStatus) = { | |
223 | 223 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
224 | 224 | then true | |
225 | 225 | else throwCreateNotCalled(), if (validStatus(newStatus)) | |
226 | 226 | then true | |
227 | 227 | else throwInvalidStatus()] | |
228 | 228 | if ((checks == checks)) | |
229 | 229 | then [StringEntry(keyStatus(amountAssetId, priceAssetId), newStatus)] | |
230 | 230 | else throw("Strict value is not equal to itself.") | |
231 | 231 | } | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | ||
235 | 235 | @Callable(i) | |
236 | 236 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker) = { | |
237 | 237 | let checks = [mustManager(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
238 | 238 | then true | |
239 | - | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == | |
239 | + | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
240 | 240 | then true | |
241 | 241 | else throwCanActivateOnlyPendingPool()] | |
242 | 242 | if ((checks == checks)) | |
243 | 243 | then { | |
244 | 244 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((("WX " + amountAssetTicker) + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL"], nil) | |
245 | 245 | if ((activateNewPoolInv == activateNewPoolInv)) | |
246 | 246 | then { | |
247 | 247 | let lpAssetId = match activateNewPoolInv { | |
248 | 248 | case id: String => | |
249 | 249 | id | |
250 | 250 | case _ => | |
251 | 251 | throwFactoryReturnedNotString() | |
252 | 252 | } | |
253 | 253 | if ((lpAssetId == lpAssetId)) | |
254 | 254 | then { | |
255 | 255 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
256 | 256 | if ((beforePut == beforePut)) | |
257 | 257 | then { | |
258 | 258 | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
259 | 259 | if ((put == put)) | |
260 | 260 | then { | |
261 | 261 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
262 | 262 | if ((afterPut == afterPut)) | |
263 | 263 | then { | |
264 | 264 | let user = value(assetInfo(fromBase58String(amountAssetId))).issuer | |
265 | - | [StringEntry(keyStatus(amountAssetId, priceAssetId), | |
265 | + | [StringEntry(keyStatus(amountAssetId, priceAssetId), statusCreating), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
266 | 266 | } | |
267 | 267 | else throw("Strict value is not equal to itself.") | |
268 | 268 | } | |
269 | 269 | else throw("Strict value is not equal to itself.") | |
270 | 270 | } | |
271 | 271 | else throw("Strict value is not equal to itself.") | |
272 | 272 | } | |
273 | 273 | else throw("Strict value is not equal to itself.") | |
274 | 274 | } | |
275 | 275 | else throw("Strict value is not equal to itself.") | |
276 | 276 | } | |
277 | 277 | else throw("Strict value is not equal to itself.") | |
278 | 278 | } | |
279 | 279 | ||
280 | 280 | ||
281 | 281 | ||
282 | 282 | @Callable(i) | |
283 | 283 | func setAdmins (adminPubKeys) = { | |
284 | 284 | let checkCaller = mustManager(i) | |
285 | 285 | if ((checkCaller == checkCaller)) | |
286 | 286 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
287 | 287 | else throw("Strict value is not equal to itself.") | |
288 | 288 | } | |
289 | 289 | ||
290 | 290 | ||
291 | 291 | ||
292 | 292 | @Callable(i) | |
293 | 293 | func setManager (pendingManagerPublicKey) = { | |
294 | 294 | let checkCaller = mustManager(i) | |
295 | 295 | if ((checkCaller == checkCaller)) | |
296 | 296 | then { | |
297 | 297 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
298 | 298 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
299 | 299 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
300 | 300 | else throw("Strict value is not equal to itself.") | |
301 | 301 | } | |
302 | 302 | else throw("Strict value is not equal to itself.") | |
303 | 303 | } | |
304 | 304 | ||
305 | 305 | ||
306 | 306 | ||
307 | 307 | @Callable(i) | |
308 | 308 | func confirmManager () = { | |
309 | 309 | let pm = pendingManagerPublicKeyOrUnit() | |
310 | 310 | let hasPM = if (isDefined(pm)) | |
311 | 311 | then true | |
312 | 312 | else throw("No pending manager") | |
313 | 313 | if ((hasPM == hasPM)) | |
314 | 314 | then { | |
315 | 315 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
316 | 316 | then true | |
317 | 317 | else throw("You are not pending manager") | |
318 | 318 | if ((checkPM == checkPM)) | |
319 | 319 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
320 | 320 | else throw("Strict value is not equal to itself.") | |
321 | 321 | } | |
322 | 322 | else throw("Strict value is not equal to itself.") | |
323 | 323 | } | |
324 | 324 | ||
325 | 325 | ||
326 | + | ||
327 | + | @Callable(i) | |
328 | + | func priceAssetsREADONLY () = $Tuple2(nil, split(valueOrElse(getString(keyPriceAssetIds()), EMPTY), SEP)) | |
329 | + | ||
330 | + | ||
326 | 331 | @Verifier(tx) | |
327 | 332 | func verify () = { | |
328 | 333 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
329 | 334 | case pk: ByteVector => | |
330 | 335 | pk | |
331 | 336 | case _: Unit => | |
332 | 337 | tx.senderPublicKey | |
333 | 338 | case _ => | |
334 | 339 | throw("Match error") | |
335 | 340 | } | |
336 | 341 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
337 | 342 | } | |
338 | 343 |
github/deemru/w8io/026f985 52.87 ms ◑