tx · GQkSzkfpfKuDezTo4a9ZWEw2Y963pkrp7nMJz1F8svDG 3MyswDZXU8YcgX1dfuQgAjitWPJ3cggU2PR: -0.01000000 Waves 2021.12.22 22:01 [1845860] smart account 3MyswDZXU8YcgX1dfuQgAjitWPJ3cggU2PR > SELF 0.00000000 Waves
{ "type": 13, "id": "GQkSzkfpfKuDezTo4a9ZWEw2Y963pkrp7nMJz1F8svDG", "fee": 1000000, "feeAssetId": null, "timestamp": 1640199670340, "version": 2, "chainId": 84, "sender": "3MyswDZXU8YcgX1dfuQgAjitWPJ3cggU2PR", "senderPublicKey": "JBFUVQjjvtMqXZeeeJLQyEP8RPmvMWbZHyCfGFnrmWJZ", "proofs": [ "3VvP6WZCuKCtk7oYKj26aSngjsnVe6kVWk4pt9ZRvDUvKmQgrFSTQF75zTfUjTJEtA5YsTDC2zMJiMLJWMfVc8CN" ], "script": "base64:AAIFAAAAAAAAAgcIAhIFCgMICAgaFAoBQRIPY2FsY1RvdGFsUmV3YXJkGg8KAUISCm5ld0JhbGFuY2UaEgoBQxINbmV3U2F2ZVJld2FyZBoGCgFhEgFpGgsKAWISBmFjdGlvbhoJCgFjEgR0eXBlGhAKAWQSC3ZhbHVlQWN0aW9uGhIKAWUSDXRyYW5zYWN0aW9uSWQaFwoBZhISY3VycmVudFdhbGxldEJ5dGVzGg4KAWcSCXBheUFtb3VudBoSCgFoEg1jdXJyZW50V2FsbGV0GgwKAWkSB25hbWVOZnQaDgoBahIJdGltZXN0YW1wGhAKAWsSC2V4YW5CYWxhbmNlGgwKAWwSByRtYXRjaDAaBgoBbRIBdBoMCgFuEgdiYWxhbmNlGg8KAW8SCmhpc3RvcmljSWQaFAoBcBIPaW5pdGlhbFBvd2VyTmZ0GgoKAXESBXBvd2VyGg0KAXISCG5mdFBvd2VyGhQKAXMSD3Jld2FyZFRpbWVzdGFtcBoPCgF0EgpzYXZlUmV3YXJkGhUKAXUSEG5ld1Rva2VuUHVyY2hhc2UaFQoBdhIQdG90YWxFe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ON1ltMVdLM1phRnA3VmZqdno2S0ZSR0Y2QXhzQVhtNzZXBwkAAAAAAAACBQAAAAFnAAAAAAAAD0JABwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAHQWRkcmVzcwAAAAEJAAJZAAAAAQUAAAABYwAAAAAAAAAAAQkAAlkAAAABBQAAAAFkBQAAAANuaWwDAwMJAAAAAAAAAgUAAAABYgIAAAAHUmVxdWVzdAkAAGYAAAACBQAAAAFBAAAAAAAAAAAABwkAAAAAAAACBQAAAAFnAAAAAAAAD0JABwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAAA1iYWxhbmNlX2V4YW5fBQAAAAFoBQAAAAFCCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAICAAAAEXJld2FyZF90aW1lc3RhbXBfBQAAAAFoBQAAAAF4CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAICAAAADHNhdmVfcmV3YXJkXwUAAAABaAAAAAAAAAAAAAUAAAADbmlsCQAAAgAAAAECAAAAXldlIHdlcmUgdW5hYmxlIHRvIGZ1bGZpbGwgeW91ciByZXF1ZXN0ISBNYWtlIHN1cmUgeW91IGhhdmUgZW5vdWdoIGJhbGFuY2UgZm9yIHRoZSB0cmFuc2FjdGlvbiEAAAAAR2JjIA==", "height": 1845860, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 42yeq2QMRqJWxt1Y73nTeJ5C3pzMa9ATEvkPtPetJoJg Next: 5b21zdMqf2sbpgBmpPoMFDEvssfCvG675sBYAQP8mt1n Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | let currentWallet = toBase58String(i.caller.bytes) | |
12 | 12 | let nameNft = ((((((("nft_" + type) + "_") + take(transactionId, 10)) + "_") + currentWallet) + "_") + transactionId) | |
13 | 13 | let timestamp = take(toString(lastBlock.timestamp), 10) | |
14 | + | let exanBalance = match getInteger(this, ("exan_balance_" + currentWallet)) { | |
15 | + | case t: Int => | |
16 | + | t | |
17 | + | case _ => | |
18 | + | 0 | |
19 | + | } | |
14 | 20 | let balance = match getInteger(this, ("balance_exan_" + currentWallet)) { | |
15 | 21 | case t: Int => | |
16 | 22 | t | |
54 | 60 | 0 | |
55 | 61 | } | |
56 | 62 | let newTokenPurchase = (i.payments[0].amount * 10000) | |
63 | + | let totalExanBalance = (exanBalance + newTokenPurchase) | |
57 | 64 | let newPower = (power + initialPowerNft) | |
58 | 65 | let nowTimestamp = parseIntValue(timestamp) | |
59 | 66 | let calcRequestTimestamp = (nowTimestamp - rewardTimestamp) | |
68 | 75 | then 0 | |
69 | 76 | else (saveReward + calcTotalReward) | |
70 | 77 | if ((action == "Buy Tokens")) | |
71 | - | then [IntegerEntry((((" | |
78 | + | then [IntegerEntry(("exan_balance_" + currentWallet), totalExanBalance), IntegerEntry(((("buy_tokens_" + currentWallet) + "_") + transactionId), newTokenPurchase)] | |
72 | 79 | else if (if ((action == "Buy NFT")) | |
73 | 80 | then ((payAmount / 100000) == initialPowerNft) | |
74 | 81 | else false) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func start (action,type,valueAction) = { | |
8 | 8 | let transactionId = toBase58String(i.transactionId) | |
9 | 9 | let currentWalletBytes = i.caller | |
10 | 10 | let payAmount = value(i.payments[0].amount) | |
11 | 11 | let currentWallet = toBase58String(i.caller.bytes) | |
12 | 12 | let nameNft = ((((((("nft_" + type) + "_") + take(transactionId, 10)) + "_") + currentWallet) + "_") + transactionId) | |
13 | 13 | let timestamp = take(toString(lastBlock.timestamp), 10) | |
14 | + | let exanBalance = match getInteger(this, ("exan_balance_" + currentWallet)) { | |
15 | + | case t: Int => | |
16 | + | t | |
17 | + | case _ => | |
18 | + | 0 | |
19 | + | } | |
14 | 20 | let balance = match getInteger(this, ("balance_exan_" + currentWallet)) { | |
15 | 21 | case t: Int => | |
16 | 22 | t | |
17 | 23 | case _ => | |
18 | 24 | 0 | |
19 | 25 | } | |
20 | 26 | let historicId = match getInteger(this, "historicId") { | |
21 | 27 | case t: Int => | |
22 | 28 | t | |
23 | 29 | case _ => | |
24 | 30 | 0 | |
25 | 31 | } | |
26 | 32 | let initialPowerNft = match getInteger(this, ("List_NFT_" + type)) { | |
27 | 33 | case t: Int => | |
28 | 34 | t | |
29 | 35 | case _ => | |
30 | 36 | 0 | |
31 | 37 | } | |
32 | 38 | let power = match getInteger(this, ("power_" + currentWallet)) { | |
33 | 39 | case t: Int => | |
34 | 40 | t | |
35 | 41 | case _ => | |
36 | 42 | 0 | |
37 | 43 | } | |
38 | 44 | let nftPower = match getInteger(this, valueAction) { | |
39 | 45 | case t: Int => | |
40 | 46 | t | |
41 | 47 | case _ => | |
42 | 48 | 0 | |
43 | 49 | } | |
44 | 50 | let rewardTimestamp = match getInteger(this, ("reward_timestamp_" + currentWallet)) { | |
45 | 51 | case t: Int => | |
46 | 52 | t | |
47 | 53 | case _ => | |
48 | 54 | 0 | |
49 | 55 | } | |
50 | 56 | let saveReward = match getInteger(this, ("save_reward_" + currentWallet)) { | |
51 | 57 | case t: Int => | |
52 | 58 | t | |
53 | 59 | case _ => | |
54 | 60 | 0 | |
55 | 61 | } | |
56 | 62 | let newTokenPurchase = (i.payments[0].amount * 10000) | |
63 | + | let totalExanBalance = (exanBalance + newTokenPurchase) | |
57 | 64 | let newPower = (power + initialPowerNft) | |
58 | 65 | let nowTimestamp = parseIntValue(timestamp) | |
59 | 66 | let calcRequestTimestamp = (nowTimestamp - rewardTimestamp) | |
60 | 67 | let calcReward24hours = if ((power > 0)) | |
61 | 68 | then (86400 / (power / 100)) | |
62 | 69 | else 0 | |
63 | 70 | let calcTotalReward = if ((calcReward24hours > 0)) | |
64 | 71 | then ((calcRequestTimestamp * 100000000) / calcReward24hours) | |
65 | 72 | else 0 | |
66 | 73 | let newBalance = ((balance + calcTotalReward) + saveReward) | |
67 | 74 | let newSaveReward = if ((power == 0)) | |
68 | 75 | then 0 | |
69 | 76 | else (saveReward + calcTotalReward) | |
70 | 77 | if ((action == "Buy Tokens")) | |
71 | - | then [IntegerEntry((((" | |
78 | + | then [IntegerEntry(("exan_balance_" + currentWallet), totalExanBalance), IntegerEntry(((("buy_tokens_" + currentWallet) + "_") + transactionId), newTokenPurchase)] | |
72 | 79 | else if (if ((action == "Buy NFT")) | |
73 | 80 | then ((payAmount / 100000) == initialPowerNft) | |
74 | 81 | else false) | |
75 | 82 | then [Issue(((take(type, 6) + "_") + take(transactionId, 9)), "", 1, 0, false), IntegerEntry(nameNft, initialPowerNft), IntegerEntry(("power_" + currentWallet), newPower), IntegerEntry(("reward_timestamp_" + currentWallet), nowTimestamp), IntegerEntry(("save_reward_" + currentWallet), newSaveReward)] | |
76 | 83 | else if (if (if ((action == "Send NFT")) | |
77 | 84 | then (currentWallet == "3N7Ym1WK3ZaFp7Vfjvz6KFRGF6AxsAXm76W") | |
78 | 85 | else false) | |
79 | 86 | then (payAmount == 1000000) | |
80 | 87 | else false) | |
81 | 88 | then [ScriptTransfer(Address(fromBase58String(type)), 1, fromBase58String(valueAction))] | |
82 | 89 | else if (if (if ((action == "Request")) | |
83 | 90 | then (calcTotalReward > 0) | |
84 | 91 | else false) | |
85 | 92 | then (payAmount == 1000000) | |
86 | 93 | else false) | |
87 | 94 | then [IntegerEntry(("balance_exan_" + currentWallet), newBalance), IntegerEntry(("reward_timestamp_" + currentWallet), nowTimestamp), IntegerEntry(("save_reward_" + currentWallet), 0)] | |
88 | 95 | else throw("We were unable to fulfill your request! Make sure you have enough balance for the transaction!") | |
89 | 96 | } | |
90 | 97 | ||
91 | 98 |
github/deemru/w8io/169f3d6 41.44 ms ◑