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