tx · Azyizy1Nf7tM6N2arVLFUi9UdgvcXBecJi54znTCyAcG 3N5hQm6twVhFgf8mKBkJpNhxwcBnpZsPyni: -0.01000000 Waves 2019.08.19 13:37 [637919] smart account 3N5hQm6twVhFgf8mKBkJpNhxwcBnpZsPyni > SELF 0.00000000 Waves
{ "type": 13, "id": "Azyizy1Nf7tM6N2arVLFUi9UdgvcXBecJi54znTCyAcG", "fee": 1000000, "feeAssetId": null, "timestamp": 1566211073775, "version": 1, "sender": "3N5hQm6twVhFgf8mKBkJpNhxwcBnpZsPyni", "senderPublicKey": "5qEf6v7n4Cm55KWEaSs76eUft3uwLezLoJeBrf6u9BKE", "proofs": [ "5qpUP1htxHj6dC13hFrSSVxieScH1PMCzKZLH2fpfe2Pem4q46DKFW63LqKnrL2234URYXfTZGoNFAaUVh3TZTeQ" ], "script": "base64:AAIDAAAAAAAAAAAAAAAGAAAAAAhvd25lcktleQIAAAAFb3duZXIAAAAACndhdmVzVG9rZW4FAAAABHVuaXQBAAAACXBheW1lbnRPZgAAAAEAAAADa2V5CQABLAAAAAICAAAAC3BheW1lbnRfb2ZfBQAAAANrZXkBAAAACHN0YXR1c09mAAAAAQAAAANrZXkJAAEsAAAAAgIAAAAKc3RhdHVzX29mXwUAAAADa2V5AAAAAAVvd25lcgkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABCQEAAAAFdmFsdWUAAAABCQAEHQAAAAIFAAAABHRoaXMFAAAACG93bmVyS2V5AQAAABBpc1BheW1lbnRQZW5kaW5nAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwkBAAAACHN0YXR1c09mAAAAAQUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXMFAAAAByRtYXRjaDAJAAAAAAAAAgUAAAABcwIAAAAHcGVuZGluZwcAAAAEAAAAAWkBAAAABGluaXQAAAACAAAABW93bmVyAAAABXRva2VuAwkAAA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AUAAAAKd2F2ZXNUb2tlbgUAAAADbmlsCQAAAgAAAAEJAAEsAAAAAgIAAAAYY2FuIG9ubHkgV0FWRVMsIGJ1dCBnb3QgCQACWAAAAAEJAQAAAAV2YWx1ZQAAAAEIBQAAAAFhAAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAncGF5bWVudCBpbiBhc3NldFRva2VucyBtdXN0IGJlIGF0dGFjaGVkCQAAAgAAAAECAAAAKE9yZGVyIGFscmVhZHkgaGFzIGJlZW4gcGF5ZWQgb3IgcmVqZWN0ZWQAAAABaQEAAAAGcmVqZWN0AAAAAQAAAANrZXkDCQEAAAAQaXNQYXltZW50UGVuZGluZwAAAAEFAAAAA2tleQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAACHN0YXR1c09mAAAAAQUAAAADa2V5AgAAAAhyZWplY3RlZAUAAAADbmlsCQAAAgAAAAECAAAAKE9yZGVyIGFscmVhZHkgaGFzIGJlZW4gcGF5ZWQgb3IgcmVqZWN0ZWQAAAAAu/nD7g==", "chainId": 84, "height": 637919, "spentComplexity": 0 } View: original | compacted Prev: none Next: 3e6Bga7CzLMkTJuXavTNXRLmdY1SgkMogbavgDxf38r1 Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let ownerKey = "owner" | |
5 | + | ||
6 | + | let wavesToken = unit | |
7 | + | ||
8 | + | func paymentOf (key) = ("payment_of_" + key) | |
9 | + | ||
10 | + | ||
11 | + | func statusOf (key) = ("status_of_" + key) | |
12 | + | ||
13 | + | ||
14 | + | let owner = addressFromStringValue(value(getString(this, ownerKey))) | |
15 | + | ||
16 | + | func isPaymentPending (key) = match getString(this, statusOf(key)) { | |
17 | + | case s: String => | |
18 | + | (s == "pending") | |
19 | + | case _ => | |
20 | + | false | |
21 | + | } | |
22 | + | ||
23 | + | ||
24 | + | @Callable(i) | |
25 | + | func init (owner,token) = if ((i.caller == this)) | |
26 | + | then WriteSet([DataEntry(ownerKey, owner)]) | |
27 | + | else throw("only dapp itself can init") | |
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | @Callable(i) | |
32 | + | func setWaitToPayment (key,payment) = WriteSet([DataEntry(statusOf(key), "pending"), DataEntry(paymentOf(key), payment)]) | |
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | @Callable(i) | |
37 | + | func pay (key) = if (isPaymentPending(key)) | |
38 | + | then match i.payment { | |
39 | + | case a: AttachedPayment => | |
40 | + | if ((a.assetId == wavesToken)) | |
41 | + | then { | |
42 | + | let datas = WriteSet([DataEntry(statusOf(key), "paid")]) | |
43 | + | let payment = getIntegerValue(this, "payment_of_test") | |
44 | + | ScriptResult(datas, TransferSet([ScriptTransfer(owner, payment, wavesToken)])) | |
45 | + | } | |
46 | + | else throw(("can only WAVES, but got " + toBase58String(value(a.assetId)))) | |
47 | + | case _ => | |
48 | + | throw("payment in assetTokens must be attached") | |
49 | + | } | |
50 | + | else throw("Order already has been payed or rejected") | |
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | @Callable(i) | |
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 | + | ||
59 | + |
github/deemru/w8io/026f985 17.02 ms ◑