tx · B2PQy2yDB8EaCUcdm881J8JpjcVyndq2nh3sUKUtgCP4 3NBa3D825FiK62g33t84fNBhSE38P5dvVj1: -0.01000000 Waves 2020.01.28 18:10 [874325] smart account 3NBa3D825FiK62g33t84fNBhSE38P5dvVj1 > SELF 0.00000000 Waves
{ "type": 13, "id": "B2PQy2yDB8EaCUcdm881J8JpjcVyndq2nh3sUKUtgCP4", "fee": 1000000, "feeAssetId": null, "timestamp": 1580224270515, "version": 1, "sender": "3NBa3D825FiK62g33t84fNBhSE38P5dvVj1", "senderPublicKey": "4x4BuKVGXrrAcvUGuifMaAcW79ShqCffbj553mzBTpwG", "proofs": [ "2JTJMVRgRbmf859xurdC8D55kPocRwYxwfjuzPN3xLkq7NPXzP2oUY5SVtZDbGjXvF32mhJFppqFhtt37bkrFjzF" ], "script": "base64:AAIDAAAAAAAAABEIARIECgIBARIDCgEIEgASAAAAADUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAAAAEAAAAYZ2V0U3RyaW5nQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRLZXkAAAACAAA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Zc1NWSlV0TXZNcVpqNWhINE5jBQAAAANuaWwEAAAABWNvdW50CQAAZAAAAAIJAABkAAAAAgkAAGQAAAACAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAABAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAACAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAMJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAADAAAAAAAAAAACAAAAAAAAAAAACQAAZwAAAAIFAAAABWNvdW50AAAAAAAAAAADtEZgTg==", "chainId": 84, "height": 874325, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getNumberByKey (key) = match getInteger(this, key) { | |
5 | + | case a: Int => | |
6 | + | a | |
7 | + | case _ => | |
8 | + | 0 | |
9 | + | } | |
10 | + | ||
11 | + | ||
12 | + | func getStringByKey (key) = match getString(this, key) { | |
13 | + | case a: String => | |
14 | + | a | |
15 | + | case _ => | |
16 | + | "" | |
17 | + | } | |
18 | + | ||
19 | + | ||
20 | + | func getStringByAddressAndKey (address,key) = match getString(address, key) { | |
21 | + | case a: String => | |
22 | + | a | |
23 | + | case _ => | |
24 | + | "" | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func getNumberByAddressAndKey (address,key) = match getInteger(address, key) { | |
29 | + | case a: Int => | |
30 | + | a | |
31 | + | case _ => | |
32 | + | 0 | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | let WAVELET = 100000000 | |
37 | + | ||
38 | + | let PAULI = 1000000 | |
39 | + | ||
40 | + | let PERCENTACCURACY = 1000 | |
41 | + | ||
42 | + | let MINORDERTOTAL = (10 * WAVELET) | |
43 | + | ||
44 | + | let MAXROI = 100 | |
45 | + | ||
46 | + | let CANCELED = "canceled" | |
47 | + | ||
48 | + | let NEW = "new" | |
49 | + | ||
50 | + | let FILLED = "filled" | |
51 | + | ||
52 | + | let NeutrinoContractKey = "neutrino_contract" | |
53 | + | ||
54 | + | let OrderbookKey = "orderbook" | |
55 | + | ||
56 | + | let PriceKey = "price" | |
57 | + | ||
58 | + | let BondAssetIdKey = "bond_asset_id" | |
59 | + | ||
60 | + | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
61 | + | ||
62 | + | let ControlContractKey = "control_contract" | |
63 | + | ||
64 | + | let BalanceLockedkKey = "balance_lock_" | |
65 | + | ||
66 | + | let WavesLockedBalanceKey = (BalanceLockedkKey + "waves") | |
67 | + | ||
68 | + | let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino") | |
69 | + | ||
70 | + | let LiquidationContractKey = "liquidation_contract" | |
71 | + | ||
72 | + | func getOrderPriceKey (orderId) = ("order_price_" + orderId) | |
73 | + | ||
74 | + | ||
75 | + | func getOrderTotalKey (orderId) = ("order_total_" + orderId) | |
76 | + | ||
77 | + | ||
78 | + | func getOrderOwnerKey (orderId) = ("order_owner_" + orderId) | |
79 | + | ||
80 | + | ||
81 | + | func getOrderHeightKey (orderId) = ("order_height_" + orderId) | |
82 | + | ||
83 | + | ||
84 | + | func getOrderStatusKey (orderId) = ("order_status_" + orderId) | |
85 | + | ||
86 | + | ||
87 | + | func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId) | |
88 | + | ||
89 | + | ||
90 | + | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, 100, price), WAVELET, PAULI) | |
91 | + | ||
92 | + | ||
93 | + | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, 100), PAULI, WAVELET) | |
94 | + | ||
95 | + | ||
96 | + | func convertNeutrinoToBond (amount) = (amount / PAULI) | |
97 | + | ||
98 | + | ||
99 | + | func convertBondToNeutrino (amount) = (amount * PAULI) | |
100 | + | ||
101 | + | ||
102 | + | func convertWavesToBond (amount,price) = convertNeutrinoToBond(convertWavesToNeutrino(amount, price)) | |
103 | + | ||
104 | + | ||
105 | + | func convertBondToWaves (amount,price) = convertNeutrinoToWaves(convertBondToNeutrino(amount), price) | |
106 | + | ||
107 | + | ||
108 | + | let orderbook = getStringByKey(OrderbookKey) | |
109 | + | ||
110 | + | let neutrinoContract = addressFromStringValue(getStringByKey(NeutrinoContractKey)) | |
111 | + | ||
112 | + | let controlContract = addressFromStringValue(getStringByAddressAndKey(neutrinoContract, ControlContractKey)) | |
113 | + | ||
114 | + | let liquidationContract = addressFromStringValue(getStringByAddressAndKey(neutrinoContract, LiquidationContractKey)) | |
115 | + | ||
116 | + | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey)) | |
117 | + | ||
118 | + | let bondAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, BondAssetIdKey)) | |
119 | + | ||
120 | + | let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey) | |
121 | + | ||
122 | + | let neutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, NeutrinoLockedBalanceKey) | |
123 | + | ||
124 | + | let reserve = (wavesBalance(neutrinoContract) - getNumberByAddressAndKey(neutrinoContract, WavesLockedBalanceKey)) | |
125 | + | ||
126 | + | let neutrinoSupply = (((neutrinoLockedBalance + extract(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId)) | |
127 | + | ||
128 | + | let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve, currentPrice)) | |
129 | + | ||
130 | + | func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id)) | |
131 | + | ||
132 | + | ||
133 | + | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
134 | + | ||
135 | + | ||
136 | + | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
137 | + | ||
138 | + | ||
139 | + | func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id)) | |
140 | + | ||
141 | + | ||
142 | + | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
143 | + | ||
144 | + | ||
145 | + | func getOrderElementById (id) = (id + "_") | |
146 | + | ||
147 | + | ||
148 | + | func addOrder (orderId,position) = { | |
149 | + | let orders = split(orderbook, "_") | |
150 | + | let newOrder = getOrderElementById(orderId) | |
151 | + | if ((position == 0)) | |
152 | + | then (newOrder + orderbook) | |
153 | + | else if ((position >= (size(orders) - 1))) | |
154 | + | then (orderbook + newOrder) | |
155 | + | else { | |
156 | + | let parts = split(orderbook, getOrderElementById(orders[position])) | |
157 | + | (((parts[0] + newOrder) + getOrderElementById(orders[position])) + parts[1]) | |
158 | + | } | |
159 | + | } | |
160 | + | ||
161 | + | ||
162 | + | func dropOrder (orderId) = { | |
163 | + | let parts = split(orderbook, getOrderElementById(orderId)) | |
164 | + | (parts[0] + parts[1]) | |
165 | + | } | |
166 | + | ||
167 | + | ||
168 | + | @Callable(i) | |
169 | + | func addBuyBondOrder (price,position) = { | |
170 | + | let pmt = extract(i.payment) | |
171 | + | let newOrderId = toBase58String(keccak256((((toBytes(price) + toBytes(pmt.amount)) + i.caller.bytes) + toBytes(height)))) | |
172 | + | let priceWavesByBondCents = fraction(100, 100, price) | |
173 | + | let roi = fraction((priceWavesByBondCents - currentPrice), 100, currentPrice) | |
174 | + | if ((MINORDERTOTAL > pmt.amount)) | |
175 | + | then throw(("min order total equals " + toString(MINORDERTOTAL))) | |
176 | + | else if ((roi > MAXROI)) | |
177 | + | then throw("max setOrder ROI is 100%") | |
178 | + | else if (isDefined(pmt.assetId)) | |
179 | + | then throw("can use waves only") | |
180 | + | else if ((0 >= price)) | |
181 | + | then throw("price less zero") | |
182 | + | else if ((getOrderOwner(newOrderId) != "")) | |
183 | + | then throw("order exists") | |
184 | + | else { | |
185 | + | let orders = split(orderbook, "_") | |
186 | + | let nextOrderId = if ((position == 0)) | |
187 | + | then "" | |
188 | + | else orders[(position - 1)] | |
189 | + | let nextOrderPrice = getOrderPrice(nextOrderId) | |
190 | + | let isNextOrderError = if (if ((nextOrderId != "")) | |
191 | + | then (price > nextOrderPrice) | |
192 | + | else false) | |
193 | + | then true | |
194 | + | else false | |
195 | + | let prevOrderId = orders[position] | |
196 | + | let prevOrderPrice = getOrderPrice(prevOrderId) | |
197 | + | let isPrevOrderError = if ((prevOrderPrice >= price)) | |
198 | + | then true | |
199 | + | else false | |
200 | + | if (if (isNextOrderError) | |
201 | + | then true | |
202 | + | else isPrevOrderError) | |
203 | + | then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError))) | |
204 | + | else WriteSet([DataEntry(OrderbookKey, addOrder(newOrderId, position)), DataEntry(getOrderPriceKey(newOrderId), price), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), toString(i.caller)), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW), DataEntry(("debug_order_currentPrice_" + newOrderId), currentPrice), DataEntry(("debug_order_roi_" + newOrderId), roi)]) | |
205 | + | } | |
206 | + | } | |
207 | + | ||
208 | + | ||
209 | + | ||
210 | + | @Callable(i) | |
211 | + | func cancelOrder (orderId) = { | |
212 | + | let owner = getOrderOwner(orderId) | |
213 | + | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
214 | + | if ((owner != toString(i.caller))) | |
215 | + | then throw("permission denied") | |
216 | + | else if ((getOrderStatus(orderId) != NEW)) | |
217 | + | then throw("invalid order status") | |
218 | + | else ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
219 | + | } | |
220 | + | ||
221 | + | ||
222 | + | ||
223 | + | @Callable(i) | |
224 | + | func sellBond () = { | |
225 | + | let bondBalance = assetBalance(this, bondAssetId) | |
226 | + | let deficitPositive = if ((0 >= deficit)) | |
227 | + | then 0 | |
228 | + | else (deficit / PAULI) | |
229 | + | let bondAmount = if ((deficitPositive >= bondBalance)) | |
230 | + | then bondBalance | |
231 | + | else deficitPositive | |
232 | + | let returnAmount = if ((deficitPositive >= bondBalance)) | |
233 | + | then 0 | |
234 | + | else (bondBalance - deficitPositive) | |
235 | + | if (if ((deficitPositive == 0)) | |
236 | + | then (bondBalance == 0) | |
237 | + | else false) | |
238 | + | then throw("without deficit") | |
239 | + | else if ((bondBalance == 0)) | |
240 | + | then throw("without bonds to sell") | |
241 | + | else if ((returnAmount > 0)) | |
242 | + | then TransferSet([ScriptTransfer(neutrinoContract, returnAmount, bondAssetId)]) | |
243 | + | else if ((orderbook == "")) | |
244 | + | then throw("empty orderbook") | |
245 | + | else { | |
246 | + | let orderId = take(orderbook, valueOrErrorMessage(indexOf(orderbook, "_"), "no orders found")) | |
247 | + | let filledTotal = getOrderFilledTotal(orderId) | |
248 | + | let orderPrice = getOrderPrice(orderId) | |
249 | + | let priceWavesByBondCents = fraction(100, 100, orderPrice) | |
250 | + | let remainedTotal = (getOrderTotal(orderId) - filledTotal) | |
251 | + | let amountToExecuteOrder = convertWavesToBond(remainedTotal, priceWavesByBondCents) | |
252 | + | let fillOrderCondition = (bondAmount >= amountToExecuteOrder) | |
253 | + | let fillableOrderAmount = if (fillOrderCondition) | |
254 | + | then amountToExecuteOrder | |
255 | + | else bondAmount | |
256 | + | let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents) | |
257 | + | if ((amountToExecuteOrder == 0)) | |
258 | + | then ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), FILLED)]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(orderId)), remainedTotal, unit)])) | |
259 | + | else if ((totalOrderWaveletesRequired == 0)) | |
260 | + | then throw("cannot fill order at the moment") | |
261 | + | else ScriptResult(WriteSet([DataEntry(OrderbookKey, if (if (fillOrderCondition) | |
262 | + | then (remainedTotal == 0) | |
263 | + | else false) | |
264 | + | then dropOrder(orderId) | |
265 | + | else orderbook), DataEntry(getOrderFilledTotalKey(orderId), (filledTotal + totalOrderWaveletesRequired)), DataEntry(getOrderStatusKey(orderId), if (if (fillOrderCondition) | |
266 | + | then (remainedTotal == 0) | |
267 | + | else false) | |
268 | + | then FILLED | |
269 | + | else NEW)]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(orderId)), fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit)])) | |
270 | + | } | |
271 | + | } | |
272 | + | ||
273 | + | ||
274 | + | ||
275 | + | @Callable(i) | |
276 | + | func updateReservesAndNeutrinoSupply () = { | |
277 | + | let idx = getNumberByKey("updateReservesAndNeutrinoSupplyIdx") | |
278 | + | let newIdx = (idx + 1) | |
279 | + | WriteSet([DataEntry("updateReservesAndNeutrinoSupplyIdx", newIdx), DataEntry("reserve", reserve), DataEntry("neutrinoSupply", neutrinoSupply), DataEntry("deficit", deficit)]) | |
280 | + | } | |
281 | + | ||
282 | + | ||
283 | + | @Verifier(tx) | |
284 | + | func verify () = { | |
285 | + | let pubKeyAdminsList = ["GhfjByrxpjDqQ9JvJoGjxG2WTguunR9sujsPM8qYh3nL", "6dpqiSXuBAM7x3nrD5VuCaYQb2cz1g4NooFDS1xGdCV6", "9EU95UGWLuccZCpPK3KBjhiq5CFapNs8QWxtHqjJ25cc", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"] | |
286 | + | let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0]))) | |
287 | + | then 1 | |
288 | + | else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1]))) | |
289 | + | then 1 | |
290 | + | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2]))) | |
291 | + | then 1 | |
292 | + | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3]))) | |
293 | + | then 2 | |
294 | + | else 0)) | |
295 | + | (count >= 3) | |
296 | + | } | |
297 | + |
github/deemru/w8io/026f985 43.28 ms ◑