tx · 3xvBfT2e68aAGGFdZFWpMKzVBbPW1Rm8rs8RkWjWMhTQ

3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N:  -0.02000000 Waves

2020.05.26 20:48 [1015625] smart account 3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N > SELF 0.00000000 Waves

{ "type": 13, "id": "3xvBfT2e68aAGGFdZFWpMKzVBbPW1Rm8rs8RkWjWMhTQ", "fee": 2000000, "feeAssetId": null, "timestamp": 1590515382934, "version": 1, "sender": "3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N", "senderPublicKey": "4bj7YXaphTC4Ldx7DqqMmrTjNshRtw1yNsej2XXZcAzS", "proofs": [ "59CmUzLpXDZvtY7Qnpb3ZWS8jFMyK1KLyDaX9iwE3aiik4pRHDMdBkYtyqMDn6DTo2o8TMTn8ZCkHu7SVWzpCGBY", "4PtPPYVADEiXSqJP2cAW7jtix8jc9RMFVwrbmgxTHhxzCmRf2uyE9Ki9soh2hJ5BCZpbkagupC5ieLhqBudz2ZQU", "4NgQ8n4E5hRZ6J9kna2NYJ4BPnbbe28MUaRbJLsokFucgDqCTbdmXoUFFAMWKNeGYNVMkjxFgc6a5NZFM1A2yc6J" ], "script": "base64:AAIDAAAAAAAAABcIARIECgIBCBIECgIBCBIDCgEIEgASAAAAADgBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAAAAEAAAAWZ2V0Qm9v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QAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAgkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAIAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAwkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAMAAAAAAAAAAAIAAAAAAAAAAAAJAABnAAAAAgUAAAAFY291bnQAAAAAAAAAAAN5EW0y", "chainId": 84, "height": 1015625, "spentComplexity": 0 } View: original | compacted Prev: AWF637nDw3Dtjo4HLNw54mAm54WBSpwFo5inRsgfdr7m Next: GtW3gBibgPQcnsSgmknLb4U5k9D5tBemAfGF3V925YfL Diff:
OldNewDifferences
114114 func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price)
115115
116116
117-let neutrinoContract = addressFromStringValue("3Mzbx34Ex5rRbn39vUHx9kiwh3nneF8S5we")
117+let neutrinoContract = Address(base58'3Mzbx34Ex5rRbn39vUHx9kiwh3nneF8S5we')
118118
119-let controlContract = addressFromStringValue("3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")
119+let controlContract = Address(base58'3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx')
120120
121-let liquidationContract = addressFromStringValue("3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62")
121+let liquidationContract = Address(base58'3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62')
122122
123-let neutrinoAssetId = fromBase58String("25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT")
123+let neutrinoAssetId = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'
124124
125-let bondAssetId = fromBase58String("BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH")
125+let bondAssetId = base58'BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH'
126126
127127 let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
128128
159159 func getNextOrder (id) = getStringByKey(getNextOrderKey(id))
160160
161161
162-@Callable(i)
163-func addBuyBondOrder (price,prevOrder) = {
164- let pmt = extract(i.payment)
165- let newOrderId = toBase58String(keccak256(((((toBytes(price) + toBytes(pmt.amount)) + i.caller.bytes) + toBytes(height)) + i.transactionId)))
166- let priceWavesByBondCents = fraction(100, 100, price)
167- let roi = fraction((priceWavesByBondCents - currentPrice), 100, currentPrice)
162+func internalSellBond (pFirstOrder,pNextOrder,pFilledTotal,pRoi,pPaymentWavelets,orderOwnerAddress) = if ((pFirstOrder == ""))
163+ then throw("empty orderbook")
164+ else {
165+ let priceWavesByBondCents = fraction((100 + pRoi), currentPrice, 100)
166+ let remainedTotal = (pPaymentWavelets - pFilledTotal)
167+ let fillableOrderAmount = convertWavesToBond(remainedTotal, priceWavesByBondCents)
168+ let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents)
169+ let nbTokensSellCondition = (fraction(deficit, 100, neutrinoSupply) >= pRoi)
170+ if (!(nbTokensSellCondition))
171+ then throw(("innapropriate roi: " + toString(pRoi)))
172+ else if ((totalOrderWaveletesRequired == 0))
173+ then throw("cannot fill order at the moment")
174+ else {
175+ let changeWavelets = (remainedTotal - totalOrderWaveletesRequired)
176+ let commonWriteSetData = [DataEntry(getOrderFilledTotalKey(firstOrder), (pFilledTotal + totalOrderWaveletesRequired)), DataEntry(getOrderStatusKey(firstOrder), FILLED)]
177+ let commonTransfers = [ScriptTransfer(orderOwnerAddress, fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit), ScriptTransfer(orderOwnerAddress, changeWavelets, unit)]
178+ let writeSetData = if ((pFirstOrder == firstOrder))
179+ then [DataEntry(getPrevOrderKey(pNextOrder), ""), DataEntry(FirstOrderKey, pNextOrder)] :: commonWriteSetData
180+ else commonWriteSetData
181+ ScriptResult(WriteSet(writeSetData), TransferSet(commonTransfers))
182+ }
183+ }
184+
185+
186+func internalAddBuyBondOrder (roi,prevOrder,inv,instant) = {
187+ let pmt = extract(inv.payment)
188+ let newOrderId = toBase58String(inv.transactionId)
168189 if (isBlocked)
169190 then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
170191 else if ((MINORDERTOTAL > pmt.amount))
181202 then throw("roi should not be equal to 0")
182203 else if (isDefined(pmt.assetId))
183204 then throw("can use waves only")
184- else if ((0 >= price))
185- then throw("price less zero")
186- else if ((getOrderOwner(newOrderId) != ""))
187- then throw("order exists")
188- else if (if ((prevOrder != ""))
189- then (getOrderStatus(prevOrder) != NEW)
190- else false)
191- then throw("prev order status is not new")
192- else {
193- let owner = toString(i.caller)
194- let nextOrder = if ((prevOrder == ""))
195- then firstOrder
196- else getNextOrder(prevOrder)
197- let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
198- let isNextOrderError = if (if ((nextOrder != ""))
199- then (roi >= nextOrderRoi)
205+ else if ((getOrderOwner(newOrderId) != ""))
206+ then throw("order exists")
207+ else if (if ((prevOrder != ""))
208+ then (getOrderStatus(prevOrder) != NEW)
209+ else false)
210+ then throw("prev order status is not new")
211+ else {
212+ let isNewOrderAtFirstPosition = (prevOrder == "")
213+ let owner = toString(inv.caller)
214+ let nextOrder = if (isNewOrderAtFirstPosition)
215+ then firstOrder
216+ else getNextOrder(prevOrder)
217+ let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
218+ let isNextOrderError = if (if ((nextOrder != ""))
219+ then (roi >= nextOrderRoi)
220+ else false)
221+ then true
222+ else false
223+ let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
224+ let isPrevOrderError = if (if ((prevOrder != ""))
225+ then (prevOrderRoi > roi)
226+ else false)
227+ then true
228+ else false
229+ if (if (isNextOrderError)
230+ then true
231+ else isPrevOrderError)
232+ then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
233+ else if (if (isNewOrderAtFirstPosition)
234+ then instant
200235 else false)
201- then true
202- else false
203- let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
204- let isPrevOrderError = if (if ((prevOrder != ""))
205- then (prevOrderRoi > roi)
206- else false)
207- then true
208- else false
209- if (if (isNextOrderError)
210- then true
211- else isPrevOrderError)
212- then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
213- else WriteSet([DataEntry(getPrevOrderKey(newOrderId), prevOrder), DataEntry(getNextOrderKey(newOrderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
214- then ""
215- else newOrderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
216- then ""
217- else newOrderId), DataEntry(FirstOrderKey, if (if ((firstOrder == ""))
218- then true
219- else (firstOrder == nextOrder))
220- then newOrderId
221- else firstOrder), DataEntry(getOrderPriceKey(newOrderId), price), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), owner), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW), DataEntry(("debug_order_currentPrice_" + newOrderId), currentPrice), DataEntry(getRoiByOrderIdKey(newOrderId), roi)])
222- }
236+ then internalSellBond(newOrderId, nextOrder, 0, roi, pmt.amount, inv.caller)
237+ else if (instant)
238+ then throw("Instant order couldn't be added into waiting queue")
239+ else WriteSet([DataEntry(getPrevOrderKey(newOrderId), prevOrder), DataEntry(getNextOrderKey(newOrderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
240+ then ""
241+ else newOrderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
242+ then ""
243+ else newOrderId), DataEntry(FirstOrderKey, if (if ((firstOrder == ""))
244+ then true
245+ else (firstOrder == nextOrder))
246+ then newOrderId
247+ else firstOrder), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), owner), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW), DataEntry(("debug_order_currentPrice_" + newOrderId), currentPrice), DataEntry(getRoiByOrderIdKey(newOrderId), roi)])
248+ }
249+ }
250+
251+
252+@Callable(i)
253+func instantBuyNsbtOrFail (roi,prevOrder) = {
254+ let pmt = extract(i.payment)
255+ internalAddBuyBondOrder(roi, prevOrder, i, true)
256+ }
257+
258+
259+
260+@Callable(i)
261+func addBuyBondOrder (price,prevOrder) = {
262+ let pmt = extract(i.payment)
263+ let priceWavesByBondCents = fraction(100, 100, price)
264+ let roi = fraction((priceWavesByBondCents - currentPrice), 100, currentPrice)
265+ if ((0 >= price))
266+ then throw("price less zero")
267+ else internalAddBuyBondOrder(roi, prevOrder, i, false)
223268 }
224269
225270
245290
246291
247292 @Callable(i)
248-func sellBond () = {
249- let bondBalance = assetBalance(this, bondAssetId)
250- let returnAmount = (bondBalance - neutrinoSupply)
251- if (isBlocked)
252- then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
253- else if ((bondBalance == 0))
254- then throw("without base tokens to sell")
255- else if ((returnAmount > 0))
256- then TransferSet([ScriptTransfer(neutrinoContract, returnAmount, bondAssetId)])
257- else if ((firstOrder == ""))
258- then throw("empty orderbook")
259- else {
260- let nextOrder = getNextOrder(firstOrder)
261- let filledTotal = getOrderFilledTotal(firstOrder)
262- let orderPrice = getOrderPrice(firstOrder)
263- let roi = getNumberByKey(getRoiByOrderIdKey(firstOrder))
264- let priceWavesByBondCents = fraction((100 + roi), currentPrice, 100)
265- let remainedTotal = (getOrderTotal(firstOrder) - filledTotal)
266- let amountToExecuteOrder = convertWavesToBond(remainedTotal, priceWavesByBondCents)
267- let fillOrderCondition = (bondBalance >= amountToExecuteOrder)
268- let fillableOrderAmount = if (fillOrderCondition)
269- then amountToExecuteOrder
270- else bondBalance
271- let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents)
272- let nbTokensSellCondition = (fraction(deficit, 100, neutrinoSupply) >= roi)
273- if (!(nbTokensSellCondition))
274- then throw(("innapropriate roi: " + toString(roi)))
275- else if ((amountToExecuteOrder == 0))
276- then ScriptResult(WriteSet([DataEntry(FirstOrderKey, nextOrder), DataEntry(getPrevOrderKey(nextOrder), ""), DataEntry(getOrderStatusKey(firstOrder), FILLED)]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(firstOrder)), remainedTotal, unit)]))
277- else if ((totalOrderWaveletesRequired == 0))
278- then throw("cannot fill order at the moment")
279- else {
280- let newStatus = if (if (fillOrderCondition)
281- then if ((remainedTotal == 0))
282- then true
283- else (remainedTotal == totalOrderWaveletesRequired)
284- else false)
285- then FILLED
286- else NEW
287- ScriptResult(WriteSet([DataEntry(getPrevOrderKey(nextOrder), if ((newStatus == FILLED))
288- then ""
289- else firstOrder), DataEntry(FirstOrderKey, if ((newStatus == FILLED))
290- then nextOrder
291- else firstOrder), DataEntry(getOrderFilledTotalKey(firstOrder), (filledTotal + totalOrderWaveletesRequired)), DataEntry(getOrderStatusKey(firstOrder), newStatus)]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(firstOrder)), fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit)]))
292- }
293- }
294- }
293+func sellBond () = if (isBlocked)
294+ then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
295+ else if ((firstOrder == ""))
296+ then throw("empty orderbook")
297+ else {
298+ let nextOrder = getNextOrder(firstOrder)
299+ let filledTotal = getOrderFilledTotal(firstOrder)
300+ let orderPrice = getOrderPrice(firstOrder)
301+ let roi = getNumberByKey(getRoiByOrderIdKey(firstOrder))
302+ let paymentWavelets = getOrderTotal(firstOrder)
303+ let orderOwnerAddress = Address(fromBase58String(getOrderOwner(firstOrder)))
304+ internalSellBond(firstOrder, nextOrder, filledTotal, roi, paymentWavelets, orderOwnerAddress)
305+ }
295306
296307
297308
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 getBoolByAddressAndKey (address,key) = match getBoolean(address, key) {
2121 case a: Boolean =>
2222 a
2323 case _ =>
2424 false
2525 }
2626
2727
2828 func getStringByAddressAndKey (address,key) = match getString(address, key) {
2929 case a: String =>
3030 a
3131 case _ =>
3232 ""
3333 }
3434
3535
3636 func getNumberByAddressAndKey (address,key) = match getInteger(address, key) {
3737 case a: Int =>
3838 a
3939 case _ =>
4040 0
4141 }
4242
4343
4444 let WAVELET = 100000000
4545
4646 let PAULI = 1000000
4747
4848 let MINORDERTOTAL = (10 * WAVELET)
4949
5050 let MAXROI = 95
5151
5252 let CANCELED = "canceled"
5353
5454 let NEW = "new"
5555
5656 let FILLED = "filled"
5757
5858 let NeutrinoContractKey = "neutrino_contract"
5959
6060 let PriceKey = "price"
6161
6262 let BondAssetIdKey = "bond_asset_id"
6363
6464 let NeutrinoAssetIdKey = "neutrino_asset_id"
6565
6666 let ControlContractKey = "control_contract"
6767
6868 let BalanceLockedkKey = "balance_lock_"
6969
7070 let WavesLockedBalanceKey = (BalanceLockedkKey + "waves")
7171
7272 let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino")
7373
7474 let LiquidationContractKey = "liquidation_contract"
7575
7676 let FirstOrderKey = "order_first"
7777
7878 func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId)
7979
8080
8181 func getOrderPriceKey (orderId) = ("order_price_" + orderId)
8282
8383
8484 func getOrderTotalKey (orderId) = ("order_total_" + orderId)
8585
8686
8787 func getOrderOwnerKey (orderId) = ("order_owner_" + orderId)
8888
8989
9090 func getOrderHeightKey (orderId) = ("order_height_" + orderId)
9191
9292
9393 func getOrderStatusKey (orderId) = ("order_status_" + orderId)
9494
9595
9696 func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId)
9797
9898
9999 func getPrevOrderKey (orderId) = ("order_prev_" + orderId)
100100
101101
102102 func getNextOrderKey (orderId) = ("order_next_" + orderId)
103103
104104
105105 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, 100, price), WAVELET, PAULI)
106106
107107
108108 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, 100), PAULI, WAVELET)
109109
110110
111111 func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price)
112112
113113
114114 func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price)
115115
116116
117-let neutrinoContract = addressFromStringValue("3Mzbx34Ex5rRbn39vUHx9kiwh3nneF8S5we")
117+let neutrinoContract = Address(base58'3Mzbx34Ex5rRbn39vUHx9kiwh3nneF8S5we')
118118
119-let controlContract = addressFromStringValue("3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")
119+let controlContract = Address(base58'3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx')
120120
121-let liquidationContract = addressFromStringValue("3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62")
121+let liquidationContract = Address(base58'3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62')
122122
123-let neutrinoAssetId = fromBase58String("25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT")
123+let neutrinoAssetId = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'
124124
125-let bondAssetId = fromBase58String("BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH")
125+let bondAssetId = base58'BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH'
126126
127127 let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
128128
129129 let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey)
130130
131131 let neutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, NeutrinoLockedBalanceKey)
132132
133133 let reserve = (wavesBalance(neutrinoContract) - getNumberByAddressAndKey(neutrinoContract, WavesLockedBalanceKey))
134134
135135 let neutrinoSupply = (((neutrinoLockedBalance + extract(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId))
136136
137137 let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve, currentPrice))
138138
139139 let firstOrder = getStringByKey(FirstOrderKey)
140140
141141 func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id))
142142
143143
144144 func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
145145
146146
147147 func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
148148
149149
150150 func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
151151
152152
153153 func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
154154
155155
156156 func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id))
157157
158158
159159 func getNextOrder (id) = getStringByKey(getNextOrderKey(id))
160160
161161
162-@Callable(i)
163-func addBuyBondOrder (price,prevOrder) = {
164- let pmt = extract(i.payment)
165- let newOrderId = toBase58String(keccak256(((((toBytes(price) + toBytes(pmt.amount)) + i.caller.bytes) + toBytes(height)) + i.transactionId)))
166- let priceWavesByBondCents = fraction(100, 100, price)
167- let roi = fraction((priceWavesByBondCents - currentPrice), 100, currentPrice)
162+func internalSellBond (pFirstOrder,pNextOrder,pFilledTotal,pRoi,pPaymentWavelets,orderOwnerAddress) = if ((pFirstOrder == ""))
163+ then throw("empty orderbook")
164+ else {
165+ let priceWavesByBondCents = fraction((100 + pRoi), currentPrice, 100)
166+ let remainedTotal = (pPaymentWavelets - pFilledTotal)
167+ let fillableOrderAmount = convertWavesToBond(remainedTotal, priceWavesByBondCents)
168+ let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents)
169+ let nbTokensSellCondition = (fraction(deficit, 100, neutrinoSupply) >= pRoi)
170+ if (!(nbTokensSellCondition))
171+ then throw(("innapropriate roi: " + toString(pRoi)))
172+ else if ((totalOrderWaveletesRequired == 0))
173+ then throw("cannot fill order at the moment")
174+ else {
175+ let changeWavelets = (remainedTotal - totalOrderWaveletesRequired)
176+ let commonWriteSetData = [DataEntry(getOrderFilledTotalKey(firstOrder), (pFilledTotal + totalOrderWaveletesRequired)), DataEntry(getOrderStatusKey(firstOrder), FILLED)]
177+ let commonTransfers = [ScriptTransfer(orderOwnerAddress, fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit), ScriptTransfer(orderOwnerAddress, changeWavelets, unit)]
178+ let writeSetData = if ((pFirstOrder == firstOrder))
179+ then [DataEntry(getPrevOrderKey(pNextOrder), ""), DataEntry(FirstOrderKey, pNextOrder)] :: commonWriteSetData
180+ else commonWriteSetData
181+ ScriptResult(WriteSet(writeSetData), TransferSet(commonTransfers))
182+ }
183+ }
184+
185+
186+func internalAddBuyBondOrder (roi,prevOrder,inv,instant) = {
187+ let pmt = extract(inv.payment)
188+ let newOrderId = toBase58String(inv.transactionId)
168189 if (isBlocked)
169190 then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
170191 else if ((MINORDERTOTAL > pmt.amount))
171192 then throw(("min order total equals " + toString(MINORDERTOTAL)))
172193 else if ((roi > MAXROI))
173194 then throw("max setOrder ROI is 95%")
174195 else if (if ((deficit > 0))
175196 then (0 > roi)
176197 else false)
177198 then throw("can't place order with negative roi during deficit")
178199 else if ((-(MAXROI) > roi))
179200 then throw("min setOrder ROI is -95%")
180201 else if ((roi == 0))
181202 then throw("roi should not be equal to 0")
182203 else if (isDefined(pmt.assetId))
183204 then throw("can use waves only")
184- else if ((0 >= price))
185- then throw("price less zero")
186- else if ((getOrderOwner(newOrderId) != ""))
187- then throw("order exists")
188- else if (if ((prevOrder != ""))
189- then (getOrderStatus(prevOrder) != NEW)
190- else false)
191- then throw("prev order status is not new")
192- else {
193- let owner = toString(i.caller)
194- let nextOrder = if ((prevOrder == ""))
195- then firstOrder
196- else getNextOrder(prevOrder)
197- let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
198- let isNextOrderError = if (if ((nextOrder != ""))
199- then (roi >= nextOrderRoi)
205+ else if ((getOrderOwner(newOrderId) != ""))
206+ then throw("order exists")
207+ else if (if ((prevOrder != ""))
208+ then (getOrderStatus(prevOrder) != NEW)
209+ else false)
210+ then throw("prev order status is not new")
211+ else {
212+ let isNewOrderAtFirstPosition = (prevOrder == "")
213+ let owner = toString(inv.caller)
214+ let nextOrder = if (isNewOrderAtFirstPosition)
215+ then firstOrder
216+ else getNextOrder(prevOrder)
217+ let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
218+ let isNextOrderError = if (if ((nextOrder != ""))
219+ then (roi >= nextOrderRoi)
220+ else false)
221+ then true
222+ else false
223+ let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
224+ let isPrevOrderError = if (if ((prevOrder != ""))
225+ then (prevOrderRoi > roi)
226+ else false)
227+ then true
228+ else false
229+ if (if (isNextOrderError)
230+ then true
231+ else isPrevOrderError)
232+ then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
233+ else if (if (isNewOrderAtFirstPosition)
234+ then instant
200235 else false)
201- then true
202- else false
203- let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
204- let isPrevOrderError = if (if ((prevOrder != ""))
205- then (prevOrderRoi > roi)
206- else false)
207- then true
208- else false
209- if (if (isNextOrderError)
210- then true
211- else isPrevOrderError)
212- then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
213- else WriteSet([DataEntry(getPrevOrderKey(newOrderId), prevOrder), DataEntry(getNextOrderKey(newOrderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
214- then ""
215- else newOrderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
216- then ""
217- else newOrderId), DataEntry(FirstOrderKey, if (if ((firstOrder == ""))
218- then true
219- else (firstOrder == nextOrder))
220- then newOrderId
221- else firstOrder), DataEntry(getOrderPriceKey(newOrderId), price), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), owner), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW), DataEntry(("debug_order_currentPrice_" + newOrderId), currentPrice), DataEntry(getRoiByOrderIdKey(newOrderId), roi)])
222- }
236+ then internalSellBond(newOrderId, nextOrder, 0, roi, pmt.amount, inv.caller)
237+ else if (instant)
238+ then throw("Instant order couldn't be added into waiting queue")
239+ else WriteSet([DataEntry(getPrevOrderKey(newOrderId), prevOrder), DataEntry(getNextOrderKey(newOrderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
240+ then ""
241+ else newOrderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
242+ then ""
243+ else newOrderId), DataEntry(FirstOrderKey, if (if ((firstOrder == ""))
244+ then true
245+ else (firstOrder == nextOrder))
246+ then newOrderId
247+ else firstOrder), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), owner), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW), DataEntry(("debug_order_currentPrice_" + newOrderId), currentPrice), DataEntry(getRoiByOrderIdKey(newOrderId), roi)])
248+ }
249+ }
250+
251+
252+@Callable(i)
253+func instantBuyNsbtOrFail (roi,prevOrder) = {
254+ let pmt = extract(i.payment)
255+ internalAddBuyBondOrder(roi, prevOrder, i, true)
256+ }
257+
258+
259+
260+@Callable(i)
261+func addBuyBondOrder (price,prevOrder) = {
262+ let pmt = extract(i.payment)
263+ let priceWavesByBondCents = fraction(100, 100, price)
264+ let roi = fraction((priceWavesByBondCents - currentPrice), 100, currentPrice)
265+ if ((0 >= price))
266+ then throw("price less zero")
267+ else internalAddBuyBondOrder(roi, prevOrder, i, false)
223268 }
224269
225270
226271
227272 @Callable(i)
228273 func cancelOrder (orderId) = {
229274 let owner = getOrderOwner(orderId)
230275 let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
231276 let caller = toString(i.caller)
232277 let nextOrder = getNextOrder(orderId)
233278 let prevOrder = getPrevOrder(orderId)
234279 if (isBlocked)
235280 then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
236281 else if ((owner != caller))
237282 then throw("permission denied")
238283 else if ((getOrderStatus(orderId) != NEW))
239284 then throw("invalid order status")
240285 else ScriptResult(WriteSet([DataEntry(FirstOrderKey, if ((firstOrder == orderId))
241286 then nextOrder
242287 else firstOrder), DataEntry(getNextOrderKey(prevOrder), nextOrder), DataEntry(getPrevOrderKey(nextOrder), prevOrder), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
243288 }
244289
245290
246291
247292 @Callable(i)
248-func sellBond () = {
249- let bondBalance = assetBalance(this, bondAssetId)
250- let returnAmount = (bondBalance - neutrinoSupply)
251- if (isBlocked)
252- then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
253- else if ((bondBalance == 0))
254- then throw("without base tokens to sell")
255- else if ((returnAmount > 0))
256- then TransferSet([ScriptTransfer(neutrinoContract, returnAmount, bondAssetId)])
257- else if ((firstOrder == ""))
258- then throw("empty orderbook")
259- else {
260- let nextOrder = getNextOrder(firstOrder)
261- let filledTotal = getOrderFilledTotal(firstOrder)
262- let orderPrice = getOrderPrice(firstOrder)
263- let roi = getNumberByKey(getRoiByOrderIdKey(firstOrder))
264- let priceWavesByBondCents = fraction((100 + roi), currentPrice, 100)
265- let remainedTotal = (getOrderTotal(firstOrder) - filledTotal)
266- let amountToExecuteOrder = convertWavesToBond(remainedTotal, priceWavesByBondCents)
267- let fillOrderCondition = (bondBalance >= amountToExecuteOrder)
268- let fillableOrderAmount = if (fillOrderCondition)
269- then amountToExecuteOrder
270- else bondBalance
271- let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents)
272- let nbTokensSellCondition = (fraction(deficit, 100, neutrinoSupply) >= roi)
273- if (!(nbTokensSellCondition))
274- then throw(("innapropriate roi: " + toString(roi)))
275- else if ((amountToExecuteOrder == 0))
276- then ScriptResult(WriteSet([DataEntry(FirstOrderKey, nextOrder), DataEntry(getPrevOrderKey(nextOrder), ""), DataEntry(getOrderStatusKey(firstOrder), FILLED)]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(firstOrder)), remainedTotal, unit)]))
277- else if ((totalOrderWaveletesRequired == 0))
278- then throw("cannot fill order at the moment")
279- else {
280- let newStatus = if (if (fillOrderCondition)
281- then if ((remainedTotal == 0))
282- then true
283- else (remainedTotal == totalOrderWaveletesRequired)
284- else false)
285- then FILLED
286- else NEW
287- ScriptResult(WriteSet([DataEntry(getPrevOrderKey(nextOrder), if ((newStatus == FILLED))
288- then ""
289- else firstOrder), DataEntry(FirstOrderKey, if ((newStatus == FILLED))
290- then nextOrder
291- else firstOrder), DataEntry(getOrderFilledTotalKey(firstOrder), (filledTotal + totalOrderWaveletesRequired)), DataEntry(getOrderStatusKey(firstOrder), newStatus)]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(firstOrder)), fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit)]))
292- }
293- }
294- }
293+func sellBond () = if (isBlocked)
294+ then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
295+ else if ((firstOrder == ""))
296+ then throw("empty orderbook")
297+ else {
298+ let nextOrder = getNextOrder(firstOrder)
299+ let filledTotal = getOrderFilledTotal(firstOrder)
300+ let orderPrice = getOrderPrice(firstOrder)
301+ let roi = getNumberByKey(getRoiByOrderIdKey(firstOrder))
302+ let paymentWavelets = getOrderTotal(firstOrder)
303+ let orderOwnerAddress = Address(fromBase58String(getOrderOwner(firstOrder)))
304+ internalSellBond(firstOrder, nextOrder, filledTotal, roi, paymentWavelets, orderOwnerAddress)
305+ }
295306
296307
297308
298309 @Callable(i)
299310 func updateReservesAndNeutrinoSupply () = {
300311 func getNumberByKeyInternal (key) = match getInteger(this, key) {
301312 case a: Int =>
302313 a
303314 case _ =>
304315 0
305316 }
306317
307318 let idx = getNumberByKeyInternal("updateReservesAndNeutrinoSupplyIdx")
308319 let newIdx = (idx + 1)
309320 WriteSet([DataEntry("updateReservesAndNeutrinoSupplyIdx", newIdx), DataEntry("reserve", reserve), DataEntry("neutrinoSupply", neutrinoSupply), DataEntry("deficit", deficit)])
310321 }
311322
312323
313324 @Verifier(tx)
314325 func verify () = {
315326 let pubKeyAdminsList = ["GXxmZaCigPgJsT6d1cLr8nUXA65nGX8V7FuAzzrY8wQE", "3xumx4hrPpeeoo79HLGbZCgfz95L39ZFdxxwWeSUC2Pu", "D4CqtK5fBsnzRo33ZMhrM7niLseDH2uRoK6weBq2JQ3A", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"]
316327 let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0])))
317328 then 1
318329 else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1])))
319330 then 1
320331 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2])))
321332 then 1
322333 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3])))
323334 then 2
324335 else 0))
325336 (count >= 3)
326337 }
327338

github/deemru/w8io/169f3d6 
72.01 ms