tx · 8pnJqJbszCSDrwmXrpjRCGJWByxnAnpMeqs3YvgrAP2P 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD: -0.01400000 Waves 2021.05.27 10:41 [1543773] smart account 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD > SELF 0.00000000 Waves
{ "type": 13, "id": "8pnJqJbszCSDrwmXrpjRCGJWByxnAnpMeqs3YvgrAP2P", "fee": 1400000, "feeAssetId": null, "timestamp": 1622101287942, "version": 2, "chainId": 84, "sender": "3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD", "senderPublicKey": "8SRjg8K8B7rhV2pih6qRgku886VQE4phwNCDjWZu1fUe", "proofs": [ "2ZMkG5GvrPBSSd5p8C3qPeDnG9rFDKAR3on7r5DU52GwHyGGsg9QXyVABtsYXdXPSGJ13PxoEhgAReoVBoWzXKxb" ], "script": "base64:AAIEAAAAAAAAACwIAhIDCgEIEgMKAQESAwoBARIECgIIARIHCgUICAEBCBIECgIIARIECgIIAQAAAAsBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbAE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AAAAGYW1vdW50AwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQkBAAAABXZhbHVlAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMJAAACAAAAAQIAAAAgbmVlZCBhdHRhY2ggcGF5bWVudCB3aXRoIE5ZQU4tMjUEAAAAB3BheW1lbnQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAAZhbW91bnQJAAJZAAAAAQUAAAAHYXNzZXRJZAkABEwAAAACCQEAAAAEQnVybgAAAAIJAQAAAAV2YWx1ZQAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQIBQAAAAdwYXltZW50AAAABmFtb3VudAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmr84sx", "height": 1543773, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G7ZUnwUL1hJsaW99CjoWZmEMqZzBEgGW196hRDK7dMyZ Next: 9MHM6rYEE4J74pRrDBiYcp4fEN4MEhZ3Wv37UwLTVXH1 Diff:
Old | New | Differences | |
---|---|---|---|
37 | 37 | func k (j) = g(i(j)) | |
38 | 38 | ||
39 | 39 | ||
40 | - | func l ( | |
40 | + | func l () = "dApp_tokenId" | |
41 | 41 | ||
42 | 42 | ||
43 | - | func m ( | |
43 | + | func m () = g(l()) | |
44 | 44 | ||
45 | 45 | ||
46 | - | func n () = " | |
46 | + | func n (o) = (("asset_" + o) + "_price") | |
47 | 47 | ||
48 | 48 | ||
49 | - | func | |
49 | + | func p (o) = a(n(o)) | |
50 | 50 | ||
51 | 51 | ||
52 | - | func | |
52 | + | func q (o) = (("asset_" + o) + "_data") | |
53 | 53 | ||
54 | 54 | ||
55 | - | func | |
55 | + | func r (o) = g(n(o)) | |
56 | 56 | ||
57 | 57 | ||
58 | - | func r (s) = (("asset_" + s) + "_amount") | |
59 | - | ||
60 | - | ||
61 | - | func t (s) = a(r(s)) | |
62 | - | ||
63 | - | ||
64 | - | func u (s) = (("asset_" + s) + "_price") | |
65 | - | ||
66 | - | ||
67 | - | func v (s) = a(u(s)) | |
68 | - | ||
69 | - | ||
70 | - | func w (s) = (("asset_" + s) + "_data") | |
71 | - | ||
72 | - | ||
73 | - | func x (s) = g(u(s)) | |
74 | - | ||
75 | - | ||
76 | - | @Callable(y) | |
77 | - | func signUp (z) = { | |
78 | - | let A = toBase58String(y.caller.bytes) | |
79 | - | let B = k(A) | |
80 | - | if ((B != f)) | |
81 | - | then throw("user is already registered") | |
82 | - | else [StringEntry(i(A), z), IntegerEntry(l(A), 0)] | |
58 | + | @Callable(s) | |
59 | + | func signUp (t) = { | |
60 | + | let u = toBase58String(s.caller.bytes) | |
61 | + | let v = k(u) | |
62 | + | if ((v != f)) | |
63 | + | then throw("User is already registered") | |
64 | + | else [StringEntry(i(v), t)] | |
83 | 65 | } | |
84 | 66 | ||
85 | 67 | ||
86 | 68 | ||
87 | - | @Callable( | |
88 | - | func | |
89 | - | let | |
90 | - | if (( | |
91 | - | then throw(" | |
69 | + | @Callable(s) | |
70 | + | func issueNyanToken (w) = { | |
71 | + | let x = m() | |
72 | + | if ((x != f)) | |
73 | + | then throw("NYAN Token already issued") | |
92 | 74 | else { | |
93 | - | let | |
94 | - | let | |
95 | - | [ | |
75 | + | let y = Issue("NYAN Token", "NYAN Token is a cryptocurrency token that operates on the Waves platform", w, 0, true) | |
76 | + | let z = toBase58String(calculateAssetId(y)) | |
77 | + | [y, StringEntry(l(), z)] | |
96 | 78 | } | |
97 | 79 | } | |
98 | 80 | ||
99 | 81 | ||
100 | 82 | ||
101 | - | @Callable( | |
102 | - | func | |
103 | - | let | |
104 | - | if (( | |
105 | - | then throw(" | |
83 | + | @Callable(s) | |
84 | + | func reissueNyanToken (w) = { | |
85 | + | let x = m() | |
86 | + | if ((x != f)) | |
87 | + | then throw("NYAN Token was not issued") | |
106 | 88 | else { | |
107 | - | let F = q() | |
108 | - | let G = (F + C) | |
109 | - | [Reissue(fromBase58String(D), C, true), IntegerEntry(p(), G)] | |
89 | + | let A = fromBase58String(x) | |
90 | + | [Reissue(A, w, true)] | |
110 | 91 | } | |
111 | 92 | } | |
112 | 93 | ||
113 | 94 | ||
114 | 95 | ||
115 | - | @Callable(y) | |
116 | - | func transferToken (H,I) = { | |
117 | - | let F = q() | |
118 | - | let J = (F - I) | |
119 | - | if ((0 > J)) | |
120 | - | then throw("not enoung balance") | |
96 | + | @Callable(s) | |
97 | + | func transferNyanToken (B,C) = { | |
98 | + | let v = k(B) | |
99 | + | let x = m() | |
100 | + | let A = fromBase58String(x) | |
101 | + | let D = assetBalance(this, A) | |
102 | + | let E = (D - C) | |
103 | + | if ((v == f)) | |
104 | + | then throw("You cannot transfer NYAN Token to a user who is not registered") | |
105 | + | else if ((0 > C)) | |
106 | + | then throw("It is impossible to transfer a negative amount") | |
107 | + | else if ((0 > E)) | |
108 | + | then throw("Not enough NYAN Tokens to transfer") | |
109 | + | else { | |
110 | + | let F = Address(fromBase58String(B)) | |
111 | + | [ScriptTransfer(F, C, A)] | |
112 | + | } | |
113 | + | } | |
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | @Callable(s) | |
118 | + | func issueAssetToken (G,H,w,I,J) = { | |
119 | + | let K = Issue(G, H, w, 0, true) | |
120 | + | let L = toBase58String(calculateAssetId(K)) | |
121 | + | if ((w == 0)) | |
122 | + | then [K, IntegerEntry(n(L), I), StringEntry(q(L), J)] | |
121 | 123 | else { | |
122 | - | let A = toBase58String(y.caller.bytes) | |
123 | - | let K = m(A) | |
124 | - | let L = (K + I) | |
125 | - | [IntegerEntry(p(), J), IntegerEntry(l(H), L), ScriptTransfer(Address(fromBase58String(H)), I, fromBase58String(o()))] | |
124 | + | let x = m() | |
125 | + | let A = fromBase58String(x) | |
126 | + | let D = assetBalance(this, A) | |
127 | + | let C = (w * I) | |
128 | + | let E = (D - C) | |
129 | + | if ((0 > E)) | |
130 | + | then throw("Not enough NYAN Tokens to issue an asset") | |
131 | + | else [K, Burn(A, C), IntegerEntry(n(L), I), StringEntry(q(L), J)] | |
126 | 132 | } | |
127 | 133 | } | |
128 | 134 | ||
129 | 135 | ||
130 | 136 | ||
131 | - | @Callable(y) | |
132 | - | func issueAssetToken (M,N,C,O,P) = { | |
133 | - | let s = Issue(M, N, C, 0, true) | |
134 | - | let E = calculateAssetId(s) | |
135 | - | [s, IntegerEntry(r(toBase58String(E)), C), IntegerEntry(u(toBase58String(E)), O), StringEntry(w(toBase58String(E)), P)] | |
137 | + | @Callable(s) | |
138 | + | func reissueAssetToken (M,w) = { | |
139 | + | let x = m() | |
140 | + | let A = fromBase58String(x) | |
141 | + | let D = assetBalance(this, A) | |
142 | + | let N = p(M) | |
143 | + | let C = (w * N) | |
144 | + | let E = (D - C) | |
145 | + | if ((0 > E)) | |
146 | + | then throw("Not enough NYAN Tokens to reissue an asset") | |
147 | + | else { | |
148 | + | let O = fromBase58String(M) | |
149 | + | [Reissue(O, w, true), Burn(A, C)] | |
150 | + | } | |
136 | 151 | } | |
137 | 152 | ||
138 | 153 | ||
139 | 154 | ||
140 | - | @Callable(y) | |
141 | - | func reissueAssetToken (E,I) = { | |
142 | - | let Q = t(E) | |
143 | - | let R = (Q + I) | |
144 | - | [Reissue(fromBase58String(E), I, true), IntegerEntry(r(E), R)] | |
145 | - | } | |
146 | - | ||
147 | - | ||
148 | - | ||
149 | - | @Callable(y) | |
150 | - | func exchangeAssetToken (E,I) = if (!(isDefined(value(y.payments)))) | |
155 | + | @Callable(s) | |
156 | + | func exchangeAssetToken (M,C) = if (!(isDefined(value(s.payments)))) | |
151 | 157 | then throw("need attach payment with NYAN-25") | |
152 | 158 | else { | |
153 | - | let | |
154 | - | [ScriptTransfer(Address( | |
159 | + | let P = s.payments[0] | |
160 | + | [ScriptTransfer(Address(s.caller.bytes), C, fromBase58String(M)), Burn(value(P.assetId), P.amount)] | |
155 | 161 | } | |
156 | 162 | ||
157 | 163 | ||
158 | - | @Verifier( | |
159 | - | func | |
164 | + | @Verifier(Q) | |
165 | + | func R () = sigVerify(Q.bodyBytes, Q.proofs[0], Q.senderPublicKey) | |
160 | 166 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func a (b) = { | |
5 | 5 | let c = { | |
6 | 6 | let d = getInteger(this, b) | |
7 | 7 | if ($isInstanceOf(d, "Int")) | |
8 | 8 | then { | |
9 | 9 | let e = d | |
10 | 10 | e | |
11 | 11 | } | |
12 | 12 | else 0 | |
13 | 13 | } | |
14 | 14 | c | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | let f = "none" | |
19 | 19 | ||
20 | 20 | func g (b) = { | |
21 | 21 | let h = { | |
22 | 22 | let d = getString(this, b) | |
23 | 23 | if ($isInstanceOf(d, "String")) | |
24 | 24 | then { | |
25 | 25 | let e = d | |
26 | 26 | e | |
27 | 27 | } | |
28 | 28 | else f | |
29 | 29 | } | |
30 | 30 | h | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func i (j) = (("user_" + j) + "_email") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func k (j) = g(i(j)) | |
38 | 38 | ||
39 | 39 | ||
40 | - | func l ( | |
40 | + | func l () = "dApp_tokenId" | |
41 | 41 | ||
42 | 42 | ||
43 | - | func m ( | |
43 | + | func m () = g(l()) | |
44 | 44 | ||
45 | 45 | ||
46 | - | func n () = " | |
46 | + | func n (o) = (("asset_" + o) + "_price") | |
47 | 47 | ||
48 | 48 | ||
49 | - | func | |
49 | + | func p (o) = a(n(o)) | |
50 | 50 | ||
51 | 51 | ||
52 | - | func | |
52 | + | func q (o) = (("asset_" + o) + "_data") | |
53 | 53 | ||
54 | 54 | ||
55 | - | func | |
55 | + | func r (o) = g(n(o)) | |
56 | 56 | ||
57 | 57 | ||
58 | - | func r (s) = (("asset_" + s) + "_amount") | |
59 | - | ||
60 | - | ||
61 | - | func t (s) = a(r(s)) | |
62 | - | ||
63 | - | ||
64 | - | func u (s) = (("asset_" + s) + "_price") | |
65 | - | ||
66 | - | ||
67 | - | func v (s) = a(u(s)) | |
68 | - | ||
69 | - | ||
70 | - | func w (s) = (("asset_" + s) + "_data") | |
71 | - | ||
72 | - | ||
73 | - | func x (s) = g(u(s)) | |
74 | - | ||
75 | - | ||
76 | - | @Callable(y) | |
77 | - | func signUp (z) = { | |
78 | - | let A = toBase58String(y.caller.bytes) | |
79 | - | let B = k(A) | |
80 | - | if ((B != f)) | |
81 | - | then throw("user is already registered") | |
82 | - | else [StringEntry(i(A), z), IntegerEntry(l(A), 0)] | |
58 | + | @Callable(s) | |
59 | + | func signUp (t) = { | |
60 | + | let u = toBase58String(s.caller.bytes) | |
61 | + | let v = k(u) | |
62 | + | if ((v != f)) | |
63 | + | then throw("User is already registered") | |
64 | + | else [StringEntry(i(v), t)] | |
83 | 65 | } | |
84 | 66 | ||
85 | 67 | ||
86 | 68 | ||
87 | - | @Callable( | |
88 | - | func | |
89 | - | let | |
90 | - | if (( | |
91 | - | then throw(" | |
69 | + | @Callable(s) | |
70 | + | func issueNyanToken (w) = { | |
71 | + | let x = m() | |
72 | + | if ((x != f)) | |
73 | + | then throw("NYAN Token already issued") | |
92 | 74 | else { | |
93 | - | let | |
94 | - | let | |
95 | - | [ | |
75 | + | let y = Issue("NYAN Token", "NYAN Token is a cryptocurrency token that operates on the Waves platform", w, 0, true) | |
76 | + | let z = toBase58String(calculateAssetId(y)) | |
77 | + | [y, StringEntry(l(), z)] | |
96 | 78 | } | |
97 | 79 | } | |
98 | 80 | ||
99 | 81 | ||
100 | 82 | ||
101 | - | @Callable( | |
102 | - | func | |
103 | - | let | |
104 | - | if (( | |
105 | - | then throw(" | |
83 | + | @Callable(s) | |
84 | + | func reissueNyanToken (w) = { | |
85 | + | let x = m() | |
86 | + | if ((x != f)) | |
87 | + | then throw("NYAN Token was not issued") | |
106 | 88 | else { | |
107 | - | let F = q() | |
108 | - | let G = (F + C) | |
109 | - | [Reissue(fromBase58String(D), C, true), IntegerEntry(p(), G)] | |
89 | + | let A = fromBase58String(x) | |
90 | + | [Reissue(A, w, true)] | |
110 | 91 | } | |
111 | 92 | } | |
112 | 93 | ||
113 | 94 | ||
114 | 95 | ||
115 | - | @Callable(y) | |
116 | - | func transferToken (H,I) = { | |
117 | - | let F = q() | |
118 | - | let J = (F - I) | |
119 | - | if ((0 > J)) | |
120 | - | then throw("not enoung balance") | |
96 | + | @Callable(s) | |
97 | + | func transferNyanToken (B,C) = { | |
98 | + | let v = k(B) | |
99 | + | let x = m() | |
100 | + | let A = fromBase58String(x) | |
101 | + | let D = assetBalance(this, A) | |
102 | + | let E = (D - C) | |
103 | + | if ((v == f)) | |
104 | + | then throw("You cannot transfer NYAN Token to a user who is not registered") | |
105 | + | else if ((0 > C)) | |
106 | + | then throw("It is impossible to transfer a negative amount") | |
107 | + | else if ((0 > E)) | |
108 | + | then throw("Not enough NYAN Tokens to transfer") | |
109 | + | else { | |
110 | + | let F = Address(fromBase58String(B)) | |
111 | + | [ScriptTransfer(F, C, A)] | |
112 | + | } | |
113 | + | } | |
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | @Callable(s) | |
118 | + | func issueAssetToken (G,H,w,I,J) = { | |
119 | + | let K = Issue(G, H, w, 0, true) | |
120 | + | let L = toBase58String(calculateAssetId(K)) | |
121 | + | if ((w == 0)) | |
122 | + | then [K, IntegerEntry(n(L), I), StringEntry(q(L), J)] | |
121 | 123 | else { | |
122 | - | let A = toBase58String(y.caller.bytes) | |
123 | - | let K = m(A) | |
124 | - | let L = (K + I) | |
125 | - | [IntegerEntry(p(), J), IntegerEntry(l(H), L), ScriptTransfer(Address(fromBase58String(H)), I, fromBase58String(o()))] | |
124 | + | let x = m() | |
125 | + | let A = fromBase58String(x) | |
126 | + | let D = assetBalance(this, A) | |
127 | + | let C = (w * I) | |
128 | + | let E = (D - C) | |
129 | + | if ((0 > E)) | |
130 | + | then throw("Not enough NYAN Tokens to issue an asset") | |
131 | + | else [K, Burn(A, C), IntegerEntry(n(L), I), StringEntry(q(L), J)] | |
126 | 132 | } | |
127 | 133 | } | |
128 | 134 | ||
129 | 135 | ||
130 | 136 | ||
131 | - | @Callable(y) | |
132 | - | func issueAssetToken (M,N,C,O,P) = { | |
133 | - | let s = Issue(M, N, C, 0, true) | |
134 | - | let E = calculateAssetId(s) | |
135 | - | [s, IntegerEntry(r(toBase58String(E)), C), IntegerEntry(u(toBase58String(E)), O), StringEntry(w(toBase58String(E)), P)] | |
137 | + | @Callable(s) | |
138 | + | func reissueAssetToken (M,w) = { | |
139 | + | let x = m() | |
140 | + | let A = fromBase58String(x) | |
141 | + | let D = assetBalance(this, A) | |
142 | + | let N = p(M) | |
143 | + | let C = (w * N) | |
144 | + | let E = (D - C) | |
145 | + | if ((0 > E)) | |
146 | + | then throw("Not enough NYAN Tokens to reissue an asset") | |
147 | + | else { | |
148 | + | let O = fromBase58String(M) | |
149 | + | [Reissue(O, w, true), Burn(A, C)] | |
150 | + | } | |
136 | 151 | } | |
137 | 152 | ||
138 | 153 | ||
139 | 154 | ||
140 | - | @Callable(y) | |
141 | - | func reissueAssetToken (E,I) = { | |
142 | - | let Q = t(E) | |
143 | - | let R = (Q + I) | |
144 | - | [Reissue(fromBase58String(E), I, true), IntegerEntry(r(E), R)] | |
145 | - | } | |
146 | - | ||
147 | - | ||
148 | - | ||
149 | - | @Callable(y) | |
150 | - | func exchangeAssetToken (E,I) = if (!(isDefined(value(y.payments)))) | |
155 | + | @Callable(s) | |
156 | + | func exchangeAssetToken (M,C) = if (!(isDefined(value(s.payments)))) | |
151 | 157 | then throw("need attach payment with NYAN-25") | |
152 | 158 | else { | |
153 | - | let | |
154 | - | [ScriptTransfer(Address( | |
159 | + | let P = s.payments[0] | |
160 | + | [ScriptTransfer(Address(s.caller.bytes), C, fromBase58String(M)), Burn(value(P.assetId), P.amount)] | |
155 | 161 | } | |
156 | 162 | ||
157 | 163 | ||
158 | - | @Verifier( | |
159 | - | func | |
164 | + | @Verifier(Q) | |
165 | + | func R () = sigVerify(Q.bodyBytes, Q.proofs[0], Q.senderPublicKey) | |
160 | 166 |
github/deemru/w8io/169f3d6 40.45 ms ◑