tx · 7W7izueMUAiQjnFEGNDz9vP7q5UXGeNWHsVTUoXSyiRu 3Msughfkwji8uccY4RAxuKWvNpnEscWyhHK: -0.01400000 Waves 2019.06.21 19:35 [552020] smart account 3Msughfkwji8uccY4RAxuKWvNpnEscWyhHK > SELF 0.00000000 Waves
{ "type": 13, "id": "7W7izueMUAiQjnFEGNDz9vP7q5UXGeNWHsVTUoXSyiRu", "fee": 1400000, "feeAssetId": null, "timestamp": 1561134908895, "version": 1, "sender": "3Msughfkwji8uccY4RAxuKWvNpnEscWyhHK", "senderPublicKey": "AzyC6W7iD5HYehj2xef6xWKogmxDC6RaX9N1ST8P39bn", "proofs": [ "4mWWKwhWq3hsA7JsEwvsZsf9YT75eouDHGTfntTQrXzTKAyTLvmr4rKN46vXnB4hHD5XGR32zm9cEHWKEC9w3CM1" ], "script": "base64:AAIDAAAAAAAAAAAAAAAHAAAAAAZsZXZlbDEAAAAAAAAAAAUAAAAABmxldmVsMgAAAAAAAAAABQAAAAAGbGV2ZWwzAAAAAAAAAAAFAAAAAAhjYXNoQmFjawAAAAAAAAAABQEAAAAQYmFsYW5jZUluY3JlbWVudAAAAAIAAAAHYWRkcmVzcwAAAANpbmMEAAAACmJhbGFuY2VLZXkJAAEsAAAAAgUAAAAHYWRkcmVzcwIAAAAIX2JhbGFuY2UJAQAAAAlEYXRhRW50cnkAAAACBQAAAApiYWxhbmNlS2V5CQAAZAAAAAIFAAAAA2luYwQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApiYWxhbmNlS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAABAAAAFWluZGV4QmFsYW5jZUluY3JlbWVudAAAAAQAAAAHYWRkcmVzcwAAAAVvd25lcgAAAANpbmMAAAAFbGV2ZWwEAAAABmxvZ0tleQkAASwAAAACBQAAAAdhZGRyZXNzBQAAAAVsZXZlbAQAAAAKcmVjb3Jk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AAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAFb3duZXICAAAADV9yZWZzdHJ1Y3R1cmUFAAAADHJlZlN0cnVjdHVyZQUAAAADbmlsAAAAADuc2JE=", "chainId": 84, "height": 552020, "spentComplexity": 0 } View: original | compacted Prev: AkF73KK6i9zsbEBPSmeaJLpXA9cZ3XEsmjL883SNgvs4 Next: F5wy5pRGBCcUY6EtvFit1heZyAnpUttNr1q91AnAitf1 Diff:
Old | New | Differences | |
---|---|---|---|
46 | 46 | let refListSize = size(refList) | |
47 | 47 | let incLevel1 = ((amount * level1) / 1000) | |
48 | 48 | let incCashBack = ((amount * cashBack) / 1000) | |
49 | - | [balanceIncrement(owner, incCashBack), indexBalanceIncrement(owner, ownerColon, incCashBack, "_txs_cashback"), balanceIncrement(refList[0], incLevel1), indexBalanceIncrement(refList[0], ownerColon, incLevel1, "_txs_l1"), if ((refListSize | |
49 | + | [balanceIncrement(owner, incCashBack), indexBalanceIncrement(owner, ownerColon, incCashBack, "_txs_cashback"), balanceIncrement(refList[0], incLevel1), indexBalanceIncrement(refList[0], ownerColon, incLevel1, "_txs_l1"), if ((refListSize >= 2)) | |
50 | 50 | then { | |
51 | 51 | let incLevel2 = ((amount * level2) / 1000) | |
52 | - | [balanceIncrement(refList[1], incLevel2), indexBalanceIncrement(refList[1], ownerColon, incLevel2, "_txs_l2"), if ((refListSize | |
52 | + | [balanceIncrement(refList[1], incLevel2), indexBalanceIncrement(refList[1], ownerColon, incLevel2, "_txs_l2"), if ((refListSize >= 3)) | |
53 | 53 | then { | |
54 | 54 | let incLevel3 = ((amount * level3) / 1000) | |
55 | 55 | [balanceIncrement(refList[2], incLevel3), indexBalanceIncrement(refList[2], ownerColon, incLevel3, "_txs_l3")] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let level1 = 5 | |
5 | 5 | ||
6 | 6 | let level2 = 5 | |
7 | 7 | ||
8 | 8 | let level3 = 5 | |
9 | 9 | ||
10 | 10 | let cashBack = 5 | |
11 | 11 | ||
12 | 12 | func balanceIncrement (address,inc) = { | |
13 | 13 | let balanceKey = (address + "_balance") | |
14 | 14 | DataEntry(balanceKey, (inc + match getInteger(this, balanceKey) { | |
15 | 15 | case b: Int => | |
16 | 16 | b | |
17 | 17 | case _ => | |
18 | 18 | 0 | |
19 | 19 | })) | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func indexBalanceIncrement (address,owner,inc,level) = { | |
24 | 24 | let logKey = (address + level) | |
25 | 25 | let recordData = (owner + toString(inc)) | |
26 | 26 | match getString(this, logKey) { | |
27 | 27 | case prev: String => | |
28 | 28 | DataEntry(logKey, ((prev + ",") + recordData)) | |
29 | 29 | case _ => | |
30 | 30 | DataEntry(logKey, recordData) | |
31 | 31 | } | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func getReferer (user) = getString(this, (user + "_referer")) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | @Callable(i) | |
39 | 39 | func fund () = { | |
40 | 40 | let owner = toBase58String(i.callerPublicKey) | |
41 | 41 | let ownerColon = (((owner + ":") + toString(height)) + ":") | |
42 | 42 | let amount = extract(i.payment).amount | |
43 | 43 | WriteSet( match getString(this, (owner + "_refstructure")) { | |
44 | 44 | case refListS: String => | |
45 | 45 | let refList = split(refListS, ",") | |
46 | 46 | let refListSize = size(refList) | |
47 | 47 | let incLevel1 = ((amount * level1) / 1000) | |
48 | 48 | let incCashBack = ((amount * cashBack) / 1000) | |
49 | - | [balanceIncrement(owner, incCashBack), indexBalanceIncrement(owner, ownerColon, incCashBack, "_txs_cashback"), balanceIncrement(refList[0], incLevel1), indexBalanceIncrement(refList[0], ownerColon, incLevel1, "_txs_l1"), if ((refListSize | |
49 | + | [balanceIncrement(owner, incCashBack), indexBalanceIncrement(owner, ownerColon, incCashBack, "_txs_cashback"), balanceIncrement(refList[0], incLevel1), indexBalanceIncrement(refList[0], ownerColon, incLevel1, "_txs_l1"), if ((refListSize >= 2)) | |
50 | 50 | then { | |
51 | 51 | let incLevel2 = ((amount * level2) / 1000) | |
52 | - | [balanceIncrement(refList[1], incLevel2), indexBalanceIncrement(refList[1], ownerColon, incLevel2, "_txs_l2"), if ((refListSize | |
52 | + | [balanceIncrement(refList[1], incLevel2), indexBalanceIncrement(refList[1], ownerColon, incLevel2, "_txs_l2"), if ((refListSize >= 3)) | |
53 | 53 | then { | |
54 | 54 | let incLevel3 = ((amount * level3) / 1000) | |
55 | 55 | [balanceIncrement(refList[2], incLevel3), indexBalanceIncrement(refList[2], ownerColon, incLevel3, "_txs_l3")] | |
56 | 56 | } | |
57 | 57 | else nil] | |
58 | 58 | } | |
59 | 59 | else nil] | |
60 | 60 | case _ => | |
61 | 61 | nil | |
62 | 62 | }) | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | 67 | @Callable(i) | |
68 | 68 | func withdraw (amount) = if ((0 >= amount)) | |
69 | 69 | then throw("invalid amount") | |
70 | 70 | else { | |
71 | 71 | let owner = toBase58String(i.callerPublicKey) | |
72 | 72 | let newBalance = ( match getInteger(this, (owner + "_balance")) { | |
73 | 73 | case b: Int => | |
74 | 74 | b | |
75 | 75 | case _ => | |
76 | 76 | 0 | |
77 | 77 | } - amount) | |
78 | 78 | if ((0 > newBalance)) | |
79 | 79 | then throw("transaction leads to negative account balance") | |
80 | 80 | else ScriptResult(WriteSet([DataEntry((owner + "_balance"), newBalance)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | ||
85 | 85 | @Callable(i) | |
86 | 86 | func register (referer) = { | |
87 | 87 | let owner = toBase58String(i.callerPublicKey) | |
88 | 88 | if (isDefined(getReferer(owner))) | |
89 | 89 | then throw("Already registered") | |
90 | 90 | else { | |
91 | 91 | let referalsKey = (referer + "_referrals") | |
92 | 92 | let referals = match getString(this, referalsKey) { | |
93 | 93 | case oldRefs: String => | |
94 | 94 | ((oldRefs + ",") + owner) | |
95 | 95 | case _ => | |
96 | 96 | owner | |
97 | 97 | } | |
98 | 98 | let refStructure = (referer + match getReferer(referer) { | |
99 | 99 | case referer2: String => | |
100 | 100 | (("," + referer2) + match getReferer(referer2) { | |
101 | 101 | case referer3: String => | |
102 | 102 | ("," + referer3) | |
103 | 103 | case _ => | |
104 | 104 | "" | |
105 | 105 | }) | |
106 | 106 | case _ => | |
107 | 107 | "" | |
108 | 108 | }) | |
109 | 109 | WriteSet([DataEntry((owner + "_referer"), referer), DataEntry(referalsKey, referals), DataEntry((owner + "_refstructure"), refStructure)]) | |
110 | 110 | } | |
111 | 111 | } | |
112 | 112 | ||
113 | 113 |
github/deemru/w8io/169f3d6 41.26 ms ◑![]()