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:AAIEAAAAAAAAACwIAhIDCgEIEgMKAQESAwoBARIECgIIARIHCgUICAEBCBIECgIIARIECgIIAQAAAAsBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbA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QAAAAGYW1vdW50AwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQkBAAAABXZhbHVlAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMJAAACAAAAAQIAAAAgbmVlZCBhdHRhY2ggcGF5bWVudCB3aXRoIE5ZQU4tMjUEAAAAB3BheW1lbnQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAAZhbW91bnQJAAJZAAAAAQUAAAAHYXNzZXRJZAkABEwAAAACCQEAAAAEQnVybgAAAAIJAQAAAAV2YWx1ZQAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQIBQAAAAdwYXltZW50AAAABmFtb3VudAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmr84sx", "height": 1543773, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G7ZUnwUL1hJsaW99CjoWZmEMqZzBEgGW196hRDK7dMyZ Next: 9MHM6rYEE4J74pRrDBiYcp4fEN4MEhZ3Wv37UwLTVXH1 Diff:
OldNewDifferences
3737 func k (j) = g(i(j))
3838
3939
40-func l (j) = (("user_" + j) + "_balance")
40+func l () = "dApp_tokenId"
4141
4242
43-func m (j) = a(l(j))
43+func m () = g(l())
4444
4545
46-func n () = "dApp_assetId"
46+func n (o) = (("asset_" + o) + "_price")
4747
4848
49-func o () = g(n())
49+func p (o) = a(n(o))
5050
5151
52-func p () = "dApp_balance"
52+func q (o) = (("asset_" + o) + "_data")
5353
5454
55-func q () = a(p())
55+func r (o) = g(n(o))
5656
5757
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)]
8365 }
8466
8567
8668
87-@Callable(y)
88-func issueToken (C) = {
89- let D = o()
90- if ((D != f))
91- then throw("token has already been issued")
69+@Callable(s)
70+func issueNyanToken (w) = {
71+ let x = m()
72+ if ((x != f))
73+ then throw("NYAN Token already issued")
9274 else {
93- let s = Issue("NYAN-25", "NYAN-25 token", C, 0, true)
94- let E = calculateAssetId(s)
95-[s, StringEntry(n(), toBase58String(E)), IntegerEntry(p(), C)]
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)]
9678 }
9779 }
9880
9981
10082
101-@Callable(y)
102-func reissueToken (C) = {
103- let D = o()
104- if ((D == f))
105- then throw("token has not been issued")
83+@Callable(s)
84+func reissueNyanToken (w) = {
85+ let x = m()
86+ if ((x != f))
87+ then throw("NYAN Token was not issued")
10688 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)]
11091 }
11192 }
11293
11394
11495
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)]
121123 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)]
126132 }
127133 }
128134
129135
130136
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+ }
136151 }
137152
138153
139154
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))))
151157 then throw("need attach payment with NYAN-25")
152158 else {
153- let S = y.payments[0]
154-[ScriptTransfer(Address(y.caller.bytes), I, fromBase58String(E)), Burn(value(S.assetId), S.amount)]
159+ let P = s.payments[0]
160+[ScriptTransfer(Address(s.caller.bytes), C, fromBase58String(M)), Burn(value(P.assetId), P.amount)]
155161 }
156162
157163
158-@Verifier(T)
159-func U () = sigVerify(T.bodyBytes, T.proofs[0], T.senderPublicKey)
164+@Verifier(Q)
165+func R () = sigVerify(Q.bodyBytes, Q.proofs[0], Q.senderPublicKey)
160166
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func a (b) = {
55 let c = {
66 let d = getInteger(this, b)
77 if ($isInstanceOf(d, "Int"))
88 then {
99 let e = d
1010 e
1111 }
1212 else 0
1313 }
1414 c
1515 }
1616
1717
1818 let f = "none"
1919
2020 func g (b) = {
2121 let h = {
2222 let d = getString(this, b)
2323 if ($isInstanceOf(d, "String"))
2424 then {
2525 let e = d
2626 e
2727 }
2828 else f
2929 }
3030 h
3131 }
3232
3333
3434 func i (j) = (("user_" + j) + "_email")
3535
3636
3737 func k (j) = g(i(j))
3838
3939
40-func l (j) = (("user_" + j) + "_balance")
40+func l () = "dApp_tokenId"
4141
4242
43-func m (j) = a(l(j))
43+func m () = g(l())
4444
4545
46-func n () = "dApp_assetId"
46+func n (o) = (("asset_" + o) + "_price")
4747
4848
49-func o () = g(n())
49+func p (o) = a(n(o))
5050
5151
52-func p () = "dApp_balance"
52+func q (o) = (("asset_" + o) + "_data")
5353
5454
55-func q () = a(p())
55+func r (o) = g(n(o))
5656
5757
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)]
8365 }
8466
8567
8668
87-@Callable(y)
88-func issueToken (C) = {
89- let D = o()
90- if ((D != f))
91- then throw("token has already been issued")
69+@Callable(s)
70+func issueNyanToken (w) = {
71+ let x = m()
72+ if ((x != f))
73+ then throw("NYAN Token already issued")
9274 else {
93- let s = Issue("NYAN-25", "NYAN-25 token", C, 0, true)
94- let E = calculateAssetId(s)
95-[s, StringEntry(n(), toBase58String(E)), IntegerEntry(p(), C)]
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)]
9678 }
9779 }
9880
9981
10082
101-@Callable(y)
102-func reissueToken (C) = {
103- let D = o()
104- if ((D == f))
105- then throw("token has not been issued")
83+@Callable(s)
84+func reissueNyanToken (w) = {
85+ let x = m()
86+ if ((x != f))
87+ then throw("NYAN Token was not issued")
10688 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)]
11091 }
11192 }
11293
11394
11495
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)]
121123 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)]
126132 }
127133 }
128134
129135
130136
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+ }
136151 }
137152
138153
139154
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))))
151157 then throw("need attach payment with NYAN-25")
152158 else {
153- let S = y.payments[0]
154-[ScriptTransfer(Address(y.caller.bytes), I, fromBase58String(E)), Burn(value(S.assetId), S.amount)]
159+ let P = s.payments[0]
160+[ScriptTransfer(Address(s.caller.bytes), C, fromBase58String(M)), Burn(value(P.assetId), P.amount)]
155161 }
156162
157163
158-@Verifier(T)
159-func U () = sigVerify(T.bodyBytes, T.proofs[0], T.senderPublicKey)
164+@Verifier(Q)
165+func R () = sigVerify(Q.bodyBytes, Q.proofs[0], Q.senderPublicKey)
160166

github/deemru/w8io/169f3d6 
40.45 ms