tx · Ga5wcD8sxwhMegh1rA5yGDpoz3bEWX633Hgg2fDPDhSe

3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV:  -0.01400000 Waves

2022.02.04 04:31 [1908209] smart account 3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV > SELF 0.00000000 Waves

{ "type": 13, "id": "Ga5wcD8sxwhMegh1rA5yGDpoz3bEWX633Hgg2fDPDhSe", "fee": 1400000, "feeAssetId": null, "timestamp": 1643938266110, "version": 2, "chainId": 84, "sender": "3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV", "senderPublicKey": "7ycxALbgfzht9z36iWCgRauBfWzQGSgkc3HMwu7wDwNX", "proofs": [ "4QYvf6oLk7sznbfS9KrjHUpSxJxyvxEa9urYquFC39f3FwkbJHmAPyHNHTqaJSMPNH2qehwNWxSZHUtaMV3x6Gkp" ], "script": "base64:AAIFAAAAAAAAAhEIAhIDCgEIEgUKAwgBCBIFCgMICAgSAwoBCBIDCgEIEgMKAQgaDAoBQRIHcGF5bWVudBoRCgFCEgxjdXN0b21lckFkZHIaBgoBQxIBcBoMCgFEEgdzb2xkb3V0GgcKAUUSAnR4GgsKAUYSBnZlcmlmeRoJCgFhEgROT05FGg0KAWISCGN1c3RvbWVyGg0KAWMSCHN1cHBsaWVyGg8KAWQSCmVyaWNQdWJLZXkaEwoBZRIOZ2V0U3RyaW5nQnlLZXkaCAoBZhIDa2V5GgwKAWcSByRtYXRjaDAaBgoBaBIBYRoQCgFpEgtnZXRJdGVtSGFzaBoKCgFqEgV0aXRsZRoPCgFrEgpjb21ib1RpdGxlGg8KAWwSCmdldE5hbWVLZXkaCQoBbRIEdHlwZRoJCgFuEgRhZGRyGhcKAW8SEmdldEl0ZW1TdXBwbGllcktleRoJCgFwEgRpdGVtGhQKAXESD2dldEl0ZW1QcmljZUtleRoWCgFyEhFnZXRJdGVtU29sZE91dEtleRoTCgFzEg5nZXRJdGVtRGF0YUtleRoZCgF0EhRnZXRWYWx1ZUl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QAAAAEJAQAAAAFzAAAAAQUAAAABcAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAABcgAAAAEFAAAAAXAFAAAAA25pbAkAAAIAAAABAgAAABRObyBzdWNoIGl0ZW0gcHJlc2VudAAAAAF3AQAAAAtkZWxldGVFbnRyeQAAAAEAAAABZgMJAAAAAAAAAggFAAAAAXcAAAAPY2FsbGVyUHVibGljS2V5BQAAAAFkCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAAAWYFAAAAA25pbAkAAAIAAAABAgAAABxPbmx5IEVyaWMgY2FuIGRlbGV0ZSBlbnRyaWVzAAAAAXcBAAAACnVucmVnaXN0ZXIAAAABAAAAAW0DAwkAAAAAAAACBQAAAAFtBQAAAAFjBgkAAAAAAAACBQAAAAFtBQAAAAFiBAAAAAFuCQACWAAAAAEICAUAAAABdwAAAAZjYWxsZXIAAAAFYnl0ZXMJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAWwAAAACBQAAAAFtBQAAAAFuBQAAAANuaWwJAAACAAAAAQIAAAAQSWxsZWdhbCBhcmd1bWVudAAAAAEAAAABRQEAAAABRgAAAAAJAAH0AAAAAwgFAAAAAUUAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAFFAAAABnByb29mcwAAAAAAAAAAAAgFAAAAAUUAAAAPc2VuZGVyUHVibGljS2V50idhPw==", "height": 1908209, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HRXA72GWLbTeHMQBpZme4fnekwwPi2p71Wnk5ZQ9aiTC Next: none Diff:
OldNewDifferences
4646
4747 func getSoldOutValue (item) = {
4848 let key = getItemSoldOutKey(item)
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- }
49+ match getInteger(this, key) {
50+ case a: Int =>
51+ a
52+ case _ =>
53+ 2
54+ }
5755 }
5856
5957
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- if (true)
50- then throw(("SoldKey: " + key))
51- else match getInteger(this, key) {
52- case a: Int =>
53- a
54- case _ =>
55- 2
56- }
49+ match getInteger(this, key) {
50+ case a: Int =>
51+ a
52+ case _ =>
53+ 2
54+ }
5755 }
5856
5957
6058 @Callable(i)
6159 func register (type) = {
6260 let addr = toBase58String(i.caller.bytes)
6361 if (if (isDefined(type))
6462 then if ((type == customer))
6563 then true
6664 else (type == supplier)
6765 else false)
6866 then [StringEntry(getNameKey(type, addr), addr)]
6967 else throw("Invalid func parameters")
7068 }
7169
7270
7371
7472 @Callable(i)
7573 func createItem (title,price,data) = {
7674 let supplierAddress = toBase58String(i.caller.bytes)
7775 let item = getItemHash(supplierAddress, title)
7876 if ((0 >= price))
7977 then throw("Price can not be negative value or zero")
8078 else if ((getValueItemSupplier(item) != NONE))
8179 then throw("Item already exists")
8280 else [StringEntry(getItemSupplierKey(item), supplierAddress), IntegerEntry(getItemPriceKey(item), price), IntegerEntry(getItemSoldOutKey(item), 0), StringEntry(getItemDataKey(item), data)]
8381 }
8482
8583
8684
8785 @Callable(i)
8886 func purchase (title,supplier,data) = if ((size(i.payments) > 0))
8987 then {
9088 let payment = i.payments[0]
9189 if (if (isDefined(title))
9290 then isDefined(supplier)
9391 else false)
9492 then if (isDefined(payment.assetId))
9593 then throw("Only should pay in waves")
9694 else {
9795 let customerAddr = toBase58String(i.caller.bytes)
9896 let item = getItemHash(supplier, title)
9997 let price = match getInteger(this, getItemPriceKey(item)) {
10098 case p: Int =>
10199 p
102100 case _ =>
103101 0
104102 }
105103 let soldout = getSoldOutValue(item)
106104 if ((soldout != 0))
107105 then throw(("Item is already sold, res: " + toString(soldout)))
108106 else if ((payment.amount > price))
109107 then throw("payment cant be higher than price")
110108 else if ((price > payment.amount))
111109 then throw("payment cant be lower than price")
112110 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)]
113111 }
114112 else throw("Coupon title and supplier address should be present")
115113 }
116114 else throw("Please attach payment")
117115
118116
119117
120118 @Callable(i)
121119 func deleteItem (title) = {
122120 let supplierAddress = toBase58String(i.caller.bytes)
123121 let item = getItemHash(supplierAddress, title)
124122 if ((getValueItemSupplier(item) != NONE))
125123 then [DeleteEntry(getItemSupplierKey(item)), DeleteEntry(getItemPriceKey(item)), DeleteEntry(getItemDataKey(item)), DeleteEntry(getItemSoldOutKey(item))]
126124 else throw("No such item present")
127125 }
128126
129127
130128
131129 @Callable(i)
132130 func deleteEntry (key) = if ((i.callerPublicKey == ericPubKey))
133131 then [DeleteEntry(key)]
134132 else throw("Only Eric can delete entries")
135133
136134
137135
138136 @Callable(i)
139137 func unregister (type) = if (if ((type == supplier))
140138 then true
141139 else (type == customer))
142140 then {
143141 let addr = toBase58String(i.caller.bytes)
144142 [DeleteEntry(getNameKey(type, addr))]
145143 }
146144 else throw("Illegal argument")
147145
148146
149147 @Verifier(tx)
150148 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
151149

github/deemru/w8io/026f985 
29.16 ms