tx · 7xgBVUgvBpv865KdCZ8YpKP2rUpgimZbnviG6PaTkktB

3My53oD4J4iwt5tHJdmJWXSXxHxtLSLw3Uh:  -0.01000000 Waves

2019.11.16 00:01 [766734] smart account 3My53oD4J4iwt5tHJdmJWXSXxHxtLSLw3Uh > SELF 0.00000000 Waves

{ "type": 13, "id": "7xgBVUgvBpv865KdCZ8YpKP2rUpgimZbnviG6PaTkktB", "fee": 1000000, "feeAssetId": null, "timestamp": 1573851679483, "version": 1, "sender": "3My53oD4J4iwt5tHJdmJWXSXxHxtLSLw3Uh", "senderPublicKey": "GEAGP4AhGgGms71DdR3TAhcPadEtG5DqEa6aQ1xX6eoF", "proofs": [ "5z5kQbqcNius8VSfryXc7yKvQ2rx1v3UQPvo9yBimjPBfvq5FLSmtoqxeXnU6Ms7zXNcdUQQxXC8ZppAEuheZEnt" ], "script": "base64:AAIDAAAAAAAAAAsIARIAEgMKAQgSAAAAADMBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAAAAEAAAAYZ2V0U3RyaW5nQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABhnZXROdW1iZXJCeUFkZHJl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BQAAAAZhbW91bnQJAQAAAAlkcm9wT3JkZXIAAAABBQAAAAdvcmRlcklkBQAAAAlvcmRlcmJvb2sJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABZnZXRPcmRlckZpbGxlZFRvdGFsS2V5AAAAAQUAAAAHb3JkZXJJZAkAAGQAAAACBQAAAAtmaWxsZWRUb3RhbAUAAAAObmV3RmlsbGVkVG90YWwJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABFnZXRPcmRlclN0YXR1c0tleQAAAAEFAAAAB29yZGVySWQFAAAABnN0YXR1cwUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAKb3JkZXJPd25lcgkBAAAAFWNvbnZlcnRCb25kVG9OZXV0cmlubwAAAAEFAAAADm5ld0ZpbGxlZFRvdGFsBQAAAA9uZXV0cmlub0Fzc2V0SWQFAAAAA25pbAAAAACixD1s", "chainId": 84, "height": 766734, "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 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 ORDERSPLITSYMBOL = "_"
39+
40+let PAULI = 100
41+
42+let PERCENTACCURACY = 1000
43+
44+let MAXDISCOUNT = 50
45+
46+let CANCELED = "canceled"
47+
48+let NEW = "new"
49+
50+let FILLED = "filled"
51+
52+let OrderbookKey = "orderbook"
53+
54+let PriceKey = "price"
55+
56+let BondAssetIdKey = "bond_asset_id"
57+
58+let NeutrinoAssetIdKey = "neutrino_asset_id"
59+
60+let NeutrinoContractKey = "neutrino_contract"
61+
62+let ControlContractKey = "control_contract"
63+
64+let SwapLockedBalanceKey = "swap_locked_balance"
65+
66+let SwapNeutrinoLockedBalanceKey = "swap_neutrino_locked_balance"
67+
68+let SwapWavesLockedBalanceKey = "swap_waves_locked_balance"
69+
70+func getOrderTotalKey (orderId) = ("order_total_" + orderId)
71+
72+
73+func getOrderOwnerKey (orderId) = ("order_owner_" + orderId)
74+
75+
76+func getOrderHeightKey (orderId) = ("order_height_" + orderId)
77+
78+
79+func getOrderStatusKey (orderId) = ("order_status_" + orderId)
80+
81+
82+func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId)
83+
84+
85+func convertNeutrinoToWaves (amount,price) = ((((amount * 100) / price) * WAVELET) / PAULI)
86+
87+
88+func convertWavesToNeutrino (amount,price) = ((((amount * price) / 100) * PAULI) / WAVELET)
89+
90+
91+func convertNeutrinoToBond (amount) = (amount / PAULI)
92+
93+
94+func convertBondToNeutrino (amount) = (amount * PAULI)
95+
96+
97+func convertWavesToBond (amount,price) = convertNeutrinoToBond(convertWavesToNeutrino(amount, price))
98+
99+
100+let orderbook = getStringByKey(OrderbookKey)
101+
102+let neutrinoContract = addressFromStringValue(getStringByKey(NeutrinoContractKey))
103+
104+let controlContract = addressFromStringValue(getStringByAddressAndKey(neutrinoContract, ControlContractKey))
105+
106+let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey)
107+
108+let swapLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapLockedBalanceKey)
109+
110+let swapNeutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapNeutrinoLockedBalanceKey)
111+
112+let swapWavesLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapWavesLockedBalanceKey)
113+
114+let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey))
115+
116+let bondAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, BondAssetIdKey))
117+
118+let reserve = (wavesBalance(neutrinoContract) - swapWavesLockedBalance)
119+
120+let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(this, neutrinoAssetId)) + swapNeutrinoLockedBalance)
121+
122+let surplus = (convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply)
123+
124+func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
125+
126+
127+func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
128+
129+
130+func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
131+
132+
133+func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
134+
135+
136+func getOrderElementById (id) = (id + ORDERSPLITSYMBOL)
137+
138+
139+func addOrder (orderId,position) = {
140+ let orders = split(orderbook, ORDERSPLITSYMBOL)
141+ let newOrder = getOrderElementById(orderId)
142+ if ((position == 0))
143+ then (newOrder + orderbook)
144+ else if ((position >= (size(orders) - 1)))
145+ then (orderbook + newOrder)
146+ else {
147+ let parts = split(orderbook, getOrderElementById(orders[position]))
148+ (((parts[0] + newOrder) + getOrderElementById(orders[position])) + parts[1])
149+ }
150+ }
151+
152+
153+func dropOrder (orderId) = {
154+ let parts = split(orderbook, getOrderElementById(orderId))
155+ (parts[0] + parts[1])
156+ }
157+
158+
159+func getOrdersInOrderbook (orderbook) = split(orderbook, ORDERSPLITSYMBOL)
160+
161+
162+@Callable(i)
163+func addLiquidationOrder () = {
164+ let pmt = extract(i.payment)
165+ let newOrderId = toBase58String(keccak256(((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height))))
166+ if ((pmt.assetId != bondAssetId))
167+ then throw("can use appropriate neutrino bonds tokens only")
168+ else if ((getOrderOwner(newOrderId) != ""))
169+ then throw("an order is already exists")
170+ else WriteSet([DataEntry(OrderbookKey, addOrder(newOrderId, size(getOrdersInOrderbook(orderbook)))), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), toString(i.caller)), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW)])
171+ }
172+
173+
174+
175+@Callable(i)
176+func cancelOrder (orderId) = {
177+ let owner = getOrderOwner(orderId)
178+ let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
179+ if ((owner != toString(i.caller)))
180+ then throw("permission denied")
181+ else if ((getOrderStatus(orderId) != NEW))
182+ then throw("invalid order status")
183+ else ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)]))
184+ }
185+
186+
187+
188+@Callable(i)
189+func liquidateBond () = {
190+ let orderId = getOrdersInOrderbook(orderbook)[0]
191+ let orderTotal = getOrderTotal(orderId)
192+ let orderOwner = getOrderOwner(orderId)
193+ let filledTotal = getOrderFilledTotal(orderId)
194+ let surplusBond = (convertNeutrinoToBond(surplus) + assetBalance(this, neutrinoAssetId))
195+ if ((0 >= surplusBond))
196+ then throw("there is no proficit on the smart contract now")
197+ else if ((orderbook == ""))
198+ then throw("empty orderbook")
199+ else {
200+ let amount = (orderTotal - filledTotal)
201+ let status = if ((surplusBond >= amount))
202+ then FILLED
203+ else NEW
204+ let newFilledTotal = if ((surplusBond >= amount))
205+ then amount
206+ else surplusBond
207+ ScriptResult(WriteSet([DataEntry(OrderbookKey, if ((surplusBond >= amount))
208+ then dropOrder(orderId)
209+ else orderbook), DataEntry(getOrderFilledTotalKey(orderId), (filledTotal + newFilledTotal)), DataEntry(getOrderStatusKey(orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)]))
210+ }
211+ }
212+
213+

github/deemru/w8io/026f985 
44.86 ms