tx · FQcKGnKCWEoDER6GCXaZjUchpyqSwfjdQgibexChkgaN

3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh:  -0.04000000 Waves

2022.08.24 13:01 [2198414] smart account 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh > SELF 0.00000000 Waves

{ "type": 13, "id": "FQcKGnKCWEoDER6GCXaZjUchpyqSwfjdQgibexChkgaN", "fee": 4000000, "feeAssetId": null, "timestamp": 1661335296964, "version": 1, "sender": "3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh", "senderPublicKey": "HiTi1JT7GQRqLNxg4yZhD1mV42y1Mv2AYvRx92JQRbwX", "proofs": [ "2RWmrGCvReXxXcTo2d7CyYAfrZj4EX7PiNjK5h4bCH7MXTuEWmHMNLQkYvnfyJB1tzQ8xZAw3SAk2o5nAhp18yS7" ], "script": "base64:BgIvCAISBAoCAQQSBQoDCAEBEgUKAwgBARIDCgEIEgQKAggBEgUKAwgBCBIFCgMIAQhqAAZFVUxFUjgA1onPgQEABU1VTFQ2AMCEPQAGTVVMVFg2CQC2AgEAwIQ9AAVNVUxUOACAwtcvAAZNVUxUWDgJALYCAQCAwtcvAAdNVUxUWDEwCQC2AgEAgMivoCUABk1VTFQxMgCAoJSljR0AB01VTFRYMTYJALYCAQCAgIT+pt7hEQAGTVVMVDE4CQC2AgEAgICQu7rWrfANAANTRVACAl9fABFERUZBVUxUU1dBUEZFRU4yVwCIJwARREVGQVVMVFNXQVBGRUVXMk4AoJwBAAtCUlBST1RFQ1RFRACgjQYAB1dBVkVTSUQJANkEAQIFV0FWRVMBEmtleU5ldXRyaW5vQXNzZXRJZAACEW5ldXRyaW5vX2Fzc2V0X2lkAQ5rZXlOc2J0QXNzZXRJZAACDWJvbmRfYXNzZXRfaWQBDmtleVN1cmZBc3NldElkAAINc3VyZl9hc3NldF9pZAEQa2V5QmFsYW5jZUxvY2tlZAACDWJhbGFuY2VfbG9ja18BFWtleVdhdmVzTG9ja2VkQmFsY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QUMb3V0TmV0QW1vdW50CQDMCAIJAKQDAQUKb3V0U3VyZkFtdAkAzAgCCQCkAwEFDG91dEZlZUFtb3VudAkAzAgCCQCkAwEFBXByaWNlCQDMCAIJAKQDAQUOYmxja3MyTG10UmVzZXQJAMwIAgkApAMBBQ1saW1pdE1heFdhdmVzCQDMCAIJAKQDAQUMbGltaXRNYXhVc2RuCQDMCAIJAKQDAQUPaW5BbXRUb1N1cmZQYXJ0BQNuaWwFA1NFUABrA/Ah", "chainId": 84, "height": 2198414, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8g2WnbZT4qL8h1oL7rvXrsJ7pgHgRSFUzQnf5KZZ8SiQ Next: 62SckJcH7hagXSmBJLcjz7ucac7xwYwkadsKCMPmzsiB Diff:
OldNewDifferences
6363
6464
6565 func keySwapAmountBParam () = "%s%s__config__swapBParam"
66+
67+
68+func keyUsdnSwapAmountAParam () = "%s%s__config__usdnSwapAParam"
69+
70+
71+func keyUsdnSwapAmountBParam () = "%s%s__config__usdnSwapBParam"
6672
6773
6874 func keyNsbtLockContract () = "%s__nsbtLockContract"
287293 let surfAssetId = fromBase58String(surfAssetIdStr)
288294
289295 @Callable(i)
290-func reverseSwapLimitREADONLY (lim) = {
296+func reverseSwapLimitREADONLY (lim,isWavesSwap) = {
297+ let BR = asInt(asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil))[nMetricIdxBR])
291298 let gNsbt = if ((0 >= lim))
292299 then 0
293300 else {
294- let aParamX8 = toBigInt(getIntOrFail(mathContract, keySwapAmountAParam()))
295- let bParamX16 = toBigInt(getIntOrFail(mathContract, keySwapAmountBParam()))
296- let limDivAX8 = fraction(toBigInt(lim), MULTX10, aParamX8)
301+ let aParamX8 = toBigInt(getIntOrFail(mathContract, if (isWavesSwap)
302+ then keySwapAmountAParam()
303+ else keyUsdnSwapAmountAParam()))
304+ let bParamX16 = toBigInt(getIntOrFail(mathContract, if (isWavesSwap)
305+ then keySwapAmountBParam()
306+ else keyUsdnSwapAmountBParam()))
307+ let limDivAX8 = if (isWavesSwap)
308+ then fraction(toBigInt(lim), MULTX10, aParamX8)
309+ else fraction(fraction(toBigInt(lim), MULTX10, aParamX8), MULTX6, toBigInt(BR))
297310 let revBX16 = fraction(MULTX16, MULTX16, bParamX16)
298311 toInt(pow(limDivAX8, 8, revBX16, 16, 6, CEILING))
299312 }
416429 let limitWantedUsdn = if ((assetIdStr == "WAVES"))
417430 then convertWavesToNeutrino(limitWanted, getIntegerValue(controlContract, keyPrice()))
418431 else limitWanted
419- let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn], nil))
432+ let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn, (assetIdStr == "WAVES")], nil))
420433 let gNsbtDelta = (gNsbtNeeded - gNsbtCurrent)
421434 $Tuple2(nil, makeString(["%s%s", toString(gNsbtCurrent), toString(gNsbtDelta)], SEP))
422435 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let EULER8 = 271828182
55
66 let MULT6 = 1000000
77
88 let MULTX6 = toBigInt(1000000)
99
1010 let MULT8 = 100000000
1111
1212 let MULTX8 = toBigInt(100000000)
1313
1414 let MULTX10 = toBigInt(10000000000)
1515
1616 let MULT12 = 1000000000000
1717
1818 let MULTX16 = toBigInt(10000000000000000)
1919
2020 let MULT18 = toBigInt(1000000000000000000)
2121
2222 let SEP = "__"
2323
2424 let DEFAULTSWAPFEEN2W = 5000
2525
2626 let DEFAULTSWAPFEEW2N = 20000
2727
2828 let BRPROTECTED = 100000
2929
3030 let WAVESID = fromBase58String("WAVES")
3131
3232 func keyNeutrinoAssetId () = "neutrino_asset_id"
3333
3434
3535 func keyNsbtAssetId () = "bond_asset_id"
3636
3737
3838 func keySurfAssetId () = "surf_asset_id"
3939
4040
4141 func keyBalanceLocked () = "balance_lock_"
4242
4343
4444 func keyWavesLockedBalance () = (keyBalanceLocked() + "waves")
4545
4646
4747 func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino")
4848
4949
5050 func keyMinWavesSwapAmount () = "min_waves_swap_amount"
5151
5252
5353 func keyMinNeutrinoSwapAmount () = "min_neutrino_swap_amount"
5454
5555
5656 func keyWavesOutFeePart () = "wavesOut_swap_feePart"
5757
5858
5959 func keyNeutrinoOutFeePart () = "neutrinoOut_swap_feePart"
6060
6161
6262 func keySwapAmountAParam () = "%s%s__config__swapAParam"
6363
6464
6565 func keySwapAmountBParam () = "%s%s__config__swapBParam"
66+
67+
68+func keyUsdnSwapAmountAParam () = "%s%s__config__usdnSwapAParam"
69+
70+
71+func keyUsdnSwapAmountBParam () = "%s%s__config__usdnSwapBParam"
6672
6773
6874 func keyNsbtLockContract () = "%s__nsbtLockContract"
6975
7076
7177 func keyMathContract () = "%s__mathContract"
7278
7379
7480 func keyBalanceWavesLockInterval () = "balance_waves_lock_interval"
7581
7682
7783 func keyBalanceNeutrinoLockInterval () = "balance_neutrino_lock_interval"
7884
7985
8086 func keyPrice () = "price"
8187
8288
8389 func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "start"], SEP)
8490
8591
8692 func keyHalfLife () = "%s__halfLife"
8793
8894
8995 func keyMinLockAmount () = "%s__minLockAmount"
9096
9197
9298 func keyMinWavesForNsbtBuy () = "min_waves_nsbt_buy"
9399
94100
95101 func keyMinNsbtSell () = "min_nsbt_sell"
96102
97103
98104 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
99105
100106
101107 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
102108
103109
104110 func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
105111
106112
107113 func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price)
108114
109115
110116 func convertWavesToNeutrino (amount,price) = fraction(amount, price, MULT8)
111117
112118
113119 func asAnyList (val) = match val {
114120 case valAnyList: List[Any] =>
115121 valAnyList
116122 case _ =>
117123 throw("fail to cast into List[Any]")
118124 }
119125
120126
121127 func asInt (val) = match val {
122128 case valInt: Int =>
123129 valInt
124130 case _ =>
125131 throw("fail to cast into Int")
126132 }
127133
128134
129135 func asString (val) = match val {
130136 case valStr: String =>
131137 valStr
132138 case _ =>
133139 throw("fail to cast into String")
134140 }
135141
136142
137143 func asTuple2Ints (val) = match val {
138144 case v: (Int, Int) =>
139145 v
140146 case _ =>
141147 throw("fail to cast into Tuple2 ints")
142148 }
143149
144150
145151 func asSwapParamsSTRUCT (val) = match val {
146152 case struct: (Int, Int, Int, Int, Int, Int, Int) =>
147153 struct
148154 case _ =>
149155 throw("fail to cast into SwapParamsSTRUCT")
150156 }
151157
152158
153159 func asWithdrawResultSTRUCT (val) = match val {
154160 case struct: (Int, Unit, Int, Int, Int, Int, Int)|(Int, ByteVector, Int, Int, Int, Int, Int) =>
155161 struct
156162 case _ =>
157163 throw("fail to cast into WithdrawResult")
158164 }
159165
160166
161167 func toTimestamp (start) = if ((0 > start))
162168 then -1
163169 else match blockInfoByHeight(start) {
164170 case block: BlockInfo =>
165171 block.timestamp
166172 case _ =>
167173 -1
168174 }
169175
170176
171177 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult))
172178
173179
174180 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18))
175181
176182
177183 let nMetricIdxPrice = 0
178184
179185 let nMetricIdxUsdnLockedBalance = 1
180186
181187 let nMetricIdxWavesLockedBalance = 2
182188
183189 let nMetricIdxReserve = 3
184190
185191 let nMetricIdxReserveInUsdn = 4
186192
187193 let nMetricIdxUsdnSupply = 5
188194
189195 let nMetricIdxSurplus = 6
190196
191197 let nMetricIdxSurplusPercent = 7
192198
193199 let nMetricIdxBR = 8
194200
195201 let nMetricIdxNsbtSupply = 9
196202
197203 let nMetricIdxMaxNsbtSupply = 10
198204
199205 let nMetricIdxSurfSupply = 11
200206
201207 let IdxControlCfgNeutrinoDapp = 1
202208
203209 let IdxControlCfgAuctionDapp = 2
204210
205211 let IdxControlCfgRpdDapp = 3
206212
207213 let IdxControlCfgMathDapp = 4
208214
209215 let IdxControlCfgLiquidationDapp = 5
210216
211217 let IdxControlCfgRestDapp = 6
212218
213219 let IdxControlCfgNodeRegistryDapp = 7
214220
215221 let IdxControlCfgNsbtStakingDapp = 8
216222
217223 let IdxControlCfgMediatorDapp = 9
218224
219225 let IdxControlCfgSurfStakingDapp = 10
220226
221227 let IdxControlCfgGnsbtControllerDapp = 11
222228
223229 let bFuncIdxSurf = 0
224230
225231 let bFuncIdxWaves = 1
226232
227233 let bFuncIdxUsdn = 2
228234
229235 let bFuncIdxReserveStart = 3
230236
231237 let bFuncIdxSupplyStart = 4
232238
233239 let bFuncIdxBRStart = 5
234240
235241 let bFuncIdxReserveEnd = 6
236242
237243 let bFuncIdxSupplyEnd = 7
238244
239245 let bFuncIdxBREnd = 8
240246
241247 let bFuncIdxRest = 9
242248
243249 let bFuncIdxWavesPrice = 10
244250
245251 func keyControlAddress () = "%s%s__config__controlAddress"
246252
247253
248254 func keyControlCfg () = "%s__controlConfig"
249255
250256
251257 func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP)
252258
253259
254260 func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx)))
255261
256262
257263 let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx"))
258264
259265 let controlCfg = readControlCfgOrFail(controlContract)
260266
261267 let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp)
262268
263269 let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp)
264270
265271 let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp)
266272
267273 let liquidationContract = getContractAddressOrFail(controlCfg, IdxControlCfgLiquidationDapp)
268274
269275 let rpdContract = getContractAddressOrFail(controlCfg, IdxControlCfgRpdDapp)
270276
271277 let nsbtStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgNsbtStakingDapp)
272278
273279 let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp)
274280
275281 let gnsbtControllerContract = getContractAddressOrFail(controlCfg, IdxControlCfgGnsbtControllerDapp)
276282
277283 let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId())
278284
279285 let neutrinoAssetId = fromBase58String(neutrinoAssetIdString)
280286
281287 let nsbtAssetIdStr = getStringValue(neutrinoContract, keyNsbtAssetId())
282288
283289 let nsbtAssetId = fromBase58String(nsbtAssetIdStr)
284290
285291 let surfAssetIdStr = getStringValue(auctionContract, keySurfAssetId())
286292
287293 let surfAssetId = fromBase58String(surfAssetIdStr)
288294
289295 @Callable(i)
290-func reverseSwapLimitREADONLY (lim) = {
296+func reverseSwapLimitREADONLY (lim,isWavesSwap) = {
297+ let BR = asInt(asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil))[nMetricIdxBR])
291298 let gNsbt = if ((0 >= lim))
292299 then 0
293300 else {
294- let aParamX8 = toBigInt(getIntOrFail(mathContract, keySwapAmountAParam()))
295- let bParamX16 = toBigInt(getIntOrFail(mathContract, keySwapAmountBParam()))
296- let limDivAX8 = fraction(toBigInt(lim), MULTX10, aParamX8)
301+ let aParamX8 = toBigInt(getIntOrFail(mathContract, if (isWavesSwap)
302+ then keySwapAmountAParam()
303+ else keyUsdnSwapAmountAParam()))
304+ let bParamX16 = toBigInt(getIntOrFail(mathContract, if (isWavesSwap)
305+ then keySwapAmountBParam()
306+ else keyUsdnSwapAmountBParam()))
307+ let limDivAX8 = if (isWavesSwap)
308+ then fraction(toBigInt(lim), MULTX10, aParamX8)
309+ else fraction(fraction(toBigInt(lim), MULTX10, aParamX8), MULTX6, toBigInt(BR))
297310 let revBX16 = fraction(MULTX16, MULTX16, bParamX16)
298311 toInt(pow(limDivAX8, 8, revBX16, 16, 6, CEILING))
299312 }
300313 $Tuple2(nil, gNsbt)
301314 }
302315
303316
304317
305318 @Callable(i)
306319 func gnsbtInfoINTERNAL (userAddressStrOrEmpty,additionalNsbtToStakeOrZero,additionalSurfToStakeOrZero) = {
307320 let userAddressOrThis = if ((userAddressStrOrEmpty != ""))
308321 then addressFromStringValue(userAddressStrOrEmpty)
309322 else this
310323 let currentPrice = getIntegerValue(controlContract, keyPrice())
311324 let gnsbtFromNsbtDiff = additionalNsbtToStakeOrZero
312325 let gnsbtFromSurfDiff = asInt(invoke(surfStakingContract, "gnsbtFromSurfSYSREADONLY", [additionalSurfToStakeOrZero], nil))
313326 let gNsbtDiff = (gnsbtFromNsbtDiff + gnsbtFromSurfDiff)
314327 let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil))
315328 let blcks2LmtReset = swapParamsTuple._3
316329 let gnsbtAmt = swapParamsTuple._4
317330 let gnsbtAmtTotal = swapParamsTuple._5
318331 let limitMaxWaves = swapParamsTuple._6
319332 let limitMaxUsdn = swapParamsTuple._7
320333 let swapParamsTupleNEW = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, gNsbtDiff], nil))
321334 let blcks2LmtResetNEW = swapParamsTupleNEW._3
322335 let gnsbtAmtNEW = swapParamsTupleNEW._4
323336 let gnsbtAmtTotalNEW = swapParamsTupleNEW._5
324337 let limitMaxWavesNEW = swapParamsTupleNEW._6
325338 let limitMaxUsdnNEW = swapParamsTupleNEW._7
326339 let nsbtBalance = if ((userAddressStrOrEmpty != ""))
327340 then assetBalance(userAddressOrThis, nsbtAssetId)
328341 else 0
329342 let surfBalance = if ((userAddressStrOrEmpty != ""))
330343 then assetBalance(userAddressOrThis, surfAssetId)
331344 else 0
332345 let nsbtBalanceDiff = if ((additionalNsbtToStakeOrZero >= 0))
333346 then additionalNsbtToStakeOrZero
334347 else {
335348 let nsbtUnstakingData = asAnyList(invoke(nsbtStakingContract, "nsbtUnstakingSYSREADONLY", [userAddressStrOrEmpty, (-1 * additionalNsbtToStakeOrZero)], nil))
336349 let nsbtReceiveAmount = asInt(nsbtUnstakingData[2])
337350 let result = -(nsbtReceiveAmount)
338351 result
339352 }
340353 let nsbtBalanceNew = (nsbtBalance - nsbtBalanceDiff)
341354 let surfBalanceNew = (surfBalance - additionalSurfToStakeOrZero)
342355 let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStrOrEmpty, additionalNsbtToStakeOrZero, additionalSurfToStakeOrZero], nil))
343356 let gnsbtUser = asInt(gnsbtData[0])
344357 let gnsbtTotal = asInt(gnsbtData[1])
345358 let nsbtData = asAnyList(gnsbtData[2])
346359 let surfData = asAnyList(gnsbtData[3])
347360 let vpEffectiveHeight = asInt(gnsbtData[4])
348361 let vpEffectiveHeightNEW = asInt(gnsbtData[5])
349362 let gnsbtAmtFromNsbt = asInt(nsbtData[2])
350363 let gnsbtAmtFromSurf = asInt(surfData[2])
351364 let gnsbtAmtFromNsbtNEW = (gnsbtAmtFromNsbt + gnsbtFromNsbtDiff)
352365 let gnsbtAmtFromSurfNEW = (gnsbtAmtFromSurf + gnsbtFromSurfDiff)
353366 let gnsbtFromNsbtTotal = asInt(nsbtData[3])
354367 let gnsbtFromSurfTotal = asInt(surfData[3])
355368 let gnsbtFromSurfActiveTotal = 0
356369 let gnsbtFromSurfFrozenTotal = gnsbtFromSurfTotal
357370 let gnsbtFromNsbtTotalNEW = (gnsbtFromNsbtTotal + gnsbtFromNsbtDiff)
358371 let gnsbtFromSurfTotalNEW = (gnsbtFromSurfTotal + gnsbtFromSurfDiff)
359372 let gnsbtFromSurfFrozenTotalNEW = gnsbtFromSurfTotalNEW
360373 let votingPower = fraction(gnsbtAmtFromNsbt, MULT8, (gnsbtFromNsbtTotal + gnsbtFromSurfActiveTotal))
361374 let votingPowerNew = fraction(gnsbtAmtFromNsbtNEW, MULT8, (gnsbtFromNsbtTotalNEW + gnsbtFromSurfActiveTotal))
362375 let votingPowerMax = fraction((gnsbtAmtFromNsbt + gnsbtAmtFromSurf), MULT8, ((gnsbtFromNsbtTotal + gnsbtFromSurfActiveTotal) + gnsbtFromSurfFrozenTotal))
363376 let votingPowerMaxNew = fraction((gnsbtAmtFromNsbtNEW + gnsbtAmtFromSurfNEW), MULT8, ((gnsbtFromNsbtTotalNEW + gnsbtFromSurfActiveTotal) + gnsbtFromSurfFrozenTotalNEW))
364377 let votingPowerEta = if ((vpEffectiveHeight == 0))
365378 then height
366379 else vpEffectiveHeight
367380 let votingPowerEtaNew = if ((vpEffectiveHeightNEW == 0))
368381 then height
369382 else vpEffectiveHeightNEW
370383 $Tuple2(nil, [0, nsbtBalance, surfBalance, nsbtBalanceNew, surfBalanceNew, gnsbtAmtFromNsbt, gnsbtAmtFromSurf, gnsbtAmtFromNsbtNEW, gnsbtAmtFromSurfNEW, gnsbtFromNsbtTotal, gnsbtFromSurfTotal, gnsbtFromNsbtTotalNEW, gnsbtFromSurfTotalNEW, limitMaxUsdn, limitMaxWaves, limitMaxUsdnNEW, limitMaxWavesNEW, blcks2LmtReset, blcks2LmtResetNEW, votingPower, votingPowerNew, votingPowerMax, votingPowerMaxNew, votingPowerEta, votingPowerEtaNew])
371384 }
372385
373386
374387
375388 @Callable(i)
376389 func gnsbtInfoREADONLY (userAddressStrOrEmpty,additionalNsbtToStakeOrZero,additionalSurfToStakeOrZero) = {
377390 let gnsbtInfoDATA = asAnyList(invoke(this, "gnsbtInfoINTERNAL", [userAddressStrOrEmpty, additionalNsbtToStakeOrZero, additionalSurfToStakeOrZero], nil))
378391 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d", toString(asInt(gnsbtInfoDATA[1])), toString(asInt(gnsbtInfoDATA[2])), toString(asInt(gnsbtInfoDATA[3])), toString(asInt(gnsbtInfoDATA[4])), toString(asInt(gnsbtInfoDATA[5])), toString(asInt(gnsbtInfoDATA[6])), toString(asInt(gnsbtInfoDATA[7])), toString(asInt(gnsbtInfoDATA[8])), toString(asInt(gnsbtInfoDATA[9])), toString(asInt(gnsbtInfoDATA[10])), toString(asInt(gnsbtInfoDATA[11])), toString(asInt(gnsbtInfoDATA[12])), toString(asInt(gnsbtInfoDATA[13])), toString(asInt(gnsbtInfoDATA[14])), toString(asInt(gnsbtInfoDATA[15])), toString(asInt(gnsbtInfoDATA[16])), toString(asInt(gnsbtInfoDATA[17])), toString(asInt(gnsbtInfoDATA[18])), toString(asInt(gnsbtInfoDATA[19])), toString(asInt(gnsbtInfoDATA[20])), toString(asInt(gnsbtInfoDATA[21])), toString(asInt(gnsbtInfoDATA[22])), toString(asInt(gnsbtInfoDATA[23])), toString(asInt(gnsbtInfoDATA[24]))], SEP))
379392 }
380393
381394
382395
383396 @Callable(i)
384397 func rewardInfoREADONLY (userAddressStrOrEmpty) = {
385398 let rewardsData = asAnyList(invoke(gnsbtControllerContract, "gnsbtRewardsSYSREADONLY", [userAddressStrOrEmpty], nil))
386399 $Tuple2(nil, makeString(["%s%s", asString(rewardsData[0]), asString(rewardsData[1])], SEP))
387400 }
388401
389402
390403
391404 @Callable(i)
392405 func mergeNsbtREADONLY (userAddressMandatory,newAmount) = {
393406 let nsbtData = asAnyList(invoke(nsbtStakingContract, "nsbtStakingSYSREADONLY", [userAddressMandatory, newAmount], nil))
394407 let amount0 = asInt(nsbtData[0])
395408 let startHeight = if ((0 >= amount0))
396409 then -1
397410 else asInt(nsbtData[2])
398411 let startTimestamp = toTimestamp(startHeight)
399412 let startHeightNew = if ((0 >= newAmount))
400413 then startHeight
401414 else {
402415 let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife())
403416 asInt(invoke(mathContract, "mergeStakesREADONLY", [amount0, startHeight, newAmount, height, halfLife], nil))
404417 }
405418 let startTimestampNew = toTimestamp(startHeightNew)
406419 $Tuple2(nil, makeString(["%d%d%d%d", toString(startHeight), toString(startTimestamp), toString(startHeightNew), toString(startTimestampNew)], SEP))
407420 }
408421
409422
410423
411424 @Callable(i)
412425 func swapLimitCalculatorREADONLY (userAddressStrOpt,limitWanted,assetIdStr) = {
413426 let gNsbtCurrent = if ((userAddressStrOpt == ""))
414427 then 0
415428 else asInt(asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOpt, 0], nil))._4)
416429 let limitWantedUsdn = if ((assetIdStr == "WAVES"))
417430 then convertWavesToNeutrino(limitWanted, getIntegerValue(controlContract, keyPrice()))
418431 else limitWanted
419- let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn], nil))
432+ let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn, (assetIdStr == "WAVES")], nil))
420433 let gNsbtDelta = (gNsbtNeeded - gNsbtCurrent)
421434 $Tuple2(nil, makeString(["%s%s", toString(gNsbtCurrent), toString(gNsbtDelta)], SEP))
422435 }
423436
424437
425438
426439 @Callable(i)
427440 func swapInfoREADONLY (userAddressStrOrEmpty,amount,assetIdStr) = {
428441 let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil))
429442 let price = asInt(neutrinoMetrics[nMetricIdxPrice])
430443 let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil))
431444 let blcks2LmtReset = swapParamsTuple._3
432445 let limitMaxWaves = swapParamsTuple._6
433446 let limitMaxUsdn = swapParamsTuple._7
434447 let assetId = fromBase58String(assetIdStr)
435448 let swapType = if ((assetId == WAVESID))
436449 then "waves"
437450 else if ((assetId == neutrinoAssetId))
438451 then "neutrino"
439452 else throw(("Can't swap assetId=" + assetIdStr))
440453 let withdrawTuple = asWithdrawResultSTRUCT(invoke(neutrinoContract, "calcWithdrawResultSYSREADONLY", [swapType, amount, price], nil))
441454 let outNetAmount = withdrawTuple._1
442455 let outAssetId = withdrawTuple._2
443456 let outSurfAmt = withdrawTuple._3
444457 let inAmtToSurfPart = withdrawTuple._4
445458 let unleaseAmt = withdrawTuple._5
446459 let outFeeAmount = withdrawTuple._6
447460 let outAmtGross = withdrawTuple._7
448461 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(price), toString(blcks2LmtReset), toString(limitMaxWaves), toString(limitMaxUsdn), toString(inAmtToSurfPart)], SEP))
449462 }
450463
451464

github/deemru/w8io/026f985 
57.33 ms