tx · 6aLMzw8QnK8tXCmDdAWjHbJB38jttvpeRFViZYRv6ij7
3MzgLbskN82suZgkmqTvzQxDtZfjQfX1DLp: -0.00200000 Waves
2024.11.11 04:19 [3366115] smart account 3MzgLbskN82suZgkmqTvzQxDtZfjQfX1DLp > SELF 0.00000000 Waves
{
"type": 13,
"id": "6aLMzw8QnK8tXCmDdAWjHbJB38jttvpeRFViZYRv6ij7",
"fee": 200000,
"feeAssetId": null,
"timestamp": 1731288010812,
"version": 1,
"sender": "3MzgLbskN82suZgkmqTvzQxDtZfjQfX1DLp",
"senderPublicKey": "B5p5JF1Hn7k2YwGxQxgFre8bM5pd7N2c6wPdyKdLzzd6",
"proofs": [
"243ff3fY11MdXFPsJSiN1i4wH669DpNFWPG3vThcH6XSNnZn1gxStpU6YKS4AMZGVHzyqjyLdb7aq8ujxY8EGKQ3"
],
"script": "base64:CAIHCAISAwoBCAABAWkBGGNoZWNrQW5kSW5jcmVtZW50Q291bnRlcgEIZnVuY05hbWUECWhvdXJseUtleQkArAICBQhmdW5jTmFtZQIOX2hvdXJseVR4Q291bnQECGRhaWx5S2V5CQCsAgIFCGZ1bmNOYW1lAg1fZGFpbHlUeENvdW50BAphbGxvd2VkS2V5CQCsAgIFCGZ1bmNOYW1lAghfYWxsb3dlZAQNaG91cmx5VHhDb3VudAQHJG1hdGNoMAkAmggCBQR0aGlzBQlob3VybHlLZXkDCQABAgUHJG1hdGNoMAIDSW50BAFhBQckbWF0Y2gwBQFhAAAEDGRhaWx5VHhDb3VudAQHJG1hdGNoMAkAmggCBQR0aGlzBQhkYWlseUtleQMJAAECBQckbWF0Y2gwAgNJbnQEAWEFByRtYXRjaDAFAWEAAAQLaG91cmx5TGltaXQAZAQKZGFpbHlMaW1pdADIAQMJAGcCBQ1ob3VybHlUeENvdW50BQtob3VybHlMaW1pdAkAAgECFUhvdXJseSBsaW1pdCBleGNlZWRlZAMJAGcCBQxkYWlseVR4Q291bnQFCmRhaWx5TGltaXQJAAIBAhREYWlseSBsaW1pdCBleGNlZWRlZAQObmV3SG91cmx5Q291bnQJAGQCBQ1ob3VybHlUeENvdW50AAEEDW5ld0RhaWx5Q291bnQJAGQCBQxkYWlseVR4Q291bnQAAQQNdXBkYXRlUmVzdWx0cwkAzAgCCQEMSW50ZWdlckVudHJ5AgUJaG91cmx5S2V5BQ5uZXdIb3VybHlDb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgUIZGFpbHlLZXkFDW5ld0RhaWx5Q291bnQJAMwIAgkBDEJvb2xlYW5FbnRyeQIFCmFsbG93ZWRLZXkGBQNuaWwEC2NoZWNrSG91cmx5CQCaCAIFBHRoaXMFCWhvdXJseUtleQQKY2hlY2tEYWlseQkAmggCBQR0aGlzBQhkYWlseUtleQQHJG1hdGNoMAULY2hlY2tIb3VybHkDCQABAgUHJG1hdGNoMAIDSW50BAFhBQckbWF0Y2gwBAckbWF0Y2gxBQpjaGVja0RhaWx5AwkAAQIFByRtYXRjaDECA0ludAQBYgUHJG1hdGNoMQMDCQAAAgUBYQUObmV3SG91cmx5Q291bnQJAAACBQFiBQ1uZXdEYWlseUNvdW50BwUNdXBkYXRlUmVzdWx0cwkAAgECEkRhdGEgdXBkYXRlIGZhaWxlZAkAAgECGUZhaWxlZCB0byBnZXQgZGFpbHkgY291bnQJAAIBAhpGYWlsZWQgdG8gZ2V0IGhvdXJseSBjb3VudABQJn+G",
"chainId": 84,
"height": 3366115,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 2qttdA8FW2zeUWqJu5FiAWrqsYNQuDR4cMy6C5mmdedD
Next: H1chrA1GmjAAzkypojKFU3CBJhjGjNunkdktdveX7294
Diff:
Old | New | | Differences |
---|
7 | 7 | | func checkAndIncrementCounter (funcName) = { |
---|
8 | 8 | | let hourlyKey = (funcName + "_hourlyTxCount") |
---|
9 | 9 | | let dailyKey = (funcName + "_dailyTxCount") |
---|
| 10 | + | let allowedKey = (funcName + "_allowed") |
---|
10 | 11 | | let hourlyTxCount = match getInteger(this, hourlyKey) { |
---|
11 | 12 | | case a: Int => |
---|
12 | 13 | | a |
---|
|
28 | 29 | | else { |
---|
29 | 30 | | let newHourlyCount = (hourlyTxCount + 1) |
---|
30 | 31 | | let newDailyCount = (dailyTxCount + 1) |
---|
31 | | - | let updateResults = [IntegerEntry(hourlyKey, newHourlyCount), IntegerEntry(dailyKey, newDailyCount), BooleanEntry("checkAndIncrementCounter", true)] |
---|
| 32 | + | let updateResults = [IntegerEntry(hourlyKey, newHourlyCount), IntegerEntry(dailyKey, newDailyCount), BooleanEntry(allowedKey, true)] |
---|
32 | 33 | | let checkHourly = getInteger(this, hourlyKey) |
---|
33 | 34 | | let checkDaily = getInteger(this, dailyKey) |
---|
34 | 35 | | match checkHourly { |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 8 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func checkAndIncrementCounter (funcName) = { |
---|
8 | 8 | | let hourlyKey = (funcName + "_hourlyTxCount") |
---|
9 | 9 | | let dailyKey = (funcName + "_dailyTxCount") |
---|
| 10 | + | let allowedKey = (funcName + "_allowed") |
---|
10 | 11 | | let hourlyTxCount = match getInteger(this, hourlyKey) { |
---|
11 | 12 | | case a: Int => |
---|
12 | 13 | | a |
---|
13 | 14 | | case _ => |
---|
14 | 15 | | 0 |
---|
15 | 16 | | } |
---|
16 | 17 | | let dailyTxCount = match getInteger(this, dailyKey) { |
---|
17 | 18 | | case a: Int => |
---|
18 | 19 | | a |
---|
19 | 20 | | case _ => |
---|
20 | 21 | | 0 |
---|
21 | 22 | | } |
---|
22 | 23 | | let hourlyLimit = 100 |
---|
23 | 24 | | let dailyLimit = 200 |
---|
24 | 25 | | if ((hourlyTxCount >= hourlyLimit)) |
---|
25 | 26 | | then throw("Hourly limit exceeded") |
---|
26 | 27 | | else if ((dailyTxCount >= dailyLimit)) |
---|
27 | 28 | | then throw("Daily limit exceeded") |
---|
28 | 29 | | else { |
---|
29 | 30 | | let newHourlyCount = (hourlyTxCount + 1) |
---|
30 | 31 | | let newDailyCount = (dailyTxCount + 1) |
---|
31 | | - | let updateResults = [IntegerEntry(hourlyKey, newHourlyCount), IntegerEntry(dailyKey, newDailyCount), BooleanEntry("checkAndIncrementCounter", true)] |
---|
| 32 | + | let updateResults = [IntegerEntry(hourlyKey, newHourlyCount), IntegerEntry(dailyKey, newDailyCount), BooleanEntry(allowedKey, true)] |
---|
32 | 33 | | let checkHourly = getInteger(this, hourlyKey) |
---|
33 | 34 | | let checkDaily = getInteger(this, dailyKey) |
---|
34 | 35 | | match checkHourly { |
---|
35 | 36 | | case a: Int => |
---|
36 | 37 | | match checkDaily { |
---|
37 | 38 | | case b: Int => |
---|
38 | 39 | | if (if ((a == newHourlyCount)) |
---|
39 | 40 | | then (b == newDailyCount) |
---|
40 | 41 | | else false) |
---|
41 | 42 | | then updateResults |
---|
42 | 43 | | else throw("Data update failed") |
---|
43 | 44 | | case _ => |
---|
44 | 45 | | throw("Failed to get daily count") |
---|
45 | 46 | | } |
---|
46 | 47 | | case _ => |
---|
47 | 48 | | throw("Failed to get hourly count") |
---|
48 | 49 | | } |
---|
49 | 50 | | } |
---|
50 | 51 | | } |
---|
51 | 52 | | |
---|
52 | 53 | | |
---|