tx · H6mJ7TjZEhbmP9jg2zUQMiQKMUQTMJeEm5viKyvzCmvf 3N9ZoipEVJyQhhijNYxkcomvgGrrEeDhPvN: -0.01000000 Waves 2023.01.20 21:57 [2413682] smart account 3N9ZoipEVJyQhhijNYxkcomvgGrrEeDhPvN > SELF 0.00000000 Waves
{ "type": 13, "id": "H6mJ7TjZEhbmP9jg2zUQMiQKMUQTMJeEm5viKyvzCmvf", "fee": 1000000, "feeAssetId": null, "timestamp": 1674241081817, "version": 2, "chainId": 84, "sender": "3N9ZoipEVJyQhhijNYxkcomvgGrrEeDhPvN", "senderPublicKey": "2Gtgx295VLiew3CzXqh9eXfFZBTEpDW2nLsrJZ1C4i9J", "proofs": [ "2WBVtUEZ8BRAb1u4WJviqeMoqQbS5pNAgLFuCsKpiPzcDz4q9TTQ9U89akMQvrNrVvBuVXxV9eSoWRwk37c283my" ], "script": "base64:AAIFAAAAAAAAACMIAhIGCgQIBAgEEgMKAQgSBwoFCAgIAQgSAwoBCBIECgIICAAAAAoBAAAAFHRyeUdldFN0cmluZ0V4dGVybmFsAAAAAgAAAAdhZGRyZXNzAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABV0cnlHZXRJbnRlZ2VyRXh0ZXJuYWwAAAACAAAAB2FkZHJlc3MAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAAAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQkBAAAAFHRyeUdldFN0cmluZ0V4dGVybmFsAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAAA10cnlHZXRJbnRlZ2VyAAA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AR0eElkAgAAAAhfb3RoZXJJZAkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkBQAAAANuaWwAAAABaQEAAAASZmluYWxpemVPdXRnb2luZ1R4AAAAAgAAAAR0eElkAAAACW90aGVyVHhJZAMJAQAAAAIhPQAAAAIJAQAAAAx0cnlHZXRTdHJpbmcAAAABCQABLAAAAAIJAAEsAAAAAgIAAAADdHhfBQAAAAR0eElkAgAAAAhfb3RoZXJJZAIAAAAACQAAAgAAAAEJAAEsAAAAAgUAAAAEdHhJZAIAAAAcIGlzIGFscmVhZHkgZnVsbHkgcHJvY2Vzc2VkIQMJAQAAAAIhPQAAAAIIBQAAAAFpAAAABmNhbGxlcgUAAAAEdGhpcwkAAAIAAAABAgAAAA1EaXJ0eSBoYWNrZXIhCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAN0eF8FAAAABHR4SWQCAAAAB19zdGF0dXMCAAAACVBST0NFU1NFRAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAADdHhfBQAAAAR0eElkAgAAAAhfb3RoZXJJZAUAAAAJb3RoZXJUeElkBQAAAANuaWwAAAAARNozgw==", "height": 2413682, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BmtCAFyoL1LWZ8bfqrZguijQvg5LeDPiUSx4RumV4d5i Next: Gy7Y5SYuuvQe2xccvSYvgv5c4VnwGC4oGwqWieDQ4zFE Diff:
Old | New | Differences | |
---|---|---|---|
107 | 107 | let amount = tryGetInteger((("tx_" + txId) + "_amount")) | |
108 | 108 | let assetId = tryGetString((("tx_" + txId) + "_assetId")) | |
109 | 109 | let specifiqueData = if (tryGetBoolean(reissueable(assetIdToReceive))) | |
110 | - | then if ((tryGetString( | |
111 | - | then throw("Skipping tx, corrupt data!") | |
110 | + | then if ((tryGetString(nativeAssetKey(assetId)) != assetIdToReceive)) | |
111 | + | then throw("RE: Skipping tx, corrupt data!") | |
112 | 112 | else [Reissue(fromBase58String(assetIdToReceive), amount, true)] | |
113 | - | else if ((tryGetString( | |
114 | - | then throw("Skipping tx, corrupt data!") | |
113 | + | else if ((tryGetString(otherChainAssetKey(assetId)) != assetIdToReceive)) | |
114 | + | then throw("URE: Skipping tx, corrupt data!") | |
115 | 115 | else nil | |
116 | 116 | (specifiqueData ++ [ScriptTransfer(addressFromStringValue(destination), amount, fromBase58String(assetIdToReceive)), StringEntry((("tx_" + txId) + "_status"), "PROCESSED"), StringEntry((("tx_" + txId) + "_otherId"), toBase58String(i.transactionId))]) | |
117 | 117 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func tryGetStringExternal (address,key) = match getString(address, key) { | |
5 | 5 | case a: String => | |
6 | 6 | a | |
7 | 7 | case _ => | |
8 | 8 | "" | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func tryGetIntegerExternal (address,key) = match getInteger(address, key) { | |
13 | 13 | case b: Int => | |
14 | 14 | b | |
15 | 15 | case _ => | |
16 | 16 | 0 | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func tryGetString (key) = tryGetStringExternal(this, key) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func tryGetInteger (key) = tryGetIntegerExternal(this, key) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
27 | 27 | case b: Boolean => | |
28 | 28 | b | |
29 | 29 | case _ => | |
30 | 30 | false | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func assetIdToString (assetId) = toBase58String(value(assetId)) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func nativeAssetKey (nativeAsset) = ("nativeAsset_" + nativeAsset) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func otherChainAssetKey (otherChainAsset) = ("otherChainAsset_" + otherChainAsset) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func reissueable (asset) = ("reissueable_" + asset) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func validatePayment (payment) = { | |
47 | 47 | let pmt = value(payment) | |
48 | 48 | if (!(isDefined(pmt.assetId))) | |
49 | 49 | then throw("It needs to be an asset") | |
50 | 50 | else { | |
51 | 51 | let assetDetails = value(assetInfo(value(pmt.assetId))) | |
52 | 52 | if ((1 > pmt.amount)) | |
53 | 53 | then throw("You didnt attached a payment!") | |
54 | 54 | else assetIdToString(pmt.assetId) | |
55 | 55 | } | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(i) | |
60 | 60 | func initiateAssets (nativeAsset,nativeAssetReissueable,otherChainAsset,otherChainAssetReissueable) = if ((tryGetString(nativeAssetKey(nativeAsset)) != "")) | |
61 | 61 | then throw("Native Asset already listed!") | |
62 | 62 | else if ((tryGetString(otherChainAssetKey(otherChainAsset)) != "")) | |
63 | 63 | then throw("Other Asset already listed!") | |
64 | 64 | else [StringEntry(nativeAssetKey(nativeAsset), otherChainAsset), StringEntry(otherChainAssetKey(otherChainAsset), nativeAsset), BooleanEntry(reissueable(nativeAsset), nativeAssetReissueable), BooleanEntry(reissueable(otherChainAsset), otherChainAssetReissueable)] | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(i) | |
69 | 69 | func initiateOutGoingTx (destination) = { | |
70 | 70 | let payment = i.payments | |
71 | 71 | if ((size(payment) != 1)) | |
72 | 72 | then throw("Invalid payment added!") | |
73 | 73 | else if ((1 > payment[0].amount)) | |
74 | 74 | then throw("Invalid amount added!") | |
75 | 75 | else { | |
76 | 76 | let assetId = validatePayment(payment[0]) | |
77 | 77 | let specifiqueData = if (tryGetBoolean(reissueable(assetId))) | |
78 | 78 | then [Burn(fromBase58String(assetId), payment[0].amount), StringEntry((("tx_" + toBase58String(i.transactionId)) + "_asset_to_receive"), tryGetString(otherChainAssetKey(assetId)))] | |
79 | 79 | else [StringEntry((("tx_" + toBase58String(i.transactionId)) + "_asset_to_receive"), tryGetString(nativeAssetKey(assetId)))] | |
80 | 80 | ([StringEntry((("tx_" + toBase58String(i.transactionId)) + "_dest"), destination), StringEntry((("tx_" + toBase58String(i.transactionId)) + "_status"), "UNPROCESSED")] ++ specifiqueData) | |
81 | 81 | } | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | ||
86 | 86 | @Callable(i) | |
87 | 87 | func storeDataIncomingTx (txId,destination,assetId,amount,assetIdToReceive) = if (if ((tryGetString((("tx_" + txId) + "_status")) != "")) | |
88 | 88 | then true | |
89 | 89 | else (tryGetString((("tx_" + txId) + "_dest")) != "")) | |
90 | 90 | then throw((txId + " is already stored!")) | |
91 | 91 | else if ((i.caller != this)) | |
92 | 92 | then throw("Dirty hacker") | |
93 | 93 | else [StringEntry((("tx_" + txId) + "_dest"), destination), StringEntry((("tx_" + txId) + "_status"), "UNPROCESSED"), StringEntry((("tx_" + txId) + "_assetId"), assetId), StringEntry((("tx_" + txId) + "_assetId_to_receive"), assetIdToReceive), IntegerEntry((("tx_" + txId) + "_amount"), amount)] | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | ||
97 | 97 | @Callable(i) | |
98 | 98 | func releaseIncomingTx (txId) = { | |
99 | 99 | let status = tryGetString((("tx_" + txId) + "_status")) | |
100 | 100 | if ((status == "")) | |
101 | 101 | then throw("No such txid found!") | |
102 | 102 | else if ((status == "PROCESSED")) | |
103 | 103 | then throw("Already processed!") | |
104 | 104 | else { | |
105 | 105 | let assetIdToReceive = tryGetString((("tx_" + txId) + "_assetId_to_receive")) | |
106 | 106 | let destination = tryGetString((("tx_" + txId) + "_dest")) | |
107 | 107 | let amount = tryGetInteger((("tx_" + txId) + "_amount")) | |
108 | 108 | let assetId = tryGetString((("tx_" + txId) + "_assetId")) | |
109 | 109 | let specifiqueData = if (tryGetBoolean(reissueable(assetIdToReceive))) | |
110 | - | then if ((tryGetString( | |
111 | - | then throw("Skipping tx, corrupt data!") | |
110 | + | then if ((tryGetString(nativeAssetKey(assetId)) != assetIdToReceive)) | |
111 | + | then throw("RE: Skipping tx, corrupt data!") | |
112 | 112 | else [Reissue(fromBase58String(assetIdToReceive), amount, true)] | |
113 | - | else if ((tryGetString( | |
114 | - | then throw("Skipping tx, corrupt data!") | |
113 | + | else if ((tryGetString(otherChainAssetKey(assetId)) != assetIdToReceive)) | |
114 | + | then throw("URE: Skipping tx, corrupt data!") | |
115 | 115 | else nil | |
116 | 116 | (specifiqueData ++ [ScriptTransfer(addressFromStringValue(destination), amount, fromBase58String(assetIdToReceive)), StringEntry((("tx_" + txId) + "_status"), "PROCESSED"), StringEntry((("tx_" + txId) + "_otherId"), toBase58String(i.transactionId))]) | |
117 | 117 | } | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | @Callable(i) | |
123 | 123 | func finalizeOutgoingTx (txId,otherTxId) = if ((tryGetString((("tx_" + txId) + "_otherId")) != "")) | |
124 | 124 | then throw((txId + " is already fully processed!")) | |
125 | 125 | else if ((i.caller != this)) | |
126 | 126 | then throw("Dirty hacker!") | |
127 | 127 | else [StringEntry((("tx_" + txId) + "_status"), "PROCESSED"), StringEntry((("tx_" + txId) + "_otherId"), otherTxId)] | |
128 | 128 | ||
129 | 129 |
github/deemru/w8io/169f3d6 32.34 ms ◑