tx · 4YgSGVZwbca4HfimSHJ6dvaLUfAMKTdMLQGfi5nU4rRb 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh: -0.04000000 Waves 2022.08.23 14:58 [2197101] smart account 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh > SELF 0.00000000 Waves
{ "type": 13, "id": "4YgSGVZwbca4HfimSHJ6dvaLUfAMKTdMLQGfi5nU4rRb", "fee": 4000000, "feeAssetId": null, "timestamp": 1661256053081, "version": 1, "sender": "3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh", "senderPublicKey": "HiTi1JT7GQRqLNxg4yZhD1mV42y1Mv2AYvRx92JQRbwX", "proofs": [ "KGHAUon3u5DgFLFbVnZSXwCk1sHznzJU8gDHjdLEKYwnSKPXteMcXJfjJ4rcg9Djq2cvcLQA8x4iW6k8cpFUwUP" ], "script": "base64:BgIuCAISAwoBARIFCgMIAQESBQoDCAEBEgMKAQgSBAoCCAESBQoDCAEIEgUKAwgBCGgABkVVTEVSOADWic+BAQAFTVVMVDYAwIQ9AAZNVUxUWDYJALYCAQDAhD0ABU1VTFQ4AIDC1y8ABk1VTFRYOAkAtgIBAIDC1y8AB01VTFRYMTAJALYCAQCAyK+gJQAGTVVMVDEyAICglKWNHQAHTVVMVFgxNgkAtgIBAICAhP6m3uERAAZNVUxUMTgJALYCAQCAgJC7utat8A0AA1NFUAICX18AEURFRkFVTFRTV0FQRkVFTjJXAIgnABFERUZBVUxUU1dBUEZFRVcyTgCgnAEAC0JSUFJPVEVDVEVEAKCNBgAHV0FWRVNJRAkA2QQBAgVXQVZFUwESa2V5TmV1dHJpbm9Bc3NldElkAAIRbmV1dHJpbm9fYXNzZXRfaWQBDmtleU5zYnRBc3NldElkAAINYm9uZF9hc3NldF9pZAEOa2V5U3VyZkFzc2V0SWQAAg1zdXJmX2Fzc2V0X2lkARBrZXlCYWxhbmNlTG9ja2VkAAINYmFsYW5jZV9sb2NrXwEVa2V5V2F2ZXNMb2NrZ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vbnRyYWN0Ah1jYWxjV2l0aGRyYXdSZXN1bHRTWVNSRUFET05MWQkAzAgCBQhzd2FwVHlwZQkAzAgCBQZhbW91bnQJAMwIAgUFcHJpY2UFA25pbAUDbmlsBAxvdXROZXRBbW91bnQIBQ13aXRoZHJhd1R1cGxlAl8xBApvdXRBc3NldElkCAUNd2l0aGRyYXdUdXBsZQJfMgQKb3V0U3VyZkFtdAgFDXdpdGhkcmF3VHVwbGUCXzMED2luQW10VG9TdXJmUGFydAgFDXdpdGhkcmF3VHVwbGUCXzQECnVubGVhc2VBbXQIBQ13aXRoZHJhd1R1cGxlAl81BAxvdXRGZWVBbW91bnQIBQ13aXRoZHJhd1R1cGxlAl82BAtvdXRBbXRHcm9zcwgFDXdpdGhkcmF3VHVwbGUCXzcJAJQKAgUDbmlsCQC5CQIJAMwIAgIOJWQlZCVkJWQlZCVkJWQJAMwIAgkApAMBBQxvdXROZXRBbW91bnQJAMwIAgkApAMBBQpvdXRTdXJmQW10CQDMCAIJAKQDAQUMb3V0RmVlQW1vdW50CQDMCAIJAKQDAQUFcHJpY2UJAMwIAgkApAMBBQ5ibGNrczJMbXRSZXNldAkAzAgCCQCkAwEFDWxpbWl0TWF4V2F2ZXMJAMwIAgkApAMBBQxsaW1pdE1heFVzZG4FA25pbAUDU0VQAOUCsGA=", "chainId": 84, "height": 2197101, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BrB2GWcz86YLVmAHaAB9RWrsu2ASrCbzoZm6rMtgqLG7 Next: 3CtyKjMEYhTH2qrnCL5CRR9ecg3R3aUZwtNRJ8L78RdL Diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | let MULT18 = toBigInt(1000000000000000000) | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | + | ||
24 | + | let DEFAULTSWAPFEEN2W = 5000 | |
25 | + | ||
26 | + | let DEFAULTSWAPFEEW2N = 20000 | |
27 | + | ||
28 | + | let BRPROTECTED = 100000 | |
23 | 29 | ||
24 | 30 | let WAVESID = fromBase58String("WAVES") | |
25 | 31 | ||
137 | 143 | ||
138 | 144 | ||
139 | 145 | func asSwapParamsSTRUCT (val) = match val { | |
140 | - | case struct: (Int, Int, Int, Int, Int) => | |
146 | + | case struct: (Int, Int, Int, Int, Int, Int, Int) => | |
141 | 147 | struct | |
142 | 148 | case _ => | |
143 | - | throw("fail to cast into Tuple5 ints") | |
149 | + | throw("fail to cast into SwapParamsSTRUCT") | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | func asWithdrawResultSTRUCT (val) = match val { | |
154 | + | case struct: (Int, Unit, Int, Int, Int, Int, Int)|(Int, ByteVector, Int, Int, Int, Int, Int) => | |
155 | + | struct | |
156 | + | case _ => | |
157 | + | throw("fail to cast into WithdrawResult") | |
144 | 158 | } | |
145 | 159 | ||
146 | 160 | ||
159 | 173 | ||
160 | 174 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
161 | 175 | ||
176 | + | ||
177 | + | let nMetricIdxPrice = 0 | |
178 | + | ||
179 | + | let nMetricIdxUsdnLockedBalance = 1 | |
180 | + | ||
181 | + | let nMetricIdxWavesLockedBalance = 2 | |
182 | + | ||
183 | + | let nMetricIdxReserve = 3 | |
184 | + | ||
185 | + | let nMetricIdxReserveInUsdn = 4 | |
186 | + | ||
187 | + | let nMetricIdxUsdnSupply = 5 | |
188 | + | ||
189 | + | let nMetricIdxSurplus = 6 | |
190 | + | ||
191 | + | let nMetricIdxSurplusPercent = 7 | |
192 | + | ||
193 | + | let nMetricIdxBR = 8 | |
194 | + | ||
195 | + | let nMetricIdxNsbtSupply = 9 | |
196 | + | ||
197 | + | let nMetricIdxMaxNsbtSupply = 10 | |
198 | + | ||
199 | + | let nMetricIdxSurfSupply = 11 | |
162 | 200 | ||
163 | 201 | let IdxControlCfgNeutrinoDapp = 1 | |
164 | 202 | ||
181 | 219 | let IdxControlCfgSurfStakingDapp = 10 | |
182 | 220 | ||
183 | 221 | let IdxControlCfgGnsbtControllerDapp = 11 | |
222 | + | ||
223 | + | let bFuncIdxSurf = 0 | |
224 | + | ||
225 | + | let bFuncIdxWaves = 1 | |
226 | + | ||
227 | + | let bFuncIdxUsdn = 2 | |
228 | + | ||
229 | + | let bFuncIdxReserveStart = 3 | |
230 | + | ||
231 | + | let bFuncIdxSupplyStart = 4 | |
232 | + | ||
233 | + | let bFuncIdxBRStart = 5 | |
234 | + | ||
235 | + | let bFuncIdxReserveEnd = 6 | |
236 | + | ||
237 | + | let bFuncIdxSupplyEnd = 7 | |
238 | + | ||
239 | + | let bFuncIdxBREnd = 8 | |
240 | + | ||
241 | + | let bFuncIdxRest = 9 | |
242 | + | ||
243 | + | let bFuncIdxWavesPrice = 10 | |
184 | 244 | ||
185 | 245 | func keyControlAddress () = "%s%s__config__controlAddress" | |
186 | 246 | ||
252 | 312 | let gnsbtFromSurfDiff = asInt(invoke(surfStakingContract, "gnsbtFromSurfSYSREADONLY", [additionalSurfToStakeOrZero], nil)) | |
253 | 313 | let gNsbtDiff = (gnsbtFromNsbtDiff + gnsbtFromSurfDiff) | |
254 | 314 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
255 | - | let limitMaxUsdn = swapParamsTuple._1 | |
256 | - | let limitSpent = swapParamsTuple._2 | |
257 | 315 | let blcks2LmtReset = swapParamsTuple._3 | |
258 | 316 | let gnsbtAmt = swapParamsTuple._4 | |
259 | 317 | let gnsbtAmtTotal = swapParamsTuple._5 | |
318 | + | let limitMaxWaves = swapParamsTuple._6 | |
319 | + | let limitMaxUsdn = swapParamsTuple._7 | |
260 | 320 | let swapParamsTupleNEW = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, gNsbtDiff], nil)) | |
261 | - | let limitMaxUsdnNEW = swapParamsTupleNEW._1 | |
262 | - | let limitSpentNEW = swapParamsTupleNEW._2 | |
263 | 321 | let blcks2LmtResetNEW = swapParamsTupleNEW._3 | |
264 | 322 | let gnsbtAmtNEW = swapParamsTupleNEW._4 | |
265 | 323 | let gnsbtAmtTotalNEW = swapParamsTupleNEW._5 | |
266 | - | let | |
267 | - | let | |
324 | + | let limitMaxWavesNEW = swapParamsTupleNEW._6 | |
325 | + | let limitMaxUsdnNEW = swapParamsTupleNEW._7 | |
268 | 326 | let nsbtBalance = if ((userAddressStrOrEmpty != "")) | |
269 | 327 | then assetBalance(userAddressOrThis, nsbtAssetId) | |
270 | 328 | else 0 | |
364 | 422 | } | |
365 | 423 | ||
366 | 424 | ||
425 | + | ||
426 | + | @Callable(i) | |
427 | + | func swapInfoREADONLY (userAddressStrOrEmpty,amount,assetIdStr) = { | |
428 | + | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
429 | + | let price = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
430 | + | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
431 | + | let blcks2LmtReset = swapParamsTuple._3 | |
432 | + | let limitMaxWaves = swapParamsTuple._6 | |
433 | + | let limitMaxUsdn = swapParamsTuple._7 | |
434 | + | let assetId = fromBase58String(assetIdStr) | |
435 | + | let swapType = if ((assetId == WAVESID)) | |
436 | + | then "waves" | |
437 | + | else if ((assetId == neutrinoAssetId)) | |
438 | + | then "neutrino" | |
439 | + | else throw(("Can't swap assetId=" + assetIdStr)) | |
440 | + | let withdrawTuple = asWithdrawResultSTRUCT(invoke(neutrinoContract, "calcWithdrawResultSYSREADONLY", [swapType, amount, price], nil)) | |
441 | + | let outNetAmount = withdrawTuple._1 | |
442 | + | let outAssetId = withdrawTuple._2 | |
443 | + | let outSurfAmt = withdrawTuple._3 | |
444 | + | let inAmtToSurfPart = withdrawTuple._4 | |
445 | + | let unleaseAmt = withdrawTuple._5 | |
446 | + | let outFeeAmount = withdrawTuple._6 | |
447 | + | let outAmtGross = withdrawTuple._7 | |
448 | + | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(price), toString(blcks2LmtReset), toString(limitMaxWaves), toString(limitMaxUsdn)], SEP)) | |
449 | + | } | |
450 | + | ||
451 | + |
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 | + | ||
24 | + | let DEFAULTSWAPFEEN2W = 5000 | |
25 | + | ||
26 | + | let DEFAULTSWAPFEEW2N = 20000 | |
27 | + | ||
28 | + | let BRPROTECTED = 100000 | |
23 | 29 | ||
24 | 30 | let WAVESID = fromBase58String("WAVES") | |
25 | 31 | ||
26 | 32 | func keyNeutrinoAssetId () = "neutrino_asset_id" | |
27 | 33 | ||
28 | 34 | ||
29 | 35 | func keyNsbtAssetId () = "bond_asset_id" | |
30 | 36 | ||
31 | 37 | ||
32 | 38 | func keySurfAssetId () = "surf_asset_id" | |
33 | 39 | ||
34 | 40 | ||
35 | 41 | func keyBalanceLocked () = "balance_lock_" | |
36 | 42 | ||
37 | 43 | ||
38 | 44 | func keyWavesLockedBalance () = (keyBalanceLocked() + "waves") | |
39 | 45 | ||
40 | 46 | ||
41 | 47 | func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino") | |
42 | 48 | ||
43 | 49 | ||
44 | 50 | func keyMinWavesSwapAmount () = "min_waves_swap_amount" | |
45 | 51 | ||
46 | 52 | ||
47 | 53 | func keyMinNeutrinoSwapAmount () = "min_neutrino_swap_amount" | |
48 | 54 | ||
49 | 55 | ||
50 | 56 | func keyWavesOutFeePart () = "wavesOut_swap_feePart" | |
51 | 57 | ||
52 | 58 | ||
53 | 59 | func keyNeutrinoOutFeePart () = "neutrinoOut_swap_feePart" | |
54 | 60 | ||
55 | 61 | ||
56 | 62 | func keySwapAmountAParam () = "%s%s__config__swapAParam" | |
57 | 63 | ||
58 | 64 | ||
59 | 65 | func keySwapAmountBParam () = "%s%s__config__swapBParam" | |
60 | 66 | ||
61 | 67 | ||
62 | 68 | func keyNsbtLockContract () = "%s__nsbtLockContract" | |
63 | 69 | ||
64 | 70 | ||
65 | 71 | func keyMathContract () = "%s__mathContract" | |
66 | 72 | ||
67 | 73 | ||
68 | 74 | func keyBalanceWavesLockInterval () = "balance_waves_lock_interval" | |
69 | 75 | ||
70 | 76 | ||
71 | 77 | func keyBalanceNeutrinoLockInterval () = "balance_neutrino_lock_interval" | |
72 | 78 | ||
73 | 79 | ||
74 | 80 | func keyPrice () = "price" | |
75 | 81 | ||
76 | 82 | ||
77 | 83 | func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "start"], SEP) | |
78 | 84 | ||
79 | 85 | ||
80 | 86 | func keyHalfLife () = "%s__halfLife" | |
81 | 87 | ||
82 | 88 | ||
83 | 89 | func keyMinLockAmount () = "%s__minLockAmount" | |
84 | 90 | ||
85 | 91 | ||
86 | 92 | func keyMinWavesForNsbtBuy () = "min_waves_nsbt_buy" | |
87 | 93 | ||
88 | 94 | ||
89 | 95 | func keyMinNsbtSell () = "min_nsbt_sell" | |
90 | 96 | ||
91 | 97 | ||
92 | 98 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
93 | 99 | ||
94 | 100 | ||
95 | 101 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
96 | 102 | ||
97 | 103 | ||
98 | 104 | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
99 | 105 | ||
100 | 106 | ||
101 | 107 | func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price) | |
102 | 108 | ||
103 | 109 | ||
104 | 110 | func convertWavesToNeutrino (amount,price) = fraction(amount, price, MULT8) | |
105 | 111 | ||
106 | 112 | ||
107 | 113 | func asAnyList (val) = match val { | |
108 | 114 | case valAnyList: List[Any] => | |
109 | 115 | valAnyList | |
110 | 116 | case _ => | |
111 | 117 | throw("fail to cast into List[Any]") | |
112 | 118 | } | |
113 | 119 | ||
114 | 120 | ||
115 | 121 | func asInt (val) = match val { | |
116 | 122 | case valInt: Int => | |
117 | 123 | valInt | |
118 | 124 | case _ => | |
119 | 125 | throw("fail to cast into Int") | |
120 | 126 | } | |
121 | 127 | ||
122 | 128 | ||
123 | 129 | func asString (val) = match val { | |
124 | 130 | case valStr: String => | |
125 | 131 | valStr | |
126 | 132 | case _ => | |
127 | 133 | throw("fail to cast into String") | |
128 | 134 | } | |
129 | 135 | ||
130 | 136 | ||
131 | 137 | func asTuple2Ints (val) = match val { | |
132 | 138 | case v: (Int, Int) => | |
133 | 139 | v | |
134 | 140 | case _ => | |
135 | 141 | throw("fail to cast into Tuple2 ints") | |
136 | 142 | } | |
137 | 143 | ||
138 | 144 | ||
139 | 145 | func asSwapParamsSTRUCT (val) = match val { | |
140 | - | case struct: (Int, Int, Int, Int, Int) => | |
146 | + | case struct: (Int, Int, Int, Int, Int, Int, Int) => | |
141 | 147 | struct | |
142 | 148 | case _ => | |
143 | - | throw("fail to cast into Tuple5 ints") | |
149 | + | throw("fail to cast into SwapParamsSTRUCT") | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | func asWithdrawResultSTRUCT (val) = match val { | |
154 | + | case struct: (Int, Unit, Int, Int, Int, Int, Int)|(Int, ByteVector, Int, Int, Int, Int, Int) => | |
155 | + | struct | |
156 | + | case _ => | |
157 | + | throw("fail to cast into WithdrawResult") | |
144 | 158 | } | |
145 | 159 | ||
146 | 160 | ||
147 | 161 | func toTimestamp (start) = if ((0 > start)) | |
148 | 162 | then -1 | |
149 | 163 | else match blockInfoByHeight(start) { | |
150 | 164 | case block: BlockInfo => | |
151 | 165 | block.timestamp | |
152 | 166 | case _ => | |
153 | 167 | -1 | |
154 | 168 | } | |
155 | 169 | ||
156 | 170 | ||
157 | 171 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
158 | 172 | ||
159 | 173 | ||
160 | 174 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
161 | 175 | ||
176 | + | ||
177 | + | let nMetricIdxPrice = 0 | |
178 | + | ||
179 | + | let nMetricIdxUsdnLockedBalance = 1 | |
180 | + | ||
181 | + | let nMetricIdxWavesLockedBalance = 2 | |
182 | + | ||
183 | + | let nMetricIdxReserve = 3 | |
184 | + | ||
185 | + | let nMetricIdxReserveInUsdn = 4 | |
186 | + | ||
187 | + | let nMetricIdxUsdnSupply = 5 | |
188 | + | ||
189 | + | let nMetricIdxSurplus = 6 | |
190 | + | ||
191 | + | let nMetricIdxSurplusPercent = 7 | |
192 | + | ||
193 | + | let nMetricIdxBR = 8 | |
194 | + | ||
195 | + | let nMetricIdxNsbtSupply = 9 | |
196 | + | ||
197 | + | let nMetricIdxMaxNsbtSupply = 10 | |
198 | + | ||
199 | + | let nMetricIdxSurfSupply = 11 | |
162 | 200 | ||
163 | 201 | let IdxControlCfgNeutrinoDapp = 1 | |
164 | 202 | ||
165 | 203 | let IdxControlCfgAuctionDapp = 2 | |
166 | 204 | ||
167 | 205 | let IdxControlCfgRpdDapp = 3 | |
168 | 206 | ||
169 | 207 | let IdxControlCfgMathDapp = 4 | |
170 | 208 | ||
171 | 209 | let IdxControlCfgLiquidationDapp = 5 | |
172 | 210 | ||
173 | 211 | let IdxControlCfgRestDapp = 6 | |
174 | 212 | ||
175 | 213 | let IdxControlCfgNodeRegistryDapp = 7 | |
176 | 214 | ||
177 | 215 | let IdxControlCfgNsbtStakingDapp = 8 | |
178 | 216 | ||
179 | 217 | let IdxControlCfgMediatorDapp = 9 | |
180 | 218 | ||
181 | 219 | let IdxControlCfgSurfStakingDapp = 10 | |
182 | 220 | ||
183 | 221 | let IdxControlCfgGnsbtControllerDapp = 11 | |
222 | + | ||
223 | + | let bFuncIdxSurf = 0 | |
224 | + | ||
225 | + | let bFuncIdxWaves = 1 | |
226 | + | ||
227 | + | let bFuncIdxUsdn = 2 | |
228 | + | ||
229 | + | let bFuncIdxReserveStart = 3 | |
230 | + | ||
231 | + | let bFuncIdxSupplyStart = 4 | |
232 | + | ||
233 | + | let bFuncIdxBRStart = 5 | |
234 | + | ||
235 | + | let bFuncIdxReserveEnd = 6 | |
236 | + | ||
237 | + | let bFuncIdxSupplyEnd = 7 | |
238 | + | ||
239 | + | let bFuncIdxBREnd = 8 | |
240 | + | ||
241 | + | let bFuncIdxRest = 9 | |
242 | + | ||
243 | + | let bFuncIdxWavesPrice = 10 | |
184 | 244 | ||
185 | 245 | func keyControlAddress () = "%s%s__config__controlAddress" | |
186 | 246 | ||
187 | 247 | ||
188 | 248 | func keyControlCfg () = "%s__controlConfig" | |
189 | 249 | ||
190 | 250 | ||
191 | 251 | func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP) | |
192 | 252 | ||
193 | 253 | ||
194 | 254 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
195 | 255 | ||
196 | 256 | ||
197 | 257 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
198 | 258 | ||
199 | 259 | let controlCfg = readControlCfgOrFail(controlContract) | |
200 | 260 | ||
201 | 261 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
202 | 262 | ||
203 | 263 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
204 | 264 | ||
205 | 265 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
206 | 266 | ||
207 | 267 | let liquidationContract = getContractAddressOrFail(controlCfg, IdxControlCfgLiquidationDapp) | |
208 | 268 | ||
209 | 269 | let rpdContract = getContractAddressOrFail(controlCfg, IdxControlCfgRpdDapp) | |
210 | 270 | ||
211 | 271 | let nsbtStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgNsbtStakingDapp) | |
212 | 272 | ||
213 | 273 | let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp) | |
214 | 274 | ||
215 | 275 | let gnsbtControllerContract = getContractAddressOrFail(controlCfg, IdxControlCfgGnsbtControllerDapp) | |
216 | 276 | ||
217 | 277 | let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId()) | |
218 | 278 | ||
219 | 279 | let neutrinoAssetId = fromBase58String(neutrinoAssetIdString) | |
220 | 280 | ||
221 | 281 | let nsbtAssetIdStr = getStringValue(neutrinoContract, keyNsbtAssetId()) | |
222 | 282 | ||
223 | 283 | let nsbtAssetId = fromBase58String(nsbtAssetIdStr) | |
224 | 284 | ||
225 | 285 | let surfAssetIdStr = getStringValue(auctionContract, keySurfAssetId()) | |
226 | 286 | ||
227 | 287 | let surfAssetId = fromBase58String(surfAssetIdStr) | |
228 | 288 | ||
229 | 289 | @Callable(i) | |
230 | 290 | func reverseSwapLimitREADONLY (lim) = { | |
231 | 291 | let gNsbt = if ((0 >= lim)) | |
232 | 292 | then 0 | |
233 | 293 | else { | |
234 | 294 | let aParamX8 = toBigInt(getIntOrFail(mathContract, keySwapAmountAParam())) | |
235 | 295 | let bParamX16 = toBigInt(getIntOrFail(mathContract, keySwapAmountBParam())) | |
236 | 296 | let limDivAX8 = fraction(toBigInt(lim), MULTX10, aParamX8) | |
237 | 297 | let revBX16 = fraction(MULTX16, MULTX16, bParamX16) | |
238 | 298 | toInt(pow(limDivAX8, 8, revBX16, 16, 6, CEILING)) | |
239 | 299 | } | |
240 | 300 | $Tuple2(nil, gNsbt) | |
241 | 301 | } | |
242 | 302 | ||
243 | 303 | ||
244 | 304 | ||
245 | 305 | @Callable(i) | |
246 | 306 | func gnsbtInfoINTERNAL (userAddressStrOrEmpty,additionalNsbtToStakeOrZero,additionalSurfToStakeOrZero) = { | |
247 | 307 | let userAddressOrThis = if ((userAddressStrOrEmpty != "")) | |
248 | 308 | then addressFromStringValue(userAddressStrOrEmpty) | |
249 | 309 | else this | |
250 | 310 | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
251 | 311 | let gnsbtFromNsbtDiff = additionalNsbtToStakeOrZero | |
252 | 312 | let gnsbtFromSurfDiff = asInt(invoke(surfStakingContract, "gnsbtFromSurfSYSREADONLY", [additionalSurfToStakeOrZero], nil)) | |
253 | 313 | let gNsbtDiff = (gnsbtFromNsbtDiff + gnsbtFromSurfDiff) | |
254 | 314 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
255 | - | let limitMaxUsdn = swapParamsTuple._1 | |
256 | - | let limitSpent = swapParamsTuple._2 | |
257 | 315 | let blcks2LmtReset = swapParamsTuple._3 | |
258 | 316 | let gnsbtAmt = swapParamsTuple._4 | |
259 | 317 | let gnsbtAmtTotal = swapParamsTuple._5 | |
318 | + | let limitMaxWaves = swapParamsTuple._6 | |
319 | + | let limitMaxUsdn = swapParamsTuple._7 | |
260 | 320 | let swapParamsTupleNEW = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, gNsbtDiff], nil)) | |
261 | - | let limitMaxUsdnNEW = swapParamsTupleNEW._1 | |
262 | - | let limitSpentNEW = swapParamsTupleNEW._2 | |
263 | 321 | let blcks2LmtResetNEW = swapParamsTupleNEW._3 | |
264 | 322 | let gnsbtAmtNEW = swapParamsTupleNEW._4 | |
265 | 323 | let gnsbtAmtTotalNEW = swapParamsTupleNEW._5 | |
266 | - | let | |
267 | - | let | |
324 | + | let limitMaxWavesNEW = swapParamsTupleNEW._6 | |
325 | + | let limitMaxUsdnNEW = swapParamsTupleNEW._7 | |
268 | 326 | let nsbtBalance = if ((userAddressStrOrEmpty != "")) | |
269 | 327 | then assetBalance(userAddressOrThis, nsbtAssetId) | |
270 | 328 | else 0 | |
271 | 329 | let surfBalance = if ((userAddressStrOrEmpty != "")) | |
272 | 330 | then assetBalance(userAddressOrThis, surfAssetId) | |
273 | 331 | else 0 | |
274 | 332 | let nsbtBalanceDiff = if ((additionalNsbtToStakeOrZero >= 0)) | |
275 | 333 | then additionalNsbtToStakeOrZero | |
276 | 334 | else { | |
277 | 335 | let nsbtUnstakingData = asAnyList(invoke(nsbtStakingContract, "nsbtUnstakingSYSREADONLY", [userAddressStrOrEmpty, (-1 * additionalNsbtToStakeOrZero)], nil)) | |
278 | 336 | let nsbtReceiveAmount = asInt(nsbtUnstakingData[2]) | |
279 | 337 | let result = -(nsbtReceiveAmount) | |
280 | 338 | result | |
281 | 339 | } | |
282 | 340 | let nsbtBalanceNew = (nsbtBalance - nsbtBalanceDiff) | |
283 | 341 | let surfBalanceNew = (surfBalance - additionalSurfToStakeOrZero) | |
284 | 342 | let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStrOrEmpty, additionalNsbtToStakeOrZero, additionalSurfToStakeOrZero], nil)) | |
285 | 343 | let gnsbtUser = asInt(gnsbtData[0]) | |
286 | 344 | let gnsbtTotal = asInt(gnsbtData[1]) | |
287 | 345 | let nsbtData = asAnyList(gnsbtData[2]) | |
288 | 346 | let surfData = asAnyList(gnsbtData[3]) | |
289 | 347 | let vpEffectiveHeight = asInt(gnsbtData[4]) | |
290 | 348 | let vpEffectiveHeightNEW = asInt(gnsbtData[5]) | |
291 | 349 | let gnsbtAmtFromNsbt = asInt(nsbtData[2]) | |
292 | 350 | let gnsbtAmtFromSurf = asInt(surfData[2]) | |
293 | 351 | let gnsbtAmtFromNsbtNEW = (gnsbtAmtFromNsbt + gnsbtFromNsbtDiff) | |
294 | 352 | let gnsbtAmtFromSurfNEW = (gnsbtAmtFromSurf + gnsbtFromSurfDiff) | |
295 | 353 | let gnsbtFromNsbtTotal = asInt(nsbtData[3]) | |
296 | 354 | let gnsbtFromSurfTotal = asInt(surfData[3]) | |
297 | 355 | let gnsbtFromSurfActiveTotal = 0 | |
298 | 356 | let gnsbtFromSurfFrozenTotal = gnsbtFromSurfTotal | |
299 | 357 | let gnsbtFromNsbtTotalNEW = (gnsbtFromNsbtTotal + gnsbtFromNsbtDiff) | |
300 | 358 | let gnsbtFromSurfTotalNEW = (gnsbtFromSurfTotal + gnsbtFromSurfDiff) | |
301 | 359 | let gnsbtFromSurfFrozenTotalNEW = gnsbtFromSurfTotalNEW | |
302 | 360 | let votingPower = fraction(gnsbtAmtFromNsbt, MULT8, (gnsbtFromNsbtTotal + gnsbtFromSurfActiveTotal)) | |
303 | 361 | let votingPowerNew = fraction(gnsbtAmtFromNsbtNEW, MULT8, (gnsbtFromNsbtTotalNEW + gnsbtFromSurfActiveTotal)) | |
304 | 362 | let votingPowerMax = fraction((gnsbtAmtFromNsbt + gnsbtAmtFromSurf), MULT8, ((gnsbtFromNsbtTotal + gnsbtFromSurfActiveTotal) + gnsbtFromSurfFrozenTotal)) | |
305 | 363 | let votingPowerMaxNew = fraction((gnsbtAmtFromNsbtNEW + gnsbtAmtFromSurfNEW), MULT8, ((gnsbtFromNsbtTotalNEW + gnsbtFromSurfActiveTotal) + gnsbtFromSurfFrozenTotalNEW)) | |
306 | 364 | let votingPowerEta = if ((vpEffectiveHeight == 0)) | |
307 | 365 | then height | |
308 | 366 | else vpEffectiveHeight | |
309 | 367 | let votingPowerEtaNew = if ((vpEffectiveHeightNEW == 0)) | |
310 | 368 | then height | |
311 | 369 | else vpEffectiveHeightNEW | |
312 | 370 | $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 | 371 | } | |
314 | 372 | ||
315 | 373 | ||
316 | 374 | ||
317 | 375 | @Callable(i) | |
318 | 376 | func gnsbtInfoREADONLY (userAddressStrOrEmpty,additionalNsbtToStakeOrZero,additionalSurfToStakeOrZero) = { | |
319 | 377 | let gnsbtInfoDATA = asAnyList(invoke(this, "gnsbtInfoINTERNAL", [userAddressStrOrEmpty, additionalNsbtToStakeOrZero, additionalSurfToStakeOrZero], nil)) | |
320 | 378 | $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 | 379 | } | |
322 | 380 | ||
323 | 381 | ||
324 | 382 | ||
325 | 383 | @Callable(i) | |
326 | 384 | func rewardInfoREADONLY (userAddressStrOrEmpty) = { | |
327 | 385 | let rewardsData = asAnyList(invoke(gnsbtControllerContract, "gnsbtRewardsSYSREADONLY", [userAddressStrOrEmpty], nil)) | |
328 | 386 | $Tuple2(nil, makeString(["%s%s", asString(rewardsData[0]), asString(rewardsData[1])], SEP)) | |
329 | 387 | } | |
330 | 388 | ||
331 | 389 | ||
332 | 390 | ||
333 | 391 | @Callable(i) | |
334 | 392 | func mergeNsbtREADONLY (userAddressMandatory,newAmount) = { | |
335 | 393 | let nsbtData = asAnyList(invoke(nsbtStakingContract, "nsbtStakingSYSREADONLY", [userAddressMandatory, newAmount], nil)) | |
336 | 394 | let amount0 = asInt(nsbtData[0]) | |
337 | 395 | let startHeight = if ((0 >= amount0)) | |
338 | 396 | then -1 | |
339 | 397 | else asInt(nsbtData[2]) | |
340 | 398 | let startTimestamp = toTimestamp(startHeight) | |
341 | 399 | let startHeightNew = if ((0 >= newAmount)) | |
342 | 400 | then startHeight | |
343 | 401 | else { | |
344 | 402 | let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife()) | |
345 | 403 | asInt(invoke(mathContract, "mergeStakesREADONLY", [amount0, startHeight, newAmount, height, halfLife], nil)) | |
346 | 404 | } | |
347 | 405 | let startTimestampNew = toTimestamp(startHeightNew) | |
348 | 406 | $Tuple2(nil, makeString(["%d%d%d%d", toString(startHeight), toString(startTimestamp), toString(startHeightNew), toString(startTimestampNew)], SEP)) | |
349 | 407 | } | |
350 | 408 | ||
351 | 409 | ||
352 | 410 | ||
353 | 411 | @Callable(i) | |
354 | 412 | func swapLimitCalculatorREADONLY (userAddressStrOpt,limitWanted,assetIdStr) = { | |
355 | 413 | let gNsbtCurrent = if ((userAddressStrOpt == "")) | |
356 | 414 | then 0 | |
357 | 415 | else asInt(asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOpt, 0], nil))._4) | |
358 | 416 | let limitWantedUsdn = if ((assetIdStr == "WAVES")) | |
359 | 417 | then convertWavesToNeutrino(limitWanted, getIntegerValue(controlContract, keyPrice())) | |
360 | 418 | else limitWanted | |
361 | 419 | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn], nil)) | |
362 | 420 | let gNsbtDelta = (gNsbtNeeded - gNsbtCurrent) | |
363 | 421 | $Tuple2(nil, makeString(["%s%s", toString(gNsbtCurrent), toString(gNsbtDelta)], SEP)) | |
364 | 422 | } | |
365 | 423 | ||
366 | 424 | ||
425 | + | ||
426 | + | @Callable(i) | |
427 | + | func swapInfoREADONLY (userAddressStrOrEmpty,amount,assetIdStr) = { | |
428 | + | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
429 | + | let price = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
430 | + | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
431 | + | let blcks2LmtReset = swapParamsTuple._3 | |
432 | + | let limitMaxWaves = swapParamsTuple._6 | |
433 | + | let limitMaxUsdn = swapParamsTuple._7 | |
434 | + | let assetId = fromBase58String(assetIdStr) | |
435 | + | let swapType = if ((assetId == WAVESID)) | |
436 | + | then "waves" | |
437 | + | else if ((assetId == neutrinoAssetId)) | |
438 | + | then "neutrino" | |
439 | + | else throw(("Can't swap assetId=" + assetIdStr)) | |
440 | + | let withdrawTuple = asWithdrawResultSTRUCT(invoke(neutrinoContract, "calcWithdrawResultSYSREADONLY", [swapType, amount, price], nil)) | |
441 | + | let outNetAmount = withdrawTuple._1 | |
442 | + | let outAssetId = withdrawTuple._2 | |
443 | + | let outSurfAmt = withdrawTuple._3 | |
444 | + | let inAmtToSurfPart = withdrawTuple._4 | |
445 | + | let unleaseAmt = withdrawTuple._5 | |
446 | + | let outFeeAmount = withdrawTuple._6 | |
447 | + | let outAmtGross = withdrawTuple._7 | |
448 | + | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(price), toString(blcks2LmtReset), toString(limitMaxWaves), toString(limitMaxUsdn)], SEP)) | |
449 | + | } | |
450 | + | ||
451 | + |
github/deemru/w8io/026f985 61.88 ms ◑