tx · 8oTC6roBS3qrXv1qcmDGng34u5vzakvAMty4XZWqQrSt

3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi:  -0.01400000 Waves

2022.03.03 22:28 [1948215] smart account 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi > SELF 0.00000000 Waves

{ "type": 13, "id": "8oTC6roBS3qrXv1qcmDGng34u5vzakvAMty4XZWqQrSt", "fee": 1400000, "feeAssetId": null, "timestamp": 1646335681616, "version": 1, "sender": "3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi", "senderPublicKey": "4qGVXRFATZNzo2RZZ5UYHXojGyJgSRBwtgJcCU8rJe5A", "proofs": [ "3x3QkatcxrGiCCTmjAQHRtmGevpB36996mHHV52aBR9T8matibPdKhWnbSG8vHSZksDQ7QqryGs8Xb653ghDdKXD" ], "script": "base64:AAIFAAAAAAAAAD0IAhIFCgMICAESAwoBARIHCgUBAQEBARIICgYBAQEBAQESABIDCgEBEgMKAQgSABIECgIBARIGCgQBAQEBAAAAOgAAAAAHV0FWRUxFVAAAAAAABfXhAAAAAAAFUEFVTEkAAAAAAAAPQkAAAAAACEJJR1BBVUxJCQABNgAAAAEAAAAAAAAPQkAAAAAACFBSSUNFTEVUAAAAAAAAD0JAAAAAAARNVUxUAAAAAAAF9eEAAAAAAAlCSUdNVUxUMTYJAAE2AAAAAQAAI4byb8EAAAAAAAAJTVVMVFNDQUxFAAAAAAAAAAAIAAAAAAdTQ0FMRTE2AAAAAAAAAAAQAAAAAANTRVACAAAAAl9fAAAAAAVIQUxGOAAAAAAAAvrwgAAAAAALRVVMRVJOVU1CRVIJAAE2AAAAAQAAYJKhE9jVdAAAAAAGc2NhbGU2AAAAAAAAD0JAAAAAAAxzY2FsZTZCaWdJbnQJAAE2AAAAAQAAAAAAAA9CQAAAAAAMc2NhbGU4QmlnSW50CQABNgAAAAEAAAAAAAX14QABAAAAEmtleU5ldXRyaW5vQWRkcmVzcwAAAAACAAAAHSVzJXNfX2NvbmZpZ19fbm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AhoYWxmTGlmZQkBAAAADGdldEludE9yRmFpbAAAAAIFAAAAE25zYnRTdGFraW5nQ29udHJhY3QJAQAAAAtrZXlIYWxmTGlmZQAAAAAEAAAAAXcJAABrAAAAAwUAAAAHYW1vdW50MgkAAGwAAAAGAAAAAAAAAAACAAAAAAAAAAAACQAAawAAAAMJAABlAAAAAgUAAAAHaGVpZ2h0MgUAAAAHaGVpZ2h0MQUAAAAETVVMVAUAAAAIaGFsZkxpZmUAAAAAAAAAAAgAAAAAAAAAAAgFAAAABkhBTEZVUAUAAAAETVVMVAQAAAABdgkAAGsAAAADCQAAZAAAAAIFAAAAB2Ftb3VudDEFAAAAB2Ftb3VudDIFAAAABE1VTFQJAABkAAAAAgUAAAAHYW1vdW50MQUAAAABdwkABRQAAAACBQAAAANuaWwJAABkAAAAAgUAAAAHaGVpZ2h0MQkAAGkAAAACCQAAZQAAAAIFAAAABUhBTEY4CQAAaAAAAAIFAAAACGhhbGZMaWZlCQAAbQAAAAYFAAAAAXYAAAAAAAAAAAgAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAgFAAAABkhBTEZVUAUAAAAETVVMVAAAAAC45Koj", "chainId": 84, "height": 1948215, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9Ca8GfrDNAwKi7BMFT6XmCM11KzQqgXr3CY7ZVksX5R9 Next: 7TVQfj8ojaYSeqXN5ezyjW3JNk6SfPuoLyo6j1n7yutg Diff:
OldNewDifferences
101101 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
102102
103103
104+func getNumberByKey (address,key) = valueOrElse(getInteger(address, key), 0)
105+
106+
104107 func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
105108
106109
160163
161164 let nsbtAssetId = fromBase58String(nsbtAssetIdStr)
162165
166+func calcContractNsbtPriceInternal (nsbtSupplyOverride) = {
167+ let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
168+ let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsMATH", nil, nil))
169+ if ((neutrinoMetrics == neutrinoMetrics))
170+ then {
171+ let nsbtSupply = if ((nsbtSupplyOverride == unit))
172+ then asInt(neutrinoMetrics[9])
173+ else value(nsbtSupplyOverride)
174+ let currentPrice = asInt(neutrinoMetrics[0])
175+ let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
176+ if ((kCalcArray == kCalcArray))
177+ then {
178+ let multK = parseBigIntValue(asString(kCalcArray[6]))
179+ let mK = fromX16(multK, MULT)
180+ let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply))
181+ let multStep2 = fraction(multStep1, multStep1, MULT)
182+ let multNsbt2usdnPrice = fraction(mK, multStep2, MULT)
183+ let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
184+ let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
185+ $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
186+ }
187+ else throw("Strict value is not equal to itself.")
188+ }
189+ else throw("Strict value is not equal to itself.")
190+ }
191+
192+
163193 @Callable(i)
164194 func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this))
165195 then throw("not authorized")
211241 let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
212242 let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
213243 let nsbtAmountRaw = ((mRaw - sRaw) - step3)
214- $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[0]), asInt(kCalcArray[1]), asInt(kCalcArray[2]), asInt(price), asInt(kCalcArray[3]), asInt(kCalcArray[4]), kCalcArray[5], kCalcArray[6], toString(step1), toString(step2), toString(step3)])
244+ $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[0]), asInt(kCalcArray[1]), asInt(kCalcArray[2]), price, asInt(kCalcArray[3]), asInt(kCalcArray[4]), kCalcArray[5], kCalcArray[6], toString(step1), toString(step2), step3])
215245 }
216246 else throw("Strict value is not equal to itself.")
217247 }
219249
220250
221251 @Callable(i)
222-func calcContractNsbtPriceMATH () = {
223- let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
224- let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsMATH", nil, nil))
225- if ((neutrinoMetrics == neutrinoMetrics))
252+func calcContractNsbtPriceMATH () = calcContractNsbtPriceInternal(unit)
253+
254+
255+
256+@Callable(i)
257+func calcContractNsbtPriceBySupplyMATH (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply)
258+
259+
260+
261+@Callable(i)
262+func calcUserSwapLimitsMATH (userAddressStr) = {
263+ let currentPrice = getIntegerValue(controlContract, keyPrice())
264+ let userGNsbtAmount = valueOrElse(getInteger(nsbtStakingContract, keyLockParamUserAmount(userAddressStr)), 0)
265+ let usdnLmtMax = asInt(invoke(this, "calcSwapLimitMATH", [userGNsbtAmount], nil))
266+ if ((usdnLmtMax == usdnLmtMax))
226267 then {
227- let nsbtSupply = asInt(neutrinoMetrics[9])
228- let currentPrice = asInt(neutrinoMetrics[0])
229- let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
230- if ((kCalcArray == kCalcArray))
231- then {
232- let multK = parseBigIntValue(asString(kCalcArray[6]))
233- let mK = fromX16(multK, MULT)
234- let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply))
235- let multStep2 = fraction(multStep1, multStep1, MULT)
236- let multNsbt2usdnPrice = fraction(mK, multStep2, MULT)
237- let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
238- let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
239- $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
240- }
241- else throw("Strict value is not equal to itself.")
268+ let quickSwapResetBlocks = getNumberByKey(neutrinoContract, keyQuickSwapLimitDuration())
269+ let lastQuickSwapBlock = valueOrElse(getInteger(neutrinoContract, keyUserLastQuickSwapHeight(userAddressStr)), 0)
270+ let isNewQuickSwapPeriod = ((height - lastQuickSwapBlock) > quickSwapResetBlocks)
271+ let quickSwapUserSpent = if (isNewQuickSwapPeriod)
272+ then 0
273+ else valueOrElse(getInteger(neutrinoContract, keyQuickSwapUserSpentInPeriod(userAddressStr)), 0)
274+ let blcks2LmtReset = if (isNewQuickSwapPeriod)
275+ then 0
276+ else (quickSwapResetBlocks - (height - lastQuickSwapBlock))
277+ let wavesLmtMax = convertNeutrinoToWaves(usdnLmtMax, currentPrice)
278+ $Tuple2(nil, [usdnLmtMax, quickSwapUserSpent, blcks2LmtReset, wavesLmtMax])
242279 }
243280 else throw("Strict value is not equal to itself.")
244281 }
255292 let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(addressFromStringValue(liquidationContract), neutrinoAssetId))
256293 let surplus = (reservesInUsdn - neutrinoSupply)
257294 let deficit = (neutrinoSupply - reservesInUsdn)
258- let surplusPercent = (fraction(surplus, PAULI, neutrinoSupply) * 100)
259- let BR = fraction(reservesInUsdn, PAULI, neutrinoSupply)
295+ let surplusPercent = if ((neutrinoSupply == 0))
296+ then 0
297+ else (fraction(surplus, PAULI, neutrinoSupply) * 100)
298+ let BR = if ((neutrinoSupply == 0))
299+ then 0
300+ else fraction(reservesInUsdn, PAULI, neutrinoSupply)
260301 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
261302 let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId))
262303 $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX])
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let WAVELET = 100000000
55
66 let PAULI = 1000000
77
88 let BIGPAULI = toBigInt(1000000)
99
1010 let PRICELET = 1000000
1111
1212 let MULT = 100000000
1313
1414 let BIGMULT16 = toBigInt(10000000000000000)
1515
1616 let MULTSCALE = 8
1717
1818 let SCALE16 = 16
1919
2020 let SEP = "__"
2121
2222 let HALF8 = 50000000
2323
2424 let EULERNUMBER = toBigInt(27182818284590452)
2525
2626 let scale6 = 1000000
2727
2828 let scale6BigInt = toBigInt(1000000)
2929
3030 let scale8BigInt = toBigInt(100000000)
3131
3232 func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress"
3333
3434
3535 func keySwapAmountAParam () = "%s%s__config__swapAParam"
3636
3737
3838 func keyNeutrinoAssetId () = "neutrino_asset_id"
3939
4040
4141 func keyLiquidationContractAddress () = "liquidation_contract"
4242
4343
4444 func keyRPDContract () = "rpd_contract"
4545
4646
4747 func keyAuctionContract () = "auction_contract"
4848
4949
5050 func keyContolContract () = "control_contract"
5151
5252
5353 func keyBondAssetId () = "bond_asset_id"
5454
5555
5656 func keyBalanceLocked () = "balance_lock_"
5757
5858
5959 func keyWavesLockedBalance () = (keyBalanceLocked() + "waves")
6060
6161
6262 func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino")
6363
6464
6565 func keyMinWavesSwapAmount () = "min_waves_swap_amount"
6666
6767
6868 func keyMinNeutrinoSwapAmount () = "min_neutrino_swap_amount"
6969
7070
7171 func keyWavesOutFeePart () = "wavesOut_swap_feePart"
7272
7373
7474 func keyNeutrinoOutFeePart () = "neutrinoOut_swap_feePart"
7575
7676
7777 func keyNsbtLockContract () = "%s__nsbtLockContract"
7878
7979
8080 func keyQuickSwapLimitDuration () = "%s__quickSwapLimitDuration"
8181
8282
8383 func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP)
8484
8585
8686 func keyQuickSwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "quickSwapUserSpentInPeriod", userAddress], SEP)
8787
8888
8989 func keyPrice () = "price"
9090
9191
9292 func keyHalfLife () = "%s__halfLife"
9393
9494
9595 func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "amount"], SEP)
9696
9797
9898 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
9999
100100
101101 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
102102
103103
104+func getNumberByKey (address,key) = valueOrElse(getInteger(address, key), 0)
105+
106+
104107 func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
105108
106109
107110 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI)
108111
109112
110113 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET)
111114
112115
113116 func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult))
114117
115118
116119 func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16))
117120
118121
119122 func asAnyList (val) = match val {
120123 case valAnyLyst: List[Any] =>
121124 valAnyLyst
122125 case _ =>
123126 throw("fail to cast into List[Any]")
124127 }
125128
126129
127130 func asInt (val) = match val {
128131 case valInt: Int =>
129132 valInt
130133 case _ =>
131134 throw("fail to cast into Int")
132135 }
133136
134137
135138 func asString (val) = match val {
136139 case valStr: String =>
137140 valStr
138141 case _ =>
139142 throw("fail to cast into String")
140143 }
141144
142145
143146 let neutrinoContract = addressFromStringValue(getStringOrFail(this, keyNeutrinoAddress()))
144147
145148 let controlContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyContolContract()))
146149
147150 let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract()))
148151
149152 let liquidationContract = getStringOrFail(neutrinoContract, keyLiquidationContractAddress())
150153
151154 let rpdContract = getStringOrFail(neutrinoContract, keyRPDContract())
152155
153156 let nsbtStakingContract = addressFromStringValue(getStringOrFail(this, keyNsbtLockContract()))
154157
155158 let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId())
156159
157160 let neutrinoAssetId = fromBase58String(neutrinoAssetIdString)
158161
159162 let nsbtAssetIdStr = getStringValue(neutrinoContract, keyBondAssetId())
160163
161164 let nsbtAssetId = fromBase58String(nsbtAssetIdStr)
162165
166+func calcContractNsbtPriceInternal (nsbtSupplyOverride) = {
167+ let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
168+ let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsMATH", nil, nil))
169+ if ((neutrinoMetrics == neutrinoMetrics))
170+ then {
171+ let nsbtSupply = if ((nsbtSupplyOverride == unit))
172+ then asInt(neutrinoMetrics[9])
173+ else value(nsbtSupplyOverride)
174+ let currentPrice = asInt(neutrinoMetrics[0])
175+ let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
176+ if ((kCalcArray == kCalcArray))
177+ then {
178+ let multK = parseBigIntValue(asString(kCalcArray[6]))
179+ let mK = fromX16(multK, MULT)
180+ let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply))
181+ let multStep2 = fraction(multStep1, multStep1, MULT)
182+ let multNsbt2usdnPrice = fraction(mK, multStep2, MULT)
183+ let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
184+ let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
185+ $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
186+ }
187+ else throw("Strict value is not equal to itself.")
188+ }
189+ else throw("Strict value is not equal to itself.")
190+ }
191+
192+
163193 @Callable(i)
164194 func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this))
165195 then throw("not authorized")
166196 else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), StringEntry(keyNsbtLockContract(), nsbtLockAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)]
167197
168198
169199
170200 @Callable(i)
171201 func calcSwapLimitMATH (gNsbtAmount) = {
172202 let limitParamA = toBigInt(3)
173203 let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6)
174204 let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING)
175205 let limit = fraction(limitParamA, limitPowPart, scale8BigInt)
176206 $Tuple2(nil, toInt(limit))
177207 }
178208
179209
180210
181211 @Callable(i)
182212 func calculateKMATH (wRaw,uRaw,price,mRaw,sRaw) = {
183213 let EXP = toBigInt(2718281)
184214 let EXPSCALE = 6
185215 let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3)
186216 let paulB = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_b"), ((3 * PAULI) / 10))
187217 let wReservesInUsdn = convertWavesToNeutrino(wRaw, price)
188218 let multBR = fraction(wReservesInUsdn, MULT, uRaw)
189219 if ((multBR > 10678564816))
190220 then throw("BR > 10678.564816% will overflow exponent")
191221 else {
192222 let multPower = (a * (multBR - MULT))
193223 let multExpInPower = pow(EXP, EXPSCALE, toBigInt(multPower), MULTSCALE, SCALE16, DOWN)
194224 let multK = fraction(toBigInt(paulB), multExpInPower, BIGPAULI)
195225 $Tuple2(nil, [a, paulB, wReservesInUsdn, multBR, multPower, toString(multExpInPower), toString(multK)])
196226 }
197227 }
198228
199229
200230
201231 @Callable(i)
202232 func curveFunctionMATH (wRaw,uRaw,price,mRaw,sRaw,wavesPayRaw) = {
203233 let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [wRaw, uRaw, price, mRaw, sRaw], nil))
204234 if ((kCalcArray == kCalcArray))
205235 then {
206236 let multK = parseBigIntValue(asString(kCalcArray[6]))
207237 let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
208238 let bigMaxNsbtSupply = toBigInt(mRaw)
209239 let bigNsbtSupply = toBigInt((mRaw - sRaw))
210240 let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK)
211241 let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
212242 let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
213243 let nsbtAmountRaw = ((mRaw - sRaw) - step3)
214- $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[0]), asInt(kCalcArray[1]), asInt(kCalcArray[2]), asInt(price), asInt(kCalcArray[3]), asInt(kCalcArray[4]), kCalcArray[5], kCalcArray[6], toString(step1), toString(step2), toString(step3)])
244+ $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[0]), asInt(kCalcArray[1]), asInt(kCalcArray[2]), price, asInt(kCalcArray[3]), asInt(kCalcArray[4]), kCalcArray[5], kCalcArray[6], toString(step1), toString(step2), step3])
215245 }
216246 else throw("Strict value is not equal to itself.")
217247 }
218248
219249
220250
221251 @Callable(i)
222-func calcContractNsbtPriceMATH () = {
223- let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
224- let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsMATH", nil, nil))
225- if ((neutrinoMetrics == neutrinoMetrics))
252+func calcContractNsbtPriceMATH () = calcContractNsbtPriceInternal(unit)
253+
254+
255+
256+@Callable(i)
257+func calcContractNsbtPriceBySupplyMATH (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply)
258+
259+
260+
261+@Callable(i)
262+func calcUserSwapLimitsMATH (userAddressStr) = {
263+ let currentPrice = getIntegerValue(controlContract, keyPrice())
264+ let userGNsbtAmount = valueOrElse(getInteger(nsbtStakingContract, keyLockParamUserAmount(userAddressStr)), 0)
265+ let usdnLmtMax = asInt(invoke(this, "calcSwapLimitMATH", [userGNsbtAmount], nil))
266+ if ((usdnLmtMax == usdnLmtMax))
226267 then {
227- let nsbtSupply = asInt(neutrinoMetrics[9])
228- let currentPrice = asInt(neutrinoMetrics[0])
229- let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
230- if ((kCalcArray == kCalcArray))
231- then {
232- let multK = parseBigIntValue(asString(kCalcArray[6]))
233- let mK = fromX16(multK, MULT)
234- let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply))
235- let multStep2 = fraction(multStep1, multStep1, MULT)
236- let multNsbt2usdnPrice = fraction(mK, multStep2, MULT)
237- let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
238- let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
239- $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
240- }
241- else throw("Strict value is not equal to itself.")
268+ let quickSwapResetBlocks = getNumberByKey(neutrinoContract, keyQuickSwapLimitDuration())
269+ let lastQuickSwapBlock = valueOrElse(getInteger(neutrinoContract, keyUserLastQuickSwapHeight(userAddressStr)), 0)
270+ let isNewQuickSwapPeriod = ((height - lastQuickSwapBlock) > quickSwapResetBlocks)
271+ let quickSwapUserSpent = if (isNewQuickSwapPeriod)
272+ then 0
273+ else valueOrElse(getInteger(neutrinoContract, keyQuickSwapUserSpentInPeriod(userAddressStr)), 0)
274+ let blcks2LmtReset = if (isNewQuickSwapPeriod)
275+ then 0
276+ else (quickSwapResetBlocks - (height - lastQuickSwapBlock))
277+ let wavesLmtMax = convertNeutrinoToWaves(usdnLmtMax, currentPrice)
278+ $Tuple2(nil, [usdnLmtMax, quickSwapUserSpent, blcks2LmtReset, wavesLmtMax])
242279 }
243280 else throw("Strict value is not equal to itself.")
244281 }
245282
246283
247284
248285 @Callable(i)
249286 func calcNeutinoMetricsMATH () = {
250287 let currentPrice = getIntegerValue(controlContract, keyPrice())
251288 let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0)
252289 let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0)
253290 let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance)
254291 let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice)
255292 let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(addressFromStringValue(liquidationContract), neutrinoAssetId))
256293 let surplus = (reservesInUsdn - neutrinoSupply)
257294 let deficit = (neutrinoSupply - reservesInUsdn)
258- let surplusPercent = (fraction(surplus, PAULI, neutrinoSupply) * 100)
259- let BR = fraction(reservesInUsdn, PAULI, neutrinoSupply)
295+ let surplusPercent = if ((neutrinoSupply == 0))
296+ then 0
297+ else (fraction(surplus, PAULI, neutrinoSupply) * 100)
298+ let BR = if ((neutrinoSupply == 0))
299+ then 0
300+ else fraction(reservesInUsdn, PAULI, neutrinoSupply)
260301 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
261302 let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId))
262303 $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX])
263304 }
264305
265306
266307
267308 @Callable(i)
268309 func getUnstakeComissionAmountMATH (amount,startHeight) = {
269310 let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife())
270311 $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT))
271312 }
272313
273314
274315
275316 @Callable(i)
276317 func mergeStakesMATH (amount1,height1,amount2,height2) = {
277318 let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife())
278319 let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT)
279320 let v = fraction((amount1 + amount2), MULT, (amount1 + w))
280321 $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT)))
281322 }
282323
283324

github/deemru/w8io/026f985 
46.30 ms