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:AAIFAAAAAAAAAAsIAhIAEgASAwoBCAAAAEMBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQIAAAAAAQAAABZnZXRCb29sQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAdhZGRyZXNzBQAAAANrZXkHAQAAABhnZXRTdHJpbmdCeUFkZHJlc3NBbmRLZXkA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AETAAAAAICAAAALDVXUlhGU2p3Y1RiTmZLY0pzOFpxWG1TU1dZc1NWSlV0TXZNcVpqNWhINE5jBQAAAANuaWwEAAAABWNvdW50CQAAZAAAAAIJAABkAAAAAgkAAGQAAAACAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAABAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAACAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAMJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAADAAAAAAAAAAACAAAAAAAAAAAACQAAZwAAAAIFAAAABWNvdW50AAAAAAAAAAADr3pwgQ==", "chainId": 84, "height": 1949261, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 55tTXqErqwjBKRGrwM5AXWAFqjf3Ps8PsGJJgSRvJmuL Next: 7UDTRzYE5C9DH15rhdekJNeJqwyC7h4uaB7wKvzw3559 Diff:
Old | New | Differences | |
---|---|---|---|
84 | 84 | ||
85 | 85 | let MinWavesForNsbtBuyKey = "min_waves_nsbt_buy" | |
86 | 86 | ||
87 | + | let MinNsbtSellKey = "min_nsbt_sell" | |
88 | + | ||
87 | 89 | func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId) | |
88 | 90 | ||
89 | 91 | ||
143 | 145 | ||
144 | 146 | let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked") | |
145 | 147 | ||
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) | |
147 | 151 | ||
148 | 152 | let firstOrder = getStringByKey(FirstOrderKey) | |
149 | 153 | ||
189 | 193 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
190 | 194 | else if (isDefined(pmt.assetId)) | |
191 | 195 | then throw("can use waves only") | |
192 | - | else if (( | |
196 | + | else if ((minWavesAmountNsbtBuy > pmtAmount)) | |
193 | 197 | then throw((("min " + toString(minWavesAmountNsbtBuy)) + " waves expected")) | |
194 | 198 | else { | |
195 | 199 | let ownerAddress = i.caller | |
234 | 238 | let pmtAmount = pmt.amount | |
235 | 239 | if ((pmt.assetId != nsbtAssetId)) | |
236 | 240 | 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 | + | } | |
256 | 262 | } | |
257 | 263 | ||
258 | 264 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func getBoolByAddressAndKey (address,key) = valueOrElse(getBoolean(address, key), false) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func getStringByAddressAndKey (address,key) = valueOrElse(getString(address, key), "") | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func getNumberByAddressAndKey (address,key) = valueOrElse(getInteger(address, key), 0) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func asAnyList (val) = match val { | |
20 | 20 | case valAnyLyst: List[Any] => | |
21 | 21 | valAnyLyst | |
22 | 22 | case _ => | |
23 | 23 | throw("fail to cast into List[Any]") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func asString (val) = match val { | |
28 | 28 | case valStr: String => | |
29 | 29 | valStr | |
30 | 30 | case _ => | |
31 | 31 | throw("fail to cast into String") | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func asInt (val) = match val { | |
36 | 36 | case valInt: Int => | |
37 | 37 | valInt | |
38 | 38 | case _ => | |
39 | 39 | throw("fail to cast into Int") | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | let WAVELET = 100000000 | |
44 | 44 | ||
45 | 45 | let PAULI = 1000000 | |
46 | 46 | ||
47 | 47 | let BIGPAULI = toBigInt(1000000) | |
48 | 48 | ||
49 | 49 | let PRICELET = 1000000 | |
50 | 50 | ||
51 | 51 | let MULT = 100000000 | |
52 | 52 | ||
53 | 53 | let BIGMULT16 = toBigInt(10000000000000000) | |
54 | 54 | ||
55 | 55 | let SCALE8 = 8 | |
56 | 56 | ||
57 | 57 | let SCALE16 = 16 | |
58 | 58 | ||
59 | 59 | let MINORDERTOTAL = (10 * WAVELET) | |
60 | 60 | ||
61 | 61 | let MAXROI = 95 | |
62 | 62 | ||
63 | 63 | let CANCELED = "canceled" | |
64 | 64 | ||
65 | 65 | let NEW = "new" | |
66 | 66 | ||
67 | 67 | let FILLED = "filled" | |
68 | 68 | ||
69 | 69 | let PriceKey = "price" | |
70 | 70 | ||
71 | 71 | let NsbtAssetIdKey = "bond_asset_id" | |
72 | 72 | ||
73 | 73 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
74 | 74 | ||
75 | 75 | let BalanceLockedkKey = "balance_lock_" | |
76 | 76 | ||
77 | 77 | let WavesLockedBalanceKey = (BalanceLockedkKey + "waves") | |
78 | 78 | ||
79 | 79 | let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino") | |
80 | 80 | ||
81 | 81 | let FirstOrderKey = "order_first" | |
82 | 82 | ||
83 | 83 | let MathContractKey = "math_contract" | |
84 | 84 | ||
85 | 85 | let MinWavesForNsbtBuyKey = "min_waves_nsbt_buy" | |
86 | 86 | ||
87 | + | let MinNsbtSellKey = "min_nsbt_sell" | |
88 | + | ||
87 | 89 | func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId) | |
88 | 90 | ||
89 | 91 | ||
90 | 92 | func getOrderPriceKey (orderId) = ("order_price_" + orderId) | |
91 | 93 | ||
92 | 94 | ||
93 | 95 | func getOrderTotalKey (orderId) = ("order_total_" + orderId) | |
94 | 96 | ||
95 | 97 | ||
96 | 98 | func getOrderOwnerKey (orderId) = ("order_owner_" + orderId) | |
97 | 99 | ||
98 | 100 | ||
99 | 101 | func getOrderHeightKey (orderId) = ("order_height_" + orderId) | |
100 | 102 | ||
101 | 103 | ||
102 | 104 | func getOrderStatusKey (orderId) = ("order_status_" + orderId) | |
103 | 105 | ||
104 | 106 | ||
105 | 107 | func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId) | |
106 | 108 | ||
107 | 109 | ||
108 | 110 | func getPrevOrderKey (orderId) = ("order_prev_" + orderId) | |
109 | 111 | ||
110 | 112 | ||
111 | 113 | func getNextOrderKey (orderId) = ("order_next_" + orderId) | |
112 | 114 | ||
113 | 115 | ||
114 | 116 | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI) | |
115 | 117 | ||
116 | 118 | ||
117 | 119 | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET) | |
118 | 120 | ||
119 | 121 | ||
120 | 122 | func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price) | |
121 | 123 | ||
122 | 124 | ||
123 | 125 | func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price) | |
124 | 126 | ||
125 | 127 | ||
126 | 128 | func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult)) | |
127 | 129 | ||
128 | 130 | ||
129 | 131 | func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16)) | |
130 | 132 | ||
131 | 133 | ||
132 | 134 | let neutrinoContract = Address(base58'3N9be2mwrA52WJho6DiesZkk4351GvpnWuj') | |
133 | 135 | ||
134 | 136 | let controlContract = Address(base58'3MrwvfA9VRYwhHy4NuWPQGdxCtZdhH4LMMa') | |
135 | 137 | ||
136 | 138 | let liquidationContract = Address(base58'3N24ZPUAMhFm76N3vbNiiDtFqfUnmBHTc5N') | |
137 | 139 | ||
138 | 140 | let mathContract = addressFromStringValue(getStringByKey(MathContractKey)) | |
139 | 141 | ||
140 | 142 | let neutrinoAssetId = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
141 | 143 | ||
142 | 144 | let nsbtAssetId = base58'F3iaxzruFeKujfVfYSZEkejpjh67wmRfPCRHiNmWKp3Z' | |
143 | 145 | ||
144 | 146 | let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked") | |
145 | 147 | ||
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) | |
147 | 151 | ||
148 | 152 | let firstOrder = getStringByKey(FirstOrderKey) | |
149 | 153 | ||
150 | 154 | func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id)) | |
151 | 155 | ||
152 | 156 | ||
153 | 157 | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
154 | 158 | ||
155 | 159 | ||
156 | 160 | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
157 | 161 | ||
158 | 162 | ||
159 | 163 | func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id)) | |
160 | 164 | ||
161 | 165 | ||
162 | 166 | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
163 | 167 | ||
164 | 168 | ||
165 | 169 | func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id)) | |
166 | 170 | ||
167 | 171 | ||
168 | 172 | func getNextOrder (id) = getStringByKey(getNextOrderKey(id)) | |
169 | 173 | ||
170 | 174 | ||
171 | 175 | func getReversePrice (price) = ((PRICELET * PRICELET) / price) | |
172 | 176 | ||
173 | 177 | ||
174 | 178 | func calcNsbt2WavesPriceRaw (spentWavesRaw,receivedNsbtRaw) = fraction(spentWavesRaw, (PAULI * PRICELET), receivedNsbtRaw) | |
175 | 179 | ||
176 | 180 | ||
177 | 181 | 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)] | |
178 | 182 | ||
179 | 183 | ||
180 | 184 | 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]))) + "]") | |
181 | 185 | ||
182 | 186 | ||
183 | 187 | @Callable(i) | |
184 | 188 | func buyNsbt () = { | |
185 | 189 | let pmt = value(i.payments[0]) | |
186 | 190 | let pmtAmount = pmt.amount | |
187 | 191 | let wavesPay = pmtAmount | |
188 | 192 | if (isBlocked) | |
189 | 193 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
190 | 194 | else if (isDefined(pmt.assetId)) | |
191 | 195 | then throw("can use waves only") | |
192 | - | else if (( | |
196 | + | else if ((minWavesAmountNsbtBuy > pmtAmount)) | |
193 | 197 | then throw((("min " + toString(minWavesAmountNsbtBuy)) + " waves expected")) | |
194 | 198 | else { | |
195 | 199 | let ownerAddress = i.caller | |
196 | 200 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil)) | |
197 | 201 | if ((neutrinoMetrics == neutrinoMetrics)) | |
198 | 202 | then { | |
199 | 203 | let currentPrice = asInt(neutrinoMetrics[0]) | |
200 | 204 | let reserve = asInt(neutrinoMetrics[3]) | |
201 | 205 | let neutrinoSupply = asInt(neutrinoMetrics[5]) | |
202 | 206 | let nsbtSupply = asInt(neutrinoMetrics[9]) | |
203 | 207 | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
204 | 208 | let curveResult = asAnyList(invoke(mathContract, "curveFunctionMATH", [reserve, neutrinoSupply, currentPrice, nsbtSupplyMAX, nsbtSupply, wavesPay], nil)) | |
205 | 209 | if ((curveResult == curveResult)) | |
206 | 210 | then { | |
207 | 211 | let nsbtAmount = asInt(curveResult[0]) | |
208 | 212 | if ((0 >= nsbtAmount)) | |
209 | 213 | then throw("nsbtAmount <= 0") | |
210 | 214 | else if ((wavesPay > (nsbtAmount * 9223372))) | |
211 | 215 | then throw(((("Nsbt2Waves price exceeds MAX_INT: " + toString(wavesPay)) + "/") + toString(nsbtAmount))) | |
212 | 216 | else { | |
213 | 217 | let nsbt2WavesPriceRaw = calcNsbt2WavesPriceRaw(wavesPay, nsbtAmount) | |
214 | 218 | let roi = 0 | |
215 | 219 | let amountLeased = invoke(neutrinoContract, "acceptWaves", nil, i.payments) | |
216 | 220 | if ((amountLeased == amountLeased)) | |
217 | 221 | 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) | |
218 | 222 | else throw("Strict value is not equal to itself.") | |
219 | 223 | } | |
220 | 224 | } | |
221 | 225 | else throw("Strict value is not equal to itself.") | |
222 | 226 | } | |
223 | 227 | else throw("Strict value is not equal to itself.") | |
224 | 228 | } | |
225 | 229 | } | |
226 | 230 | ||
227 | 231 | ||
228 | 232 | ||
229 | 233 | @Callable(i) | |
230 | 234 | func sellNsbt () = if (isBlocked) | |
231 | 235 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
232 | 236 | else { | |
233 | 237 | let pmt = value(i.payments[0]) | |
234 | 238 | let pmtAmount = pmt.amount | |
235 | 239 | if ((pmt.assetId != nsbtAssetId)) | |
236 | 240 | 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 | + | } | |
256 | 262 | } | |
257 | 263 | ||
258 | 264 | ||
259 | 265 | ||
260 | 266 | @Callable(i) | |
261 | 267 | func cancelOrder (orderId) = { | |
262 | 268 | let owner = getOrderOwner(orderId) | |
263 | 269 | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
264 | 270 | let caller = toString(i.caller) | |
265 | 271 | let nextOrder = getNextOrder(orderId) | |
266 | 272 | let prevOrder = getPrevOrder(orderId) | |
267 | 273 | if ((getOrderStatus(orderId) != NEW)) | |
268 | 274 | then throw("invalid order status") | |
269 | 275 | else [StringEntry(FirstOrderKey, if ((firstOrder == orderId)) | |
270 | 276 | then nextOrder | |
271 | 277 | else firstOrder), StringEntry(getNextOrderKey(prevOrder), nextOrder), StringEntry(getPrevOrderKey(nextOrder), prevOrder), StringEntry(getOrderStatusKey(orderId), CANCELED), ScriptTransfer(i.caller, amount, unit)] | |
272 | 278 | } | |
273 | 279 | ||
274 | 280 | ||
275 | 281 | @Verifier(tx) | |
276 | 282 | func verify () = { | |
277 | 283 | let pubKeyAdminsList = ["ExtEEK19nmKj9mCpnWyvEEJFYATLMcVEMvohhUHkyHNm", "Ev5py5FfBQX9cZpYKnfQrTB49Byf8QmpZWeDVRim4yV7", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"] | |
278 | 284 | let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0]))) | |
279 | 285 | then 1 | |
280 | 286 | else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1]))) | |
281 | 287 | then 1 | |
282 | 288 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2]))) | |
283 | 289 | then 1 | |
284 | 290 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3]))) | |
285 | 291 | then 2 | |
286 | 292 | else 0)) | |
287 | 293 | (count >= 3) | |
288 | 294 | } | |
289 | 295 |
github/deemru/w8io/026f985 56.62 ms ◑