tx · 6c2P7kdQjRgRKy34VFUuH5uycQUApwXfdyrsGBSAoiXq

3MuTR6FqVriefgvXkJtNxj8CNh3nBbuqidJ:  -0.01400000 Waves

2019.09.27 23:00 [695284] smart account 3MuTR6FqVriefgvXkJtNxj8CNh3nBbuqidJ > SELF 0.00000000 Waves

{ "type": 13, "id": "6c2P7kdQjRgRKy34VFUuH5uycQUApwXfdyrsGBSAoiXq", "fee": 1400000, "feeAssetId": null, "timestamp": 1569614456307, "version": 1, "sender": "3MuTR6FqVriefgvXkJtNxj8CNh3nBbuqidJ", "senderPublicKey": "7Egc9nr6FA2hbNNbo8H21n8htzQ5nYzsLc6eku6JU5pn", "proofs": [ "2j939BmcH771yw4fwmXudY6r8Lk94XHNmT1jCvtMPFmrgNCCUv3gdrxzzgV1VWw8Jq7uhk3Kda5RaSw2b5gDhXBq" ], "script": "base64:AAIDAAAAAAAAAAAAAAAoAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2FkZHJlc3MAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAHYWRkcmVzcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAA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YXRhRW50cnkAAAACBQAAAAxPcmRlckJvb2tLZXkFAAAADG5ld09yZGVyYm9vawkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFmdldE9yZGVyRmlsbGVkVG90YWxLZXkAAAABBQAAAAdvcmRlcklkCQAAZAAAAAIFAAAAC2ZpbGxlZFRvdGFsBQAAAAV0b3RhbAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEWdldE9yZGVyU3RhdHVzS2V5AAAAAQUAAAAHb3JkZXJJZAUAAAAGc3RhdHVzBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAApvcmRlck93bmVyBQAAAAxmaWxsZWRBbW91bnQFAAAAC2JvbmRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAQbmV1dHJpbm9Db250cmFjdAUAAAAFdG90YWwFAAAAD25ldXRyaW5vQXNzZXRJZAUAAAADbmlsAAAAAAfET2o=", "chainId": 84, "height": 695284, "spentComplexity": 0 } View: original | compacted Prev: AsNFd69NnkoKX7UCP1WttdkZHEEyPL5mxPdfpfSLzQP9 Next: DJEQVQty694sMLyJ5Sm3GEDZkGLex32FZLsFHqc8516i Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getNumberByAddressAndKey (address,key) = match getInteger(addressFromStringValue(address), key) {
55 case a: Int =>
66 a
77 case _ =>
88 0
99 }
1010
1111
1212 func getNumberByKey (key) = match getInteger(this, key) {
1313 case a: Int =>
1414 a
1515 case _ =>
1616 0
1717 }
1818
1919
2020 func getStringByKey (key) = match getString(this, key) {
2121 case a: String =>
2222 a
2323 case _ =>
2424 ""
2525 }
2626
2727
2828 let ORDERSPLITSYMBOL = "_"
2929
3030 let WAVELET = 100000000
3131
3232 let CANCELED = "canceled"
3333
3434 let NEW = "new"
3535
3636 let FILLED = "filled"
3737
3838 let OrderBookKey = "orderbook"
3939
4040 let OrderPriceKey = "order_price_"
4141
4242 let OrderTotalKey = "order_total_"
4343
4444 let OrderFilledTotalKey = "order_filled_total_"
4545
4646 let OrderOwnerKey = "order_owner_"
4747
4848 let OrderHeightKey = "order_height_"
4949
5050 let OrderStatusKey = "order_status_"
5151
5252 let PriceKey = "price"
5353
5454 let BondAssetIdKey = "bond_asset_id"
5555
5656 let NeutrinoAssetIdKey = "neutrino_asset_id"
5757
5858 let NeutrinoContractKey = "neutrino_contract"
5959
6060 func getOrderPriceKey (orderId) = (OrderPriceKey + orderId)
6161
6262
6363 func getOrderTotalKey (orderId) = (OrderTotalKey + orderId)
6464
6565
6666 func getOrderOwnerKey (orderId) = (OrderOwnerKey + orderId)
6767
6868
6969 func getOrderHeightKey (orderId) = (OrderHeightKey + orderId)
7070
7171
7272 func getOrderStatusKey (orderId) = (OrderStatusKey + orderId)
7373
7474
7575 func getOrderFilledTotalKey (orderId) = (OrderFilledTotalKey + orderId)
7676
7777
7878 let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey))
7979
8080 let bondAssetId = fromBase58String(getStringByKey(BondAssetIdKey))
8181
8282 let neutrinoContract = getStringByKey(NeutrinoContractKey)
8383
8484 let price = getNumberByAddressAndKey(neutrinoContract, PriceKey)
8585
8686 let orderbook = getStringByKey(OrderBookKey)
8787
8888 let reserve = wavesBalance(addressFromStringValue(neutrinoContract))
8989
9090 let neutrinoSupply = {
9191 let info = extract(assetInfo(neutrinoAssetId))
9292 (info.quantity - assetBalance(addressFromStringValue(neutrinoContract), neutrinoAssetId))
9393 }
9494
9595 func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id))
9696
9797
9898 func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
9999
100100
101101 func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
102102
103103
104104 func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
105105
106106
107107 func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
108108
109109
110110 func getOrderElementById (id) = (id + ORDERSPLITSYMBOL)
111111
112112
113113 func addOrder (orderId,position) = {
114114 let orders = split(orderbook, ORDERSPLITSYMBOL)
115115 let newOrder = getOrderElementById(orderId)
116116 if ((position == 0))
117117 then (newOrder + orderbook)
118118 else if ((position >= (size(orders) - 1)))
119119 then (orderbook + newOrder)
120120 else {
121121 let parts = split(orderbook, getOrderElementById(orders[position]))
122122 (((parts[0] + newOrder) + getOrderElementById(orders[position])) + parts[1])
123123 }
124124 }
125125
126126
127127 func dropOrder (orderId) = {
128128 let parts = split(orderbook, getOrderElementById(orderId))
129129 (parts[0] + parts[1])
130130 }
131131
132132
133133 @Callable(i)
134134 func setOrder (price,position) = {
135135 let pmt = extract(i.payment)
136136 let newOrderId = toBase58String(keccak256((((toBytes(price) + toBytes(pmt.amount)) + i.caller.bytes) + toBytes(height))))
137137 if ((pmt.assetId != neutrinoAssetId))
138138 then throw("can use neutrino only")
139139 else if ((0 >= price))
140140 then throw("price less zero")
141141 else if ((getOrderOwner(newOrderId) != ""))
142142 then throw("order exists")
143143 else {
144144 let orders = split(orderbook, ORDERSPLITSYMBOL)
145145 let nextOrderId = if ((position == 0))
146146 then ""
147147 else orders[(position - 1)]
148148 let nextOrderPrice = getOrderPrice(nextOrderId)
149149 let isNextOrderError = if (if ((nextOrderId != ""))
150150 then (price > nextOrderPrice)
151151 else false)
152152 then true
153153 else false
154154 let prevOrderId = orders[position]
155155 let prevOrderPrice = getOrderPrice(prevOrderId)
156156 let isPrevOrderError = if ((prevOrderPrice >= price))
157157 then true
158158 else false
159159 if (if (isNextOrderError)
160160 then true
161161 else isPrevOrderError)
162162 then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
163163 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)])
164164 }
165165 }
166166
167167
168168
169169 @Callable(i)
170170 func cancelOrder (orderId) = {
171171 let owner = getOrderOwner(orderId)
172172 let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
173173 if ((owner != toString(i.caller)))
174174 then throw("permission denied")
175175 else ScriptResult(WriteSet([DataEntry(OrderBookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, neutrinoAssetId)]))
176176 }
177177
178178
179179
180180 @Callable(i)
181181 func executeOrder () = {
182182 let bondBalance = assetBalance(this, bondAssetId)
183183 let deficit = ((neutrinoSupply - ((reserve * price) / 100)) / WAVELET)
184184 let deficitPositive = if ((0 >= deficit))
185185 then 0
186186 else deficit
187187 let bondAmount = if ((deficitPositive >= bondBalance))
188188 then bondBalance
189189 else deficitPositive
190190 let returnAmount = if ((deficitPositive >= bondBalance))
191191 then 0
192192 else (bondBalance - deficitPositive)
193193 if ((bondAmount == 0))
194194 then TransferSet([ScriptTransfer(addressFromStringValue(neutrinoContract), returnAmount, bondAssetId)])
195195 else {
196196 let orderId = split(orderbook, ORDERSPLITSYMBOL)[0]
197197 let filledTotal = getOrderFilledTotal(orderId)
198198 let orderTotal = getOrderTotal(orderId)
199199 let orderPrice = getOrderPrice(orderId)
200200 let orderOwner = getOrderOwner(orderId)
201201 let amount = ((((orderTotal - filledTotal) * 100) / orderPrice) / WAVELET)
202202 let newOrderbook = if ((bondAmount >= amount))
203203 then dropOrder(orderId)
204204 else orderbook
205205 let filledAmount = if ((bondAmount >= amount))
206206 then amount
207207 else bondAmount
208208 let total = (((filledAmount * orderPrice) / 100) * WAVELET)
209209 let status = if ((bondAmount >= amount))
210210 then FILLED
211211 else NEW
212212 ScriptResult(WriteSet([DataEntry(OrderBookKey, newOrderbook), DataEntry(getOrderFilledTotalKey(orderId), (filledTotal + total)), DataEntry(getOrderStatusKey(orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), filledAmount, bondAssetId), ScriptTransfer(addressFromStringValue(neutrinoContract), total, neutrinoAssetId)]))
213213 }
214214 }
215215
216216

github/deemru/w8io/026f985 
45.68 ms