tx · CDRkiBJfw7ETkATcfUYJhhoEuWj26Bm2RZsjHw9X3Tau

3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi:  -0.01400000 Waves

2022.03.18 10:35 [1969106] smart account 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi > SELF 0.00000000 Waves

{ "type": 13, "id": "CDRkiBJfw7ETkATcfUYJhhoEuWj26Bm2RZsjHw9X3Tau", "fee": 1400000, "feeAssetId": null, "timestamp": 1647588948594, "version": 1, "sender": "3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi", "senderPublicKey": "4qGVXRFATZNzo2RZZ5UYHXojGyJgSRBwtgJcCU8rJe5A", "proofs": [ "FcvW39K5JixABsSSG6C5QrgHF9Y1qTZnWTgmfzV1FQ358SWwo2QpRdu2FGCaNVjWCfDoCPdqig737CoqcYvr9ZQ" ], "script": "base64:AAIFAAAAAAAAADMIAhIFCgMICAESAwoBARIHCgUBAQEBARIDCgEBEgMKAQESABIFCgMBAQESBwoFAQEBAQEAAAAvAAAAAAdXQVZFTEVUAAAAAAAF9eEAAAAAAAVQQVVMSQAAAAAAAA9CQAAAAAAIQklHUEFVTEkJAAE2AAAAAQAAAAAAAA9CQAAAAAAIUFJJQ0VMRVQAAAAAAAAPQkAAAAAABE1VTFQAAAAAAAX14QAAAAAACUJJR01VTFQxNgkAATYAAAABAAAjhvJvwQAAAAAAAAlNVUxUU0NBTEUAAAAAAAAAAAgAAAAAB1NDQUxFMTYAAAAAAAAAABAAAAAAA1NFUAIAAAACX18AAAAABUhBTEY4AAAAAAAC+vCAAAAAAAtFVUxFUk5VTUJFUgkAATYAAAABAABgkqET2NV0AAAAAAZzY2FsZTYAAAAAAAAPQkAAAAAADHNjYWxlNkJpZ0ludAkAATYAAAABAAAAAAAAD0JAAAAAAAxzY2FsZThCaWdJbnQJAAE2AAAAAQAAAAAABfXhAAAAAAANc2NhbGUxMEJpZ0ludAkAATYAAAABAAAAAAJUC+QAAQAAABJrZXlOZXV0cmlub0FkZ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AAgUAAAADbmlsCQAAawAAAAMFAAAABmFtb3VudAkAAGwAAAAGAAAAAAAAAAACAAAAAAAAAAAACQAAawAAAAMJAQAAAAEtAAAAAQkAAGUAAAACBQAAAAZoZWlnaHQFAAAAC3N0YXJ0SGVpZ2h0BQAAAARNVUxUBQAAAAhoYWxmTGlmZQAAAAAAAAAACAAAAAAAAAAACAUAAAAGSEFMRlVQBQAAAARNVUxUAAAAAWkBAAAAE21lcmdlU3Rha2VzUkVBRE9OTFkAAAAFAAAAB2Ftb3VudDEAAAAHaGVpZ2h0MQAAAAdhbW91bnQyAAAAB2hlaWdodDIAAAAIaGFsZkxpZmUEAAAAAXcJAABrAAAAAwUAAAAHYW1vdW50MgkAAGwAAAAGAAAAAAAAAAACAAAAAAAAAAAACQAAawAAAAMJAABlAAAAAgUAAAAHaGVpZ2h0MgUAAAAHaGVpZ2h0MQUAAAAETVVMVAUAAAAIaGFsZkxpZmUAAAAAAAAAAAgAAAAAAAAAAAgFAAAABkhBTEZVUAUAAAAETVVMVAQAAAABdgkAAGsAAAADCQAAZAAAAAIFAAAAB2Ftb3VudDEFAAAAB2Ftb3VudDIFAAAABE1VTFQJAABkAAAAAgUAAAAHYW1vdW50MQUAAAABdwkABRQAAAACBQAAAANuaWwJAABkAAAAAgUAAAAHaGVpZ2h0MQkAAGkAAAACCQAAZQAAAAIFAAAABUhBTEY4CQAAaAAAAAIFAAAACGhhbGZMaWZlCQAAbQAAAAYFAAAAAXYAAAAAAAAAAAgAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAgFAAAABkhBTEZVUAUAAAAETVVMVAAAAAB3r7vC", "chainId": 84, "height": 1969106, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B5PKtkw2C9MdNE1Mz2x7qHVWpi26LDXcfH67Bm5GGjrU Next: HCUkraKw7BiYJp6rQ3rRi2P5mpg6Y7UarD1RWHeSefNY Diff:
OldNewDifferences
133133
134134 let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId()))
135135
136-func calcContractNsbtPriceInternal (nsbtSupplyOverride) = {
137- let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
136+func calcContractNsbtPriceInternal (nsbtSupplyDELTA) = {
138137 let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
139- if ((neutrinoMetrics == neutrinoMetrics))
140- then {
141- let nsbtSupply = if ((nsbtSupplyOverride == unit))
142- then asInt(neutrinoMetrics[9])
143- else value(nsbtSupplyOverride)
144- let currentPrice = asInt(neutrinoMetrics[0])
145- let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [asInt(neutrinoMetrics[3]), asInt(neutrinoMetrics[5]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
146- if ((kCalcArray == kCalcArray))
147- then {
148- let multK = parseBigIntValue(asString(kCalcArray[6]))
149- let mK = fromX16(multK, MULT)
150- let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply))
151- let multStep2 = fraction(multStep1, multStep1, MULT)
152- let multNsbt2usdnPrice = fraction(mK, multStep2, MULT)
153- let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
154- let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
155- $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
156- }
157- else throw("Strict value is not equal to itself.")
158- }
159- else throw("Strict value is not equal to itself.")
138+ let price = asInt(neutrinoMetrics[0])
139+ let wRaw = asInt(neutrinoMetrics[3])
140+ let uRaw = asInt(neutrinoMetrics[5])
141+ let sRaw = (asInt(neutrinoMetrics[9]) + nsbtSupplyDELTA)
142+ let mRaw = asInt(neutrinoMetrics[10])
143+ let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
144+ let multKX16 = parseBigIntValue(asString(kCalcArray[6]))
145+ let multStep1X16 = fraction(toBigInt(mRaw), BIGMULT16, toBigInt((mRaw - sRaw)))
146+ let multStep2X16 = fraction(multStep1X16, multStep1X16, BIGMULT16)
147+ let multNsbt2usdnPriceX16 = fraction(multKX16, multStep2X16, BIGMULT16)
148+ let nsbt2usdnPrice = toInt(fraction(multNsbt2usdnPriceX16, toBigInt(PAULI), BIGMULT16))
149+ let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, price)
150+ $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
160151 }
161152
162153
201192 @Callable(i)
202193 func curveFunctionREADONLY (wavesPayRaw) = {
203194 let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
204- if ((neutrinoMetrics == neutrinoMetrics))
205- then {
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.")
225- }
226- else throw("Strict value is not equal to itself.")
195+ let price = asInt(neutrinoMetrics[0])
196+ let wRaw = asInt(neutrinoMetrics[3])
197+ let uRaw = asInt(neutrinoMetrics[5])
198+ let sRaw = asInt(neutrinoMetrics[9])
199+ let mRaw = asInt(neutrinoMetrics[10])
200+ let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
201+ let multK = parseBigIntValue(asString(kCalcArray[6]))
202+ let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
203+ let bigMaxNsbtSupply = toBigInt(mRaw)
204+ let bigNsbtSupply = toBigInt((mRaw - sRaw))
205+ let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK)
206+ let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
207+ let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
208+ let nsbtAmountRaw = ((mRaw - sRaw) - step3)
209+ $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])
227210 }
228211
229212
230213
231214 @Callable(i)
232-func calcContractNsbtPriceREADONLY () = calcContractNsbtPriceInternal(unit)
233-
234-
235-
236-@Callable(i)
237-func calcContractNsbtPriceBySupplyREADONLY (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply)
215+func calcContractNsbtPriceSYSREADONLY (nsbtSupplyDELTA) = calcContractNsbtPriceInternal(nsbtSupplyDELTA)
238216
239217
240218
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 let scale10BigInt = toBigInt(10000000000)
3333
3434 func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress"
3535
3636
3737 func keySwapAmountAParam () = "%s%s__config__swapAParam"
3838
3939
4040 func keyNeutrinoAssetId () = "neutrino_asset_id"
4141
4242
4343 func keyLiquidationContractAddress () = "liquidation_contract"
4444
4545
4646 func keyAuctionContract () = "auction_contract"
4747
4848
4949 func keyContolContract () = "control_contract"
5050
5151
5252 func keyBondAssetId () = "bond_asset_id"
5353
5454
5555 func keyBalanceLocked () = "balance_lock_"
5656
5757
5858 func keyWavesLockedBalance () = (keyBalanceLocked() + "waves")
5959
6060
6161 func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino")
6262
6363
6464 func swapsTimeframeKEY () = "swaps_timeframe"
6565
6666
6767 func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP)
6868
6969
7070 func keyQuickSwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "quickSwapUserSpentInPeriod", userAddress], SEP)
7171
7272
7373 func keyPrice () = "price"
7474
7575
7676 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
7777
7878
7979 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
8080
8181
8282 func getNumberByKey (address,key) = valueOrElse(getInteger(address, key), 0)
8383
8484
8585 func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
8686
8787
8888 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI)
8989
9090
9191 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET)
9292
9393
9494 func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult))
9595
9696
9797 func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16))
9898
9999
100100 func asAnyList (val) = match val {
101101 case valAnyLyst: List[Any] =>
102102 valAnyLyst
103103 case _ =>
104104 throw("fail to cast into List[Any]")
105105 }
106106
107107
108108 func asInt (val) = match val {
109109 case valInt: Int =>
110110 valInt
111111 case _ =>
112112 throw("fail to cast into Int")
113113 }
114114
115115
116116 func asString (val) = match val {
117117 case valStr: String =>
118118 valStr
119119 case _ =>
120120 throw("fail to cast into String")
121121 }
122122
123123
124124 let neutrinoContract = addressFromStringValue(getStringOrFail(this, keyNeutrinoAddress()))
125125
126126 let controlContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyContolContract()))
127127
128128 let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract()))
129129
130130 let liquidationContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyLiquidationContractAddress()))
131131
132132 let neutrinoAssetId = fromBase58String(getStringOrFail(neutrinoContract, keyNeutrinoAssetId()))
133133
134134 let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId()))
135135
136-func calcContractNsbtPriceInternal (nsbtSupplyOverride) = {
137- let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
136+func calcContractNsbtPriceInternal (nsbtSupplyDELTA) = {
138137 let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
139- if ((neutrinoMetrics == neutrinoMetrics))
140- then {
141- let nsbtSupply = if ((nsbtSupplyOverride == unit))
142- then asInt(neutrinoMetrics[9])
143- else value(nsbtSupplyOverride)
144- let currentPrice = asInt(neutrinoMetrics[0])
145- let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [asInt(neutrinoMetrics[3]), asInt(neutrinoMetrics[5]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil))
146- if ((kCalcArray == kCalcArray))
147- then {
148- let multK = parseBigIntValue(asString(kCalcArray[6]))
149- let mK = fromX16(multK, MULT)
150- let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply))
151- let multStep2 = fraction(multStep1, multStep1, MULT)
152- let multNsbt2usdnPrice = fraction(mK, multStep2, MULT)
153- let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
154- let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
155- $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
156- }
157- else throw("Strict value is not equal to itself.")
158- }
159- else throw("Strict value is not equal to itself.")
138+ let price = asInt(neutrinoMetrics[0])
139+ let wRaw = asInt(neutrinoMetrics[3])
140+ let uRaw = asInt(neutrinoMetrics[5])
141+ let sRaw = (asInt(neutrinoMetrics[9]) + nsbtSupplyDELTA)
142+ let mRaw = asInt(neutrinoMetrics[10])
143+ let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
144+ let multKX16 = parseBigIntValue(asString(kCalcArray[6]))
145+ let multStep1X16 = fraction(toBigInt(mRaw), BIGMULT16, toBigInt((mRaw - sRaw)))
146+ let multStep2X16 = fraction(multStep1X16, multStep1X16, BIGMULT16)
147+ let multNsbt2usdnPriceX16 = fraction(multKX16, multStep2X16, BIGMULT16)
148+ let nsbt2usdnPrice = toInt(fraction(multNsbt2usdnPriceX16, toBigInt(PAULI), BIGMULT16))
149+ let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, price)
150+ $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
160151 }
161152
162153
163154 @Callable(i)
164155 func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this))
165156 then throw("not authorized")
166157 else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)]
167158
168159
169160
170161 @Callable(i)
171162 func calcSwapLimitREADONLY (gNsbtAmount) = {
172163 let limitParamA = toBigInt(getIntOrFail(this, keySwapAmountAParam()))
173164 let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6)
174165 let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING)
175166 let limit = fraction(limitParamA, limitPowPart, scale10BigInt)
176167 $Tuple2(nil, toInt(limit))
177168 }
178169
179170
180171
181172 @Callable(i)
182173 func calculateKREADONLY (wRaw,uRaw,price,mRaw,sRaw) = {
183174 let EXP = toBigInt(2718281)
184175 let EXPSCALE = 6
185176 let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3)
186177 let paulB = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_b"), ((3 * PAULI) / 10))
187178 let wReservesInUsdn = convertWavesToNeutrino(wRaw, price)
188179 let multBR = fraction(wReservesInUsdn, MULT, uRaw)
189180 if ((multBR > 10678564816))
190181 then throw("BR > 10678.564816% will overflow exponent")
191182 else {
192183 let multPower = (a * (multBR - MULT))
193184 let multExpInPower = pow(EXP, EXPSCALE, toBigInt(multPower), MULTSCALE, SCALE16, DOWN)
194185 let multK = fraction(toBigInt(paulB), multExpInPower, BIGPAULI)
195186 $Tuple2(nil, [a, paulB, wReservesInUsdn, multBR, multPower, toString(multExpInPower), toString(multK)])
196187 }
197188 }
198189
199190
200191
201192 @Callable(i)
202193 func curveFunctionREADONLY (wavesPayRaw) = {
203194 let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
204- if ((neutrinoMetrics == neutrinoMetrics))
205- then {
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.")
225- }
226- else throw("Strict value is not equal to itself.")
195+ let price = asInt(neutrinoMetrics[0])
196+ let wRaw = asInt(neutrinoMetrics[3])
197+ let uRaw = asInt(neutrinoMetrics[5])
198+ let sRaw = asInt(neutrinoMetrics[9])
199+ let mRaw = asInt(neutrinoMetrics[10])
200+ let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
201+ let multK = parseBigIntValue(asString(kCalcArray[6]))
202+ let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
203+ let bigMaxNsbtSupply = toBigInt(mRaw)
204+ let bigNsbtSupply = toBigInt((mRaw - sRaw))
205+ let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK)
206+ let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
207+ let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
208+ let nsbtAmountRaw = ((mRaw - sRaw) - step3)
209+ $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])
227210 }
228211
229212
230213
231214 @Callable(i)
232-func calcContractNsbtPriceREADONLY () = calcContractNsbtPriceInternal(unit)
233-
234-
235-
236-@Callable(i)
237-func calcContractNsbtPriceBySupplyREADONLY (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply)
215+func calcContractNsbtPriceSYSREADONLY (nsbtSupplyDELTA) = calcContractNsbtPriceInternal(nsbtSupplyDELTA)
238216
239217
240218
241219 @Callable(i)
242220 func calcNeutinoMetricsREADONLY () = {
243221 let currentPrice = getIntegerValue(controlContract, keyPrice())
244222 let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0)
245223 let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0)
246224 let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance)
247225 let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice)
248226 let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId))
249227 let surplus = (reservesInUsdn - neutrinoSupply)
250228 let deficit = (neutrinoSupply - reservesInUsdn)
251229 let surplusPercent = if ((neutrinoSupply == 0))
252230 then 0
253231 else (fraction(surplus, PAULI, neutrinoSupply) * 100)
254232 let BR = if ((neutrinoSupply == 0))
255233 then 0
256234 else fraction(reservesInUsdn, PAULI, neutrinoSupply)
257235 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
258236 let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId))
259237 $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX])
260238 }
261239
262240
263241
264242 @Callable(i)
265243 func getUnstakeComissionAmountREADONLY (amount,startHeight,halfLife) = $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT))
266244
267245
268246
269247 @Callable(i)
270248 func mergeStakesREADONLY (amount1,height1,amount2,height2,halfLife) = {
271249 let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT)
272250 let v = fraction((amount1 + amount2), MULT, (amount1 + w))
273251 $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT)))
274252 }
275253
276254

github/deemru/w8io/026f985 
57.01 ms