tx · CSrrtvcWK5PNkVHx3SH6JA5dhUhrLqw3QC1kKeP7Rzay
3N5hQm6twVhFgf8mKBkJpNhxwcBnpZsPyni: -0.01400000 Waves
2019.08.19 14:02 [637947] smart account 3N5hQm6twVhFgf8mKBkJpNhxwcBnpZsPyni > SELF 0.00000000 Waves
{
"type": 13,
"id": "CSrrtvcWK5PNkVHx3SH6JA5dhUhrLqw3QC1kKeP7Rzay",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1566212582933,
"version": 1,
"sender": "3N5hQm6twVhFgf8mKBkJpNhxwcBnpZsPyni",
"senderPublicKey": "5qEf6v7n4Cm55KWEaSs76eUft3uwLezLoJeBrf6u9BKE",
"proofs": [
"2dc65YnvPNEuXmozh1M9C5Vx335HRdYyq8zhBrQ933UWXKs33asnVa5xiWA2exaySp5MFL5HnptLQMV9JQyvwXyf"
],
"script": "base64:AAIDAAAAAAAAAAAAAAAGAAAAAAhvd25lcktleQIAAAAFb3duZXIAAAAACndhdmVzVG9rZW4FAAAABHVuaXQBAAAACXBheW1lbnRPZgAAAAEAAAADa2V5CQABLAAAAAICAAAAC3BheW1lbnRfb2ZfBQAAAANrZXkBAAAACHN0YXR1c09mAAAAAQAAAANrZXkJAAEsAAAAAgIAAAAKc3RhdHVzX29mXwUAAAADa2V5AAAAAAVvd25lcgkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABCQEAAAAFdmFsdWUAAAABCQAEHQAAAAIFAAAABHRoaXMFAAAACG93bmVyS2V5AQAAABBpc1BheW1lbnRQZW5kaW5nAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwkAASwAAAACAgAAAApzdGF0dXNfb2ZfBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABcwUAAAAHJG1hdGNoMAkAAAAAAAACBQAAAAFzAgAAAAdwZW5kaW5nBwAAAAQAAAABaQEAAAAEaW5pdAAAAAIAAA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AAAAQIAAAAYY2FuIG9ubHkgV0FWRVMsIGJ1dCBnb3QgCQAAAgAAAAECAAAAJ3BheW1lbnQgaW4gYXNzZXRUb2tlbnMgbXVzdCBiZSBhdHRhY2hlZAkAAAIAAAABAgAAAChPcmRlciBhbHJlYWR5IGhhcyBiZWVuIHBheWVkIG9yIHJlamVjdGVkAAAAAWkBAAAABnJlamVjdAAAAAEAAAADa2V5AwkBAAAAEGlzUGF5bWVudFBlbmRpbmcAAAABBQAAAANrZXkJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAAhzdGF0dXNPZgAAAAEFAAAAA2tleQIAAAAIcmVqZWN0ZWQFAAAAA25pbAkAAAIAAAABAgAAAChPcmRlciBhbHJlYWR5IGhhcyBiZWVuIHBheWVkIG9yIHJlamVjdGVkAAAAAOZm6YE=",
"chainId": 84,
"height": 637947,
"spentComplexity": 0
}
View: original | compacted
Prev: DuX8EgpzV1G3sXRn1b6eJe21NWVb6TQjr4uWYTv8ZfoL
Next: AhCShtmr2zhZntHaY2xHSQXqikxVL5gc8Xf9MecTM2hV
Diff:
Old | New | | Differences |
---|
34 | 34 | | |
---|
35 | 35 | | |
---|
36 | 36 | | @Callable(i) |
---|
37 | | - | func pay (key) = if (true) |
---|
| 37 | + | func pay (key) = if (isPaymentPending(key)) |
---|
38 | 38 | | then match i.payment { |
---|
39 | 39 | | case a: AttachedPayment => |
---|
40 | 40 | | if ((a.assetId == unit)) |
---|
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, ("status_of_" + 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 (true) |
---|
| 37 | + | func pay (key) = if (isPaymentPending(key)) |
---|
38 | 38 | | then match i.payment { |
---|
39 | 39 | | case a: AttachedPayment => |
---|
40 | 40 | | if ((a.assetId == unit)) |
---|
41 | 41 | | then { |
---|
42 | 42 | | let data = WriteSet([DataEntry("status_of_test", "paid")]) |
---|
43 | 43 | | ScriptResult(data, TransferSet([ScriptTransfer(Address(base58'3N5hQm6twVhFgf8mKBkJpNhxwcBnpZsPyni'), 10, wavesToken)])) |
---|
44 | 44 | | } |
---|
45 | 45 | | else throw("can only WAVES, but got ") |
---|
46 | 46 | | case _ => |
---|
47 | 47 | | throw("payment in assetTokens must be attached") |
---|
48 | 48 | | } |
---|
49 | 49 | | else throw("Order already has been payed or rejected") |
---|
50 | 50 | | |
---|
51 | 51 | | |
---|
52 | 52 | | |
---|
53 | 53 | | @Callable(i) |
---|
54 | 54 | | func reject (key) = if (isPaymentPending(key)) |
---|
55 | 55 | | then WriteSet([DataEntry(statusOf(key), "rejected")]) |
---|
56 | 56 | | else throw("Order already has been payed or rejected") |
---|
57 | 57 | | |
---|
58 | 58 | | |
---|