tx · 9MHM6rYEE4J74pRrDBiYcp4fEN4MEhZ3Wv37UwLTVXH1 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD: -0.01400000 Waves 2021.05.27 12:16 [1543872] smart account 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD > SELF 0.00000000 Waves
{ "type": 13, "id": "9MHM6rYEE4J74pRrDBiYcp4fEN4MEhZ3Wv37UwLTVXH1", "fee": 1400000, "feeAssetId": null, "timestamp": 1622107021321, "version": 2, "chainId": 84, "sender": "3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD", "senderPublicKey": "8SRjg8K8B7rhV2pih6qRgku886VQE4phwNCDjWZu1fUe", "proofs": [ "2LgSN4mxGDZiVHyhKVScsAcLfRTPnNp9pobVVQBG91fr4rxd3oMrxmdUwrs86D8H69vzPtBeAbChW2man8jwb7v2" ], "script": "base64:AAIEAAAAAAAAACwIAhIDCgEIEgMKAQESAwoBARIECgIIARIHCgUICAEBCBIECgIIARIECgIIAQAAAAsBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbAEA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AAAGYW1vdW50BAAAAAhwYXltZW50cwgFAAAAAWkAAAAIcGF5bWVudHMEAAAADHBheW1lbnRzU2l6ZQkAAZAAAAABBQAAAAhwYXltZW50cwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAIcGF5bWVudHMFAAAADHBheW1lbnRzU2l6ZQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXn5FhD+", "height": 1543872, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8pnJqJbszCSDrwmXrpjRCGJWByxnAnpMeqs3YvgrAP2P Next: HXTmb23AK2oMgxnBmJ3FxqPGcXfs6Q75HgaJGuCMDDLT Diff:
Old | New | Differences | |
---|---|---|---|
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Callable(i) | |
150 | - | func exchangeAssetToken (assetId,amount) = if (!(isDefined(value(i.payments)))) | |
151 | - | then throw("need attach payment with NYAN-25") | |
152 | - | else { | |
153 | - | let payment = i.payments[0] | |
154 | - | [ScriptTransfer(Address(i.caller.bytes), amount, fromBase58String(assetId)), Burn(value(payment.assetId), payment.amount)] | |
155 | - | } | |
150 | + | func exchangeAssetToken (assetId,amount) = { | |
151 | + | let payments = i.payments | |
152 | + | let paymentsSize = size(payments) | |
153 | + | [IntegerEntry("payments", paymentsSize)] | |
154 | + | } | |
156 | 155 | ||
157 | 156 | ||
158 | 157 | @Verifier(tx) |
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 getKeyNyanToken () = "dApp_tokenId" | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func getValueNyanToken () = getStringByKey(getKeyNyanToken()) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getKeyAssetPrice (asset) = (("asset_" + asset) + "_price") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getValueAssetPrice (asset) = getNumberByKey(getKeyAssetPrice(asset)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getKeyAssetData (asset) = (("asset_" + asset) + "_data") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueAssetData (asset) = getStringByKey(getKeyAssetPrice(asset)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | @Callable(i) | |
53 | 53 | func signUp (email) = { | |
54 | 54 | let userAddressStr = toBase58String(i.caller.bytes) | |
55 | 55 | let userEmailStr = getValueUserEmail(userAddressStr) | |
56 | 56 | if ((userEmailStr != NONE)) | |
57 | 57 | then throw("User is already registered") | |
58 | 58 | else [StringEntry(getKeyUserEmail(userEmailStr), email)] | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | ||
63 | 63 | @Callable(i) | |
64 | 64 | func issueNyanToken (quantity) = { | |
65 | 65 | let nyanTokenStr = getValueNyanToken() | |
66 | 66 | if ((nyanTokenStr != NONE)) | |
67 | 67 | then throw("NYAN Token already issued") | |
68 | 68 | else { | |
69 | 69 | let nyanTokenIssue = Issue("NYAN Token", "NYAN Token is a cryptocurrency token that operates on the Waves platform", quantity, 0, true) | |
70 | 70 | let nyanTokenAssetIdStr = toBase58String(calculateAssetId(nyanTokenIssue)) | |
71 | 71 | [nyanTokenIssue, StringEntry(getKeyNyanToken(), nyanTokenAssetIdStr)] | |
72 | 72 | } | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | 77 | @Callable(i) | |
78 | 78 | func reissueNyanToken (quantity) = { | |
79 | 79 | let nyanTokenStr = getValueNyanToken() | |
80 | 80 | if ((nyanTokenStr != NONE)) | |
81 | 81 | then throw("NYAN Token was not issued") | |
82 | 82 | else { | |
83 | 83 | let nyanToken = fromBase58String(nyanTokenStr) | |
84 | 84 | [Reissue(nyanToken, quantity, true)] | |
85 | 85 | } | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(i) | |
91 | 91 | func transferNyanToken (recipient,amount) = { | |
92 | 92 | let userEmailStr = getValueUserEmail(recipient) | |
93 | 93 | let nyanTokenStr = getValueNyanToken() | |
94 | 94 | let nyanToken = fromBase58String(nyanTokenStr) | |
95 | 95 | let currentDAppBalance = assetBalance(this, nyanToken) | |
96 | 96 | let newDAppBalance = (currentDAppBalance - amount) | |
97 | 97 | if ((userEmailStr == NONE)) | |
98 | 98 | then throw("You cannot transfer NYAN Token to a user who is not registered") | |
99 | 99 | else if ((0 > amount)) | |
100 | 100 | then throw("It is impossible to transfer a negative amount") | |
101 | 101 | else if ((0 > newDAppBalance)) | |
102 | 102 | then throw("Not enough NYAN Tokens to transfer") | |
103 | 103 | else { | |
104 | 104 | let recipientAddress = Address(fromBase58String(recipient)) | |
105 | 105 | [ScriptTransfer(recipientAddress, amount, nyanToken)] | |
106 | 106 | } | |
107 | 107 | } | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | 111 | @Callable(i) | |
112 | 112 | func issueAssetToken (name,description,quantity,price,data) = { | |
113 | 113 | let assetTokenIssue = Issue(name, description, quantity, 0, true) | |
114 | 114 | let assetTokenAssetIdStr = toBase58String(calculateAssetId(assetTokenIssue)) | |
115 | 115 | if ((quantity == 0)) | |
116 | 116 | then [assetTokenIssue, IntegerEntry(getKeyAssetPrice(assetTokenAssetIdStr), price), StringEntry(getKeyAssetData(assetTokenAssetIdStr), data)] | |
117 | 117 | else { | |
118 | 118 | let nyanTokenStr = getValueNyanToken() | |
119 | 119 | let nyanToken = fromBase58String(nyanTokenStr) | |
120 | 120 | let currentDAppBalance = assetBalance(this, nyanToken) | |
121 | 121 | let amount = (quantity * price) | |
122 | 122 | let newDAppBalance = (currentDAppBalance - amount) | |
123 | 123 | if ((0 > newDAppBalance)) | |
124 | 124 | then throw("Not enough NYAN Tokens to issue an asset") | |
125 | 125 | else [assetTokenIssue, Burn(nyanToken, amount), IntegerEntry(getKeyAssetPrice(assetTokenAssetIdStr), price), StringEntry(getKeyAssetData(assetTokenAssetIdStr), data)] | |
126 | 126 | } | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
131 | 131 | @Callable(i) | |
132 | 132 | func reissueAssetToken (assetId,quantity) = { | |
133 | 133 | let nyanTokenStr = getValueNyanToken() | |
134 | 134 | let nyanToken = fromBase58String(nyanTokenStr) | |
135 | 135 | let currentDAppBalance = assetBalance(this, nyanToken) | |
136 | 136 | let assetPrice = getValueAssetPrice(assetId) | |
137 | 137 | let amount = (quantity * assetPrice) | |
138 | 138 | let newDAppBalance = (currentDAppBalance - amount) | |
139 | 139 | if ((0 > newDAppBalance)) | |
140 | 140 | then throw("Not enough NYAN Tokens to reissue an asset") | |
141 | 141 | else { | |
142 | 142 | let assetTokenAssetId = fromBase58String(assetId) | |
143 | 143 | [Reissue(assetTokenAssetId, quantity, true), Burn(nyanToken, amount)] | |
144 | 144 | } | |
145 | 145 | } | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Callable(i) | |
150 | - | func exchangeAssetToken (assetId,amount) = if (!(isDefined(value(i.payments)))) | |
151 | - | then throw("need attach payment with NYAN-25") | |
152 | - | else { | |
153 | - | let payment = i.payments[0] | |
154 | - | [ScriptTransfer(Address(i.caller.bytes), amount, fromBase58String(assetId)), Burn(value(payment.assetId), payment.amount)] | |
155 | - | } | |
150 | + | func exchangeAssetToken (assetId,amount) = { | |
151 | + | let payments = i.payments | |
152 | + | let paymentsSize = size(payments) | |
153 | + | [IntegerEntry("payments", paymentsSize)] | |
154 | + | } | |
156 | 155 | ||
157 | 156 | ||
158 | 157 | @Verifier(tx) | |
159 | 158 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
160 | 159 |
github/deemru/w8io/169f3d6 44.25 ms ◑