tx · 7TVQfj8ojaYSeqXN5ezyjW3JNk6SfPuoLyo6j1n7yutg

3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi:  -0.01400000 Waves

2022.03.16 11:34 [1966289] smart account 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi > SELF 0.00000000 Waves

{ "type": 13, "id": "7TVQfj8ojaYSeqXN5ezyjW3JNk6SfPuoLyo6j1n7yutg", "fee": 1400000, "feeAssetId": null, "timestamp": 1647419751045, "version": 1, "sender": "3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi", "senderPublicKey": "4qGVXRFATZNzo2RZZ5UYHXojGyJgSRBwtgJcCU8rJe5A", "proofs": [ "4V6DzFEAXUcuiKPaHJsby94ZhR9zfbjksn12HuDtu3G3n5ZUjEVG2R9AkpAQAsCqtMKDxrWrdbSAzW66qAmDmzYQ" ], "script": "base64:AAIFAAAAAAAAADUIAhIFCgMICAESAwoBARIHCgUBAQEBARIDCgEBEgASAwoBARIAEgUKAwEBARIHCgUBAQEBAQAAAC8AAAAAB1dBVkVMRVQAAAAAAAX14QAAAAAABVBBVUxJAAAAAAAAD0JAAAAAAAhCSUdQQVVMSQkAATYAAAABAAAAAAAAD0JAAAAAAAhQUklDRUxFVAAAAAAAAA9CQAAAAAAETVVMVAAAAAAABfXhAAAAAAAJQklHTVVMVDE2CQABNgAAAAEAACOG8m/BAAAAAAAACU1VTFRTQ0FMRQAAAAAAAAAACAAAAAAHU0NBTEUxNgAAAAAAAAAAEAAAAAADU0VQAgAAAAJfXwAAAAAFSEFMRjgAAAAAAAL68IAAAAAAC0VVTEVSTlVNQkVSCQABNgAAAAEAAGCSoRPY1XQAAAAABnNjYWxlNgAAAAAAAA9CQAAAAAAMc2NhbGU2QmlnSW50CQABNgAAAAEAAAAAAAAPQkAAAAAADHNjYWxlOEJpZ0ludAkAATYAAAABAAAAAAAF9eEAAAAAAA1zY2FsZTEwQmlnSW50CQABNgAAAAEAAAAAAlQL5AABAAAAEmtleU5ldXRya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kAAGsAAAADCQAAZQAAAAIFAAAAB2hlaWdodDIFAAAAB2hlaWdodDEFAAAABE1VTFQFAAAACGhhbGZMaWZlAAAAAAAAAAAIAAAAAAAAAAAIBQAAAAZIQUxGVVAFAAAABE1VTFQEAAAAAXYJAABrAAAAAwkAAGQAAAACBQAAAAdhbW91bnQxBQAAAAdhbW91bnQyBQAAAARNVUxUCQAAZAAAAAIFAAAAB2Ftb3VudDEFAAAAAXcJAAUUAAAAAgUAAAADbmlsCQAAZAAAAAIFAAAAB2hlaWdodDEJAABpAAAAAgkAAGUAAAACBQAAAAVIQUxGOAkAAGgAAAACBQAAAAhoYWxmTGlmZQkAAG0AAAAGBQAAAAF2AAAAAAAAAAAIAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAIBQAAAAZIQUxGVVAFAAAABE1VTFQAAAAAeQmg5w==", "chainId": 84, "height": 1966289, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8oTC6roBS3qrXv1qcmDGng34u5vzakvAMty4XZWqQrSt Next: EeMUW2dwaLTbNFfHdhtpuQJeDjY3VW9mSTgZfk74L5gJ Diff:
OldNewDifferences
2929
3030 let scale8BigInt = toBigInt(100000000)
3131
32+let scale10BigInt = toBigInt(10000000000)
33+
3234 func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress"
3335
3436
3941
4042
4143 func keyLiquidationContractAddress () = "liquidation_contract"
42-
43-
44-func keyRPDContract () = "rpd_contract"
4544
4645
4746 func keyAuctionContract () = "auction_contract"
6261 func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino")
6362
6463
65-func keyMinWavesSwapAmount () = "min_waves_swap_amount"
66-
67-
68-func keyMinNeutrinoSwapAmount () = "min_neutrino_swap_amount"
69-
70-
71-func keyWavesOutFeePart () = "wavesOut_swap_feePart"
72-
73-
74-func keyNeutrinoOutFeePart () = "neutrinoOut_swap_feePart"
75-
76-
77-func keyNsbtLockContract () = "%s__nsbtLockContract"
78-
79-
80-func keyQuickSwapLimitDuration () = "%s__quickSwapLimitDuration"
64+func swapsTimeframeKEY () = "swaps_timeframe"
8165
8266
8367 func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP)
8771
8872
8973 func keyPrice () = "price"
90-
91-
92-func keyHalfLife () = "%s__halfLife"
93-
94-
95-func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "amount"], SEP)
9674
9775
9876 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
149127
150128 let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract()))
151129
152-let liquidationContract = getStringOrFail(neutrinoContract, keyLiquidationContractAddress())
130+let liquidationContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyLiquidationContractAddress()))
153131
154-let rpdContract = getStringOrFail(neutrinoContract, keyRPDContract())
132+let neutrinoAssetId = fromBase58String(getStringOrFail(neutrinoContract, keyNeutrinoAssetId()))
155133
156-let nsbtStakingContract = addressFromStringValue(getStringOrFail(this, keyNsbtLockContract()))
157-
158-let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId())
159-
160-let neutrinoAssetId = fromBase58String(neutrinoAssetIdString)
161-
162-let nsbtAssetIdStr = getStringValue(neutrinoContract, keyBondAssetId())
163-
164-let nsbtAssetId = fromBase58String(nsbtAssetIdStr)
134+let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId()))
165135
166136 func calcContractNsbtPriceInternal (nsbtSupplyOverride) = {
167137 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
168- let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsMATH", nil, nil))
138+ let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
169139 if ((neutrinoMetrics == neutrinoMetrics))
170140 then {
171141 let nsbtSupply = if ((nsbtSupplyOverride == unit))
172142 then asInt(neutrinoMetrics[9])
173143 else value(nsbtSupplyOverride)
174144 let currentPrice = asInt(neutrinoMetrics[0])
175- let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
145+ let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
176146 if ((kCalcArray == kCalcArray))
177147 then {
178148 let multK = parseBigIntValue(asString(kCalcArray[6]))
193163 @Callable(i)
194164 func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this))
195165 then throw("not authorized")
196- else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), StringEntry(keyNsbtLockContract(), nsbtLockAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)]
166+ else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)]
197167
198168
199169
200170 @Callable(i)
201-func calcSwapLimitMATH (gNsbtAmount) = {
202- let limitParamA = toBigInt(3)
171+func calcSwapLimitREADONLY (gNsbtAmount) = {
172+ let limitParamA = toBigInt(getIntOrFail(this, keySwapAmountAParam()))
203173 let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6)
204174 let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING)
205- let limit = fraction(limitParamA, limitPowPart, scale8BigInt)
175+ let limit = fraction(limitParamA, limitPowPart, scale10BigInt)
206176 $Tuple2(nil, toInt(limit))
207177 }
208178
209179
210180
211181 @Callable(i)
212-func calculateKMATH (wRaw,uRaw,price,mRaw,sRaw) = {
182+func calculateKREADONLY (wRaw,uRaw,price,mRaw,sRaw) = {
213183 let EXP = toBigInt(2718281)
214184 let EXPSCALE = 6
215185 let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3)
229199
230200
231201 @Callable(i)
232-func curveFunctionMATH (wRaw,uRaw,price,mRaw,sRaw,wavesPayRaw) = {
233- let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [wRaw, uRaw, price, mRaw, sRaw], nil))
234- if ((kCalcArray == kCalcArray))
202+func curveFunctionREADONLY (wavesPayRaw) = {
203+ let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
204+ if ((neutrinoMetrics == neutrinoMetrics))
235205 then {
236- let multK = parseBigIntValue(asString(kCalcArray[6]))
237- let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
238- let bigMaxNsbtSupply = toBigInt(mRaw)
239- let bigNsbtSupply = toBigInt((mRaw - sRaw))
240- let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK)
241- let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
242- let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
243- let nsbtAmountRaw = ((mRaw - sRaw) - 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])
206+ let price = asInt(neutrinoMetrics[0])
207+ let wRaw = asInt(neutrinoMetrics[3])
208+ let uRaw = asInt(neutrinoMetrics[5])
209+ let sRaw = asInt(neutrinoMetrics[9])
210+ let mRaw = value(assetInfo(nsbtAssetId)).quantity
211+ let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
212+ if ((kCalcArray == kCalcArray))
213+ then {
214+ let multK = parseBigIntValue(asString(kCalcArray[6]))
215+ let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
216+ let bigMaxNsbtSupply = toBigInt(mRaw)
217+ let bigNsbtSupply = toBigInt((mRaw - sRaw))
218+ let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK)
219+ let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
220+ let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
221+ let nsbtAmountRaw = ((mRaw - sRaw) - step3)
222+ $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])
223+ }
224+ else throw("Strict value is not equal to itself.")
245225 }
246226 else throw("Strict value is not equal to itself.")
247227 }
249229
250230
251231 @Callable(i)
252-func calcContractNsbtPriceMATH () = calcContractNsbtPriceInternal(unit)
232+func calcContractNsbtPriceREADONLY () = calcContractNsbtPriceInternal(unit)
253233
254234
255235
256236 @Callable(i)
257-func calcContractNsbtPriceBySupplyMATH (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply)
237+func calcContractNsbtPriceBySupplyREADONLY (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply)
258238
259239
260240
261241 @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))
267- then {
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])
279- }
280- else throw("Strict value is not equal to itself.")
281- }
282-
283-
284-
285-@Callable(i)
286-func calcNeutinoMetricsMATH () = {
242+func calcNeutinoMetricsREADONLY () = {
287243 let currentPrice = getIntegerValue(controlContract, keyPrice())
288244 let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0)
289245 let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0)
290246 let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance)
291247 let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice)
292- let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(addressFromStringValue(liquidationContract), neutrinoAssetId))
248+ let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId))
293249 let surplus = (reservesInUsdn - neutrinoSupply)
294250 let deficit = (neutrinoSupply - reservesInUsdn)
295251 let surplusPercent = if ((neutrinoSupply == 0))
306262
307263
308264 @Callable(i)
309-func getUnstakeComissionAmountMATH (amount,startHeight) = {
310- let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife())
311- $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT))
312- }
265+func getUnstakeComissionAmountREADONLY (amount,startHeight,halfLife) = $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT))
313266
314267
315268
316269 @Callable(i)
317-func mergeStakesMATH (amount1,height1,amount2,height2) = {
318- let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife())
270+func mergeStakesREADONLY (amount1,height1,amount2,height2,halfLife) = {
319271 let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT)
320272 let v = fraction((amount1 + amount2), MULT, (amount1 + w))
321273 $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT)))
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
32+let scale10BigInt = toBigInt(10000000000)
33+
3234 func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress"
3335
3436
3537 func keySwapAmountAParam () = "%s%s__config__swapAParam"
3638
3739
3840 func keyNeutrinoAssetId () = "neutrino_asset_id"
3941
4042
4143 func keyLiquidationContractAddress () = "liquidation_contract"
42-
43-
44-func keyRPDContract () = "rpd_contract"
4544
4645
4746 func keyAuctionContract () = "auction_contract"
4847
4948
5049 func keyContolContract () = "control_contract"
5150
5251
5352 func keyBondAssetId () = "bond_asset_id"
5453
5554
5655 func keyBalanceLocked () = "balance_lock_"
5756
5857
5958 func keyWavesLockedBalance () = (keyBalanceLocked() + "waves")
6059
6160
6261 func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino")
6362
6463
65-func keyMinWavesSwapAmount () = "min_waves_swap_amount"
66-
67-
68-func keyMinNeutrinoSwapAmount () = "min_neutrino_swap_amount"
69-
70-
71-func keyWavesOutFeePart () = "wavesOut_swap_feePart"
72-
73-
74-func keyNeutrinoOutFeePart () = "neutrinoOut_swap_feePart"
75-
76-
77-func keyNsbtLockContract () = "%s__nsbtLockContract"
78-
79-
80-func keyQuickSwapLimitDuration () = "%s__quickSwapLimitDuration"
64+func swapsTimeframeKEY () = "swaps_timeframe"
8165
8266
8367 func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP)
8468
8569
8670 func keyQuickSwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "quickSwapUserSpentInPeriod", userAddress], SEP)
8771
8872
8973 func keyPrice () = "price"
90-
91-
92-func keyHalfLife () = "%s__halfLife"
93-
94-
95-func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "amount"], SEP)
9674
9775
9876 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
9977
10078
10179 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
10280
10381
10482 func getNumberByKey (address,key) = valueOrElse(getInteger(address, key), 0)
10583
10684
10785 func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
10886
10987
11088 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI)
11189
11290
11391 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET)
11492
11593
11694 func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult))
11795
11896
11997 func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16))
12098
12199
122100 func asAnyList (val) = match val {
123101 case valAnyLyst: List[Any] =>
124102 valAnyLyst
125103 case _ =>
126104 throw("fail to cast into List[Any]")
127105 }
128106
129107
130108 func asInt (val) = match val {
131109 case valInt: Int =>
132110 valInt
133111 case _ =>
134112 throw("fail to cast into Int")
135113 }
136114
137115
138116 func asString (val) = match val {
139117 case valStr: String =>
140118 valStr
141119 case _ =>
142120 throw("fail to cast into String")
143121 }
144122
145123
146124 let neutrinoContract = addressFromStringValue(getStringOrFail(this, keyNeutrinoAddress()))
147125
148126 let controlContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyContolContract()))
149127
150128 let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract()))
151129
152-let liquidationContract = getStringOrFail(neutrinoContract, keyLiquidationContractAddress())
130+let liquidationContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyLiquidationContractAddress()))
153131
154-let rpdContract = getStringOrFail(neutrinoContract, keyRPDContract())
132+let neutrinoAssetId = fromBase58String(getStringOrFail(neutrinoContract, keyNeutrinoAssetId()))
155133
156-let nsbtStakingContract = addressFromStringValue(getStringOrFail(this, keyNsbtLockContract()))
157-
158-let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId())
159-
160-let neutrinoAssetId = fromBase58String(neutrinoAssetIdString)
161-
162-let nsbtAssetIdStr = getStringValue(neutrinoContract, keyBondAssetId())
163-
164-let nsbtAssetId = fromBase58String(nsbtAssetIdStr)
134+let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId()))
165135
166136 func calcContractNsbtPriceInternal (nsbtSupplyOverride) = {
167137 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
168- let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsMATH", nil, nil))
138+ let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
169139 if ((neutrinoMetrics == neutrinoMetrics))
170140 then {
171141 let nsbtSupply = if ((nsbtSupplyOverride == unit))
172142 then asInt(neutrinoMetrics[9])
173143 else value(nsbtSupplyOverride)
174144 let currentPrice = asInt(neutrinoMetrics[0])
175- let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
145+ let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
176146 if ((kCalcArray == kCalcArray))
177147 then {
178148 let multK = parseBigIntValue(asString(kCalcArray[6]))
179149 let mK = fromX16(multK, MULT)
180150 let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply))
181151 let multStep2 = fraction(multStep1, multStep1, MULT)
182152 let multNsbt2usdnPrice = fraction(mK, multStep2, MULT)
183153 let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
184154 let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
185155 $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
186156 }
187157 else throw("Strict value is not equal to itself.")
188158 }
189159 else throw("Strict value is not equal to itself.")
190160 }
191161
192162
193163 @Callable(i)
194164 func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this))
195165 then throw("not authorized")
196- else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), StringEntry(keyNsbtLockContract(), nsbtLockAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)]
166+ else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)]
197167
198168
199169
200170 @Callable(i)
201-func calcSwapLimitMATH (gNsbtAmount) = {
202- let limitParamA = toBigInt(3)
171+func calcSwapLimitREADONLY (gNsbtAmount) = {
172+ let limitParamA = toBigInt(getIntOrFail(this, keySwapAmountAParam()))
203173 let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6)
204174 let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING)
205- let limit = fraction(limitParamA, limitPowPart, scale8BigInt)
175+ let limit = fraction(limitParamA, limitPowPart, scale10BigInt)
206176 $Tuple2(nil, toInt(limit))
207177 }
208178
209179
210180
211181 @Callable(i)
212-func calculateKMATH (wRaw,uRaw,price,mRaw,sRaw) = {
182+func calculateKREADONLY (wRaw,uRaw,price,mRaw,sRaw) = {
213183 let EXP = toBigInt(2718281)
214184 let EXPSCALE = 6
215185 let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3)
216186 let paulB = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_b"), ((3 * PAULI) / 10))
217187 let wReservesInUsdn = convertWavesToNeutrino(wRaw, price)
218188 let multBR = fraction(wReservesInUsdn, MULT, uRaw)
219189 if ((multBR > 10678564816))
220190 then throw("BR > 10678.564816% will overflow exponent")
221191 else {
222192 let multPower = (a * (multBR - MULT))
223193 let multExpInPower = pow(EXP, EXPSCALE, toBigInt(multPower), MULTSCALE, SCALE16, DOWN)
224194 let multK = fraction(toBigInt(paulB), multExpInPower, BIGPAULI)
225195 $Tuple2(nil, [a, paulB, wReservesInUsdn, multBR, multPower, toString(multExpInPower), toString(multK)])
226196 }
227197 }
228198
229199
230200
231201 @Callable(i)
232-func curveFunctionMATH (wRaw,uRaw,price,mRaw,sRaw,wavesPayRaw) = {
233- let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [wRaw, uRaw, price, mRaw, sRaw], nil))
234- if ((kCalcArray == kCalcArray))
202+func curveFunctionREADONLY (wavesPayRaw) = {
203+ let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
204+ if ((neutrinoMetrics == neutrinoMetrics))
235205 then {
236- let multK = parseBigIntValue(asString(kCalcArray[6]))
237- let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
238- let bigMaxNsbtSupply = toBigInt(mRaw)
239- let bigNsbtSupply = toBigInt((mRaw - sRaw))
240- let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK)
241- let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
242- let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
243- let nsbtAmountRaw = ((mRaw - sRaw) - 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])
206+ let price = asInt(neutrinoMetrics[0])
207+ let wRaw = asInt(neutrinoMetrics[3])
208+ let uRaw = asInt(neutrinoMetrics[5])
209+ let sRaw = asInt(neutrinoMetrics[9])
210+ let mRaw = value(assetInfo(nsbtAssetId)).quantity
211+ let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
212+ if ((kCalcArray == kCalcArray))
213+ then {
214+ let multK = parseBigIntValue(asString(kCalcArray[6]))
215+ let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
216+ let bigMaxNsbtSupply = toBigInt(mRaw)
217+ let bigNsbtSupply = toBigInt((mRaw - sRaw))
218+ let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK)
219+ let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
220+ let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
221+ let nsbtAmountRaw = ((mRaw - sRaw) - step3)
222+ $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])
223+ }
224+ else throw("Strict value is not equal to itself.")
245225 }
246226 else throw("Strict value is not equal to itself.")
247227 }
248228
249229
250230
251231 @Callable(i)
252-func calcContractNsbtPriceMATH () = calcContractNsbtPriceInternal(unit)
232+func calcContractNsbtPriceREADONLY () = calcContractNsbtPriceInternal(unit)
253233
254234
255235
256236 @Callable(i)
257-func calcContractNsbtPriceBySupplyMATH (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply)
237+func calcContractNsbtPriceBySupplyREADONLY (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply)
258238
259239
260240
261241 @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))
267- then {
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])
279- }
280- else throw("Strict value is not equal to itself.")
281- }
282-
283-
284-
285-@Callable(i)
286-func calcNeutinoMetricsMATH () = {
242+func calcNeutinoMetricsREADONLY () = {
287243 let currentPrice = getIntegerValue(controlContract, keyPrice())
288244 let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0)
289245 let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0)
290246 let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance)
291247 let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice)
292- let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(addressFromStringValue(liquidationContract), neutrinoAssetId))
248+ let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId))
293249 let surplus = (reservesInUsdn - neutrinoSupply)
294250 let deficit = (neutrinoSupply - reservesInUsdn)
295251 let surplusPercent = if ((neutrinoSupply == 0))
296252 then 0
297253 else (fraction(surplus, PAULI, neutrinoSupply) * 100)
298254 let BR = if ((neutrinoSupply == 0))
299255 then 0
300256 else fraction(reservesInUsdn, PAULI, neutrinoSupply)
301257 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
302258 let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId))
303259 $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX])
304260 }
305261
306262
307263
308264 @Callable(i)
309-func getUnstakeComissionAmountMATH (amount,startHeight) = {
310- let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife())
311- $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT))
312- }
265+func getUnstakeComissionAmountREADONLY (amount,startHeight,halfLife) = $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT))
313266
314267
315268
316269 @Callable(i)
317-func mergeStakesMATH (amount1,height1,amount2,height2) = {
318- let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife())
270+func mergeStakesREADONLY (amount1,height1,amount2,height2,halfLife) = {
319271 let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT)
320272 let v = fraction((amount1 + amount2), MULT, (amount1 + w))
321273 $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT)))
322274 }
323275
324276

github/deemru/w8io/026f985 
55.35 ms