tx · T88UsL6ZTdyzGK4nXyBU466zzu9XuuaJoXpj3zseNzL 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01800000 Waves 2022.08.16 14:40 [2186973] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "T88UsL6ZTdyzGK4nXyBU466zzu9XuuaJoXpj3zseNzL", "fee": 1800000, "feeAssetId": null, "timestamp": 1660650079685, "version": 1, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "5qeDSSQ6TZ7PCYMH21JNZvzm7TBchJ8ethNxAfRp43TFPFxjsRxt6oRpSp2FtbX8YKiu3Zx4tqkFiGVyykMk2XSL" ], "script": "base64:AAIFAAAAAAAAAC0IAhIJCgcICBgYAQgBEgASCAoGCAgICAgIEgMKARgSAwoBCBIAEgASBAoCCAgAAAAwAAAAAANTRVACAAAAAl9fAAAAAAVFTVBUWQIAAAAAAAAAABFpbnZhbGlkUHJpY2VBc3NldAIAAAATSW52YWxpZCBwcmljZSBhc3NldAEAAAAHdGhyb3dQRAAAAAAJAAACAAAAAQIAAAARUGVybWlzc2lvbiBkZW5pZWQBAAAAFHRocm93Q3JlYXRlTm90Q2FsbGVkAAAAAAkAAAIAAAABAgAAACRDcmVhdGUgaXMgbm90IGNhbGxlZCBmb3IgYXNzZXRzIHBhaXIBAAAAEXRocm93WW91Tm90SXNzdWVyAAAAAAkAAAIAAAABAgAAAB5Zb3UgYXJlIG5vdCBhbW91bnRBc3NldCBpc3N1ZXIBAAAAD3Rocm93UG9vbEV4aXN0cwAAAAAJAAACAAAAAQIAAAAkUG9vbCB3aXRoIHN1Y2ggYXNzZXRzIGFscmVhZHkgZXhpc3RzAQAAABV0aHJvd0Fzc2V0Tm90VmVyaWZpZWQAAAAACQAAAgAAAAECAAAAFUFzc2V0IG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AAHJG1hdGNoMAkABCIAAAABCQEAAAAJa2V5U3RhdHVzAAAAAgUAAAANYW1vdW50QXNzZXRJZAUAAAAMcHJpY2VBc3NldElkAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXMFAAAAByRtYXRjaDAFAAAAAXMFAAAABHVuaXQJAAUUAAAAAgUAAAADbmlsBQAAAAZzdGF0dXMAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAA90YXJnZXRQdWJsaWNLZXkEAAAAByRtYXRjaDAJAQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAACcGsFAAAAByRtYXRjaDAFAAAAAnBrAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0CAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5s5ordQ==", "chainId": 84, "height": 2186973, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8FR533YiSajVwX3MYfK5V8KYJF9QrBBSAjNTNETbVA2y Next: AhJ6m9whffe9z9uf4dMo8b6VLrSsWMRYPFCKMW2CyHVQ Diff:
Old | New | Differences | |
---|---|---|---|
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | - | func | |
137 | + | func isManager (i) = match managerPublicKeyOrUnit() { | |
138 | 138 | case pk: ByteVector => | |
139 | - | if ((i.callerPublicKey == pk)) | |
140 | - | then true | |
141 | - | else throwPD() | |
139 | + | (i.callerPublicKey == pk) | |
142 | 140 | case _: Unit => | |
143 | - | if ((i.caller == this)) | |
144 | - | then true | |
145 | - | else throwPD() | |
141 | + | (i.caller == this) | |
146 | 142 | case _ => | |
147 | 143 | throw("Match error") | |
148 | 144 | } | |
145 | + | ||
146 | + | ||
147 | + | func mustManager (i) = if (isManager(i)) | |
148 | + | then true | |
149 | + | else throwPD() | |
149 | 150 | ||
150 | 151 | ||
151 | 152 | func mustAdmin (i) = { | |
152 | 153 | let adminPKs = split(valueOrElse(getString(keyAdminPubKeys()), EMPTY), SEP) | |
153 | 154 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
154 | 155 | then true | |
155 | - | else { | |
156 | - | let isManager = mustManager(i) | |
157 | - | if ((isManager == isManager)) | |
158 | - | then true | |
159 | - | else throw("Strict value is not equal to itself.") | |
160 | - | } | |
156 | + | else mustManager(i) | |
161 | 157 | } | |
162 | 158 | ||
163 | 159 | ||
189 | 185 | let amountAssetPayment = value(i.payments[0]) | |
190 | 186 | let priceAssetPayment = value(i.payments[1]) | |
191 | 187 | let feeAssetPayment = value(i.payments[2]) | |
192 | - | let $ | |
193 | - | let amountAssetId = $ | |
194 | - | let amountAssetInfo = $ | |
195 | - | let $ | |
196 | - | let priceAssetId = $ | |
197 | - | let priceAssetInfo = $ | |
198 | - | let $ | |
199 | - | let feeAssetId = $ | |
200 | - | let feeAssetInfo = $ | |
188 | + | let $t059906061 = getIdAndInfo(amountAssetPayment) | |
189 | + | let amountAssetId = $t059906061._1 | |
190 | + | let amountAssetInfo = $t059906061._2 | |
191 | + | let $t060646132 = getIdAndInfo(priceAssetPayment) | |
192 | + | let priceAssetId = $t060646132._1 | |
193 | + | let priceAssetInfo = $t060646132._2 | |
194 | + | let $t061356197 = getIdAndInfo(feeAssetPayment) | |
195 | + | let feeAssetId = $t061356197._1 | |
196 | + | let feeAssetInfo = $t061356197._2 | |
201 | 197 | let priceAssetsList = split(valueOrElse(getString(keyPriceAssetIds()), EMPTY), SEP) | |
202 | - | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
198 | + | let managerPriceAssetMinAmount = 1 | |
199 | + | let priceAssetMinAmount = if (isManager(i)) | |
200 | + | then managerPriceAssetMinAmount | |
201 | + | else { | |
202 | + | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
203 | + | value(parseInt(split(valueOrElse(getString(keyPriceAssetsMinAmount()), EMPTY), SEP)[priceAssetsIndex])) | |
204 | + | } | |
203 | 205 | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
204 | 206 | let curIndex = (lastIndex + 1) | |
205 | 207 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
212 | 214 | then true | |
213 | 215 | else throwInvalidFeeAsset(), if ((amountAssetPayment.amount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
214 | 216 | then true | |
215 | - | else throwInvalidAmountAsset(), if ((priceAssetPayment.amount >= | |
217 | + | else throwInvalidAmountAsset(), if ((priceAssetPayment.amount >= priceAssetMinAmount)) | |
216 | 218 | then true | |
217 | - | else throw(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
219 | + | else throw("invalid price asset amount"), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
218 | 220 | then true | |
219 | 221 | else throw()] | |
220 | 222 | if ((checks == checks)) |
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 keyStatus (amountAssetId,priceAssetId) = makeString(["%s%s%s", "status", amountAssetId, priceAssetId], SEP) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func keyFactoryContract () = makeString(["%s", "factoryContract"], SEP) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func keySuffix (amountAssetId,priceAssetId) = makeString(["%s%s%s", "suffix", amountAssetId, priceAssetId], SEP) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func keyLastIndex () = makeString(["%s", "lastIndex"], SEP) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | let indexSuffix = "u" | |
68 | 68 | ||
69 | 69 | let statusPending = "pending" | |
70 | 70 | ||
71 | 71 | let statusDeclined = "declined" | |
72 | 72 | ||
73 | 73 | let statusActive = "active" | |
74 | 74 | ||
75 | 75 | let statuses = [statusPending, statusDeclined, statusActive] | |
76 | 76 | ||
77 | 77 | func keyCreateCalled (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCalled", amountAssetId, priceAssetId], SEP) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func keyAmountAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "amountAssetAmount", amountAssetId, priceAssetId], SEP) | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func keyPriceAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "priceAssetAmount", amountAssetId, priceAssetId], SEP) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func keyHeight (amountAssetId,priceAssetId) = makeString(["%s%s%s", "height", amountAssetId, priceAssetId], SEP) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func keyFeeAssetId () = makeString(["%s", "feeAssetId"], SEP) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func keyFeeAmount () = makeString(["%s", "feeAmount"], SEP) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func keyAmountAssetMinAmount () = makeString(["%s", "amountAssetMinAmount"], SEP) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func keyPriceAssetsMinAmount () = makeString(["%s", "priceAssetsMinAmount"], SEP) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func keyPriceAssetIds () = makeString(["%s", "priceAssetIds"], SEP) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract())) | |
108 | 108 | ||
109 | 109 | func isCreateCalled (amountAssetId,priceAssetId) = valueOrElse(getBoolean(keyCreateCalled(amountAssetId, priceAssetId)), false) | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func mustCreateCalled (amountAssetId,priceAssetId) = if (isCreateCalled(amountAssetId, priceAssetId)) | |
113 | 113 | then true | |
114 | 114 | else throwCreateNotCalled() | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
118 | 118 | case s: String => | |
119 | 119 | fromBase58String(s) | |
120 | 120 | case _: Unit => | |
121 | 121 | unit | |
122 | 122 | case _ => | |
123 | 123 | throw("Match error") | |
124 | 124 | } | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
128 | 128 | case s: String => | |
129 | 129 | fromBase58String(s) | |
130 | 130 | case _: Unit => | |
131 | 131 | unit | |
132 | 132 | case _ => | |
133 | 133 | throw("Match error") | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | - | func | |
137 | + | func isManager (i) = match managerPublicKeyOrUnit() { | |
138 | 138 | case pk: ByteVector => | |
139 | - | if ((i.callerPublicKey == pk)) | |
140 | - | then true | |
141 | - | else throwPD() | |
139 | + | (i.callerPublicKey == pk) | |
142 | 140 | case _: Unit => | |
143 | - | if ((i.caller == this)) | |
144 | - | then true | |
145 | - | else throwPD() | |
141 | + | (i.caller == this) | |
146 | 142 | case _ => | |
147 | 143 | throw("Match error") | |
148 | 144 | } | |
145 | + | ||
146 | + | ||
147 | + | func mustManager (i) = if (isManager(i)) | |
148 | + | then true | |
149 | + | else throwPD() | |
149 | 150 | ||
150 | 151 | ||
151 | 152 | func mustAdmin (i) = { | |
152 | 153 | let adminPKs = split(valueOrElse(getString(keyAdminPubKeys()), EMPTY), SEP) | |
153 | 154 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
154 | 155 | then true | |
155 | - | else { | |
156 | - | let isManager = mustManager(i) | |
157 | - | if ((isManager == isManager)) | |
158 | - | then true | |
159 | - | else throw("Strict value is not equal to itself.") | |
160 | - | } | |
156 | + | else mustManager(i) | |
161 | 157 | } | |
162 | 158 | ||
163 | 159 | ||
164 | 160 | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(getStringOrFail(keyAssetsStoreContract())), (("status_<" + assetId) + ">")), 0) == 2) | |
165 | 161 | ||
166 | 162 | ||
167 | 163 | func getIdAndInfo (payment) = { | |
168 | 164 | let id = value(payment.assetId) | |
169 | 165 | let info = value(assetInfo(id)) | |
170 | 166 | $Tuple2(toBase58String(id), info) | |
171 | 167 | } | |
172 | 168 | ||
173 | 169 | ||
174 | 170 | func validStatus (status) = containsElement(statuses, status) | |
175 | 171 | ||
176 | 172 | ||
177 | 173 | @Callable(i) | |
178 | 174 | func constructor (factoryV2Address,assetsStoreAddress,priceAssetIds,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
179 | 175 | let checkCaller = mustManager(i) | |
180 | 176 | if ((checkCaller == checkCaller)) | |
181 | 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)] | |
182 | 178 | else throw("Strict value is not equal to itself.") | |
183 | 179 | } | |
184 | 180 | ||
185 | 181 | ||
186 | 182 | ||
187 | 183 | @Callable(i) | |
188 | 184 | func create () = { | |
189 | 185 | let amountAssetPayment = value(i.payments[0]) | |
190 | 186 | let priceAssetPayment = value(i.payments[1]) | |
191 | 187 | let feeAssetPayment = value(i.payments[2]) | |
192 | - | let $ | |
193 | - | let amountAssetId = $ | |
194 | - | let amountAssetInfo = $ | |
195 | - | let $ | |
196 | - | let priceAssetId = $ | |
197 | - | let priceAssetInfo = $ | |
198 | - | let $ | |
199 | - | let feeAssetId = $ | |
200 | - | let feeAssetInfo = $ | |
188 | + | let $t059906061 = getIdAndInfo(amountAssetPayment) | |
189 | + | let amountAssetId = $t059906061._1 | |
190 | + | let amountAssetInfo = $t059906061._2 | |
191 | + | let $t060646132 = getIdAndInfo(priceAssetPayment) | |
192 | + | let priceAssetId = $t060646132._1 | |
193 | + | let priceAssetInfo = $t060646132._2 | |
194 | + | let $t061356197 = getIdAndInfo(feeAssetPayment) | |
195 | + | let feeAssetId = $t061356197._1 | |
196 | + | let feeAssetInfo = $t061356197._2 | |
201 | 197 | let priceAssetsList = split(valueOrElse(getString(keyPriceAssetIds()), EMPTY), SEP) | |
202 | - | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
198 | + | let managerPriceAssetMinAmount = 1 | |
199 | + | let priceAssetMinAmount = if (isManager(i)) | |
200 | + | then managerPriceAssetMinAmount | |
201 | + | else { | |
202 | + | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
203 | + | value(parseInt(split(valueOrElse(getString(keyPriceAssetsMinAmount()), EMPTY), SEP)[priceAssetsIndex])) | |
204 | + | } | |
203 | 205 | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
204 | 206 | let curIndex = (lastIndex + 1) | |
205 | 207 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
206 | 208 | then true | |
207 | 209 | else throwPoolExists(), if ((amountAssetInfo.issuer == i.caller)) | |
208 | 210 | then true | |
209 | 211 | else throwYouNotIssuer(), if (isVerified(amountAssetId)) | |
210 | 212 | then true | |
211 | 213 | else throwAssetNotVerified(), if ((getString(keyFeeAssetId()) == feeAssetId)) | |
212 | 214 | then true | |
213 | 215 | else throwInvalidFeeAsset(), if ((amountAssetPayment.amount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
214 | 216 | then true | |
215 | - | else throwInvalidAmountAsset(), if ((priceAssetPayment.amount >= | |
217 | + | else throwInvalidAmountAsset(), if ((priceAssetPayment.amount >= priceAssetMinAmount)) | |
216 | 218 | then true | |
217 | - | else throw(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
219 | + | else throw("invalid price asset amount"), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
218 | 220 | then true | |
219 | 221 | else throw()] | |
220 | 222 | if ((checks == checks)) | |
221 | 223 | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), IntegerEntry(keyLastIndex(), curIndex), StringEntry(keySuffix(amountAssetId, priceAssetId), (toString(curIndex) + indexSuffix)), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetPayment.amount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetPayment.amount)] | |
222 | 224 | else throw("Strict value is not equal to itself.") | |
223 | 225 | } | |
224 | 226 | ||
225 | 227 | ||
226 | 228 | ||
227 | 229 | @Callable(i) | |
228 | 230 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker,logo) = { | |
229 | 231 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
230 | 232 | then true | |
231 | 233 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
232 | 234 | then true | |
233 | 235 | else throwCanActivateOnlyPendingPool()] | |
234 | 236 | if ((checks == checks)) | |
235 | 237 | then { | |
236 | 238 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL", logo], nil) | |
237 | 239 | if ((activateNewPoolInv == activateNewPoolInv)) | |
238 | 240 | then { | |
239 | 241 | let lpAssetId = match activateNewPoolInv { | |
240 | 242 | case id: String => | |
241 | 243 | id | |
242 | 244 | case _ => | |
243 | 245 | throwFactoryReturnedNotString() | |
244 | 246 | } | |
245 | 247 | if ((lpAssetId == lpAssetId)) | |
246 | 248 | then { | |
247 | 249 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
248 | 250 | if ((beforePut == beforePut)) | |
249 | 251 | then { | |
250 | 252 | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
251 | 253 | if ((put == put)) | |
252 | 254 | then { | |
253 | 255 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
254 | 256 | if ((afterPut == afterPut)) | |
255 | 257 | then { | |
256 | 258 | let user = value(assetInfo(fromBase58String(amountAssetId))).issuer | |
257 | 259 | [StringEntry(keyStatus(amountAssetId, priceAssetId), statusActive), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
258 | 260 | } | |
259 | 261 | else throw("Strict value is not equal to itself.") | |
260 | 262 | } | |
261 | 263 | else throw("Strict value is not equal to itself.") | |
262 | 264 | } | |
263 | 265 | else throw("Strict value is not equal to itself.") | |
264 | 266 | } | |
265 | 267 | else throw("Strict value is not equal to itself.") | |
266 | 268 | } | |
267 | 269 | else throw("Strict value is not equal to itself.") | |
268 | 270 | } | |
269 | 271 | else throw("Strict value is not equal to itself.") | |
270 | 272 | } | |
271 | 273 | ||
272 | 274 | ||
273 | 275 | ||
274 | 276 | @Callable(i) | |
275 | 277 | func setAdmins (adminPubKeys) = { | |
276 | 278 | let checkCaller = mustManager(i) | |
277 | 279 | if ((checkCaller == checkCaller)) | |
278 | 280 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
279 | 281 | else throw("Strict value is not equal to itself.") | |
280 | 282 | } | |
281 | 283 | ||
282 | 284 | ||
283 | 285 | ||
284 | 286 | @Callable(i) | |
285 | 287 | func setManager (pendingManagerPublicKey) = { | |
286 | 288 | let checkCaller = mustManager(i) | |
287 | 289 | if ((checkCaller == checkCaller)) | |
288 | 290 | then { | |
289 | 291 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
290 | 292 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
291 | 293 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
292 | 294 | else throw("Strict value is not equal to itself.") | |
293 | 295 | } | |
294 | 296 | else throw("Strict value is not equal to itself.") | |
295 | 297 | } | |
296 | 298 | ||
297 | 299 | ||
298 | 300 | ||
299 | 301 | @Callable(i) | |
300 | 302 | func confirmManager () = { | |
301 | 303 | let pm = pendingManagerPublicKeyOrUnit() | |
302 | 304 | let hasPM = if (isDefined(pm)) | |
303 | 305 | then true | |
304 | 306 | else throw("No pending manager") | |
305 | 307 | if ((hasPM == hasPM)) | |
306 | 308 | then { | |
307 | 309 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
308 | 310 | then true | |
309 | 311 | else throw("You are not pending manager") | |
310 | 312 | if ((checkPM == checkPM)) | |
311 | 313 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
312 | 314 | else throw("Strict value is not equal to itself.") | |
313 | 315 | } | |
314 | 316 | else throw("Strict value is not equal to itself.") | |
315 | 317 | } | |
316 | 318 | ||
317 | 319 | ||
318 | 320 | ||
319 | 321 | @Callable(i) | |
320 | 322 | func priceAssetsREADONLY () = { | |
321 | 323 | let priceAssets = match getString(keyPriceAssetIds()) { | |
322 | 324 | case s: String => | |
323 | 325 | if ((size(s) == 0)) | |
324 | 326 | then nil | |
325 | 327 | else split(s, SEP) | |
326 | 328 | case _ => | |
327 | 329 | nil | |
328 | 330 | } | |
329 | 331 | $Tuple2(nil, priceAssets) | |
330 | 332 | } | |
331 | 333 | ||
332 | 334 | ||
333 | 335 | ||
334 | 336 | @Callable(i) | |
335 | 337 | func statusREADONLY (amountAssetId,priceAssetId) = { | |
336 | 338 | let status = match getString(keyStatus(amountAssetId, priceAssetId)) { | |
337 | 339 | case s: String => | |
338 | 340 | s | |
339 | 341 | case _ => | |
340 | 342 | unit | |
341 | 343 | } | |
342 | 344 | $Tuple2(nil, status) | |
343 | 345 | } | |
344 | 346 | ||
345 | 347 | ||
346 | 348 | @Verifier(tx) | |
347 | 349 | func verify () = { | |
348 | 350 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
349 | 351 | case pk: ByteVector => | |
350 | 352 | pk | |
351 | 353 | case _: Unit => | |
352 | 354 | tx.senderPublicKey | |
353 | 355 | case _ => | |
354 | 356 | throw("Match error") | |
355 | 357 | } | |
356 | 358 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
357 | 359 | } | |
358 | 360 |
github/deemru/w8io/026f985 54.52 ms ◑