tx · tR842EtG18pM3FDw9LX9n9exxroMzjMsgxs4o6JJnQP

3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd:  -0.01400000 Waves

2022.03.04 15:58 [1949261] smart account 3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd > SELF 0.00000000 Waves

{ "type": 13, "id": "tR842EtG18pM3FDw9LX9n9exxroMzjMsgxs4o6JJnQP", "fee": 1400000, "feeAssetId": null, "timestamp": 1646398779131, "version": 1, "sender": "3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd", "senderPublicKey": "CdnTmMHxT68Qa4MtHEnAiUhsdKTi2YkHPGn92ThinVNt", "proofs": [ "4QyZ2AQzwvcHX1Cqd46A6usYMYJRPWdH5gJPEeVkAmwLWcn7zRHTMUpj5tfsbcvJ7Y8M6jnrHs4A8LTrpkHTo1TE", "5Kh9kzwiiLiPhW1aKKgy2BNNeEe1qwRoVW4v5znJN6F38KbTfJjP3FbV7JL5v7tg3YQ2gXgufXgssoUsBZsEWqWe", "mHArbhkst1NPNDat5quDPRNfFnxpnDMoJ2sRPYwUS4JTXg7g4cB6qYpxQhmhVnwzT85dM3WpFyrQmVHMLbfYrVH" ], "script": "base64:AAIFAAAAAAAAAAsIAhIAEgASAwoBCAAAAEMBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQIAAAAAAQAAABZnZXRCb29sQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAdhZGRyZXNzBQAAAANrZXkHAQAAABhnZXRTdHJpbmdCeUFkZHJlc3NBbmRLZXk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QAETAAAAAICAAAALDVXUlhGU2p3Y1RiTmZLY0pzOFpxWG1TU1dZc1NWSlV0TXZNcVpqNWhINE5jBQAAAANuaWwEAAAABWNvdW50CQAAZAAAAAIJAABkAAAAAgkAAGQAAAACAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAABAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAACAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAMJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAADAAAAAAAAAAACAAAAAAAAAAAACQAAZwAAAAIFAAAABWNvdW50AAAAAAAAAAADr3pwgQ==", "chainId": 84, "height": 1949261, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 55tTXqErqwjBKRGrwM5AXWAFqjf3Ps8PsGJJgSRvJmuL Next: 7UDTRzYE5C9DH15rhdekJNeJqwyC7h4uaB7wKvzw3559 Diff:
OldNewDifferences
8484
8585 let MinWavesForNsbtBuyKey = "min_waves_nsbt_buy"
8686
87+let MinNsbtSellKey = "min_nsbt_sell"
88+
8789 func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId)
8890
8991
143145
144146 let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
145147
146-let minWavesAmountNsbtBuy = valueOrElse(getInteger(this, MinWavesForNsbtBuyKey), 10)
148+let minWavesAmountNsbtBuy = valueOrElse(getInteger(this, MinWavesForNsbtBuyKey), 1000000000)
149+
150+let minNsbtSell = valueOrElse(getInteger(this, MinNsbtSellKey), 1000000)
147151
148152 let firstOrder = getStringByKey(FirstOrderKey)
149153
189193 then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
190194 else if (isDefined(pmt.assetId))
191195 then throw("can use waves only")
192- else if (((minWavesAmountNsbtBuy * WAVELET) > pmtAmount))
196+ else if ((minWavesAmountNsbtBuy > pmtAmount))
193197 then throw((("min " + toString(minWavesAmountNsbtBuy)) + " waves expected"))
194198 else {
195199 let ownerAddress = i.caller
234238 let pmtAmount = pmt.amount
235239 if ((pmt.assetId != nsbtAssetId))
236240 then throw("can use NSBT only")
237- else {
238- let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
239- if ((neutrinoMetrics == neutrinoMetrics))
240- then {
241- let nsbtSupply = asInt(neutrinoMetrics[10])
242- let newPrice = asInt(asAnyList(invoke(mathContract, "calcContractNsbtPriceBySupplyMATH", [(nsbtSupply - pmtAmount)], nil))[0])
243- if ((newPrice == newPrice))
244- then if ((PAULI > newPrice))
245- then throw((("resulting nsbt price would be < 1 (" + toString(newPrice)) + " usdn"))
246- else {
247- let transf = invoke(neutrinoContract, "transferUsdnToUser", [pmtAmount, toString(i.caller)], nil)
248- if ((transf == transf))
249- then $Tuple2(nil, newPrice)
250- else throw("Strict value is not equal to itself.")
251- }
252- else throw("Strict value is not equal to itself.")
253- }
254- else throw("Strict value is not equal to itself.")
255- }
241+ else if ((minNsbtSell > pmtAmount))
242+ then throw((("min " + toString(minNsbtSell)) + " nsbt expected"))
243+ else {
244+ let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
245+ if ((neutrinoMetrics == neutrinoMetrics))
246+ then {
247+ let nsbtSupply = asInt(neutrinoMetrics[10])
248+ let newPrice = asInt(asAnyList(invoke(mathContract, "calcContractNsbtPriceBySupplyMATH", [(nsbtSupply - pmtAmount)], nil))[0])
249+ if ((newPrice == newPrice))
250+ then if ((PAULI > newPrice))
251+ then throw((("resulting nsbt price would be < 1 (" + toString(newPrice)) + " usdn"))
252+ else {
253+ let transf = invoke(neutrinoContract, "transferUsdnToUser", [pmtAmount, toString(i.caller)], nil)
254+ if ((transf == transf))
255+ then $Tuple2(nil, newPrice)
256+ else throw("Strict value is not equal to itself.")
257+ }
258+ else throw("Strict value is not equal to itself.")
259+ }
260+ else throw("Strict value is not equal to itself.")
261+ }
256262 }
257263
258264
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
55
66
77 func getStringByKey (key) = valueOrElse(getString(this, key), "")
88
99
1010 func getBoolByAddressAndKey (address,key) = valueOrElse(getBoolean(address, key), false)
1111
1212
1313 func getStringByAddressAndKey (address,key) = valueOrElse(getString(address, key), "")
1414
1515
1616 func getNumberByAddressAndKey (address,key) = valueOrElse(getInteger(address, key), 0)
1717
1818
1919 func asAnyList (val) = match val {
2020 case valAnyLyst: List[Any] =>
2121 valAnyLyst
2222 case _ =>
2323 throw("fail to cast into List[Any]")
2424 }
2525
2626
2727 func asString (val) = match val {
2828 case valStr: String =>
2929 valStr
3030 case _ =>
3131 throw("fail to cast into String")
3232 }
3333
3434
3535 func asInt (val) = match val {
3636 case valInt: Int =>
3737 valInt
3838 case _ =>
3939 throw("fail to cast into Int")
4040 }
4141
4242
4343 let WAVELET = 100000000
4444
4545 let PAULI = 1000000
4646
4747 let BIGPAULI = toBigInt(1000000)
4848
4949 let PRICELET = 1000000
5050
5151 let MULT = 100000000
5252
5353 let BIGMULT16 = toBigInt(10000000000000000)
5454
5555 let SCALE8 = 8
5656
5757 let SCALE16 = 16
5858
5959 let MINORDERTOTAL = (10 * WAVELET)
6060
6161 let MAXROI = 95
6262
6363 let CANCELED = "canceled"
6464
6565 let NEW = "new"
6666
6767 let FILLED = "filled"
6868
6969 let PriceKey = "price"
7070
7171 let NsbtAssetIdKey = "bond_asset_id"
7272
7373 let NeutrinoAssetIdKey = "neutrino_asset_id"
7474
7575 let BalanceLockedkKey = "balance_lock_"
7676
7777 let WavesLockedBalanceKey = (BalanceLockedkKey + "waves")
7878
7979 let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino")
8080
8181 let FirstOrderKey = "order_first"
8282
8383 let MathContractKey = "math_contract"
8484
8585 let MinWavesForNsbtBuyKey = "min_waves_nsbt_buy"
8686
87+let MinNsbtSellKey = "min_nsbt_sell"
88+
8789 func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId)
8890
8991
9092 func getOrderPriceKey (orderId) = ("order_price_" + orderId)
9193
9294
9395 func getOrderTotalKey (orderId) = ("order_total_" + orderId)
9496
9597
9698 func getOrderOwnerKey (orderId) = ("order_owner_" + orderId)
9799
98100
99101 func getOrderHeightKey (orderId) = ("order_height_" + orderId)
100102
101103
102104 func getOrderStatusKey (orderId) = ("order_status_" + orderId)
103105
104106
105107 func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId)
106108
107109
108110 func getPrevOrderKey (orderId) = ("order_prev_" + orderId)
109111
110112
111113 func getNextOrderKey (orderId) = ("order_next_" + orderId)
112114
113115
114116 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI)
115117
116118
117119 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET)
118120
119121
120122 func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price)
121123
122124
123125 func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price)
124126
125127
126128 func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult))
127129
128130
129131 func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16))
130132
131133
132134 let neutrinoContract = Address(base58'3N9be2mwrA52WJho6DiesZkk4351GvpnWuj')
133135
134136 let controlContract = Address(base58'3MrwvfA9VRYwhHy4NuWPQGdxCtZdhH4LMMa')
135137
136138 let liquidationContract = Address(base58'3N24ZPUAMhFm76N3vbNiiDtFqfUnmBHTc5N')
137139
138140 let mathContract = addressFromStringValue(getStringByKey(MathContractKey))
139141
140142 let neutrinoAssetId = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
141143
142144 let nsbtAssetId = base58'F3iaxzruFeKujfVfYSZEkejpjh67wmRfPCRHiNmWKp3Z'
143145
144146 let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
145147
146-let minWavesAmountNsbtBuy = valueOrElse(getInteger(this, MinWavesForNsbtBuyKey), 10)
148+let minWavesAmountNsbtBuy = valueOrElse(getInteger(this, MinWavesForNsbtBuyKey), 1000000000)
149+
150+let minNsbtSell = valueOrElse(getInteger(this, MinNsbtSellKey), 1000000)
147151
148152 let firstOrder = getStringByKey(FirstOrderKey)
149153
150154 func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id))
151155
152156
153157 func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
154158
155159
156160 func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
157161
158162
159163 func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
160164
161165
162166 func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
163167
164168
165169 func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id))
166170
167171
168172 func getNextOrder (id) = getStringByKey(getNextOrderKey(id))
169173
170174
171175 func getReversePrice (price) = ((PRICELET * PRICELET) / price)
172176
173177
174178 func calcNsbt2WavesPriceRaw (spentWavesRaw,receivedNsbtRaw) = fraction(spentWavesRaw, (PAULI * PRICELET), receivedNsbtRaw)
175179
176180
177181 func orderData (orderId,totalWavelets,filledWavelets,owner,status,roi,price,currentPrice) = [IntegerEntry(getOrderPriceKey(orderId), price), IntegerEntry(getOrderTotalKey(orderId), totalWavelets), IntegerEntry(getOrderFilledTotalKey(orderId), filledWavelets), StringEntry(getOrderOwnerKey(orderId), owner), IntegerEntry(getOrderHeightKey(orderId), height), StringEntry(getOrderStatusKey(orderId), status), IntegerEntry(("debug_order_currentPrice_" + orderId), currentPrice), IntegerEntry(getRoiByOrderIdKey(orderId), roi)]
178182
179183
180184 func toStr (name,curveResult) = (((((((((((((((((((((((((((((((((((name + "[nsbtAmountRaw=") + toString(asInt(curveResult[0]))) + " usdnPayment=") + toString(asInt(curveResult[1]))) + " wRaw=") + toString(asInt(curveResult[2]))) + " uRaw=") + toString(asInt(curveResult[3]))) + " mRaw=") + toString(asInt(curveResult[4]))) + " sRaw=") + toString(asInt(curveResult[5]))) + " nsbtCurveParam_a=") + toString(asInt(curveResult[6]))) + " nsbtCurveParam_b=") + toString(asInt(curveResult[7]))) + " wReservesInUsdn=") + toString(asInt(curveResult[8]))) + " price=") + toString(asInt(curveResult[9]))) + " multBR=") + toString(asInt(curveResult[10]))) + " multPower=") + toString(asInt(curveResult[11]))) + " multExpInPower=") + asString(curveResult[12])) + " multK=") + asString(curveResult[13])) + " step1=") + asString(curveResult[14])) + " step2=") + asString(curveResult[15])) + " step3=") + toString(asInt(curveResult[16]))) + "]")
181185
182186
183187 @Callable(i)
184188 func buyNsbt () = {
185189 let pmt = value(i.payments[0])
186190 let pmtAmount = pmt.amount
187191 let wavesPay = pmtAmount
188192 if (isBlocked)
189193 then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
190194 else if (isDefined(pmt.assetId))
191195 then throw("can use waves only")
192- else if (((minWavesAmountNsbtBuy * WAVELET) > pmtAmount))
196+ else if ((minWavesAmountNsbtBuy > pmtAmount))
193197 then throw((("min " + toString(minWavesAmountNsbtBuy)) + " waves expected"))
194198 else {
195199 let ownerAddress = i.caller
196200 let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
197201 if ((neutrinoMetrics == neutrinoMetrics))
198202 then {
199203 let currentPrice = asInt(neutrinoMetrics[0])
200204 let reserve = asInt(neutrinoMetrics[3])
201205 let neutrinoSupply = asInt(neutrinoMetrics[5])
202206 let nsbtSupply = asInt(neutrinoMetrics[9])
203207 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
204208 let curveResult = asAnyList(invoke(mathContract, "curveFunctionMATH", [reserve, neutrinoSupply, currentPrice, nsbtSupplyMAX, nsbtSupply, wavesPay], nil))
205209 if ((curveResult == curveResult))
206210 then {
207211 let nsbtAmount = asInt(curveResult[0])
208212 if ((0 >= nsbtAmount))
209213 then throw("nsbtAmount <= 0")
210214 else if ((wavesPay > (nsbtAmount * 9223372)))
211215 then throw(((("Nsbt2Waves price exceeds MAX_INT: " + toString(wavesPay)) + "/") + toString(nsbtAmount)))
212216 else {
213217 let nsbt2WavesPriceRaw = calcNsbt2WavesPriceRaw(wavesPay, nsbtAmount)
214218 let roi = 0
215219 let amountLeased = invoke(neutrinoContract, "acceptWaves", nil, i.payments)
216220 if ((amountLeased == amountLeased))
217221 then $Tuple2((orderData(toBase58String(i.transactionId), pmtAmount, pmtAmount, toString(ownerAddress), FILLED, roi, nsbt2WavesPriceRaw, currentPrice) ++ [ScriptTransfer(ownerAddress, nsbtAmount, nsbtAssetId), StringEntry("debug_curveResult", toStr("curveResult", curveResult))]), nsbtAmount)
218222 else throw("Strict value is not equal to itself.")
219223 }
220224 }
221225 else throw("Strict value is not equal to itself.")
222226 }
223227 else throw("Strict value is not equal to itself.")
224228 }
225229 }
226230
227231
228232
229233 @Callable(i)
230234 func sellNsbt () = if (isBlocked)
231235 then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
232236 else {
233237 let pmt = value(i.payments[0])
234238 let pmtAmount = pmt.amount
235239 if ((pmt.assetId != nsbtAssetId))
236240 then throw("can use NSBT only")
237- else {
238- let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
239- if ((neutrinoMetrics == neutrinoMetrics))
240- then {
241- let nsbtSupply = asInt(neutrinoMetrics[10])
242- let newPrice = asInt(asAnyList(invoke(mathContract, "calcContractNsbtPriceBySupplyMATH", [(nsbtSupply - pmtAmount)], nil))[0])
243- if ((newPrice == newPrice))
244- then if ((PAULI > newPrice))
245- then throw((("resulting nsbt price would be < 1 (" + toString(newPrice)) + " usdn"))
246- else {
247- let transf = invoke(neutrinoContract, "transferUsdnToUser", [pmtAmount, toString(i.caller)], nil)
248- if ((transf == transf))
249- then $Tuple2(nil, newPrice)
250- else throw("Strict value is not equal to itself.")
251- }
252- else throw("Strict value is not equal to itself.")
253- }
254- else throw("Strict value is not equal to itself.")
255- }
241+ else if ((minNsbtSell > pmtAmount))
242+ then throw((("min " + toString(minNsbtSell)) + " nsbt expected"))
243+ else {
244+ let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
245+ if ((neutrinoMetrics == neutrinoMetrics))
246+ then {
247+ let nsbtSupply = asInt(neutrinoMetrics[10])
248+ let newPrice = asInt(asAnyList(invoke(mathContract, "calcContractNsbtPriceBySupplyMATH", [(nsbtSupply - pmtAmount)], nil))[0])
249+ if ((newPrice == newPrice))
250+ then if ((PAULI > newPrice))
251+ then throw((("resulting nsbt price would be < 1 (" + toString(newPrice)) + " usdn"))
252+ else {
253+ let transf = invoke(neutrinoContract, "transferUsdnToUser", [pmtAmount, toString(i.caller)], nil)
254+ if ((transf == transf))
255+ then $Tuple2(nil, newPrice)
256+ else throw("Strict value is not equal to itself.")
257+ }
258+ else throw("Strict value is not equal to itself.")
259+ }
260+ else throw("Strict value is not equal to itself.")
261+ }
256262 }
257263
258264
259265
260266 @Callable(i)
261267 func cancelOrder (orderId) = {
262268 let owner = getOrderOwner(orderId)
263269 let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
264270 let caller = toString(i.caller)
265271 let nextOrder = getNextOrder(orderId)
266272 let prevOrder = getPrevOrder(orderId)
267273 if ((getOrderStatus(orderId) != NEW))
268274 then throw("invalid order status")
269275 else [StringEntry(FirstOrderKey, if ((firstOrder == orderId))
270276 then nextOrder
271277 else firstOrder), StringEntry(getNextOrderKey(prevOrder), nextOrder), StringEntry(getPrevOrderKey(nextOrder), prevOrder), StringEntry(getOrderStatusKey(orderId), CANCELED), ScriptTransfer(i.caller, amount, unit)]
272278 }
273279
274280
275281 @Verifier(tx)
276282 func verify () = {
277283 let pubKeyAdminsList = ["ExtEEK19nmKj9mCpnWyvEEJFYATLMcVEMvohhUHkyHNm", "Ev5py5FfBQX9cZpYKnfQrTB49Byf8QmpZWeDVRim4yV7", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"]
278284 let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0])))
279285 then 1
280286 else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1])))
281287 then 1
282288 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2])))
283289 then 1
284290 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3])))
285291 then 2
286292 else 0))
287293 (count >= 3)
288294 }
289295

github/deemru/w8io/026f985 
56.62 ms