tx · HCJYc2aqPxoTmXtE9V8oJBGWpzSdHtBUwmHXydBGussM

3Mz3XPi4hQnfVK9ZaA27YwFfiPApPgFnCts:  -0.01400000 Waves

2019.12.27 18:05 [827597] smart account 3Mz3XPi4hQnfVK9ZaA27YwFfiPApPgFnCts > SELF 0.00000000 Waves

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

github/deemru/w8io/169f3d6 
35.45 ms