tx · 68du3LNvteAgGJ6vZ6G2N2Gk1Y4CnY1F4ztkMKRgxqYT

3MwBMfHq2xGp8TJamHoFe3wrNsbHDxdoyVx:  -0.01000000 Waves

2020.04.03 16:37 [938061] smart account 3MwBMfHq2xGp8TJamHoFe3wrNsbHDxdoyVx > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
32.37 ms