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