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:AAIEAAAAAAAAACwIAhIDCgEIEgMKAQESAwoBARIECgIIARIHCgUICAEBCBIECgIIARIECgIIAQAAAAsBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbAE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AAAAGYW1vdW50BAAAAAhwYXltZW50cwgFAAAAAWkAAAAIcGF5bWVudHMEAAAADHBheW1lbnRzU2l6ZQkAAZAAAAABBQAAAAhwYXltZW50cwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAIcGF5bWVudHMFAAAADHBheW1lbnRzU2l6ZQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXn5FhD+", "height": 1543872, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8pnJqJbszCSDrwmXrpjRCGJWByxnAnpMeqs3YvgrAP2P Next: HXTmb23AK2oMgxnBmJ3FxqPGcXfs6Q75HgaJGuCMDDLT Diff:
OldNewDifferences
147147
148148
149149 @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+ }
156155
157156
158157 @Verifier(tx)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getNumberByKey (key) = {
55 let number = match getInteger(this, key) {
66 case a: Int =>
77 a
88 case _ =>
99 0
1010 }
1111 number
1212 }
1313
1414
1515 let NONE = "none"
1616
1717 func getStringByKey (key) = {
1818 let string = match getString(this, key) {
1919 case a: String =>
2020 a
2121 case _ =>
2222 NONE
2323 }
2424 string
2525 }
2626
2727
2828 func getKeyUserEmail (user) = (("user_" + user) + "_email")
2929
3030
3131 func getValueUserEmail (user) = getStringByKey(getKeyUserEmail(user))
3232
3333
3434 func getKeyNyanToken () = "dApp_tokenId"
3535
3636
3737 func getValueNyanToken () = getStringByKey(getKeyNyanToken())
3838
3939
4040 func getKeyAssetPrice (asset) = (("asset_" + asset) + "_price")
4141
4242
4343 func getValueAssetPrice (asset) = getNumberByKey(getKeyAssetPrice(asset))
4444
4545
4646 func getKeyAssetData (asset) = (("asset_" + asset) + "_data")
4747
4848
4949 func getValueAssetData (asset) = getStringByKey(getKeyAssetPrice(asset))
5050
5151
5252 @Callable(i)
5353 func signUp (email) = {
5454 let userAddressStr = toBase58String(i.caller.bytes)
5555 let userEmailStr = getValueUserEmail(userAddressStr)
5656 if ((userEmailStr != NONE))
5757 then throw("User is already registered")
5858 else [StringEntry(getKeyUserEmail(userEmailStr), email)]
5959 }
6060
6161
6262
6363 @Callable(i)
6464 func issueNyanToken (quantity) = {
6565 let nyanTokenStr = getValueNyanToken()
6666 if ((nyanTokenStr != NONE))
6767 then throw("NYAN Token already issued")
6868 else {
6969 let nyanTokenIssue = Issue("NYAN Token", "NYAN Token is a cryptocurrency token that operates on the Waves platform", quantity, 0, true)
7070 let nyanTokenAssetIdStr = toBase58String(calculateAssetId(nyanTokenIssue))
7171 [nyanTokenIssue, StringEntry(getKeyNyanToken(), nyanTokenAssetIdStr)]
7272 }
7373 }
7474
7575
7676
7777 @Callable(i)
7878 func reissueNyanToken (quantity) = {
7979 let nyanTokenStr = getValueNyanToken()
8080 if ((nyanTokenStr != NONE))
8181 then throw("NYAN Token was not issued")
8282 else {
8383 let nyanToken = fromBase58String(nyanTokenStr)
8484 [Reissue(nyanToken, quantity, true)]
8585 }
8686 }
8787
8888
8989
9090 @Callable(i)
9191 func transferNyanToken (recipient,amount) = {
9292 let userEmailStr = getValueUserEmail(recipient)
9393 let nyanTokenStr = getValueNyanToken()
9494 let nyanToken = fromBase58String(nyanTokenStr)
9595 let currentDAppBalance = assetBalance(this, nyanToken)
9696 let newDAppBalance = (currentDAppBalance - amount)
9797 if ((userEmailStr == NONE))
9898 then throw("You cannot transfer NYAN Token to a user who is not registered")
9999 else if ((0 > amount))
100100 then throw("It is impossible to transfer a negative amount")
101101 else if ((0 > newDAppBalance))
102102 then throw("Not enough NYAN Tokens to transfer")
103103 else {
104104 let recipientAddress = Address(fromBase58String(recipient))
105105 [ScriptTransfer(recipientAddress, amount, nyanToken)]
106106 }
107107 }
108108
109109
110110
111111 @Callable(i)
112112 func issueAssetToken (name,description,quantity,price,data) = {
113113 let assetTokenIssue = Issue(name, description, quantity, 0, true)
114114 let assetTokenAssetIdStr = toBase58String(calculateAssetId(assetTokenIssue))
115115 if ((quantity == 0))
116116 then [assetTokenIssue, IntegerEntry(getKeyAssetPrice(assetTokenAssetIdStr), price), StringEntry(getKeyAssetData(assetTokenAssetIdStr), data)]
117117 else {
118118 let nyanTokenStr = getValueNyanToken()
119119 let nyanToken = fromBase58String(nyanTokenStr)
120120 let currentDAppBalance = assetBalance(this, nyanToken)
121121 let amount = (quantity * price)
122122 let newDAppBalance = (currentDAppBalance - amount)
123123 if ((0 > newDAppBalance))
124124 then throw("Not enough NYAN Tokens to issue an asset")
125125 else [assetTokenIssue, Burn(nyanToken, amount), IntegerEntry(getKeyAssetPrice(assetTokenAssetIdStr), price), StringEntry(getKeyAssetData(assetTokenAssetIdStr), data)]
126126 }
127127 }
128128
129129
130130
131131 @Callable(i)
132132 func reissueAssetToken (assetId,quantity) = {
133133 let nyanTokenStr = getValueNyanToken()
134134 let nyanToken = fromBase58String(nyanTokenStr)
135135 let currentDAppBalance = assetBalance(this, nyanToken)
136136 let assetPrice = getValueAssetPrice(assetId)
137137 let amount = (quantity * assetPrice)
138138 let newDAppBalance = (currentDAppBalance - amount)
139139 if ((0 > newDAppBalance))
140140 then throw("Not enough NYAN Tokens to reissue an asset")
141141 else {
142142 let assetTokenAssetId = fromBase58String(assetId)
143143 [Reissue(assetTokenAssetId, quantity, true), Burn(nyanToken, amount)]
144144 }
145145 }
146146
147147
148148
149149 @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+ }
156155
157156
158157 @Verifier(tx)
159158 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
160159

github/deemru/w8io/169f3d6 
44.25 ms