tx · 57KAy3WDXNrFtUN5iLoZSz7gLFfN8Ly4GaUPFvuWmvZc 3Mtwm9zTenpozLfVL46hAidH3zuLKScURQK: -0.01400000 Waves 2021.11.17 16:57 [1795122] smart account 3Mtwm9zTenpozLfVL46hAidH3zuLKScURQK > SELF 0.00000000 Waves
{ "type": 13, "id": "57KAy3WDXNrFtUN5iLoZSz7gLFfN8Ly4GaUPFvuWmvZc", "fee": 1400000, "feeAssetId": null, "timestamp": 1637157493998, "version": 2, "chainId": 84, "sender": "3Mtwm9zTenpozLfVL46hAidH3zuLKScURQK", "senderPublicKey": "Eu1AYNJAMgEeS5Wftr8wEFyspBRFVBv9qQV7XCYzGpxn", "proofs": [ "4KYqKxkt8v9mQoteGeBM3otwgXFhHG8y7rs8PDzuwKxuRUKAFKJzv2UJ4cwdnTMbpvNyac3t7JneZJzPvU5hm8h" ], "script": "base64:AAIFAAAAAAAAAAsIAhIAEgMKAQESAAAAAAgAAAAACkRJU0NMQUlNRVICAAAARXRlc3RpbmcgUFVaWkxFIHN0YWtpbmcgc21hcnQgY29udHJhY3Qgd2l0aCByZXdhcmRzIGluIG11bHRpcGxlIGFzc2V0cwAAAAAFc2NhbGUAAAAAAAX14QAAAAAACHB1enpsZUlkAQAAACD+xBrh3u/naSJ9Eujvd+1d33EPvCCH0lpodP3xbghYNwAAAAAMZWFybmVkQXNzZXRzCQAETAAAAAIBAAAAIAhlhLcP8IpqGvPiaOguCJAkw9MnWAPNLPYuXgvf2hWkCQAETAAAAAIBAAAAILYmKcME9c5TkaQOS3UkL2SMUbH6369UKb1I0h0qsqrRCQAETAAAAAIBAAAAIMsNZWEOiZVYNXpBi2Ybb1youCxEjpzJ+bYYhbDils6dCQAETAAAAAIBAAAAIJWeoqHE/VM6llJihm3Pbu4DsBTneJAmzXJqqfw3qIHoCQAETAAAAAIBAAAAIERMQj0IfbtQ71vvD6lMQZsjo7R1kbzVylNCXNNKY0ExCQAETAAAAAIBAAAAIDxTA10LiK0+XoDGc8iIJHM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 1795122, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AFMkPUJdUV6m4NXpK5M9MzZ7Sq9S2aUPqQHvit9os2t2 Next: Am7RAxgqgvi8rY2bdNnhXnbc6wFE3JshPYw8q8LMKykX Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let scale = 100000000 | |
7 | 7 | ||
8 | - | let puzzleId = base58' | |
8 | + | let puzzleId = base58'J9VzWPfRSQyCbEv5oWpxLSihigbpbJsGBHJZV9Ct8ook' | |
9 | 9 | ||
10 | 10 | let earnedAssets = [base58'Zn3cLHW7aAVPm5aACcTjvg7e7iEy2cKDtbowok5qa9H', base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p', base58'EfdcPXw7o7rrrPWmMBr2sa66Dk95n56622ngujbaGhye', base58'B543bkZcZNo5GrUnd5fxB6EwkiJhAVyKCkPn5nWzZC2s', base58'5bcAh1r6ydrpk44FEmrnmJQjumgKo3NKEEsyfgmZYwxC', base58'54UszKAj3MtYmkdRCqSXAcaQLaVALBy7CCrVkfmfzhxR', base58'5nk9JW8yRonyNBEwhChoksLxpBECVxbVLqaNuQs9EJn1', base58'Dfx6LJPndo1h5Umk9SofDhMDs6Gi8cHyT3873pSgoASU', base58'4kwKSf4Bx2Wq8YxKnVZBhcEHyXzEtJ2pw7ixfJgirwf2', base58'Ej7kEzxvUsoiMtJKiuFpMD9tC6qfCADpZynyW2vqcWW', base58'5HGPPLj58XUx3ryMgkASJoqYq33zwBbTMf1CGxfKw6jp', base58'yDf4UTg4DS75sCNP7oC1HraTN4KHtqmd6WueTid4PF1', base58'2R57nL7ftpuwbgdprcmAeA9i7ykLH6A4wzLkZHWPiHKc', base58'CE5cxMvz7865CyFZPFUmDiL4KRkYXP6b6oYgN3vmWdV5', base58'5m5stLsMZSPomwxTTjJGMMEnjMafRMfap5vZyaLwgMKD', base58'46PdJcKzDuYfzLuLNjffM3F8jR8hL357V9AdGK2xN3kx', base58'ESaD2AREvgk7o4C9eQkZ8Nmau9BSHqgTK5ymHV36xocy'] | |
11 | 11 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let DISCLAIMER = "testing PUZZLE staking smart contract with rewards in multiple assets" | |
5 | 5 | ||
6 | 6 | let scale = 100000000 | |
7 | 7 | ||
8 | - | let puzzleId = base58' | |
8 | + | let puzzleId = base58'J9VzWPfRSQyCbEv5oWpxLSihigbpbJsGBHJZV9Ct8ook' | |
9 | 9 | ||
10 | 10 | let earnedAssets = [base58'Zn3cLHW7aAVPm5aACcTjvg7e7iEy2cKDtbowok5qa9H', base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p', base58'EfdcPXw7o7rrrPWmMBr2sa66Dk95n56622ngujbaGhye', base58'B543bkZcZNo5GrUnd5fxB6EwkiJhAVyKCkPn5nWzZC2s', base58'5bcAh1r6ydrpk44FEmrnmJQjumgKo3NKEEsyfgmZYwxC', base58'54UszKAj3MtYmkdRCqSXAcaQLaVALBy7CCrVkfmfzhxR', base58'5nk9JW8yRonyNBEwhChoksLxpBECVxbVLqaNuQs9EJn1', base58'Dfx6LJPndo1h5Umk9SofDhMDs6Gi8cHyT3873pSgoASU', base58'4kwKSf4Bx2Wq8YxKnVZBhcEHyXzEtJ2pw7ixfJgirwf2', base58'Ej7kEzxvUsoiMtJKiuFpMD9tC6qfCADpZynyW2vqcWW', base58'5HGPPLj58XUx3ryMgkASJoqYq33zwBbTMf1CGxfKw6jp', base58'yDf4UTg4DS75sCNP7oC1HraTN4KHtqmd6WueTid4PF1', base58'2R57nL7ftpuwbgdprcmAeA9i7ykLH6A4wzLkZHWPiHKc', base58'CE5cxMvz7865CyFZPFUmDiL4KRkYXP6b6oYgN3vmWdV5', base58'5m5stLsMZSPomwxTTjJGMMEnjMafRMfap5vZyaLwgMKD', base58'46PdJcKzDuYfzLuLNjffM3F8jR8hL357V9AdGK2xN3kx', base58'ESaD2AREvgk7o4C9eQkZ8Nmau9BSHqgTK5ymHV36xocy'] | |
11 | 11 | ||
12 | 12 | let earnedAssetsAmount = size(earnedAssets) | |
13 | 13 | ||
14 | 14 | func tryGetInteger (key) = match getInteger(this, key) { | |
15 | 15 | case b: Int => | |
16 | 16 | b | |
17 | 17 | case _ => | |
18 | 18 | 0 | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func calculateCurrentAssetInterest (assetId,assetIdStr) = { | |
23 | 23 | let totalStaked = tryGetInteger("global_puzzleStaked") | |
24 | 24 | let tokenBalanceLastCheck = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_earnings")) | |
25 | 25 | let currentTokenEarnings = max([tokenBalanceLastCheck, assetBalance(this, assetId)]) | |
26 | 26 | let newEarnings = (currentTokenEarnings - tokenBalanceLastCheck) | |
27 | 27 | let newInterest = if ((totalStaked == 0)) | |
28 | 28 | then 0 | |
29 | 29 | else fraction(newEarnings, scale, totalStaked) | |
30 | 30 | let lastCheckInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest")) | |
31 | 31 | (lastCheckInterest + newInterest) | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func claimResult (address) = { | |
36 | 36 | let addressStr = toString(address) | |
37 | 37 | let puzzleAmount = tryGetInteger((addressStr + "_puzzleStaked")) | |
38 | 38 | func handler (accum,assetId) = { | |
39 | 39 | let assetIdStr = toBase58String(assetId) | |
40 | 40 | let currentTokenInterest = calculateCurrentAssetInterest(assetId, assetIdStr) | |
41 | 41 | let currentTokenEarnings = max([tryGetInteger((("global_lastCheck_" + assetIdStr) + "_earnings")), assetBalance(this, assetId)]) | |
42 | 42 | let rewardAmount = fraction(puzzleAmount, (currentTokenInterest - tryGetInteger((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"))), scale) | |
43 | 43 | if ((rewardAmount == 0)) | |
44 | 44 | then accum | |
45 | 45 | else (accum ++ [IntegerEntry((("global_lastCheck_" + assetIdStr) + "_earnings"), (currentTokenEarnings - rewardAmount)), IntegerEntry((("global_lastCheck_" + assetIdStr) + "_interest"), currentTokenInterest), IntegerEntry((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"), currentTokenInterest), ScriptTransfer(address, rewardAmount, assetId)]) | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | let $l = earnedAssets | |
49 | 49 | let $s = size($l) | |
50 | 50 | let $acc0 = nil | |
51 | 51 | func 1 ($a,$i) = if (($i >= $s)) | |
52 | 52 | then $a | |
53 | 53 | else handler($a, $l[$i]) | |
54 | 54 | ||
55 | 55 | func 2 ($a,$i) = if (($i >= $s)) | |
56 | 56 | then $a | |
57 | 57 | else throw("List size exceeds 17") | |
58 | 58 | ||
59 | 59 | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | @Callable(i) | |
64 | 64 | func stake () = { | |
65 | 65 | let addressStr = toString(i.caller) | |
66 | 66 | let pmt = i.payments[0] | |
67 | 67 | if ((value(pmt.assetId) != puzzleId)) | |
68 | 68 | then throw("wrong asset attached") | |
69 | 69 | else { | |
70 | 70 | func handler (accum,assetId) = { | |
71 | 71 | let assetIdStr = toBase58String(assetId) | |
72 | 72 | let currentTokenInterest = calculateCurrentAssetInterest(assetId, assetIdStr) | |
73 | 73 | (accum ++ [IntegerEntry((("global_lastCheck_" + assetIdStr) + "_earnings"), assetBalance(this, assetId)), IntegerEntry((("global_lastCheck_" + assetIdStr) + "_interest"), currentTokenInterest), IntegerEntry((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"), currentTokenInterest)]) | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | let li = { | |
77 | 77 | let $l = earnedAssets | |
78 | 78 | let $s = size($l) | |
79 | 79 | let $acc0 = nil | |
80 | 80 | func 1 ($a,$i) = if (($i >= $s)) | |
81 | 81 | then $a | |
82 | 82 | else handler($a, $l[$i]) | |
83 | 83 | ||
84 | 84 | func 2 ($a,$i) = if (($i >= $s)) | |
85 | 85 | then $a | |
86 | 86 | else throw("List size exceeds 17") | |
87 | 87 | ||
88 | 88 | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
89 | 89 | } | |
90 | 90 | (li ++ [IntegerEntry((addressStr + "_puzzleStaked"), (tryGetInteger((addressStr + "_puzzleStaked")) + pmt.amount)), IntegerEntry("global_puzzleStaked", (tryGetInteger("global_puzzleStaked") + pmt.amount))]) | |
91 | 91 | } | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(i) | |
97 | 97 | func unstake (puzzleAmount) = { | |
98 | 98 | let addressStr = toString(i.caller) | |
99 | 99 | let puzzleAvailable = tryGetInteger((addressStr + "_puzzleStaked")) | |
100 | 100 | if ((puzzleAmount > puzzleAvailable)) | |
101 | 101 | then throw("you don't have PUZZLE available") | |
102 | 102 | else (claimResult(i.caller) ++ [IntegerEntry((addressStr + "_puzzleStaked"), (puzzleAvailable - puzzleAmount)), IntegerEntry("global_puzzleStaked", (tryGetInteger("global_puzzleStaked") - puzzleAmount))]) | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | ||
107 | 107 | @Callable(i) | |
108 | 108 | func claim () = claimResult(i.caller) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | @Verifier(tx) | |
112 | 112 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
113 | 113 |
github/deemru/w8io/169f3d6 31.41 ms ◑