tx · 5QvBRmBdu2wVgp5dK7jttrdYLKqT2KUWSBViP6rKHxND
3Mv1jeYrZLjzFaQHVVWKfKoC2Q88zUh4QJi: -0.01400000 Waves
2019.06.23 13:18 [554556] smart account 3Mv1jeYrZLjzFaQHVVWKfKoC2Q88zUh4QJi > SELF 0.00000000 Waves
{
"type": 13,
"id": "5QvBRmBdu2wVgp5dK7jttrdYLKqT2KUWSBViP6rKHxND",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1561285110836,
"version": 1,
"sender": "3Mv1jeYrZLjzFaQHVVWKfKoC2Q88zUh4QJi",
"senderPublicKey": "BHFS1nkiKnpfwyR1K27mC8Hx2QuzDwMwUcNQps6NbD9A",
"proofs": [
"3J2DzKW6CBfTtCm3XnSTPMuavcCC3Fq23bg4LFfxum9EnAyxvwN39FQz4qGUawYbioPCMZs2gcHWDaXWZ7fTRRXy"
],
"script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAAtvd25lclB1YktleQEAAAAgmL56zWUyvLx9tZV2237SbmCmbtk/pa8bE+0Lx9TEWkkAAAABAAAAAWkBAAAACHB1cmNoYXNlAAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIGNhbiB1c2UgV0FWRVMgb25seSBhdCB0aGUgbW9tZW50BAAAAA9jdXN0b21lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAFcHJpY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwIAAAATaXRlbV9BX2NvdXBvbl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAwkAAGYAAAACBQAAAAVwcmljZQgFAAAAA3BtdAAAAAZhbW91bnQJAAACAAAAAQIAAAAucHVyY2hhc2UgYW1vdW50IGNhbm5vdCBiZSBsZXNzIHRoYW4gaXRlbSBwcmljZQMJAABmAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlCQAAAgAAAAECAAAAMHB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgaGlnaGVyIHRoYW4gaXRlbSBwcmljZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAACBzdGF0dXM6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzAgAAAAljb25maXJtZWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAfcHJpY2U6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAALb3duZXJQdWJLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYHprhD1Q==",
"chainId": 84,
"height": 554556,
"spentComplexity": 0
}
View: original | compacted
Prev: HhLvACRF1R8PLBjTj2BNBWGC3uNvyDGRZAyr3hgvQx1Q
Next: none
Diff:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | |
---|
| 4 | + | let ownerPubKey = base58'BHFS1nkiKnpfwyR1K27mC8Hx2QuzDwMwUcNQps6NbD9A' |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func purchase () = { |
---|
|
25 | 25 | | } |
---|
26 | 26 | | |
---|
27 | 27 | | |
---|
| 28 | + | @Verifier(tx) |
---|
| 29 | + | func verify () = match tx { |
---|
| 30 | + | case d: SetScriptTransaction => |
---|
| 31 | + | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey) |
---|
| 32 | + | case d: DataTransaction => |
---|
| 33 | + | true |
---|
| 34 | + | case _ => |
---|
| 35 | + | false |
---|
| 36 | + | } |
---|
| 37 | + | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | |
---|
| 4 | + | let ownerPubKey = base58'BHFS1nkiKnpfwyR1K27mC8Hx2QuzDwMwUcNQps6NbD9A' |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func purchase () = { |
---|
8 | 8 | | let pmt = extract(i.payment) |
---|
9 | 9 | | if (isDefined(pmt.assetId)) |
---|
10 | 10 | | then throw("can use WAVES only at the moment") |
---|
11 | 11 | | else { |
---|
12 | 12 | | let customerAddress = toBase58String(i.caller.bytes) |
---|
13 | 13 | | let price = match getInteger(this, "item_A_coupon_price") { |
---|
14 | 14 | | case a: Int => |
---|
15 | 15 | | a |
---|
16 | 16 | | case _ => |
---|
17 | 17 | | 0 |
---|
18 | 18 | | } |
---|
19 | 19 | | if ((price > pmt.amount)) |
---|
20 | 20 | | then throw("purchase amount cannot be less than item price") |
---|
21 | 21 | | else if ((pmt.amount > price)) |
---|
22 | 22 | | then throw("purchase amount cannot be higher than item price") |
---|
23 | 23 | | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)]) |
---|
24 | 24 | | } |
---|
25 | 25 | | } |
---|
26 | 26 | | |
---|
27 | 27 | | |
---|
| 28 | + | @Verifier(tx) |
---|
| 29 | + | func verify () = match tx { |
---|
| 30 | + | case d: SetScriptTransaction => |
---|
| 31 | + | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey) |
---|
| 32 | + | case d: DataTransaction => |
---|
| 33 | + | true |
---|
| 34 | + | case _ => |
---|
| 35 | + | false |
---|
| 36 | + | } |
---|
| 37 | + | |
---|