tx · LyGaKAz7PEJmzSxEi8J5xcT9qoKCnTJwdSQrDmufB25 3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62: -0.02000000 Waves 2020.07.14 16:44 [1087073] smart account 3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62 > SELF 0.00000000 Waves
{ "type": 13, "id": "LyGaKAz7PEJmzSxEi8J5xcT9qoKCnTJwdSQrDmufB25", "fee": 2000000, "feeAssetId": null, "timestamp": 1594734266712, "version": 1, "sender": "3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62", "senderPublicKey": "6PBV8fVJwLaUQbCyG7iqoKR3x1nqFRZFNeuN9qodoiTu", "proofs": [ "63XEweLuqCg7HxC1fw2mCNanaUJnUiYig9MtFrTqnQSRQds54HcXLGqZRL2c2FvYAuS5ZbHFhNsLux98M1dzRtca", "s3bCczur5UGauY12xkSfngFtVXe2uF8FjeSoNBRDktgiA2Z1BADCAfYCUQQtTmGg7ufxPK6nJTLVbMu2Cq7dTU4", "67CMXBJUSdBseLyvMKrkjP3EkmFW9sqKpbAAs5aZs1MgYHrCz4Vh8UXYjGB5aFJmPUEbDuHy428zmYpRtEzVAdDx" ], "script": "base64:AAIDAAAAAAAAABMIARIECgIBCBIAEgMKAQgSABIAAAAAOQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABZnZXRCb29sQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGR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1pNaHJNN25pTHNlREgydVJvSzZ3ZUJxMkpRM0EJAARMAAAAAgIAAAAsNVdSWEZTandjVGJOZktjSnM4WnFYbVNTV1lzU1ZKVXRNdk1xWmo1aEg0TmMFAAAAA25pbAQAAAAFY291bnQJAABkAAAAAgkAAGQAAAACCQAAZAAAAAIDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAgkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAIAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAwkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAMAAAAAAAAAAAIAAAAAAAAAAAAJAABnAAAAAgUAAAAFY291bnQAAAAAAAAAAAMVuEv/", "chainId": 84, "height": 1087073, "spentComplexity": 0 } View: original | compacted Prev: 8Ndd4zfTQuici7f1MWLryUR5eCjkK7mcTURfVajovXVa Next: BEbxrNz7J4F1dE5LjzhQQ6oDh2h6Vwo16zsoTRa4GsKF Diff:
Old | New | Differences | |
---|---|---|---|
44 | 44 | let WAVELET = 100000000 | |
45 | 45 | ||
46 | 46 | let PAULI = 1000000 | |
47 | + | ||
48 | + | let PRICELET = 1000000 | |
47 | 49 | ||
48 | 50 | let CANCELED = "canceled" | |
49 | 51 | ||
95 | 97 | func getNextOrderKey (orderId) = ("order_next_" + orderId) | |
96 | 98 | ||
97 | 99 | ||
98 | - | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, | |
100 | + | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI) | |
99 | 101 | ||
100 | 102 | ||
101 | - | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, | |
103 | + | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET) | |
102 | 104 | ||
103 | 105 | ||
104 | 106 | func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price) | |
291 | 293 | else { | |
292 | 294 | let nextOrder = getNextOrder(firstOrder) | |
293 | 295 | let filledTotal = getOrderFilledTotal(firstOrder) | |
294 | - | let | |
296 | + | let nsbt2UsdnPrice = getOrderPrice(firstOrder) | |
295 | 297 | let remainedTotal = (getOrderTotal(firstOrder) - filledTotal) | |
296 | - | let totalUSDNRequiredToFillOrder = fraction(remainedTotal, | |
298 | + | let totalUSDNRequiredToFillOrder = fraction(remainedTotal, nsbt2UsdnPrice, 100) | |
297 | 299 | let isOrderFullyFilable = (usdnAmount >= totalUSDNRequiredToFillOrder) | |
298 | 300 | let fillableOrderAmount = if (isOrderFullyFilable) | |
299 | 301 | then totalUSDNRequiredToFillOrder | |
300 | 302 | else usdnAmount | |
301 | - | let finalNBTFillable = fraction(fillableOrderAmount, 100, | |
302 | - | let nbTokensLiquidateCondition = (fraction((surplus + neutrinoSupply), 100, neutrinoSupply) >= | |
303 | + | let finalNBTFillable = fraction(fillableOrderAmount, 100, nsbt2UsdnPrice) | |
304 | + | let nbTokensLiquidateCondition = (fraction((surplus + neutrinoSupply), 100, neutrinoSupply) >= nsbt2UsdnPrice) | |
303 | 305 | if (!(nbTokensLiquidateCondition)) | |
304 | 306 | then throw(("innapropriate surplus: " + toString(surplus))) | |
305 | 307 | else { |
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 getBoolByAddressAndKey (address,key) = match getBoolean(address, key) { | |
21 | 21 | case a: Boolean => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | false | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getStringByAddressAndKey (address,key) = match getString(address, key) { | |
29 | 29 | case a: String => | |
30 | 30 | a | |
31 | 31 | case _ => | |
32 | 32 | "" | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getNumberByAddressAndKey (address,key) = match getInteger(address, key) { | |
37 | 37 | case a: Int => | |
38 | 38 | a | |
39 | 39 | case _ => | |
40 | 40 | 0 | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | let WAVELET = 100000000 | |
45 | 45 | ||
46 | 46 | let PAULI = 1000000 | |
47 | + | ||
48 | + | let PRICELET = 1000000 | |
47 | 49 | ||
48 | 50 | let CANCELED = "canceled" | |
49 | 51 | ||
50 | 52 | let NEW = "new" | |
51 | 53 | ||
52 | 54 | let FILLED = "filled" | |
53 | 55 | ||
54 | 56 | let NeutrinoContractKey = "neutrino_contract" | |
55 | 57 | ||
56 | 58 | let PriceKey = "price" | |
57 | 59 | ||
58 | 60 | let BondAssetIdKey = "bond_asset_id" | |
59 | 61 | ||
60 | 62 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
61 | 63 | ||
62 | 64 | let ControlContractKey = "control_contract" | |
63 | 65 | ||
64 | 66 | let BalanceLockedkKey = "balance_lock_" | |
65 | 67 | ||
66 | 68 | let WavesLockedBalanceKey = (BalanceLockedkKey + "waves") | |
67 | 69 | ||
68 | 70 | let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino") | |
69 | 71 | ||
70 | 72 | let FirstOrderKey = "order_first" | |
71 | 73 | ||
72 | 74 | let CurrentDefaultOrderKey = "order_default" | |
73 | 75 | ||
74 | 76 | func getOrderPriceKey (orderId) = ("order_price_" + orderId) | |
75 | 77 | ||
76 | 78 | ||
77 | 79 | func getOrderTotalKey (orderId) = ("order_total_" + orderId) | |
78 | 80 | ||
79 | 81 | ||
80 | 82 | func getOrderOwnerKey (orderId) = ("order_owner_" + orderId) | |
81 | 83 | ||
82 | 84 | ||
83 | 85 | func getOrderHeightKey (orderId) = ("order_height_" + orderId) | |
84 | 86 | ||
85 | 87 | ||
86 | 88 | func getOrderStatusKey (orderId) = ("order_status_" + orderId) | |
87 | 89 | ||
88 | 90 | ||
89 | 91 | func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId) | |
90 | 92 | ||
91 | 93 | ||
92 | 94 | func getPrevOrderKey (orderId) = ("order_prev_" + orderId) | |
93 | 95 | ||
94 | 96 | ||
95 | 97 | func getNextOrderKey (orderId) = ("order_next_" + orderId) | |
96 | 98 | ||
97 | 99 | ||
98 | - | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, | |
100 | + | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI) | |
99 | 101 | ||
100 | 102 | ||
101 | - | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, | |
103 | + | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET) | |
102 | 104 | ||
103 | 105 | ||
104 | 106 | func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price) | |
105 | 107 | ||
106 | 108 | ||
107 | 109 | let neutrinoContract = addressFromStringValue(getStringByKey(NeutrinoContractKey)) | |
108 | 110 | ||
109 | 111 | let controlContract = addressFromStringValue(getStringByAddressAndKey(neutrinoContract, ControlContractKey)) | |
110 | 112 | ||
111 | 113 | let liquidationContract = this | |
112 | 114 | ||
113 | 115 | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey)) | |
114 | 116 | ||
115 | 117 | let bondAssetId = fromBase58String("BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH") | |
116 | 118 | ||
117 | 119 | let firstOrder = getStringByKey(FirstOrderKey) | |
118 | 120 | ||
119 | 121 | let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked") | |
120 | 122 | ||
121 | 123 | let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey) | |
122 | 124 | ||
123 | 125 | let neutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, NeutrinoLockedBalanceKey) | |
124 | 126 | ||
125 | 127 | let wavesLockedBalance = getNumberByAddressAndKey(neutrinoContract, WavesLockedBalanceKey) | |
126 | 128 | ||
127 | 129 | let reserve = (wavesBalance(neutrinoContract) - wavesLockedBalance) | |
128 | 130 | ||
129 | 131 | let neutrinoSupply = (((neutrinoLockedBalance + extract(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId)) | |
130 | 132 | ||
131 | 133 | let surplus = (convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply) | |
132 | 134 | ||
133 | 135 | func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id)) | |
134 | 136 | ||
135 | 137 | ||
136 | 138 | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
137 | 139 | ||
138 | 140 | ||
139 | 141 | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
140 | 142 | ||
141 | 143 | ||
142 | 144 | func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id)) | |
143 | 145 | ||
144 | 146 | ||
145 | 147 | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
146 | 148 | ||
147 | 149 | ||
148 | 150 | func getOrderHeight (id) = getNumberByKey(getOrderHeightKey(id)) | |
149 | 151 | ||
150 | 152 | ||
151 | 153 | func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id)) | |
152 | 154 | ||
153 | 155 | ||
154 | 156 | func getNextOrder (id) = getStringByKey(getNextOrderKey(id)) | |
155 | 157 | ||
156 | 158 | ||
157 | 159 | let currentDefaultOrder = getStringByKey(CurrentDefaultOrderKey) | |
158 | 160 | ||
159 | 161 | func generateDataEntryToAddOrder (price,newOrderId,i,prevOrder,nextOrder,firstOrder) = { | |
160 | 162 | let amount = extract(i.payment).amount | |
161 | 163 | let isOneForOneOrder = (price == 100) | |
162 | 164 | let isFirstOrderEmty = (firstOrder == "") | |
163 | 165 | let isNewOrderPriceLowerThanCurrentFirstOrder = (getOrderPrice(firstOrder) > price) | |
164 | 166 | let newFirstOrder = if (isFirstOrderEmty) | |
165 | 167 | then newOrderId | |
166 | 168 | else if (isNewOrderPriceLowerThanCurrentFirstOrder) | |
167 | 169 | then newOrderId | |
168 | 170 | else firstOrder | |
169 | 171 | [DataEntry(getPrevOrderKey(newOrderId), prevOrder), DataEntry(getNextOrderKey(newOrderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == "")) | |
170 | 172 | then prevOrder | |
171 | 173 | else newOrderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == "")) | |
172 | 174 | then nextOrder | |
173 | 175 | else newOrderId), DataEntry(FirstOrderKey, newFirstOrder), DataEntry(getOrderPriceKey(newOrderId), price), DataEntry(getOrderTotalKey(newOrderId), amount), DataEntry(getOrderOwnerKey(newOrderId), toString(i.caller)), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW), DataEntry(CurrentDefaultOrderKey, if (isOneForOneOrder) | |
174 | 176 | then newOrderId | |
175 | 177 | else currentDefaultOrder)] | |
176 | 178 | } | |
177 | 179 | ||
178 | 180 | ||
179 | 181 | func internalAddLiquidationOrder (i,price,prevOrder) = { | |
180 | 182 | let pmt = extract(i.payment) | |
181 | 183 | let newOrderId = toBase58String(keccak256((((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height)) + i.transactionId))) | |
182 | 184 | let owner = toString(i.caller) | |
183 | 185 | let isEmptyPrevOrder = (prevOrder == "") | |
184 | 186 | let isEmptyFirstOrder = (firstOrder == "") | |
185 | 187 | if (isBlocked) | |
186 | 188 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
187 | 189 | else if ((PAULI > pmt.amount)) | |
188 | 190 | then throw("order amount should be higher than 1 NSBT") | |
189 | 191 | else if ((100 > price)) | |
190 | 192 | then throw(("price should be equal or higher than 1 nsbt for 1 usdn. i.e. >= 100; price: " + toString(price))) | |
191 | 193 | else if ((pmt.assetId != bondAssetId)) | |
192 | 194 | then throw("can use appropriate neutrino base tokens (nsbt) only") | |
193 | 195 | else if ((getOrderOwner(newOrderId) != "")) | |
194 | 196 | then throw("the order already exists") | |
195 | 197 | else if (if (!(isEmptyPrevOrder)) | |
196 | 198 | then (getOrderStatus(prevOrder) != NEW) | |
197 | 199 | else false) | |
198 | 200 | then throw("prev order status is not new") | |
199 | 201 | else if (if (isEmptyFirstOrder) | |
200 | 202 | then !(isEmptyPrevOrder) | |
201 | 203 | else false) | |
202 | 204 | then throw("wrong prev order parameter") | |
203 | 205 | else { | |
204 | 206 | let nextOrder = if (isEmptyPrevOrder) | |
205 | 207 | then firstOrder | |
206 | 208 | else getNextOrder(prevOrder) | |
207 | 209 | let isEmptyNextOrder = (nextOrder == "") | |
208 | 210 | if (isEmptyFirstOrder) | |
209 | 211 | then WriteSet(generateDataEntryToAddOrder(price, newOrderId, i, prevOrder, nextOrder, firstOrder)) | |
210 | 212 | else { | |
211 | 213 | let nextOrderPrice = getNumberByKey(getOrderPriceKey(nextOrder)) | |
212 | 214 | let prevOrderPrice = getNumberByKey(getOrderPriceKey(prevOrder)) | |
213 | 215 | let isNextOrderError = if (!(isEmptyNextOrder)) | |
214 | 216 | then (price >= nextOrderPrice) | |
215 | 217 | else false | |
216 | 218 | let isPrevOrderError = if (!(isEmptyPrevOrder)) | |
217 | 219 | then (prevOrderPrice > price) | |
218 | 220 | else false | |
219 | 221 | if (if (isNextOrderError) | |
220 | 222 | then true | |
221 | 223 | else isPrevOrderError) | |
222 | 224 | then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError))) | |
223 | 225 | else WriteSet(generateDataEntryToAddOrder(price, newOrderId, i, prevOrder, nextOrder, firstOrder)) | |
224 | 226 | } | |
225 | 227 | } | |
226 | 228 | } | |
227 | 229 | ||
228 | 230 | ||
229 | 231 | func computeCurrentDefaultOrder (id) = if ((id != currentDefaultOrder)) | |
230 | 232 | then currentDefaultOrder | |
231 | 233 | else "" | |
232 | 234 | ||
233 | 235 | ||
234 | 236 | @Callable(i) | |
235 | 237 | func addLiquidationOrderWithPrice (price,prevOrder) = internalAddLiquidationOrder(i, price, prevOrder) | |
236 | 238 | ||
237 | 239 | ||
238 | 240 | ||
239 | 241 | @Callable(i) | |
240 | 242 | func addLiquidationOrder () = internalAddLiquidationOrder(i, 100, currentDefaultOrder) | |
241 | 243 | ||
242 | 244 | ||
243 | 245 | ||
244 | 246 | @Callable(i) | |
245 | 247 | func cancelOrder (orderId) = { | |
246 | 248 | let owner = getOrderOwner(orderId) | |
247 | 249 | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
248 | 250 | let caller = toString(i.caller) | |
249 | 251 | let nextOrder = getNextOrder(orderId) | |
250 | 252 | let prevOrder = getPrevOrder(orderId) | |
251 | 253 | let isDefaultOrder = (orderId == currentDefaultOrder) | |
252 | 254 | let isPrevCanBecomeDefault = (getOrderStatus(prevOrder) == NEW) | |
253 | 255 | let newDefaultOrder = if (isDefaultOrder) | |
254 | 256 | then if (isPrevCanBecomeDefault) | |
255 | 257 | then prevOrder | |
256 | 258 | else "" | |
257 | 259 | else currentDefaultOrder | |
258 | 260 | if (isBlocked) | |
259 | 261 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
260 | 262 | else if ((owner != caller)) | |
261 | 263 | then throw("permission denied") | |
262 | 264 | else if ((getOrderStatus(orderId) != NEW)) | |
263 | 265 | then throw("invalid order status") | |
264 | 266 | else ScriptResult(WriteSet([DataEntry(CurrentDefaultOrderKey, newDefaultOrder), DataEntry(FirstOrderKey, if ((firstOrder == orderId)) | |
265 | 267 | then nextOrder | |
266 | 268 | else firstOrder), DataEntry(getNextOrderKey(prevOrder), nextOrder), DataEntry(getPrevOrderKey(nextOrder), prevOrder), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)])) | |
267 | 269 | } | |
268 | 270 | ||
269 | 271 | ||
270 | 272 | ||
271 | 273 | @Callable(i) | |
272 | 274 | func liquidateBond () = { | |
273 | 275 | let liquidationBalance = assetBalance(this, neutrinoAssetId) | |
274 | 276 | let surplusPositive = if ((0 >= surplus)) | |
275 | 277 | then 0 | |
276 | 278 | else surplus | |
277 | 279 | let usdnAmount = if ((surplusPositive >= liquidationBalance)) | |
278 | 280 | then liquidationBalance | |
279 | 281 | else surplusPositive | |
280 | 282 | let returnAmount = if ((surplusPositive >= liquidationBalance)) | |
281 | 283 | then 0 | |
282 | 284 | else (liquidationBalance - surplusPositive) | |
283 | 285 | if (isBlocked) | |
284 | 286 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
285 | 287 | else if ((liquidationBalance == 0)) | |
286 | 288 | then throw("without base tokens to liquidate") | |
287 | 289 | else if ((returnAmount > 0)) | |
288 | 290 | then TransferSet([ScriptTransfer(neutrinoContract, returnAmount, neutrinoAssetId)]) | |
289 | 291 | else if ((firstOrder == "")) | |
290 | 292 | then throw("empty orderbook") | |
291 | 293 | else { | |
292 | 294 | let nextOrder = getNextOrder(firstOrder) | |
293 | 295 | let filledTotal = getOrderFilledTotal(firstOrder) | |
294 | - | let | |
296 | + | let nsbt2UsdnPrice = getOrderPrice(firstOrder) | |
295 | 297 | let remainedTotal = (getOrderTotal(firstOrder) - filledTotal) | |
296 | - | let totalUSDNRequiredToFillOrder = fraction(remainedTotal, | |
298 | + | let totalUSDNRequiredToFillOrder = fraction(remainedTotal, nsbt2UsdnPrice, 100) | |
297 | 299 | let isOrderFullyFilable = (usdnAmount >= totalUSDNRequiredToFillOrder) | |
298 | 300 | let fillableOrderAmount = if (isOrderFullyFilable) | |
299 | 301 | then totalUSDNRequiredToFillOrder | |
300 | 302 | else usdnAmount | |
301 | - | let finalNBTFillable = fraction(fillableOrderAmount, 100, | |
302 | - | let nbTokensLiquidateCondition = (fraction((surplus + neutrinoSupply), 100, neutrinoSupply) >= | |
303 | + | let finalNBTFillable = fraction(fillableOrderAmount, 100, nsbt2UsdnPrice) | |
304 | + | let nbTokensLiquidateCondition = (fraction((surplus + neutrinoSupply), 100, neutrinoSupply) >= nsbt2UsdnPrice) | |
303 | 305 | if (!(nbTokensLiquidateCondition)) | |
304 | 306 | then throw(("innapropriate surplus: " + toString(surplus))) | |
305 | 307 | else { | |
306 | 308 | let isNothingToFillNow = (remainedTotal == 0) | |
307 | 309 | let isNothingToFillAtAll = ((filledTotal + finalNBTFillable) == getOrderTotal(firstOrder)) | |
308 | 310 | let newStatus = if (if (isOrderFullyFilable) | |
309 | 311 | then if (isNothingToFillNow) | |
310 | 312 | then true | |
311 | 313 | else isNothingToFillAtAll | |
312 | 314 | else false) | |
313 | 315 | then FILLED | |
314 | 316 | else NEW | |
315 | 317 | ScriptResult(WriteSet([DataEntry(getPrevOrderKey(nextOrder), if ((newStatus == FILLED)) | |
316 | 318 | then "" | |
317 | 319 | else firstOrder), DataEntry(FirstOrderKey, if ((newStatus == FILLED)) | |
318 | 320 | then nextOrder | |
319 | 321 | else firstOrder), DataEntry(getOrderFilledTotalKey(firstOrder), (filledTotal + finalNBTFillable)), DataEntry(getOrderStatusKey(firstOrder), newStatus), DataEntry(CurrentDefaultOrderKey, computeCurrentDefaultOrder(firstOrder))]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(firstOrder)), fillableOrderAmount, neutrinoAssetId), ScriptTransfer(neutrinoContract, finalNBTFillable, bondAssetId)])) | |
320 | 322 | } | |
321 | 323 | } | |
322 | 324 | } | |
323 | 325 | ||
324 | 326 | ||
325 | 327 | ||
326 | 328 | @Callable(i) | |
327 | 329 | func updateReservesAndNeutrinoSupply () = { | |
328 | 330 | func getNumberByKeyInternal (key) = match getInteger(this, key) { | |
329 | 331 | case a: Int => | |
330 | 332 | a | |
331 | 333 | case _ => | |
332 | 334 | 0 | |
333 | 335 | } | |
334 | 336 | ||
335 | 337 | let idx = getNumberByKeyInternal("updateReservesAndNeutrinoSupplyIdx") | |
336 | 338 | let newIdx = (idx + 1) | |
337 | 339 | WriteSet([DataEntry("updateReservesAndNeutrinoSupplyIdx", newIdx), DataEntry("reserve", reserve), DataEntry("neutrinoSupply", neutrinoSupply), DataEntry("surplus", surplus)]) | |
338 | 340 | } | |
339 | 341 | ||
340 | 342 | ||
341 | 343 | @Verifier(tx) | |
342 | 344 | func verify () = { | |
343 | 345 | let pubKeyAdminsList = ["GXxmZaCigPgJsT6d1cLr8nUXA65nGX8V7FuAzzrY8wQE", "3xumx4hrPpeeoo79HLGbZCgfz95L39ZFdxxwWeSUC2Pu", "D4CqtK5fBsnzRo33ZMhrM7niLseDH2uRoK6weBq2JQ3A", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"] | |
344 | 346 | let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0]))) | |
345 | 347 | then 1 | |
346 | 348 | else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1]))) | |
347 | 349 | then 1 | |
348 | 350 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2]))) | |
349 | 351 | then 1 | |
350 | 352 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3]))) | |
351 | 353 | then 2 | |
352 | 354 | else 0)) | |
353 | 355 | (count >= 3) | |
354 | 356 | } | |
355 | 357 |
github/deemru/w8io/026f985 50.56 ms ◑