tx · CHewGNZ7JCerPu7hM8DY4Y35WUCdMU72wUEBfZCPUwLn
3NARWzNaChSw8Mpf8CZYavL4QWQvk3KUU8b: -0.01400000 Waves
2019.08.17 19:03 [635332] smart account 3NARWzNaChSw8Mpf8CZYavL4QWQvk3KUU8b > SELF 0.00000000 Waves
{
"type": 13,
"id": "CHewGNZ7JCerPu7hM8DY4Y35WUCdMU72wUEBfZCPUwLn",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1566057845509,
"version": 1,
"sender": "3NARWzNaChSw8Mpf8CZYavL4QWQvk3KUU8b",
"senderPublicKey": "848RkjzRcJfyWuhGbq8NUFoLMpeDW8NbKu36H3SouHzF",
"proofs": [
"57DVv7mtXEqwXLj5fyRfa2xhg65u59MJBM73Zf6f2DMGvbXiryBuWUFeWRtV9SPrYBbWmvbLT82JNzj2e3UL5rcB"
],
"script": "base64:AAIDAAAAAAAAAAAAAAAGAAAAAAhvd25lcktleQIAAAAFb3duZXIAAAAACndhdmVzVG9rZW4FAAAABHVuaXQBAAAACXBheW1lbnRPZgAAAAEAAAADa2V5CQABLAAAAAICAAAAC3BheW1lbnRfb2ZfBQAAAANrZXkBAAAACHN0YXR1c09mAAAAAQAAAANrZXkJAAEsAAAAAgIAAAAKc3RhdHVzX29mXwUAAAADa2V5AAAAAAVvd25lcgkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABCQEAAAAFdmFsdWUAAAABCQAEHQAAAAIFAAAABHRoaXMFAAAACG93bmVyS2V5AQAAABBpc1BheW1lbnRQZW5kaW5nAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwkBAAAACHN0YXR1c09mAAAAAQUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXMFAAAAByRtYXRjaDAJAAAAAAAAAgUAAAABcwIAAAAHcGVuZGluZwcAAAAEAAAAAWkBAAAABGluaXQAAAACAAAABW93bmVyA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AAAAFb3duZXIFAAAAB3BheW1lbnQFAAAACndhdmVzVG9rZW4FAAAAA25pbAkAAAIAAAABCQABLAAAAAICAAAAGGNhbiBvbmx5IFdBVkVTLCBidXQgZ290IAkAAlgAAAABCQEAAAAFdmFsdWUAAAABCAUAAAABYQAAAAdhc3NldElkCQAAAgAAAAECAAAAJ3BheW1lbnQgaW4gYXNzZXRUb2tlbnMgbXVzdCBiZSBhdHRhY2hlZAkAAAIAAAABAgAAAChPcmRlciBhbHJlYWR5IGhhcyBiZWVuIHBheWVkIG9yIHJlamVjdGVkAAAAAWkBAAAABnJlamVjdAAAAAEAAAADa2V5AwkBAAAAEGlzUGF5bWVudFBlbmRpbmcAAAABBQAAAANrZXkJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAAhzdGF0dXNPZgAAAAEFAAAAA2tleQIAAAAIcmVqZWN0ZWQFAAAAA25pbAkAAAIAAAABAgAAAChPcmRlciBhbHJlYWR5IGhhcyBiZWVuIHBheWVkIG9yIHJlamVjdGVkAAAAAIUUQ6Q=",
"chainId": 84,
"height": 635332,
"spentComplexity": 0
}
View: original | compacted
Prev: EWEKbcyBjR9JBiJ4JBfqQyC4NKA4HL6wFJzQ9Va9zCdY
Next: BU9GXXcaaYGgXHsLbVRQuJyTZLdZDgvQrPiH8uh4E3Fh
Diff:
Old | New | | Differences |
---|
34 | 34 | | |
---|
35 | 35 | | |
---|
36 | 36 | | @Callable(i) |
---|
37 | | - | func pay (key) = if (!(isPaymentPending(key))) |
---|
38 | | - | then throw("Order already has been payed or rejected") |
---|
39 | | - | else match i.payment { |
---|
| 37 | + | func pay (key) = if (isPaymentPending(key)) |
---|
| 38 | + | then match i.payment { |
---|
40 | 39 | | case a: AttachedPayment => |
---|
41 | 40 | | if ((a.assetId == wavesToken)) |
---|
42 | 41 | | then { |
---|
|
48 | 47 | | case _ => |
---|
49 | 48 | | throw("payment in assetTokens must be attached") |
---|
50 | 49 | | } |
---|
| 50 | + | else throw("Order already has been payed or rejected") |
---|
51 | 51 | | |
---|
52 | 52 | | |
---|
53 | 53 | | |
---|
54 | 54 | | @Callable(i) |
---|
55 | | - | func reject (key) = if (!(isPaymentPending(key))) |
---|
56 | | - | then throw("Order already has been payed or rejected") |
---|
57 | | - | else WriteSet([DataEntry(statusOf(key), "rejected")]) |
---|
| 55 | + | func reject (key) = if (isPaymentPending(key)) |
---|
| 56 | + | then WriteSet([DataEntry(statusOf(key), "rejected")]) |
---|
| 57 | + | else throw("Order already has been payed or rejected") |
---|
58 | 58 | | |
---|
59 | 59 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let ownerKey = "owner" |
---|
5 | 5 | | |
---|
6 | 6 | | let wavesToken = unit |
---|
7 | 7 | | |
---|
8 | 8 | | func paymentOf (key) = ("payment_of_" + key) |
---|
9 | 9 | | |
---|
10 | 10 | | |
---|
11 | 11 | | func statusOf (key) = ("status_of_" + key) |
---|
12 | 12 | | |
---|
13 | 13 | | |
---|
14 | 14 | | let owner = addressFromStringValue(value(getString(this, ownerKey))) |
---|
15 | 15 | | |
---|
16 | 16 | | func isPaymentPending (key) = match getString(this, statusOf(key)) { |
---|
17 | 17 | | case s: String => |
---|
18 | 18 | | (s == "pending") |
---|
19 | 19 | | case _ => |
---|
20 | 20 | | false |
---|
21 | 21 | | } |
---|
22 | 22 | | |
---|
23 | 23 | | |
---|
24 | 24 | | @Callable(i) |
---|
25 | 25 | | func init (owner,token) = if ((i.caller == this)) |
---|
26 | 26 | | then WriteSet([DataEntry(ownerKey, owner)]) |
---|
27 | 27 | | else throw("only dapp itself can init") |
---|
28 | 28 | | |
---|
29 | 29 | | |
---|
30 | 30 | | |
---|
31 | 31 | | @Callable(i) |
---|
32 | 32 | | func setWaitToPayment (key,payment) = WriteSet([DataEntry(statusOf(key), "pending"), DataEntry(paymentOf(key), payment)]) |
---|
33 | 33 | | |
---|
34 | 34 | | |
---|
35 | 35 | | |
---|
36 | 36 | | @Callable(i) |
---|
37 | | - | func pay (key) = if (!(isPaymentPending(key))) |
---|
38 | | - | then throw("Order already has been payed or rejected") |
---|
39 | | - | else match i.payment { |
---|
| 37 | + | func pay (key) = if (isPaymentPending(key)) |
---|
| 38 | + | then match i.payment { |
---|
40 | 39 | | case a: AttachedPayment => |
---|
41 | 40 | | if ((a.assetId == wavesToken)) |
---|
42 | 41 | | then { |
---|
43 | 42 | | let datas = WriteSet([DataEntry(statusOf(key), "paid")]) |
---|
44 | 43 | | let payment = getIntegerValue(this, paymentOf(key)) |
---|
45 | 44 | | ScriptResult(datas, TransferSet([ScriptTransfer(owner, payment, wavesToken)])) |
---|
46 | 45 | | } |
---|
47 | 46 | | else throw(("can only WAVES, but got " + toBase58String(value(a.assetId)))) |
---|
48 | 47 | | case _ => |
---|
49 | 48 | | throw("payment in assetTokens must be attached") |
---|
50 | 49 | | } |
---|
| 50 | + | else throw("Order already has been payed or rejected") |
---|
51 | 51 | | |
---|
52 | 52 | | |
---|
53 | 53 | | |
---|
54 | 54 | | @Callable(i) |
---|
55 | | - | func reject (key) = if (!(isPaymentPending(key))) |
---|
56 | | - | then throw("Order already has been payed or rejected") |
---|
57 | | - | else WriteSet([DataEntry(statusOf(key), "rejected")]) |
---|
| 55 | + | func reject (key) = if (isPaymentPending(key)) |
---|
| 56 | + | then WriteSet([DataEntry(statusOf(key), "rejected")]) |
---|
| 57 | + | else throw("Order already has been payed or rejected") |
---|
58 | 58 | | |
---|
59 | 59 | | |
---|