tx · 3kvi8PPiuoLt2QVHA4ErwLBq8iK6G7XhNAabzn8WFvUz 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh: -0.04000000 Waves 2022.08.11 14:56 [2179788] smart account 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh > SELF 0.00000000 Waves
{ "type": 13, "id": "3kvi8PPiuoLt2QVHA4ErwLBq8iK6G7XhNAabzn8WFvUz", "fee": 4000000, "feeAssetId": null, "timestamp": 1660219033863, "version": 1, "sender": "3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh", "senderPublicKey": "HiTi1JT7GQRqLNxg4yZhD1mV42y1Mv2AYvRx92JQRbwX", "proofs": [ "3SoSyv7zTkVfHMZME5E4pPVh4zRqiqoLv1M6skt2pnWjEEPyGMKSzMR7AkNixJvGCR5HSMpj9s9unWv8HruxLnTe" ], "script": "base64:BgImCAISAwoBARIFCgMIAQESBQoDCAEBEgMKAQgSBAoCCAESBAoCCAFNAAZFVUxFUjgA1onPgQEABU1VTFQ2AMCEPQAGTVVMVFg2CQC2AgEAwIQ9AAVNVUxUOACAwtcvAAZNVUxUWDgJALYCAQCAwtcvAAdNVUxUWDEwCQC2AgEAgMivoCUABk1VTFQxMgCAoJSljR0AB01VTFRYMTYJALYCAQCAgIT+pt7hEQAGTVVMVDE4CQC2AgEAgICQu7rWrfANAANTRVACAl9fAAdXQVZFU0lECQDZBAECBVdBVkVTARJrZXlOZXV0cmlub0Fzc2V0SWQAAhFuZXV0cmlub19hc3NldF9pZAEOa2V5TnNidEFzc2V0SWQAAg1ib25kX2Fzc2V0X2lkAQ5rZXlTdXJmQXNzZXRJZAACDXN1cmZfYXNzZXRfaWQBEGtleUJhbGFuY2VMb2NrZWQAAg1iYWxhbmNlX2xvY2tfARVrZXlXYXZlc0xvY2tlZEJhbGFuY2UACQCsAgIJARBrZXlCYWxhbmNlTG9ja2VkAAIFd2F2ZXMBGGtleU5ldXRyaW5vTG9ja2VkQmFsYW5jZQAJAKw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E9OTFkJAMwIAgULbGltaXRXYW50ZWQFA25pbAUDbmlsBApnTnNidERlbHRhCQBlAgULZ05zYnROZWVkZWQFDGdOc2J0Q3VycmVudAkAlAoCBQNuaWwJALkJAgkAzAgCAgQlcyVzCQDMCAIJAKQDAQUMZ05zYnRDdXJyZW50CQDMCAIJAKQDAQUKZ05zYnREZWx0YQUDbmlsBQNTRVAAabmkyg==", "chainId": 84, "height": 2179788, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8dS46fttEz7js7xeui9RhUqQLr8pvjMmbxe3uTH1h7XR Next: BPYC7byV8hCU8JMjDxPAdkkhE6HswjY57DPY4ri7CwLg Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let EULER8 = 271828182 | |
5 | 5 | ||
6 | 6 | let MULT6 = 1000000 | |
7 | 7 | ||
8 | 8 | let MULTX6 = toBigInt(1000000) | |
9 | 9 | ||
10 | 10 | let MULT8 = 100000000 | |
11 | 11 | ||
12 | 12 | let MULTX8 = toBigInt(100000000) | |
13 | 13 | ||
14 | 14 | let MULTX10 = toBigInt(10000000000) | |
15 | 15 | ||
16 | 16 | let MULT12 = 1000000000000 | |
17 | 17 | ||
18 | 18 | let MULTX16 = toBigInt(10000000000000000) | |
19 | 19 | ||
20 | 20 | let MULT18 = toBigInt(1000000000000000000) | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | 23 | ||
24 | 24 | let WAVESID = fromBase58String("WAVES") | |
25 | 25 | ||
26 | 26 | func keyNeutrinoAssetId () = "neutrino_asset_id" | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func keyNsbtAssetId () = "bond_asset_id" | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func keySurfAssetId () = "surf_asset_id" | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func keyBalanceLocked () = "balance_lock_" | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func keyWavesLockedBalance () = (keyBalanceLocked() + "waves") | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino") | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func keyMinWavesSwapAmount () = "min_waves_swap_amount" | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func keyMinNeutrinoSwapAmount () = "min_neutrino_swap_amount" | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func keyWavesOutFeePart () = "wavesOut_swap_feePart" | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func keyNeutrinoOutFeePart () = "neutrinoOut_swap_feePart" | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func keySwapAmountAParam () = "%s%s__config__swapAParam" | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func keySwapAmountBParam () = "%s%s__config__swapBParam" | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyNsbtLockContract () = "%s__nsbtLockContract" | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func keyMathContract () = "%s__mathContract" | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func keyBalanceWavesLockInterval () = "balance_waves_lock_interval" | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func keyBalanceNeutrinoLockInterval () = "balance_neutrino_lock_interval" | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func keyPrice () = "price" | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "start"], SEP) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func keyHalfLife () = "%s__halfLife" | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func keyMinLockAmount () = "%s__minLockAmount" | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func keyMinWavesForNsbtBuy () = "min_waves_nsbt_buy" | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func keyMinNsbtSell () = "min_nsbt_sell" | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func convertWavesToNeutrino (amount,price) = fraction(amount, price, MULT8) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func asAnyList (val) = match val { | |
108 | 108 | case valAnyList: List[Any] => | |
109 | 109 | valAnyList | |
110 | 110 | case _ => | |
111 | 111 | throw("fail to cast into List[Any]") | |
112 | 112 | } | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func asInt (val) = match val { | |
116 | 116 | case valInt: Int => | |
117 | 117 | valInt | |
118 | 118 | case _ => | |
119 | 119 | throw("fail to cast into Int") | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func asString (val) = match val { | |
124 | 124 | case valStr: String => | |
125 | 125 | valStr | |
126 | 126 | case _ => | |
127 | 127 | throw("fail to cast into String") | |
128 | 128 | } | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func asTuple2Ints (val) = match val { | |
132 | 132 | case v: (Int, Int) => | |
133 | 133 | v | |
134 | 134 | case _ => | |
135 | 135 | throw("fail to cast into Tuple2 ints") | |
136 | 136 | } | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func asSwapParamsSTRUCT (val) = match val { | |
140 | 140 | case struct: (Int, Int, Int, Int, Int) => | |
141 | 141 | struct | |
142 | 142 | case _ => | |
143 | 143 | throw("fail to cast into Tuple5 ints") | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func toTimestamp (start) = if ((0 > start)) | |
148 | 148 | then -1 | |
149 | 149 | else match blockInfoByHeight(start) { | |
150 | 150 | case block: BlockInfo => | |
151 | 151 | block.timestamp | |
152 | 152 | case _ => | |
153 | 153 | -1 | |
154 | 154 | } | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | let IdxControlCfgNeutrinoDapp = 1 | |
164 | 164 | ||
165 | 165 | let IdxControlCfgAuctionDapp = 2 | |
166 | 166 | ||
167 | 167 | let IdxControlCfgRpdDapp = 3 | |
168 | 168 | ||
169 | 169 | let IdxControlCfgMathDapp = 4 | |
170 | 170 | ||
171 | 171 | let IdxControlCfgLiquidationDapp = 5 | |
172 | 172 | ||
173 | 173 | let IdxControlCfgRestDapp = 6 | |
174 | 174 | ||
175 | 175 | let IdxControlCfgNodeRegistryDapp = 7 | |
176 | 176 | ||
177 | 177 | let IdxControlCfgNsbtStakingDapp = 8 | |
178 | 178 | ||
179 | 179 | let IdxControlCfgMediatorDapp = 9 | |
180 | 180 | ||
181 | 181 | let IdxControlCfgSurfStakingDapp = 10 | |
182 | 182 | ||
183 | 183 | let IdxControlCfgGnsbtControllerDapp = 11 | |
184 | 184 | ||
185 | 185 | func keyControlAddress () = "%s%s__config__controlAddress" | |
186 | 186 | ||
187 | 187 | ||
188 | 188 | func keyControlCfg () = "%s__controlConfig" | |
189 | 189 | ||
190 | 190 | ||
191 | 191 | func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP) | |
192 | 192 | ||
193 | 193 | ||
194 | 194 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
195 | 195 | ||
196 | 196 | ||
197 | 197 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
198 | 198 | ||
199 | 199 | let controlCfg = readControlCfgOrFail(controlContract) | |
200 | 200 | ||
201 | 201 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
202 | 202 | ||
203 | 203 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
204 | 204 | ||
205 | 205 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
206 | 206 | ||
207 | 207 | let liquidationContract = getContractAddressOrFail(controlCfg, IdxControlCfgLiquidationDapp) | |
208 | 208 | ||
209 | 209 | let rpdContract = getContractAddressOrFail(controlCfg, IdxControlCfgRpdDapp) | |
210 | 210 | ||
211 | 211 | let nsbtStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgNsbtStakingDapp) | |
212 | 212 | ||
213 | 213 | let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp) | |
214 | 214 | ||
215 | 215 | let gnsbtControllerContract = getContractAddressOrFail(controlCfg, IdxControlCfgGnsbtControllerDapp) | |
216 | 216 | ||
217 | 217 | let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId()) | |
218 | 218 | ||
219 | 219 | let neutrinoAssetId = fromBase58String(neutrinoAssetIdString) | |
220 | 220 | ||
221 | 221 | let nsbtAssetIdStr = getStringValue(neutrinoContract, keyNsbtAssetId()) | |
222 | 222 | ||
223 | 223 | let nsbtAssetId = fromBase58String(nsbtAssetIdStr) | |
224 | 224 | ||
225 | 225 | let surfAssetIdStr = getStringValue(auctionContract, keySurfAssetId()) | |
226 | 226 | ||
227 | 227 | let surfAssetId = fromBase58String(surfAssetIdStr) | |
228 | 228 | ||
229 | 229 | @Callable(i) | |
230 | 230 | func reverseSwapLimitREADONLY (lim) = { | |
231 | 231 | let gNsbt = if ((0 >= lim)) | |
232 | 232 | then 0 | |
233 | 233 | else { | |
234 | 234 | let aParamX8 = toBigInt(getIntOrFail(mathContract, keySwapAmountAParam())) | |
235 | 235 | let bParamX16 = toBigInt(getIntOrFail(mathContract, keySwapAmountBParam())) | |
236 | 236 | let limDivAX8 = fraction(toBigInt(lim), MULTX10, aParamX8) | |
237 | 237 | let revBX16 = fraction(MULTX16, MULTX16, bParamX16) | |
238 | 238 | toInt(pow(limDivAX8, 8, revBX16, 16, 6, CEILING)) | |
239 | 239 | } | |
240 | 240 | $Tuple2(nil, gNsbt) | |
241 | 241 | } | |
242 | 242 | ||
243 | 243 | ||
244 | 244 | ||
245 | 245 | @Callable(i) | |
246 | 246 | func gnsbtInfoINTERNAL (userAddressStrOrEmpty,additionalNsbtToStakeOrZero,additionalSurfToStakeOrZero) = { | |
247 | 247 | let userAddressOrThis = if ((userAddressStrOrEmpty != "")) | |
248 | 248 | then addressFromStringValue(userAddressStrOrEmpty) | |
249 | 249 | else this | |
250 | 250 | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
251 | 251 | let gnsbtFromNsbtDiff = additionalNsbtToStakeOrZero | |
252 | 252 | let gnsbtFromSurfDiff = asInt(invoke(surfStakingContract, "gnsbtFromSurfSYSREADONLY", [additionalSurfToStakeOrZero], nil)) | |
253 | 253 | let gNsbtDiff = (gnsbtFromNsbtDiff + gnsbtFromSurfDiff) | |
254 | 254 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
255 | 255 | let limitMaxUsdn = swapParamsTuple._1 | |
256 | 256 | let limitSpent = swapParamsTuple._2 | |
257 | 257 | let blcks2LmtReset = swapParamsTuple._3 | |
258 | 258 | let gnsbtAmt = swapParamsTuple._4 | |
259 | 259 | let gnsbtAmtTotal = swapParamsTuple._5 | |
260 | 260 | let swapParamsTupleNEW = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, gNsbtDiff], nil)) | |
261 | 261 | let limitMaxUsdnNEW = swapParamsTupleNEW._1 | |
262 | 262 | let limitSpentNEW = swapParamsTupleNEW._2 | |
263 | 263 | let blcks2LmtResetNEW = swapParamsTupleNEW._3 | |
264 | 264 | let gnsbtAmtNEW = swapParamsTupleNEW._4 | |
265 | 265 | let gnsbtAmtTotalNEW = swapParamsTupleNEW._5 | |
266 | 266 | let limitMaxWaves = convertNeutrinoToWaves(limitMaxUsdn, currentPrice) | |
267 | 267 | let limitMaxWavesNEW = convertNeutrinoToWaves(limitMaxUsdnNEW, currentPrice) | |
268 | 268 | let nsbtBalance = if ((userAddressStrOrEmpty != "")) | |
269 | 269 | then assetBalance(userAddressOrThis, nsbtAssetId) | |
270 | 270 | else 0 | |
271 | 271 | let surfBalance = if ((userAddressStrOrEmpty != "")) | |
272 | 272 | then assetBalance(userAddressOrThis, surfAssetId) | |
273 | 273 | else 0 | |
274 | 274 | let nsbtBalanceDiff = if ((additionalNsbtToStakeOrZero >= 0)) | |
275 | 275 | then additionalNsbtToStakeOrZero | |
276 | 276 | else { | |
277 | 277 | let nsbtUnstakingData = asAnyList(invoke(nsbtStakingContract, "nsbtUnstakingSYSREADONLY", [userAddressStrOrEmpty, (-1 * additionalNsbtToStakeOrZero)], nil)) | |
278 | 278 | let nsbtReceiveAmount = asInt(nsbtUnstakingData[2]) | |
279 | 279 | let result = -(nsbtReceiveAmount) | |
280 | 280 | result | |
281 | 281 | } | |
282 | 282 | let nsbtBalanceNew = (nsbtBalance - nsbtBalanceDiff) | |
283 | 283 | let surfBalanceNew = (surfBalance - additionalSurfToStakeOrZero) | |
284 | 284 | let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStrOrEmpty, additionalNsbtToStakeOrZero, additionalSurfToStakeOrZero], nil)) | |
285 | 285 | let gnsbtUser = asInt(gnsbtData[0]) | |
286 | 286 | let gnsbtTotal = asInt(gnsbtData[1]) | |
287 | 287 | let nsbtData = asAnyList(gnsbtData[2]) | |
288 | 288 | let surfData = asAnyList(gnsbtData[3]) | |
289 | 289 | let vpEffectiveHeight = asInt(gnsbtData[4]) | |
290 | 290 | let vpEffectiveHeightNEW = asInt(gnsbtData[5]) | |
291 | 291 | let gnsbtAmtFromNsbt = asInt(nsbtData[2]) | |
292 | 292 | let gnsbtAmtFromSurf = asInt(surfData[2]) | |
293 | 293 | let gnsbtAmtFromNsbtNEW = (gnsbtAmtFromNsbt + gnsbtFromNsbtDiff) | |
294 | 294 | let gnsbtAmtFromSurfNEW = (gnsbtAmtFromSurf + gnsbtFromSurfDiff) | |
295 | 295 | let gnsbtFromNsbtTotal = asInt(nsbtData[3]) | |
296 | 296 | let gnsbtFromSurfTotal = asInt(surfData[3]) | |
297 | 297 | let gnsbtFromSurfActiveTotal = 0 | |
298 | 298 | let gnsbtFromSurfFrozenTotal = gnsbtFromSurfTotal | |
299 | 299 | let gnsbtFromNsbtTotalNEW = (gnsbtFromNsbtTotal + gnsbtFromNsbtDiff) | |
300 | 300 | let gnsbtFromSurfTotalNEW = (gnsbtFromSurfTotal + gnsbtFromSurfDiff) | |
301 | 301 | let gnsbtFromSurfFrozenTotalNEW = gnsbtFromSurfTotalNEW | |
302 | 302 | let votingPower = fraction(gnsbtAmtFromNsbt, MULT8, (gnsbtFromNsbtTotal + gnsbtFromSurfActiveTotal)) | |
303 | 303 | let votingPowerNew = fraction(gnsbtAmtFromNsbtNEW, MULT8, (gnsbtFromNsbtTotalNEW + gnsbtFromSurfActiveTotal)) | |
304 | 304 | let votingPowerMax = fraction((gnsbtAmtFromNsbt + gnsbtAmtFromSurf), MULT8, ((gnsbtFromNsbtTotal + gnsbtFromSurfActiveTotal) + gnsbtFromSurfFrozenTotal)) | |
305 | 305 | let votingPowerMaxNew = fraction((gnsbtAmtFromNsbtNEW + gnsbtAmtFromSurfNEW), MULT8, ((gnsbtFromNsbtTotalNEW + gnsbtFromSurfActiveTotal) + gnsbtFromSurfFrozenTotalNEW)) | |
306 | 306 | let votingPowerEta = if ((vpEffectiveHeight == 0)) | |
307 | 307 | then height | |
308 | 308 | else vpEffectiveHeight | |
309 | 309 | let votingPowerEtaNew = if ((vpEffectiveHeightNEW == 0)) | |
310 | 310 | then height | |
311 | 311 | else vpEffectiveHeightNEW | |
312 | 312 | $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]) | |
313 | 313 | } | |
314 | 314 | ||
315 | 315 | ||
316 | 316 | ||
317 | 317 | @Callable(i) | |
318 | 318 | func gnsbtInfoREADONLY (userAddressStrOrEmpty,additionalNsbtToStakeOrZero,additionalSurfToStakeOrZero) = { | |
319 | 319 | let gnsbtInfoDATA = asAnyList(invoke(this, "gnsbtInfoINTERNAL", [userAddressStrOrEmpty, additionalNsbtToStakeOrZero, additionalSurfToStakeOrZero], nil)) | |
320 | 320 | $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)) | |
321 | 321 | } | |
322 | 322 | ||
323 | 323 | ||
324 | 324 | ||
325 | 325 | @Callable(i) | |
326 | 326 | func rewardInfoREADONLY (userAddressStrOrEmpty) = { | |
327 | 327 | let rewardsData = asAnyList(invoke(gnsbtControllerContract, "gnsbtRewardsSYSREADONLY", [userAddressStrOrEmpty], nil)) | |
328 | 328 | $Tuple2(nil, makeString(["%s%s", asString(rewardsData[0]), asString(rewardsData[1])], SEP)) | |
329 | 329 | } | |
330 | 330 | ||
331 | 331 | ||
332 | 332 | ||
333 | 333 | @Callable(i) | |
334 | 334 | func mergeNsbtREADONLY (userAddressMandatory,newAmount) = { | |
335 | 335 | let nsbtData = asAnyList(invoke(nsbtStakingContract, "nsbtStakingSYSREADONLY", [userAddressMandatory, newAmount], nil)) | |
336 | 336 | let amount0 = asInt(nsbtData[0]) | |
337 | 337 | let startHeight = if ((0 >= amount0)) | |
338 | 338 | then -1 | |
339 | 339 | else asInt(nsbtData[2]) | |
340 | 340 | let startTimestamp = toTimestamp(startHeight) | |
341 | 341 | let startHeightNew = if ((0 >= newAmount)) | |
342 | 342 | then startHeight | |
343 | 343 | else { | |
344 | 344 | let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife()) | |
345 | 345 | asInt(invoke(mathContract, "mergeStakesREADONLY", [amount0, startHeight, newAmount, height, halfLife], nil)) | |
346 | 346 | } | |
347 | 347 | let startTimestampNew = toTimestamp(startHeightNew) | |
348 | 348 | $Tuple2(nil, makeString(["%d%d%d%d", toString(startHeight), toString(startTimestamp), toString(startHeightNew), toString(startTimestampNew)], SEP)) | |
349 | 349 | } | |
350 | 350 | ||
351 | 351 | ||
352 | 352 | ||
353 | 353 | @Callable(i) | |
354 | 354 | func swapLimitCalculatorREADONLY (userAddressStrOpt,limitWanted) = { | |
355 | 355 | let gNsbtCurrent = if ((userAddressStrOpt == "")) | |
356 | 356 | then 0 | |
357 | 357 | else asInt(asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOpt, 0], nil))._4) | |
358 | 358 | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWanted], nil)) | |
359 | 359 | let gNsbtDelta = (gNsbtNeeded - gNsbtCurrent) | |
360 | 360 | $Tuple2(nil, makeString(["%s%s", toString(gNsbtCurrent), toString(gNsbtDelta)], SEP)) | |
361 | 361 | } | |
362 | 362 | ||
363 | 363 |
github/deemru/w8io/026f985 53.73 ms ◑