tx · Bkp1LvPAzApusNiETzoGgDuUZDy4PShDeU8TbNfusDJd
3N1i8QSoM6oL6gxecKvXQ672yRiLt44HgXz: -0.01400000 Waves
2019.10.26 00:37 [736191] smart account 3N1i8QSoM6oL6gxecKvXQ672yRiLt44HgXz > SELF 0.00000000 Waves
{
"type": 13,
"id": "Bkp1LvPAzApusNiETzoGgDuUZDy4PShDeU8TbNfusDJd",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1572039439661,
"version": 1,
"sender": "3N1i8QSoM6oL6gxecKvXQ672yRiLt44HgXz",
"senderPublicKey": "6vvHscsLo3kap5Q2GDgkBUKrk8ToJaoj2shtCDoo22uz",
"proofs": [
"5UHBvnS9WiY88ViYFJH4Fd4VU81RDcmVE3JjWiyqyiAsB7hXe5zgnko8avzgkihEUTqS4VzPy1KbR7EUYG7JhHeG",
"4EYNQQvtK46wTxpJuVHCiKeeNRHbdwKkYorBMK2BXjY2B4RzSC4SJRW5aCQaGebB7YrueV48RkzTyDXPKw1pi7yc"
],
"script": "base64:AAIDAAAAAAAAAAQIARIAAAAAAgAAAAAHYVB1YktleQEAAAAgUdIRXgyR58fEloqAa1eXbZ1iwwaUgjm2TsMUtAj2tjAAAAAAB2NQdWJLZXkBAAAAIF+TDe+3RmBRKdAqjc19Nju2o4I02GMD8qcdXxxrnLFgAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAAApvbmx5IFdBVkVTBAAAAA9jdXN0b21lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAFcHJpY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwIAAAATaXRlbV9BX2NvdXBvbl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAwkAAGYAAAACBQAAAAVwcmljZQgFAAAAA3BtdAAAAAZhbW91bnQJAAACAAAAAQIAAAAEbGVzcwMJAABmAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlCQAAAgAAAAECAAAAB2dyZWF0ZXIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAgc3RhdHVzOnB1cmNoYXNlX2l0ZW1fQV9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwIAAAAJY29uZmlybWVkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAAH3ByaWNlOnB1cmNoYXNlX2l0ZW1fQV9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwUAAAAFcHJpY2UFAAAAA25pbAAAAACz4OBL",
"chainId": 84,
"height": 736191,
"spentComplexity": 0
}
View: original | compacted
Prev: 85dt9cjSWM9QAwZYBqB5kuYjpccerL2gDXGDvpxNwbWT
Next: 6gx6rmeHWP2tJ5XGsyTYu7WJBmMtHJXcog2MzbohUKX2
Diff:
Old | New | | Differences |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let aPubKey = base58'6WPou58ywAsW3bgC5yrCAPUbj7NbeogxH8cjJB6gRPDH' |
---|
5 | 5 | | |
---|
6 | | - | let bPubKey = base58'6vvHscsLo3kap5Q2GDgkBUKrk8ToJaoj2shtCDoo22uz' |
---|
| 6 | + | let cPubKey = base58'7S5nePywD1ZDbe9VEWphJsC73CGsRRCFV6v2kvtTM3HR' |
---|
7 | 7 | | |
---|
| 8 | + | @Callable(i) |
---|
| 9 | + | func purchase () = { |
---|
| 10 | + | let pmt = extract(i.payment) |
---|
| 11 | + | if (isDefined(pmt.assetId)) |
---|
| 12 | + | then throw("only WAVES") |
---|
| 13 | + | else { |
---|
| 14 | + | let customerAddress = toBase58String(i.caller.bytes) |
---|
| 15 | + | let price = match getInteger(this, "item_A_coupon_price") { |
---|
| 16 | + | case a: Int => |
---|
| 17 | + | a |
---|
| 18 | + | case _ => |
---|
| 19 | + | 0 |
---|
| 20 | + | } |
---|
| 21 | + | if ((price > pmt.amount)) |
---|
| 22 | + | then throw("less") |
---|
| 23 | + | else if ((pmt.amount > price)) |
---|
| 24 | + | then throw("greater") |
---|
| 25 | + | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)]) |
---|
| 26 | + | } |
---|
| 27 | + | } |
---|
8 | 28 | | |
---|
9 | | - | @Verifier(tx) |
---|
10 | | - | func verify () = { |
---|
11 | | - | let a1 = sigVerify(tx.bodyBytes, tx.proofs[0], aPubKey) |
---|
12 | | - | let a2 = sigVerify(tx.bodyBytes, tx.proofs[1], aPubKey) |
---|
13 | | - | let b1 = sigVerify(tx.bodyBytes, tx.proofs[0], bPubKey) |
---|
14 | | - | let b2 = sigVerify(tx.bodyBytes, tx.proofs[1], bPubKey) |
---|
15 | | - | let aAndB = if (if (if (if (a1) |
---|
16 | | - | then b1 |
---|
17 | | - | else false) |
---|
18 | | - | then true |
---|
19 | | - | else if (a1) |
---|
20 | | - | then b2 |
---|
21 | | - | else false) |
---|
22 | | - | then true |
---|
23 | | - | else if (a2) |
---|
24 | | - | then b1 |
---|
25 | | - | else false) |
---|
26 | | - | then true |
---|
27 | | - | else if (a2) |
---|
28 | | - | then b2 |
---|
29 | | - | else false |
---|
30 | | - | match tx { |
---|
31 | | - | case _ => |
---|
32 | | - | aAndB |
---|
33 | | - | } |
---|
34 | | - | } |
---|
35 | 29 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let aPubKey = base58'6WPou58ywAsW3bgC5yrCAPUbj7NbeogxH8cjJB6gRPDH' |
---|
5 | 5 | | |
---|
6 | | - | let bPubKey = base58'6vvHscsLo3kap5Q2GDgkBUKrk8ToJaoj2shtCDoo22uz' |
---|
| 6 | + | let cPubKey = base58'7S5nePywD1ZDbe9VEWphJsC73CGsRRCFV6v2kvtTM3HR' |
---|
7 | 7 | | |
---|
| 8 | + | @Callable(i) |
---|
| 9 | + | func purchase () = { |
---|
| 10 | + | let pmt = extract(i.payment) |
---|
| 11 | + | if (isDefined(pmt.assetId)) |
---|
| 12 | + | then throw("only WAVES") |
---|
| 13 | + | else { |
---|
| 14 | + | let customerAddress = toBase58String(i.caller.bytes) |
---|
| 15 | + | let price = match getInteger(this, "item_A_coupon_price") { |
---|
| 16 | + | case a: Int => |
---|
| 17 | + | a |
---|
| 18 | + | case _ => |
---|
| 19 | + | 0 |
---|
| 20 | + | } |
---|
| 21 | + | if ((price > pmt.amount)) |
---|
| 22 | + | then throw("less") |
---|
| 23 | + | else if ((pmt.amount > price)) |
---|
| 24 | + | then throw("greater") |
---|
| 25 | + | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)]) |
---|
| 26 | + | } |
---|
| 27 | + | } |
---|
8 | 28 | | |
---|
9 | | - | @Verifier(tx) |
---|
10 | | - | func verify () = { |
---|
11 | | - | let a1 = sigVerify(tx.bodyBytes, tx.proofs[0], aPubKey) |
---|
12 | | - | let a2 = sigVerify(tx.bodyBytes, tx.proofs[1], aPubKey) |
---|
13 | | - | let b1 = sigVerify(tx.bodyBytes, tx.proofs[0], bPubKey) |
---|
14 | | - | let b2 = sigVerify(tx.bodyBytes, tx.proofs[1], bPubKey) |
---|
15 | | - | let aAndB = if (if (if (if (a1) |
---|
16 | | - | then b1 |
---|
17 | | - | else false) |
---|
18 | | - | then true |
---|
19 | | - | else if (a1) |
---|
20 | | - | then b2 |
---|
21 | | - | else false) |
---|
22 | | - | then true |
---|
23 | | - | else if (a2) |
---|
24 | | - | then b1 |
---|
25 | | - | else false) |
---|
26 | | - | then true |
---|
27 | | - | else if (a2) |
---|
28 | | - | then b2 |
---|
29 | | - | else false |
---|
30 | | - | match tx { |
---|
31 | | - | case _ => |
---|
32 | | - | aAndB |
---|
33 | | - | } |
---|
34 | | - | } |
---|
35 | 29 | | |
---|