tx · 26oPx6bESHzC3t4nahpmcnDp1kZVmeCiT4geAvE8CmKU 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01400000 Waves 2022.04.12 13:14 [2005227] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "26oPx6bESHzC3t4nahpmcnDp1kZVmeCiT4geAvE8CmKU", "fee": 1400000, "feeAssetId": null, "timestamp": 1649758450804, "version": 2, "chainId": 84, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "Jf9yfKvTUQY3KXKZDGJZG8psukKHFr7KWeaZUU9n45ZZwWCxLKEw1TGtS9U7URvLdTRQDoihJcAErAKk1j1mTMs" ], "script": "base64:AAIFAAAAAAAAACsIAhIJCgcICBgYAQgBEgASBQoDCAgIEgcKBQgICAgIEgMKARgSAwoBCBIAAAAALgAAAAADU0VQAgAAAAJfXwAAAAAFRU1QVFkCAAAAAAAAAAARaW52YWxpZFByaWNlQXNzZXQCAAAAE0ludmFsaWQgcHJpY2UgYXNzZXQBAAAAB3Rocm93UEQAAAAACQAAAgAAAAECAAAAEVBlcm1pc3Npb24gZGVuaWVkAQAAABR0aHJvd0NyZWF0ZU5vdENhbGxlZAAAAAAJAAACAAAAAQIAAAAkQ3JlYXRlIGlzIG5vdCBjYWxsZWQgZm9yIGFzc2V0cyBwYWlyAQAAABF0aHJvd1lvdU5vdElzc3VlcgAAAAAJAAACAAAAAQIAAAAeWW91IGFyZSBub3QgYW1vdW50QXNzZXQgaXNzdWVyAQAAAA90aHJvd1Bvb2xFeGlzdHMAAAAACQAAAgAAAAECAAAAJFBvb2wgd2l0aCBzdWNoIGFzc2V0cyBhbHJlYWR5IGV4aXN0cwEAAAAVdGhyb3dBc3NldE5vdFZlcmlmaWVkAAAAAAkAAAIAAAABAgAAABVBc3Nld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} View: original | compacted Prev: B6SERzhHhrUgsXhJxMR7EAFRJVwvrLrEyC7JTY43HRqo Next: TrRaCCk58qfzWhc2axGrmkbYVCGByZHbPxjtjoEQaFZ Diff:
Old | New | Differences | |
---|---|---|---|
28 | 28 | func throwInvalidFeeAsset () = throw("Invalid fee asset") | |
29 | 29 | ||
30 | 30 | ||
31 | - | func | |
31 | + | func throwInvalidAmountAsset () = throw("Invalid amount asset attached") | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func throwInvalidStatus () = throw("Invalid status") | |
88 | 88 | func keyFeeAmount () = makeString(["%s", "feeAmount"], SEP) | |
89 | 89 | ||
90 | 90 | ||
91 | - | func | |
91 | + | func keyAmountAssetMinAmount () = makeString(["%s", "amountAssetMinAmount"], SEP) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func keyPriceAssetsMinAmount () = makeString(["%s", "priceAssetsMinAmount"], SEP) | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | ||
160 | - | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(keyAssetsStoreContract()), (("status_<" + assetId) + ">")), 0) == 2) | |
160 | + | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(getStringOrFail(keyAssetsStoreContract())), (("status_<" + assetId) + ">")), 0) == 2) | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | func getIdAndInfo (payment) = { | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | @Callable(i) | |
174 | - | func constructor (factoryV2Address,assetsStoreAddress,priceAssetIds,priceAssetsMinAmount, | |
174 | + | func constructor (factoryV2Address,assetsStoreAddress,priceAssetIds,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
175 | 175 | let checkCaller = mustManager(i) | |
176 | 176 | if ((checkCaller == checkCaller)) | |
177 | - | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyPriceAssetIds(), makeString(priceAssetIds, SEP)), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), | |
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 | ||
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 $t059105981 = getIdAndInfo(amountAssetPayment) | |
189 | + | let amountAssetId = $t059105981._1 | |
190 | + | let amountAssetInfo = $t059105981._2 | |
191 | + | let $t059846052 = getIdAndInfo(priceAssetPayment) | |
192 | + | let priceAssetId = $t059846052._1 | |
193 | + | let priceAssetInfo = $t059846052._2 | |
194 | + | let $t060556117 = getIdAndInfo(feeAssetPayment) | |
195 | + | let feeAssetId = $t060556117._1 | |
196 | + | let feeAssetInfo = $t060556117._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))) | |
204 | 204 | then true | |
205 | 205 | else throwAssetNotVerified(), if ((getString(keyFeeAssetId()) == feeAssetId)) | |
206 | 206 | then true | |
207 | - | else throwInvalidFeeAsset(), if ((amountAssetPayment.amount > | |
207 | + | else throwInvalidFeeAsset(), if ((amountAssetPayment.amount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
208 | 208 | then true | |
209 | - | else throwAmountAssetZero(), (priceAssetPayment.amount >= value(parseInt(split(valueOrElse(getString(keyPriceAssetsMinAmount()), EMPTY), SEP)[priceAssetsIndex]))), (feeAssetPayment.amount == getInteger(keyFeeAmount()))] | |
209 | + | else throwInvalidAmountAsset(), if ((priceAssetPayment.amount >= value(parseInt(split(valueOrElse(getString(keyPriceAssetsMinAmount()), EMPTY), SEP)[priceAssetsIndex])))) | |
210 | + | then true | |
211 | + | else throw(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
212 | + | then true | |
213 | + | else throw()] | |
210 | 214 | if ((checks == checks)) | |
211 | 215 | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), STATUS_PENDING), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetPayment.amount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetPayment.amount)] | |
212 | 216 | else throw("Strict value is not equal to itself.") |
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 | - | func | |
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 | 61 | let STATUS_PENDING = "pending" | |
62 | 62 | ||
63 | 63 | let STATUS_DECLINED = "declined" | |
64 | 64 | ||
65 | 65 | let STATUS_CREATING = "creating" | |
66 | 66 | ||
67 | 67 | let STATUS_ACTIVE = "active" | |
68 | 68 | ||
69 | 69 | let STATUS_BOT_DISABLED = "bot_disabled" | |
70 | 70 | ||
71 | 71 | let STATUSES = [STATUS_PENDING, STATUS_DECLINED, STATUS_CREATING, STATUS_ACTIVE, STATUS_BOT_DISABLED] | |
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 | - | func | |
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 | - | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(keyAssetsStoreContract()), (("status_<" + assetId) + ">")), 0) == 2) | |
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 | 170 | func validStatus (status) = containsElement(STATUSES, status) | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | @Callable(i) | |
174 | - | func constructor (factoryV2Address,assetsStoreAddress,priceAssetIds,priceAssetsMinAmount, | |
174 | + | func constructor (factoryV2Address,assetsStoreAddress,priceAssetIds,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
175 | 175 | let checkCaller = mustManager(i) | |
176 | 176 | if ((checkCaller == checkCaller)) | |
177 | - | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyPriceAssetIds(), makeString(priceAssetIds, SEP)), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), | |
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 $t059105981 = getIdAndInfo(amountAssetPayment) | |
189 | + | let amountAssetId = $t059105981._1 | |
190 | + | let amountAssetInfo = $t059105981._2 | |
191 | + | let $t059846052 = getIdAndInfo(priceAssetPayment) | |
192 | + | let priceAssetId = $t059846052._1 | |
193 | + | let priceAssetInfo = $t059846052._2 | |
194 | + | let $t060556117 = getIdAndInfo(feeAssetPayment) | |
195 | + | let feeAssetId = $t060556117._1 | |
196 | + | let feeAssetInfo = $t060556117._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 | - | else throwInvalidFeeAsset(), if ((amountAssetPayment.amount > | |
207 | + | else throwInvalidFeeAsset(), if ((amountAssetPayment.amount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
208 | 208 | then true | |
209 | - | else throwAmountAssetZero(), (priceAssetPayment.amount >= value(parseInt(split(valueOrElse(getString(keyPriceAssetsMinAmount()), EMPTY), SEP)[priceAssetsIndex]))), (feeAssetPayment.amount == getInteger(keyFeeAmount()))] | |
209 | + | else throwInvalidAmountAsset(), if ((priceAssetPayment.amount >= value(parseInt(split(valueOrElse(getString(keyPriceAssetsMinAmount()), EMPTY), SEP)[priceAssetsIndex])))) | |
210 | + | then true | |
211 | + | else throw(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
212 | + | then true | |
213 | + | else throw()] | |
210 | 214 | if ((checks == checks)) | |
211 | 215 | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), STATUS_PENDING), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetPayment.amount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetPayment.amount)] | |
212 | 216 | else throw("Strict value is not equal to itself.") | |
213 | 217 | } | |
214 | 218 | ||
215 | 219 | ||
216 | 220 | ||
217 | 221 | @Callable(i) | |
218 | 222 | func setStatus (amountAssetId,priceAssetId,newStatus) = { | |
219 | 223 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
220 | 224 | then true | |
221 | 225 | else throwCreateNotCalled(), if (validStatus(newStatus)) | |
222 | 226 | then true | |
223 | 227 | else throwInvalidStatus()] | |
224 | 228 | if ((checks == checks)) | |
225 | 229 | then [StringEntry(keyStatus(amountAssetId, priceAssetId), newStatus)] | |
226 | 230 | else throw("Strict value is not equal to itself.") | |
227 | 231 | } | |
228 | 232 | ||
229 | 233 | ||
230 | 234 | ||
231 | 235 | @Callable(i) | |
232 | 236 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker) = { | |
233 | 237 | let checks = [mustManager(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
234 | 238 | then true | |
235 | 239 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == STATUS_PENDING)) | |
236 | 240 | then true | |
237 | 241 | else throwCanActivateOnlyPendingPool()] | |
238 | 242 | if ((checks == checks)) | |
239 | 243 | then { | |
240 | 244 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((("WX " + amountAssetTicker) + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL"], nil) | |
241 | 245 | if ((activateNewPoolInv == activateNewPoolInv)) | |
242 | 246 | then { | |
243 | 247 | let lpAssetId = match activateNewPoolInv { | |
244 | 248 | case id: String => | |
245 | 249 | id | |
246 | 250 | case _ => | |
247 | 251 | throwFactoryReturnedNotString() | |
248 | 252 | } | |
249 | 253 | if ((lpAssetId == lpAssetId)) | |
250 | 254 | then { | |
251 | 255 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
252 | 256 | if ((beforePut == beforePut)) | |
253 | 257 | then { | |
254 | 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))))]) | |
255 | 259 | if ((put == put)) | |
256 | 260 | then { | |
257 | 261 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
258 | 262 | if ((afterPut == afterPut)) | |
259 | 263 | then { | |
260 | 264 | let user = value(assetInfo(fromBase58String(amountAssetId))).issuer | |
261 | 265 | [StringEntry(keyStatus(amountAssetId, priceAssetId), STATUS_CREATING), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
262 | 266 | } | |
263 | 267 | else throw("Strict value is not equal to itself.") | |
264 | 268 | } | |
265 | 269 | else throw("Strict value is not equal to itself.") | |
266 | 270 | } | |
267 | 271 | else throw("Strict value is not equal to itself.") | |
268 | 272 | } | |
269 | 273 | else throw("Strict value is not equal to itself.") | |
270 | 274 | } | |
271 | 275 | else throw("Strict value is not equal to itself.") | |
272 | 276 | } | |
273 | 277 | else throw("Strict value is not equal to itself.") | |
274 | 278 | } | |
275 | 279 | ||
276 | 280 | ||
277 | 281 | ||
278 | 282 | @Callable(i) | |
279 | 283 | func setAdmins (adminPubKeys) = { | |
280 | 284 | let checkCaller = mustManager(i) | |
281 | 285 | if ((checkCaller == checkCaller)) | |
282 | 286 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
283 | 287 | else throw("Strict value is not equal to itself.") | |
284 | 288 | } | |
285 | 289 | ||
286 | 290 | ||
287 | 291 | ||
288 | 292 | @Callable(i) | |
289 | 293 | func setManager (pendingManagerPublicKey) = { | |
290 | 294 | let checkCaller = mustManager(i) | |
291 | 295 | if ((checkCaller == checkCaller)) | |
292 | 296 | then { | |
293 | 297 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
294 | 298 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
295 | 299 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
296 | 300 | else throw("Strict value is not equal to itself.") | |
297 | 301 | } | |
298 | 302 | else throw("Strict value is not equal to itself.") | |
299 | 303 | } | |
300 | 304 | ||
301 | 305 | ||
302 | 306 | ||
303 | 307 | @Callable(i) | |
304 | 308 | func confirmManager () = { | |
305 | 309 | let pm = pendingManagerPublicKeyOrUnit() | |
306 | 310 | let hasPM = if (isDefined(pm)) | |
307 | 311 | then true | |
308 | 312 | else throw("No pending manager") | |
309 | 313 | if ((hasPM == hasPM)) | |
310 | 314 | then { | |
311 | 315 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
312 | 316 | then true | |
313 | 317 | else throw("You are not pending manager") | |
314 | 318 | if ((checkPM == checkPM)) | |
315 | 319 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
316 | 320 | else throw("Strict value is not equal to itself.") | |
317 | 321 | } | |
318 | 322 | else throw("Strict value is not equal to itself.") | |
319 | 323 | } | |
320 | 324 | ||
321 | 325 | ||
322 | 326 | @Verifier(tx) | |
323 | 327 | func verify () = { | |
324 | 328 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
325 | 329 | case pk: ByteVector => | |
326 | 330 | pk | |
327 | 331 | case _: Unit => | |
328 | 332 | tx.senderPublicKey | |
329 | 333 | case _ => | |
330 | 334 | throw("Match error") | |
331 | 335 | } | |
332 | 336 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
333 | 337 | } | |
334 | 338 |
github/deemru/w8io/026f985 58.65 ms ◑