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