tx · 7s9rjJt3wjBhPvNiPD8nprCRbfVNQeKXgGMfoATB6Zs6 3MpZuKDPW9Hs8HypbAd7bLxNYULnCYhoXQ4: -0.01000000 Waves 2020.04.05 18:29 [941114] smart account 3MpZuKDPW9Hs8HypbAd7bLxNYULnCYhoXQ4 > SELF 0.00000000 Waves
{ "type": 13, "id": "7s9rjJt3wjBhPvNiPD8nprCRbfVNQeKXgGMfoATB6Zs6", "fee": 1000000, "feeAssetId": null, "timestamp": 1586100654224, "version": 1, "sender": "3MpZuKDPW9Hs8HypbAd7bLxNYULnCYhoXQ4", "senderPublicKey": "Eke9tanjCLXE23D8JJf61cqgdG7TSAH7vUbaiAyymfjT", "proofs": [ "2W4ywDVd1xzv6PuvLtPKQycNfuy6MfjGwPdyKQYjWUTQubSQUULoxTSzhiachXZK15MaXdX2BEbWAT9DQcP1xqfP" ], "script": "base64:AAIDAAAAAAAAABIIARIGCgQICAEIEgYKBAgIAQgAAAAAAAAAAgAAAAFpAQAAAA1hdG9taWNEZXBvc2l0AAAABAAAAA9hdG9taWNSZWNpcGllbnQAAAAQYXRvbWljV2l0aERyYXdJZAAAABRhdG9taWNXaXRoZHJhd0Ftb3VudAAAAA9hdG9taWNEZXBvc2l0SWQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAACXBheW1lbnRJZAgFAAAAA3BtdAAAAAdhc3NldElkBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgkAASwAAAACBQAAAA9hdG9taWNSZWNpcGllbnQFAAAAD2F0b21pY0RlcG9zaXRJZAUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAA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lsCQAAAgAAAAECAAAAD05vdCBBdG9taWMgU3dhcAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAN0dHgFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAA3R0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAA3R0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAN0dHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAANzdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAANzdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAADc3R4AAAAD3NlbmRlclB1YmxpY0tleQZPRauf", "chainId": 84, "height": 941114, "spentComplexity": 0 } View: original | compacted Prev: none Next: CqJFaBQveL8gV74dKZkUfigd1cer1JE791xV2e9WgfkR Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func atomicDeposit (atomicRecipient,atomicWithDrawId,atomicWithdrawAmount,atomicDepositId) = { | |
8 | + | let currentKey = toBase58String(i.caller.bytes) | |
9 | + | let pmt = extract(i.payment) | |
10 | + | let paymentId = pmt.assetId | |
11 | + | let currentAmount = match getInteger(this, ((atomicRecipient + atomicDepositId) + currentKey)) { | |
12 | + | case a: Int => | |
13 | + | a | |
14 | + | case _ => | |
15 | + | 0 | |
16 | + | } | |
17 | + | let newAmount = (currentAmount + pmt.amount) | |
18 | + | WriteSet([DataEntry(((currentKey + atomicDepositId) + atomicRecipient), newAmount), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), atomicWithdrawAmount), DataEntry(((("F_" + currentKey) + atomicWithDrawId) + atomicRecipient), true)]) | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
24 | + | func atomicWithdraw (atomicRecipient,atomicWithDrawId,atomicWithdrawAmount,atomicDepositId) = { | |
25 | + | let currentKey = toBase58String(i.caller.bytes) | |
26 | + | let assetId = fromBase58String(atomicWithDrawId) | |
27 | + | let myDepositAmount = match getInteger(this, ((currentKey + atomicDepositId) + atomicRecipient)) { | |
28 | + | case a: Int => | |
29 | + | a | |
30 | + | case _ => | |
31 | + | 0 | |
32 | + | } | |
33 | + | let myRequestAmount = match getInteger(this, ((currentKey + atomicWithDrawId) + atomicRecipient)) { | |
34 | + | case a: Int => | |
35 | + | a | |
36 | + | case _ => | |
37 | + | 0 | |
38 | + | } | |
39 | + | let recipientDeposit = match getInteger(this, ((atomicRecipient + atomicWithDrawId) + currentKey)) { | |
40 | + | case a: Int => | |
41 | + | a | |
42 | + | case _ => | |
43 | + | 0 | |
44 | + | } | |
45 | + | let recipientRequest = match getInteger(this, ((atomicRecipient + atomicDepositId) + currentKey)) { | |
46 | + | case a: Int => | |
47 | + | a | |
48 | + | case _ => | |
49 | + | 0 | |
50 | + | } | |
51 | + | let atomicFinish = match getBoolean(this, ((("F_" + currentKey) + atomicWithDrawId) + atomicRecipient)) { | |
52 | + | case a: Boolean => | |
53 | + | a | |
54 | + | case _ => | |
55 | + | false | |
56 | + | } | |
57 | + | if (if (if (if ((myDepositAmount == recipientRequest)) | |
58 | + | then (recipientDeposit == myRequestAmount) | |
59 | + | else false) | |
60 | + | then (atomicFinish == true) | |
61 | + | else false) | |
62 | + | then (atomicWithDrawId == "WAVES") | |
63 | + | else false) | |
64 | + | then ScriptResult(WriteSet([DataEntry(((("F_" + currentKey) + atomicWithDrawId) + atomicRecipient), false)]), TransferSet([ScriptTransfer(i.caller, atomicWithdrawAmount, unit)])) | |
65 | + | else if (if (if (if ((myDepositAmount == recipientRequest)) | |
66 | + | then (recipientDeposit == myRequestAmount) | |
67 | + | else false) | |
68 | + | then (atomicFinish == true) | |
69 | + | else false) | |
70 | + | then (atomicWithDrawId != "WAVES") | |
71 | + | else false) | |
72 | + | then ScriptResult(WriteSet([DataEntry(((("F_" + currentKey) + atomicWithDrawId) + atomicRecipient), false)]), TransferSet([ScriptTransfer(i.caller, atomicWithdrawAmount, assetId)])) | |
73 | + | else throw("Not Atomic Swap") | |
74 | + | } | |
75 | + | ||
76 | + | ||
77 | + | @Verifier(tx) | |
78 | + | func verify () = match tx { | |
79 | + | case ttx: TransferTransaction => | |
80 | + | sigVerify(ttx.bodyBytes, ttx.proofs[0], ttx.senderPublicKey) | |
81 | + | case stx: SetScriptTransaction => | |
82 | + | sigVerify(stx.bodyBytes, stx.proofs[0], stx.senderPublicKey) | |
83 | + | case _ => | |
84 | + | true | |
85 | + | } | |
86 | + |
github/deemru/w8io/169f3d6 47.98 ms ◑