tx · 3jn389JsnYPnD7Tyt9tZ1d2DWHX2A9EyS8uZJFJuBNnc 3Mz5Ya4WEXatCfa2JKqqCe4g3deCrFaBxiL: -0.01400000 Waves 2019.09.27 23:32 [695318] smart account 3Mz5Ya4WEXatCfa2JKqqCe4g3deCrFaBxiL > SELF 0.00000000 Waves
{ "type": 13, "id": "3jn389JsnYPnD7Tyt9tZ1d2DWHX2A9EyS8uZJFJuBNnc", "fee": 1400000, "feeAssetId": null, "timestamp": 1569616436554, "version": 1, "sender": "3Mz5Ya4WEXatCfa2JKqqCe4g3deCrFaBxiL", "senderPublicKey": "CmDpND6JVW2kuJjY4zyXaTHga2fTuCGbo3G9aySpdybJ", "proofs": [ "5gVJGYJP5Kjy3YePHxVvyqfvjyGFXWx1wNEaRh1fKP3uqfCSXAHg4jB2sVqfrs45oLXRDumuQjk5snDVazAuWSDb" ], "script": "base64:AAIDAAAAAAAAAAAAAABhAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAAAABAAAADGdldEJvb2xCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQcAAAAAD0xJU1RTUExJVFNZTUJPTAIAAAABXwAAAAAOTElTVERBVEFTWU1CT0wCAAAAASsAAA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yYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAACm9yZGVyT3duZXIJAQAAABVjb252ZXJ0Qm9uZFRvTmV1dHJpbm8AAAABBQAAAA5uZXdGaWxsZWRUb3RhbAUAAAAPbmV1dHJpbm9Bc3NldElkBQAAAANuaWwAAAAAO1fVaA==", "chainId": 84, "height": 695318, "spentComplexity": 0 } View: original | compacted Prev: EHA9aiUZuunrmyR7BDmv4kwwLP6TPtsLbu1AFKZsveMN Next: 6sWj91cmh1JANWDRTGbDiBTSEiWXskqaFohHJxMc1W4x Diff:
Old | New | Differences | |
---|---|---|---|
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | - | func getNumberByKeyAndAddress (address,key) = match getInteger(addressFromStringValue(address), key) { | |
29 | - | case a: Int => | |
30 | - | a | |
31 | - | case _ => | |
32 | - | 0 | |
33 | - | } | |
28 | + | let LISTSPLITSYMBOL = "_" | |
34 | 29 | ||
30 | + | let LISTDATASYMBOL = "+" | |
35 | 31 | ||
36 | - | func getStringByKeyAndAddress (address,key) = match getString(addressFromStringValue(address), key) { | |
37 | - | case a: String => | |
38 | - | a | |
39 | - | case _ => | |
40 | - | "" | |
41 | - | } | |
32 | + | let WAVELET = 100000000 | |
42 | 33 | ||
34 | + | let CANCELED = "canceled" | |
43 | 35 | ||
44 | - | func getBoolByKeyAndAddress (address,key) = match getBoolean(addressFromStringValue(address), key) { | |
45 | - | case a: Boolean => | |
46 | - | a | |
47 | - | case _ => | |
48 | - | false | |
49 | - | } | |
36 | + | let NEW = "new" | |
50 | 37 | ||
51 | - | ||
52 | - | let ListSplitSymbol = "_" | |
53 | - | ||
54 | - | let BalanceLockBlock = 0 | |
55 | - | ||
56 | - | let ListDataSplitSymbol = "+" | |
57 | - | ||
58 | - | let Wavelet = 100000000 | |
59 | - | ||
60 | - | let MinimalBondOrder = (10 * Wavelet) | |
61 | - | ||
62 | - | let MinimalSurplus = (10 * Wavelet) | |
63 | - | ||
64 | - | let ApplyBlockTimeout = 10 | |
38 | + | let FILLED = "filled" | |
65 | 39 | ||
66 | 40 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
67 | 41 | ||
69 | 43 | ||
70 | 44 | let AuctionContractKey = "auction_contract" | |
71 | 45 | ||
46 | + | let BalanceLockIntervalKey = "balance_lock_interval" | |
47 | + | ||
48 | + | let VoteIntervalKey = "vote_interval" | |
49 | + | ||
50 | + | let MinSwapAmountKey = "min_swap_amount" | |
51 | + | ||
52 | + | let PriceOffsetKey = "price_offset" | |
53 | + | ||
54 | + | let ProvidingIntervalKey = "providing_interval" | |
55 | + | ||
72 | 56 | let PriceKey = "price" | |
73 | 57 | ||
74 | 58 | let NeutrinoBalanceKey = "neutrino_" | |
75 | 59 | ||
76 | 60 | let WavesBalanceKey = "waves_" | |
77 | 61 | ||
78 | - | let | |
62 | + | let BalanceUnlockBlockKey = "balance_block_" | |
79 | 63 | ||
80 | 64 | let OrderbookKey = "orderbook" | |
81 | 65 | ||
89 | 73 | ||
90 | 74 | let OrderStatusKey = "order_status_" | |
91 | 75 | ||
92 | - | let OracleKey = "oracle" | |
76 | + | let IsBlockedKey = "is_blocked" | |
77 | + | ||
78 | + | let BlackSwarmPriceKey = "black_swarm_price" | |
79 | + | ||
80 | + | let AdminVoteKey = "admin_vote_" | |
81 | + | ||
82 | + | let AdminVotePriceKey = "admin_vote_price_" | |
83 | + | ||
84 | + | let BlockExpireVoteKey = "vote_expire_block" | |
85 | + | ||
86 | + | let AdminKey = "admin_" | |
87 | + | ||
88 | + | let IsPricePendingKey = "is_pending_price" | |
89 | + | ||
90 | + | let OracleKey = "oracle_" | |
91 | + | ||
92 | + | let OracleIsProvideKey = "oracle_is_provide_" | |
93 | + | ||
94 | + | let OracleProvidePriceKey = "oracle_price_provide_" | |
95 | + | ||
96 | + | let BlockExpireProvidingKey = "providing_expire_block" | |
97 | + | ||
98 | + | func getAdminKey (count) = (AdminKey + toString(count)) | |
99 | + | ||
100 | + | ||
101 | + | func getAdminVoteKey (owner) = (AdminVoteKey + owner) | |
102 | + | ||
103 | + | ||
104 | + | func getAdminVotePriceKey (owner) = (AdminVotePriceKey + owner) | |
105 | + | ||
106 | + | ||
107 | + | func getOracleKey (count) = (OracleKey + toString(count)) | |
108 | + | ||
109 | + | ||
110 | + | func getOracleIsProvideKey (owner) = (OracleIsProvideKey + owner) | |
111 | + | ||
112 | + | ||
113 | + | func getOracleProvidePriceKey (owner) = (OracleProvidePriceKey + owner) | |
114 | + | ||
115 | + | ||
116 | + | func getNeutrinoBalanceKey (owner) = (NeutrinoBalanceKey + owner) | |
117 | + | ||
118 | + | ||
119 | + | func getWavesBalanceKey (owner) = (WavesBalanceKey + owner) | |
120 | + | ||
121 | + | ||
122 | + | func getBalanceUnlockBlockKey (owner) = (BalanceUnlockBlockKey + owner) | |
123 | + | ||
124 | + | ||
125 | + | func getBlackSwarmPriceKey (block) = ((BlackSwarmPriceKey + "_") + toString(block)) | |
126 | + | ||
127 | + | ||
128 | + | func getPriceHistoryKey (block) = ((PriceKey + "_") + toString(block)) | |
129 | + | ||
130 | + | ||
131 | + | func getOrderTotalKey (orderId) = (OrderTotalKey + orderId) | |
132 | + | ||
133 | + | ||
134 | + | func getOrderOwnerKey (orderId) = (OrderOwnerKey + orderId) | |
135 | + | ||
136 | + | ||
137 | + | func getOrderHeightKey (orderId) = (OrderHeightKey + orderId) | |
138 | + | ||
139 | + | ||
140 | + | func getOrderStatusKey (orderId) = (OrderStatusKey + orderId) | |
141 | + | ||
142 | + | ||
143 | + | func getOrderFilledTotalKey (orderId) = (OrderFilledTotalKey + orderId) | |
144 | + | ||
145 | + | ||
146 | + | let price = getNumberByKey(PriceKey) | |
147 | + | ||
148 | + | func convertNeutrinoToWaves (amount) = ((amount * 100) / price) | |
149 | + | ||
150 | + | ||
151 | + | func convertWavesToNeutrino (amount) = ((amount * price) / 100) | |
152 | + | ||
153 | + | ||
154 | + | func convertNeutrinoToBond (amount) = (amount / WAVELET) | |
155 | + | ||
156 | + | ||
157 | + | func convertBondToNeutrino (amount) = (amount * WAVELET) | |
158 | + | ||
159 | + | ||
160 | + | func convertWavesToBond (amount) = convertNeutrinoToBond(convertWavesToNeutrino(amount)) | |
161 | + | ||
162 | + | ||
163 | + | let providingInterval = getNumberByKey(ProvidingIntervalKey) | |
164 | + | ||
165 | + | let blockExpireProviding = getNumberByKey(BlockExpireProvidingKey) | |
166 | + | ||
167 | + | let isPricePending = getBoolByKey(IsPricePendingKey) | |
168 | + | ||
169 | + | let percentPriceOffset = getNumberByKey(PriceOffsetKey) | |
170 | + | ||
171 | + | let voteInterval = getNumberByKey(VoteIntervalKey) | |
172 | + | ||
173 | + | let blockExpireVote = getNumberByKey(BlockExpireVoteKey) | |
174 | + | ||
175 | + | let balanceLockInterval = getNumberByKey(BalanceLockIntervalKey) | |
176 | + | ||
177 | + | let isBlocked = getBoolByKey(IsBlockedKey) | |
178 | + | ||
179 | + | let minSwapAmount = getNumberByKey(MinSwapAmountKey) | |
93 | 180 | ||
94 | 181 | let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey)) | |
95 | 182 | ||
96 | 183 | let auctionContract = getStringByKey(AuctionContractKey) | |
97 | - | ||
98 | - | let price = getNumberByKey(PriceKey) | |
99 | 184 | ||
100 | 185 | let reserve = wavesBalance(this) | |
101 | 186 | ||
102 | 187 | let orderbook = getStringByKey(OrderbookKey) | |
103 | 188 | ||
104 | 189 | let bondAssetId = fromBase58String(getStringByKey(BondAssetIdKey)) | |
105 | - | ||
106 | - | let oracle = getStringByKey(OracleKey) | |
107 | 190 | ||
108 | 191 | let bondSupply = { | |
109 | 192 | let info = extract(assetInfo(bondAssetId)) | |
115 | 198 | (info.quantity - assetBalance(this, neutrinoAssetId)) | |
116 | 199 | } | |
117 | 200 | ||
118 | - | func getWavesBalance (owner) = getNumberByKey((WavesBalanceKey + owner)) | |
201 | + | let surplus = (convertWavesToNeutrino(reserve) - neutrinoSupply) | |
202 | + | ||
203 | + | let oracleOne = getStringByKey(getOracleKey(0)) | |
204 | + | ||
205 | + | let oracleTwo = getStringByKey(getOracleKey(1)) | |
206 | + | ||
207 | + | let oracleThree = getStringByKey(getOracleKey(2)) | |
208 | + | ||
209 | + | let adminOne = getStringByKey(getAdminKey(0)) | |
210 | + | ||
211 | + | let adminTwo = getStringByKey(getAdminKey(1)) | |
212 | + | ||
213 | + | let adminThree = getStringByKey(getAdminKey(2)) | |
214 | + | ||
215 | + | func getAdminVoteInt (owner) = if (getBoolByKey(getAdminVoteKey(owner))) | |
216 | + | then 1 | |
217 | + | else 0 | |
119 | 218 | ||
120 | 219 | ||
121 | - | func | |
220 | + | func getAdminVotePrice (owner) = getNumberByKey(getAdminVotePriceKey(owner)) | |
122 | 221 | ||
123 | 222 | ||
124 | - | func | |
223 | + | func isOracleProvide (owner) = getBoolByKey(getOracleIsProvideKey(owner)) | |
125 | 224 | ||
126 | 225 | ||
127 | - | func getOrderTotal (id) = getNumberByKey((OrderTotalKey + id)) | |
226 | + | func isOracleProvideInt (owner) = if (isOracleProvide(owner)) | |
227 | + | then 1 | |
228 | + | else 0 | |
128 | 229 | ||
129 | 230 | ||
130 | - | func | |
231 | + | func getOracleProvidePrice (owner) = getNumberByKey(getOracleProvidePriceKey(owner)) | |
131 | 232 | ||
132 | 233 | ||
133 | - | func | |
234 | + | func getWavesBalance (owner) = getNumberByKey(getWavesBalanceKey(owner)) | |
134 | 235 | ||
135 | 236 | ||
136 | - | func | |
237 | + | func getNeutrinoBalance (owner) = getNumberByKey(getNeutrinoBalanceKey(owner)) | |
137 | 238 | ||
138 | 239 | ||
139 | - | func | |
240 | + | func getUnlockBalanceBlock (owner) = getNumberByKey(getBalanceUnlockBlockKey(owner)) | |
140 | 241 | ||
141 | 242 | ||
142 | - | func | |
243 | + | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
143 | 244 | ||
144 | 245 | ||
145 | - | func | |
246 | + | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
146 | 247 | ||
147 | 248 | ||
148 | - | func | |
249 | + | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
149 | 250 | ||
150 | 251 | ||
151 | - | ||
252 | + | func getOrderElementById (id) = (id + LISTSPLITSYMBOL) | |
152 | 253 | ||
153 | - | let CANCELED = "canceled" | |
154 | 254 | ||
155 | - | ||
255 | + | func addOrder (orderId) = (orderbook + getOrderElementById(orderId)) | |
156 | 256 | ||
157 | - | let FILLED = "filled" | |
257 | + | ||
258 | + | func dropOrder (orderId) = { | |
259 | + | let parts = split(orderbook, getOrderElementById(orderId)) | |
260 | + | (parts[0] + parts[1]) | |
261 | + | } | |
262 | + | ||
158 | 263 | ||
159 | 264 | @Callable(i) | |
160 | - | func setCurrentPrice ( | |
265 | + | func setCurrentPrice (newPrice) = { | |
161 | 266 | let account = toString(i.caller) | |
162 | - | if ((account != oracle)) | |
163 | - | then throw("permission denied") | |
164 | - | else WriteSet([DataEntry(PriceKey, price), DataEntry(((PriceKey + ListSplitSymbol) + toString(height)), price)]) | |
267 | + | let priceProvidingCount = (((isOracleProvideInt(oracleOne) + isOracleProvideInt(oracleTwo)) + isOracleProvideInt(oracleThree)) + 1) | |
268 | + | if (isBlocked) | |
269 | + | then throw("contract is blocked") | |
270 | + | else if (if (if ((account != oracleOne)) | |
271 | + | then (account != oracleTwo) | |
272 | + | else false) | |
273 | + | then (account != oracleThree) | |
274 | + | else false) | |
275 | + | then throw("permission denied") | |
276 | + | else if (if ((blockExpireProviding >= height)) | |
277 | + | then isOracleProvide(account) | |
278 | + | else false) | |
279 | + | then throw("price is already provided") | |
280 | + | else if (if ((height > blockExpireProviding)) | |
281 | + | then isPricePending | |
282 | + | else false) | |
283 | + | then throw("use finilizeCurrentPrice") | |
284 | + | else WriteSet([DataEntry(getOracleProvidePriceKey(account), newPrice), DataEntry(BlockExpireProvidingKey, if ((height > blockExpireProviding)) | |
285 | + | then (height + providingInterval) | |
286 | + | else blockExpireProviding), DataEntry(getOracleIsProvideKey(oracleOne), if ((height > blockExpireProviding)) | |
287 | + | then false | |
288 | + | else isOracleProvide(oracleOne)), DataEntry(getOracleIsProvideKey(oracleTwo), if ((height > blockExpireProviding)) | |
289 | + | then false | |
290 | + | else isOracleProvide(oracleTwo)), DataEntry(getOracleIsProvideKey(oracleThree), if ((height > blockExpireProviding)) | |
291 | + | then false | |
292 | + | else isOracleProvide(oracleThree)), DataEntry(getOracleIsProvideKey(account), true), DataEntry(IsPricePendingKey, if (if ((blockExpireProviding >= height)) | |
293 | + | then (priceProvidingCount >= 2) | |
294 | + | else false) | |
295 | + | then true | |
296 | + | else isPricePending)]) | |
297 | + | } | |
298 | + | ||
299 | + | ||
300 | + | ||
301 | + | @Callable(i) | |
302 | + | func finilizeCurrentPrice () = { | |
303 | + | let account = toString(i.caller) | |
304 | + | let priceProvidingCount = ((isOracleProvideInt(oracleOne) + isOracleProvideInt(oracleTwo)) + isOracleProvideInt(oracleThree)) | |
305 | + | let newPrice = ((((getOracleProvidePrice(oracleOne) * isOracleProvideInt(oracleOne)) + (getOracleProvidePrice(oracleTwo) * isOracleProvideInt(oracleTwo))) + (getOracleProvidePrice(oracleThree) * isOracleProvideInt(oracleThree))) / priceProvidingCount) | |
306 | + | if (isBlocked) | |
307 | + | then throw("contract is blocked") | |
308 | + | else if (if (if ((account != oracleOne)) | |
309 | + | then (account != oracleTwo) | |
310 | + | else false) | |
311 | + | then (account != oracleThree) | |
312 | + | else false) | |
313 | + | then throw("permission denied") | |
314 | + | else if (if (!(isPricePending)) | |
315 | + | then true | |
316 | + | else (blockExpireProviding >= height)) | |
317 | + | then throw("wait for the end of the price providing") | |
318 | + | else if ((2 > priceProvidingCount)) | |
319 | + | then throw("2/3 oracles need to set a price") | |
320 | + | else if (if ((newPrice >= (price + ((price * percentPriceOffset) / 100)))) | |
321 | + | then true | |
322 | + | else ((price - ((price * percentPriceOffset) / 100)) >= newPrice)) | |
323 | + | then WriteSet([DataEntry(IsBlockedKey, true), DataEntry(getBlackSwarmPriceKey(height), newPrice)]) | |
324 | + | else WriteSet([DataEntry(PriceKey, newPrice), DataEntry(getPriceHistoryKey(height), newPrice), DataEntry(IsPricePendingKey, false)]) | |
325 | + | } | |
326 | + | ||
327 | + | ||
328 | + | ||
329 | + | @Callable(i) | |
330 | + | func adminUnlock (newPrice) = { | |
331 | + | let account = toString(i.caller) | |
332 | + | let adminOneVote = if ((account != adminOne)) | |
333 | + | then getAdminVoteInt(adminOne) | |
334 | + | else 0 | |
335 | + | let adminTwoVote = if ((account != adminTwo)) | |
336 | + | then getAdminVoteInt(adminTwo) | |
337 | + | else 0 | |
338 | + | let adminThreeVote = if ((account != adminThree)) | |
339 | + | then getAdminVoteInt(adminThree) | |
340 | + | else 0 | |
341 | + | let adminOnePrice = if (((getAdminVotePrice(adminOne) * adminOneVote) == newPrice)) | |
342 | + | then 1 | |
343 | + | else 0 | |
344 | + | let adminTwoPrice = if (((getAdminVotePrice(adminTwo) * adminTwoVote) == newPrice)) | |
345 | + | then 1 | |
346 | + | else 0 | |
347 | + | let adminThreePrice = if (((getAdminVotePrice(adminThree) * adminThreeVote) == newPrice)) | |
348 | + | then 1 | |
349 | + | else 0 | |
350 | + | if (!(isBlocked)) | |
351 | + | then throw("Contract is not blocked") | |
352 | + | else if (if (((((adminOnePrice + adminTwoPrice) + adminThreePrice) + 1) >= 2)) | |
353 | + | then (blockExpireVote >= height) | |
354 | + | else false) | |
355 | + | then WriteSet([DataEntry(IsBlockedKey, false), DataEntry(PriceKey, newPrice), DataEntry(getPriceHistoryKey(height), newPrice), DataEntry(getAdminVoteKey(adminOne), false), DataEntry(getAdminVoteKey(adminTwo), false), DataEntry(getAdminVoteKey(adminThree), false), DataEntry(BlockExpireVoteKey, 0), DataEntry(BlockExpireProvidingKey, 0), DataEntry(IsPricePendingKey, false)]) | |
356 | + | else WriteSet([DataEntry(getAdminVotePriceKey(account), newPrice), DataEntry(BlockExpireVoteKey, if ((height > blockExpireVote)) | |
357 | + | then (height + voteInterval) | |
358 | + | else blockExpireVote), DataEntry(getAdminVoteKey(adminOne), if ((height > blockExpireVote)) | |
359 | + | then false | |
360 | + | else (adminOneVote == 1)), DataEntry(getAdminVoteKey(adminTwo), if ((height > blockExpireVote)) | |
361 | + | then false | |
362 | + | else (adminTwoVote == 1)), DataEntry(getAdminVoteKey(adminThree), if ((height > blockExpireVote)) | |
363 | + | then false | |
364 | + | else (adminThreeVote == 1)), DataEntry(getAdminVoteKey(account), true)]) | |
365 | + | } | |
366 | + | ||
367 | + | ||
368 | + | ||
369 | + | @Callable(i) | |
370 | + | func adminLock () = { | |
371 | + | let account = toString(i.caller) | |
372 | + | let adminOneVote = if ((account != adminOne)) | |
373 | + | then getAdminVoteInt(adminOne) | |
374 | + | else 1 | |
375 | + | let adminTwoVote = if ((account != adminTwo)) | |
376 | + | then getAdminVoteInt(adminTwo) | |
377 | + | else 1 | |
378 | + | let adminThreeVote = if ((account != adminThree)) | |
379 | + | then getAdminVoteInt(adminThree) | |
380 | + | else 1 | |
381 | + | if (isBlocked) | |
382 | + | then throw("Contract is blocked") | |
383 | + | else if ((((adminOneVote + adminTwoVote) + adminThreeVote) >= 2)) | |
384 | + | then WriteSet([DataEntry(IsBlockedKey, true), DataEntry(getAdminVoteKey(adminOne), false), DataEntry(getAdminVoteKey(adminTwo), false), DataEntry(getAdminVoteKey(adminThree), false), DataEntry(BlockExpireVoteKey, 0)]) | |
385 | + | else WriteSet([DataEntry(BlockExpireVoteKey, if ((height > blockExpireVote)) | |
386 | + | then (height + voteInterval) | |
387 | + | else blockExpireVote), DataEntry(getAdminVoteKey(adminOne), if ((height > blockExpireVote)) | |
388 | + | then false | |
389 | + | else (adminOneVote == 1)), DataEntry(getAdminVoteKey(adminTwo), if ((height > blockExpireVote)) | |
390 | + | then false | |
391 | + | else (adminTwoVote == 1)), DataEntry(getAdminVoteKey(adminThree), if ((height > blockExpireVote)) | |
392 | + | then false | |
393 | + | else (adminThreeVote == 1))]) | |
165 | 394 | } | |
166 | 395 | ||
167 | 396 | ||
169 | 398 | @Callable(i) | |
170 | 399 | func swapWavesToNeutrino () = { | |
171 | 400 | let pmt = extract(i.payment) | |
172 | - | if (isDefined(pmt.assetId)) | |
173 | - | then throw("can use waves only") | |
174 | - | else { | |
175 | - | let account = toBase58String(i.caller.bytes) | |
176 | - | let amount = convertWavesToNeutrino(pmt.amount) | |
177 | - | WriteSet([DataEntry((NeutrinoBalanceKey + toString(i.caller)), (amount + getNeutrinoBalance(account))), DataEntry((BalanceBlockKey + toString(i.caller)), height)]) | |
178 | - | } | |
401 | + | if ((minSwapAmount > pmt.amount)) | |
402 | + | then throw("amount less min") | |
403 | + | else if (isDefined(pmt.assetId)) | |
404 | + | then throw("can use waves only") | |
405 | + | else if (isBlocked) | |
406 | + | then throw("contract is blocked") | |
407 | + | else { | |
408 | + | let account = toBase58String(i.caller.bytes) | |
409 | + | let amount = convertWavesToNeutrino(pmt.amount) | |
410 | + | WriteSet([DataEntry(getNeutrinoBalanceKey(account), (getNeutrinoBalance(account) + amount)), DataEntry(getBalanceUnlockBlockKey(account), (height + balanceLockInterval))]) | |
411 | + | } | |
179 | 412 | } | |
180 | 413 | ||
181 | 414 | ||
183 | 416 | @Callable(i) | |
184 | 417 | func swapNeutrinoToWaves () = { | |
185 | 418 | let pmt = extract(i.payment) | |
186 | - | if ((pmt.assetId != neutrinoAssetId)) | |
187 | - | then throw("can use neutrino only") | |
188 | - | else { | |
189 | - | let account = toBase58String(i.caller.bytes) | |
190 | - | let amount = convertNeutrinoToWaves(pmt.amount) | |
191 | - | WriteSet([DataEntry((WavesBalanceKey + toString(i.caller)), (amount + getWavesBalance(account))), DataEntry((BalanceBlockKey + toString(i.caller)), height)]) | |
192 | - | } | |
419 | + | if ((minSwapAmount > pmt.amount)) | |
420 | + | then throw("amount less min") | |
421 | + | else if (isBlocked) | |
422 | + | then throw("contract is blocked") | |
423 | + | else if ((pmt.assetId != neutrinoAssetId)) | |
424 | + | then throw("can use neutrino only") | |
425 | + | else { | |
426 | + | let account = toBase58String(i.caller.bytes) | |
427 | + | let amount = convertNeutrinoToWaves(pmt.amount) | |
428 | + | WriteSet([DataEntry(getWavesBalanceKey(account), (getWavesBalance(account) + amount)), DataEntry(getBalanceUnlockBlockKey(account), (height + balanceLockInterval))]) | |
429 | + | } | |
193 | 430 | } | |
194 | 431 | ||
195 | 432 | ||
196 | 433 | ||
197 | 434 | @Callable(i) | |
198 | - | func withdraw (account) = if (( | |
435 | + | func withdraw (account) = if ((getUnlockBalanceBlock(account) > height)) | |
199 | 436 | then throw("wait a couple of blocks for withdraw") | |
200 | - | else ScriptResult(WriteSet([DataEntry(( | |
437 | + | else ScriptResult(WriteSet([DataEntry(getWavesBalanceKey(account), 0), DataEntry(getNeutrinoBalanceKey(account), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(account), getNeutrinoBalance(account), neutrinoAssetId), ScriptTransfer(addressFromStringValue(account), getWavesBalance(account), unit)])) | |
201 | 438 | ||
202 | 439 | ||
203 | 440 | ||
206 | 443 | let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve)) | |
207 | 444 | let balanceAuction = assetBalance(addressFromStringValue(auctionContract), bondAssetId) | |
208 | 445 | let amount = (convertNeutrinoToBond(deficit) - balanceAuction) | |
209 | - | if ((amount > 0)) | |
210 | - | then TransferSet([ScriptTransfer(addressFromStringValue(auctionContract), amount, bondAssetId)]) | |
211 | - | else throw("bond were generated or do not need it") | |
446 | + | if (isBlocked) | |
447 | + | then throw("contract is blocked") | |
448 | + | else if ((amount > 0)) | |
449 | + | then TransferSet([ScriptTransfer(addressFromStringValue(auctionContract), amount, bondAssetId)]) | |
450 | + | else throw("bond were generated or do not need it") | |
212 | 451 | } | |
213 | 452 | ||
214 | 453 | ||
221 | 460 | then throw("can use bond only") | |
222 | 461 | else if ((getOrderOwner(newOrderId) != "")) | |
223 | 462 | then throw("order exists") | |
224 | - | else WriteSet([DataEntry(OrderbookKey, ( | |
463 | + | else WriteSet([DataEntry(OrderbookKey, addOrder(newOrderId)), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), toString(i.caller)), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW)]) | |
225 | 464 | } | |
226 | 465 | ||
227 | 466 | ||
232 | 471 | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
233 | 472 | if ((owner != toString(i.caller))) | |
234 | 473 | then throw("permission denied") | |
235 | - | else { | |
236 | - | let parts = split(orderbook, (orderId + ListSplitSymbol)) | |
237 | - | ScriptResult(WriteSet([DataEntry(OrderbookKey, (parts[0] + parts[1])), DataEntry((OrderStatusKey + orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)])) | |
238 | - | } | |
474 | + | else ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)])) | |
239 | 475 | } | |
240 | 476 | ||
241 | 477 | ||
242 | 478 | ||
243 | 479 | @Callable(i) | |
244 | 480 | func executeOrder () = { | |
245 | - | let orderId = split(orderbook, | |
481 | + | let orderId = split(orderbook, LISTSPLITSYMBOL)[0] | |
246 | 482 | let orderTotal = getOrderTotal(orderId) | |
247 | 483 | let orderOwner = getOrderOwner(orderId) | |
248 | 484 | let filledTotal = getOrderFilledTotal(orderId) | |
249 | - | if ((0 >= surplus)) | |
250 | - | then throw("surplus is less than zero") | |
251 | - | else { | |
252 | - | let amount = (orderTotal - filledTotal) | |
253 | - | let surplusBond = convertNeutrinoToBond(surplus) | |
254 | - | let status = if ((surplusBond >= amount)) | |
255 | - | then FILLED | |
256 | - | else NEW | |
257 | - | let newFilledTotal = if ((surplusBond >= amount)) | |
258 | - | then orderTotal | |
259 | - | else surplusBond | |
260 | - | ScriptResult(WriteSet([DataEntry(OrderbookKey, split(orderbook, (orderId + ListSplitSymbol))[1]), DataEntry((OrderFilledTotalKey + orderId), (filledTotal + newFilledTotal)), DataEntry((OrderStatusKey + orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)])) | |
261 | - | } | |
485 | + | if (isBlocked) | |
486 | + | then throw("contract is blocked") | |
487 | + | else if ((0 >= surplus)) | |
488 | + | then throw("surplus is less than zero") | |
489 | + | else { | |
490 | + | let amount = (orderTotal - filledTotal) | |
491 | + | let surplusBond = convertNeutrinoToBond(surplus) | |
492 | + | let status = if ((surplusBond >= amount)) | |
493 | + | then FILLED | |
494 | + | else NEW | |
495 | + | let newFilledTotal = if ((surplusBond >= amount)) | |
496 | + | then orderTotal | |
497 | + | else surplusBond | |
498 | + | ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderFilledTotalKey(orderId), (filledTotal + newFilledTotal)), DataEntry(getOrderStatusKey(orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)])) | |
499 | + | } | |
262 | 500 | } | |
263 | 501 | ||
264 | 502 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByKey (key) = match getInteger(this, key) { | |
5 | 5 | case a: Int => | |
6 | 6 | a | |
7 | 7 | case _ => | |
8 | 8 | 0 | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getStringByKey (key) = match getString(this, key) { | |
13 | 13 | case a: String => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | "" | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getBoolByKey (key) = match getBoolean(this, key) { | |
21 | 21 | case a: Boolean => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | false | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | - | func getNumberByKeyAndAddress (address,key) = match getInteger(addressFromStringValue(address), key) { | |
29 | - | case a: Int => | |
30 | - | a | |
31 | - | case _ => | |
32 | - | 0 | |
33 | - | } | |
28 | + | let LISTSPLITSYMBOL = "_" | |
34 | 29 | ||
30 | + | let LISTDATASYMBOL = "+" | |
35 | 31 | ||
36 | - | func getStringByKeyAndAddress (address,key) = match getString(addressFromStringValue(address), key) { | |
37 | - | case a: String => | |
38 | - | a | |
39 | - | case _ => | |
40 | - | "" | |
41 | - | } | |
32 | + | let WAVELET = 100000000 | |
42 | 33 | ||
34 | + | let CANCELED = "canceled" | |
43 | 35 | ||
44 | - | func getBoolByKeyAndAddress (address,key) = match getBoolean(addressFromStringValue(address), key) { | |
45 | - | case a: Boolean => | |
46 | - | a | |
47 | - | case _ => | |
48 | - | false | |
49 | - | } | |
36 | + | let NEW = "new" | |
50 | 37 | ||
51 | - | ||
52 | - | let ListSplitSymbol = "_" | |
53 | - | ||
54 | - | let BalanceLockBlock = 0 | |
55 | - | ||
56 | - | let ListDataSplitSymbol = "+" | |
57 | - | ||
58 | - | let Wavelet = 100000000 | |
59 | - | ||
60 | - | let MinimalBondOrder = (10 * Wavelet) | |
61 | - | ||
62 | - | let MinimalSurplus = (10 * Wavelet) | |
63 | - | ||
64 | - | let ApplyBlockTimeout = 10 | |
38 | + | let FILLED = "filled" | |
65 | 39 | ||
66 | 40 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
67 | 41 | ||
68 | 42 | let BondAssetIdKey = "bond_asset_id" | |
69 | 43 | ||
70 | 44 | let AuctionContractKey = "auction_contract" | |
71 | 45 | ||
46 | + | let BalanceLockIntervalKey = "balance_lock_interval" | |
47 | + | ||
48 | + | let VoteIntervalKey = "vote_interval" | |
49 | + | ||
50 | + | let MinSwapAmountKey = "min_swap_amount" | |
51 | + | ||
52 | + | let PriceOffsetKey = "price_offset" | |
53 | + | ||
54 | + | let ProvidingIntervalKey = "providing_interval" | |
55 | + | ||
72 | 56 | let PriceKey = "price" | |
73 | 57 | ||
74 | 58 | let NeutrinoBalanceKey = "neutrino_" | |
75 | 59 | ||
76 | 60 | let WavesBalanceKey = "waves_" | |
77 | 61 | ||
78 | - | let | |
62 | + | let BalanceUnlockBlockKey = "balance_block_" | |
79 | 63 | ||
80 | 64 | let OrderbookKey = "orderbook" | |
81 | 65 | ||
82 | 66 | let OrderTotalKey = "order_total_" | |
83 | 67 | ||
84 | 68 | let OrderOwnerKey = "order_owner_" | |
85 | 69 | ||
86 | 70 | let OrderHeightKey = "order_height_" | |
87 | 71 | ||
88 | 72 | let OrderFilledTotalKey = "order_filled_total_" | |
89 | 73 | ||
90 | 74 | let OrderStatusKey = "order_status_" | |
91 | 75 | ||
92 | - | let OracleKey = "oracle" | |
76 | + | let IsBlockedKey = "is_blocked" | |
77 | + | ||
78 | + | let BlackSwarmPriceKey = "black_swarm_price" | |
79 | + | ||
80 | + | let AdminVoteKey = "admin_vote_" | |
81 | + | ||
82 | + | let AdminVotePriceKey = "admin_vote_price_" | |
83 | + | ||
84 | + | let BlockExpireVoteKey = "vote_expire_block" | |
85 | + | ||
86 | + | let AdminKey = "admin_" | |
87 | + | ||
88 | + | let IsPricePendingKey = "is_pending_price" | |
89 | + | ||
90 | + | let OracleKey = "oracle_" | |
91 | + | ||
92 | + | let OracleIsProvideKey = "oracle_is_provide_" | |
93 | + | ||
94 | + | let OracleProvidePriceKey = "oracle_price_provide_" | |
95 | + | ||
96 | + | let BlockExpireProvidingKey = "providing_expire_block" | |
97 | + | ||
98 | + | func getAdminKey (count) = (AdminKey + toString(count)) | |
99 | + | ||
100 | + | ||
101 | + | func getAdminVoteKey (owner) = (AdminVoteKey + owner) | |
102 | + | ||
103 | + | ||
104 | + | func getAdminVotePriceKey (owner) = (AdminVotePriceKey + owner) | |
105 | + | ||
106 | + | ||
107 | + | func getOracleKey (count) = (OracleKey + toString(count)) | |
108 | + | ||
109 | + | ||
110 | + | func getOracleIsProvideKey (owner) = (OracleIsProvideKey + owner) | |
111 | + | ||
112 | + | ||
113 | + | func getOracleProvidePriceKey (owner) = (OracleProvidePriceKey + owner) | |
114 | + | ||
115 | + | ||
116 | + | func getNeutrinoBalanceKey (owner) = (NeutrinoBalanceKey + owner) | |
117 | + | ||
118 | + | ||
119 | + | func getWavesBalanceKey (owner) = (WavesBalanceKey + owner) | |
120 | + | ||
121 | + | ||
122 | + | func getBalanceUnlockBlockKey (owner) = (BalanceUnlockBlockKey + owner) | |
123 | + | ||
124 | + | ||
125 | + | func getBlackSwarmPriceKey (block) = ((BlackSwarmPriceKey + "_") + toString(block)) | |
126 | + | ||
127 | + | ||
128 | + | func getPriceHistoryKey (block) = ((PriceKey + "_") + toString(block)) | |
129 | + | ||
130 | + | ||
131 | + | func getOrderTotalKey (orderId) = (OrderTotalKey + orderId) | |
132 | + | ||
133 | + | ||
134 | + | func getOrderOwnerKey (orderId) = (OrderOwnerKey + orderId) | |
135 | + | ||
136 | + | ||
137 | + | func getOrderHeightKey (orderId) = (OrderHeightKey + orderId) | |
138 | + | ||
139 | + | ||
140 | + | func getOrderStatusKey (orderId) = (OrderStatusKey + orderId) | |
141 | + | ||
142 | + | ||
143 | + | func getOrderFilledTotalKey (orderId) = (OrderFilledTotalKey + orderId) | |
144 | + | ||
145 | + | ||
146 | + | let price = getNumberByKey(PriceKey) | |
147 | + | ||
148 | + | func convertNeutrinoToWaves (amount) = ((amount * 100) / price) | |
149 | + | ||
150 | + | ||
151 | + | func convertWavesToNeutrino (amount) = ((amount * price) / 100) | |
152 | + | ||
153 | + | ||
154 | + | func convertNeutrinoToBond (amount) = (amount / WAVELET) | |
155 | + | ||
156 | + | ||
157 | + | func convertBondToNeutrino (amount) = (amount * WAVELET) | |
158 | + | ||
159 | + | ||
160 | + | func convertWavesToBond (amount) = convertNeutrinoToBond(convertWavesToNeutrino(amount)) | |
161 | + | ||
162 | + | ||
163 | + | let providingInterval = getNumberByKey(ProvidingIntervalKey) | |
164 | + | ||
165 | + | let blockExpireProviding = getNumberByKey(BlockExpireProvidingKey) | |
166 | + | ||
167 | + | let isPricePending = getBoolByKey(IsPricePendingKey) | |
168 | + | ||
169 | + | let percentPriceOffset = getNumberByKey(PriceOffsetKey) | |
170 | + | ||
171 | + | let voteInterval = getNumberByKey(VoteIntervalKey) | |
172 | + | ||
173 | + | let blockExpireVote = getNumberByKey(BlockExpireVoteKey) | |
174 | + | ||
175 | + | let balanceLockInterval = getNumberByKey(BalanceLockIntervalKey) | |
176 | + | ||
177 | + | let isBlocked = getBoolByKey(IsBlockedKey) | |
178 | + | ||
179 | + | let minSwapAmount = getNumberByKey(MinSwapAmountKey) | |
93 | 180 | ||
94 | 181 | let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey)) | |
95 | 182 | ||
96 | 183 | let auctionContract = getStringByKey(AuctionContractKey) | |
97 | - | ||
98 | - | let price = getNumberByKey(PriceKey) | |
99 | 184 | ||
100 | 185 | let reserve = wavesBalance(this) | |
101 | 186 | ||
102 | 187 | let orderbook = getStringByKey(OrderbookKey) | |
103 | 188 | ||
104 | 189 | let bondAssetId = fromBase58String(getStringByKey(BondAssetIdKey)) | |
105 | - | ||
106 | - | let oracle = getStringByKey(OracleKey) | |
107 | 190 | ||
108 | 191 | let bondSupply = { | |
109 | 192 | let info = extract(assetInfo(bondAssetId)) | |
110 | 193 | (info.quantity - assetBalance(this, bondAssetId)) | |
111 | 194 | } | |
112 | 195 | ||
113 | 196 | let neutrinoSupply = { | |
114 | 197 | let info = extract(assetInfo(neutrinoAssetId)) | |
115 | 198 | (info.quantity - assetBalance(this, neutrinoAssetId)) | |
116 | 199 | } | |
117 | 200 | ||
118 | - | func getWavesBalance (owner) = getNumberByKey((WavesBalanceKey + owner)) | |
201 | + | let surplus = (convertWavesToNeutrino(reserve) - neutrinoSupply) | |
202 | + | ||
203 | + | let oracleOne = getStringByKey(getOracleKey(0)) | |
204 | + | ||
205 | + | let oracleTwo = getStringByKey(getOracleKey(1)) | |
206 | + | ||
207 | + | let oracleThree = getStringByKey(getOracleKey(2)) | |
208 | + | ||
209 | + | let adminOne = getStringByKey(getAdminKey(0)) | |
210 | + | ||
211 | + | let adminTwo = getStringByKey(getAdminKey(1)) | |
212 | + | ||
213 | + | let adminThree = getStringByKey(getAdminKey(2)) | |
214 | + | ||
215 | + | func getAdminVoteInt (owner) = if (getBoolByKey(getAdminVoteKey(owner))) | |
216 | + | then 1 | |
217 | + | else 0 | |
119 | 218 | ||
120 | 219 | ||
121 | - | func | |
220 | + | func getAdminVotePrice (owner) = getNumberByKey(getAdminVotePriceKey(owner)) | |
122 | 221 | ||
123 | 222 | ||
124 | - | func | |
223 | + | func isOracleProvide (owner) = getBoolByKey(getOracleIsProvideKey(owner)) | |
125 | 224 | ||
126 | 225 | ||
127 | - | func getOrderTotal (id) = getNumberByKey((OrderTotalKey + id)) | |
226 | + | func isOracleProvideInt (owner) = if (isOracleProvide(owner)) | |
227 | + | then 1 | |
228 | + | else 0 | |
128 | 229 | ||
129 | 230 | ||
130 | - | func | |
231 | + | func getOracleProvidePrice (owner) = getNumberByKey(getOracleProvidePriceKey(owner)) | |
131 | 232 | ||
132 | 233 | ||
133 | - | func | |
234 | + | func getWavesBalance (owner) = getNumberByKey(getWavesBalanceKey(owner)) | |
134 | 235 | ||
135 | 236 | ||
136 | - | func | |
237 | + | func getNeutrinoBalance (owner) = getNumberByKey(getNeutrinoBalanceKey(owner)) | |
137 | 238 | ||
138 | 239 | ||
139 | - | func | |
240 | + | func getUnlockBalanceBlock (owner) = getNumberByKey(getBalanceUnlockBlockKey(owner)) | |
140 | 241 | ||
141 | 242 | ||
142 | - | func | |
243 | + | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
143 | 244 | ||
144 | 245 | ||
145 | - | func | |
246 | + | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
146 | 247 | ||
147 | 248 | ||
148 | - | func | |
249 | + | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
149 | 250 | ||
150 | 251 | ||
151 | - | ||
252 | + | func getOrderElementById (id) = (id + LISTSPLITSYMBOL) | |
152 | 253 | ||
153 | - | let CANCELED = "canceled" | |
154 | 254 | ||
155 | - | ||
255 | + | func addOrder (orderId) = (orderbook + getOrderElementById(orderId)) | |
156 | 256 | ||
157 | - | let FILLED = "filled" | |
257 | + | ||
258 | + | func dropOrder (orderId) = { | |
259 | + | let parts = split(orderbook, getOrderElementById(orderId)) | |
260 | + | (parts[0] + parts[1]) | |
261 | + | } | |
262 | + | ||
158 | 263 | ||
159 | 264 | @Callable(i) | |
160 | - | func setCurrentPrice ( | |
265 | + | func setCurrentPrice (newPrice) = { | |
161 | 266 | let account = toString(i.caller) | |
162 | - | if ((account != oracle)) | |
163 | - | then throw("permission denied") | |
164 | - | else WriteSet([DataEntry(PriceKey, price), DataEntry(((PriceKey + ListSplitSymbol) + toString(height)), price)]) | |
267 | + | let priceProvidingCount = (((isOracleProvideInt(oracleOne) + isOracleProvideInt(oracleTwo)) + isOracleProvideInt(oracleThree)) + 1) | |
268 | + | if (isBlocked) | |
269 | + | then throw("contract is blocked") | |
270 | + | else if (if (if ((account != oracleOne)) | |
271 | + | then (account != oracleTwo) | |
272 | + | else false) | |
273 | + | then (account != oracleThree) | |
274 | + | else false) | |
275 | + | then throw("permission denied") | |
276 | + | else if (if ((blockExpireProviding >= height)) | |
277 | + | then isOracleProvide(account) | |
278 | + | else false) | |
279 | + | then throw("price is already provided") | |
280 | + | else if (if ((height > blockExpireProviding)) | |
281 | + | then isPricePending | |
282 | + | else false) | |
283 | + | then throw("use finilizeCurrentPrice") | |
284 | + | else WriteSet([DataEntry(getOracleProvidePriceKey(account), newPrice), DataEntry(BlockExpireProvidingKey, if ((height > blockExpireProviding)) | |
285 | + | then (height + providingInterval) | |
286 | + | else blockExpireProviding), DataEntry(getOracleIsProvideKey(oracleOne), if ((height > blockExpireProviding)) | |
287 | + | then false | |
288 | + | else isOracleProvide(oracleOne)), DataEntry(getOracleIsProvideKey(oracleTwo), if ((height > blockExpireProviding)) | |
289 | + | then false | |
290 | + | else isOracleProvide(oracleTwo)), DataEntry(getOracleIsProvideKey(oracleThree), if ((height > blockExpireProviding)) | |
291 | + | then false | |
292 | + | else isOracleProvide(oracleThree)), DataEntry(getOracleIsProvideKey(account), true), DataEntry(IsPricePendingKey, if (if ((blockExpireProviding >= height)) | |
293 | + | then (priceProvidingCount >= 2) | |
294 | + | else false) | |
295 | + | then true | |
296 | + | else isPricePending)]) | |
297 | + | } | |
298 | + | ||
299 | + | ||
300 | + | ||
301 | + | @Callable(i) | |
302 | + | func finilizeCurrentPrice () = { | |
303 | + | let account = toString(i.caller) | |
304 | + | let priceProvidingCount = ((isOracleProvideInt(oracleOne) + isOracleProvideInt(oracleTwo)) + isOracleProvideInt(oracleThree)) | |
305 | + | let newPrice = ((((getOracleProvidePrice(oracleOne) * isOracleProvideInt(oracleOne)) + (getOracleProvidePrice(oracleTwo) * isOracleProvideInt(oracleTwo))) + (getOracleProvidePrice(oracleThree) * isOracleProvideInt(oracleThree))) / priceProvidingCount) | |
306 | + | if (isBlocked) | |
307 | + | then throw("contract is blocked") | |
308 | + | else if (if (if ((account != oracleOne)) | |
309 | + | then (account != oracleTwo) | |
310 | + | else false) | |
311 | + | then (account != oracleThree) | |
312 | + | else false) | |
313 | + | then throw("permission denied") | |
314 | + | else if (if (!(isPricePending)) | |
315 | + | then true | |
316 | + | else (blockExpireProviding >= height)) | |
317 | + | then throw("wait for the end of the price providing") | |
318 | + | else if ((2 > priceProvidingCount)) | |
319 | + | then throw("2/3 oracles need to set a price") | |
320 | + | else if (if ((newPrice >= (price + ((price * percentPriceOffset) / 100)))) | |
321 | + | then true | |
322 | + | else ((price - ((price * percentPriceOffset) / 100)) >= newPrice)) | |
323 | + | then WriteSet([DataEntry(IsBlockedKey, true), DataEntry(getBlackSwarmPriceKey(height), newPrice)]) | |
324 | + | else WriteSet([DataEntry(PriceKey, newPrice), DataEntry(getPriceHistoryKey(height), newPrice), DataEntry(IsPricePendingKey, false)]) | |
325 | + | } | |
326 | + | ||
327 | + | ||
328 | + | ||
329 | + | @Callable(i) | |
330 | + | func adminUnlock (newPrice) = { | |
331 | + | let account = toString(i.caller) | |
332 | + | let adminOneVote = if ((account != adminOne)) | |
333 | + | then getAdminVoteInt(adminOne) | |
334 | + | else 0 | |
335 | + | let adminTwoVote = if ((account != adminTwo)) | |
336 | + | then getAdminVoteInt(adminTwo) | |
337 | + | else 0 | |
338 | + | let adminThreeVote = if ((account != adminThree)) | |
339 | + | then getAdminVoteInt(adminThree) | |
340 | + | else 0 | |
341 | + | let adminOnePrice = if (((getAdminVotePrice(adminOne) * adminOneVote) == newPrice)) | |
342 | + | then 1 | |
343 | + | else 0 | |
344 | + | let adminTwoPrice = if (((getAdminVotePrice(adminTwo) * adminTwoVote) == newPrice)) | |
345 | + | then 1 | |
346 | + | else 0 | |
347 | + | let adminThreePrice = if (((getAdminVotePrice(adminThree) * adminThreeVote) == newPrice)) | |
348 | + | then 1 | |
349 | + | else 0 | |
350 | + | if (!(isBlocked)) | |
351 | + | then throw("Contract is not blocked") | |
352 | + | else if (if (((((adminOnePrice + adminTwoPrice) + adminThreePrice) + 1) >= 2)) | |
353 | + | then (blockExpireVote >= height) | |
354 | + | else false) | |
355 | + | then WriteSet([DataEntry(IsBlockedKey, false), DataEntry(PriceKey, newPrice), DataEntry(getPriceHistoryKey(height), newPrice), DataEntry(getAdminVoteKey(adminOne), false), DataEntry(getAdminVoteKey(adminTwo), false), DataEntry(getAdminVoteKey(adminThree), false), DataEntry(BlockExpireVoteKey, 0), DataEntry(BlockExpireProvidingKey, 0), DataEntry(IsPricePendingKey, false)]) | |
356 | + | else WriteSet([DataEntry(getAdminVotePriceKey(account), newPrice), DataEntry(BlockExpireVoteKey, if ((height > blockExpireVote)) | |
357 | + | then (height + voteInterval) | |
358 | + | else blockExpireVote), DataEntry(getAdminVoteKey(adminOne), if ((height > blockExpireVote)) | |
359 | + | then false | |
360 | + | else (adminOneVote == 1)), DataEntry(getAdminVoteKey(adminTwo), if ((height > blockExpireVote)) | |
361 | + | then false | |
362 | + | else (adminTwoVote == 1)), DataEntry(getAdminVoteKey(adminThree), if ((height > blockExpireVote)) | |
363 | + | then false | |
364 | + | else (adminThreeVote == 1)), DataEntry(getAdminVoteKey(account), true)]) | |
365 | + | } | |
366 | + | ||
367 | + | ||
368 | + | ||
369 | + | @Callable(i) | |
370 | + | func adminLock () = { | |
371 | + | let account = toString(i.caller) | |
372 | + | let adminOneVote = if ((account != adminOne)) | |
373 | + | then getAdminVoteInt(adminOne) | |
374 | + | else 1 | |
375 | + | let adminTwoVote = if ((account != adminTwo)) | |
376 | + | then getAdminVoteInt(adminTwo) | |
377 | + | else 1 | |
378 | + | let adminThreeVote = if ((account != adminThree)) | |
379 | + | then getAdminVoteInt(adminThree) | |
380 | + | else 1 | |
381 | + | if (isBlocked) | |
382 | + | then throw("Contract is blocked") | |
383 | + | else if ((((adminOneVote + adminTwoVote) + adminThreeVote) >= 2)) | |
384 | + | then WriteSet([DataEntry(IsBlockedKey, true), DataEntry(getAdminVoteKey(adminOne), false), DataEntry(getAdminVoteKey(adminTwo), false), DataEntry(getAdminVoteKey(adminThree), false), DataEntry(BlockExpireVoteKey, 0)]) | |
385 | + | else WriteSet([DataEntry(BlockExpireVoteKey, if ((height > blockExpireVote)) | |
386 | + | then (height + voteInterval) | |
387 | + | else blockExpireVote), DataEntry(getAdminVoteKey(adminOne), if ((height > blockExpireVote)) | |
388 | + | then false | |
389 | + | else (adminOneVote == 1)), DataEntry(getAdminVoteKey(adminTwo), if ((height > blockExpireVote)) | |
390 | + | then false | |
391 | + | else (adminTwoVote == 1)), DataEntry(getAdminVoteKey(adminThree), if ((height > blockExpireVote)) | |
392 | + | then false | |
393 | + | else (adminThreeVote == 1))]) | |
165 | 394 | } | |
166 | 395 | ||
167 | 396 | ||
168 | 397 | ||
169 | 398 | @Callable(i) | |
170 | 399 | func swapWavesToNeutrino () = { | |
171 | 400 | let pmt = extract(i.payment) | |
172 | - | if (isDefined(pmt.assetId)) | |
173 | - | then throw("can use waves only") | |
174 | - | else { | |
175 | - | let account = toBase58String(i.caller.bytes) | |
176 | - | let amount = convertWavesToNeutrino(pmt.amount) | |
177 | - | WriteSet([DataEntry((NeutrinoBalanceKey + toString(i.caller)), (amount + getNeutrinoBalance(account))), DataEntry((BalanceBlockKey + toString(i.caller)), height)]) | |
178 | - | } | |
401 | + | if ((minSwapAmount > pmt.amount)) | |
402 | + | then throw("amount less min") | |
403 | + | else if (isDefined(pmt.assetId)) | |
404 | + | then throw("can use waves only") | |
405 | + | else if (isBlocked) | |
406 | + | then throw("contract is blocked") | |
407 | + | else { | |
408 | + | let account = toBase58String(i.caller.bytes) | |
409 | + | let amount = convertWavesToNeutrino(pmt.amount) | |
410 | + | WriteSet([DataEntry(getNeutrinoBalanceKey(account), (getNeutrinoBalance(account) + amount)), DataEntry(getBalanceUnlockBlockKey(account), (height + balanceLockInterval))]) | |
411 | + | } | |
179 | 412 | } | |
180 | 413 | ||
181 | 414 | ||
182 | 415 | ||
183 | 416 | @Callable(i) | |
184 | 417 | func swapNeutrinoToWaves () = { | |
185 | 418 | let pmt = extract(i.payment) | |
186 | - | if ((pmt.assetId != neutrinoAssetId)) | |
187 | - | then throw("can use neutrino only") | |
188 | - | else { | |
189 | - | let account = toBase58String(i.caller.bytes) | |
190 | - | let amount = convertNeutrinoToWaves(pmt.amount) | |
191 | - | WriteSet([DataEntry((WavesBalanceKey + toString(i.caller)), (amount + getWavesBalance(account))), DataEntry((BalanceBlockKey + toString(i.caller)), height)]) | |
192 | - | } | |
419 | + | if ((minSwapAmount > pmt.amount)) | |
420 | + | then throw("amount less min") | |
421 | + | else if (isBlocked) | |
422 | + | then throw("contract is blocked") | |
423 | + | else if ((pmt.assetId != neutrinoAssetId)) | |
424 | + | then throw("can use neutrino only") | |
425 | + | else { | |
426 | + | let account = toBase58String(i.caller.bytes) | |
427 | + | let amount = convertNeutrinoToWaves(pmt.amount) | |
428 | + | WriteSet([DataEntry(getWavesBalanceKey(account), (getWavesBalance(account) + amount)), DataEntry(getBalanceUnlockBlockKey(account), (height + balanceLockInterval))]) | |
429 | + | } | |
193 | 430 | } | |
194 | 431 | ||
195 | 432 | ||
196 | 433 | ||
197 | 434 | @Callable(i) | |
198 | - | func withdraw (account) = if (( | |
435 | + | func withdraw (account) = if ((getUnlockBalanceBlock(account) > height)) | |
199 | 436 | then throw("wait a couple of blocks for withdraw") | |
200 | - | else ScriptResult(WriteSet([DataEntry(( | |
437 | + | else ScriptResult(WriteSet([DataEntry(getWavesBalanceKey(account), 0), DataEntry(getNeutrinoBalanceKey(account), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(account), getNeutrinoBalance(account), neutrinoAssetId), ScriptTransfer(addressFromStringValue(account), getWavesBalance(account), unit)])) | |
201 | 438 | ||
202 | 439 | ||
203 | 440 | ||
204 | 441 | @Callable(i) | |
205 | 442 | func generateBond () = { | |
206 | 443 | let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve)) | |
207 | 444 | let balanceAuction = assetBalance(addressFromStringValue(auctionContract), bondAssetId) | |
208 | 445 | let amount = (convertNeutrinoToBond(deficit) - balanceAuction) | |
209 | - | if ((amount > 0)) | |
210 | - | then TransferSet([ScriptTransfer(addressFromStringValue(auctionContract), amount, bondAssetId)]) | |
211 | - | else throw("bond were generated or do not need it") | |
446 | + | if (isBlocked) | |
447 | + | then throw("contract is blocked") | |
448 | + | else if ((amount > 0)) | |
449 | + | then TransferSet([ScriptTransfer(addressFromStringValue(auctionContract), amount, bondAssetId)]) | |
450 | + | else throw("bond were generated or do not need it") | |
212 | 451 | } | |
213 | 452 | ||
214 | 453 | ||
215 | 454 | ||
216 | 455 | @Callable(i) | |
217 | 456 | func setOrder () = { | |
218 | 457 | let pmt = extract(i.payment) | |
219 | 458 | let newOrderId = toBase58String(keccak256(((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height)))) | |
220 | 459 | if ((pmt.assetId != bondAssetId)) | |
221 | 460 | then throw("can use bond only") | |
222 | 461 | else if ((getOrderOwner(newOrderId) != "")) | |
223 | 462 | then throw("order exists") | |
224 | - | else WriteSet([DataEntry(OrderbookKey, ( | |
463 | + | else WriteSet([DataEntry(OrderbookKey, addOrder(newOrderId)), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), toString(i.caller)), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW)]) | |
225 | 464 | } | |
226 | 465 | ||
227 | 466 | ||
228 | 467 | ||
229 | 468 | @Callable(i) | |
230 | 469 | func cancelOrder (orderId) = { | |
231 | 470 | let owner = getOrderOwner(orderId) | |
232 | 471 | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
233 | 472 | if ((owner != toString(i.caller))) | |
234 | 473 | then throw("permission denied") | |
235 | - | else { | |
236 | - | let parts = split(orderbook, (orderId + ListSplitSymbol)) | |
237 | - | ScriptResult(WriteSet([DataEntry(OrderbookKey, (parts[0] + parts[1])), DataEntry((OrderStatusKey + orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)])) | |
238 | - | } | |
474 | + | else ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)])) | |
239 | 475 | } | |
240 | 476 | ||
241 | 477 | ||
242 | 478 | ||
243 | 479 | @Callable(i) | |
244 | 480 | func executeOrder () = { | |
245 | - | let orderId = split(orderbook, | |
481 | + | let orderId = split(orderbook, LISTSPLITSYMBOL)[0] | |
246 | 482 | let orderTotal = getOrderTotal(orderId) | |
247 | 483 | let orderOwner = getOrderOwner(orderId) | |
248 | 484 | let filledTotal = getOrderFilledTotal(orderId) | |
249 | - | if ((0 >= surplus)) | |
250 | - | then throw("surplus is less than zero") | |
251 | - | else { | |
252 | - | let amount = (orderTotal - filledTotal) | |
253 | - | let surplusBond = convertNeutrinoToBond(surplus) | |
254 | - | let status = if ((surplusBond >= amount)) | |
255 | - | then FILLED | |
256 | - | else NEW | |
257 | - | let newFilledTotal = if ((surplusBond >= amount)) | |
258 | - | then orderTotal | |
259 | - | else surplusBond | |
260 | - | ScriptResult(WriteSet([DataEntry(OrderbookKey, split(orderbook, (orderId + ListSplitSymbol))[1]), DataEntry((OrderFilledTotalKey + orderId), (filledTotal + newFilledTotal)), DataEntry((OrderStatusKey + orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)])) | |
261 | - | } | |
485 | + | if (isBlocked) | |
486 | + | then throw("contract is blocked") | |
487 | + | else if ((0 >= surplus)) | |
488 | + | then throw("surplus is less than zero") | |
489 | + | else { | |
490 | + | let amount = (orderTotal - filledTotal) | |
491 | + | let surplusBond = convertNeutrinoToBond(surplus) | |
492 | + | let status = if ((surplusBond >= amount)) | |
493 | + | then FILLED | |
494 | + | else NEW | |
495 | + | let newFilledTotal = if ((surplusBond >= amount)) | |
496 | + | then orderTotal | |
497 | + | else surplusBond | |
498 | + | ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderFilledTotalKey(orderId), (filledTotal + newFilledTotal)), DataEntry(getOrderStatusKey(orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)])) | |
499 | + | } | |
262 | 500 | } | |
263 | 501 | ||
264 | 502 |
github/deemru/w8io/169f3d6 78.44 ms ◑