tx · 694TW1NM2jaP8bZyiDyPmYTWfRk6UsAiPwBmoUDTmog9 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD: -0.01400000 Waves 2021.05.25 17:20 [1541296] smart account 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD > SELF 0.00000000 Waves
{ "type": 13, "id": "694TW1NM2jaP8bZyiDyPmYTWfRk6UsAiPwBmoUDTmog9", "fee": 1400000, "feeAssetId": null, "timestamp": 1621952454457, "version": 2, "chainId": 84, "sender": "3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD", "senderPublicKey": "8SRjg8K8B7rhV2pih6qRgku886VQE4phwNCDjWZu1fUe", "proofs": [ "2ZLhMwLp9zSgGSt6rdtSHh8P66fFY8fRRxJ6iQ7xV2cvRDGEHBfZSsMj1dzYbaZK2goJZtmcqmYLMCfaZMtVgQTm" ], "script": "base64:AAIEAAAAAAAAACAIAhIDCgEIEgMKAQESAwoBARIECgIIARIHCgUICAEBCAAAABEBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbAEAAAARZ2V0VmF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udHJ5AAAAAgkBAAAAEGdldEtleUFzc2V0VGl0bGUAAAABCQACWAAAAAEFAAAAB2Fzc2V0SWQFAAAABG5hbWUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAABBnZXRLZXlBc3NldFByaWNlAAAAAQkAAlgAAAABBQAAAAdhc3NldElkBQAAAAVwcmljZQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAAPZ2V0S2V5QXNzZXREYXRhAAAAAQkAAlgAAAABBQAAAAdhc3NldElkBQAAAARkYXRhBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleZCWTZk=", "height": 1541296, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B5c544PjbspR9bwo7H1vhwSNVF1aCZAu465UUZthV4XU Next: EfuQpcbfFVtHihDajF44cspjSSdrpkjw5S6RcmgFkPMX Diff:
Old | New | Differences | |
---|---|---|---|
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueDAppBalance () = getNumberByKey(getKeyDAppBalance()) | |
50 | + | ||
51 | + | ||
52 | + | func getKeyAssetTitle (asset) = (("asset_" + asset) + "_title") | |
53 | + | ||
54 | + | ||
55 | + | func getValueAssetTitle (asset) = getStringByKey(getKeyAssetTitle(asset)) | |
56 | + | ||
57 | + | ||
58 | + | func getKeyAssetPrice (asset) = (("asset_" + asset) + "_price") | |
59 | + | ||
60 | + | ||
61 | + | func getValueAssetPrice (asset) = getNumberByKey(getKeyAssetPrice(asset)) | |
62 | + | ||
63 | + | ||
64 | + | func getKeyAssetData (asset) = (("asset_" + asset) + "_data") | |
65 | + | ||
66 | + | ||
67 | + | func getValueAssetData (asset) = getStringByKey(getKeyAssetPrice(asset)) | |
50 | 68 | ||
51 | 69 | ||
52 | 70 | @Callable(i) | |
103 | 121 | } | |
104 | 122 | ||
105 | 123 | ||
124 | + | ||
125 | + | @Callable(i) | |
126 | + | func issueAssetToken (name,description,quantity,price,data) = { | |
127 | + | let asset = Issue(name, description, quantity, 0, true) | |
128 | + | let assetId = calculateAssetId(asset) | |
129 | + | [asset, StringEntry(getKeyAssetTitle(toBase58String(assetId)), name), IntegerEntry(getKeyAssetPrice(toBase58String(assetId)), price), StringEntry(getKeyAssetData(toBase58String(assetId)), data)] | |
130 | + | } | |
131 | + | ||
132 | + | ||
106 | 133 | @Verifier(tx) | |
107 | 134 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
108 | 135 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByKey (key) = { | |
5 | 5 | let number = match getInteger(this, key) { | |
6 | 6 | case a: Int => | |
7 | 7 | a | |
8 | 8 | case _ => | |
9 | 9 | 0 | |
10 | 10 | } | |
11 | 11 | number | |
12 | 12 | } | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | let NONE = "none" | |
16 | 16 | ||
17 | 17 | func getStringByKey (key) = { | |
18 | 18 | let string = match getString(this, key) { | |
19 | 19 | case a: String => | |
20 | 20 | a | |
21 | 21 | case _ => | |
22 | 22 | NONE | |
23 | 23 | } | |
24 | 24 | string | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getKeyUserEmail (user) = (("user_" + user) + "_email") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func getValueUserEmail (user) = getStringByKey(getKeyUserEmail(user)) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getKeyUserBalance (user) = (("user_" + user) + "_balance") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func getValueUserBalance (user) = getNumberByKey(getKeyUserBalance(user)) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getKeyDAppAssetId () = "dApp_assetId" | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getValueDAppAssetId () = getStringByKey(getKeyDAppAssetId()) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getKeyDAppBalance () = "dApp_balance" | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueDAppBalance () = getNumberByKey(getKeyDAppBalance()) | |
50 | + | ||
51 | + | ||
52 | + | func getKeyAssetTitle (asset) = (("asset_" + asset) + "_title") | |
53 | + | ||
54 | + | ||
55 | + | func getValueAssetTitle (asset) = getStringByKey(getKeyAssetTitle(asset)) | |
56 | + | ||
57 | + | ||
58 | + | func getKeyAssetPrice (asset) = (("asset_" + asset) + "_price") | |
59 | + | ||
60 | + | ||
61 | + | func getValueAssetPrice (asset) = getNumberByKey(getKeyAssetPrice(asset)) | |
62 | + | ||
63 | + | ||
64 | + | func getKeyAssetData (asset) = (("asset_" + asset) + "_data") | |
65 | + | ||
66 | + | ||
67 | + | func getValueAssetData (asset) = getStringByKey(getKeyAssetPrice(asset)) | |
50 | 68 | ||
51 | 69 | ||
52 | 70 | @Callable(i) | |
53 | 71 | func signUp (email) = { | |
54 | 72 | let currentUserAddress = toBase58String(i.caller.bytes) | |
55 | 73 | let currentUserEmail = getValueUserEmail(currentUserAddress) | |
56 | 74 | if ((currentUserEmail != NONE)) | |
57 | 75 | then throw("user is already registered") | |
58 | 76 | else [StringEntry(getKeyUserEmail(currentUserAddress), email), IntegerEntry(getKeyUserBalance(currentUserAddress), 0)] | |
59 | 77 | } | |
60 | 78 | ||
61 | 79 | ||
62 | 80 | ||
63 | 81 | @Callable(i) | |
64 | 82 | func issueToken (quantity) = { | |
65 | 83 | let dAppAssetId = getValueDAppAssetId() | |
66 | 84 | if ((dAppAssetId != NONE)) | |
67 | 85 | then throw("token has already been issued") | |
68 | 86 | else { | |
69 | 87 | let asset = Issue("NYAN-25", "NYAN-25 token", quantity, 0, true) | |
70 | 88 | let assetId = calculateAssetId(asset) | |
71 | 89 | [asset, StringEntry(getKeyDAppAssetId(), toBase58String(assetId)), IntegerEntry(getKeyDAppBalance(), quantity)] | |
72 | 90 | } | |
73 | 91 | } | |
74 | 92 | ||
75 | 93 | ||
76 | 94 | ||
77 | 95 | @Callable(i) | |
78 | 96 | func reissueToken (quantity) = { | |
79 | 97 | let dAppAssetId = getValueDAppAssetId() | |
80 | 98 | if ((dAppAssetId == NONE)) | |
81 | 99 | then throw("token has not been issued") | |
82 | 100 | else { | |
83 | 101 | let currentDAppBalance = getValueDAppBalance() | |
84 | 102 | let newBalance = (currentDAppBalance + quantity) | |
85 | 103 | [Reissue(fromBase58String(dAppAssetId), quantity, true), IntegerEntry(getKeyDAppBalance(), newBalance)] | |
86 | 104 | } | |
87 | 105 | } | |
88 | 106 | ||
89 | 107 | ||
90 | 108 | ||
91 | 109 | @Callable(i) | |
92 | 110 | func transferToken (recipient,amount) = { | |
93 | 111 | let currentDAppBalance = getValueDAppBalance() | |
94 | 112 | let newDAppBalance = (currentDAppBalance - amount) | |
95 | 113 | if ((0 > newDAppBalance)) | |
96 | 114 | then throw("not enoung balance") | |
97 | 115 | else { | |
98 | 116 | let currentUserAddress = toBase58String(i.caller.bytes) | |
99 | 117 | let currentUserBalance = getValueUserBalance(currentUserAddress) | |
100 | 118 | let newUserBalance = (currentUserBalance + amount) | |
101 | 119 | [IntegerEntry(getKeyDAppBalance(), newDAppBalance), IntegerEntry(getKeyUserBalance(recipient), newUserBalance), ScriptTransfer(Address(fromBase58String(recipient)), amount, fromBase58String(getValueDAppAssetId()))] | |
102 | 120 | } | |
103 | 121 | } | |
104 | 122 | ||
105 | 123 | ||
124 | + | ||
125 | + | @Callable(i) | |
126 | + | func issueAssetToken (name,description,quantity,price,data) = { | |
127 | + | let asset = Issue(name, description, quantity, 0, true) | |
128 | + | let assetId = calculateAssetId(asset) | |
129 | + | [asset, StringEntry(getKeyAssetTitle(toBase58String(assetId)), name), IntegerEntry(getKeyAssetPrice(toBase58String(assetId)), price), StringEntry(getKeyAssetData(toBase58String(assetId)), data)] | |
130 | + | } | |
131 | + | ||
132 | + | ||
106 | 133 | @Verifier(tx) | |
107 | 134 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
108 | 135 |
github/deemru/w8io/169f3d6 82.23 ms ◑