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