tx · CqbL9jaTi6FNgM3qed1KAS5U3FEFWuVTSmvzBZnrPezK 3Mz3XPi4hQnfVK9ZaA27YwFfiPApPgFnCts: -0.01400000 Waves 2020.01.15 16:12 [855254] smart account 3Mz3XPi4hQnfVK9ZaA27YwFfiPApPgFnCts > SELF 0.00000000 Waves
{ "type": 13, "id": "CqbL9jaTi6FNgM3qed1KAS5U3FEFWuVTSmvzBZnrPezK", "fee": 1400000, "feeAssetId": null, "timestamp": 1579094058466, "version": 1, "sender": "3Mz3XPi4hQnfVK9ZaA27YwFfiPApPgFnCts", "senderPublicKey": "PuRPu7vRxThZUjyn7EuGuZyy6f77Sj87fnAzQC9Af4V", "proofs": [ "5NzphdiYG2BABi6EhpGHxpQ4k9eFtyfEWShZwXj5RYwbLEQWXT6TPUkP5DPjSguU6iN8A4VbUEkNpJ7au5F5f8WE" ], "script": "base64:AAIDAAAAAAAAAAkIARIFCgMCAQIAAAALAAAAABV0b2tlblBvcnRJbk90aGVyQ2hhaW4EAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwIAAAAVdG9rZW5Qb3J0SW5PdGhlckNoYWluAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiCQAAAgAAAAECAAAAJHRva2VuUG9ydEluT3RoZXJDaGFpbiBpcyBub3QgZGVmaW5lZAAAAAAOY2hhaW5Db2xsZWN0b3IEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwIAAAAOY2hhaW5Db2xsZWN0b3IDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAWIFAAAAByRtYXRjaDAJAQAAAAdBZGRyZXNzAAAAAQUAAAABYgkAAAIAAAABAgAAAB1jaGFpbkNvbGxlY3RvciBpcyBub3QgZGVmaW5lZAEAAAALYmxvY2tJbmZvQXQAAAABAAAABmhlaWdodAQAAAAHJG1hdGNoMAkABBwAAAACBQ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AAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5KJyHVw==", "chainId": 84, "height": 855254, "spentComplexity": 0 } View: original | compacted Prev: 9J1PRDwiwFxCZAJzNCP6yooRCEcoCfCB7heZrDXQJ1T7 Next: ZUTZM12xe5xgMe2Hr5R1wNnR1dimVRGPyerMEM8c1wU Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | throw("chainCollector is not defined") | |
16 | 16 | } | |
17 | 17 | ||
18 | - | func blockInfoAt (height) = match getBinary(chainCollector, toString(height)) { | |
18 | + | func blockInfoAt (height) = match getBinary(chainCollector, (toString(height) + "_transactionsRoot")) { | |
19 | 19 | case b: ByteVector => | |
20 | 20 | b | |
21 | 21 | case _ => |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let tokenPortInOtherChain = match getBinary(this, "tokenPortInOtherChain") { | |
5 | 5 | case b: ByteVector => | |
6 | 6 | b | |
7 | 7 | case _ => | |
8 | 8 | throw("tokenPortInOtherChain is not defined") | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | let chainCollector = match getBinary(this, "chainCollector") { | |
12 | 12 | case b: ByteVector => | |
13 | 13 | Address(b) | |
14 | 14 | case _ => | |
15 | 15 | throw("chainCollector is not defined") | |
16 | 16 | } | |
17 | 17 | ||
18 | - | func blockInfoAt (height) = match getBinary(chainCollector, toString(height)) { | |
18 | + | func blockInfoAt (height) = match getBinary(chainCollector, (toString(height) + "_transactionsRoot")) { | |
19 | 19 | case b: ByteVector => | |
20 | 20 | b | |
21 | 21 | case _ => | |
22 | 22 | throw("Block info not found") | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func assetIdToString (assetId) = match assetId { | |
27 | 27 | case assetId: ByteVector => | |
28 | 28 | toBase58String(assetId) | |
29 | 29 | case _ => | |
30 | 30 | "WAVES" | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func assetIdFromString (asset) = if ((asset == "WAVES")) | |
35 | 35 | then unit | |
36 | 36 | else fromBase58String(asset) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func extractTxAsset (txBodyBytes) = { | |
40 | 40 | let assetByte = takeRightBytes(take(txBodyBytes, (((1 + 1) + 32) + 1)), 1) | |
41 | 41 | if ((assetByte == base58'1')) | |
42 | 42 | then unit | |
43 | 43 | else takeRightBytes(take(txBodyBytes, ((((1 + 1) + 32) + 1) + 32)), 32) | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func extractTxId (txBodyBytes) = blake2b256(txBodyBytes) | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func extractTxRecipient (txBodyBytes) = { | |
51 | 51 | let assetByte = takeRightBytes(take(txBodyBytes, (((1 + 1) + 32) + 1)), 1) | |
52 | 52 | let assetIdLenght = if ((assetByte == base58'1')) | |
53 | 53 | then 0 | |
54 | 54 | else 32 | |
55 | 55 | let feeAssetByte = takeRightBytes(take(txBodyBytes, (((((1 + 1) + 32) + 1) + assetIdLenght) + 1)), 1) | |
56 | 56 | let feeAssetIdLenght = if ((feeAssetByte == base58'1')) | |
57 | 57 | then 0 | |
58 | 58 | else 32 | |
59 | 59 | takeRightBytes(take(txBodyBytes, ((((((((((1 + 1) + 32) + 1) + assetIdLenght) + 1) + feeAssetIdLenght) + 8) + 8) + 8) + 26)), 26) | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func extractTxAmount (txBodyBytes) = { | |
64 | 64 | let assetByte = takeRightBytes(take(txBodyBytes, (((1 + 1) + 32) + 1)), 1) | |
65 | 65 | let assetIdLenght = if ((assetByte == base58'1')) | |
66 | 66 | then 0 | |
67 | 67 | else 32 | |
68 | 68 | let feeAssetByte = takeRightBytes(take(txBodyBytes, (((((1 + 1) + 32) + 1) + assetIdLenght) + 1)), 1) | |
69 | 69 | let feeAssetIdLenght = if ((feeAssetByte == base58'1')) | |
70 | 70 | then 0 | |
71 | 71 | else 32 | |
72 | 72 | toInt(takeRightBytes(take(txBodyBytes, ((((((((1 + 1) + 32) + 1) + assetIdLenght) + 1) + feeAssetIdLenght) + 8) + 8)), 8)) | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func extractTxAttachment (txBodyBytes) = { | |
77 | 77 | let assetByte = takeRightBytes(take(txBodyBytes, (((1 + 1) + 32) + 1)), 1) | |
78 | 78 | let assetIdLenght = if ((assetByte == base58'1')) | |
79 | 79 | then 0 | |
80 | 80 | else 32 | |
81 | 81 | let feeAssetByte = takeRightBytes(take(txBodyBytes, (((((1 + 1) + 32) + 1) + assetIdLenght) + 1)), 1) | |
82 | 82 | let feeAssetIdLenght = if ((feeAssetByte == base58'1')) | |
83 | 83 | then 0 | |
84 | 84 | else 32 | |
85 | 85 | let attachmentLength = toInt(takeRightBytes(take(txBodyBytes, (((((((((((1 + 1) + 32) + 1) + assetIdLenght) + 1) + feeAssetIdLenght) + 8) + 8) + 8) + 26) + 2)), 2)) | |
86 | 86 | takeRightBytes(take(txBodyBytes, ((((((((((((1 + 1) + 32) + 1) + assetIdLenght) + 1) + feeAssetIdLenght) + 8) + 8) + 8) + 26) + 2) + attachmentLength)), attachmentLength) | |
87 | 87 | } | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func extractTxType (txBodyBytes) = take(txBodyBytes, 1) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | @Callable(i) | |
94 | 94 | func withdraw (txBytes,blockHeight,merkleProof) = { | |
95 | 95 | let merkleRoot = blockInfoAt(blockHeight) | |
96 | 96 | let txId = extractTxId(txBytes) | |
97 | 97 | let txRecipient = extractTxRecipient(txBytes) | |
98 | 98 | let txAttachment = extractTxAttachment(txBytes) | |
99 | 99 | let txAmount = extractTxAmount(txBytes) | |
100 | 100 | let txAsset = extractTxAsset(txBytes) | |
101 | 101 | let txType = extractTxType(txBytes) | |
102 | 102 | let txIdKey = (toBase58String(txId) + "_tx") | |
103 | 103 | let assetKey = (assetIdToString(txAsset) + "_asset") | |
104 | 104 | let assetInThisChain = match getString(this, assetKey) { | |
105 | 105 | case s: String => | |
106 | 106 | assetIdFromString(s) | |
107 | 107 | case _ => | |
108 | 108 | throw("incorrect asset") | |
109 | 109 | } | |
110 | 110 | if ((txType != base58'5')) | |
111 | 111 | then throw("incorrect transaction type") | |
112 | 112 | else if ((txRecipient != tokenPortInOtherChain)) | |
113 | 113 | then throw("incorrect tx recipient") | |
114 | 114 | else { | |
115 | 115 | let recipient = Address(txAttachment) | |
116 | 116 | if (isDefined(getBoolean(this, txIdKey))) | |
117 | 117 | then throw("this tx has already been withdrawn") | |
118 | 118 | else if (!(checkMerkleProof(merkleRoot, txId, merkleProof))) | |
119 | 119 | then throw("incorrect Merkle proof") | |
120 | 120 | else ScriptResult(WriteSet([DataEntry(txIdKey, true)]), TransferSet([ScriptTransfer(recipient, txAmount, assetInThisChain)])) | |
121 | 121 | } | |
122 | 122 | } | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | @Verifier(tx) | |
126 | 126 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
127 | 127 |
github/deemru/w8io/026f985 33.06 ms ◑