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