tx · FNJfL1FDX6tudsHs33ZiXXSUqXkzAppFJd1WzcRAAehT 3N1hUxU5uVePa5VEmty9UWoTdzjfMUNekSp: -0.01400000 Waves 2020.04.06 17:17 [942494] smart account 3N1hUxU5uVePa5VEmty9UWoTdzjfMUNekSp > SELF 0.00000000 Waves
{ "type": 13, "id": "FNJfL1FDX6tudsHs33ZiXXSUqXkzAppFJd1WzcRAAehT", "fee": 1400000, "feeAssetId": null, "timestamp": 1586182575538, "version": 1, "sender": "3N1hUxU5uVePa5VEmty9UWoTdzjfMUNekSp", "senderPublicKey": "C9N8puBe7PNPmySZRMUWyTK96uEaNp6AB2w758sEo4PQ", "proofs": [ "2pAD4dFdsb45E9JyFsFJKyxXaKBxX8RUmpZPdWF94xaWr95FvmpXRPtLTLZVMPG34zEQziCmc2A1HwJe6NgdFYhK" ], "script": "base64:AAIDAAAAAAAAABwIARIGCgQICAEIEgcKBQgIAQgIEgcKBQgIAQgIAAAAAAAAAAMAAAABaQEAAAANYXRvbWljRGVwb3NpdAAAAAQAAAAPYXRvbWljUmVjaXBpZW50AAAAEGF0b21pY1dpdGhEcmF3SWQAAAAUYXRvbWljV2l0aGRyYXdBbW91bnQAAAAPYXRvbWljRGVwb3NpdElkBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50BAAAAAlwYXltZW50SWQIBQAAAANwbXQAAAAHYXNzZXRJZAQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgUAAAAKY3VycmVudEtleQUAAAAPYXRvbWljRGVwb3NpdElkBQAAAA9hdG9taWNSZWNpcGllbnQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW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EdW5pdAUAAAADbmlsCQAAAgAAAAECAAAADkZhaWxlZCB0byBzd2FwAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAA3R0eAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAADdHR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAADdHR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAA3R0eAAAAA9zZW5kZXJQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAANzdHgFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAA3N0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAA3N0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAANzdHgAAAAPc2VuZGVyUHVibGljS2V5BoNiNmw=", "chainId": 84, "height": 942494, "spentComplexity": 0 } View: original | compacted Prev: 9chL8PzxEbHtRLArGQhne38Gcxmh2PJgMfCTiDUBariE Next: none Diff:
Old | New | Differences | |
---|---|---|---|
16 | 16 | } | |
17 | 17 | let newAmount = (currentAmount + pmt.amount) | |
18 | 18 | WriteSet([DataEntry(((currentKey + atomicDepositId) + atomicRecipient), newAmount), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), atomicWithdrawAmount), DataEntry(((("d_" + currentKey) + atomicDepositId) + atomicRecipient), true)]) | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
24 | + | func cancelWithdraw (atomicRecipient,atomicWithDrawId,atomicWithdrawAmount,atomicDepositId,atomicDepositId2) = { | |
25 | + | let currentKey = toBase58String(i.caller.bytes) | |
26 | + | let assetId = fromBase58String(atomicDepositId2) | |
27 | + | let myDepositAmount = match getInteger(this, ((currentKey + atomicDepositId) + atomicRecipient)) { | |
28 | + | case a: Int => | |
29 | + | a | |
30 | + | case _ => | |
31 | + | 0 | |
32 | + | } | |
33 | + | let recipientAtomicFinish = match getBoolean(this, ((("d_" + atomicRecipient) + atomicWithDrawId) + currentKey)) { | |
34 | + | case a: Boolean => | |
35 | + | a | |
36 | + | case _ => | |
37 | + | false | |
38 | + | } | |
39 | + | if (if ((recipientAtomicFinish == false)) | |
40 | + | then (atomicDepositId2 == "WAVES") | |
41 | + | else false) | |
42 | + | then ScriptResult(WriteSet([DataEntry(((currentKey + atomicDepositId) + atomicRecipient), 0), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), 0), DataEntry(((("d_" + currentKey) + atomicDepositId) + atomicRecipient), false)]), TransferSet([ScriptTransfer(i.caller, myDepositAmount, unit)])) | |
43 | + | else if (if ((recipientAtomicFinish == false)) | |
44 | + | then (atomicDepositId2 != "WAVES") | |
45 | + | else false) | |
46 | + | then ScriptResult(WriteSet([DataEntry(((currentKey + atomicDepositId) + atomicRecipient), 0), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), 0), DataEntry(((("d_" + currentKey) + atomicDepositId) + atomicRecipient), false)]), TransferSet([ScriptTransfer(i.caller, myDepositAmount, assetId)])) | |
47 | + | else throw("Failed to withdraw") | |
19 | 48 | } | |
20 | 49 | ||
21 | 50 | ||
76 | 105 | then (atomicWithDrawId != "WAVES") | |
77 | 106 | else false) | |
78 | 107 | then ScriptResult(WriteSet([DataEntry(((atomicRecipient + atomicWithDrawId) + currentKey), 0), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), 0), DataEntry(((("d_" + atomicRecipient) + atomicWithDrawId) + currentKey), false)]), TransferSet([ScriptTransfer(i.caller, atomicWithdrawAmount, unit)])) | |
79 | - | else throw(" | |
108 | + | else throw("Failed to swap") | |
80 | 109 | } | |
81 | 110 | ||
82 | 111 |
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, ((currentKey + atomicDepositId) + atomicRecipient)) { | |
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(((("d_" + currentKey) + atomicDepositId) + atomicRecipient), true)]) | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
24 | + | func cancelWithdraw (atomicRecipient,atomicWithDrawId,atomicWithdrawAmount,atomicDepositId,atomicDepositId2) = { | |
25 | + | let currentKey = toBase58String(i.caller.bytes) | |
26 | + | let assetId = fromBase58String(atomicDepositId2) | |
27 | + | let myDepositAmount = match getInteger(this, ((currentKey + atomicDepositId) + atomicRecipient)) { | |
28 | + | case a: Int => | |
29 | + | a | |
30 | + | case _ => | |
31 | + | 0 | |
32 | + | } | |
33 | + | let recipientAtomicFinish = match getBoolean(this, ((("d_" + atomicRecipient) + atomicWithDrawId) + currentKey)) { | |
34 | + | case a: Boolean => | |
35 | + | a | |
36 | + | case _ => | |
37 | + | false | |
38 | + | } | |
39 | + | if (if ((recipientAtomicFinish == false)) | |
40 | + | then (atomicDepositId2 == "WAVES") | |
41 | + | else false) | |
42 | + | then ScriptResult(WriteSet([DataEntry(((currentKey + atomicDepositId) + atomicRecipient), 0), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), 0), DataEntry(((("d_" + currentKey) + atomicDepositId) + atomicRecipient), false)]), TransferSet([ScriptTransfer(i.caller, myDepositAmount, unit)])) | |
43 | + | else if (if ((recipientAtomicFinish == false)) | |
44 | + | then (atomicDepositId2 != "WAVES") | |
45 | + | else false) | |
46 | + | then ScriptResult(WriteSet([DataEntry(((currentKey + atomicDepositId) + atomicRecipient), 0), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), 0), DataEntry(((("d_" + currentKey) + atomicDepositId) + atomicRecipient), false)]), TransferSet([ScriptTransfer(i.caller, myDepositAmount, assetId)])) | |
47 | + | else throw("Failed to withdraw") | |
19 | 48 | } | |
20 | 49 | ||
21 | 50 | ||
22 | 51 | ||
23 | 52 | @Callable(i) | |
24 | 53 | func atomicWithdraw (atomicRecipient,atomicWithDrawId,atomicWithdrawAmount,atomicDepositId,atomicWithDrawId2) = { | |
25 | 54 | let currentKey = toBase58String(i.caller.bytes) | |
26 | 55 | let assetId = fromBase58String(atomicWithDrawId2) | |
27 | 56 | let myDepositAmount = match getInteger(this, ((currentKey + atomicDepositId) + atomicRecipient)) { | |
28 | 57 | case a: Int => | |
29 | 58 | a | |
30 | 59 | case _ => | |
31 | 60 | 0 | |
32 | 61 | } | |
33 | 62 | let myRequestAmount = match getInteger(this, ((currentKey + atomicWithDrawId) + atomicRecipient)) { | |
34 | 63 | case a: Int => | |
35 | 64 | a | |
36 | 65 | case _ => | |
37 | 66 | 0 | |
38 | 67 | } | |
39 | 68 | let recipientDepositAmount = match getInteger(this, ((atomicRecipient + atomicWithDrawId) + currentKey)) { | |
40 | 69 | case a: Int => | |
41 | 70 | a | |
42 | 71 | case _ => | |
43 | 72 | 0 | |
44 | 73 | } | |
45 | 74 | let recipientRequestAmount = match getInteger(this, ((atomicRecipient + atomicDepositId) + currentKey)) { | |
46 | 75 | case a: Int => | |
47 | 76 | a | |
48 | 77 | case _ => | |
49 | 78 | 0 | |
50 | 79 | } | |
51 | 80 | let myAtomicFinish = match getBoolean(this, ((("d_" + currentKey) + atomicDepositId) + atomicRecipient)) { | |
52 | 81 | case a: Boolean => | |
53 | 82 | a | |
54 | 83 | case _ => | |
55 | 84 | false | |
56 | 85 | } | |
57 | 86 | let recipientAtomicFinish = match getBoolean(this, ((("d_" + atomicRecipient) + atomicWithDrawId) + currentKey)) { | |
58 | 87 | case a: Boolean => | |
59 | 88 | a | |
60 | 89 | case _ => | |
61 | 90 | false | |
62 | 91 | } | |
63 | 92 | if (if (if (if ((myDepositAmount == recipientRequestAmount)) | |
64 | 93 | then (recipientDepositAmount == myRequestAmount) | |
65 | 94 | else false) | |
66 | 95 | then (recipientAtomicFinish == true) | |
67 | 96 | else false) | |
68 | 97 | then (atomicWithDrawId == "WAVES") | |
69 | 98 | else false) | |
70 | 99 | then ScriptResult(WriteSet([DataEntry(((atomicRecipient + atomicWithDrawId) + currentKey), 0), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), 0), DataEntry(((("d_" + atomicRecipient) + atomicWithDrawId) + currentKey), false)]), TransferSet([ScriptTransfer(i.caller, atomicWithdrawAmount, unit)])) | |
71 | 100 | else if (if (if (if ((myDepositAmount == recipientRequestAmount)) | |
72 | 101 | then (recipientDepositAmount == myRequestAmount) | |
73 | 102 | else false) | |
74 | 103 | then (recipientAtomicFinish == true) | |
75 | 104 | else false) | |
76 | 105 | then (atomicWithDrawId != "WAVES") | |
77 | 106 | else false) | |
78 | 107 | then ScriptResult(WriteSet([DataEntry(((atomicRecipient + atomicWithDrawId) + currentKey), 0), DataEntry(((currentKey + atomicWithDrawId) + atomicRecipient), 0), DataEntry(((("d_" + atomicRecipient) + atomicWithDrawId) + currentKey), false)]), TransferSet([ScriptTransfer(i.caller, atomicWithdrawAmount, unit)])) | |
79 | - | else throw(" | |
108 | + | else throw("Failed to swap") | |
80 | 109 | } | |
81 | 110 | ||
82 | 111 | ||
83 | 112 | @Verifier(tx) | |
84 | 113 | func verify () = match tx { | |
85 | 114 | case ttx: TransferTransaction => | |
86 | 115 | sigVerify(ttx.bodyBytes, ttx.proofs[0], ttx.senderPublicKey) | |
87 | 116 | case stx: SetScriptTransaction => | |
88 | 117 | sigVerify(stx.bodyBytes, stx.proofs[0], stx.senderPublicKey) | |
89 | 118 | case _ => | |
90 | 119 | true | |
91 | 120 | } | |
92 | 121 |
github/deemru/w8io/169f3d6 106.11 ms ◑