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