tx · 9KgxHi2mTqthwMKii38rsrEtVBT7FA17nFeei57ja7Rb 3MtMh9VNeoU1KHBU5kVt7hHQhEUYbqzqEJz: -0.01000000 Waves 2022.01.21 23:53 [1889179] smart account 3MtMh9VNeoU1KHBU5kVt7hHQhEUYbqzqEJz > SELF 0.00000000 Waves
{ "type": 13, "id": "9KgxHi2mTqthwMKii38rsrEtVBT7FA17nFeei57ja7Rb", "fee": 1000000, "feeAssetId": null, "timestamp": 1642798428166, "version": 2, "chainId": 84, "sender": "3MtMh9VNeoU1KHBU5kVt7hHQhEUYbqzqEJz", "senderPublicKey": "5CGkDK1nydPrRrczEoAAqPgVS6ark32vTHEPM676oTzM", "proofs": [ "YmLtkbpX8McHrx5SDqCcKi9Fd6nCxGmcP5MTrc7wTD7fYkWhsR2qYkdFcaRX2KtXuJdu2iuW74n4ZnCLYC7Fmoy" ], "script": "base64:AAIFAAAAAAAAAXQIAhIAEgMKAQESABIAGgsKAWESBnNjb25leBoKCgFiEgVTY2FsZRoSCgFjEg10cnlHZXRJbnRlZ2VyGggKAWQSA2tleRoMCgFlEgckbWF0Y2gwGgYKAWYSAWIaEQoBZxIMdHJ5R2V0U3RyaW5nGgYKAWgSAWEaFQoBaRIQY2xhaW1BbGlhc1Jlc3VsdBoMCgFqEgdhZGRyZXNzGg8KAWsSCmFkZHJlc3NTdHIaFAoBbBIPY3VycmVudEludGVyZXN0GhYKAW0SEWxhc3RDaGVja0ludGVyZXN0GhEKAW4SDHN0YWtlZEFtb3VudBoLCgFvEgZyZXdhcmQaEAoBcBILY2xhaW1SZXN1bHQaBgoBcRIBaRoLCgFyEgZhbW91bnQaFgoBcxIRdG90YWxTdGFrZWRBbW91bnQaEAoBdBILdWx0cmFBbW91bnQaEgoBdRINaW50ZXJlc3REZWx0YRoHCgF2EgJ0eBoLCgF3EgZ2ZXJpZnkAAAAGAAAAAAFhAQAAACC6hu0QdKejwH9I+j+G8AYHkraWlmo7ShFw6+pV4JLTMwAAAAABYgAAAADo1KU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179, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 6Wx4PeW4mSksnt5sNyLaAobLwhDUxDKF19ueTGXnk1eT Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let sconex = base58'DZ8ALmuLeSZ2ocsYLAcL9MiXBFDbMNQG9LtitREyU5ZC' | |
5 | + | ||
6 | + | let Scale = 1000000000000 | |
7 | + | ||
8 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
9 | + | case b: Int => | |
10 | + | b | |
11 | + | case _ => | |
12 | + | 0 | |
13 | + | } | |
14 | + | ||
15 | + | ||
16 | + | func tryGetString (key) = match getString(this, key) { | |
17 | + | case a: String => | |
18 | + | a | |
19 | + | case _ => | |
20 | + | "" | |
21 | + | } | |
22 | + | ||
23 | + | ||
24 | + | func claimAliasResult (address) = { | |
25 | + | let addressStr = toString(address) | |
26 | + | let currentInterest = tryGetInteger("global_lastCheck_EGG_interest") | |
27 | + | let lastCheckInterest = tryGetInteger((addressStr + "_lastCheck_EGG_interest")) | |
28 | + | let stakedAmount = tryGetInteger((addressStr + "_EGG_staked")) | |
29 | + | let reward = if ((lastCheckInterest > 0)) | |
30 | + | then fraction((currentInterest - lastCheckInterest), stakedAmount, Scale) | |
31 | + | else 0 | |
32 | + | [IntegerEntry((addressStr + "_lastCheck_EGG_interest"), currentInterest), IntegerEntry((addressStr + "_EGG_claimed"), (tryGetInteger((addressStr + "_EGG_claimed")) + reward)), ScriptTransfer(address, reward, sconex)] | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func claimResult (address) = claimAliasResult(address) | |
37 | + | ||
38 | + | ||
39 | + | @Callable(i) | |
40 | + | func stake () = { | |
41 | + | let amount = i.payments[0].amount | |
42 | + | let addressStr = toString(i.caller) | |
43 | + | let totalStakedAmount = tryGetInteger("global_staked") | |
44 | + | if ((i.payments[0].assetId != sconex)) | |
45 | + | then throw("wrong asset attached") | |
46 | + | else (claimResult(i.caller) ++ [IntegerEntry("global_staked", (totalStakedAmount + amount)), IntegerEntry((addressStr + "_staked"), (tryGetInteger((addressStr + "_staked")) + amount))]) | |
47 | + | } | |
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | @Callable(i) | |
52 | + | func unStake (amount) = { | |
53 | + | let addressStr = toString(i.caller) | |
54 | + | let stakedAmount = tryGetInteger((addressStr + "_staked")) | |
55 | + | if ((amount > stakedAmount)) | |
56 | + | then throw("you don't have tokens available") | |
57 | + | else (claimResult(i.caller) ++ [IntegerEntry((addressStr + "_staked"), (stakedAmount - amount)), IntegerEntry("global_staked", (tryGetInteger("global_staked") - amount)), ScriptTransfer(i.caller, amount, sconex)]) | |
58 | + | } | |
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | @Callable(i) | |
63 | + | func claimReward () = claimResult(i.caller) | |
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | @Callable(i) | |
68 | + | func topUpReward () = { | |
69 | + | let amount = fraction(i.payments[0].amount, 9, 10) | |
70 | + | let ultraAmount = (i.payments[0].amount - amount) | |
71 | + | let currentInterest = tryGetInteger("global_lastCheck_EGG_interest") | |
72 | + | let totalStakedAmount = tryGetInteger("global_staked") | |
73 | + | let interestDelta = if ((totalStakedAmount > 0)) | |
74 | + | then fraction(amount, Scale, totalStakedAmount) | |
75 | + | else 0 | |
76 | + | if ((i.payments[0].assetId != sconex)) | |
77 | + | then throw("wrong asset attached") | |
78 | + | else [IntegerEntry("global_EGG_earnings", (tryGetInteger("global_EGG_earnings") + amount)), IntegerEntry("global_lastCheck_EGG_interest", (currentInterest + interestDelta))] | |
79 | + | } | |
80 | + | ||
81 | + | ||
82 | + | @Verifier(tx) | |
83 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
84 | + |
github/deemru/w8io/169f3d6 19.02 ms ◑