tx · 4ipPRY1tfDjXYHf3RgACkpV6xWnLcAF4ihmfxhQifYmQ 3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4: -0.01700000 Waves 2023.09.14 14:45 [2755024] smart account 3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4 > SELF 0.00000000 Waves
{ "type": 13, "id": "4ipPRY1tfDjXYHf3RgACkpV6xWnLcAF4ihmfxhQifYmQ", "fee": 1700000, "feeAssetId": null, "timestamp": 1694691902755, "version": 2, "chainId": 84, "sender": "3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4", "senderPublicKey": "DU1U4j8FqHUMRr9WgfF3yo67ULEFkjp7dtMWMpjBK1ar", "proofs": [ "2SX7ZDA4H35xzGukWoh3XqkqAzNoVsYdCXpRtKcAWcdwG4SBAhx6aCKBvs28uNciN3S5Yb2ji5LEnJuD3LpMwKvq", "47vxZCw1Sg5jnse9PD7EoyUw7cvbER6nXS4bHWzE6qGx8V3NJ367kSMKmGUb9ZKNJMi5vfQuMr5usmzzduRbTg4q" ], "script": "base64:BgI0CAISABIDCgEIEgMKAQgSBwoFCAgICAESABIDCgEBEgASABIDCgEIEgUKAwgICBIAEgASACIABlNDQUxFOACAwtcvAA1QRVJDRU5UX1NDQUxFAJBOAAlTRVBBUkFUT1ICAl9fAAlrSW50ZXJlc3QCCGludGVyZXN0AA1rVXNlckludGVyZXN0Ag1fdXNlckludGVyZXN0AA5rVXNlckF2YWlsYWJsZQITX3VzZXJBdmFpbGFibGVDbGFpbQAQa1VzZXJUb2tlblN0YWtlZAIQX3VzZXJUb2tlblN0YWtlZAARa1RvdGFsVG9rZW5TdGFrZWQCEHRvdGFsVG9rZW5TdGFrZWQADGtORlRJbnRlcmVzdAILTkZUSW50ZXJlc3QAEGtORlRVc2VySW50ZXJlc3QCEF9ORlRVc2VySW50ZXJlc3QAFmtORlRVc2VyQXZhaWxhYmxlQ2xhaW0CFl9ORlRVc2VyQXZhaWxhYmxlQ2xhaW0AD2tORlRUb3R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AAwMDAwUKaXNSaWdodEZlZQUKaXNJbml0Q2FsbAcFBmlzU2VsZgcFDGlzbm9QYXltZW50cwcGBRNtdWx0aVNpZ25lZEJ5QWRtaW5zBRNtdWx0aVNpZ25lZEJ5QWRtaW5zE7CWmQ==", "height": 2755024, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: XPeLieLgFx5Htg62rhiuVn2b6WPxHBUJ2Qa2Gf8uZEc Next: AKGttLNzSenSUFncf6Fvw7QtGpfed3SZdZLNMWcCH6B3 Diff:
Old | New | Differences | |
---|---|---|---|
115 | 115 | ||
116 | 116 | ||
117 | 117 | @Callable(i) | |
118 | - | func | |
118 | + | func getStatsREADONLY () = { | |
119 | 119 | let apr = calcTokenApr() | |
120 | - | let $t036294228 = if ((user == "")) | |
120 | + | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
121 | + | let totalNftStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
122 | + | $Tuple2(nil, makeString(["%d%d%d", toString(apr), toString(totalTokenStaked), toString(totalNftStaked)], SEPARATOR)) | |
123 | + | } | |
124 | + | ||
125 | + | ||
126 | + | ||
127 | + | @Callable(i) | |
128 | + | func getStatsByUserREADONLY (user) = { | |
129 | + | let $t039804579 = if ((user == "")) | |
121 | 130 | then $Tuple4(0, 0, 0, 0) | |
122 | 131 | else { | |
123 | 132 | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
124 | - | let $ | |
125 | - | let userNewInterest = $ | |
126 | - | let claimAmountAvailable = $ | |
127 | - | let userTokenStaked = $ | |
128 | - | let totalTokenStaked = $ | |
129 | - | let $ | |
130 | - | let userNewInterestNFT = $ | |
131 | - | let claimAmountAvailableNFT = $ | |
132 | - | let userNFTStaked = $ | |
133 | - | let totalNFTStaked = $ | |
133 | + | let $t042174313 = claimCalc(user) | |
134 | + | let userNewInterest = $t042174313._1 | |
135 | + | let claimAmountAvailable = $t042174313._2 | |
136 | + | let userTokenStaked = $t042174313._3 | |
137 | + | let totalTokenStaked = $t042174313._4 | |
138 | + | let $t043204421 = claimCalcNft(user) | |
139 | + | let userNewInterestNFT = $t043204421._1 | |
140 | + | let claimAmountAvailableNFT = $t043204421._2 | |
141 | + | let userNFTStaked = $t043204421._3 | |
142 | + | let totalNFTStaked = $t043204421._4 | |
134 | 143 | let userBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
135 | 144 | $Tuple4(userBalance, userTokenStaked, claimAmountAvailable, claimAmountAvailableNFT) | |
136 | 145 | } | |
137 | - | let userTokenBalance = $t036294228._1 | |
138 | - | let userTokenStaked = $t036294228._2 | |
139 | - | let claimAmountAvailable = $t036294228._3 | |
140 | - | let claimAmountAvailableNFT = $t036294228._4 | |
146 | + | let userTokenBalance = $t039804579._1 | |
147 | + | let userTokenStaked = $t039804579._2 | |
148 | + | let claimAmountAvailable = $t039804579._3 | |
149 | + | let claimAmountAvailableNFT = $t039804579._4 | |
150 | + | $Tuple2(nil, makeString(["%d%d%d%d", toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT)], SEPARATOR)) | |
151 | + | } | |
152 | + | ||
153 | + | ||
154 | + | ||
155 | + | @Callable(i) | |
156 | + | func getUserStatsREADONLY (user) = { | |
157 | + | let apr = calcTokenApr() | |
158 | + | let $t048905489 = if ((user == "")) | |
159 | + | then $Tuple4(0, 0, 0, 0) | |
160 | + | else { | |
161 | + | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
162 | + | let $t051275223 = claimCalc(user) | |
163 | + | let userNewInterest = $t051275223._1 | |
164 | + | let claimAmountAvailable = $t051275223._2 | |
165 | + | let userTokenStaked = $t051275223._3 | |
166 | + | let totalTokenStaked = $t051275223._4 | |
167 | + | let $t052305331 = claimCalcNft(user) | |
168 | + | let userNewInterestNFT = $t052305331._1 | |
169 | + | let claimAmountAvailableNFT = $t052305331._2 | |
170 | + | let userNFTStaked = $t052305331._3 | |
171 | + | let totalNFTStaked = $t052305331._4 | |
172 | + | let userBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
173 | + | $Tuple4(userBalance, userTokenStaked, claimAmountAvailable, claimAmountAvailableNFT) | |
174 | + | } | |
175 | + | let userTokenBalance = $t048905489._1 | |
176 | + | let userTokenStaked = $t048905489._2 | |
177 | + | let claimAmountAvailable = $t048905489._3 | |
178 | + | let claimAmountAvailableNFT = $t048905489._4 | |
141 | 179 | $Tuple2(nil, makeString(["%d%d%d%d%d", toString(apr), toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT)], SEPARATOR)) | |
142 | 180 | } | |
143 | 181 | ||
162 | 200 | func stake () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
163 | 201 | then throw("One payment expected") | |
164 | 202 | else { | |
165 | - | let $ | |
166 | - | let pmtAmount = $ | |
167 | - | let pmtAssetId = $ | |
203 | + | let $t066926767 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
204 | + | let pmtAmount = $t066926767._1 | |
205 | + | let pmtAssetId = $t066926767._2 | |
168 | 206 | if ((pmtAssetId != fromBase58String(tokenId))) | |
169 | 207 | then throw("Wrong payment asset") | |
170 | 208 | else { | |
171 | 209 | let user = toString(i.caller) | |
172 | - | let $ | |
173 | - | let userNewInterest = $ | |
174 | - | let claimAmountAvailable = $ | |
175 | - | let userTokenStaked = $ | |
176 | - | let totalTokenStaked = $ | |
210 | + | let $t068886984 = claimCalc(user) | |
211 | + | let userNewInterest = $t068886984._1 | |
212 | + | let claimAmountAvailable = $t068886984._2 | |
213 | + | let userTokenStaked = $t068886984._3 | |
214 | + | let totalTokenStaked = $t068886984._4 | |
177 | 215 | [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked + pmtAmount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked + pmtAmount))] | |
178 | 216 | } | |
179 | 217 | }) | |
186 | 224 | if ((0 >= amount)) | |
187 | 225 | then throw("Amount must be greater than 0") | |
188 | 226 | else { | |
189 | - | let $ | |
190 | - | let userNewInterest = $ | |
191 | - | let claimAmountAvailable = $ | |
192 | - | let userTokenStaked = $ | |
193 | - | let totalTokenStaked = $ | |
227 | + | let $t074227518 = claimCalc(user) | |
228 | + | let userNewInterest = $t074227518._1 | |
229 | + | let claimAmountAvailable = $t074227518._2 | |
230 | + | let userTokenStaked = $t074227518._3 | |
231 | + | let totalTokenStaked = $t074227518._4 | |
194 | 232 | if ((amount > userTokenStaked)) | |
195 | 233 | then throw("You can't unstake more than staked") | |
196 | 234 | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount)), ScriptTransfer(i.caller, amount, fromBase58String(tokenId))] | |
202 | 240 | @Callable(i) | |
203 | 241 | func claim () = valueOrElse(isActive(), { | |
204 | 242 | let user = toString(i.caller) | |
205 | - | let $ | |
206 | - | let userNewInterest = $ | |
207 | - | let claimAmountAvailable = $ | |
208 | - | let userTokenStaked = $ | |
209 | - | let totalTokenStaked = $ | |
210 | - | let $ | |
211 | - | let userNewInterestNFT = $ | |
212 | - | let claimAmountAvailableNFT = $ | |
213 | - | let userNFTStaked = $ | |
214 | - | let totalNFTStaked = $ | |
243 | + | let $t080248120 = claimCalc(user) | |
244 | + | let userNewInterest = $t080248120._1 | |
245 | + | let claimAmountAvailable = $t080248120._2 | |
246 | + | let userTokenStaked = $t080248120._3 | |
247 | + | let totalTokenStaked = $t080248120._4 | |
248 | + | let $t081238224 = claimCalcNft(user) | |
249 | + | let userNewInterestNFT = $t081238224._1 | |
250 | + | let claimAmountAvailableNFT = $t081238224._2 | |
251 | + | let userNFTStaked = $t081238224._3 | |
252 | + | let totalNFTStaked = $t081238224._4 | |
215 | 253 | if (((claimAmountAvailable + claimAmountAvailableNFT) == 0)) | |
216 | 254 | then throw("Nothing to claim") | |
217 | 255 | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), 0), IntegerEntry((user + kNFTUserInterest), userNewInterestNFT), IntegerEntry((user + kNFTUserAvailableClaim), 0), ScriptTransfer(i.caller, (claimAmountAvailable + claimAmountAvailableNFT), fromBase58String(tokenId))] | |
223 | 261 | func stakeNFT () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
224 | 262 | then throw("One payment expected") | |
225 | 263 | else { | |
226 | - | let $ | |
227 | - | let pmtAmount = $ | |
228 | - | let pmtAssetId = $ | |
264 | + | let $t087808855 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
265 | + | let pmtAmount = $t087808855._1 | |
266 | + | let pmtAssetId = $t087808855._2 | |
229 | 267 | let pmtAssetIdStr = assetIdToStr(pmtAssetId) | |
230 | 268 | if (!(isDefined(getString(this, (pmtAssetIdStr + kNFTCreated))))) | |
231 | 269 | then throw("Wrong nft asset") | |
232 | 270 | else { | |
233 | 271 | let user = toString(i.caller) | |
234 | - | let $ | |
235 | - | let userNewInterest = $ | |
236 | - | let claimAmountAvailable = $ | |
237 | - | let userNFTStaked = $ | |
238 | - | let totalNFTStaked = $ | |
272 | + | let $t090369131 = claimCalcNft(user) | |
273 | + | let userNewInterest = $t090369131._1 | |
274 | + | let claimAmountAvailable = $t090369131._2 | |
275 | + | let userNFTStaked = $t090369131._3 | |
276 | + | let totalNFTStaked = $t090369131._4 | |
239 | 277 | [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked + 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked + 1)), BooleanEntry((((user + "_") + pmtAssetIdStr) + kuserNFTStakedId), true)] | |
240 | 278 | } | |
241 | 279 | }) | |
248 | 286 | if (isDefined(getBoolean(this, (((user + "_") + id) + kuserNFTStakedId)))) | |
249 | 287 | then throw("You didn't staked") | |
250 | 288 | else { | |
251 | - | let $ | |
252 | - | let userNewInterest = $ | |
253 | - | let claimAmountAvailable = $ | |
254 | - | let userNFTStaked = $ | |
255 | - | let totalNFTStaked = $ | |
289 | + | let $t096689763 = claimCalcNft(user) | |
290 | + | let userNewInterest = $t096689763._1 | |
291 | + | let claimAmountAvailable = $t096689763._2 | |
292 | + | let userNFTStaked = $t096689763._3 | |
293 | + | let totalNFTStaked = $t096689763._4 | |
256 | 294 | [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked - 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked - 1)), DeleteEntry((((user + "_") + id) + kuserNFTStakedId)), ScriptTransfer(i.caller, 1, fromBase58String(id))] | |
257 | 295 | } | |
258 | 296 | }) | |
266 | 304 | let nftId = calculateAssetId(issue) | |
267 | 305 | let nftList = valueOrElse(getString(this, kNFTCreatedList), "") | |
268 | 306 | let newNftList = (nftList + (if ((nftList != "")) | |
269 | - | then SEPARATOR | |
307 | + | then (SEPARATOR + toBase58String(nftId)) | |
270 | 308 | else ("" + toBase58String(nftId)))) | |
271 | 309 | [issue, StringEntry((toBase58String(nftId) + kNFTCreated), userAddr), StringEntry(kNFTCreatedList, newNftList), ScriptTransfer(uAddr, 1, nftId)] | |
272 | 310 | })) | |
277 | 315 | func airdrop () = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if ((size(i.payments) != 1)) | |
278 | 316 | then throw("One payment expected") | |
279 | 317 | else { | |
280 | - | let $ | |
281 | - | let pmtAmount = $ | |
282 | - | let pmtAssetId = $ | |
318 | + | let $t01093311008 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
319 | + | let pmtAmount = $t01093311008._1 | |
320 | + | let pmtAssetId = $t01093311008._2 | |
283 | 321 | if ((pmtAssetId != fromBase58String(tokenId))) | |
284 | 322 | then throw("Wrong payment asset") | |
285 | 323 | else { | |
288 | 326 | let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
289 | 327 | let curInterest = valueOrElse(getInteger(this, kInterest), 0) | |
290 | 328 | let curNFTInterest = valueOrElse(getInteger(this, kNFTInterest), 0) | |
291 | - | let $ | |
329 | + | let $t01143111635 = if ((totalNFTStaked == 0)) | |
292 | 330 | then $Tuple2(0, pmtAmount) | |
293 | 331 | else { | |
294 | 332 | let nftP = fraction(pmtAmount, min([percentForNFT, (totalNFTStaked * 10)]), 100) | |
295 | 333 | $Tuple2(nftP, (pmtAmount - nftP)) | |
296 | 334 | } | |
297 | - | let pmtNFT = $ | |
298 | - | let pmtToken = $ | |
335 | + | let pmtNFT = $t01143111635._1 | |
336 | + | let pmtToken = $t01143111635._2 | |
299 | 337 | let interestNew = if ((totalTokenStaked > 0)) | |
300 | 338 | then (curInterest + fraction(pmtToken, SCALE8, totalTokenStaked)) | |
301 | 339 | else curInterest |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 100000000 | |
5 | 5 | ||
6 | 6 | let PERCENT_SCALE = 10000 | |
7 | 7 | ||
8 | 8 | let SEPARATOR = "__" | |
9 | 9 | ||
10 | 10 | let kInterest = "interest" | |
11 | 11 | ||
12 | 12 | let kUserInterest = "_userInterest" | |
13 | 13 | ||
14 | 14 | let kUserAvailable = "_userAvailableClaim" | |
15 | 15 | ||
16 | 16 | let kUserTokenStaked = "_userTokenStaked" | |
17 | 17 | ||
18 | 18 | let kTotalTokenStaked = "totalTokenStaked" | |
19 | 19 | ||
20 | 20 | let kNFTInterest = "NFTInterest" | |
21 | 21 | ||
22 | 22 | let kNFTUserInterest = "_NFTUserInterest" | |
23 | 23 | ||
24 | 24 | let kNFTUserAvailableClaim = "_NFTUserAvailableClaim" | |
25 | 25 | ||
26 | 26 | let kNFTTotalStaked = "NFTTotalStaked" | |
27 | 27 | ||
28 | 28 | let kuserNFTStaked = "_userNFTStaked" | |
29 | 29 | ||
30 | 30 | let kuserNFTStakedId = "_userNFTStakedId" | |
31 | 31 | ||
32 | 32 | let kNFTCreated = "_NFTCreated" | |
33 | 33 | ||
34 | 34 | let kLastAirdrop = "_lastAirdrop" | |
35 | 35 | ||
36 | 36 | let kTokenid = "tokenId" | |
37 | 37 | ||
38 | 38 | let kPersentForNFT = "percentForNFT" | |
39 | 39 | ||
40 | 40 | let kNFTCreatedList = "nftCreatedList" | |
41 | 41 | ||
42 | 42 | let kActive = "active" | |
43 | 43 | ||
44 | 44 | let kAdmin1PK = "admin_pub_1" | |
45 | 45 | ||
46 | 46 | let kAdmin2PK = "admin_pub_2" | |
47 | 47 | ||
48 | 48 | let kAdmin3PK = "admin_pub_3" | |
49 | 49 | ||
50 | 50 | let admin1PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin1PK), "Can't get admin1PK")) | |
51 | 51 | ||
52 | 52 | let admin2PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin2PK), "Can't get admin2PK")) | |
53 | 53 | ||
54 | 54 | let admin3PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin3PK), "Can't get operatorPK")) | |
55 | 55 | ||
56 | 56 | let tokenId = valueOrErrorMessage(getString(this, kTokenid), "Can't get staking token") | |
57 | 57 | ||
58 | 58 | func isAdminCall (i) = if (containsElement([admin1PK, admin2PK, admin3PK], i.callerPublicKey)) | |
59 | 59 | then unit | |
60 | 60 | else throw("Only admin can call this function") | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func isSelfCall (i) = if ((i.caller == this)) | |
64 | 64 | then unit | |
65 | 65 | else throw("Only contract itself can call this function") | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func isActive () = if (valueOrElse(getBoolean(this, kActive), true)) | |
69 | 69 | then unit | |
70 | 70 | else throw("DApp is inactive at this moment") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func assetIdToStr (assetId) = match assetId { | |
74 | 74 | case id: ByteVector => | |
75 | 75 | toBase58String(id) | |
76 | 76 | case waves: Unit => | |
77 | 77 | "WAVES" | |
78 | 78 | case _ => | |
79 | 79 | throw("Not Asset id") | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func claimCalc (user) = { | |
84 | 84 | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
85 | 85 | let curInterest = valueOrElse(getInteger(this, kInterest), 0) | |
86 | 86 | let availableForClaim = valueOrElse(getInteger(this, (user + kUserAvailable)), 0) | |
87 | 87 | let userInterest = valueOrElse(getInteger(this, (user + kUserInterest)), curInterest) | |
88 | 88 | let userTokenStaked = valueOrElse(getInteger(this, (user + kUserTokenStaked)), 0) | |
89 | 89 | let claimAmount = fraction(userTokenStaked, (curInterest - userInterest), SCALE8) | |
90 | 90 | $Tuple4(curInterest, (claimAmount + availableForClaim), userTokenStaked, totalTokenStaked) | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func claimCalcNft (user) = { | |
95 | 95 | let totalNftStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
96 | 96 | let curInterest = valueOrElse(getInteger(this, kNFTInterest), 0) | |
97 | 97 | let availableForClaim = valueOrElse(getInteger(this, (user + kNFTUserAvailableClaim)), 0) | |
98 | 98 | let userInterest = valueOrElse(getInteger(this, (user + kNFTUserInterest)), curInterest) | |
99 | 99 | let userNftStaked = valueOrElse(getInteger(this, (user + kuserNFTStaked)), 0) | |
100 | 100 | let claimAmount = (userNftStaked * (curInterest - userInterest)) | |
101 | 101 | $Tuple4(curInterest, (claimAmount + availableForClaim), userNftStaked, totalNftStaked) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func calcTokenApr () = { | |
106 | 106 | let lastAirdrop = valueOrElse(getInteger(this, kLastAirdrop), 0) | |
107 | 107 | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
108 | 108 | let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
109 | 109 | let percentForNFT = getIntegerValue(this, kPersentForNFT) | |
110 | 110 | let tokenAirdrop = if ((totalNFTStaked == 0)) | |
111 | 111 | then lastAirdrop | |
112 | 112 | else fraction(lastAirdrop, min([percentForNFT, (totalNFTStaked * 10)]), 100) | |
113 | 113 | (fraction(tokenAirdrop, PERCENT_SCALE, totalTokenStaked) * 52) | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | @Callable(i) | |
118 | - | func | |
118 | + | func getStatsREADONLY () = { | |
119 | 119 | let apr = calcTokenApr() | |
120 | - | let $t036294228 = if ((user == "")) | |
120 | + | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
121 | + | let totalNftStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
122 | + | $Tuple2(nil, makeString(["%d%d%d", toString(apr), toString(totalTokenStaked), toString(totalNftStaked)], SEPARATOR)) | |
123 | + | } | |
124 | + | ||
125 | + | ||
126 | + | ||
127 | + | @Callable(i) | |
128 | + | func getStatsByUserREADONLY (user) = { | |
129 | + | let $t039804579 = if ((user == "")) | |
121 | 130 | then $Tuple4(0, 0, 0, 0) | |
122 | 131 | else { | |
123 | 132 | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
124 | - | let $ | |
125 | - | let userNewInterest = $ | |
126 | - | let claimAmountAvailable = $ | |
127 | - | let userTokenStaked = $ | |
128 | - | let totalTokenStaked = $ | |
129 | - | let $ | |
130 | - | let userNewInterestNFT = $ | |
131 | - | let claimAmountAvailableNFT = $ | |
132 | - | let userNFTStaked = $ | |
133 | - | let totalNFTStaked = $ | |
133 | + | let $t042174313 = claimCalc(user) | |
134 | + | let userNewInterest = $t042174313._1 | |
135 | + | let claimAmountAvailable = $t042174313._2 | |
136 | + | let userTokenStaked = $t042174313._3 | |
137 | + | let totalTokenStaked = $t042174313._4 | |
138 | + | let $t043204421 = claimCalcNft(user) | |
139 | + | let userNewInterestNFT = $t043204421._1 | |
140 | + | let claimAmountAvailableNFT = $t043204421._2 | |
141 | + | let userNFTStaked = $t043204421._3 | |
142 | + | let totalNFTStaked = $t043204421._4 | |
134 | 143 | let userBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
135 | 144 | $Tuple4(userBalance, userTokenStaked, claimAmountAvailable, claimAmountAvailableNFT) | |
136 | 145 | } | |
137 | - | let userTokenBalance = $t036294228._1 | |
138 | - | let userTokenStaked = $t036294228._2 | |
139 | - | let claimAmountAvailable = $t036294228._3 | |
140 | - | let claimAmountAvailableNFT = $t036294228._4 | |
146 | + | let userTokenBalance = $t039804579._1 | |
147 | + | let userTokenStaked = $t039804579._2 | |
148 | + | let claimAmountAvailable = $t039804579._3 | |
149 | + | let claimAmountAvailableNFT = $t039804579._4 | |
150 | + | $Tuple2(nil, makeString(["%d%d%d%d", toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT)], SEPARATOR)) | |
151 | + | } | |
152 | + | ||
153 | + | ||
154 | + | ||
155 | + | @Callable(i) | |
156 | + | func getUserStatsREADONLY (user) = { | |
157 | + | let apr = calcTokenApr() | |
158 | + | let $t048905489 = if ((user == "")) | |
159 | + | then $Tuple4(0, 0, 0, 0) | |
160 | + | else { | |
161 | + | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
162 | + | let $t051275223 = claimCalc(user) | |
163 | + | let userNewInterest = $t051275223._1 | |
164 | + | let claimAmountAvailable = $t051275223._2 | |
165 | + | let userTokenStaked = $t051275223._3 | |
166 | + | let totalTokenStaked = $t051275223._4 | |
167 | + | let $t052305331 = claimCalcNft(user) | |
168 | + | let userNewInterestNFT = $t052305331._1 | |
169 | + | let claimAmountAvailableNFT = $t052305331._2 | |
170 | + | let userNFTStaked = $t052305331._3 | |
171 | + | let totalNFTStaked = $t052305331._4 | |
172 | + | let userBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
173 | + | $Tuple4(userBalance, userTokenStaked, claimAmountAvailable, claimAmountAvailableNFT) | |
174 | + | } | |
175 | + | let userTokenBalance = $t048905489._1 | |
176 | + | let userTokenStaked = $t048905489._2 | |
177 | + | let claimAmountAvailable = $t048905489._3 | |
178 | + | let claimAmountAvailableNFT = $t048905489._4 | |
141 | 179 | $Tuple2(nil, makeString(["%d%d%d%d%d", toString(apr), toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT)], SEPARATOR)) | |
142 | 180 | } | |
143 | 181 | ||
144 | 182 | ||
145 | 183 | ||
146 | 184 | @Callable(i) | |
147 | 185 | func init (tokenId,adm1Pub,adm2Pub,adm3Pub,toNFTPercent) = valueOrElse(isSelfCall(i), if (isDefined(getString(this, kTokenid))) | |
148 | 186 | then throw("DApp already inited") | |
149 | 187 | else if (!(isDefined(assetInfo(fromBase58String(tokenId))))) | |
150 | 188 | then throw("asset id is not correct asset id") | |
151 | 189 | else if ((size(fromBase58String(adm1Pub)) != 32)) | |
152 | 190 | then throw("group1Admin1PubKey is not correct") | |
153 | 191 | else if ((size(fromBase58String(adm2Pub)) != 32)) | |
154 | 192 | then throw("group1Admin1PubKey is not correct") | |
155 | 193 | else if ((size(fromBase58String(adm3Pub)) != 32)) | |
156 | 194 | then throw("group1Admin1PubKey is not correct") | |
157 | 195 | else [StringEntry(kTokenid, tokenId), StringEntry(kAdmin1PK, adm1Pub), StringEntry(kAdmin2PK, adm2Pub), StringEntry(kAdmin3PK, adm3Pub), IntegerEntry(kPersentForNFT, toNFTPercent)]) | |
158 | 196 | ||
159 | 197 | ||
160 | 198 | ||
161 | 199 | @Callable(i) | |
162 | 200 | func stake () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
163 | 201 | then throw("One payment expected") | |
164 | 202 | else { | |
165 | - | let $ | |
166 | - | let pmtAmount = $ | |
167 | - | let pmtAssetId = $ | |
203 | + | let $t066926767 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
204 | + | let pmtAmount = $t066926767._1 | |
205 | + | let pmtAssetId = $t066926767._2 | |
168 | 206 | if ((pmtAssetId != fromBase58String(tokenId))) | |
169 | 207 | then throw("Wrong payment asset") | |
170 | 208 | else { | |
171 | 209 | let user = toString(i.caller) | |
172 | - | let $ | |
173 | - | let userNewInterest = $ | |
174 | - | let claimAmountAvailable = $ | |
175 | - | let userTokenStaked = $ | |
176 | - | let totalTokenStaked = $ | |
210 | + | let $t068886984 = claimCalc(user) | |
211 | + | let userNewInterest = $t068886984._1 | |
212 | + | let claimAmountAvailable = $t068886984._2 | |
213 | + | let userTokenStaked = $t068886984._3 | |
214 | + | let totalTokenStaked = $t068886984._4 | |
177 | 215 | [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked + pmtAmount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked + pmtAmount))] | |
178 | 216 | } | |
179 | 217 | }) | |
180 | 218 | ||
181 | 219 | ||
182 | 220 | ||
183 | 221 | @Callable(i) | |
184 | 222 | func unstake (amount) = valueOrElse(isActive(), { | |
185 | 223 | let user = toString(i.caller) | |
186 | 224 | if ((0 >= amount)) | |
187 | 225 | then throw("Amount must be greater than 0") | |
188 | 226 | else { | |
189 | - | let $ | |
190 | - | let userNewInterest = $ | |
191 | - | let claimAmountAvailable = $ | |
192 | - | let userTokenStaked = $ | |
193 | - | let totalTokenStaked = $ | |
227 | + | let $t074227518 = claimCalc(user) | |
228 | + | let userNewInterest = $t074227518._1 | |
229 | + | let claimAmountAvailable = $t074227518._2 | |
230 | + | let userTokenStaked = $t074227518._3 | |
231 | + | let totalTokenStaked = $t074227518._4 | |
194 | 232 | if ((amount > userTokenStaked)) | |
195 | 233 | then throw("You can't unstake more than staked") | |
196 | 234 | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount)), ScriptTransfer(i.caller, amount, fromBase58String(tokenId))] | |
197 | 235 | } | |
198 | 236 | }) | |
199 | 237 | ||
200 | 238 | ||
201 | 239 | ||
202 | 240 | @Callable(i) | |
203 | 241 | func claim () = valueOrElse(isActive(), { | |
204 | 242 | let user = toString(i.caller) | |
205 | - | let $ | |
206 | - | let userNewInterest = $ | |
207 | - | let claimAmountAvailable = $ | |
208 | - | let userTokenStaked = $ | |
209 | - | let totalTokenStaked = $ | |
210 | - | let $ | |
211 | - | let userNewInterestNFT = $ | |
212 | - | let claimAmountAvailableNFT = $ | |
213 | - | let userNFTStaked = $ | |
214 | - | let totalNFTStaked = $ | |
243 | + | let $t080248120 = claimCalc(user) | |
244 | + | let userNewInterest = $t080248120._1 | |
245 | + | let claimAmountAvailable = $t080248120._2 | |
246 | + | let userTokenStaked = $t080248120._3 | |
247 | + | let totalTokenStaked = $t080248120._4 | |
248 | + | let $t081238224 = claimCalcNft(user) | |
249 | + | let userNewInterestNFT = $t081238224._1 | |
250 | + | let claimAmountAvailableNFT = $t081238224._2 | |
251 | + | let userNFTStaked = $t081238224._3 | |
252 | + | let totalNFTStaked = $t081238224._4 | |
215 | 253 | if (((claimAmountAvailable + claimAmountAvailableNFT) == 0)) | |
216 | 254 | then throw("Nothing to claim") | |
217 | 255 | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), 0), IntegerEntry((user + kNFTUserInterest), userNewInterestNFT), IntegerEntry((user + kNFTUserAvailableClaim), 0), ScriptTransfer(i.caller, (claimAmountAvailable + claimAmountAvailableNFT), fromBase58String(tokenId))] | |
218 | 256 | }) | |
219 | 257 | ||
220 | 258 | ||
221 | 259 | ||
222 | 260 | @Callable(i) | |
223 | 261 | func stakeNFT () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
224 | 262 | then throw("One payment expected") | |
225 | 263 | else { | |
226 | - | let $ | |
227 | - | let pmtAmount = $ | |
228 | - | let pmtAssetId = $ | |
264 | + | let $t087808855 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
265 | + | let pmtAmount = $t087808855._1 | |
266 | + | let pmtAssetId = $t087808855._2 | |
229 | 267 | let pmtAssetIdStr = assetIdToStr(pmtAssetId) | |
230 | 268 | if (!(isDefined(getString(this, (pmtAssetIdStr + kNFTCreated))))) | |
231 | 269 | then throw("Wrong nft asset") | |
232 | 270 | else { | |
233 | 271 | let user = toString(i.caller) | |
234 | - | let $ | |
235 | - | let userNewInterest = $ | |
236 | - | let claimAmountAvailable = $ | |
237 | - | let userNFTStaked = $ | |
238 | - | let totalNFTStaked = $ | |
272 | + | let $t090369131 = claimCalcNft(user) | |
273 | + | let userNewInterest = $t090369131._1 | |
274 | + | let claimAmountAvailable = $t090369131._2 | |
275 | + | let userNFTStaked = $t090369131._3 | |
276 | + | let totalNFTStaked = $t090369131._4 | |
239 | 277 | [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked + 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked + 1)), BooleanEntry((((user + "_") + pmtAssetIdStr) + kuserNFTStakedId), true)] | |
240 | 278 | } | |
241 | 279 | }) | |
242 | 280 | ||
243 | 281 | ||
244 | 282 | ||
245 | 283 | @Callable(i) | |
246 | 284 | func unstakeNFT (id) = valueOrElse(isActive(), { | |
247 | 285 | let user = toString(i.caller) | |
248 | 286 | if (isDefined(getBoolean(this, (((user + "_") + id) + kuserNFTStakedId)))) | |
249 | 287 | then throw("You didn't staked") | |
250 | 288 | else { | |
251 | - | let $ | |
252 | - | let userNewInterest = $ | |
253 | - | let claimAmountAvailable = $ | |
254 | - | let userNFTStaked = $ | |
255 | - | let totalNFTStaked = $ | |
289 | + | let $t096689763 = claimCalcNft(user) | |
290 | + | let userNewInterest = $t096689763._1 | |
291 | + | let claimAmountAvailable = $t096689763._2 | |
292 | + | let userNFTStaked = $t096689763._3 | |
293 | + | let totalNFTStaked = $t096689763._4 | |
256 | 294 | [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked - 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked - 1)), DeleteEntry((((user + "_") + id) + kuserNFTStakedId)), ScriptTransfer(i.caller, 1, fromBase58String(id))] | |
257 | 295 | } | |
258 | 296 | }) | |
259 | 297 | ||
260 | 298 | ||
261 | 299 | ||
262 | 300 | @Callable(i) | |
263 | 301 | func issueNFT (userAddr,name,descr) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), { | |
264 | 302 | let uAddr = valueOrErrorMessage(addressFromString(userAddr), "Wrong user address") | |
265 | 303 | let issue = Issue(name, descr, 1, 0, false) | |
266 | 304 | let nftId = calculateAssetId(issue) | |
267 | 305 | let nftList = valueOrElse(getString(this, kNFTCreatedList), "") | |
268 | 306 | let newNftList = (nftList + (if ((nftList != "")) | |
269 | - | then SEPARATOR | |
307 | + | then (SEPARATOR + toBase58String(nftId)) | |
270 | 308 | else ("" + toBase58String(nftId)))) | |
271 | 309 | [issue, StringEntry((toBase58String(nftId) + kNFTCreated), userAddr), StringEntry(kNFTCreatedList, newNftList), ScriptTransfer(uAddr, 1, nftId)] | |
272 | 310 | })) | |
273 | 311 | ||
274 | 312 | ||
275 | 313 | ||
276 | 314 | @Callable(i) | |
277 | 315 | func airdrop () = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if ((size(i.payments) != 1)) | |
278 | 316 | then throw("One payment expected") | |
279 | 317 | else { | |
280 | - | let $ | |
281 | - | let pmtAmount = $ | |
282 | - | let pmtAssetId = $ | |
318 | + | let $t01093311008 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
319 | + | let pmtAmount = $t01093311008._1 | |
320 | + | let pmtAssetId = $t01093311008._2 | |
283 | 321 | if ((pmtAssetId != fromBase58String(tokenId))) | |
284 | 322 | then throw("Wrong payment asset") | |
285 | 323 | else { | |
286 | 324 | let percentForNFT = getIntegerValue(this, kPersentForNFT) | |
287 | 325 | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
288 | 326 | let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
289 | 327 | let curInterest = valueOrElse(getInteger(this, kInterest), 0) | |
290 | 328 | let curNFTInterest = valueOrElse(getInteger(this, kNFTInterest), 0) | |
291 | - | let $ | |
329 | + | let $t01143111635 = if ((totalNFTStaked == 0)) | |
292 | 330 | then $Tuple2(0, pmtAmount) | |
293 | 331 | else { | |
294 | 332 | let nftP = fraction(pmtAmount, min([percentForNFT, (totalNFTStaked * 10)]), 100) | |
295 | 333 | $Tuple2(nftP, (pmtAmount - nftP)) | |
296 | 334 | } | |
297 | - | let pmtNFT = $ | |
298 | - | let pmtToken = $ | |
335 | + | let pmtNFT = $t01143111635._1 | |
336 | + | let pmtToken = $t01143111635._2 | |
299 | 337 | let interestNew = if ((totalTokenStaked > 0)) | |
300 | 338 | then (curInterest + fraction(pmtToken, SCALE8, totalTokenStaked)) | |
301 | 339 | else curInterest | |
302 | 340 | let interestNFTNew = if ((totalNFTStaked > 0)) | |
303 | 341 | then (curNFTInterest + (pmtNFT / totalNFTStaked)) | |
304 | 342 | else curNFTInterest | |
305 | 343 | [IntegerEntry(kInterest, interestNew), IntegerEntry(kNFTInterest, interestNFTNew), IntegerEntry(kLastAirdrop, pmtAmount)] | |
306 | 344 | } | |
307 | 345 | })) | |
308 | 346 | ||
309 | 347 | ||
310 | 348 | ||
311 | 349 | @Callable(i) | |
312 | 350 | func activate () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, kActive), true)) | |
313 | 351 | then throw("dApp already active") | |
314 | 352 | else [BooleanEntry(kActive, true)]) | |
315 | 353 | ||
316 | 354 | ||
317 | 355 | ||
318 | 356 | @Callable(i) | |
319 | 357 | func shutdown () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, kActive), true))) | |
320 | 358 | then throw("dApp already shutdown") | |
321 | 359 | else [BooleanEntry(kActive, false)]) | |
322 | 360 | ||
323 | 361 | ||
324 | 362 | @Verifier(tx) | |
325 | 363 | func verify () = { | |
326 | 364 | let multiSignedByAdmins = { | |
327 | 365 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK)) | |
328 | 366 | then 1 | |
329 | 367 | else 0 | |
330 | 368 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], admin2PK)) | |
331 | 369 | then 1 | |
332 | 370 | else 0 | |
333 | 371 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], admin3PK)) | |
334 | 372 | then 1 | |
335 | 373 | else 0 | |
336 | 374 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
337 | 375 | } | |
338 | 376 | match tx { | |
339 | 377 | case inv: InvokeScriptTransaction => | |
340 | 378 | let isSelf = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
341 | 379 | let isRightFee = if ((inv.fee == 900000)) | |
342 | 380 | then (inv.feeAssetId == unit) | |
343 | 381 | else false | |
344 | 382 | let isInitCall = (inv.function == "init") | |
345 | 383 | let isnoPayments = (size(inv.payments) == 0) | |
346 | 384 | if (if (if (if (isRightFee) | |
347 | 385 | then isInitCall | |
348 | 386 | else false) | |
349 | 387 | then isSelf | |
350 | 388 | else false) | |
351 | 389 | then isnoPayments | |
352 | 390 | else false) | |
353 | 391 | then true | |
354 | 392 | else multiSignedByAdmins | |
355 | 393 | case _ => | |
356 | 394 | multiSignedByAdmins | |
357 | 395 | } | |
358 | 396 | } | |
359 | 397 |
github/deemru/w8io/026f985 75.44 ms ◑