tx · HRXA72GWLbTeHMQBpZme4fnekwwPi2p71Wnk5ZQ9aiTC

3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV:  -0.01400000 Waves

2022.02.04 04:26 [1908204] smart account 3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV > SELF 0.00000000 Waves

{ "type": 13, "id": "HRXA72GWLbTeHMQBpZme4fnekwwPi2p71Wnk5ZQ9aiTC", "fee": 1400000, "feeAssetId": null, "timestamp": 1643937964336, "version": 2, "chainId": 84, "sender": "3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV", "senderPublicKey": "7ycxALbgfzht9z36iWCgRauBfWzQGSgkc3HMwu7wDwNX", "proofs": [ "5LPMpRxK7SoUKqwKcLNWpJWCKuAaruiwptD63CfzE4KFK2rMB8EFTd5vEQpfpDxhym4uWYZ8h12rrzEPiAbnXoxR" ], "script": "base64:AAIFAAAAAAAAAhEIAhIDCgEIEgUKAwgBCBIFCgMICAgSAwoBCBIDCgEIEgMKAQgaDAoBQRIHcGF5bWVudBoRCgFCEgxjdXN0b21lckFkZHIaBgoBQxIBcBoMCgFEEgdzb2xkb3V0GgcKAUUSAnR4GgsKAUYSBnZlcmlmeRoJCgFhEgROT05FGg0KAWISCGN1c3RvbWVyGg0KAWMSCHN1cHBsaWVyGg8KAWQSCmVyaWNQdWJLZXkaEwoBZRIOZ2V0U3RyaW5nQnlLZXkaCAoBZhIDa2V5GgwKAWcSByRtYXRjaDAaBgoBaBIBYRoQCgFpEgtnZXRJdGVtSGFzaBoKCgFqEgV0aXRsZRoPCgFrEgpjb21ib1RpdGxlGg8KAWwSCmdldE5hbWVLZXkaCQoBbRIEdHlwZRoJCgFuEgRhZGRyGhcKAW8SEmdldEl0ZW1TdXBwbGllcktleRoJCgFwEgRpdGVtGhQKAXESD2dldEl0ZW1QcmljZUtleRoWCgFyEhFnZXRJdGVtU29sZE91dEtleRoTCgFzEg5nZXRJdGVtRGF0YUtleRoZCgF0EhRnZXRWYWx1ZUl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EFAAAAAXAJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAXMAAAABBQAAAAFwCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAAAFyAAAAAQUAAAABcAUAAAADbmlsCQAAAgAAAAECAAAAFE5vIHN1Y2ggaXRlbSBwcmVzZW50AAAAAXcBAAAAC2RlbGV0ZUVudHJ5AAAAAQAAAAFmAwkAAAAAAAACCAUAAAABdwAAAA9jYWxsZXJQdWJsaWNLZXkFAAAAAWQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAABZgUAAAADbmlsCQAAAgAAAAECAAAAHE9ubHkgRXJpYyBjYW4gZGVsZXRlIGVudHJpZXMAAAABdwEAAAAKdW5yZWdpc3RlcgAAAAEAAAABbQMDCQAAAAAAAAIFAAAAAW0FAAAAAWMGCQAAAAAAAAIFAAAAAW0FAAAAAWIEAAAAAW4JAAJYAAAAAQgIBQAAAAF3AAAABmNhbGxlcgAAAAVieXRlcwkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAABbAAAAAIFAAAAAW0FAAAAAW4FAAAAA25pbAkAAAIAAAABAgAAABBJbGxlZ2FsIGFyZ3VtZW50AAAAAQAAAAFFAQAAAAFGAAAAAAkAAfQAAAADCAUAAAABRQAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAUUAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAABRQAAAA9zZW5kZXJQdWJsaWNLZXloog8C", "height": 1908204, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DxYuqpFDfYAfxL294ghooZUTaoghTfWcppPfku8gLBy9 Next: Ga5wcD8sxwhMegh1rA5yGDpoz3bEWX633Hgg2fDPDhSe Diff:
OldNewDifferences
4646
4747 func getSoldOutValue (item) = {
4848 let key = getItemSoldOutKey(item)
49- match getInteger(this, key) {
50- case a: Int =>
51- a
52- case _ =>
53- 2
54- }
49+ if (true)
50+ then throw(("SoldKey: " + key))
51+ else match getInteger(this, key) {
52+ case a: Int =>
53+ a
54+ case _ =>
55+ 2
56+ }
5557 }
5658
5759
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "NONE"
55
66 let customer = "CUSTOMER"
77
88 let supplier = "SUPPLIER"
99
1010 let ericPubKey = base58'8haEN2a7ZmkzawLmnr5rFX14X1oHi5kjt8NQUDNjSDLG'
1111
1212 func getStringByKey (key) = match getString(key) {
1313 case a: String =>
1414 a
1515 case _ =>
1616 NONE
1717 }
1818
1919
2020 func getItemHash (supplier,title) = {
2121 let comboTitle = (supplier + title)
2222 ("item_" + toBase58String(sha256(toBytes(comboTitle))))
2323 }
2424
2525
2626 func getNameKey (type,addr) = (((type + "_") + addr) + "_name")
2727
2828
2929 func getItemSupplierKey (item) = (item + "_owner")
3030
3131
3232 func getItemPriceKey (item) = (item + "_price")
3333
3434
3535 func getItemSoldOutKey (item) = (item + "_soldout")
3636
3737
3838 func getItemDataKey (item) = (item + "_data")
3939
4040
4141 func getValueItemSupplier (item) = {
4242 let itemKey = getItemSupplierKey(item)
4343 getStringByKey(itemKey)
4444 }
4545
4646
4747 func getSoldOutValue (item) = {
4848 let key = getItemSoldOutKey(item)
49- match getInteger(this, key) {
50- case a: Int =>
51- a
52- case _ =>
53- 2
54- }
49+ if (true)
50+ then throw(("SoldKey: " + key))
51+ else match getInteger(this, key) {
52+ case a: Int =>
53+ a
54+ case _ =>
55+ 2
56+ }
5557 }
5658
5759
5860 @Callable(i)
5961 func register (type) = {
6062 let addr = toBase58String(i.caller.bytes)
6163 if (if (isDefined(type))
6264 then if ((type == customer))
6365 then true
6466 else (type == supplier)
6567 else false)
6668 then [StringEntry(getNameKey(type, addr), addr)]
6769 else throw("Invalid func parameters")
6870 }
6971
7072
7173
7274 @Callable(i)
7375 func createItem (title,price,data) = {
7476 let supplierAddress = toBase58String(i.caller.bytes)
7577 let item = getItemHash(supplierAddress, title)
7678 if ((0 >= price))
7779 then throw("Price can not be negative value or zero")
7880 else if ((getValueItemSupplier(item) != NONE))
7981 then throw("Item already exists")
8082 else [StringEntry(getItemSupplierKey(item), supplierAddress), IntegerEntry(getItemPriceKey(item), price), IntegerEntry(getItemSoldOutKey(item), 0), StringEntry(getItemDataKey(item), data)]
8183 }
8284
8385
8486
8587 @Callable(i)
8688 func purchase (title,supplier,data) = if ((size(i.payments) > 0))
8789 then {
8890 let payment = i.payments[0]
8991 if (if (isDefined(title))
9092 then isDefined(supplier)
9193 else false)
9294 then if (isDefined(payment.assetId))
9395 then throw("Only should pay in waves")
9496 else {
9597 let customerAddr = toBase58String(i.caller.bytes)
9698 let item = getItemHash(supplier, title)
9799 let price = match getInteger(this, getItemPriceKey(item)) {
98100 case p: Int =>
99101 p
100102 case _ =>
101103 0
102104 }
103105 let soldout = getSoldOutValue(item)
104106 if ((soldout != 0))
105107 then throw(("Item is already sold, res: " + toString(soldout)))
106108 else if ((payment.amount > price))
107109 then throw("payment cant be higher than price")
108110 else if ((price > payment.amount))
109111 then throw("payment cant be lower than price")
110112 else [DeleteEntry(getItemSupplierKey(item)), DeleteEntry(getItemPriceKey(item)), DeleteEntry(getItemDataKey(item)), DeleteEntry(getItemSoldOutKey(item)), StringEntry(getItemSupplierKey(item), customerAddr), IntegerEntry(getItemPriceKey(item), price), IntegerEntry(getItemSoldOutKey(item), 1), StringEntry(getItemDataKey(item), data), StringEntry(((((("status:purchase_" + item) + "_supplier_") + supplier) + "_customer_") + customerAddr), "confirmed"), IntegerEntry(((((("price:purchase_" + item) + "_supplier_") + supplier) + "_customer_") + customerAddr), price)]
111113 }
112114 else throw("Coupon title and supplier address should be present")
113115 }
114116 else throw("Please attach payment")
115117
116118
117119
118120 @Callable(i)
119121 func deleteItem (title) = {
120122 let supplierAddress = toBase58String(i.caller.bytes)
121123 let item = getItemHash(supplierAddress, title)
122124 if ((getValueItemSupplier(item) != NONE))
123125 then [DeleteEntry(getItemSupplierKey(item)), DeleteEntry(getItemPriceKey(item)), DeleteEntry(getItemDataKey(item)), DeleteEntry(getItemSoldOutKey(item))]
124126 else throw("No such item present")
125127 }
126128
127129
128130
129131 @Callable(i)
130132 func deleteEntry (key) = if ((i.callerPublicKey == ericPubKey))
131133 then [DeleteEntry(key)]
132134 else throw("Only Eric can delete entries")
133135
134136
135137
136138 @Callable(i)
137139 func unregister (type) = if (if ((type == supplier))
138140 then true
139141 else (type == customer))
140142 then {
141143 let addr = toBase58String(i.caller.bytes)
142144 [DeleteEntry(getNameKey(type, addr))]
143145 }
144146 else throw("Illegal argument")
145147
146148
147149 @Verifier(tx)
148150 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
149151

github/deemru/w8io/026f985 
45.94 ms