tx · AwPXVTnwBa6LetodXsdtp9SGyNvvcZnLiWTqhHd8wyDg

3Msughfkwji8uccY4RAxuKWvNpnEscWyhHK:  -0.01400000 Waves

2019.07.02 16:31 [567836] smart account 3Msughfkwji8uccY4RAxuKWvNpnEscWyhHK > SELF 0.00000000 Waves

{ "type": 13, "id": "AwPXVTnwBa6LetodXsdtp9SGyNvvcZnLiWTqhHd8wyDg", "fee": 1400000, "feeAssetId": null, "timestamp": 1562074260764, "version": 1, "sender": "3Msughfkwji8uccY4RAxuKWvNpnEscWyhHK", "senderPublicKey": "AzyC6W7iD5HYehj2xef6xWKogmxDC6RaX9N1ST8P39bn", "proofs": [ "22ratUH3aKT54kzoAM2WnGKdB7dLr79MGM4rx6dWyNfsjxeSUfcGMtsRjWeJ5RdEN7aZ5wsDWJApjo6kh7SkcF4a" ], "script": "base64:AAIDAAAAAAAAAAAAAAALAAAAAAZsZXZlbDEAAAAAAAAAAPoAAAAABmxldmVsMgAAAAAAAAAA+gAAAAAGbGV2ZWwzAAAAAAAAAAD6AAAAAAhjYXNoQmFjawAAAAAAAAAA+gAAAAAGbWF4RmVlAAAAAAAATEtAAAAAAA5jaGFuZ2VPd25lcktleQIAAAAsQUQydmJ6cFIzWk1YaVkxWmhCZHE0aUgxd3o1dzZ0VUNIUHoxdnZOZnlDcUUBAAAAEGJhbGFuY2VJbmNyZW1lbnQAAAACAAAAB2FkZHJlc3MAAAADaW5jBAAAAApiYWxhbmNlS2V5CQABLAAAAAIFAAAAB2FkZHJlc3MCAAAACF9iYWxhbmNlCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKYmFsYW5jZUtleQkAAGQAAAACBQAAAANpbmMEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKYmFsYW5jZUtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAAAQAAABVpbmRleEJhbGFuY2VJbmNyZW1l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AAABLAUAAAAIcmVmZXJlcjMCAAAAAAIAAAAACQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAVvd25lcgIAAAAIX3JlZmVyZXIFAAAAB3JlZmVyZXIJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAC3JlZmVyYWxzS2V5BQAAAAhyZWZlcmFscwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAVvd25lcgIAAAANX3JlZnN0cnVjdHVyZQUAAAAMcmVmU3RydWN0dXJlBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyCAUAAAABaQAAAANmZWUFAAAABHVuaXQFAAAAA25pbAAAAAD2xAJm", "chainId": 84, "height": 567836, "spentComplexity": 0 } View: original | compacted Prev: CSi5Msk2ANvEZxvSeREWgmP4A9jYK5Gfqagv5GwfX47 Next: 8xuvB84GiyhToGqbiqnzneqWyWmbhQT437RH4nnoRDm6 Diff:
OldNewDifferences
4848 else true
4949
5050
51+func w () = {
52+ let x = extract(blockInfoByHeight(height))
53+ toString(x.timestamp)
54+ }
55+
56+
5157 @Callable(v)
5258 func fund () = {
5359 let n = toBase58String(v.callerPublicKey)
54- let w = extract(blockInfoByHeight(height))
55- let x = (((n + ":") + toString(w.timestamp)) + ":")
56- let y = extract(v.payment).amount
57- let z = u(v)
60+ let y = ((n + ":") + w())
61+ let z = extract(v.payment).amount
62+ let A = u(v)
5863 ScriptResult(WriteSet({
5964 let k = getString(this, (n + "_refstructure"))
6065 if ($isInstanceOf(k, "String"))
6166 then {
62- let A = k
63- let B = split(A, ",")
64- let C = size(B)
65- let D = ((y * a) / 1000)
66- let E = ((y * d) / 1000)
67-[g(n, E), m(n, x, E, "_txs_cashback"), g(B[0], D), m(B[0], x, D, "_txs_l1"), if ((C >= 2))
67+ let B = k
68+ let C = split(B, ",")
69+ let D = size(C)
70+ let E = ((z * a) / 1000)
71+ let F = ((z * d) / 1000)
72+[g(n, F), m(n, y, F, "_txs_cashback"), g(C[0], E), m(C[0], y, E, "_txs_l1"), if ((D >= 2))
6873 then {
69- let F = ((y * b) / 1000)
70-[g(B[1], F), m(B[1], x, F, "_txs_l2"), if ((C >= 3))
74+ let G = ((z * b) / 1000)
75+[g(C[1], G), m(C[1], y, G, "_txs_l2"), if ((D >= 3))
7176 then {
72- let G = ((y * c) / 1000)
73-[g(B[2], G), m(B[2], x, G, "_txs_l3"), g(f, (((y - D) - F) - G)), m(f, x, (((y - D) - F) - G), "_txs_change")]
77+ let H = ((z * c) / 1000)
78+[g(C[2], H), m(C[2], y, H, "_txs_l3"), g(f, (((z - E) - G) - H)), m(f, y, (((z - E) - G) - H), "_txs_change")]
7479 }
75- else [g(f, ((y - D) - F)), m(f, x, ((y - D) - F), "_txs_change")]]
80+ else [g(f, ((z - E) - G)), m(f, y, ((z - E) - G), "_txs_change")]]
7681 }
77- else [g(f, (y - D)), m(f, x, (y - D), "_txs_change")]]
82+ else [g(f, (z - E)), m(f, y, (z - E), "_txs_change")]]
7883 }
79- else [g(f, y), m(f, x, y, "_txs_change")]
84+ else [g(f, z), m(f, y, z, "_txs_change")]
8085 }), TransferSet([ScriptTransfer(v.caller, v.fee, unit)]))
8186 }
8287
8489
8590 @Callable(v)
8691 func withdraw () = {
87- let z = u(v)
92+ let A = u(v)
8893 let n = toBase58String(v.callerPublicKey)
89- let y = {
90- let k = getInteger(this, (n + "_balance"))
94+ let j = (n + "_balance")
95+ let z = {
96+ let k = getInteger(this, j)
9197 if ($isInstanceOf(k, "Int"))
9298 then {
9399 let l = k
95101 }
96102 else 0
97103 }
98- ScriptResult(WriteSet([DataEntry((n + "_balance"), 0)]), TransferSet([ScriptTransfer(v.caller, (y + v.fee), unit)]))
104+ let I = (n + "_withdraw_txs")
105+ let J = ((((toString(z) + ":") + toBase58String(v.transactionId)) + ":") + w())
106+ let K = {
107+ let k = getString(this, I)
108+ if ($isInstanceOf(k, "String"))
109+ then {
110+ let L = k
111+ ((L + ",") + J)
112+ }
113+ else J
114+ }
115+ ScriptResult(WriteSet([DataEntry(j, 0), DataEntry(I, K)]), TransferSet([ScriptTransfer(v.caller, (z + v.fee), unit)]))
99116 }
100117
101118
102119
103120 @Callable(v)
104-func test () = WriteSet(nil)
105-
106-
107-
108-@Callable(v)
109-func register (H,I) = {
110- let z = u(v)
121+func register (M,N) = {
122+ let A = u(v)
111123 if ((take(toBase58String(v.transactionId), 3) != "123"))
112124 then throw("proof of work failed")
113125 else {
115127 if (isDefined(s(n)))
116128 then throw("Already registered")
117129 else {
118- let J = (H + "_referrals")
119- let K = {
120- let k = getString(this, J)
130+ let O = (M + "_referrals")
131+ let P = {
132+ let k = getString(this, O)
121133 if ($isInstanceOf(k, "String"))
122134 then {
123- let L = k
124- ((L + ",") + n)
135+ let Q = k
136+ ((Q + ",") + n)
125137 }
126138 else n
127139 }
128- let M = (H + {
129- let k = s(H)
140+ let R = (M + {
141+ let k = s(M)
130142 if ($isInstanceOf(k, "String"))
131143 then {
132- let N = k
133- (("," + N) + {
134- let O = s(N)
135- if ($isInstanceOf(O, "String"))
144+ let S = k
145+ (("," + S) + {
146+ let T = s(S)
147+ if ($isInstanceOf(T, "String"))
136148 then {
137- let P = O
138- ("," + P)
149+ let U = T
150+ ("," + U)
139151 }
140152 else ""
141153 })
142154 }
143155 else ""
144156 })
145- ScriptResult(WriteSet([DataEntry((n + "_referer"), H), DataEntry(J, K), DataEntry((n + "_refstructure"), M)]), TransferSet([ScriptTransfer(v.caller, v.fee, unit)]))
157+ ScriptResult(WriteSet([DataEntry((n + "_referer"), M), DataEntry(O, P), DataEntry((n + "_refstructure"), R)]), TransferSet([ScriptTransfer(v.caller, v.fee, unit)]))
146158 }
147159 }
148160 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = 250
55
66 let b = 250
77
88 let c = 250
99
1010 let d = 250
1111
1212 let e = 5000000
1313
1414 let f = "AD2vbzpR3ZMXiY1ZhBdq4iH1wz5w6tUCHPz1vvNfyCqE"
1515
1616 func g (h,i) = {
1717 let j = (h + "_balance")
1818 DataEntry(j, (i + {
1919 let k = getInteger(this, j)
2020 if ($isInstanceOf(k, "Int"))
2121 then {
2222 let l = k
2323 l
2424 }
2525 else 0
2626 }))
2727 }
2828
2929
3030 func m (h,n,i,o) = {
3131 let p = (h + o)
3232 let q = (n + toString(i))
3333 let k = getString(this, p)
3434 if ($isInstanceOf(k, "String"))
3535 then {
3636 let r = k
3737 DataEntry(p, ((r + ",") + q))
3838 }
3939 else DataEntry(p, q)
4040 }
4141
4242
4343 func s (t) = getString(this, (t + "_referer"))
4444
4545
4646 func u (v) = if ((v.fee > e))
4747 then throw("unreasonable large fee")
4848 else true
4949
5050
51+func w () = {
52+ let x = extract(blockInfoByHeight(height))
53+ toString(x.timestamp)
54+ }
55+
56+
5157 @Callable(v)
5258 func fund () = {
5359 let n = toBase58String(v.callerPublicKey)
54- let w = extract(blockInfoByHeight(height))
55- let x = (((n + ":") + toString(w.timestamp)) + ":")
56- let y = extract(v.payment).amount
57- let z = u(v)
60+ let y = ((n + ":") + w())
61+ let z = extract(v.payment).amount
62+ let A = u(v)
5863 ScriptResult(WriteSet({
5964 let k = getString(this, (n + "_refstructure"))
6065 if ($isInstanceOf(k, "String"))
6166 then {
62- let A = k
63- let B = split(A, ",")
64- let C = size(B)
65- let D = ((y * a) / 1000)
66- let E = ((y * d) / 1000)
67-[g(n, E), m(n, x, E, "_txs_cashback"), g(B[0], D), m(B[0], x, D, "_txs_l1"), if ((C >= 2))
67+ let B = k
68+ let C = split(B, ",")
69+ let D = size(C)
70+ let E = ((z * a) / 1000)
71+ let F = ((z * d) / 1000)
72+[g(n, F), m(n, y, F, "_txs_cashback"), g(C[0], E), m(C[0], y, E, "_txs_l1"), if ((D >= 2))
6873 then {
69- let F = ((y * b) / 1000)
70-[g(B[1], F), m(B[1], x, F, "_txs_l2"), if ((C >= 3))
74+ let G = ((z * b) / 1000)
75+[g(C[1], G), m(C[1], y, G, "_txs_l2"), if ((D >= 3))
7176 then {
72- let G = ((y * c) / 1000)
73-[g(B[2], G), m(B[2], x, G, "_txs_l3"), g(f, (((y - D) - F) - G)), m(f, x, (((y - D) - F) - G), "_txs_change")]
77+ let H = ((z * c) / 1000)
78+[g(C[2], H), m(C[2], y, H, "_txs_l3"), g(f, (((z - E) - G) - H)), m(f, y, (((z - E) - G) - H), "_txs_change")]
7479 }
75- else [g(f, ((y - D) - F)), m(f, x, ((y - D) - F), "_txs_change")]]
80+ else [g(f, ((z - E) - G)), m(f, y, ((z - E) - G), "_txs_change")]]
7681 }
77- else [g(f, (y - D)), m(f, x, (y - D), "_txs_change")]]
82+ else [g(f, (z - E)), m(f, y, (z - E), "_txs_change")]]
7883 }
79- else [g(f, y), m(f, x, y, "_txs_change")]
84+ else [g(f, z), m(f, y, z, "_txs_change")]
8085 }), TransferSet([ScriptTransfer(v.caller, v.fee, unit)]))
8186 }
8287
8388
8489
8590 @Callable(v)
8691 func withdraw () = {
87- let z = u(v)
92+ let A = u(v)
8893 let n = toBase58String(v.callerPublicKey)
89- let y = {
90- let k = getInteger(this, (n + "_balance"))
94+ let j = (n + "_balance")
95+ let z = {
96+ let k = getInteger(this, j)
9197 if ($isInstanceOf(k, "Int"))
9298 then {
9399 let l = k
94100 l
95101 }
96102 else 0
97103 }
98- ScriptResult(WriteSet([DataEntry((n + "_balance"), 0)]), TransferSet([ScriptTransfer(v.caller, (y + v.fee), unit)]))
104+ let I = (n + "_withdraw_txs")
105+ let J = ((((toString(z) + ":") + toBase58String(v.transactionId)) + ":") + w())
106+ let K = {
107+ let k = getString(this, I)
108+ if ($isInstanceOf(k, "String"))
109+ then {
110+ let L = k
111+ ((L + ",") + J)
112+ }
113+ else J
114+ }
115+ ScriptResult(WriteSet([DataEntry(j, 0), DataEntry(I, K)]), TransferSet([ScriptTransfer(v.caller, (z + v.fee), unit)]))
99116 }
100117
101118
102119
103120 @Callable(v)
104-func test () = WriteSet(nil)
105-
106-
107-
108-@Callable(v)
109-func register (H,I) = {
110- let z = u(v)
121+func register (M,N) = {
122+ let A = u(v)
111123 if ((take(toBase58String(v.transactionId), 3) != "123"))
112124 then throw("proof of work failed")
113125 else {
114126 let n = toBase58String(v.callerPublicKey)
115127 if (isDefined(s(n)))
116128 then throw("Already registered")
117129 else {
118- let J = (H + "_referrals")
119- let K = {
120- let k = getString(this, J)
130+ let O = (M + "_referrals")
131+ let P = {
132+ let k = getString(this, O)
121133 if ($isInstanceOf(k, "String"))
122134 then {
123- let L = k
124- ((L + ",") + n)
135+ let Q = k
136+ ((Q + ",") + n)
125137 }
126138 else n
127139 }
128- let M = (H + {
129- let k = s(H)
140+ let R = (M + {
141+ let k = s(M)
130142 if ($isInstanceOf(k, "String"))
131143 then {
132- let N = k
133- (("," + N) + {
134- let O = s(N)
135- if ($isInstanceOf(O, "String"))
144+ let S = k
145+ (("," + S) + {
146+ let T = s(S)
147+ if ($isInstanceOf(T, "String"))
136148 then {
137- let P = O
138- ("," + P)
149+ let U = T
150+ ("," + U)
139151 }
140152 else ""
141153 })
142154 }
143155 else ""
144156 })
145- ScriptResult(WriteSet([DataEntry((n + "_referer"), H), DataEntry(J, K), DataEntry((n + "_refstructure"), M)]), TransferSet([ScriptTransfer(v.caller, v.fee, unit)]))
157+ ScriptResult(WriteSet([DataEntry((n + "_referer"), M), DataEntry(O, P), DataEntry((n + "_refstructure"), R)]), TransferSet([ScriptTransfer(v.caller, v.fee, unit)]))
146158 }
147159 }
148160 }
149161
150162

github/deemru/w8io/169f3d6 
66.10 ms