tx · 2snY9xfwD3bJME647kqDUQgquex6pbmBRegfCE8mSCcj 3N9hj5xjfQdmxFKgztzxsQY9FSGSRM2RNTr: -0.05000000 Waves 2019.10.18 23:48 [725961] smart account 3N9hj5xjfQdmxFKgztzxsQY9FSGSRM2RNTr > SELF 0.00000000 Waves
{ "type": 13, "id": "2snY9xfwD3bJME647kqDUQgquex6pbmBRegfCE8mSCcj", "fee": 5000000, "feeAssetId": null, "timestamp": 1571431364876, "version": 1, "sender": "3N9hj5xjfQdmxFKgztzxsQY9FSGSRM2RNTr", "senderPublicKey": "456duGZMs5yvsHurjiNQi2JtHjKtMj4WyRRRcVHzKWrb", "proofs": [ "3t4N2KvMqmUZaGkPAuXEujHkPCX5XhXxvhojnRarD8C8hKyugBL1sqHf1E6cwwHLXnPWKfsaosy6JyKWSzfvuMDB" ], "script": "base64:AAIDAAAAAAAAAA0IARIDCgEIEgQKAggIAAAAEgAAAAAEWUVBUgAAAAAHWPDfwAAAAAAFTU9OVEgJAABpAAAAAgUAAAAEWUVBUgAAAAAAAAAADAAAAAAFQURNSU4CAAAAIzNOQkRnUjhoVTZXODZTc3RuM0VHaWQ4azl1eGtxaUpqeFQ2AAAAAAVUT0tFTgEAAAAgxYrQlOWMQVAQFV8+63OMRt4C+0j9Xrs6Q7YHkRdAWuYAAAAABHdFVVIBAAAAIOwWYQRfe5EhQQY7N/Pn19T489PGDqqAl/OQv9D6FbqZAAAAAANXVlMAAAAAAAX14QAAAAAAC1BSSUNFeEJBU0lDAAAAAAAAAAA8AAAAAA5QUklDRXhBRFZBTkNFRAAAAAAAAAAAMgAAAAAFQkFTSUMCAAAABWJhc2ljAAAAAAhBRFZBTkNFRAIAAAAIYWR2YW5jZWQAAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEA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AABHBsYW4FAAAACWlzUmVuZXdhbAAAAAD/6CdP", "chainId": 84, "height": 725961, "spentComplexity": 0 } View: original | compacted Prev: 9WJkscDuER8wciaSGwAzS1qW1Qpz9zDbKZPQFwvVjW4e Next: 4YXsjdkUxU8EwYweskZ2ZMEFVW5ED2hTGsPdPfpZ1ey9 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = | |
4 | + | let a = 31556952000 | |
5 | 5 | ||
6 | - | let b = ( | |
6 | + | let b = (a / 12) | |
7 | 7 | ||
8 | - | let c = | |
8 | + | let c = "3NBDgR8hU6W86Sstn3EGid8k9uxkqiJjxT6" | |
9 | 9 | ||
10 | 10 | let d = base58'EJ85vmBXWEtV4yHLPRTxex4q4s9mC8jKUhheyjZxwnPw' | |
11 | 11 | ||
12 | - | let e = | |
12 | + | let e = base58'Gtb1WRznfchDnTh37ezoDTJ4wcoKaRsKqKjJjy7nm2zU' | |
13 | 13 | ||
14 | - | func f (g) = { | |
15 | - | let h = getInteger(this, g) | |
16 | - | if ($isInstanceOf(h, "Int")) | |
14 | + | let f = 100000000 | |
15 | + | ||
16 | + | let g = 60 | |
17 | + | ||
18 | + | let h = 50 | |
19 | + | ||
20 | + | let i = "basic" | |
21 | + | ||
22 | + | let j = "advanced" | |
23 | + | ||
24 | + | let k = "none" | |
25 | + | ||
26 | + | func l (m) = { | |
27 | + | let n = getInteger(this, m) | |
28 | + | if ($isInstanceOf(n, "Int")) | |
17 | 29 | then { | |
18 | - | let | |
19 | - | | |
30 | + | let o = n | |
31 | + | o | |
20 | 32 | } | |
21 | 33 | else 0 | |
22 | 34 | } | |
23 | 35 | ||
24 | 36 | ||
25 | - | func | |
26 | - | let | |
27 | - | if ($isInstanceOf( | |
37 | + | func p (m) = { | |
38 | + | let n = getString(this, m) | |
39 | + | if ($isInstanceOf(n, "String")) | |
28 | 40 | then { | |
29 | - | let | |
30 | - | | |
41 | + | let q = n | |
42 | + | q | |
31 | 43 | } | |
32 | - | else | |
44 | + | else k | |
33 | 45 | } | |
34 | 46 | ||
35 | 47 | ||
36 | - | func | |
48 | + | func r (s) = (("member_" + s) + "_subscription_end") | |
37 | 49 | ||
38 | 50 | ||
39 | - | func | |
51 | + | func t (s) = (("member_" + s) + "_plan") | |
40 | 52 | ||
41 | 53 | ||
42 | - | func | |
54 | + | func u (v) = TransferSet([ScriptTransfer(v, 1, d)]) | |
43 | 55 | ||
44 | 56 | ||
45 | - | func | |
57 | + | func w (v,x,y) = WriteSet([DataEntry(r(v), (lastBlock.timestamp + x)), DataEntry(t(v), y)]) | |
46 | 58 | ||
47 | 59 | ||
48 | - | @Callable(q) | |
49 | - | func subscribe () = { | |
50 | - | let r = extract(q.payment) | |
51 | - | if (isDefined(r.assetId)) | |
52 | - | then throw("can use only WAVES token at the moment") | |
60 | + | func z (A,x,y,B) = { | |
61 | + | let v = toBase58String(A.bytes) | |
62 | + | if (B) | |
63 | + | then w(v, a, y) | |
64 | + | else ScriptResult(w(v, a, y), u(A)) | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | @Callable(C) | |
69 | + | func subscribe (y) = { | |
70 | + | let D = extract(C.payment) | |
71 | + | if ((D.assetId != e)) | |
72 | + | then throw("can use only wEUR token at the moment") | |
53 | 73 | else { | |
54 | - | let s = toBase58String(q.caller.bytes) | |
55 | - | let t = f(l(s)) | |
56 | - | if ((b > r.amount)) | |
57 | - | then throw("payment amount cannot be lowher then subscription fee") | |
58 | - | else if ((t != 0)) | |
59 | - | then throw("Already subscribed") | |
60 | - | else ScriptResult(WriteSet([DataEntry(l(s), lastBlock.timestamp), DataEntry(n(s), b), DataEntry(p(s), 0)]), TransferSet([ScriptTransfer(q.caller, 1, d)])) | |
74 | + | let v = toBase58String(C.caller.bytes) | |
75 | + | let E = l(r(v)) | |
76 | + | let B = (E == 0) | |
77 | + | if ((y == i)) | |
78 | + | then if ((g > D.amount)) | |
79 | + | then throw("unsufficient payment amount for basic plan") | |
80 | + | else z(C.caller, a, y, B) | |
81 | + | else if ((y == j)) | |
82 | + | then if ((h > D.amount)) | |
83 | + | then throw("unsufficient payment amount for advanced plan") | |
84 | + | else z(C.caller, b, y, B) | |
85 | + | else throw(("subscription to an unknown plan: " + y)) | |
61 | 86 | } | |
62 | 87 | } | |
63 | 88 | ||
64 | 89 | ||
65 | 90 | ||
66 | - | @Callable(q) | |
67 | - | func renew () = { | |
68 | - | let r = extract(q.payment) | |
69 | - | if (isDefined(r.assetId)) | |
70 | - | then throw("can use only WAVES token at the moment") | |
91 | + | @Callable(C) | |
92 | + | func subscribeUser (F,y) = { | |
93 | + | let v = toBase58String(C.caller.bytes) | |
94 | + | let G = toBase58String(this.bytes) | |
95 | + | if (if ((v != c)) | |
96 | + | then (v != G) | |
97 | + | else false) | |
98 | + | then throw("only admins can do that") | |
71 | 99 | else { | |
72 | - | let | |
73 | - | let | |
74 | - | let | |
75 | - | | |
76 | - | | |
77 | - | | |
78 | - | | |
79 | - | | |
100 | + | let E = l(r(F)) | |
101 | + | let B = (E == 0) | |
102 | + | let x = if ((y == i)) | |
103 | + | then a | |
104 | + | else if ((y == j)) | |
105 | + | then b | |
106 | + | else throw(("subscription to an unknown plan: " + y)) | |
107 | + | z(C.caller, x, y, B) | |
80 | 108 | } | |
81 | 109 | } | |
82 | 110 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = | |
4 | + | let a = 31556952000 | |
5 | 5 | ||
6 | - | let b = ( | |
6 | + | let b = (a / 12) | |
7 | 7 | ||
8 | - | let c = | |
8 | + | let c = "3NBDgR8hU6W86Sstn3EGid8k9uxkqiJjxT6" | |
9 | 9 | ||
10 | 10 | let d = base58'EJ85vmBXWEtV4yHLPRTxex4q4s9mC8jKUhheyjZxwnPw' | |
11 | 11 | ||
12 | - | let e = | |
12 | + | let e = base58'Gtb1WRznfchDnTh37ezoDTJ4wcoKaRsKqKjJjy7nm2zU' | |
13 | 13 | ||
14 | - | func f (g) = { | |
15 | - | let h = getInteger(this, g) | |
16 | - | if ($isInstanceOf(h, "Int")) | |
14 | + | let f = 100000000 | |
15 | + | ||
16 | + | let g = 60 | |
17 | + | ||
18 | + | let h = 50 | |
19 | + | ||
20 | + | let i = "basic" | |
21 | + | ||
22 | + | let j = "advanced" | |
23 | + | ||
24 | + | let k = "none" | |
25 | + | ||
26 | + | func l (m) = { | |
27 | + | let n = getInteger(this, m) | |
28 | + | if ($isInstanceOf(n, "Int")) | |
17 | 29 | then { | |
18 | - | let | |
19 | - | | |
30 | + | let o = n | |
31 | + | o | |
20 | 32 | } | |
21 | 33 | else 0 | |
22 | 34 | } | |
23 | 35 | ||
24 | 36 | ||
25 | - | func | |
26 | - | let | |
27 | - | if ($isInstanceOf( | |
37 | + | func p (m) = { | |
38 | + | let n = getString(this, m) | |
39 | + | if ($isInstanceOf(n, "String")) | |
28 | 40 | then { | |
29 | - | let | |
30 | - | | |
41 | + | let q = n | |
42 | + | q | |
31 | 43 | } | |
32 | - | else | |
44 | + | else k | |
33 | 45 | } | |
34 | 46 | ||
35 | 47 | ||
36 | - | func | |
48 | + | func r (s) = (("member_" + s) + "_subscription_end") | |
37 | 49 | ||
38 | 50 | ||
39 | - | func | |
51 | + | func t (s) = (("member_" + s) + "_plan") | |
40 | 52 | ||
41 | 53 | ||
42 | - | func | |
54 | + | func u (v) = TransferSet([ScriptTransfer(v, 1, d)]) | |
43 | 55 | ||
44 | 56 | ||
45 | - | func | |
57 | + | func w (v,x,y) = WriteSet([DataEntry(r(v), (lastBlock.timestamp + x)), DataEntry(t(v), y)]) | |
46 | 58 | ||
47 | 59 | ||
48 | - | @Callable(q) | |
49 | - | func subscribe () = { | |
50 | - | let r = extract(q.payment) | |
51 | - | if (isDefined(r.assetId)) | |
52 | - | then throw("can use only WAVES token at the moment") | |
60 | + | func z (A,x,y,B) = { | |
61 | + | let v = toBase58String(A.bytes) | |
62 | + | if (B) | |
63 | + | then w(v, a, y) | |
64 | + | else ScriptResult(w(v, a, y), u(A)) | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | @Callable(C) | |
69 | + | func subscribe (y) = { | |
70 | + | let D = extract(C.payment) | |
71 | + | if ((D.assetId != e)) | |
72 | + | then throw("can use only wEUR token at the moment") | |
53 | 73 | else { | |
54 | - | let s = toBase58String(q.caller.bytes) | |
55 | - | let t = f(l(s)) | |
56 | - | if ((b > r.amount)) | |
57 | - | then throw("payment amount cannot be lowher then subscription fee") | |
58 | - | else if ((t != 0)) | |
59 | - | then throw("Already subscribed") | |
60 | - | else ScriptResult(WriteSet([DataEntry(l(s), lastBlock.timestamp), DataEntry(n(s), b), DataEntry(p(s), 0)]), TransferSet([ScriptTransfer(q.caller, 1, d)])) | |
74 | + | let v = toBase58String(C.caller.bytes) | |
75 | + | let E = l(r(v)) | |
76 | + | let B = (E == 0) | |
77 | + | if ((y == i)) | |
78 | + | then if ((g > D.amount)) | |
79 | + | then throw("unsufficient payment amount for basic plan") | |
80 | + | else z(C.caller, a, y, B) | |
81 | + | else if ((y == j)) | |
82 | + | then if ((h > D.amount)) | |
83 | + | then throw("unsufficient payment amount for advanced plan") | |
84 | + | else z(C.caller, b, y, B) | |
85 | + | else throw(("subscription to an unknown plan: " + y)) | |
61 | 86 | } | |
62 | 87 | } | |
63 | 88 | ||
64 | 89 | ||
65 | 90 | ||
66 | - | @Callable(q) | |
67 | - | func renew () = { | |
68 | - | let r = extract(q.payment) | |
69 | - | if (isDefined(r.assetId)) | |
70 | - | then throw("can use only WAVES token at the moment") | |
91 | + | @Callable(C) | |
92 | + | func subscribeUser (F,y) = { | |
93 | + | let v = toBase58String(C.caller.bytes) | |
94 | + | let G = toBase58String(this.bytes) | |
95 | + | if (if ((v != c)) | |
96 | + | then (v != G) | |
97 | + | else false) | |
98 | + | then throw("only admins can do that") | |
71 | 99 | else { | |
72 | - | let | |
73 | - | let | |
74 | - | let | |
75 | - | | |
76 | - | | |
77 | - | | |
78 | - | | |
79 | - | | |
100 | + | let E = l(r(F)) | |
101 | + | let B = (E == 0) | |
102 | + | let x = if ((y == i)) | |
103 | + | then a | |
104 | + | else if ((y == j)) | |
105 | + | then b | |
106 | + | else throw(("subscription to an unknown plan: " + y)) | |
107 | + | z(C.caller, x, y, B) | |
80 | 108 | } | |
81 | 109 | } | |
82 | 110 | ||
83 | 111 |
github/deemru/w8io/169f3d6 40.24 ms ◑