tx · FaY14mFdv3mCQih3b7vpvpvfaTCGJjMWNCrv7TzXnUGG

3N7SvhS43TcNEzNLXVSeqWFfE21zr88RMsC:  -0.01400000 Waves

2019.11.18 16:47 [770644] smart account 3N7SvhS43TcNEzNLXVSeqWFfE21zr88RMsC > SELF 0.00000000 Waves

{ "type": 13, "id": "FaY14mFdv3mCQih3b7vpvpvfaTCGJjMWNCrv7TzXnUGG", "fee": 1400000, "feeAssetId": null, "timestamp": 1574084821234, "version": 1, "sender": "3N7SvhS43TcNEzNLXVSeqWFfE21zr88RMsC", "senderPublicKey": "3Lp94uZUAQkwp8vsxnez57VtmkhZXn3zRi4ZmBxC8q4N", "proofs": [ "2CuxgPYEDrQ8aJ3WtrArBhn7bMcshe5CxjQWHyxGtFeMKgoFkxBnW8WrGSq179f5raXnqtdVZ6F8uwjoWyk9rJvK" ], "script": "base64:AAIDAAAAAAAAAAsIARIAEgMKAQgSAAAAADMBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAAAAEAAAAYZ2V0U3RyaW5nQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABhnZXROdW1iZXJCeUFkZHJlc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nBsdXNCb25kBQAAAAZhbW91bnQJAQAAAAlkcm9wT3JkZXIAAAABBQAAAAdvcmRlcklkBQAAAAlvcmRlcmJvb2sJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABZnZXRPcmRlckZpbGxlZFRvdGFsS2V5AAAAAQUAAAAHb3JkZXJJZAkAAGQAAAACBQAAAAtmaWxsZWRUb3RhbAUAAAAObmV3RmlsbGVkVG90YWwJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABFnZXRPcmRlclN0YXR1c0tleQAAAAEFAAAAB29yZGVySWQFAAAABnN0YXR1cwUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAKb3JkZXJPd25lcgkBAAAAFWNvbnZlcnRCb25kVG9OZXV0cmlubwAAAAEFAAAADm5ld0ZpbGxlZFRvdGFsBQAAAA9uZXV0cmlub0Fzc2V0SWQFAAAAA25pbAAAAACsNZnu", "chainId": 84, "height": 770644, "spentComplexity": 0 } View: original | compacted Prev: EKXHshxMiZ1BHhXG1171XTYh4ZoyNm677MWnJH6xxahH Next: 2fhFiDkcmvKi4D2YuiH7WYFqY12nx1xK86HNHBsrrLmj Diff:
OldNewDifferences
117117
118118 let reserve = (wavesBalance(neutrinoContract) - swapWavesLockedBalance)
119119
120-let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(this, neutrinoAssetId)) + swapNeutrinoLockedBalance)
120+let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(neutrinoContract, neutrinoAssetId)) + swapNeutrinoLockedBalance)
121121
122-let surplus = (convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply)
122+let surplus = ((convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply) + assetBalance(this, neutrinoAssetId))
123123
124124 func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
125125
191191 let orderTotal = getOrderTotal(orderId)
192192 let orderOwner = getOrderOwner(orderId)
193193 let filledTotal = getOrderFilledTotal(orderId)
194- let surplusBond = (convertNeutrinoToBond(surplus) + assetBalance(this, neutrinoAssetId))
194+ let surplusBond = convertNeutrinoToBond(surplus)
195195 if ((0 >= surplusBond))
196196 then throw("there is no proficit on the smart contract now")
197197 else if ((orderbook == ""))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getNumberByKey (key) = match getInteger(this, key) {
55 case a: Int =>
66 a
77 case _ =>
88 0
99 }
1010
1111
1212 func getStringByKey (key) = match getString(this, key) {
1313 case a: String =>
1414 a
1515 case _ =>
1616 ""
1717 }
1818
1919
2020 func getStringByAddressAndKey (address,key) = match getString(address, key) {
2121 case a: String =>
2222 a
2323 case _ =>
2424 ""
2525 }
2626
2727
2828 func getNumberByAddressAndKey (address,key) = match getInteger(address, key) {
2929 case a: Int =>
3030 a
3131 case _ =>
3232 0
3333 }
3434
3535
3636 let WAVELET = 100000000
3737
3838 let ORDERSPLITSYMBOL = "_"
3939
4040 let PAULI = 100
4141
4242 let PERCENTACCURACY = 1000
4343
4444 let MAXDISCOUNT = 50
4545
4646 let CANCELED = "canceled"
4747
4848 let NEW = "new"
4949
5050 let FILLED = "filled"
5151
5252 let OrderbookKey = "orderbook"
5353
5454 let PriceKey = "price"
5555
5656 let BondAssetIdKey = "bond_asset_id"
5757
5858 let NeutrinoAssetIdKey = "neutrino_asset_id"
5959
6060 let NeutrinoContractKey = "neutrino_contract"
6161
6262 let ControlContractKey = "control_contract"
6363
6464 let SwapLockedBalanceKey = "swap_locked_balance"
6565
6666 let SwapNeutrinoLockedBalanceKey = "swap_neutrino_locked_balance"
6767
6868 let SwapWavesLockedBalanceKey = "swap_waves_locked_balance"
6969
7070 func getOrderTotalKey (orderId) = ("order_total_" + orderId)
7171
7272
7373 func getOrderOwnerKey (orderId) = ("order_owner_" + orderId)
7474
7575
7676 func getOrderHeightKey (orderId) = ("order_height_" + orderId)
7777
7878
7979 func getOrderStatusKey (orderId) = ("order_status_" + orderId)
8080
8181
8282 func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId)
8383
8484
8585 func convertNeutrinoToWaves (amount,price) = ((((amount * 100) / price) * WAVELET) / PAULI)
8686
8787
8888 func convertWavesToNeutrino (amount,price) = ((((amount * price) / 100) * PAULI) / WAVELET)
8989
9090
9191 func convertNeutrinoToBond (amount) = (amount / PAULI)
9292
9393
9494 func convertBondToNeutrino (amount) = (amount * PAULI)
9595
9696
9797 func convertWavesToBond (amount,price) = convertNeutrinoToBond(convertWavesToNeutrino(amount, price))
9898
9999
100100 let orderbook = getStringByKey(OrderbookKey)
101101
102102 let neutrinoContract = addressFromStringValue(getStringByKey(NeutrinoContractKey))
103103
104104 let controlContract = addressFromStringValue(getStringByAddressAndKey(neutrinoContract, ControlContractKey))
105105
106106 let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey)
107107
108108 let swapLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapLockedBalanceKey)
109109
110110 let swapNeutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapNeutrinoLockedBalanceKey)
111111
112112 let swapWavesLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapWavesLockedBalanceKey)
113113
114114 let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey))
115115
116116 let bondAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, BondAssetIdKey))
117117
118118 let reserve = (wavesBalance(neutrinoContract) - swapWavesLockedBalance)
119119
120-let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(this, neutrinoAssetId)) + swapNeutrinoLockedBalance)
120+let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(neutrinoContract, neutrinoAssetId)) + swapNeutrinoLockedBalance)
121121
122-let surplus = (convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply)
122+let surplus = ((convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply) + assetBalance(this, neutrinoAssetId))
123123
124124 func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
125125
126126
127127 func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
128128
129129
130130 func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
131131
132132
133133 func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
134134
135135
136136 func getOrderElementById (id) = (id + ORDERSPLITSYMBOL)
137137
138138
139139 func addOrder (orderId,position) = {
140140 let orders = split(orderbook, ORDERSPLITSYMBOL)
141141 let newOrder = getOrderElementById(orderId)
142142 if ((position == 0))
143143 then (newOrder + orderbook)
144144 else if ((position >= (size(orders) - 1)))
145145 then (orderbook + newOrder)
146146 else {
147147 let parts = split(orderbook, getOrderElementById(orders[position]))
148148 (((parts[0] + newOrder) + getOrderElementById(orders[position])) + parts[1])
149149 }
150150 }
151151
152152
153153 func dropOrder (orderId) = {
154154 let parts = split(orderbook, getOrderElementById(orderId))
155155 (parts[0] + parts[1])
156156 }
157157
158158
159159 func getOrdersInOrderbook (orderbook) = split(orderbook, ORDERSPLITSYMBOL)
160160
161161
162162 @Callable(i)
163163 func addLiquidationOrder () = {
164164 let pmt = extract(i.payment)
165165 let newOrderId = toBase58String(keccak256(((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height))))
166166 if ((pmt.assetId != bondAssetId))
167167 then throw("can use appropriate neutrino bonds tokens only")
168168 else if ((getOrderOwner(newOrderId) != ""))
169169 then throw("an order is already exists")
170170 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)])
171171 }
172172
173173
174174
175175 @Callable(i)
176176 func cancelOrder (orderId) = {
177177 let owner = getOrderOwner(orderId)
178178 let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
179179 if ((owner != toString(i.caller)))
180180 then throw("permission denied")
181181 else if ((getOrderStatus(orderId) != NEW))
182182 then throw("invalid order status")
183183 else ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)]))
184184 }
185185
186186
187187
188188 @Callable(i)
189189 func liquidateBond () = {
190190 let orderId = getOrdersInOrderbook(orderbook)[0]
191191 let orderTotal = getOrderTotal(orderId)
192192 let orderOwner = getOrderOwner(orderId)
193193 let filledTotal = getOrderFilledTotal(orderId)
194- let surplusBond = (convertNeutrinoToBond(surplus) + assetBalance(this, neutrinoAssetId))
194+ let surplusBond = convertNeutrinoToBond(surplus)
195195 if ((0 >= surplusBond))
196196 then throw("there is no proficit on the smart contract now")
197197 else if ((orderbook == ""))
198198 then throw("empty orderbook")
199199 else {
200200 let amount = (orderTotal - filledTotal)
201201 let status = if ((surplusBond >= amount))
202202 then FILLED
203203 else NEW
204204 let newFilledTotal = if ((surplusBond >= amount))
205205 then amount
206206 else surplusBond
207207 ScriptResult(WriteSet([DataEntry(OrderbookKey, if ((surplusBond >= amount))
208208 then dropOrder(orderId)
209209 else orderbook), DataEntry(getOrderFilledTotalKey(orderId), (filledTotal + newFilledTotal)), DataEntry(getOrderStatusKey(orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)]))
210210 }
211211 }
212212
213213

github/deemru/w8io/026f985 
57.80 ms