tx · 4ZzWwsmnqzxLZGDaMS8nqcGk11cwMVzj6G8MfLPANVxn

3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm:  -0.01000000 Waves

2022.03.17 16:10 [1967986] smart account 3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm > SELF 0.00000000 Waves

{ "type": 13, "id": "4ZzWwsmnqzxLZGDaMS8nqcGk11cwMVzj6G8MfLPANVxn", "fee": 1000000, "feeAssetId": null, "timestamp": 1647522634278, "version": 2, "chainId": 84, "sender": "3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm", "senderPublicKey": "DKZcYM5WoZ3gBkiAgjzXdfQaZcfisgn2Zn4B226GHMcD", "proofs": [ "57NFYB92U3BHdVZtkJrTY6mRvm8Twss8ucrgU6FXJ8oDm4iZAELktTQraxT7UPwX395iXnPw8WZNeCgT26MahvmC" ], "script": "base64:AAIFAAAAAAAAAAIIAgAAAAMAAAAACkFQdWJsaWNLZXkBAAAAIIu19x30Xz+P53LrUAJYEkMtH1VpfGt0/1aTVmldOosMAAAAAApCUHVibGljS2V5AQAAACC3DZKziv/tGyt03Qly8mbrCHW73dDw0g2OKdh4o9AuGgAAAAAKQ1B1YmxpY0tleQEAAAAgTEDWlbqWShJQlBG6PB0IqAYOORzGNp+r5czsD9gl8mAAAAAAAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAACQTEJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAApBUHVibGljS2V5BAAAAAJBMgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEFAAAACkFQdWJsaWNLZXkEAAAAAkEzCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAA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QAAAAJCMwcGAwUAAAACQzIFAAAAAkIxBwYDBQAAAAJDMgUAAAACQjMHBgMFAAAAAkMzBQAAAAJCMQcGAwUAAAACQzMFAAAAAkIyBwQAAAAHJG1hdGNoMAUAAAACdHgDAwUAAAACQUIGBQAAAAJBQwYFAAAAAkJDm8GJ5g==", "height": 1967986, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EHVLtGp9TM6QhaC2Rgv3XYvDb8rb4XgKFR6ixCSnviHx Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let NONE = "none"
4+let APublicKey = base58'AQNbrqrtZ6QZSsdTekNofCi39KjhtsyRBSpBEmc4EqMm'
55
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- }
6+let BPublicKey = base58'DKZcYM5WoZ3gBkiAgjzXdfQaZcfisgn2Zn4B226GHMcD'
7+
8+let CPublicKey = base58'68fL3LofvP8XvE3Nei5sjoZprfVxdDALDjkQ5SGLVDeX'
159
1610
17-func getStrByKey (key) = {
18- let str = match getString(this, key) {
19- case a: String =>
20- a
11+@Verifier(tx)
12+func verify () = {
13+ let A1 = sigVerify(tx.bodyBytes, tx.proofs[0], APublicKey)
14+ let A2 = sigVerify(tx.bodyBytes, tx.proofs[1], APublicKey)
15+ let A3 = sigVerify(tx.bodyBytes, tx.proofs[2], APublicKey)
16+ let B1 = sigVerify(tx.bodyBytes, tx.proofs[0], BPublicKey)
17+ let B2 = sigVerify(tx.bodyBytes, tx.proofs[1], BPublicKey)
18+ let B3 = sigVerify(tx.bodyBytes, tx.proofs[2], BPublicKey)
19+ let C1 = sigVerify(tx.bodyBytes, tx.proofs[0], CPublicKey)
20+ let C2 = sigVerify(tx.bodyBytes, tx.proofs[1], CPublicKey)
21+ let C3 = sigVerify(tx.bodyBytes, tx.proofs[2], CPublicKey)
22+ let AB = if (if (if (if (if (if (A1)
23+ then B2
24+ else false)
25+ then true
26+ else if (A1)
27+ then B3
28+ else false)
29+ then true
30+ else if (A2)
31+ then B1
32+ else false)
33+ then true
34+ else if (A2)
35+ then B3
36+ else false)
37+ then true
38+ else if (A3)
39+ then B1
40+ else false)
41+ then true
42+ else if (A3)
43+ then B2
44+ else false
45+ let AC = if (if (if (if (if (if (A1)
46+ then C2
47+ else false)
48+ then true
49+ else if (A1)
50+ then C3
51+ else false)
52+ then true
53+ else if (A2)
54+ then C1
55+ else false)
56+ then true
57+ else if (A2)
58+ then C3
59+ else false)
60+ then true
61+ else if (A3)
62+ then C1
63+ else false)
64+ then true
65+ else if (A3)
66+ then C2
67+ else false
68+ let BC = if (if (if (if (if (if (C1)
69+ then B2
70+ else false)
71+ then true
72+ else if (C1)
73+ then B3
74+ else false)
75+ then true
76+ else if (C2)
77+ then B1
78+ else false)
79+ then true
80+ else if (C2)
81+ then B3
82+ else false)
83+ then true
84+ else if (C3)
85+ then B1
86+ else false)
87+ then true
88+ else if (C3)
89+ then B2
90+ else false
91+ match tx {
2192 case _ =>
22- NONE
93+ if (if (AB)
94+ then true
95+ else AC)
96+ then true
97+ else BC
2398 }
24- str
2599 }
26-
27-
28-func getKeyItemPrice (item) = (item + "_price")
29-
30-
31-func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
32-
33-
34-func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
35-
36-
37-func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
38-
39-
40-func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
41-
42-
43-func getKeyItemData (item) = (item + "_data")
44-
45-
46-func getKeyItemSupplier (item) = (item + "_owner")
47-
48-
49-func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
50-
51-
52-func getKeyBalanceSupplier (account) = (account + "_balance")
53-
54-
55-func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
56-
57-
58-@Callable(i)
59-func addItem (title,price,data) = {
60- let supplierAddress = toBase58String(i.caller.bytes)
61- let item = getKeyItem(supplierAddress, title)
62- if ((0 >= price))
63- then throw("purchase amount cannot be less than item price")
64- else if ((getValueItemSupplier(item) != NONE))
65- then throw("an item is already exist")
66- else $Tuple2([StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data)], unit)
67- }
68-
69-
70-
71-@Callable(i)
72-func purchase (item) = {
73- let pmt = i.payments[0]
74- if (isDefined(pmt.assetId))
75- then throw("can use WAVES only at the moment")
76- else {
77- let userAddress = toBase58String(i.caller.bytes)
78- let price = getValueItemPrice(item)
79- let supplierAddress = getValueItemSupplier(item)
80- if ((price > pmt.amount))
81- then throw("purchase amount cannot be less than item price")
82- else if ((pmt.amount > price))
83- then throw("purchase amount cannot be higher than item price")
84- else if ((supplierAddress == NONE))
85- then throw("supplier does not exist")
86- else $Tuple2([IntegerEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), IntegerEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))], unit)
87- }
88- }
89-
90100

github/deemru/w8io/026f985 
32.96 ms