tx · CGWwdrAd7GEZ5BHaZTiPuZRARqVBqwjyz85ZcjrAsRkD 3NCV9ifzdz2ZpMiaW3tUCnyzqYE1EDqj4q5: -0.05000000 Waves 2019.11.07 18:38 [754696] smart account 3NCV9ifzdz2ZpMiaW3tUCnyzqYE1EDqj4q5 > SELF 0.00000000 Waves
{ "type": 13, "id": "CGWwdrAd7GEZ5BHaZTiPuZRARqVBqwjyz85ZcjrAsRkD", "fee": 5000000, "feeAssetId": null, "timestamp": 1573141043284, "version": 1, "sender": "3NCV9ifzdz2ZpMiaW3tUCnyzqYE1EDqj4q5", "senderPublicKey": "5kzCgK4UaAsE1fmoCF6xdRdFNm6udRYNsN5NmKmYV5BK", "proofs": [ "3uS5aHDirBVsijG77WZQXAChEmGkUyeM7dsmhyVjLcJgaVvzxQqz4Yj44BAJf6ag3D8yqMj2aXH2pp4tJkuinvZ4", "4iXPN7mA77AJ7AMGjvGAnbHjuCdB7sNZCBaUrcwmFCf1XPcoouNwa6mHAfWYqU1XJ1AGZm8BbxXR4CZC45VMMFHJ", "49cRqLN3gPdQhYZNb1VWHZKa8r6XUb8685YCDEnzCiqqf53euedDg6g5cCEd8WNkjp7dJ51EUDym4VHJnsSGQA1c" ], "script": "base64:AAIDAAAAAAAAAAkIARIFCgMIAQgAAAAIAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQA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AEmdldEtleUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAAD3N1cHBsaWVyQWRkcmVzcwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEFAAAABGl0ZW0FAAAABXByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAOZ2V0S2V5SXRlbURhdGEAAAABBQAAAARpdGVtBQAAAARkYXRhBQAAAANuaWwAAAAAaX+QDQ==", "chainId": 84, "height": 754696, "spentComplexity": 0 } View: original | compacted Prev: 3dFfEHZGTo8oSMSXVDsch2YdosGaojHZgq9mUeQwKa89 Next: CGsP5haiQEK7htX7FQBUdkQxUxzQSka4LpMHsJdbpK8Z Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let NONE = "none" | |
5 | 5 | ||
6 | - | let bobPubKey = base58'H1UcayXjKc7QrAmJ3erroxQ5wApeMNPzQ5XEX9ZZ11Tv' | |
7 | - | ||
8 | - | let cooperPubKey = base58'6NELMuugHtPjNMo1XK5zcBoHcb7AGJe7yc8vDdXphgW3' | |
6 | + | func getNumberByKey (key) = { | |
7 | + | let num = match getInteger(this, key) { | |
8 | + | case a: Int => | |
9 | + | a | |
10 | + | case _ => | |
11 | + | 0 | |
12 | + | } | |
13 | + | num | |
14 | + | } | |
9 | 15 | ||
10 | 16 | ||
11 | - | @Verifier(tx) | |
12 | - | func verify () = { | |
13 | - | let alice1 = sigVerify(tx.bodyBytes, tx.proofs[0], alicePubKey) | |
14 | - | let alice2 = sigVerify(tx.bodyBytes, tx.proofs[1], alicePubKey) | |
15 | - | let alice3 = sigVerify(tx.bodyBytes, tx.proofs[2], alicePubKey) | |
16 | - | let bob1 = sigVerify(tx.bodyBytes, tx.proofs[0], bobPubKey) | |
17 | - | let bob2 = sigVerify(tx.bodyBytes, tx.proofs[1], bobPubKey) | |
18 | - | let bob3 = sigVerify(tx.bodyBytes, tx.proofs[2], bobPubKey) | |
19 | - | let cooper1 = sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubKey) | |
20 | - | let cooper2 = sigVerify(tx.bodyBytes, tx.proofs[1], cooperPubKey) | |
21 | - | let cooper3 = sigVerify(tx.bodyBytes, tx.proofs[2], cooperPubKey) | |
22 | - | let aliceAndBob = if (if (if (if (if (if (alice1) | |
23 | - | then bob2 | |
24 | - | else false) | |
25 | - | then true | |
26 | - | else if (alice1) | |
27 | - | then bob3 | |
28 | - | else false) | |
29 | - | then true | |
30 | - | else if (alice2) | |
31 | - | then bob1 | |
32 | - | else false) | |
33 | - | then true | |
34 | - | else if (alice2) | |
35 | - | then bob3 | |
36 | - | else false) | |
37 | - | then true | |
38 | - | else if (alice3) | |
39 | - | then bob1 | |
40 | - | else false) | |
41 | - | then true | |
42 | - | else if (alice3) | |
43 | - | then bob2 | |
44 | - | else false | |
45 | - | let aliceAndCooper = if (if (if (if (if (if (alice1) | |
46 | - | then cooper2 | |
47 | - | else false) | |
48 | - | then true | |
49 | - | else if (alice1) | |
50 | - | then cooper3 | |
51 | - | else false) | |
52 | - | then true | |
53 | - | else if (alice2) | |
54 | - | then cooper1 | |
55 | - | else false) | |
56 | - | then true | |
57 | - | else if (alice2) | |
58 | - | then cooper3 | |
59 | - | else false) | |
60 | - | then true | |
61 | - | else if (alice3) | |
62 | - | then cooper1 | |
63 | - | else false) | |
64 | - | then true | |
65 | - | else if (alice3) | |
66 | - | then cooper2 | |
67 | - | else false | |
68 | - | let bobAndCooper = if (if (if (if (if (if (cooper1) | |
69 | - | then bob2 | |
70 | - | else false) | |
71 | - | then true | |
72 | - | else if (cooper1) | |
73 | - | then bob3 | |
74 | - | else false) | |
75 | - | then true | |
76 | - | else if (cooper2) | |
77 | - | then bob1 | |
78 | - | else false) | |
79 | - | then true | |
80 | - | else if (cooper2) | |
81 | - | then bob3 | |
82 | - | else false) | |
83 | - | then true | |
84 | - | else if (cooper3) | |
85 | - | then bob1 | |
86 | - | else false) | |
87 | - | then true | |
88 | - | else if (cooper3) | |
89 | - | then bob2 | |
90 | - | else false | |
91 | - | match tx { | |
17 | + | func getStrByKey (key) = { | |
18 | + | let str = match getString(this, key) { | |
19 | + | case a: String => | |
20 | + | a | |
92 | 21 | case _ => | |
93 | - | if (if (aliceAndBob) | |
94 | - | then true | |
95 | - | else aliceAndCooper) | |
96 | - | then true | |
97 | - | else bobAndCooper | |
22 | + | NONE | |
98 | 23 | } | |
24 | + | str | |
99 | 25 | } | |
26 | + | ||
27 | + | ||
28 | + | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
29 | + | ||
30 | + | ||
31 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
32 | + | ||
33 | + | ||
34 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
35 | + | ||
36 | + | ||
37 | + | func getKeyItemPrice (item) = (item + "_price") | |
38 | + | ||
39 | + | ||
40 | + | func getKeyItemData (item) = (item + "_data") | |
41 | + | ||
42 | + | ||
43 | + | @Callable(i) | |
44 | + | func addItem (title,price,data) = { | |
45 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
46 | + | let item = getKeyItem(supplierAddress, title) | |
47 | + | if ((0 >= price)) | |
48 | + | then throw("Valor de compra não pode ser inferior a 0") | |
49 | + | else if ((getValueItemSupplier(item) != NONE)) | |
50 | + | then throw("O item já existe") | |
51 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
52 | + | } | |
53 | + | ||
100 | 54 |
github/deemru/w8io/026f985 24.93 ms ◑