tx · 9bZcZVVfKBo6cmyveBfVFu7iDNdMvDwd6QMSe4SRtRrt 3MwMNZ5PmZeVN8sDprmFuYbjJVeJVxMa46f: -0.00900000 Waves 2022.06.24 01:52 [2109677] smart account 3MwMNZ5PmZeVN8sDprmFuYbjJVeJVxMa46f > SELF 0.00000000 Waves
{ "type": 13, "id": "9bZcZVVfKBo6cmyveBfVFu7iDNdMvDwd6QMSe4SRtRrt", "fee": 900000, "feeAssetId": null, "timestamp": 1656024754983, "version": 2, "chainId": 84, "sender": "3MwMNZ5PmZeVN8sDprmFuYbjJVeJVxMa46f", "senderPublicKey": "CpLxySPGoDGRVBSTXHBZr9PxDduQz4JU6GK9jSAdpXse", "proofs": [ "5cTL1go2x4b9A1r2U8K6agxWERZrktdXBqnxB9zz3nQFxPoy8s8NboX5DdYCKsBv1mwg7y9bjcmLdbPVzEsgUS76" ], "script": "base64:AAIFAAAAAAAAABQIAhIDCgEBEgQKAgEEEgMKAQQSAAAAAA4AAAAABG5hbWUCAAAACVpldGEgVEVBTQAAAAALc3Rha2VkUG93ZXIAAAAAAAAAAAEAAAAAB2RlY2ltYWwAAAAAAAX14QABAAAABmdldFN0cgAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAABAAAABWNoZWNrAAAAAQAAAANwYmsEAAAABnBia19zdAkAAlgAAAABBQAAAANwYmsEAAAABnBvaW50cwkBAAAAEUBleHRyTmF0aXZlKDEwNTgpAAAAAQIAAAAGcG9pbnRzCQEAAAAIY29udGFpbnMAAAACBQAAAAZwb2ludHMFAAAABnBia19zdAAAAAAMc2hhcmVUb2tlbklkCQEAAAAGZ2V0U3RyAAAAAQIAAAAOU0hBUkVfQVNTRVRfSUQBAAAAD2dldFNoYXJlQXNzZXRJZAAAAAAJAAJZAAAAAQUAAAAM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D2tleVN0YWtlZEFtb3VudAAAAAEIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAANuaWwAAAABaQEAAAALY2xhaW1SZXdhcmQAAAAAAwkAAGYAAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAACQAAAgAAAAECAAAAGVBsZWFzZSBkb24ndCBhZGQgcGF5bWVudHMJAQAAABJjbGFpbVN0YWtpbmdSZXN1bHQAAAABCAUAAAABaQAAAAZjYWxsZXIAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQ2rpFk=", "height": 2109677, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AcK5HJWswsTpWYHMq5d46Cig46RDbqmbFnH4UBdGB4UH Next: none Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let name = "Zeta TEAM" | |
5 | 5 | ||
6 | - | let stakedPower = 10 | |
6 | + | let stakedPower = 1 | |
7 | + | ||
8 | + | let decimal = 100000000 | |
7 | 9 | ||
8 | 10 | func getStr (key) = match getString(this, key) { | |
9 | 11 | case b: String => | |
52 | 54 | let lastCheckInterest = tryGetInteger(keyLastCheckInterest(address)) | |
53 | 55 | let stakedAmount = tryGetInteger(keyStakedAmount(address)) | |
54 | 56 | let reward = if ((lastCheckInterest > 0)) | |
55 | - | then (((currentInterest - lastCheckInterest) | |
57 | + | then (fraction((currentInterest - lastCheckInterest), stakedAmount, decimal) * stakedPower) | |
56 | 58 | else 0 | |
57 | 59 | let transfer = if ((reward > 0)) | |
58 | 60 | then [ScriptTransfer(address, reward, getEggId())] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let name = "Zeta TEAM" | |
5 | 5 | ||
6 | - | let stakedPower = 10 | |
6 | + | let stakedPower = 1 | |
7 | + | ||
8 | + | let decimal = 100000000 | |
7 | 9 | ||
8 | 10 | func getStr (key) = match getString(this, key) { | |
9 | 11 | case b: String => | |
10 | 12 | b | |
11 | 13 | case _ => | |
12 | 14 | "" | |
13 | 15 | } | |
14 | 16 | ||
15 | 17 | ||
16 | 18 | func check (pbk) = { | |
17 | 19 | let pbk_st = toBase58String(pbk) | |
18 | 20 | let points = getStringValue("points") | |
19 | 21 | contains(points, pbk_st) | |
20 | 22 | } | |
21 | 23 | ||
22 | 24 | ||
23 | 25 | let shareTokenId = getStr("SHARE_ASSET_ID") | |
24 | 26 | ||
25 | 27 | func getShareAssetId () = fromBase58String(shareTokenId) | |
26 | 28 | ||
27 | 29 | ||
28 | 30 | let bullBank = base58'3N3k8kYqD1uZA9G5LxEPirYd2Ftpswpn9mC' | |
29 | 31 | ||
30 | 32 | func getEggId () = base58'EUNzgdPinhbvxEwRDxakAU7EB9QHupsUXYB8TTXdjnSS' | |
31 | 33 | ||
32 | 34 | ||
33 | 35 | func tryGetInteger (key) = match getInteger(this, key) { | |
34 | 36 | case b: Int => | |
35 | 37 | b | |
36 | 38 | case _ => | |
37 | 39 | 0 | |
38 | 40 | } | |
39 | 41 | ||
40 | 42 | ||
41 | 43 | func keyStakedAmount (address) = (toString(address) + "_farm_staked") | |
42 | 44 | ||
43 | 45 | ||
44 | 46 | func keyLastCheckInterest (address) = (toString(address) + "_lastCheck_interest") | |
45 | 47 | ||
46 | 48 | ||
47 | 49 | func keyEggClaimed (address) = (toString(address) + "_claimed") | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | func claimStakingResult (address) = { | |
51 | 53 | let currentInterest = height | |
52 | 54 | let lastCheckInterest = tryGetInteger(keyLastCheckInterest(address)) | |
53 | 55 | let stakedAmount = tryGetInteger(keyStakedAmount(address)) | |
54 | 56 | let reward = if ((lastCheckInterest > 0)) | |
55 | - | then (((currentInterest - lastCheckInterest) | |
57 | + | then (fraction((currentInterest - lastCheckInterest), stakedAmount, decimal) * stakedPower) | |
56 | 58 | else 0 | |
57 | 59 | let transfer = if ((reward > 0)) | |
58 | 60 | then [ScriptTransfer(address, reward, getEggId())] | |
59 | 61 | else nil | |
60 | 62 | (transfer ++ [IntegerEntry(keyLastCheckInterest(address), currentInterest), IntegerEntry(keyEggClaimed(address), (tryGetInteger(keyEggClaimed(address)) + reward))]) | |
61 | 63 | } | |
62 | 64 | ||
63 | 65 | ||
64 | 66 | @Callable(i) | |
65 | 67 | func issueToken (amount) = if (check(i.callerPublicKey)) | |
66 | 68 | then if ((shareTokenId != "")) | |
67 | 69 | then [Reissue(fromBase58String(shareTokenId), amount, true), ScriptTransfer(i.caller, amount, getShareAssetId())] | |
68 | 70 | else { | |
69 | 71 | let shareToken = Issue(name, (("Team token for the " + name) + " collective farm"), amount, 8, true) | |
70 | 72 | [shareToken, StringEntry("SHARE_ASSET_ID", toBase58String(calculateAssetId(shareToken)))] | |
71 | 73 | } | |
72 | 74 | else throw("Private Farm. Access prohibited!") | |
73 | 75 | ||
74 | 76 | ||
75 | 77 | ||
76 | 78 | @Callable(i) | |
77 | 79 | func withdrawFarmTokens (amount,compound) = if ((size(i.payments) > 0)) | |
78 | 80 | then throw("Please don't add payments") | |
79 | 81 | else if (compound) | |
80 | 82 | then throw("No compound, please!") | |
81 | 83 | else { | |
82 | 84 | let addressStr = toString(i.caller) | |
83 | 85 | let stakedAmount = tryGetInteger(keyStakedAmount(i.caller)) | |
84 | 86 | let wdAmount = if ((amount == -1)) | |
85 | 87 | then stakedAmount | |
86 | 88 | else amount | |
87 | 89 | if ((wdAmount > stakedAmount)) | |
88 | 90 | then throw("you don't have tokens available") | |
89 | 91 | else (claimStakingResult(i.caller) ++ [IntegerEntry(keyStakedAmount(i.caller), (stakedAmount - wdAmount)), ScriptTransfer(i.caller, wdAmount, getShareAssetId())]) | |
90 | 92 | } | |
91 | 93 | ||
92 | 94 | ||
93 | 95 | ||
94 | 96 | @Callable(i) | |
95 | 97 | func stakeFarmTokens (compound) = { | |
96 | 98 | let shareTokenIdBytes = getShareAssetId() | |
97 | 99 | if ((size(i.payments) > 1)) | |
98 | 100 | then throw("To many payments added") | |
99 | 101 | else if ((i.payments[0].assetId != shareTokenIdBytes)) | |
100 | 102 | then throw("Wrong assetId") | |
101 | 103 | else if (compound) | |
102 | 104 | then throw("No compound, please!") | |
103 | 105 | else { | |
104 | 106 | let amount = i.payments[0].amount | |
105 | 107 | let addressStr = toString(i.caller) | |
106 | 108 | if ((i.payments[0].assetId != shareTokenIdBytes)) | |
107 | 109 | then throw("wrong asset attached") | |
108 | 110 | else (claimStakingResult(i.caller) ++ [IntegerEntry(keyStakedAmount(i.caller), (tryGetInteger(keyStakedAmount(i.caller)) + amount))]) | |
109 | 111 | } | |
110 | 112 | } | |
111 | 113 | ||
112 | 114 | ||
113 | 115 | ||
114 | 116 | @Callable(i) | |
115 | 117 | func claimReward () = if ((size(i.payments) > 0)) | |
116 | 118 | then throw("Please don't add payments") | |
117 | 119 | else claimStakingResult(i.caller) | |
118 | 120 | ||
119 | 121 | ||
120 | 122 | @Verifier(tx) | |
121 | 123 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
122 | 124 |
github/deemru/w8io/169f3d6 31.78 ms ◑