tx · 2MmQnuJ4vcAVfvNn2FmshC9YYDp43QHc21LTJBZCHXhu 3N55QHceL4hgf9MUfJqSbtRppEgGu25MQv7: -0.01400000 Waves 2021.05.25 16:02 [1541219] smart account 3N55QHceL4hgf9MUfJqSbtRppEgGu25MQv7 > SELF 0.00000000 Waves
{ "type": 13, "id": "2MmQnuJ4vcAVfvNn2FmshC9YYDp43QHc21LTJBZCHXhu", "fee": 1400000, "feeAssetId": null, "timestamp": 1621947741656, "version": 2, "chainId": 84, "sender": "3N55QHceL4hgf9MUfJqSbtRppEgGu25MQv7", "senderPublicKey": "4rc8Aajc7YNqQXTNrzVvsTiZKzZwzKWZ4JXr4N34wxTJ", "proofs": [ "4cGLcQFkwoKCN1K2DhaDDMy1j4P95pnuSEmQKvXJypXLLdFvN2CCv4dqhmCyvZfhEaJZX51Tdc6rzHUfptr7cCZ7" ], "script": "base64:AAIEAAAAAAAAABcIAhIDCgEIEgMKAQESAwoBARIECgIIAQAAAAsBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbAEAAAARZ2V0VmFsdWVVc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l0eQkABEwAAAACCQEAAAAHUmVpc3N1ZQAAAAMJAAJZAAAAAQUAAAALZEFwcEFzc2V0SWQFAAAACHF1YW50aXR5BgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAEWdldEtleURBcHBCYWxhbmNlAAAAAAUAAAAKbmV3QmFsYW5jZQUAAAADbmlsAAAAAWkBAAAADXRyYW5zZmVyVG9rZW4AAAACAAAACXJlY2lwaWVudAAAAAZhbW91bnQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5ZNEOiA==", "height": 1541219, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getNumberByKey (key) = { | |
5 | + | let number = match getInteger(this, key) { | |
6 | + | case a: Int => | |
7 | + | a | |
8 | + | case _ => | |
9 | + | 0 | |
10 | + | } | |
11 | + | number | |
12 | + | } | |
13 | + | ||
14 | + | ||
15 | + | let NONE = "none" | |
16 | + | ||
17 | + | func getStringByKey (key) = { | |
18 | + | let string = match getString(this, key) { | |
19 | + | case a: String => | |
20 | + | a | |
21 | + | case _ => | |
22 | + | NONE | |
23 | + | } | |
24 | + | string | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func getKeyUserEmail (user) = (("user_" + user) + "_email") | |
29 | + | ||
30 | + | ||
31 | + | func getValueUserEmail (user) = getStringByKey(getKeyUserEmail(user)) | |
32 | + | ||
33 | + | ||
34 | + | func getKeyUserBalance (user) = (("user_" + user) + "_balance") | |
35 | + | ||
36 | + | ||
37 | + | func getValueUserBalance (user) = getNumberByKey(getKeyUserBalance(user)) | |
38 | + | ||
39 | + | ||
40 | + | func getKeyDAppAssetId () = "dApp_assetId" | |
41 | + | ||
42 | + | ||
43 | + | func getValueDAppAssetId () = getStringByKey(getKeyDAppAssetId()) | |
44 | + | ||
45 | + | ||
46 | + | func getKeyDAppBalance () = "dApp_balance" | |
47 | + | ||
48 | + | ||
49 | + | func getValueDAppAmount () = getNumberByKey(getKeyDAppBalance()) | |
50 | + | ||
51 | + | ||
52 | + | @Callable(i) | |
53 | + | func signUp (email) = { | |
54 | + | let currentUserAddress = toBase58String(i.caller.bytes) | |
55 | + | let currentUserEmail = getValueUserEmail(currentUserAddress) | |
56 | + | if ((currentUserEmail != NONE)) | |
57 | + | then throw("user is already registered") | |
58 | + | else [StringEntry(getKeyUserEmail(currentUserAddress), email), IntegerEntry(getKeyUserBalance(currentUserAddress), 0)] | |
59 | + | } | |
60 | + | ||
61 | + | ||
62 | + | ||
63 | + | @Callable(i) | |
64 | + | func issueToken (quantity) = { | |
65 | + | let dAppAssetId = getValueDAppAssetId() | |
66 | + | if ((dAppAssetId != NONE)) | |
67 | + | then throw("token has already been issued") | |
68 | + | else { | |
69 | + | let asset = Issue("NYAN-25", "NYAN-25 token", quantity, 0, true) | |
70 | + | let assetId = calculateAssetId(asset) | |
71 | + | [asset, StringEntry(getKeyDAppAssetId(), toBase58String(assetId)), IntegerEntry(getKeyDAppBalance(), quantity)] | |
72 | + | } | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(i) | |
78 | + | func reissueToken (quantity) = { | |
79 | + | let dAppAssetId = getValueDAppAssetId() | |
80 | + | if ((dAppAssetId == NONE)) | |
81 | + | then throw("token has not been issued") | |
82 | + | else { | |
83 | + | let currentBalance = getValueDAppAmount() | |
84 | + | let newBalance = (currentBalance + quantity) | |
85 | + | [Reissue(fromBase58String(dAppAssetId), quantity, true), IntegerEntry(getKeyDAppBalance(), newBalance)] | |
86 | + | } | |
87 | + | } | |
88 | + | ||
89 | + | ||
90 | + | ||
91 | + | @Callable(i) | |
92 | + | func transferToken (recipient,amount) = nil | |
93 | + | ||
94 | + | ||
95 | + | @Verifier(tx) | |
96 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
97 | + |
github/deemru/w8io/026f985 15.49 ms ◑