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:AAIDAAAAAAAAAA0IARIDCgEIEgQKAggIAAAADQAAAAAETk9ORQIAAAAETk9ORQEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQEAAAAPZ2V0Qm9vbGVhbkJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQbAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAdCb29sZWFuBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FAQAAAAtnZXRLZXlPcmRlcgAAAAIAAAALc2hvcEFkZHJlc3MAAAAHb3JkZXJJZAQAAAAVc2hvcEFkZHJlc3NBbmRPcmRlcklkCQABLAAAAAIFAAAAC3Nob3BBZGRyZXNzBQAAAAdvcmRlcklkCQABLAAAAAICAAAABm9yZGVyX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AnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tledPQKfo=",
"height": 1202965,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: HMCGqz6S9msHiYVboZp6usfXyahtwVGgXJppsyeDV1Qk
Next: FKPzCgaWW9AqADAvfiqvjopbXH4exSxjaGjYbMhzCApW
Diff:
Old | New | | Differences |
---|
5 | 5 | | |
---|
6 | 6 | | func getStringByKey (key) = match getString(this, key) { |
---|
7 | 7 | | case a: String => |
---|
| 8 | + | a |
---|
| 9 | + | case _ => |
---|
| 10 | + | NONE |
---|
| 11 | + | } |
---|
| 12 | + | |
---|
| 13 | + | |
---|
| 14 | + | func getBooleanByKey (key) = match getBoolean(this, key) { |
---|
| 15 | + | case a: Boolean => |
---|
8 | 16 | | a |
---|
9 | 17 | | case _ => |
---|
10 | 18 | | NONE |
---|
|
38 | 46 | | func getKeyOrderIsDelivered (order) = (order + "_isDelivered") |
---|
39 | 47 | | |
---|
40 | 48 | | |
---|
41 | | - | func getValueOfOrder (order) = getStringByKey(getKeyOrderShopAddress(order)) |
---|
| 49 | + | func getValueShopAddressOfOrder (order) = getStringByKey(getKeyOrderShopAddress(order)) |
---|
| 50 | + | |
---|
| 51 | + | |
---|
| 52 | + | func getValueIsAccepteOfOrder (order) = getBooleanByKey(getKeyOrderIsAccepted(order)) |
---|
42 | 53 | | |
---|
43 | 54 | | |
---|
44 | 55 | | @Callable(i) |
---|
|
52 | 63 | | let order = getKeyOrder(shopAddress, orderId) |
---|
53 | 64 | | if ((0 >= shippingCosts)) |
---|
54 | 65 | | 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)) |
---|
56 | 67 | | then throw("An order with the same id already exists") |
---|
57 | 68 | | 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)]) |
---|
58 | 69 | | } |
---|
| 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)]) |
---|
59 | 82 | | } |
---|
60 | 83 | | |
---|
61 | 84 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let NONE = "NONE" |
---|
5 | 5 | | |
---|
6 | 6 | | func getStringByKey (key) = match getString(this, key) { |
---|
7 | 7 | | case a: String => |
---|
| 8 | + | a |
---|
| 9 | + | case _ => |
---|
| 10 | + | NONE |
---|
| 11 | + | } |
---|
| 12 | + | |
---|
| 13 | + | |
---|
| 14 | + | func getBooleanByKey (key) = match getBoolean(this, key) { |
---|
| 15 | + | case a: Boolean => |
---|
8 | 16 | | a |
---|
9 | 17 | | case _ => |
---|
10 | 18 | | NONE |
---|
11 | 19 | | } |
---|
12 | 20 | | |
---|
13 | 21 | | |
---|
14 | 22 | | func getKeyOrder (shopAddress,orderId) = { |
---|
15 | 23 | | let shopAddressAndOrderId = (shopAddress + orderId) |
---|
16 | 24 | | ("order_" + toBase58String(sha256(toBytes(shopAddressAndOrderId)))) |
---|
17 | 25 | | } |
---|
18 | 26 | | |
---|
19 | 27 | | |
---|
20 | 28 | | func getKeyOrderShopAddress (order) = (order + "_shop") |
---|
21 | 29 | | |
---|
22 | 30 | | |
---|
23 | 31 | | func getKeyOrderShippingCosts (order) = (order + "_shipping") |
---|
24 | 32 | | |
---|
25 | 33 | | |
---|
26 | 34 | | func getKeyOrderOrderId (order) = (order + "_orderId") |
---|
27 | 35 | | |
---|
28 | 36 | | |
---|
29 | 37 | | func getKeyOrderCourier (order) = (order + "_courierId") |
---|
30 | 38 | | |
---|
31 | 39 | | |
---|
32 | 40 | | func getKeyOrderIsAccepted (order) = (order + "_isAccepted") |
---|
33 | 41 | | |
---|
34 | 42 | | |
---|
35 | 43 | | func getKeyOrderIsInDelivery (order) = (order + "_isInDelivery") |
---|
36 | 44 | | |
---|
37 | 45 | | |
---|
38 | 46 | | func getKeyOrderIsDelivered (order) = (order + "_isDelivered") |
---|
39 | 47 | | |
---|
40 | 48 | | |
---|
41 | | - | func getValueOfOrder (order) = getStringByKey(getKeyOrderShopAddress(order)) |
---|
| 49 | + | func getValueShopAddressOfOrder (order) = getStringByKey(getKeyOrderShopAddress(order)) |
---|
| 50 | + | |
---|
| 51 | + | |
---|
| 52 | + | func getValueIsAccepteOfOrder (order) = getBooleanByKey(getKeyOrderIsAccepted(order)) |
---|
42 | 53 | | |
---|
43 | 54 | | |
---|
44 | 55 | | @Callable(i) |
---|
45 | 56 | | func addOrder (orderId) = { |
---|
46 | 57 | | let shopAddress = toBase58String(i.caller.bytes) |
---|
47 | 58 | | let pmt = extract(i.payment) |
---|
48 | 59 | | let shippingCosts = pmt.amount |
---|
49 | 60 | | if (isDefined(pmt.assetId)) |
---|
50 | 61 | | then throw("Currently you can place orders only with Waves tokens") |
---|
51 | 62 | | else { |
---|
52 | 63 | | let order = getKeyOrder(shopAddress, orderId) |
---|
53 | 64 | | if ((0 >= shippingCosts)) |
---|
54 | 65 | | 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)) |
---|
56 | 67 | | then throw("An order with the same id already exists") |
---|
57 | 68 | | 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)]) |
---|
58 | 69 | | } |
---|
| 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)]) |
---|
59 | 82 | | } |
---|
60 | 83 | | |
---|
61 | 84 | | |
---|
62 | 85 | | @Verifier(tx) |
---|
63 | 86 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
64 | 87 | | |
---|