tx · BPYC7byV8hCU8JMjDxPAdkkhE6HswjY57DPY4ri7CwLg 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh: -0.04000000 Waves 2022.08.15 12:06 [2185377] smart account 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh > SELF 0.00000000 Waves
{ "type": 13, "id": "BPYC7byV8hCU8JMjDxPAdkkhE6HswjY57DPY4ri7CwLg", "fee": 4000000, "feeAssetId": null, "timestamp": 1660554428936, "version": 1, "sender": "3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh", "senderPublicKey": "HiTi1JT7GQRqLNxg4yZhD1mV42y1Mv2AYvRx92JQRbwX", "proofs": [ "ai7ypCJb9ygc73VJv46vtzPWCabEW5izfzbdkjQMpG66c5jC7HPq8MAbg1WWaHXKcDqsMuTayBjXWY7zEA3oVuT" ], "script": "base64:BgInCAISAwoBARIFCgMIAQESBQoDCAEBEgMKAQgSBAoCCAESBQoDCAEITQAGRVVMRVI4ANaJz4EBAAVNVUxUNgDAhD0ABk1VTFRYNgkAtgIBAMCEPQAFTVVMVDgAgMLXLwAGTVVMVFg4CQC2AgEAgMLXLwAHTVVMVFgxMAkAtgIBAIDIr6AlAAZNVUxUMTIAgKCUpY0dAAdNVUxUWDE2CQC2AgEAgICE/qbe4REABk1VTFQxOAkAtgIBAICAkLu61q3wDQADU0VQAgJfXwAHV0FWRVNJRAkA2QQBAgVXQVZFUwESa2V5TmV1dHJpbm9Bc3NldElkAAIRbmV1dHJpbm9fYXNzZXRfaWQBDmtleU5zYnRBc3NldElkAAINYm9uZF9hc3NldF9pZAEOa2V5U3VyZkFzc2V0SWQAAg1zdXJmX2Fzc2V0X2lkARBrZXlCYWxhbmNlTG9ja2VkAAINYmFsYW5jZV9sb2NrXwEVa2V5V2F2ZXNMb2NrZWRCYWxhbmNlAAkArAICCQEQa2V5QmFsYW5jZUxvY2tlZAACBXdhdmVzARhrZXlOZXV0cmlub0xvY2tlZEJhbGFuY2UACQCsAgIJ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NTApAgUPY29udHJvbENvbnRyYWN0CQEIa2V5UHJpY2UABQtsaW1pdFdhbnRlZAQLZ05zYnROZWVkZWQJAQVhc0ludAEJAPwHBAUEdGhpcwIYcmV2ZXJzZVN3YXBMaW1pdFJFQURPTkxZCQDMCAIFD2xpbWl0V2FudGVkVXNkbgUDbmlsBQNuaWwECmdOc2J0RGVsdGEJAGUCBQtnTnNidE5lZWRlZAUMZ05zYnRDdXJyZW50CQCUCgIFA25pbAkAuQkCCQDMCAICBCVzJXMJAMwIAgkApAMBBQxnTnNidEN1cnJlbnQJAMwIAgkApAMBBQpnTnNidERlbHRhBQNuaWwFA1NFUAA5J0N/", "chainId": 84, "height": 2185377, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3kvi8PPiuoLt2QVHA4ErwLBq8iK6G7XhNAabzn8WFvUz Next: BrB2GWcz86YLVmAHaAB9RWrsu2ASrCbzoZm6rMtgqLG7 Diff:
Old | New | Differences | |
---|---|---|---|
351 | 351 | ||
352 | 352 | ||
353 | 353 | @Callable(i) | |
354 | - | func swapLimitCalculatorREADONLY (userAddressStrOpt,limitWanted) = { | |
354 | + | func swapLimitCalculatorREADONLY (userAddressStrOpt,limitWanted,assetIdStr) = { | |
355 | 355 | let gNsbtCurrent = if ((userAddressStrOpt == "")) | |
356 | 356 | then 0 | |
357 | 357 | else asInt(asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOpt, 0], nil))._4) | |
358 | - | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWanted], nil)) | |
358 | + | let limitWantedUsdn = if ((assetIdStr == "WAVES")) | |
359 | + | then (limitWanted * getIntegerValue(controlContract, keyPrice())) | |
360 | + | else limitWanted | |
361 | + | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn], nil)) | |
359 | 362 | let gNsbtDelta = (gNsbtNeeded - gNsbtCurrent) | |
360 | 363 | $Tuple2(nil, makeString(["%s%s", toString(gNsbtCurrent), toString(gNsbtDelta)], SEP)) | |
361 | 364 | } |
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 | - | func swapLimitCalculatorREADONLY (userAddressStrOpt,limitWanted) = { | |
354 | + | func swapLimitCalculatorREADONLY (userAddressStrOpt,limitWanted,assetIdStr) = { | |
355 | 355 | let gNsbtCurrent = if ((userAddressStrOpt == "")) | |
356 | 356 | then 0 | |
357 | 357 | else asInt(asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOpt, 0], nil))._4) | |
358 | - | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWanted], nil)) | |
358 | + | let limitWantedUsdn = if ((assetIdStr == "WAVES")) | |
359 | + | then (limitWanted * getIntegerValue(controlContract, keyPrice())) | |
360 | + | else limitWanted | |
361 | + | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn], nil)) | |
359 | 362 | let gNsbtDelta = (gNsbtNeeded - gNsbtCurrent) | |
360 | 363 | $Tuple2(nil, makeString(["%s%s", toString(gNsbtCurrent), toString(gNsbtDelta)], SEP)) | |
361 | 364 | } | |
362 | 365 | ||
363 | 366 |
github/deemru/w8io/026f985 292.59 ms ◑