tx · 6iLkHAo7mAApY5TBX1R9KGUgrg1kpWyiJR9mVHgjVa56 3MrFUxcMycRcQDahrA16JhvuEKnbmMF3QZP: -0.01400000 Waves 2021.11.17 23:25 [1795510] smart account 3MrFUxcMycRcQDahrA16JhvuEKnbmMF3QZP > SELF 0.00000000 Waves
{ "type": 13, "id": "6iLkHAo7mAApY5TBX1R9KGUgrg1kpWyiJR9mVHgjVa56", "fee": 1400000, "feeAssetId": null, "timestamp": 1637180729889, "version": 2, "chainId": 84, "sender": "3MrFUxcMycRcQDahrA16JhvuEKnbmMF3QZP", "senderPublicKey": "HtiJZF4j7Jo8jR12wxtKDkNhS3qCe3qsk8QxnnjVvXyq", "proofs": [ "3sa3UiHdS5gzKtuM8iTQvHpcCodnzTmv4a8p8g9GaWeBwTSmqwRp6JLk35PL7v1RAVj9sRxHQo2Ewc248xCwWVaM" ], "script": "base64:AAIDAAAAAAAAAAkIARIFCgMIAQgAAAARAAAAAA5vd25lclB1YmxpY0tleQEAAAAg+vpQLL2mPfyArBYUtbGDGNd2Bob4dY09QIj2qZyvriAAAAAAC3B1YktleUFsaWNlAQAAACD6+lAsvaY9/ICsFhS1sYMY13YGhvh1jT1AiPapnK+uIAAAAAAJcHViS2V5Qm9iAQAAACCUsCR6p8uxl5C6m//bF9LMOJ5wpGmHg60nCkicG8fXSwAAAAAMcHViS2V5Q29vcGVyAQAAACDL4ltXWjtBAgmyw+43ufKFK4uABZCpd3ZSAl5xLM1BSAAAAAAETk9ORQIAAAAEbm9uZQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAF0BQAAAAckbWF0Y2gwBQAAAAF0AAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkAB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0eAAAAAZwcm9vZnMAAAAAAAAAAAIFAAAADHB1YktleUNvb3BlcgAAAAAAAAAAAQAAAAAAAAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAOb3duZXJQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYJAABnAAAAAgkAAGQAAAACCQAAZAAAAAIFAAAAC3NpZ25lZEFsaWNlBQAAAAlzaWduZWRCb2IFAAAADHNpZ25lZENvb3BlcgAAAAAAAAAAAqrCTpQ=", "height": 1795510, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: JC8tC8DzEYVXLrgwh6CP8eRJ4vaedghpwtJmiQcWJCM9 Next: 9184FjYaMmmKUVzh2434rMhdi5DdN4GNUv3dzTYYCa27 Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let pubKeyBob = base58'B1R7zeh6VgTv4Xxe3aHhdoZ9aQgWcqN8LFC9smacE96r' | |
9 | 9 | ||
10 | 10 | let pubKeyCooper = base58'EisxKQktzqqd4UsxE7UgVjSHqoWindUpjoB7dsDwfG4o' | |
11 | + | ||
12 | + | let NONE = "none" | |
13 | + | ||
14 | + | func getNumberByKey (key) = { | |
15 | + | let num = match getInteger(this, key) { | |
16 | + | case t: Int => | |
17 | + | t | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | num | |
22 | + | } | |
23 | + | ||
24 | + | ||
25 | + | func getStrByKey (key) = { | |
26 | + | let str = match getString(this, key) { | |
27 | + | case t: String => | |
28 | + | t | |
29 | + | case _ => | |
30 | + | NONE | |
31 | + | } | |
32 | + | str | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func getKeyItemPrice (item) = (item + "_price") | |
37 | + | ||
38 | + | ||
39 | + | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
40 | + | ||
41 | + | ||
42 | + | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
43 | + | ||
44 | + | ||
45 | + | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
46 | + | ||
47 | + | ||
48 | + | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
49 | + | ||
50 | + | ||
51 | + | func getKeyItemData (item) = (item + "_data") | |
52 | + | ||
53 | + | ||
54 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
55 | + | ||
56 | + | ||
57 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
58 | + | ||
59 | + | ||
60 | + | func getKeyBalanceSupplier (account) = (account + "_balance") | |
61 | + | ||
62 | + | ||
63 | + | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
64 | + | ||
65 | + | ||
66 | + | @Callable(i) | |
67 | + | func addItem (title,price,data) = { | |
68 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
69 | + | let item = getKeyItem(supplierAddress, title) | |
70 | + | if ((0 >= price)) | |
71 | + | then throw("purchase amount cannot be less than item price") | |
72 | + | else if ((getValueItemSupplier(item) != NONE)) | |
73 | + | then throw("an item is already exist") | |
74 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
75 | + | } | |
11 | 76 | ||
12 | 77 | ||
13 | 78 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ownerPublicKey = base58'HtiJZF4j7Jo8jR12wxtKDkNhS3qCe3qsk8QxnnjVvXyq' | |
5 | 5 | ||
6 | 6 | let pubKeyAlice = base58'HtiJZF4j7Jo8jR12wxtKDkNhS3qCe3qsk8QxnnjVvXyq' | |
7 | 7 | ||
8 | 8 | let pubKeyBob = base58'B1R7zeh6VgTv4Xxe3aHhdoZ9aQgWcqN8LFC9smacE96r' | |
9 | 9 | ||
10 | 10 | let pubKeyCooper = base58'EisxKQktzqqd4UsxE7UgVjSHqoWindUpjoB7dsDwfG4o' | |
11 | + | ||
12 | + | let NONE = "none" | |
13 | + | ||
14 | + | func getNumberByKey (key) = { | |
15 | + | let num = match getInteger(this, key) { | |
16 | + | case t: Int => | |
17 | + | t | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | num | |
22 | + | } | |
23 | + | ||
24 | + | ||
25 | + | func getStrByKey (key) = { | |
26 | + | let str = match getString(this, key) { | |
27 | + | case t: String => | |
28 | + | t | |
29 | + | case _ => | |
30 | + | NONE | |
31 | + | } | |
32 | + | str | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func getKeyItemPrice (item) = (item + "_price") | |
37 | + | ||
38 | + | ||
39 | + | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
40 | + | ||
41 | + | ||
42 | + | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
43 | + | ||
44 | + | ||
45 | + | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
46 | + | ||
47 | + | ||
48 | + | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
49 | + | ||
50 | + | ||
51 | + | func getKeyItemData (item) = (item + "_data") | |
52 | + | ||
53 | + | ||
54 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
55 | + | ||
56 | + | ||
57 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
58 | + | ||
59 | + | ||
60 | + | func getKeyBalanceSupplier (account) = (account + "_balance") | |
61 | + | ||
62 | + | ||
63 | + | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
64 | + | ||
65 | + | ||
66 | + | @Callable(i) | |
67 | + | func addItem (title,price,data) = { | |
68 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
69 | + | let item = getKeyItem(supplierAddress, title) | |
70 | + | if ((0 >= price)) | |
71 | + | then throw("purchase amount cannot be less than item price") | |
72 | + | else if ((getValueItemSupplier(item) != NONE)) | |
73 | + | then throw("an item is already exist") | |
74 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
75 | + | } | |
11 | 76 | ||
12 | 77 | ||
13 | 78 | @Verifier(tx) | |
14 | 79 | func verify () = { | |
15 | 80 | let signedAlice = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyAlice)) | |
16 | 81 | then true | |
17 | 82 | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyAlice)) | |
18 | 83 | then true | |
19 | 84 | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyAlice)) | |
20 | 85 | then 1 | |
21 | 86 | else 0 | |
22 | 87 | let signedBob = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyBob)) | |
23 | 88 | then true | |
24 | 89 | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyBob)) | |
25 | 90 | then true | |
26 | 91 | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyBob)) | |
27 | 92 | then 1 | |
28 | 93 | else 0 | |
29 | 94 | let signedCooper = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyCooper)) | |
30 | 95 | then true | |
31 | 96 | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyCooper)) | |
32 | 97 | then true | |
33 | 98 | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyCooper)) | |
34 | 99 | then 1 | |
35 | 100 | else 0 | |
36 | 101 | match tx { | |
37 | 102 | case d: SetScriptTransaction => | |
38 | 103 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
39 | 104 | case d: DataTransaction => | |
40 | 105 | true | |
41 | 106 | case _ => | |
42 | 107 | (((signedAlice + signedBob) + signedCooper) >= 2) | |
43 | 108 | } | |
44 | 109 | } | |
45 | 110 |
github/deemru/w8io/026f985 22.12 ms ◑