tx · Bcb9y8WGuhSLGMFFop95b9XnoYFA3Jgh4kD84JHhYpVR 3N1iXCNZY1tjDef39ScB9LPBmooxdXoBJkD: -0.01000000 Waves 2023.06.20 04:55 [2630317] smart account 3N1iXCNZY1tjDef39ScB9LPBmooxdXoBJkD > SELF 0.00000000 Waves
{ "type": 13, "id": "Bcb9y8WGuhSLGMFFop95b9XnoYFA3Jgh4kD84JHhYpVR", "fee": 1000000, "feeAssetId": null, "timestamp": 1687226209967, "version": 2, "chainId": 84, "sender": "3N1iXCNZY1tjDef39ScB9LPBmooxdXoBJkD", "senderPublicKey": "9qMg5u3dj3rp3orXEZZNTWN7PUWnoijorcYJQDkwmRVX", "proofs": [ "2PMWujrWYTt6aDrPkn5YcGDFbqZMZ9PMo1ogvu3f9zGkCTzd71SKPGjoj7QL4CWi6J42FfmmxafhcF1oTZqhtRrK" ], "script": "base64:BgINCAISABIDCgEBEgASAAcABkFPNzdJZAEgw6r4SvB42n5NP7kr1SoV2hXFLDHIkyEMqOZzQLoU6KoACUFPNzdJZFN0cgIsRUFvaTNpWHdSYXZkaUw3SGRueDZRN1pCY0V6SGNrOW96ZmdRVnlpQXR6ZVYABVNjYWxlAICglKWNHQENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtYXRjaDAFAWIAAAEMdHJ5R2V0U3RyaW5nAQNrZXkEByRtYXRjaDAJAJ0IAgUEdGhpcwUDa2V5AwkAAQIFByRtYXRjaDACBlN0cmluZwQBYQUHJG1hdGNoMAUBYQIAARBjbGFpbUFsaWFzUmVzdWx0AgdhZGRyZXNzCmFzc2V0SWRTdHIECmFkZHJlc3NTdHIJAKUIAQUHYWRkcmVzcwQPY3VycmVudEludGVyZXN0CQENdHJ5R2V0SW50ZWdlcgEJAKwCAgkArAICAhFnbG9iYWxfbGFzdENoZWNrXwUKYXNzZXRJZFN0cgIJX2ludGVyZXN0BBFs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AAB2Fzc2V0SWQFBkFPNzdJZAkAAgECFHdyb25nIGFzc2V0IGF0dGFjaGVkCQCUCgIJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkArAICAgdnbG9iYWxfBQphc3NldElkU3RyAglfZWFybmluZ3MJAGQCCQENdHJ5R2V0SW50ZWdlcgEJAKwCAgkArAICAgdnbG9iYWxfBQphc3NldElkU3RyAglfZWFybmluZ3MFBmFtb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICCQCsAgICEWdsb2JhbF9sYXN0Q2hlY2tfBQphc3NldElkU3RyAglfaW50ZXJlc3QJAGQCBQ9jdXJyZW50SW50ZXJlc3QFDWludGVyZXN0RGVsdGEJAMwIAgkBDEludGVnZXJFbnRyeQICFWdsb2JhbF91bHRyYV9lYXJuaW5ncwkAZAIJAQ10cnlHZXRJbnRlZ2VyAQIVZ2xvYmFsX3VsdHJhX2Vhcm5pbmdzBQt1bHRyYUFtb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgIfZ2xvYmFsX2xhc3RDaGVja191bHRyYV9pbnRlcmVzdAkAZAIFFGN1cnJlbnRVbHRyYUludGVyZXN0BRJ1bHRyYUludGVyZXN0RGVsdGEFA25pbAUGYW1vdW50AQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleTqGVek=", "height": 2630317, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5AkrqBaM8YaRxQvKaaKNw5uqxVKHB6mXpE8Pw2iD7BqU Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let AO77Id = base58' | |
4 | + | let AO77Id = base58'EAoi3iXwRavdiL7Hdnx6Q7ZBcEzHck9ozfgQVyiAtzeV' | |
5 | 5 | ||
6 | - | let AO77IdStr = " | |
6 | + | let AO77IdStr = "EAoi3iXwRavdiL7Hdnx6Q7ZBcEzHck9ozfgQVyiAtzeV" | |
7 | 7 | ||
8 | 8 | let Scale = 1000000000000 | |
9 | 9 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let AO77Id = base58' | |
4 | + | let AO77Id = base58'EAoi3iXwRavdiL7Hdnx6Q7ZBcEzHck9ozfgQVyiAtzeV' | |
5 | 5 | ||
6 | - | let AO77IdStr = " | |
6 | + | let AO77IdStr = "EAoi3iXwRavdiL7Hdnx6Q7ZBcEzHck9ozfgQVyiAtzeV" | |
7 | 7 | ||
8 | 8 | let Scale = 1000000000000 | |
9 | 9 | ||
10 | 10 | func tryGetInteger (key) = match getInteger(this, key) { | |
11 | 11 | case b: Int => | |
12 | 12 | b | |
13 | 13 | case _ => | |
14 | 14 | 0 | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func tryGetString (key) = match getString(this, key) { | |
19 | 19 | case a: String => | |
20 | 20 | a | |
21 | 21 | case _ => | |
22 | 22 | "" | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func claimAliasResult (address,assetIdStr) = { | |
27 | 27 | let addressStr = toString(address) | |
28 | 28 | let currentInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest")) | |
29 | 29 | let lastCheckInterest = tryGetInteger((((addressStr + "_lastCheck_") + assetIdStr) + "_interest")) | |
30 | 30 | let stakedAmount = if ((assetIdStr == AO77IdStr)) | |
31 | 31 | then tryGetInteger((addressStr + "_staked")) | |
32 | 32 | else tryGetInteger((((addressStr + "_") + assetIdStr) + "_staked")) | |
33 | 33 | let reward = if ((lastCheckInterest > 0)) | |
34 | 34 | then fraction((currentInterest - lastCheckInterest), stakedAmount, Scale) | |
35 | 35 | else 0 | |
36 | 36 | [IntegerEntry((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"), currentInterest), IntegerEntry((((addressStr + "_") + assetIdStr) + "_claimed"), (tryGetInteger((((addressStr + "_") + assetIdStr) + "_claimed")) + reward)), IntegerEntry((((addressStr + "_") + assetIdStr) + "_lastClaim"), lastBlock.timestamp), ScriptTransfer(address, reward, fromBase58String(assetIdStr))] | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func claimResult (address) = claimAliasResult(address, AO77IdStr) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | @Callable(i) | |
44 | 44 | func stake () = { | |
45 | 45 | let amount = i.payments[0].amount | |
46 | 46 | let addressStr = toString(i.caller) | |
47 | 47 | let assetIdStr = toBase58String(AO77Id) | |
48 | 48 | let currentInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest")) | |
49 | 49 | let totalStakedAmount = tryGetInteger("global_staked") | |
50 | 50 | if ((i.payments[0].assetId != AO77Id)) | |
51 | 51 | then throw("wrong asset attached") | |
52 | 52 | else (claimResult(i.caller) ++ [IntegerEntry("global_staked", (totalStakedAmount + amount)), IntegerEntry((addressStr + "_staked"), (tryGetInteger((addressStr + "_staked")) + amount))]) | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func unStake (amount) = { | |
59 | 59 | let addressStr = toString(i.caller) | |
60 | 60 | let stakedAmount = tryGetInteger((addressStr + "_staked")) | |
61 | 61 | if ((amount > stakedAmount)) | |
62 | 62 | then throw("you don't have tokens available") | |
63 | 63 | else (claimResult(i.caller) ++ [IntegerEntry((addressStr + "_staked"), (stakedAmount - amount)), IntegerEntry("global_staked", (tryGetInteger("global_staked") - amount)), ScriptTransfer(i.caller, amount, AO77Id)]) | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(i) | |
69 | 69 | func claimReward () = claimResult(i.caller) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | @Callable(i) | |
74 | 74 | func topUpReward () = { | |
75 | 75 | let amount = fraction(i.payments[0].amount, 9, 10) | |
76 | 76 | let ultraAmount = (i.payments[0].amount - amount) | |
77 | 77 | let assetIdStr = toBase58String(value(i.payments[0].assetId)) | |
78 | 78 | let currentInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest")) | |
79 | 79 | let totalStakedAmount = tryGetInteger("global_staked") | |
80 | 80 | let interestDelta = if ((totalStakedAmount > 0)) | |
81 | 81 | then fraction(amount, Scale, totalStakedAmount) | |
82 | 82 | else 0 | |
83 | 83 | let currentUltraInterest = tryGetInteger("global_lastCheck_ultra_interest") | |
84 | 84 | let totalUltraStakedAmount = tryGetInteger("global_ultra_staked") | |
85 | 85 | let ultraInterestDelta = if ((totalStakedAmount > 0)) | |
86 | 86 | then fraction(amount, Scale, totalStakedAmount) | |
87 | 87 | else 0 | |
88 | 88 | if ((i.payments[0].assetId != AO77Id)) | |
89 | 89 | then throw("wrong asset attached") | |
90 | 90 | else $Tuple2([IntegerEntry((("global_" + assetIdStr) + "_earnings"), (tryGetInteger((("global_" + assetIdStr) + "_earnings")) + amount)), IntegerEntry((("global_lastCheck_" + assetIdStr) + "_interest"), (currentInterest + interestDelta)), IntegerEntry("global_ultra_earnings", (tryGetInteger("global_ultra_earnings") + ultraAmount)), IntegerEntry("global_lastCheck_ultra_interest", (currentUltraInterest + ultraInterestDelta))], amount) | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | @Verifier(tx) | |
95 | 95 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
96 | 96 |
github/deemru/w8io/026f985 42.28 ms ◑