tx · Agyc8u9FSrVg8DJXgPZJsxsdiU7da4FMhE89uKPYUayu

3N61Xs9cTetvoP1uZSrtuRxxJ4A4RCR7a4G:  -0.01400000 Waves

2020.10.02 16:05 [1202965] smart account 3N61Xs9cTetvoP1uZSrtuRxxJ4A4RCR7a4G > SELF 0.00000000 Waves

{ "type": 13, "id": "Agyc8u9FSrVg8DJXgPZJsxsdiU7da4FMhE89uKPYUayu", "fee": 1400000, "feeAssetId": null, "timestamp": 1601643962499, "version": 2, "chainId": 84, "sender": "3N61Xs9cTetvoP1uZSrtuRxxJ4A4RCR7a4G", "senderPublicKey": "DjYkFAzpGaY6gNruMz81SkVbRsemgpfr6KJbXXgyH3UM", "proofs": [ "2ohZaz7YVc5DypbwaJMZziXVL8qj2mZpBeVa5qhmhSXxsAH3sx2rHE2DCfqav7hRLFiNCaXods9R2WWRnCL8PBAN" ], "script": "base64:AAIDAAAAAAAAAA0IARIDCgEIEgQKAggIAAAADQAAAAAETk9ORQIAAAAETk9ORQEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQEAAAAPZ2V0Qm9vbGVhbkJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQbAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAdCb29sZWFuBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FAQAAAAtnZXRLZXlPcmRlcgAAAAIAAAALc2hvcEFkZHJlc3MAAAAHb3JkZXJJZAQAAAAVc2hvcEFkZHJlc3NBbmRPcmRlcklkCQABLAAAAAIFAAAAC3Nob3BBZGRyZXNzBQAAAAdvcmRlcklkCQABLAAAAAICAAAABm9yZGVyXwkAAlgAAA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Byb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tledPQKfo=", "height": 1202965, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HMCGqz6S9msHiYVboZp6usfXyahtwVGgXJppsyeDV1Qk Next: FKPzCgaWW9AqADAvfiqvjopbXH4exSxjaGjYbMhzCApW Diff:
OldNewDifferences
55
66 func getStringByKey (key) = match getString(this, key) {
77 case a: String =>
8+ a
9+ case _ =>
10+ NONE
11+}
12+
13+
14+func getBooleanByKey (key) = match getBoolean(this, key) {
15+ case a: Boolean =>
816 a
917 case _ =>
1018 NONE
3846 func getKeyOrderIsDelivered (order) = (order + "_isDelivered")
3947
4048
41-func getValueOfOrder (order) = getStringByKey(getKeyOrderShopAddress(order))
49+func getValueShopAddressOfOrder (order) = getStringByKey(getKeyOrderShopAddress(order))
50+
51+
52+func getValueIsAccepteOfOrder (order) = getBooleanByKey(getKeyOrderIsAccepted(order))
4253
4354
4455 @Callable(i)
5263 let order = getKeyOrder(shopAddress, orderId)
5364 if ((0 >= shippingCosts))
5465 then throw("You cannot create an order with shipping costs lower than 0")
55- else if ((getValueOfOrder(order) != NONE))
66+ else if ((getValueShopAddressOfOrder(order) != NONE))
5667 then throw("An order with the same id already exists")
5768 else WriteSet([DataEntry(getKeyOrderShopAddress(order), shopAddress), DataEntry(getKeyOrderShippingCosts(order), shippingCosts), DataEntry(getKeyOrderOrderId(order), orderId), DataEntry(getKeyOrderCourier(order), NONE), DataEntry(getKeyOrderIsAccepted(order), false), DataEntry(getKeyOrderIsInDelivery(order), false), DataEntry(getKeyOrderIsDelivered(order), false)])
5869 }
70+ }
71+
72+
73+
74+@Callable(i)
75+func setOrderIsAccepted (shopAddress,orderId) = {
76+ let order = getKeyOrder(shopAddress, orderId)
77+ if ((getValueShopAddressOfOrder(order) != shopAddress))
78+ then throw("The requested order does not exist")
79+ else if ((getValueIsAccepteOfOrder(order) != false))
80+ then throw("The requested order is no longer available")
81+ else WriteSet([DataEntry(getKeyOrderIsAccepted(order), true)])
5982 }
6083
6184
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "NONE"
55
66 func getStringByKey (key) = match getString(this, key) {
77 case a: String =>
8+ a
9+ case _ =>
10+ NONE
11+}
12+
13+
14+func getBooleanByKey (key) = match getBoolean(this, key) {
15+ case a: Boolean =>
816 a
917 case _ =>
1018 NONE
1119 }
1220
1321
1422 func getKeyOrder (shopAddress,orderId) = {
1523 let shopAddressAndOrderId = (shopAddress + orderId)
1624 ("order_" + toBase58String(sha256(toBytes(shopAddressAndOrderId))))
1725 }
1826
1927
2028 func getKeyOrderShopAddress (order) = (order + "_shop")
2129
2230
2331 func getKeyOrderShippingCosts (order) = (order + "_shipping")
2432
2533
2634 func getKeyOrderOrderId (order) = (order + "_orderId")
2735
2836
2937 func getKeyOrderCourier (order) = (order + "_courierId")
3038
3139
3240 func getKeyOrderIsAccepted (order) = (order + "_isAccepted")
3341
3442
3543 func getKeyOrderIsInDelivery (order) = (order + "_isInDelivery")
3644
3745
3846 func getKeyOrderIsDelivered (order) = (order + "_isDelivered")
3947
4048
41-func getValueOfOrder (order) = getStringByKey(getKeyOrderShopAddress(order))
49+func getValueShopAddressOfOrder (order) = getStringByKey(getKeyOrderShopAddress(order))
50+
51+
52+func getValueIsAccepteOfOrder (order) = getBooleanByKey(getKeyOrderIsAccepted(order))
4253
4354
4455 @Callable(i)
4556 func addOrder (orderId) = {
4657 let shopAddress = toBase58String(i.caller.bytes)
4758 let pmt = extract(i.payment)
4859 let shippingCosts = pmt.amount
4960 if (isDefined(pmt.assetId))
5061 then throw("Currently you can place orders only with Waves tokens")
5162 else {
5263 let order = getKeyOrder(shopAddress, orderId)
5364 if ((0 >= shippingCosts))
5465 then throw("You cannot create an order with shipping costs lower than 0")
55- else if ((getValueOfOrder(order) != NONE))
66+ else if ((getValueShopAddressOfOrder(order) != NONE))
5667 then throw("An order with the same id already exists")
5768 else WriteSet([DataEntry(getKeyOrderShopAddress(order), shopAddress), DataEntry(getKeyOrderShippingCosts(order), shippingCosts), DataEntry(getKeyOrderOrderId(order), orderId), DataEntry(getKeyOrderCourier(order), NONE), DataEntry(getKeyOrderIsAccepted(order), false), DataEntry(getKeyOrderIsInDelivery(order), false), DataEntry(getKeyOrderIsDelivered(order), false)])
5869 }
70+ }
71+
72+
73+
74+@Callable(i)
75+func setOrderIsAccepted (shopAddress,orderId) = {
76+ let order = getKeyOrder(shopAddress, orderId)
77+ if ((getValueShopAddressOfOrder(order) != shopAddress))
78+ then throw("The requested order does not exist")
79+ else if ((getValueIsAccepteOfOrder(order) != false))
80+ then throw("The requested order is no longer available")
81+ else WriteSet([DataEntry(getKeyOrderIsAccepted(order), true)])
5982 }
6083
6184
6285 @Verifier(tx)
6386 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
6487

github/deemru/w8io/026f985 
20.51 ms