tx · DvYcALBngra21P8isXrBZPbwuiZzU9PYFLuRHcUBcGwR

3NC8pQxcnDTtDkhzv5Eje8qqW4qoFawLnAb:  -0.01400000 Waves

2019.09.16 15:18 [678783] smart account 3NC8pQxcnDTtDkhzv5Eje8qqW4qoFawLnAb > SELF 0.00000000 Waves

{ "type": 13, "id": "DvYcALBngra21P8isXrBZPbwuiZzU9PYFLuRHcUBcGwR", "fee": 1400000, "feeAssetId": null, "timestamp": 1568636378074, "version": 1, "sender": "3NC8pQxcnDTtDkhzv5Eje8qqW4qoFawLnAb", "senderPublicKey": "5vyi92HdgdTabKCQzDHGrgQ4ASjtoT3XrCUXr459sWuc", "proofs": [ "3Et2EVkYxeKPR1C8AFo2H1N56QiZn4EwJtgfN7tYYEFZgfsAS9SVeHYgtKc9tWKbnUhYRdWw2Th5eVQ2NnQhP4Th" ], "script": "base64:AAIDAAAAAAAAAAAAAAAcAAAAAAROT05FAgAAAAABAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUAAAAADE9yZGVyQm9va0tleQIAAAAJb3JkZXJib29rAAAAAA1PcmRlclByaWNlS2V5AgAAAAxvcmRlcl9wcmljZV8AAAAADU9yZGVyVG90YWxLZXkCAAAADG9yZGVyX3RvdGFsXwAAAAATT3JkZXJGaWxsZWRUb3RhbEtleQIAAAATb3JkZXJfZmlsbGVkX3RvdGFsXwAAAAANT3JkZXJPd25lcktleQIAAAAMb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29yZGVySWQJAABkAAAAAgUAAAALZmlsbGVkVG90YWwFAAAABXRvdGFsCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAADk9yZGVyU3RhdHVzS2V5BQAAAAdvcmRlcklkBQAAAAZzdGF0dXMFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADGZpbGxlZEFtb3VudAUAAAALQm9uZEFzc2V0SWQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAABBOZXV0cmlub0NvbnRyYWN0BQAAAAV0b3RhbAUAAAAPTmV1dHJpbm9Bc3NldElkBQAAAANuaWwAAAAALuLM1Q==", "chainId": 84, "height": 678783, "spentComplexity": 0 } View: original | compacted Prev: A81CkduwFsXS6Jzh3DhkM9yziFZBLH2mxfXZSAsnaLPX Next: 2xvABcx3A9ckkWt3o1qnJ3C6iTMQD1yqucS1UE2LDHWH Diff:
OldNewDifferences
137137
138138
139139 @Callable(i)
140-func execute () = {
140+func executeOrder () = {
141141 let orderId = split(orderbook, OrderSplitSymbol)[0]
142142 let bondAmount = assetBalance(this, BondAssetId)
143143 let filledTotal = getOrderFilledTotal(orderId)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = ""
55
66 func getNumberByKey (key) = match getInteger(this, key) {
77 case a: Int =>
88 a
99 case _ =>
1010 0
1111 }
1212
1313
1414 func getStringByKey (key) = match getString(this, key) {
1515 case a: String =>
1616 a
1717 case _ =>
1818 NONE
1919 }
2020
2121
2222 let OrderBookKey = "orderbook"
2323
2424 let OrderPriceKey = "order_price_"
2525
2626 let OrderTotalKey = "order_total_"
2727
2828 let OrderFilledTotalKey = "order_filled_total_"
2929
3030 let OrderOwnerKey = "order_owner_"
3131
3232 let OrderHeightKey = "order_height_"
3333
3434 let OrderStatusKey = "order_status_"
3535
3636 let BondAssetIdKey = "bond_asset_id"
3737
3838 let NeutrinoAssetIdKey = "neutrino_asset_id"
3939
4040 let NeutrinoContractKey = "neutrino_contract"
4141
4242 let orderbook = getStringByKey(OrderBookKey)
4343
4444 func getOrderPrice (id) = getNumberByKey((OrderPriceKey + id))
4545
4646
4747 func getOrderTotal (id) = getNumberByKey((OrderTotalKey + id))
4848
4949
5050 func getOrderOwner (id) = getStringByKey((OrderOwnerKey + id))
5151
5252
5353 func getOrderStatus (id) = getStringByKey((OrderStatusKey + id))
5454
5555
5656 func getOrderFilledTotal (id) = getNumberByKey((OrderFilledTotalKey + id))
5757
5858
5959 let OrderSplitSymbol = "_"
6060
6161 let BondAssetId = fromBase58String(getStringByKey(BondAssetIdKey))
6262
6363 let NeutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey))
6464
6565 let NeutrinoContract = getStringByKey(NeutrinoContractKey)
6666
6767 let Wavelet = 100000000
6868
6969 let CANCELED = "canceled"
7070
7171 let NEW = "new"
7272
7373 let FILLED = "filled"
7474
7575 func calculateOrderbook (orderId,position) = {
7676 let orders = split(orderbook, OrderSplitSymbol)
7777 let newOrder = (orderId + OrderSplitSymbol)
7878 if ((position == 0))
7979 then (newOrder + orderbook)
8080 else if ((position >= (size(orders) - 1)))
8181 then (orderbook + newOrder)
8282 else {
8383 let parts = split(orderbook, (orders[position] + OrderSplitSymbol))
8484 (((parts[0] + newOrder) + (orders[position] + OrderSplitSymbol)) + parts[1])
8585 }
8686 }
8787
8888
8989 @Callable(i)
9090 func setOrder (price,position) = {
9191 let pmt = extract(i.payment)
9292 let newOrderId = toBase58String(keccak256((((toBytes(price) + toBytes(pmt.amount)) + i.caller.bytes) + toBytes(height))))
9393 if ((pmt.assetId != NeutrinoAssetId))
9494 then throw("can use neutrino only")
9595 else if ((0 >= price))
9696 then throw("price less zero")
9797 else if ((getOrderOwner(newOrderId) != NONE))
9898 then throw("order exists")
9999 else {
100100 let orders = split(orderbook, OrderSplitSymbol)
101101 let nextOrderId = if ((position == 0))
102102 then ""
103103 else orders[(position - 1)]
104104 let nextOrderPrice = getOrderPrice(nextOrderId)
105105 let isNextOrderError = if (if ((nextOrderId != ""))
106106 then (price > nextOrderPrice)
107107 else false)
108108 then true
109109 else false
110110 let prevOrderId = orders[position]
111111 let prevOrderPrice = getOrderPrice(prevOrderId)
112112 let isPrevOrderError = if ((prevOrderPrice >= price))
113113 then true
114114 else false
115115 if (if (isNextOrderError)
116116 then true
117117 else isPrevOrderError)
118118 then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
119119 else WriteSet([DataEntry(OrderBookKey, calculateOrderbook(newOrderId, position)), DataEntry((OrderPriceKey + newOrderId), price), DataEntry((OrderTotalKey + newOrderId), pmt.amount), DataEntry((OrderOwnerKey + newOrderId), toString(i.caller)), DataEntry((OrderHeightKey + newOrderId), height), DataEntry((OrderStatusKey + newOrderId), NEW)])
120120 }
121121 }
122122
123123
124124
125125 @Callable(i)
126126 func cancelOrder (orderId) = {
127127 let owner = getOrderOwner(orderId)
128128 let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
129129 if ((owner != toString(i.caller)))
130130 then throw("permission denied")
131131 else {
132132 let parts = split(orderbook, (orderId + OrderSplitSymbol))
133133 ScriptResult(WriteSet([DataEntry(OrderBookKey, (parts[0] + parts[1])), DataEntry((OrderStatusKey + orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, NeutrinoAssetId)]))
134134 }
135135 }
136136
137137
138138
139139 @Callable(i)
140-func execute () = {
140+func executeOrder () = {
141141 let orderId = split(orderbook, OrderSplitSymbol)[0]
142142 let bondAmount = assetBalance(this, BondAssetId)
143143 let filledTotal = getOrderFilledTotal(orderId)
144144 let orderTotal = getOrderTotal(orderId)
145145 let orderPrice = getOrderPrice(orderId)
146146 let amount = ((((orderTotal - filledTotal) * 100) / orderPrice) / Wavelet)
147147 let newOrderbook = if ((bondAmount >= amount))
148148 then split(orderbook, (orderId + OrderSplitSymbol))[1]
149149 else orderbook
150150 let filledAmount = if ((bondAmount >= amount))
151151 then amount
152152 else bondAmount
153153 let total = (((filledAmount * orderPrice) / 100) * Wavelet)
154154 let status = if ((bondAmount >= amount))
155155 then FILLED
156156 else NEW
157157 ScriptResult(WriteSet([DataEntry(OrderBookKey, newOrderbook), DataEntry((OrderFilledTotalKey + orderId), (filledTotal + total)), DataEntry((OrderStatusKey + orderId), status)]), TransferSet([ScriptTransfer(i.caller, filledAmount, BondAssetId), ScriptTransfer(addressFromStringValue(NeutrinoContract), total, NeutrinoAssetId)]))
158158 }
159159
160160

github/deemru/w8io/169f3d6 
36.05 ms