tx · NeFC6cpeFqrTcnoiJfVZ9kpAxfjciHb61eLz4TjYt9W 3N3irEKCdj77h97aEbfj3fa3uMXCNCXVhKt: -0.01200000 Waves 2023.12.11 10:10 [2881720] smart account 3N3irEKCdj77h97aEbfj3fa3uMXCNCXVhKt > SELF 0.00000000 Waves
{ "type": 13, "id": "NeFC6cpeFqrTcnoiJfVZ9kpAxfjciHb61eLz4TjYt9W", "fee": 1200000, "feeAssetId": null, "timestamp": 1702278652986, "version": 1, "sender": "3N3irEKCdj77h97aEbfj3fa3uMXCNCXVhKt", "senderPublicKey": "FACNGaFYnR8yFbQFg9sRBpzGVCyzMyLeVw3JMhGQT1wn", "proofs": [ "38RgLLX9N389xNDjve1rzDPvwsWknTgzThM417wYFo8m63ZiaWkQBos8DEQs6DK8HEfYbMwxJQkAnk83tT1ZK9YG" ], "script": "base64:BgIWCAISBAoCCAESBQoDGBEBEgMKAQgSADAADGNvbnRyYWN0RmlsZQIRbDJtcF9zdGFraW5nLnJpZGUAA1NFUAICX18ABnNjYWxlOACAwtcvAAdzY2FsZTE4AICAkLu61q3wDQANc2NhbGUxOEJpZ0ludAkAtgIBBQdzY2FsZTE4ABJBRERSRVNTX0JZVEVTX1NJWkUAGgANQkxPQ0tTX0lOX0RBWQCgCwAMYWRtaW5BZGRyZXNzCQERQGV4dHJOYXRpdmUoMTA2MikBAiMzTXBzN0NacUI5blViRWlyWXlDTU1vQTdWYnFyeEx2SkZTQgEIdGhyb3dFcnIBA21zZwkAAgEJAKwCAgkArAICBQxjb250cmFjdEZpbGUCAjogBQNtc2cACmtleUFzc2V0SWQJALkJAgkAzAgCAgIlcwkAzAgCAgdhc3NldElkBQNuaWwFA1NFUAATa2V5RW1pc3Npb25QZXJCbG9jawkAuQkCCQDMCAICAiVzCQDMCAICEGVtaXNzaW9uUGVyQmxvY2sFA25pbAUDU0VQABlrZXlFbWlzc2lvblBlcmlvZEluQmxvY2tzCQC5CQIJAMwIAgICJXMJAMwIAgIWZW1pc3Npb25Q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HVzZXJTdGFraW5nTm9kZXNMaXN0CAUNJHQwMTA2OTExMDc4MwJfMQQZdXNlclN0YWtpbmdOb2RlU2hhcmVzTGlzdAgFDSR0MDEwNjkxMTA3ODMCXzIJAJQKAgUDbmlsCQCcCgoFDHVzZXJMcEFtb3VudAUcdXNlckF2YWlsYWJsZUFzc2V0VG9XaXRoZHJhdwkBD2dldEN1cnJlbnRQcmljZQAFFXVzZXJUb3RhbFN0YWtlZEFtb3VudAUXdXNlclRvdGFsQXNzZXRXaXRoZHJhd24FEnVzZXJMb2NrZWRMcEFtb3VudAUVdXNlckxvY2tlZEFzc2V0QW1vdW50BRR1c2VyU3Rha2luZ05vZGVzTGlzdAUZdXNlclN0YWtpbmdOb2RlU2hhcmVzTGlzdAkBEmdldFJlbWFpbmluZ0Jsb2NrcwABaQEWZ2V0VG90YWxBc3NldHNSRUFET05MWQAJAJQKAgUDbmlsCQCYCgYFDXRvdGFsTHBBbW91bnQJAStnZXRUb3RhbEFzc2V0QW1vdW50V2l0aFByb2ZpdE9yTWF4QXZhaWxhYmxlAQUGaGVpZ2h0CQEPZ2V0Q3VycmVudFByaWNlAAUTdG90YWxMb2NrZWRMcEFtb3VudAkBD2NhbGNBc3NldEZyb21McAIFE3RvdGFsTG9ja2VkTHBBbW91bnQFBmhlaWdodAkBEmdldFJlbWFpbmluZ0Jsb2NrcwAAVc1t9A==", "chainId": 84, "height": 2881720, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E7zhNJLDwJLYAR8UJ4QesJGw2e3qc4rFZ2W7USKCxYnt Next: 9Yntvwin2bHmAWhDYMe7vJp83gXvStWcLpftuYU8SxWo Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFile = "l2mp_staking.ride" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let scale8 = 100000000 | |
9 | 9 | ||
10 | 10 | let scale18 = 1000000000000000000 | |
11 | 11 | ||
12 | 12 | let scale18BigInt = toBigInt(scale18) | |
13 | 13 | ||
14 | 14 | let ADDRESS_BYTES_SIZE = 26 | |
15 | 15 | ||
16 | 16 | let BLOCKS_IN_DAY = 1440 | |
17 | 17 | ||
18 | 18 | let adminAddress = addressFromStringValue("3Mps7CZqB9nUbEirYyCMMoA7VbqrxLvJFSB") | |
19 | 19 | ||
20 | 20 | func throwErr (msg) = throw(((contractFile + ": ") + msg)) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | let keyAssetId = makeString(["%s", "assetId"], SEP) | |
24 | 24 | ||
25 | 25 | let keyEmissionPerBlock = makeString(["%s", "emissionPerBlock"], SEP) | |
26 | 26 | ||
27 | 27 | let keyEmissionPeriodInBlocks = makeString(["%s", "emissionPeriodInBlocks"], SEP) | |
28 | 28 | ||
29 | 29 | let keyStartBlock = makeString(["%s", "startBlock"], SEP) | |
30 | 30 | ||
31 | 31 | let keyTotalLpAmount = makeString(["%s", "totalLpAmount"], SEP) | |
32 | 32 | ||
33 | 33 | let keyTotalAssetAmount = makeString(["%s", "totalAssetAmount"], SEP) | |
34 | 34 | ||
35 | 35 | let keyTotalLockedLpAmount = makeString(["%s", "totalLockedLpAmount"], SEP) | |
36 | 36 | ||
37 | 37 | func keyUserLpAmount (userAddress) = makeString(["%s%s", "userLpAmount", userAddress], SEP) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func keyUserLockedLpAmount (userAddress) = makeString(["%s%s", "userLockedLpAmount", userAddress], SEP) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func keyUserStakingNodes (userAddress) = makeString(["%s%s", "userStakingNodes", userAddress], SEP) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func keyUserStakingNodesShares (userAddress) = makeString(["%s%s", "userStakingNodesShares", userAddress], SEP) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func keyUserTotalAssetWithdrawn (userAddress) = makeString(["%s%s", "totalAssetWithdrawn", userAddress], SEP) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func keyUserTotalAssetStaked (userAddress) = makeString(["%s%s", "totalAssetStaked", userAddress], SEP) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func keyHistory (type,userAddress,txId) = makeString(["%s%s%s", type, userAddress, toBase58String(txId)], SEP) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func formatHistory (totalProfit,price,totalAssetAmount,totalLpAmount) = makeString(["%d%d%d%d", toString(totalProfit), toString(price), toString(totalAssetAmount), toString(totalLpAmount)], SEP) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | let totalLpAmount = valueOrElse(getInteger(this, keyTotalLpAmount), 0) | |
62 | 62 | ||
63 | 63 | let totalAssetAmount = valueOrElse(getInteger(this, keyTotalAssetAmount), 0) | |
64 | 64 | ||
65 | 65 | let totalLockedLpAmount = valueOrElse(getInteger(this, keyTotalLockedLpAmount), 0) | |
66 | 66 | ||
67 | 67 | let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES") | |
68 | 68 | ||
69 | 69 | let assetIdBytes = if ((assetIdString == "WAVES")) | |
70 | 70 | then unit | |
71 | 71 | else fromBase58String(assetIdString) | |
72 | 72 | ||
73 | 73 | let emissionPeriodInBlocks = valueOrElse(getInteger(this, keyEmissionPeriodInBlocks), BLOCKS_IN_DAY) | |
74 | 74 | ||
75 | 75 | let emissionPerBlock = valueOrElse(getInteger(this, keyEmissionPerBlock), 0) | |
76 | 76 | ||
77 | 77 | let emissionPerPeriod = (emissionPerBlock * emissionPeriodInBlocks) | |
78 | 78 | ||
79 | 79 | let startBlock = valueOrElse(getInteger(this, keyStartBlock), height) | |
80 | 80 | ||
81 | 81 | func stringListToIntListHelper (acc,value) = (acc :+ parseIntValue(value)) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func calcTotalProfitForHeight (h) = { | |
85 | 85 | let startPeriod = fraction(startBlock, 1, emissionPeriodInBlocks) | |
86 | 86 | let elapsedPeriods = ((h / emissionPeriodInBlocks) - startPeriod) | |
87 | 87 | max([0, (emissionPerPeriod * elapsedPeriods)]) | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func calcTotalProfit () = calcTotalProfitForHeight(height) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func getMaxAssetAvailable () = match assetIdBytes { | |
95 | 95 | case u: Unit => | |
96 | 96 | wavesBalance(this).available | |
97 | 97 | case b: ByteVector => | |
98 | 98 | assetBalance(this, b) | |
99 | 99 | case _ => | |
100 | 100 | throw("Match error") | |
101 | 101 | } | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func getTotalAssetAmountWithProfitOrMaxAvailable (atHeight) = { | |
105 | 105 | let totalAssetAmountWithProfit = (totalAssetAmount + calcTotalProfitForHeight(atHeight)) | |
106 | 106 | let totalAmount = min([totalAssetAmountWithProfit, getMaxAssetAvailable()]) | |
107 | 107 | if ((totalLpAmount == 0)) | |
108 | 108 | then 0 | |
109 | 109 | else totalAmount | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func getPriceAtHeight (h) = if ((totalLpAmount != 0)) | |
114 | 114 | then fraction(toBigInt(getTotalAssetAmountWithProfitOrMaxAvailable(h)), scale18BigInt, toBigInt(totalLpAmount)) | |
115 | 115 | else scale18BigInt | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func getCurrentPrice () = getPriceAtHeight(height) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func getRemainingBlocks () = if ((emissionPerBlock == 0)) | |
122 | 122 | then 0 | |
123 | 123 | else fraction((getMaxAssetAvailable() - getTotalAssetAmountWithProfitOrMaxAvailable(height)), 1, emissionPerBlock) | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func getUserStakingNodesData (userAddress) = { | |
127 | 127 | let nodesRaw = valueOrElse(getString(this, keyUserStakingNodes(userAddress)), "") | |
128 | 128 | let sharesRaw = valueOrElse(getString(this, keyUserStakingNodesShares(userAddress)), "") | |
129 | 129 | let nodesList = if ((nodesRaw == "")) | |
130 | 130 | then nil | |
131 | 131 | else split(nodesRaw, SEP) | |
132 | 132 | let sharesStringList = if ((sharesRaw == "")) | |
133 | 133 | then nil | |
134 | 134 | else split(sharesRaw, SEP) | |
135 | 135 | let sharesList = { | |
136 | 136 | let $l = sharesStringList | |
137 | 137 | let $s = size($l) | |
138 | 138 | let $acc0 = nil | |
139 | 139 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
140 | 140 | then $a | |
141 | 141 | else stringListToIntListHelper($a, $l[$i]) | |
142 | 142 | ||
143 | 143 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
144 | 144 | then $a | |
145 | 145 | else throw("List size exceeds 20") | |
146 | 146 | ||
147 | 147 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
148 | 148 | } | |
149 | 149 | $Tuple2(nodesList, sharesList) | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func calcAssetFromLp (lpAmount,atHeight) = max([0, toInt(fraction(toBigInt(lpAmount), getPriceAtHeight(atHeight), scale18BigInt))]) | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func calcLpFromAsset (assetAmount,atHeight) = max([0, toInt(fraction(toBigInt(assetAmount), scale18BigInt, getPriceAtHeight(atHeight)))]) | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func getUserLpAmount (userAddress) = valueOrElse(getInteger(this, keyUserLpAmount(userAddress)), 0) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func getUserLockedLpAmount (userAddress) = valueOrElse(getInteger(this, keyUserLockedLpAmount(userAddress)), 0) | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func getUserAvailableAssetsToWithdraw (userAddress) = { | |
166 | 166 | let userLpAmount = getUserLpAmount(userAddress) | |
167 | 167 | calcAssetFromLp(userLpAmount, height) | |
168 | 168 | } | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func getStakeActions (i,userAddress,stakeHeight) = { | |
172 | 172 | let checks = [if ((stakeHeight >= startBlock)) | |
173 | 173 | then true | |
174 | 174 | else throwErr("startBlock is greater than stakeHeight"), if ((size(i.payments) == 1)) | |
175 | 175 | then true | |
176 | 176 | else throwErr("should include 1 payment"), if ((i.payments[0].assetId == assetIdBytes)) | |
177 | 177 | then true | |
178 | 178 | else throwErr(("payment should be in " + assetIdString)), if ((i.payments[0].amount > 0)) | |
179 | 179 | then true | |
180 | 180 | else "payment amount should be greater than 0", if ((size(fromBase58String(userAddress)) == ADDRESS_BYTES_SIZE)) | |
181 | 181 | then true | |
182 | 182 | else throwErr("user address is not valid")] | |
183 | 183 | if ((checks == checks)) | |
184 | 184 | then { | |
185 | 185 | let paymentAmount = i.payments[0].amount | |
186 | 186 | let paymentLpAmount = calcLpFromAsset(paymentAmount, stakeHeight) | |
187 | 187 | let userLpAmount = getUserLpAmount(userAddress) | |
188 | 188 | let userTotalStakedAmount = valueOrElse(getInteger(this, keyUserTotalAssetStaked(userAddress)), 0) | |
189 | 189 | let newTotalLpAmount = (totalLpAmount + paymentLpAmount) | |
190 | 190 | let newTotalAssetAmount = calcAssetFromLp(newTotalLpAmount, stakeHeight) | |
191 | 191 | let newUserLpAmount = (userLpAmount + paymentLpAmount) | |
192 | 192 | let newUserTotalStakedAmount = (userTotalStakedAmount + paymentAmount) | |
193 | 193 | [StringEntry(keyHistory("stake", userAddress, i.transactionId), formatHistory(calcTotalProfit(), getCurrentPrice(), totalLpAmount, totalAssetAmount)), IntegerEntry(keyTotalLpAmount, newTotalLpAmount), IntegerEntry(keyTotalAssetAmount, newTotalAssetAmount), IntegerEntry(keyUserLpAmount(userAddress), newUserLpAmount), IntegerEntry(keyUserTotalAssetStaked(userAddress), newUserTotalStakedAmount), IntegerEntry(keyStartBlock, stakeHeight)] | |
194 | 194 | } | |
195 | 195 | else throw("Strict value is not equal to itself.") | |
196 | 196 | } | |
197 | 197 | ||
198 | 198 | ||
199 | 199 | @Callable(i) | |
200 | 200 | func stakeForAdmin (userAddress,stakeHeight) = { | |
201 | 201 | let check = [if ((i.caller == adminAddress)) | |
202 | 202 | then true | |
203 | 203 | else throwErr("permission denied")] | |
204 | 204 | if ((check == check)) | |
205 | 205 | then getStakeActions(i, userAddress, stakeHeight) | |
206 | 206 | else throw("Strict value is not equal to itself.") | |
207 | 207 | } | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | 211 | @Callable(i) | |
212 | 212 | func airdrop (addressList,amountList,airdropHeight) = { | |
213 | 213 | func sum (accum,next) = if ((0 > next)) | |
214 | 214 | then throwErr("negative amount value in amountList") | |
215 | 215 | else (accum + next) | |
216 | 216 | ||
217 | 217 | let amountListSum = { | |
218 | 218 | let $l = amountList | |
219 | 219 | let $s = size($l) | |
220 | 220 | let $acc0 = 0 | |
221 | 221 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
222 | 222 | then $a | |
223 | 223 | else sum($a, $l[$i]) | |
224 | 224 | ||
225 | 225 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
226 | 226 | then $a | |
227 | 227 | else throw("List size exceeds 90") | |
228 | 228 | ||
229 | 229 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90) | |
230 | 230 | } | |
231 | 231 | let check = [if ((i.caller == adminAddress)) | |
232 | 232 | then true | |
233 | 233 | else throwErr("permission denied"), if ((airdropHeight >= startBlock)) | |
234 | 234 | then true | |
235 | 235 | else throwErr("airdropHeight is greater than stakeHeight"), if ((size(i.payments) == 1)) | |
236 | 236 | then true | |
237 | 237 | else throwErr("should include 1 payment"), if ((i.payments[0].assetId == assetIdBytes)) | |
238 | 238 | then true | |
239 | 239 | else throwErr(("payment should be in " + assetIdString)), if ((i.payments[0].amount > 0)) | |
240 | 240 | then true | |
241 | 241 | else "payment amount should be greater than 0", if ((size(addressList) == size(amountList))) | |
242 | 242 | then true | |
243 | 243 | else throwErr("addressList should be same size as amountList"), if ((i.payments[0].amount >= amountListSum)) | |
244 | 244 | then true | |
245 | 245 | else throwErr("payment amount is less than sum of amountList")] | |
246 | 246 | if ((check == check)) | |
247 | 247 | then { | |
248 | 248 | func getAirdropStateChanges (accum,assetAmount) = { | |
249 | 249 | let $t083648415 = accum | |
250 | 250 | let result = $t083648415._1 | |
251 | 251 | let index = $t083648415._2 | |
252 | 252 | let totalLp = $t083648415._3 | |
253 | 253 | let processedList = $t083648415._4 | |
254 | 254 | let addressString = addressList[index] | |
255 | 255 | let address = match addressFromString(addressString) { | |
256 | 256 | case adr: Address => | |
257 | 257 | adr | |
258 | 258 | case _ => | |
259 | 259 | throwErr("invalid address in addressList") | |
260 | 260 | } | |
261 | 261 | let ch = [if (!(containsElement(processedList, address))) | |
262 | 262 | then true | |
263 | 263 | else throwErr("duplicate address is addressList")] | |
264 | 264 | if ((ch == ch)) | |
265 | 265 | then { | |
266 | 266 | let addedLpAmount = calcLpFromAsset(assetAmount, airdropHeight) | |
267 | 267 | let userLockedLpKey = keyUserLockedLpAmount(addressString) | |
268 | 268 | let oldLpAmount = valueOrElse(getInteger(this, userLockedLpKey), 0) | |
269 | 269 | $Tuple4((result :+ IntegerEntry(userLockedLpKey, (oldLpAmount + addedLpAmount))), (index + 1), (totalLp + addedLpAmount), (processedList :+ address)) | |
270 | 270 | } | |
271 | 271 | else throw("Strict value is not equal to itself.") | |
272 | 272 | } | |
273 | 273 | ||
274 | 274 | let $t091949311 = { | |
275 | 275 | let $l = amountList | |
276 | 276 | let $s = size($l) | |
277 | 277 | let $acc0 = $Tuple4(nil, 0, 0, nil) | |
278 | 278 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
279 | 279 | then $a | |
280 | 280 | else getAirdropStateChanges($a, $l[$i]) | |
281 | 281 | ||
282 | 282 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
283 | 283 | then $a | |
284 | 284 | else throw("List size exceeds 90") | |
285 | 285 | ||
286 | 286 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90) | |
287 | 287 | } | |
288 | 288 | let airdropEntries = $t091949311._1 | |
289 | 289 | let _a = $t091949311._2 | |
290 | 290 | let addedTotalLockedLpAmount = $t091949311._3 | |
291 | 291 | let _b = $t091949311._4 | |
292 | 292 | let newTotalAsset = calcAssetFromLp((totalLpAmount + addedTotalLockedLpAmount), airdropHeight) | |
293 | 293 | ([IntegerEntry(keyTotalLockedLpAmount, (totalLockedLpAmount + addedTotalLockedLpAmount)), IntegerEntry(keyTotalLpAmount, (totalLpAmount + addedTotalLockedLpAmount)), IntegerEntry(keyTotalAssetAmount, newTotalAsset), IntegerEntry(keyStartBlock, airdropHeight)] ++ airdropEntries) | |
294 | 294 | } | |
295 | 295 | else throw("Strict value is not equal to itself.") | |
296 | 296 | } | |
297 | 297 | ||
298 | 298 | ||
299 | 299 | ||
300 | 300 | @Callable(i) | |
301 | 301 | func getUserAssetsREADONLY (userAddress) = { | |
302 | 302 | let userLpAmount = getUserLpAmount(userAddress) | |
303 | 303 | let userLockedLpAmount = getUserLockedLpAmount(userAddress) | |
304 | 304 | let userLockedAssetAmount = calcAssetFromLp(userLockedLpAmount, height) | |
305 | 305 | let userAvailableAssetToWithdraw = getUserAvailableAssetsToWithdraw(userAddress) | |
306 | 306 | let userTotalStakedAmount = valueOrElse(getInteger(this, keyUserTotalAssetStaked(userAddress)), 0) | |
307 | 307 | let userTotalAssetWithdrawn = valueOrElse(getInteger(this, keyUserTotalAssetWithdrawn(userAddress)), 0) | |
308 | 308 | let $t01069110783 = getUserStakingNodesData(userAddress) | |
309 | 309 | let userStakingNodesList = $t01069110783._1 | |
310 | 310 | let userStakingNodeSharesList = $t01069110783._2 | |
311 | 311 | $Tuple2(nil, $Tuple10(userLpAmount, userAvailableAssetToWithdraw, getCurrentPrice(), userTotalStakedAmount, userTotalAssetWithdrawn, userLockedLpAmount, userLockedAssetAmount, userStakingNodesList, userStakingNodeSharesList, getRemainingBlocks())) | |
312 | 312 | } | |
313 | 313 | ||
314 | 314 | ||
315 | 315 | ||
316 | 316 | @Callable(i) | |
317 | 317 | func getTotalAssetsREADONLY () = $Tuple2(nil, $Tuple6(totalLpAmount, getTotalAssetAmountWithProfitOrMaxAvailable(height), getCurrentPrice(), totalLockedLpAmount, calcAssetFromLp(totalLockedLpAmount, height), getRemainingBlocks())) | |
318 | 318 | ||
319 | 319 |
github/deemru/w8io/026f985 46.56 ms ◑