tx · G65XF1r2QV6hbrSmMNaGThHX95ar6fBuwSbSEjiM17DW
3MuBakQdFAobmsHH371bKVYNed6yA9Y2Wfy: -0.01400000 Waves
2021.05.25 15:52 [1541212] smart account 3MuBakQdFAobmsHH371bKVYNed6yA9Y2Wfy > SELF 0.00000000 Waves
{
"type": 13,
"id": "G65XF1r2QV6hbrSmMNaGThHX95ar6fBuwSbSEjiM17DW",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1621947192737,
"version": 2,
"chainId": 84,
"sender": "3MuBakQdFAobmsHH371bKVYNed6yA9Y2Wfy",
"senderPublicKey": "9BAE85H9Tsey8NGdpT5HxdVYHBCmY1prGiG1TSQJxnZe",
"proofs": [
"61VhKaQs5ama9eub6ZguBwUMYBBqdc2wCx83AFmzCMw4R78TegeynifWFvxmxjF3c62phqbeBD9SQuwNnhnr8K8U"
],
"script": "base64:AAIEAAAAAAAAABcIAhIDCgEIEgMKAQESAwoBARIECgIIAQAAAAsBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbAEAAAARZ2V0VmFsdWVVc2VyR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cEJhbGFuY2UAAAAABQAAAAhxdWFudGl0eQUAAAADbmlsAAAAAWkBAAAADXRyYW5zZmVyVG9rZW4AAAACAAAACXJlY2lwaWVudAAAAAZhbW91bnQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5M+0zDQ==",
"height": 1541212,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 2haiFjzhL9m2D1FczgfTZssMfnSkqeUsu18v6sURC1jC
Next: GkugvFiuFa4mRTGcSj3TdPZ4oVe4MKa2gQfpYJr2uZ8f
Diff:
Old | New | | Differences |
---|
31 | 31 | | func getValueUserEmail (user) = getStringByKey(getKeyUserEmail(user)) |
---|
32 | 32 | | |
---|
33 | 33 | | |
---|
| 34 | + | func getKeyUserBalance (user) = (("user_" + user) + "balance") |
---|
| 35 | + | |
---|
| 36 | + | |
---|
| 37 | + | func getValueUserBalance (user) = getNumberByKey(getKeyUserBalance(user)) |
---|
| 38 | + | |
---|
| 39 | + | |
---|
34 | 40 | | func getKeyDAppAssetId () = "dApp_assetId" |
---|
35 | 41 | | |
---|
36 | 42 | | |
---|
37 | 43 | | func getValueDAppAssetId () = getStringByKey(getKeyDAppAssetId()) |
---|
| 44 | + | |
---|
| 45 | + | |
---|
| 46 | + | func getKeyDAppBalance () = "dApp_assetId" |
---|
| 47 | + | |
---|
| 48 | + | |
---|
| 49 | + | func getValueDAppAmount () = getStringByKey(getKeyDAppBalance()) |
---|
38 | 50 | | |
---|
39 | 51 | | |
---|
40 | 52 | | @Callable(i) |
---|
|
43 | 55 | | let currentUserEmail = getValueUserEmail(currentUserAddress) |
---|
44 | 56 | | if ((currentUserEmail != NONE)) |
---|
45 | 57 | | then throw("user is already registered") |
---|
46 | | - | else [StringEntry(getKeyUserEmail(currentUserAddress), email)] |
---|
| 58 | + | else [StringEntry(getKeyUserEmail(currentUserAddress), email), IntegerEntry(getKeyUserBalance(currentUserAddress), 0)] |
---|
47 | 59 | | } |
---|
48 | 60 | | |
---|
49 | 61 | | |
---|
|
56 | 68 | | else { |
---|
57 | 69 | | let asset = Issue("NYAN-25", "NYAN-25 token", quantity, 0, true) |
---|
58 | 70 | | let assetId = calculateAssetId(asset) |
---|
59 | | - | [asset, StringEntry(getKeyDAppAssetId(), toBase58String(assetId))] |
---|
| 71 | + | [asset, StringEntry(getKeyDAppAssetId(), toBase58String(assetId)), IntegerEntry(getKeyDAppBalance(), quantity)] |
---|
60 | 72 | | } |
---|
61 | 73 | | } |
---|
62 | 74 | | |
---|
|
67 | 79 | | let dAppAssetId = getValueDAppAssetId() |
---|
68 | 80 | | if ((dAppAssetId == NONE)) |
---|
69 | 81 | | then throw("token has not been issued") |
---|
70 | | - | else [Reissue(fromBase58String(dAppAssetId), quantity, true)] |
---|
| 82 | + | else [Reissue(fromBase58String(dAppAssetId), quantity, true), IntegerEntry(getKeyDAppBalance(), quantity)] |
---|
71 | 83 | | } |
---|
| 84 | + | |
---|
| 85 | + | |
---|
| 86 | + | |
---|
| 87 | + | @Callable(i) |
---|
| 88 | + | func transferToken (recipient,amount) = nil |
---|
72 | 89 | | |
---|
73 | 90 | | |
---|
74 | 91 | | @Verifier(tx) |
---|
Full:
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 | + | func getKeyUserBalance (user) = (("user_" + user) + "balance") |
---|
| 35 | + | |
---|
| 36 | + | |
---|
| 37 | + | func getValueUserBalance (user) = getNumberByKey(getKeyUserBalance(user)) |
---|
| 38 | + | |
---|
| 39 | + | |
---|
34 | 40 | | func getKeyDAppAssetId () = "dApp_assetId" |
---|
35 | 41 | | |
---|
36 | 42 | | |
---|
37 | 43 | | func getValueDAppAssetId () = getStringByKey(getKeyDAppAssetId()) |
---|
| 44 | + | |
---|
| 45 | + | |
---|
| 46 | + | func getKeyDAppBalance () = "dApp_assetId" |
---|
| 47 | + | |
---|
| 48 | + | |
---|
| 49 | + | func getValueDAppAmount () = getStringByKey(getKeyDAppBalance()) |
---|
38 | 50 | | |
---|
39 | 51 | | |
---|
40 | 52 | | @Callable(i) |
---|
41 | 53 | | func signUp (email) = { |
---|
42 | 54 | | let currentUserAddress = toBase58String(i.caller.bytes) |
---|
43 | 55 | | let currentUserEmail = getValueUserEmail(currentUserAddress) |
---|
44 | 56 | | if ((currentUserEmail != NONE)) |
---|
45 | 57 | | then throw("user is already registered") |
---|
46 | | - | else [StringEntry(getKeyUserEmail(currentUserAddress), email)] |
---|
| 58 | + | else [StringEntry(getKeyUserEmail(currentUserAddress), email), IntegerEntry(getKeyUserBalance(currentUserAddress), 0)] |
---|
47 | 59 | | } |
---|
48 | 60 | | |
---|
49 | 61 | | |
---|
50 | 62 | | |
---|
51 | 63 | | @Callable(i) |
---|
52 | 64 | | func issueToken (quantity) = { |
---|
53 | 65 | | let dAppAssetId = getValueDAppAssetId() |
---|
54 | 66 | | if ((dAppAssetId != NONE)) |
---|
55 | 67 | | then throw("token has already been issued") |
---|
56 | 68 | | else { |
---|
57 | 69 | | let asset = Issue("NYAN-25", "NYAN-25 token", quantity, 0, true) |
---|
58 | 70 | | let assetId = calculateAssetId(asset) |
---|
59 | | - | [asset, StringEntry(getKeyDAppAssetId(), toBase58String(assetId))] |
---|
| 71 | + | [asset, StringEntry(getKeyDAppAssetId(), toBase58String(assetId)), IntegerEntry(getKeyDAppBalance(), quantity)] |
---|
60 | 72 | | } |
---|
61 | 73 | | } |
---|
62 | 74 | | |
---|
63 | 75 | | |
---|
64 | 76 | | |
---|
65 | 77 | | @Callable(i) |
---|
66 | 78 | | func reissueToken (quantity) = { |
---|
67 | 79 | | let dAppAssetId = getValueDAppAssetId() |
---|
68 | 80 | | if ((dAppAssetId == NONE)) |
---|
69 | 81 | | then throw("token has not been issued") |
---|
70 | | - | else [Reissue(fromBase58String(dAppAssetId), quantity, true)] |
---|
| 82 | + | else [Reissue(fromBase58String(dAppAssetId), quantity, true), IntegerEntry(getKeyDAppBalance(), quantity)] |
---|
71 | 83 | | } |
---|
| 84 | + | |
---|
| 85 | + | |
---|
| 86 | + | |
---|
| 87 | + | @Callable(i) |
---|
| 88 | + | func transferToken (recipient,amount) = nil |
---|
72 | 89 | | |
---|
73 | 90 | | |
---|
74 | 91 | | @Verifier(tx) |
---|
75 | 92 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
76 | 93 | | |
---|