tx · HoxXNsq3ocoXKToVaq3SXRzpwq4JuNXHuegDQbAct35u 3MxSZ4FPq75Q3cQcf9VJkKFDJkeFpm5Ynm3: -0.00700000 Waves 2022.07.10 10:12 [2133308] smart account 3MxSZ4FPq75Q3cQcf9VJkKFDJkeFpm5Ynm3 > SELF 0.00000000 Waves
{ "type": 13, "id": "HoxXNsq3ocoXKToVaq3SXRzpwq4JuNXHuegDQbAct35u", "fee": 700000, "feeAssetId": null, "timestamp": 1657437173573, "version": 2, "chainId": 84, "sender": "3MxSZ4FPq75Q3cQcf9VJkKFDJkeFpm5Ynm3", "senderPublicKey": "AdPVtTCVPZCuVF944iD1f5LJ9e4pjzpQ2rrxGEWt7Rbx", "proofs": [ "52iANA2UnshKJWhMYHnUaALzYfB4a5XHSoGFq3bqkpCgQJysBUaPZPSq2hkzyVskQjFfgYGR9xrzpPgSBT4SLoEr" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEBAAAACAAAAAAKZWdnQXNzZXRJZAEAAAAgF/4YCdBeNnPXi9mYwFve9iIGEZ5QZQVegfUQpkcQUdwAAAAAEGNvbGxlY3RvckFkZHJlc3MBAAAAGgFUAqwIk+AYdvRW0p5bt95mLATeRN8JIV7TAAAAAAVkZWxheQAAAAAAAAAAAgAAAAALbWF4RXhjaGFuZ2UAAAAAAAAAAAEAAAAADGV4Y2hhbmdlUmF0ZQAAAAAAAAAAAQEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYX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ggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleczgw20=", "height": 2133308, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C9ECzazDm8sdpiWHgdY5KiWz71Y2yQukjzhosyz2Gew1 Next: 2NFL6K3EzxQ4BrQwCbhJEJj3hfj53GWMgLkcdpAqZ8Ef Diff:
Old | New | Differences | |
---|---|---|---|
48 | 48 | let lastTransferedDay = tryGetInteger((("receiver_" + toString(i.originCaller)) + "_lastDay")) | |
49 | 49 | let totalAmountInDay = tryGetInteger((("receiver_" + toString(i.originCaller)) + "_totalAmountInDay")) | |
50 | 50 | if ((height > (lastTransferedDay + delay))) | |
51 | - | then if (( | |
51 | + | then if ((totalAmountInDay > maxExchange)) | |
52 | 52 | then throw("Max exchange limit reached. Please try after 24 hours.") | |
53 | - | else if (( | |
53 | + | else if (((totalAmountInDay + amount) > maxExchange)) | |
54 | 54 | then throw("Max exchange crossed. Please try with lower value.") | |
55 | 55 | else [IntegerEntry((("receiver_" + toString(i.originCaller)) + "_totalAmountInDay"), (totalAmountInDay + amount)), IntegerEntry((((("receiver_" + toString(i.originCaller)) + "_transactionId_") + transactionId) + "_waveAmount"), amount), IntegerEntry((((("receiver_" + toString(i.originCaller)) + "_transactionId_") + transactionId) + "_tokenAmount"), totalExchangedAmount), ScriptTransfer(Address(collectorAddress), amount, unit), ScriptTransfer(i.originCaller, totalExchangedAmount, eggAssetId)] | |
56 | 56 | else [IntegerEntry((("receiver_" + toString(i.originCaller)) + "_lastDay"), height), IntegerEntry((("receiver_" + toString(i.originCaller)) + "_totalAmountInDay"), amount), IntegerEntry((((("receiver_" + toString(i.originCaller)) + "_transactionId_") + transactionId) + "_waveAmount"), amount), IntegerEntry((((("receiver_" + toString(i.originCaller)) + "_transactionId_") + transactionId) + "_tokenAmount"), totalExchangedAmount), ScriptTransfer(Address(collectorAddress), amount, unit), ScriptTransfer(i.originCaller, totalExchangedAmount, eggAssetId)] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let eggAssetId = base58'2cf6jyVG19oHU79R8iHfqFEesjstr3e7nSYEUhb2WagB' | |
5 | 5 | ||
6 | 6 | let collectorAddress = base58'3MpADDQFqadaCADNH9JDMQAGw9WEaMcymVU' | |
7 | 7 | ||
8 | 8 | let delay = 2 | |
9 | 9 | ||
10 | 10 | let maxExchange = 1 | |
11 | 11 | ||
12 | 12 | let exchangeRate = 1 | |
13 | 13 | ||
14 | 14 | func tryGetInteger (key) = { | |
15 | 15 | let val = match getInteger(this, key) { | |
16 | 16 | case b: Int => | |
17 | 17 | b | |
18 | 18 | case _ => | |
19 | 19 | 0 | |
20 | 20 | } | |
21 | 21 | val | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func tryGetString (key) = { | |
26 | 26 | let val = match getString(this, key) { | |
27 | 27 | case b: String => | |
28 | 28 | b | |
29 | 29 | case _ => | |
30 | 30 | "" | |
31 | 31 | } | |
32 | 32 | val | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
37 | 37 | case b: Boolean => | |
38 | 38 | b | |
39 | 39 | case _ => | |
40 | 40 | false | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | @Callable(i) | |
45 | 45 | func exchangeToken (amount) = { | |
46 | 46 | let transactionId = toBase58String(i.transactionId) | |
47 | 47 | let totalExchangedAmount = (exchangeRate * amount) | |
48 | 48 | let lastTransferedDay = tryGetInteger((("receiver_" + toString(i.originCaller)) + "_lastDay")) | |
49 | 49 | let totalAmountInDay = tryGetInteger((("receiver_" + toString(i.originCaller)) + "_totalAmountInDay")) | |
50 | 50 | if ((height > (lastTransferedDay + delay))) | |
51 | - | then if (( | |
51 | + | then if ((totalAmountInDay > maxExchange)) | |
52 | 52 | then throw("Max exchange limit reached. Please try after 24 hours.") | |
53 | - | else if (( | |
53 | + | else if (((totalAmountInDay + amount) > maxExchange)) | |
54 | 54 | then throw("Max exchange crossed. Please try with lower value.") | |
55 | 55 | else [IntegerEntry((("receiver_" + toString(i.originCaller)) + "_totalAmountInDay"), (totalAmountInDay + amount)), IntegerEntry((((("receiver_" + toString(i.originCaller)) + "_transactionId_") + transactionId) + "_waveAmount"), amount), IntegerEntry((((("receiver_" + toString(i.originCaller)) + "_transactionId_") + transactionId) + "_tokenAmount"), totalExchangedAmount), ScriptTransfer(Address(collectorAddress), amount, unit), ScriptTransfer(i.originCaller, totalExchangedAmount, eggAssetId)] | |
56 | 56 | else [IntegerEntry((("receiver_" + toString(i.originCaller)) + "_lastDay"), height), IntegerEntry((("receiver_" + toString(i.originCaller)) + "_totalAmountInDay"), amount), IntegerEntry((((("receiver_" + toString(i.originCaller)) + "_transactionId_") + transactionId) + "_waveAmount"), amount), IntegerEntry((((("receiver_" + toString(i.originCaller)) + "_transactionId_") + transactionId) + "_tokenAmount"), totalExchangedAmount), ScriptTransfer(Address(collectorAddress), amount, unit), ScriptTransfer(i.originCaller, totalExchangedAmount, eggAssetId)] | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | @Verifier(tx) | |
61 | 61 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
62 | 62 |
github/deemru/w8io/026f985 28.54 ms ◑