tx · FBqnYqzcxC2mDudFec3gJsqkbRatDSPat3S3EjNoDiTz 3MpniGh4Ab64nzX6AXtoL5tzeC5EwSyHuaq: -0.01400000 Waves 2022.01.11 01:54 [1873466] smart account 3MpniGh4Ab64nzX6AXtoL5tzeC5EwSyHuaq > SELF 0.00000000 Waves
{ "type": 13, "id": "FBqnYqzcxC2mDudFec3gJsqkbRatDSPat3S3EjNoDiTz", "fee": 1400000, "feeAssetId": null, "timestamp": 1641855266040, "version": 2, "chainId": 84, "sender": "3MpniGh4Ab64nzX6AXtoL5tzeC5EwSyHuaq", "senderPublicKey": "HxF3FdYr3sD3ju9Y1wL4d5kmRtKJGhgSSYQkCyo78xGn", "proofs": [ "2yp7TKzwCESFLG5aKcRgBZnYBfZwziLYkJE3P9Y4s29Lwhg1kjh8wZJwVPD4swg3yzBoEQA18qWkRCxYf6SVs9b" ], "script": "base64:AAIFAAAAAAAAAJgIAhIDCgEIEgASAwoBCBoSCgFhEg1hY2NvdW50UHViS2V5GgYKAWISAWkaCQoBYxIEbmFtZRoMCgFkEgdwYXltZW50GhEKAWUSDGN1c3RvbWVyQWRkchoKCgFmEgVwcmljZRoMCgFnEgckbWF0Y2gwGgYKAWgSAXQaCAoBaRIDa2V5GgcKAWoSAnR4GgsKAWsSBnZlcmlmeQAAAAEAAAAAAWEBAAAAIPvhzx/EchOaJzhclRFzOZsCtGy7ySpoi0epc7fB20UHAAAAAwAAAAFiAQAAAAhwdXJjaGFzZQAAAAEAAAABYwQAAAABZAkAAZEAAAACCAUAAAABYgAAAAhwYXltZW50cwAAAAAAAAAAAAMJAQAAAAlpc0RlZmluZWQAAAABBQAAAAFjAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAFkAAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAYT25seSBzaG91bGQgcGF5IGluIHdhdmVzBAAAAAFlCQACWAAAAAEICAUAAAABYgAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAAWYEAAAAAWcJAAQaAAAAAgUA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RW50cnkAAAACAgAAABNpdGVtX0JfY291cG9uX3ByaWNlAAAAAAACYloABQAAAANuaWwJAAACAAAAAQIAAAAZT25seSBvd25lciBjYW4gc2V0IHByaWNlcwAAAAFiAQAAAAtkZWxldGVFbnRyeQAAAAEAAAABaQMJAAAAAAAAAggFAAAAAWIAAAAPY2FsbGVyUHVibGljS2V5BQAAAAFhCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAAAWkFAAAAA25pbAkAAAIAAAABAgAAAB1Pbmx5IG93bmVyIGNhbiBkZWxldGUgZW50cmllcwAAAAEAAAABagEAAAABawAAAAAJAAH0AAAAAwgFAAAAAWoAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAFqAAAABnByb29mcwAAAAAAAAAAAAgFAAAAAWoAAAAPc2VuZGVyUHVibGljS2V5y6WUgA==", "height": 1873466, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 73GEufqkgET8UiCV3ih7eny1za32Q6iZbVZNve4yKe5T Next: DFYHaEJBitYpWA5xzEsX8CanzEACaw2t63Xp1fMLCBtg Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | let a = base58'HxF3FdYr3sD3ju9Y1wL4d5kmRtKJGhgSSYQkCyo78xGn' | |
5 | 5 | ||
6 | 6 | @Callable(b) | |
7 | - | func purchase () = { | |
8 | - | let c = b.payments[0] | |
9 | - | if (isDefined(c.assetId)) | |
10 | - | then throw("Only should pay in waves") | |
11 | - | else { | |
12 | - | let d = toBase58String(b.caller.bytes) | |
13 | - | let e = { | |
14 | - | let f = getInteger(this, "item_A_coupon_price") | |
15 | - | if ($isInstanceOf(f, "Int")) | |
16 | - | then { | |
17 | - | let g = f | |
18 | - | g | |
19 | - | } | |
20 | - | else 0 | |
7 | + | func purchase (c) = { | |
8 | + | let d = b.payments[0] | |
9 | + | if (isDefined(c)) | |
10 | + | then if (isDefined(d.assetId)) | |
11 | + | then throw("Only should pay in waves") | |
12 | + | else { | |
13 | + | let e = toBase58String(b.caller.bytes) | |
14 | + | let f = { | |
15 | + | let g = getInteger(this, (("item_" + c) + "_coupon_price")) | |
16 | + | if ($isInstanceOf(g, "Int")) | |
17 | + | then { | |
18 | + | let h = g | |
19 | + | h | |
20 | + | } | |
21 | + | else 0 | |
22 | + | } | |
23 | + | if ((f != 0)) | |
24 | + | then if ((d.amount > f)) | |
25 | + | then throw(("payment cant be higher than price" + toString(f))) | |
26 | + | else if ((f > d.amount)) | |
27 | + | then throw(("payment cant be less than price: " + toString(f))) | |
28 | + | else [StringEntry(((("status:purchase_item_" + c) + "_customer_") + e), "confirmed"), IntegerEntry(((("price:purchase_item_" + c) + "_customer_") + e), f)] | |
29 | + | else throw("Please enter valid coupon name: A or B") | |
21 | 30 | } | |
22 | - | if ((c.amount > e)) | |
23 | - | then throw(("payment cant be higher than price" + toString(e))) | |
24 | - | else if ((e > c.amount)) | |
25 | - | then throw(("payment cant be less than price: " + toString(e))) | |
26 | - | else [StringEntry(("status:purchase_item_A_customer_" + d), "confirmed"), IntegerEntry(("price:purchase_item_A_customer_" + d), e)] | |
27 | - | } | |
31 | + | else throw("Coupon name should be present") | |
28 | 32 | } | |
29 | 33 | ||
30 | 34 | ||
31 | 35 | ||
32 | 36 | @Callable(b) | |
33 | 37 | func setPrices () = if ((b.callerPublicKey == a)) | |
34 | - | then [IntegerEntry("item_A_coupon_price", 30000000)] | |
38 | + | then [IntegerEntry("item_A_coupon_price", 30000000), IntegerEntry("item_B_coupon_price", 40000000)] | |
35 | 39 | else throw("Only owner can set prices") | |
36 | 40 | ||
37 | 41 | ||
38 | 42 | ||
39 | 43 | @Callable(b) | |
40 | - | func deleteEntry ( | |
41 | - | then [DeleteEntry( | |
44 | + | func deleteEntry (i) = if ((b.callerPublicKey == a)) | |
45 | + | then [DeleteEntry(i)] | |
42 | 46 | else throw("Only owner can delete entries") | |
43 | 47 | ||
44 | 48 | ||
45 | - | @Verifier( | |
46 | - | func | |
49 | + | @Verifier(j) | |
50 | + | func k () = sigVerify(j.bodyBytes, j.proofs[0], j.senderPublicKey) | |
47 | 51 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'HxF3FdYr3sD3ju9Y1wL4d5kmRtKJGhgSSYQkCyo78xGn' | |
5 | 5 | ||
6 | 6 | @Callable(b) | |
7 | - | func purchase () = { | |
8 | - | let c = b.payments[0] | |
9 | - | if (isDefined(c.assetId)) | |
10 | - | then throw("Only should pay in waves") | |
11 | - | else { | |
12 | - | let d = toBase58String(b.caller.bytes) | |
13 | - | let e = { | |
14 | - | let f = getInteger(this, "item_A_coupon_price") | |
15 | - | if ($isInstanceOf(f, "Int")) | |
16 | - | then { | |
17 | - | let g = f | |
18 | - | g | |
19 | - | } | |
20 | - | else 0 | |
7 | + | func purchase (c) = { | |
8 | + | let d = b.payments[0] | |
9 | + | if (isDefined(c)) | |
10 | + | then if (isDefined(d.assetId)) | |
11 | + | then throw("Only should pay in waves") | |
12 | + | else { | |
13 | + | let e = toBase58String(b.caller.bytes) | |
14 | + | let f = { | |
15 | + | let g = getInteger(this, (("item_" + c) + "_coupon_price")) | |
16 | + | if ($isInstanceOf(g, "Int")) | |
17 | + | then { | |
18 | + | let h = g | |
19 | + | h | |
20 | + | } | |
21 | + | else 0 | |
22 | + | } | |
23 | + | if ((f != 0)) | |
24 | + | then if ((d.amount > f)) | |
25 | + | then throw(("payment cant be higher than price" + toString(f))) | |
26 | + | else if ((f > d.amount)) | |
27 | + | then throw(("payment cant be less than price: " + toString(f))) | |
28 | + | else [StringEntry(((("status:purchase_item_" + c) + "_customer_") + e), "confirmed"), IntegerEntry(((("price:purchase_item_" + c) + "_customer_") + e), f)] | |
29 | + | else throw("Please enter valid coupon name: A or B") | |
21 | 30 | } | |
22 | - | if ((c.amount > e)) | |
23 | - | then throw(("payment cant be higher than price" + toString(e))) | |
24 | - | else if ((e > c.amount)) | |
25 | - | then throw(("payment cant be less than price: " + toString(e))) | |
26 | - | else [StringEntry(("status:purchase_item_A_customer_" + d), "confirmed"), IntegerEntry(("price:purchase_item_A_customer_" + d), e)] | |
27 | - | } | |
31 | + | else throw("Coupon name should be present") | |
28 | 32 | } | |
29 | 33 | ||
30 | 34 | ||
31 | 35 | ||
32 | 36 | @Callable(b) | |
33 | 37 | func setPrices () = if ((b.callerPublicKey == a)) | |
34 | - | then [IntegerEntry("item_A_coupon_price", 30000000)] | |
38 | + | then [IntegerEntry("item_A_coupon_price", 30000000), IntegerEntry("item_B_coupon_price", 40000000)] | |
35 | 39 | else throw("Only owner can set prices") | |
36 | 40 | ||
37 | 41 | ||
38 | 42 | ||
39 | 43 | @Callable(b) | |
40 | - | func deleteEntry ( | |
41 | - | then [DeleteEntry( | |
44 | + | func deleteEntry (i) = if ((b.callerPublicKey == a)) | |
45 | + | then [DeleteEntry(i)] | |
42 | 46 | else throw("Only owner can delete entries") | |
43 | 47 | ||
44 | 48 | ||
45 | - | @Verifier( | |
46 | - | func | |
49 | + | @Verifier(j) | |
50 | + | func k () = sigVerify(j.bodyBytes, j.proofs[0], j.senderPublicKey) | |
47 | 51 |
github/deemru/w8io/169f3d6 29.26 ms ◑![]()