tx · BtNapCdbmiw6SAccJG8dXWZoQ7DqfRSeU3XFPFFKJQya 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD: -0.01400000 Waves 2021.05.26 14:00 [1542543] smart account 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD > SELF 0.00000000 Waves
{ "type": 13, "id": "BtNapCdbmiw6SAccJG8dXWZoQ7DqfRSeU3XFPFFKJQya", "fee": 1400000, "feeAssetId": null, "timestamp": 1622026885346, "version": 2, "chainId": 84, "sender": "3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD", "senderPublicKey": "8SRjg8K8B7rhV2pih6qRgku886VQE4phwNCDjWZu1fUe", "proofs": [ "3N6SFKZj6A3qvHtiZ18R2ABXo5HjBq1KFWH5DZ66QRBBtVQhkWJYmmnfNYYXWPFHpg26RTHbct67R5YVpFWTFQSm" ], "script": "base64:AAIEAAAAAAAAACYIAhIDCgEIEgMKAQESAwoBARIECgIIARIHCgUICAEBCBIECgIIAQAAABEBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbAEAAAARZ2V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RW50cnkAAAACCQEAAAARZ2V0S2V5QXNzZXRBbW91bnQAAAABCQACWAAAAAEFAAAAB2Fzc2V0SWQFAAAACHF1YW50aXR5CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAAQZ2V0S2V5QXNzZXRQcmljZQAAAAEJAAJYAAAAAQUAAAAHYXNzZXRJZAUAAAAFcHJpY2UJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAD2dldEtleUFzc2V0RGF0YQAAAAEJAAJYAAAAAQUAAAAHYXNzZXRJZAUAAAAEZGF0YQUAAAADbmlsAAAAAWkBAAAAEmV4Y2hhbmdlQXNzZXRUb2tlbgAAAAIAAAAHYXNzZXRJZAAAAAZhbW91bnQDCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABCAUAAAABaQAAAAhwYXltZW50cwkAAAIAAAABAgAAACBuZWVkIGF0dGFjaCBwYXltZW50IHdpdGggTllBTi0yNQQAAAAHcGF5bWVudAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAHQWRkcmVzcwAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMFAAAABmFtb3VudAkAAlkAAAABBQAAAAdhc3NldElkCQAETAAAAAIJAQAAAARCdXJuAAAAAgkBAAAABXZhbHVlAAAAAQgFAAAAB3BheW1lbnQAAAAHYXNzZXRJZAgFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQ9SqpI=", "height": 1542543, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8Zj1t2KQoUSNvVDsUjojSWnwFD3cM6kGNGz5UCH7zKKz Next: 3MriaVwUnSi2R5kMbzhcEWybLfwzzCmjtWpHcWgZFHRt Diff:
Old | New | Differences | |
---|---|---|---|
138 | 138 | ||
139 | 139 | ||
140 | 140 | @Callable(y) | |
141 | - | func exchangeAssetToken (E,I) = | |
142 | - | | |
143 | - | | |
144 | - | | |
145 | - | ||
146 | - | } | |
141 | + | func exchangeAssetToken (E,I) = if (!(isDefined(y.payments))) | |
142 | + | then throw("need attach payment with NYAN-25") | |
143 | + | else { | |
144 | + | let Q = y.payments[0] | |
145 | + | [ScriptTransfer(Address(y.caller.bytes), I, fromBase58String(E)), Burn(value(Q.assetId), Q.amount)] | |
146 | + | } | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Verifier(R) |
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 | 40 | func l (j) = (("user_" + j) + "_balance") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func m (j) = a(l(j)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func n () = "dApp_assetId" | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func o () = g(n()) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func p () = "dApp_balance" | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func q () = a(p()) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func r (s) = (("asset_" + s) + "_amount") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func t (s) = a(r(s)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func u (s) = (("asset_" + s) + "_price") | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func v (s) = a(u(s)) | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func w (s) = (("asset_" + s) + "_data") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func x (s) = g(u(s)) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | @Callable(y) | |
77 | 77 | func signUp (z) = { | |
78 | 78 | let A = toBase58String(y.caller.bytes) | |
79 | 79 | let B = k(A) | |
80 | 80 | if ((B != f)) | |
81 | 81 | then throw("user is already registered") | |
82 | 82 | else [StringEntry(i(A), z), IntegerEntry(l(A), 0)] | |
83 | 83 | } | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
87 | 87 | @Callable(y) | |
88 | 88 | func issueToken (C) = { | |
89 | 89 | let D = o() | |
90 | 90 | if ((D != f)) | |
91 | 91 | then throw("token has already been issued") | |
92 | 92 | else { | |
93 | 93 | let s = Issue("NYAN-25", "NYAN-25 token", C, 0, true) | |
94 | 94 | let E = calculateAssetId(s) | |
95 | 95 | [s, StringEntry(n(), toBase58String(E)), IntegerEntry(p(), C)] | |
96 | 96 | } | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | ||
101 | 101 | @Callable(y) | |
102 | 102 | func reissueToken (C) = { | |
103 | 103 | let D = o() | |
104 | 104 | if ((D == f)) | |
105 | 105 | then throw("token has not been issued") | |
106 | 106 | else { | |
107 | 107 | let F = q() | |
108 | 108 | let G = (F + C) | |
109 | 109 | [Reissue(fromBase58String(D), C, true), IntegerEntry(p(), G)] | |
110 | 110 | } | |
111 | 111 | } | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | ||
115 | 115 | @Callable(y) | |
116 | 116 | func transferToken (H,I) = { | |
117 | 117 | let F = q() | |
118 | 118 | let J = (F - I) | |
119 | 119 | if ((0 > J)) | |
120 | 120 | then throw("not enoung balance") | |
121 | 121 | else { | |
122 | 122 | let A = toBase58String(y.caller.bytes) | |
123 | 123 | let K = m(A) | |
124 | 124 | let L = (K + I) | |
125 | 125 | [IntegerEntry(p(), J), IntegerEntry(l(H), L), ScriptTransfer(Address(fromBase58String(H)), I, fromBase58String(o()))] | |
126 | 126 | } | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
131 | 131 | @Callable(y) | |
132 | 132 | func issueAssetToken (M,N,C,O,P) = { | |
133 | 133 | let s = Issue(M, N, C, 0, true) | |
134 | 134 | let E = calculateAssetId(s) | |
135 | 135 | [s, IntegerEntry(r(toBase58String(E)), C), IntegerEntry(u(toBase58String(E)), O), StringEntry(w(toBase58String(E)), P)] | |
136 | 136 | } | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | ||
140 | 140 | @Callable(y) | |
141 | - | func exchangeAssetToken (E,I) = | |
142 | - | | |
143 | - | | |
144 | - | | |
145 | - | ||
146 | - | } | |
141 | + | func exchangeAssetToken (E,I) = if (!(isDefined(y.payments))) | |
142 | + | then throw("need attach payment with NYAN-25") | |
143 | + | else { | |
144 | + | let Q = y.payments[0] | |
145 | + | [ScriptTransfer(Address(y.caller.bytes), I, fromBase58String(E)), Burn(value(Q.assetId), Q.amount)] | |
146 | + | } | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Verifier(R) | |
150 | 150 | func S () = sigVerify(R.bodyBytes, R.proofs[0], R.senderPublicKey) | |
151 | 151 |
github/deemru/w8io/026f985 34.05 ms ◑