tx · 8Zj1t2KQoUSNvVDsUjojSWnwFD3cM6kGNGz5UCH7zKKz

3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD:  -0.01400000 Waves

2021.05.26 13:59 [1542542] smart account 3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD > SELF 0.00000000 Waves

{ "type": 13, "id": "8Zj1t2KQoUSNvVDsUjojSWnwFD3cM6kGNGz5UCH7zKKz", "fee": 1400000, "feeAssetId": null, "timestamp": 1622026790066, "version": 2, "chainId": 84, "sender": "3MtoBpCc3s2T4CxasJ5MXrZZsU339D28mvD", "senderPublicKey": "8SRjg8K8B7rhV2pih6qRgku886VQE4phwNCDjWZu1fUe", "proofs": [ "2bYxdL9c82EoQcRGFKZfqrrZU3NyFzjqe7EAqL6dY1tAzwqJNGEKhXkBhWyFecmQqPQCXeHgy9XfewSSEKqCrnnq" ], "script": "base64:AAIEAAAAAAAAACYIAhIDCgEIEgMKAQESAwoBARIECgIIARIHCgUICAEBCBIECgIIAQAAABEBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAAAAAAROT05FAgAAAARub25lAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAABnN0cmluZwEAAAAPZ2V0S2V5VXNlckVtYWlsAAAAAQAAAAR1c2VyCQABLAAAAAIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABHVzZXICAAAABl9lbWFpbAEAA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lZ2VyRW50cnkAAAACCQEAAAARZ2V0S2V5QXNzZXRBbW91bnQAAAABCQACWAAAAAEFAAAAB2Fzc2V0SWQFAAAACHF1YW50aXR5CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAAQZ2V0S2V5QXNzZXRQcmljZQAAAAEJAAJYAAAAAQUAAAAHYXNzZXRJZAUAAAAFcHJpY2UJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAD2dldEtleUFzc2V0RGF0YQAAAAEJAAJYAAAAAQUAAAAHYXNzZXRJZAUAAAAEZGF0YQUAAAADbmlsAAAAAWkBAAAAEmV4Y2hhbmdlQXNzZXRUb2tlbgAAAAIAAAAHYXNzZXRJZAAAAAZhbW91bnQEAAAAB3BheW1lbnQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAADCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABBQAAAAdwYXltZW50CQAAAgAAAAECAAAAIG5lZWQgYXR0YWNoIHBheW1lbnQgd2l0aCBOWUFOLTI1CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAAAdBZGRyZXNzAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwUAAAAGYW1vdW50CQACWQAAAAEFAAAAB2Fzc2V0SWQJAARMAAAAAgkBAAAABEJ1cm4AAAACCQEAAAAFdmFsdWUAAAABCAUAAAAHcGF5bWVudAAAAAdhc3NldElkCAUAAAAHcGF5bWVudAAAAAZhbW91bnQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5ayfxzg==", "height": 1542542, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4jBJTxo9QoaJYY38vGoFQmCFzo6Zqt74BdAUzg2ajQPV Next: BtNapCdbmiw6SAccJG8dXWZoQ7DqfRSeU3XFPFFKJQya Diff:
OldNewDifferences
134134 @Callable(i)
135135 func exchangeAssetToken (assetId,amount) = {
136136 let payment = i.payments[0]
137-[ScriptTransfer(Address(i.caller.bytes), amount, fromBase58String(assetId)), Burn(value(payment.assetId), payment.amount)]
137+ if (!(isDefined(payment)))
138+ then throw("need attach payment with NYAN-25")
139+ else [ScriptTransfer(Address(i.caller.bytes), amount, fromBase58String(assetId)), Burn(value(payment.assetId), payment.amount)]
138140 }
139141
140142
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 getKeyUserBalance (user) = (("user_" + user) + "_balance")
3535
3636
3737 func getValueUserBalance (user) = getNumberByKey(getKeyUserBalance(user))
3838
3939
4040 func getKeyDAppAssetId () = "dApp_assetId"
4141
4242
4343 func getValueDAppAssetId () = getStringByKey(getKeyDAppAssetId())
4444
4545
4646 func getKeyDAppBalance () = "dApp_balance"
4747
4848
4949 func getValueDAppBalance () = getNumberByKey(getKeyDAppBalance())
5050
5151
5252 func getKeyAssetAmount (asset) = (("asset_" + asset) + "_amount")
5353
5454
5555 func getValueAssetAmount (asset) = getNumberByKey(getKeyAssetAmount(asset))
5656
5757
5858 func getKeyAssetPrice (asset) = (("asset_" + asset) + "_price")
5959
6060
6161 func getValueAssetPrice (asset) = getNumberByKey(getKeyAssetPrice(asset))
6262
6363
6464 func getKeyAssetData (asset) = (("asset_" + asset) + "_data")
6565
6666
6767 func getValueAssetData (asset) = getStringByKey(getKeyAssetPrice(asset))
6868
6969
7070 @Callable(i)
7171 func signUp (email) = {
7272 let currentUserAddress = toBase58String(i.caller.bytes)
7373 let currentUserEmail = getValueUserEmail(currentUserAddress)
7474 if ((currentUserEmail != NONE))
7575 then throw("user is already registered")
7676 else [StringEntry(getKeyUserEmail(currentUserAddress), email), IntegerEntry(getKeyUserBalance(currentUserAddress), 0)]
7777 }
7878
7979
8080
8181 @Callable(i)
8282 func issueToken (quantity) = {
8383 let dAppAssetId = getValueDAppAssetId()
8484 if ((dAppAssetId != NONE))
8585 then throw("token has already been issued")
8686 else {
8787 let asset = Issue("NYAN-25", "NYAN-25 token", quantity, 0, true)
8888 let assetId = calculateAssetId(asset)
8989 [asset, StringEntry(getKeyDAppAssetId(), toBase58String(assetId)), IntegerEntry(getKeyDAppBalance(), quantity)]
9090 }
9191 }
9292
9393
9494
9595 @Callable(i)
9696 func reissueToken (quantity) = {
9797 let dAppAssetId = getValueDAppAssetId()
9898 if ((dAppAssetId == NONE))
9999 then throw("token has not been issued")
100100 else {
101101 let currentDAppBalance = getValueDAppBalance()
102102 let newBalance = (currentDAppBalance + quantity)
103103 [Reissue(fromBase58String(dAppAssetId), quantity, true), IntegerEntry(getKeyDAppBalance(), newBalance)]
104104 }
105105 }
106106
107107
108108
109109 @Callable(i)
110110 func transferToken (recipient,amount) = {
111111 let currentDAppBalance = getValueDAppBalance()
112112 let newDAppBalance = (currentDAppBalance - amount)
113113 if ((0 > newDAppBalance))
114114 then throw("not enoung balance")
115115 else {
116116 let currentUserAddress = toBase58String(i.caller.bytes)
117117 let currentUserBalance = getValueUserBalance(currentUserAddress)
118118 let newUserBalance = (currentUserBalance + amount)
119119 [IntegerEntry(getKeyDAppBalance(), newDAppBalance), IntegerEntry(getKeyUserBalance(recipient), newUserBalance), ScriptTransfer(Address(fromBase58String(recipient)), amount, fromBase58String(getValueDAppAssetId()))]
120120 }
121121 }
122122
123123
124124
125125 @Callable(i)
126126 func issueAssetToken (name,description,quantity,price,data) = {
127127 let asset = Issue(name, description, quantity, 0, true)
128128 let assetId = calculateAssetId(asset)
129129 [asset, IntegerEntry(getKeyAssetAmount(toBase58String(assetId)), quantity), IntegerEntry(getKeyAssetPrice(toBase58String(assetId)), price), StringEntry(getKeyAssetData(toBase58String(assetId)), data)]
130130 }
131131
132132
133133
134134 @Callable(i)
135135 func exchangeAssetToken (assetId,amount) = {
136136 let payment = i.payments[0]
137-[ScriptTransfer(Address(i.caller.bytes), amount, fromBase58String(assetId)), Burn(value(payment.assetId), payment.amount)]
137+ if (!(isDefined(payment)))
138+ then throw("need attach payment with NYAN-25")
139+ else [ScriptTransfer(Address(i.caller.bytes), amount, fromBase58String(assetId)), Burn(value(payment.assetId), payment.amount)]
138140 }
139141
140142
141143 @Verifier(tx)
142144 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
143145

github/deemru/w8io/026f985 
48.27 ms