tx · xNdrfhkYUJxGwz9JFF1EiwbWZSFHcNawLiTtRAqnhwM

3MrtHeXquGPcRd3YjJQHfY1Ss6oSDpfxGuL:  -0.01400000 Waves

2019.09.18 10:30 [681397] smart account 3MrtHeXquGPcRd3YjJQHfY1Ss6oSDpfxGuL > SELF 0.00000000 Waves

{ "type": 13, "id": "xNdrfhkYUJxGwz9JFF1EiwbWZSFHcNawLiTtRAqnhwM", "fee": 1400000, "feeAssetId": null, "timestamp": 1568791802725, "version": 1, "sender": "3MrtHeXquGPcRd3YjJQHfY1Ss6oSDpfxGuL", "senderPublicKey": "3nmDHSgwcZ79tNbGjppGBY9MbYm4qLZEJcZ32D2WmxkG", "proofs": [ "FH9yQA5D2eNFTUd4WT2RVghfWWQuU4rW1qNVzjfTyzsPJMCqu1VnxLiKn3797SoP62NA9HS1QobZmKV4Ckv4vPu" ], "script": "base64:AAIDAAAAAAAAAAAAAABGAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAAAABAAAADGdldEJvb2xCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQcBAAAAGGdldE51bWJlckJ5S2V5QW5kQWRkcmVzcwAAAAIAAAAHYWRkcmVzcwAAAANrZXkEAAA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VycGx1c0JvbmQFAAAABmFtb3VudAUAAAAKb3JkZXJUb3RhbAUAAAALc3VycGx1c0JvbmQJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAxPcmRlcmJvb2tLZXkJAAGRAAAAAgkABLUAAAACBQAAAAlvcmRlcmJvb2sJAAEsAAAAAgUAAAAHb3JkZXJJZAUAAAAPTGlzdFNwbGl0U3ltYm9sAAAAAAAAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAAE09yZGVyRmlsbGVkVG90YWxLZXkFAAAAB29yZGVySWQJAABkAAAAAgUAAAALZmlsbGVkVG90YWwFAAAADm5ld0ZpbGxlZFRvdGFsCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAADk9yZGVyU3RhdHVzS2V5BQAAAAdvcmRlcklkBQAAAAZzdGF0dXMFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAACm9yZGVyT3duZXIJAQAAABVjb252ZXJ0Qm9uZFRvTmV1dHJpbm8AAAABBQAAAA5uZXdGaWxsZWRUb3RhbAUAAAAPbmV1dHJpbm9Bc3NldElkBQAAAANuaWwAAAAA2JoVUQ==", "chainId": 84, "height": 681397, "spentComplexity": 0 } View: original | compacted Prev: 4LoBcYALToq4aumjUjYaUDK95DHvzLSnsS5SceTMUSrR Next: none Diff:
OldNewDifferences
8787
8888 let OrderHeightKey = "order_height_"
8989
90-let OrderbookTotalKey = "orderbook_total"
91-
92-let OrderbookTotalSnapshotKey = "orderbook_total_snapshot"
90+let OrderFilledTotalKey = "order_filled_total_"
9391
9492 let SnapshotBlockKey = "snapshot_block"
9593
113111
114112 let NodeProviderStatus = "node_status"
115113
114+let OrderStatusKey = "order_status_"
115+
116116 let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey))
117117
118118 let price = getNumberByKey(PriceKey)
124124 (info.quantity - assetBalance(this, neutrinoAssetId))
125125 }
126126
127-let orderbookTotal = getNumberByKey(OrderbookTotalKey)
128-
129127 let orderbook = getStringByKey(OrderbookKey)
130128
131129 let snapshotBlock = getNumberByKey(SnapshotBlockKey)
133131 let lastBondGenerated = getNumberByKey(BondGeneratedBlockKey)
134132
135133 let orderbookSnapshot = getStringByKey(OrderbookSnapshotKey)
136-
137-let orderbookTotalSnapshot = getNumberByKey(OrderbookTotalSnapshotKey)
138134
139135 let bondAssetId = fromBase58String(getStringByKey(BondAssetIdKey))
140136
177173 func isSentNodeBalance (address,block) = getBoolByKey((((IsSentNodeBalanceKey + address) + ListSplitSymbol) + toString(block)))
178174
179175
176+func getOrderFilledTotal (id) = getNumberByKey((OrderFilledTotalKey + id))
177+
178+
180179 func convertNeutrinoToWaves (amount) = ((amount * 100) / price)
181180
182181
193192
194193
195194 let surplus = (convertWavesToNeutrino(reserve) - neutrinoSupply)
195+
196+let CANCELED = "canceled"
197+
198+let NEW = "new"
199+
200+let FILLED = "filled"
196201
197202 @Callable(i)
198203 func setCurrentPrice (price) = WriteSet([DataEntry(PriceKey, price), DataEntry(((PriceKey + ListSplitSymbol) + toString(height)), price)])
254259 then throw("can use bond only")
255260 else if ((getOrderOwner(newOrderId) != ""))
256261 then throw("order exists")
257- else WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal + pmt.amount)), DataEntry(OrderbookKey, ((orderbook + newOrderId) + ListSplitSymbol)), DataEntry((OrderTotalKey + newOrderId), pmt.amount), DataEntry((OrderOwnerKey + newOrderId), toString(i.caller)), DataEntry((OrderHeightKey + newOrderId), height)])
262+ else WriteSet([DataEntry(OrderbookKey, ((orderbook + newOrderId) + ListSplitSymbol)), DataEntry((OrderTotalKey + newOrderId), pmt.amount), DataEntry((OrderOwnerKey + newOrderId), toString(i.caller)), DataEntry((OrderHeightKey + newOrderId), height)])
258263 }
259264
260265
262267 @Callable(i)
263268 func cancelOrder (orderId) = {
264269 let owner = getOrderOwner(orderId)
265- let total = getOrderTotal(orderId)
270+ let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
266271 if ((owner != toString(i.caller)))
267272 then throw("permission denied")
268273 else {
269- let newOrderBookOnePart = split(orderbook, (orderId + ListSplitSymbol))[0]
270- let newOrderBookTwoPart = split(orderbook, (orderId + ListSplitSymbol))[1]
271- ScriptResult(WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal - total)), DataEntry(OrderbookKey, (newOrderBookOnePart + newOrderBookTwoPart)), DataEntry((OrderTotalKey + orderId), 0)]), TransferSet([ScriptTransfer(i.caller, total, unit)]))
274+ let parts = split(orderbook, (orderId + ListSplitSymbol))
275+ ScriptResult(WriteSet([DataEntry(OrderbookKey, (parts[0] + parts[1])), DataEntry((OrderStatusKey + orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)]))
272276 }
273277 }
274278
279283 let orderId = split(orderbook, ListSplitSymbol)[0]
280284 let orderTotal = getOrderTotal(orderId)
281285 let orderOwner = getOrderOwner(orderId)
286+ let filledTotal = getOrderFilledTotal(orderId)
282287 if ((0 >= surplus))
283288 then throw("surplus is less than zero")
284289 else {
285- let amount = convertBondToNeutrino((orderTotal - convertNeutrinoToBond(surplus)))
286- ScriptResult(WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal - (if ((surplus >= orderTotal))
290+ let amount = (orderTotal - filledTotal)
291+ let surplusBond = convertNeutrinoToBond(surplus)
292+ let status = if ((surplusBond >= amount))
293+ then FILLED
294+ else NEW
295+ let newFilledTotal = if ((surplusBond >= amount))
287296 then orderTotal
288- else surplus))), DataEntry(OrderbookKey, split(orderbook, (orderId + ListSplitSymbol))[1]), DataEntry((OrderTotalKey + orderId), if ((0 >= amount))
289- then 0
290- else amount)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), if ((surplus >= orderTotal))
291- then convertBondToNeutrino(orderTotal)
292- else surplus, neutrinoAssetId)]))
297+ else surplusBond
298+ ScriptResult(WriteSet([DataEntry(OrderbookKey, split(orderbook, (orderId + ListSplitSymbol))[1]), DataEntry((OrderFilledTotalKey + orderId), (filledTotal + newFilledTotal)), DataEntry((OrderStatusKey + orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)]))
293299 }
294300 }
295301
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 getBoolByKey (key) = match getBoolean(this, key) {
2121 case a: Boolean =>
2222 a
2323 case _ =>
2424 false
2525 }
2626
2727
2828 func getNumberByKeyAndAddress (address,key) = match getInteger(addressFromStringValue(address), key) {
2929 case a: Int =>
3030 a
3131 case _ =>
3232 0
3333 }
3434
3535
3636 func getStringByKeyAndAddress (address,key) = match getString(addressFromStringValue(address), key) {
3737 case a: String =>
3838 a
3939 case _ =>
4040 ""
4141 }
4242
4343
4444 func getBoolByKeyAndAddress (address,key) = match getBoolean(addressFromStringValue(address), key) {
4545 case a: Boolean =>
4646 a
4747 case _ =>
4848 false
4949 }
5050
5151
5252 let ListSplitSymbol = "_"
5353
5454 let BalanceLockBlock = 0
5555
5656 let ListDataSplitSymbol = "+"
5757
5858 let Wavelet = 100000000
5959
6060 let MinimalBondOrder = (10 * Wavelet)
6161
6262 let MinimalSurplus = (10 * Wavelet)
6363
6464 let ApplyBlockTimeout = 10
6565
6666 let LeaseContractKey = "lease_contract"
6767
6868 let NeutrinoAssetIdKey = "neutrino_asset_id"
6969
7070 let BondAssetIdKey = "bond_asset_id"
7171
7272 let AuctionContractKey = "auction_contract"
7373
7474 let PriceKey = "price"
7575
7676 let NeutrinoBalanceKey = "neutrino_"
7777
7878 let WavesBalanceKey = "waves_"
7979
8080 let BalanceBlockKey = "balance_block_"
8181
8282 let OrderbookKey = "orderbook"
8383
8484 let OrderTotalKey = "order_total_"
8585
8686 let OrderOwnerKey = "order_owner_"
8787
8888 let OrderHeightKey = "order_height_"
8989
90-let OrderbookTotalKey = "orderbook_total"
91-
92-let OrderbookTotalSnapshotKey = "orderbook_total_snapshot"
90+let OrderFilledTotalKey = "order_filled_total_"
9391
9492 let SnapshotBlockKey = "snapshot_block"
9593
9694 let OrderbookSnapshotKey = "orderbook_snapshot"
9795
9896 let BondGeneratedBlockKey = "bond_generated_block"
9997
10098 let AccountSnapshotBlockKey = "account_snapshot_block_"
10199
102100 let AccountSnapshotOwnerKey = "account_snapshot_owner_"
103101
104102 let AccountSnapshotAmountKey = "account_snapshot_amount_"
105103
106104 let AccountSnapshotNodeKey = "account_snapshot_node_"
107105
108106 let SnapshotNodeBalanceKey = "snapshot_node_balance_"
109107
110108 let NodeBalanceKey = "node_balance_"
111109
112110 let IsSentNodeBalanceKey = "is_sent_node_balance_"
113111
114112 let NodeProviderStatus = "node_status"
115113
114+let OrderStatusKey = "order_status_"
115+
116116 let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey))
117117
118118 let price = getNumberByKey(PriceKey)
119119
120120 let reserve = wavesBalance(this)
121121
122122 let neutrinoSupply = {
123123 let info = extract(assetInfo(neutrinoAssetId))
124124 (info.quantity - assetBalance(this, neutrinoAssetId))
125125 }
126126
127-let orderbookTotal = getNumberByKey(OrderbookTotalKey)
128-
129127 let orderbook = getStringByKey(OrderbookKey)
130128
131129 let snapshotBlock = getNumberByKey(SnapshotBlockKey)
132130
133131 let lastBondGenerated = getNumberByKey(BondGeneratedBlockKey)
134132
135133 let orderbookSnapshot = getStringByKey(OrderbookSnapshotKey)
136-
137-let orderbookTotalSnapshot = getNumberByKey(OrderbookTotalSnapshotKey)
138134
139135 let bondAssetId = fromBase58String(getStringByKey(BondAssetIdKey))
140136
141137 let auctionContract = getStringByKey(AuctionContractKey)
142138
143139 let leaseContract = getStringByKey(LeaseContractKey)
144140
145141 let bondSupply = {
146142 let info = extract(assetInfo(bondAssetId))
147143 (info.quantity - assetBalance(this, bondAssetId))
148144 }
149145
150146 func getWavesBalance (owner) = getNumberByKey((WavesBalanceKey + owner))
151147
152148
153149 func getNeutrinoBalance (owner) = getNumberByKey((NeutrinoBalanceKey + owner))
154150
155151
156152 func getBalanceBlock (owner) = getNumberByKey((BalanceBlockKey + owner))
157153
158154
159155 func getOrderTotal (id) = getNumberByKey((OrderTotalKey + id))
160156
161157
162158 func getOrderOwner (id) = getStringByKey((OrderOwnerKey + id))
163159
164160
165161 func getAccountSnapshotBlock (id) = getNumberByKey((AccountSnapshotBlockKey + id))
166162
167163
168164 func getAccountSnapshotOwner (id) = getStringByKey((AccountSnapshotOwnerKey + id))
169165
170166
171167 func getAccountSnapshotAmount (id) = getNumberByKey((AccountSnapshotAmountKey + id))
172168
173169
174170 func getNodeBalance (address,block) = getNumberByKeyAndAddress(leaseContract, (((NodeBalanceKey + address) + ListSplitSymbol) + toString(block)))
175171
176172
177173 func isSentNodeBalance (address,block) = getBoolByKey((((IsSentNodeBalanceKey + address) + ListSplitSymbol) + toString(block)))
178174
179175
176+func getOrderFilledTotal (id) = getNumberByKey((OrderFilledTotalKey + id))
177+
178+
180179 func convertNeutrinoToWaves (amount) = ((amount * 100) / price)
181180
182181
183182 func convertWavesToNeutrino (amount) = ((amount * price) / 100)
184183
185184
186185 func convertNeutrinoToBond (amount) = (amount / Wavelet)
187186
188187
189188 func convertBondToNeutrino (amount) = (amount * Wavelet)
190189
191190
192191 func convertWavesToBond (amount) = convertNeutrinoToBond(convertWavesToNeutrino(amount))
193192
194193
195194 let surplus = (convertWavesToNeutrino(reserve) - neutrinoSupply)
195+
196+let CANCELED = "canceled"
197+
198+let NEW = "new"
199+
200+let FILLED = "filled"
196201
197202 @Callable(i)
198203 func setCurrentPrice (price) = WriteSet([DataEntry(PriceKey, price), DataEntry(((PriceKey + ListSplitSymbol) + toString(height)), price)])
199204
200205
201206
202207 @Callable(i)
203208 func swapWavesToNeutrino () = {
204209 let pmt = extract(i.payment)
205210 if (isDefined(pmt.assetId))
206211 then throw("can use waves only")
207212 else {
208213 let account = toBase58String(i.caller.bytes)
209214 let amount = convertWavesToNeutrino(pmt.amount)
210215 WriteSet([DataEntry((NeutrinoBalanceKey + toString(i.caller)), (amount + getNeutrinoBalance(account))), DataEntry((BalanceBlockKey + toString(i.caller)), height)])
211216 }
212217 }
213218
214219
215220
216221 @Callable(i)
217222 func swapNeutrinoToWaves () = {
218223 let pmt = extract(i.payment)
219224 if ((pmt.assetId != neutrinoAssetId))
220225 then throw("can use neutrino only")
221226 else {
222227 let account = toBase58String(i.caller.bytes)
223228 let amount = convertNeutrinoToWaves(pmt.amount)
224229 WriteSet([DataEntry((WavesBalanceKey + toString(i.caller)), (amount + getWavesBalance(account))), DataEntry((BalanceBlockKey + toString(i.caller)), height)])
225230 }
226231 }
227232
228233
229234
230235 @Callable(i)
231236 func withdraw (account) = if (((getBalanceBlock(account) + BalanceLockBlock) >= height))
232237 then throw("wait a couple of blocks for withdraw")
233238 else ScriptResult(WriteSet([DataEntry((WavesBalanceKey + account), 0), DataEntry((NeutrinoBalanceKey + account), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(account), getNeutrinoBalance(account), neutrinoAssetId), ScriptTransfer(addressFromStringValue(account), getWavesBalance(account), unit)]))
234239
235240
236241
237242 @Callable(i)
238243 func generateBond () = {
239244 let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve))
240245 let balanceAuction = assetBalance(addressFromStringValue(auctionContract), bondAssetId)
241246 let amount = (convertNeutrinoToBond(deficit) - balanceAuction)
242247 if ((amount > 0))
243248 then TransferSet([ScriptTransfer(addressFromStringValue(auctionContract), amount, bondAssetId)])
244249 else throw(("deficit did not reach the threshold. deficit =" + toString(deficit)))
245250 }
246251
247252
248253
249254 @Callable(i)
250255 func setOrder () = {
251256 let pmt = extract(i.payment)
252257 let newOrderId = toBase58String(keccak256(((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height))))
253258 if ((pmt.assetId != bondAssetId))
254259 then throw("can use bond only")
255260 else if ((getOrderOwner(newOrderId) != ""))
256261 then throw("order exists")
257- else WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal + pmt.amount)), DataEntry(OrderbookKey, ((orderbook + newOrderId) + ListSplitSymbol)), DataEntry((OrderTotalKey + newOrderId), pmt.amount), DataEntry((OrderOwnerKey + newOrderId), toString(i.caller)), DataEntry((OrderHeightKey + newOrderId), height)])
262+ else WriteSet([DataEntry(OrderbookKey, ((orderbook + newOrderId) + ListSplitSymbol)), DataEntry((OrderTotalKey + newOrderId), pmt.amount), DataEntry((OrderOwnerKey + newOrderId), toString(i.caller)), DataEntry((OrderHeightKey + newOrderId), height)])
258263 }
259264
260265
261266
262267 @Callable(i)
263268 func cancelOrder (orderId) = {
264269 let owner = getOrderOwner(orderId)
265- let total = getOrderTotal(orderId)
270+ let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
266271 if ((owner != toString(i.caller)))
267272 then throw("permission denied")
268273 else {
269- let newOrderBookOnePart = split(orderbook, (orderId + ListSplitSymbol))[0]
270- let newOrderBookTwoPart = split(orderbook, (orderId + ListSplitSymbol))[1]
271- ScriptResult(WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal - total)), DataEntry(OrderbookKey, (newOrderBookOnePart + newOrderBookTwoPart)), DataEntry((OrderTotalKey + orderId), 0)]), TransferSet([ScriptTransfer(i.caller, total, unit)]))
274+ let parts = split(orderbook, (orderId + ListSplitSymbol))
275+ ScriptResult(WriteSet([DataEntry(OrderbookKey, (parts[0] + parts[1])), DataEntry((OrderStatusKey + orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)]))
272276 }
273277 }
274278
275279
276280
277281 @Callable(i)
278282 func executeOrder () = {
279283 let orderId = split(orderbook, ListSplitSymbol)[0]
280284 let orderTotal = getOrderTotal(orderId)
281285 let orderOwner = getOrderOwner(orderId)
286+ let filledTotal = getOrderFilledTotal(orderId)
282287 if ((0 >= surplus))
283288 then throw("surplus is less than zero")
284289 else {
285- let amount = convertBondToNeutrino((orderTotal - convertNeutrinoToBond(surplus)))
286- ScriptResult(WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal - (if ((surplus >= orderTotal))
290+ let amount = (orderTotal - filledTotal)
291+ let surplusBond = convertNeutrinoToBond(surplus)
292+ let status = if ((surplusBond >= amount))
293+ then FILLED
294+ else NEW
295+ let newFilledTotal = if ((surplusBond >= amount))
287296 then orderTotal
288- else surplus))), DataEntry(OrderbookKey, split(orderbook, (orderId + ListSplitSymbol))[1]), DataEntry((OrderTotalKey + orderId), if ((0 >= amount))
289- then 0
290- else amount)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), if ((surplus >= orderTotal))
291- then convertBondToNeutrino(orderTotal)
292- else surplus, neutrinoAssetId)]))
297+ else surplusBond
298+ ScriptResult(WriteSet([DataEntry(OrderbookKey, split(orderbook, (orderId + ListSplitSymbol))[1]), DataEntry((OrderFilledTotalKey + orderId), (filledTotal + newFilledTotal)), DataEntry((OrderStatusKey + orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)]))
293299 }
294300 }
295301
296302

github/deemru/w8io/169f3d6 
65.39 ms