tx · DFakGMUW5VgEc5mwEo4c47UbTe6hv5by9gU7cy59t11Q
3N7ufBZVuVJtEPVnZAUjpffreNUxCYsb6Vk: -0.01000000 Waves
2021.06.28 21:36 [1590596] smart account 3N7ufBZVuVJtEPVnZAUjpffreNUxCYsb6Vk > SELF 0.00000000 Waves
{
"type": 13,
"id": "DFakGMUW5VgEc5mwEo4c47UbTe6hv5by9gU7cy59t11Q",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1624905434477,
"version": 2,
"chainId": 84,
"sender": "3N7ufBZVuVJtEPVnZAUjpffreNUxCYsb6Vk",
"senderPublicKey": "8rDvQxFR9tYKSwAaR4umUxBMj37GmcVY3VtWAjLyJu62",
"proofs": [
"5nRutdjz9X5HBAK5axVtZDpTCDnHf4UKML1TCnjLHPnWrvNgrEwaeemXhb7P71tH8pnsKtY1p8YkUraCraD8GZP4"
],
"script": "base64:AAIEAAAAAAAAAAwIAhIDCgEBEgMKAQgAAAAAAAAAAgAAAAFpAQAAAAdnZXRVbml0AAAAAQAAAAZ1bml0aWQEAAAAC3VuaXRBc3NldElkBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMJAAEsAAAAAgIAAAAFdW5pdF8JAAGkAAAAAQUAAAAGdW5pdGlkAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAAAAQAAAAEY29zdAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAICAAAABWNvc3RfBQAAAAt1bml0QXNzZXRJZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAADCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAFXdvcmtzIHdpdGggd2F2ZXMgb25seQMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAARjb3N0CQAAAgAAAAECAAAAGFdyb25nIHNlcnZpY2UgZmVlIGFtb3VudAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEJAAJZAAAAAQUAAAALdW5pdEFzc2V0SWQFAAAAA25pbAAAAAFpAQAAAAdidXlVbml0AAAAAQAAAAdhc3NldElEBAAAAARjb3N0BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgIAAAAFY29zdF8FAAAAB2Fzc2V0SUQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAADcG10CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAABV3b3JrcyB3aXRoIHdhdmVzIG9ubHkDCQEAAAACIT0AAAACCAUAAAADcG10AAAABmFtb3VudAUAAAAEY29zdAkAAAIAAAABAgAAABhXcm9uZyBzZXJ2aWNlIGZlZSBhbW91bnQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyAAAAAAAAAAABCQACWQAAAAEFAAAAB2Fzc2V0SUQFAAAAA25pbAAAAABQT8xt",
"height": 1590596,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: GYrb4XkKFrrFJijYLb78HrHdHm8WhyFhVFVEfEF3ypdC
Next: none
Diff:
Old | New | | Differences |
---|
26 | 26 | | } |
---|
27 | 27 | | |
---|
28 | 28 | | |
---|
| 29 | + | |
---|
| 30 | + | @Callable(i) |
---|
| 31 | + | func buyUnit (assetID) = { |
---|
| 32 | + | let cost = match getInteger(this, ("cost_" + assetID)) { |
---|
| 33 | + | case a: Int => |
---|
| 34 | + | a |
---|
| 35 | + | case _ => |
---|
| 36 | + | 0 |
---|
| 37 | + | } |
---|
| 38 | + | let pmt = value(i.payments[0]) |
---|
| 39 | + | if (isDefined(pmt.assetId)) |
---|
| 40 | + | then throw("works with waves only") |
---|
| 41 | + | else if ((pmt.amount != cost)) |
---|
| 42 | + | then throw("Wrong service fee amount") |
---|
| 43 | + | else [ScriptTransfer(i.caller, 1, fromBase58String(assetID))] |
---|
| 44 | + | } |
---|
| 45 | + | |
---|
| 46 | + | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func getUnit (unitid) = { |
---|
8 | 8 | | let unitAssetId = match getString(this, ("unit_" + toString(unitid))) { |
---|
9 | 9 | | case a: String => |
---|
10 | 10 | | a |
---|
11 | 11 | | case _ => |
---|
12 | 12 | | "" |
---|
13 | 13 | | } |
---|
14 | 14 | | let cost = match getInteger(this, ("cost_" + unitAssetId)) { |
---|
15 | 15 | | case a: Int => |
---|
16 | 16 | | a |
---|
17 | 17 | | case _ => |
---|
18 | 18 | | 0 |
---|
19 | 19 | | } |
---|
20 | 20 | | let pmt = value(i.payments[0]) |
---|
21 | 21 | | if (isDefined(pmt.assetId)) |
---|
22 | 22 | | then throw("works with waves only") |
---|
23 | 23 | | else if ((pmt.amount != cost)) |
---|
24 | 24 | | then throw("Wrong service fee amount") |
---|
25 | 25 | | else [ScriptTransfer(i.caller, 1, fromBase58String(unitAssetId))] |
---|
26 | 26 | | } |
---|
27 | 27 | | |
---|
28 | 28 | | |
---|
| 29 | + | |
---|
| 30 | + | @Callable(i) |
---|
| 31 | + | func buyUnit (assetID) = { |
---|
| 32 | + | let cost = match getInteger(this, ("cost_" + assetID)) { |
---|
| 33 | + | case a: Int => |
---|
| 34 | + | a |
---|
| 35 | + | case _ => |
---|
| 36 | + | 0 |
---|
| 37 | + | } |
---|
| 38 | + | let pmt = value(i.payments[0]) |
---|
| 39 | + | if (isDefined(pmt.assetId)) |
---|
| 40 | + | then throw("works with waves only") |
---|
| 41 | + | else if ((pmt.amount != cost)) |
---|
| 42 | + | then throw("Wrong service fee amount") |
---|
| 43 | + | else [ScriptTransfer(i.caller, 1, fromBase58String(assetID))] |
---|
| 44 | + | } |
---|
| 45 | + | |
---|
| 46 | + | |
---|