diff --git a/src/contextualizers/bridges/opStack/source.ts b/src/contextualizers/bridges/opStack/source.ts index 0a53729a..e8ec0c70 100644 --- a/src/contextualizers/bridges/opStack/source.ts +++ b/src/contextualizers/bridges/opStack/source.ts @@ -59,10 +59,7 @@ export function generate(transaction: Transaction): Transaction { const logs = transaction.logs ?? []; const transactionDepositedLog = logs.find((log: any) => { - return ( - log.topics?.length > 0 && - log.topics[0] === TRANSACTION_DEPOSITED_EVENT_HASH - ); + return log.topic0 === TRANSACTION_DEPOSITED_EVENT_HASH; }); if (!transactionDepositedLog) return transaction; diff --git a/src/contextualizers/test/transactions/cryptopunks-0xd0d8cbaa.json b/src/contextualizers/test/transactions/cryptopunks-0xd0d8cbaa.json index 2e01e750..9a287328 100644 --- a/src/contextualizers/test/transactions/cryptopunks-0xd0d8cbaa.json +++ b/src/contextualizers/test/transactions/cryptopunks-0xd0d8cbaa.json @@ -76,7 +76,7 @@ "blockHash": "0xcb1c733462728a33fcab4dfa358c80c7204b52e4517cb91e55cceb41e2dbd05c", "blockNumber": 19385111, "burntFees": "7803812510214654", - "decode": { + "decoded": { "fragment": { "type": "function", "inputs": [ @@ -206,48 +206,29 @@ "blockHash": "0xcb1c733462728a33fcab4dfa358c80c7204b52e4517cb91e55cceb41e2dbd05c", "blockNumber": 19385111, "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "decode": { - "fragment": { - "type": "event", - "inputs": [ - { - "name": "from", - "type": "address", - "baseType": "address", - "indexed": true, - "components": null, - "arrayLength": null, - "arrayChildren": null - }, - { - "name": "to", - "type": "address", - "baseType": "address", - "indexed": true, - "components": null, - "arrayLength": null, - "arrayChildren": null - }, - { - "name": "value", - "type": "uint256", - "baseType": "uint256", - "indexed": false, - "components": null, - "arrayLength": null, - "arrayChildren": null - } - ], - "name": "Transfer", - "anonymous": false - }, - "name": "Transfer", + "decoded": { "signature": "Transfer(address,address,uint256)", - "topic": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "args": [ - "0x0232d1083e970f0c78f56202b9a666b526fa379f", - "0x93b6af9f6fd83cf2a6a22a7ef529ff65f4724f17", - "1" + "signature_with_arg_names": "Transfer(address indexed from,address indexed to,uint256 value)", + "name": "Transfer", + "decoded": [ + { + "indexed": true, + "name": "from", + "type": "address", + "decoded": "0x0232d1083e970f0c78f56202b9a666b526fa379f" + }, + { + "indexed": true, + "name": "to", + "type": "address", + "decoded": "0x93b6af9f6fd83cf2a6a22a7ef529ff65f4724f17" + }, + { + "indexed": false, + "name": "value", + "type": "uint256", + "decoded": "1" + } ] }, "removed": false, @@ -265,27 +246,18 @@ "blockHash": "0xcb1c733462728a33fcab4dfa358c80c7204b52e4517cb91e55cceb41e2dbd05c", "blockNumber": 19385111, "data": "0x", - "decode": { - "fragment": { - "type": "event", - "inputs": [ - { - "name": "punkIndex", - "type": "uint256", - "baseType": "uint256", - "indexed": true, - "components": null, - "arrayLength": null, - "arrayChildren": null - } - ], - "name": "PunkNoLongerForSale", - "anonymous": false - }, - "name": "PunkNoLongerForSale", + "decoded": { "signature": "PunkNoLongerForSale(uint256)", - "topic": "0xb0e0a660b4e50f26f0b7ce75c24655fc76cc66e3334a54ff410277229fa10bd4", - "args": ["8515"] + "signature_with_arg_names": "PunkNoLongerForSale(uint256 indexed punkIndex)", + "name": "PunkNoLongerForSale", + "decoded": [ + { + "indexed": true, + "name": "punkIndex", + "type": "uint256", + "decoded": "8515" + } + ] }, "removed": false, "topic0": "0xb0e0a660b4e50f26f0b7ce75c24655fc76cc66e3334a54ff410277229fa10bd4", @@ -301,58 +273,35 @@ "blockHash": "0xcb1c733462728a33fcab4dfa358c80c7204b52e4517cb91e55cceb41e2dbd05c", "blockNumber": 19385111, "data": "0x000000000000000000000000000000000000000000000008816cc6b54aca0000", - "decode": { - "fragment": { - "type": "event", - "inputs": [ - { - "name": "punkIndex", - "type": "uint256", - "baseType": "uint256", - "indexed": true, - "components": null, - "arrayLength": null, - "arrayChildren": null - }, - { - "name": "value", - "type": "uint256", - "baseType": "uint256", - "indexed": false, - "components": null, - "arrayLength": null, - "arrayChildren": null - }, - { - "name": "fromAddress", - "type": "address", - "baseType": "address", - "indexed": true, - "components": null, - "arrayLength": null, - "arrayChildren": null - }, - { - "name": "toAddress", - "type": "address", - "baseType": "address", - "indexed": true, - "components": null, - "arrayLength": null, - "arrayChildren": null - } - ], - "name": "PunkBought", - "anonymous": false - }, - "name": "PunkBought", + "decoded": { "signature": "PunkBought(uint256,uint256,address,address)", - "topic": "0x58e5d5a525e3b40bc15abaa38b5882678db1ee68befd2f60bafe3a7fd06db9e3", - "args": [ - "8515", - "156900000000000000000", - "0x0232d1083e970f0c78f56202b9a666b526fa379f", - "0x93b6af9f6fd83cf2a6a22a7ef529ff65f4724f17" + "signature_with_arg_names": "PunkBought(uint256 indexed punkIndex,uint256 value,address indexed fromAddress,address indexed toAddress)", + "name": "PunkBought", + "decoded": [ + { + "indexed": true, + "name": "punkIndex", + "type": "uint256", + "decoded": "8515" + }, + { + "indexed": false, + "name": "value", + "type": "uint256", + "decoded": "156900000000000000000" + }, + { + "indexed": true, + "name": "fromAddress", + "type": "address", + "decoded": "0x0232d1083e970f0c78f56202b9a666b526fa379f" + }, + { + "indexed": true, + "name": "toAddress", + "type": "address", + "decoded": "0x93b6af9f6fd83cf2a6a22a7ef529ff65f4724f17" + } ] }, "removed": false, diff --git a/src/contextualizers/test/transactions/erc20swap-0x2c631258.json b/src/contextualizers/test/transactions/erc20swap-0x2c631258.json index 38abd8b3..398e3ab3 100644 --- a/src/contextualizers/test/transactions/erc20swap-0x2c631258.json +++ b/src/contextualizers/test/transactions/erc20swap-0x2c631258.json @@ -22,14 +22,14 @@ "yParity": "0x1", "assetTransfers": [ { - "asset": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed", + "contract": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed", "from": "0xc9034c3e7f58003e6ae0c8438e7c8f4598d5acaa", "to": "0x6e947ba373a53bd41139d68e8dfb4fb0472767b6", "value": "79907887473934231137403", "type": "erc20" }, { - "asset": "0x4200000000000000000000000000000000000006", + "contract": "0x4200000000000000000000000000000000000006", "from": "0x6e947ba373a53bd41139d68e8dfb4fb0472767b6", "to": "0xc9034c3e7f58003e6ae0c8438e7c8f4598d5acaa", "value": "300000000000000000", @@ -107,7 +107,7 @@ "0x6e947ba373a53bd41139d68e8dfb4fb0472767b6": { "received": [ { - "asset": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed", + "contract": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed", "id": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed", "type": "erc20", "value": "79907887473934231137403" @@ -115,7 +115,7 @@ ], "sent": [ { - "asset": "0x4200000000000000000000000000000000000006", + "contract": "0x4200000000000000000000000000000000000006", "id": "0x4200000000000000000000000000000000000006", "type": "erc20", "value": "300000000000000000" diff --git a/src/contextualizers/test/transactions/optimism-source-0x992b053b.json b/src/contextualizers/test/transactions/optimism-source-0x992b053b.json index 28bcc4f8..eec711f5 100644 --- a/src/contextualizers/test/transactions/optimism-source-0x992b053b.json +++ b/src/contextualizers/test/transactions/optimism-source-0x992b053b.json @@ -56,9 +56,7 @@ "output": "0x" }, "subtraces": 1, - "traceAddress": [ - 1 - ], + "traceAddress": [1], "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionPosition": 288, "type": "call" @@ -79,11 +77,7 @@ "output": "0x" }, "subtraces": 1, - "traceAddress": [ - 1, - 0, - 1 - ], + "traceAddress": [1, 0, 1], "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionPosition": 288, "type": "call" @@ -104,13 +98,7 @@ "output": "0x" }, "subtraces": 1, - "traceAddress": [ - 1, - 0, - 1, - 0, - 0 - ], + "traceAddress": [1, 0, 1, 0, 0], "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionPosition": 288, "type": "call" @@ -131,15 +119,7 @@ "output": "0x0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff" }, "subtraces": 0, - "traceAddress": [ - 1, - 0, - 1, - 0, - 0, - 0, - 0 - ], + "traceAddress": [1, 0, 1, 0, 0, 0, 0], "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionPosition": 288, "type": "call" @@ -260,10 +240,7 @@ "gas": null }, "name": "depositETH", - "args": [ - "200000", - "0x" - ], + "args": ["200000", "0x"], "signature": "depositETH(uint32,bytes)", "selector": "0xb1a1a882", "value": "0" @@ -356,9 +333,7 @@ }, { "key": "eth", - "value": [ - 0.2 - ] + "value": [0.2] } ], "logs": [ @@ -370,11 +345,9 @@ "data": "0x00000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000", "logIndex": 625, "removed": false, - "topics": [ - "0x35d79ab81f2b2017e19afb5c5571778877782d7a8786f5907f93b0f4702f4f23", - "0x000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e", - "0x000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e" - ], + "topic0": "0x35d79ab81f2b2017e19afb5c5571778877782d7a8786f5907f93b0f4702f4f23", + "topic1": "0x000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e", + "topic2": "0x000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e", "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionIndex": 288, "decode": { @@ -441,11 +414,9 @@ "data": "0x00000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000", "logIndex": 626, "removed": false, - "topics": [ - "0x2849b43074093a05396b6f2a937dee8565b15a48a7b3d4bffb732a5017380af5", - "0x000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e", - "0x000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e" - ], + "topic0": "0x2849b43074093a05396b6f2a937dee8565b15a48a7b3d4bffb732a5017380af5", + "topic1": "0x000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e", + "topic2": "0x000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e", "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionIndex": 288, "decode": { @@ -512,12 +483,10 @@ "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ed00000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000000000000000000000000000002c68af0bb1400000000000000077d2e00d764ad0b000100000000000000000000000000000000000000000000000000000001901400000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be1000000000000000000000000420000000000000000000000000000000000001000000000000000000000000000000000000000000000000002c68af0bb1400000000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000a41635f5fd000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e00000000000000000000000000000000000000000000000002c68af0bb140000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logIndex": 627, "removed": false, - "topics": [ - "0xb3813568d9991fc951961fcb4c784893574240a28925604d09fc577c55bb7c32", - "0x00000000000000000000000036bde71c97b33cc4729cf772ae268934f7ab70b2", - "0x0000000000000000000000004200000000000000000000000000000000000007", - "0x0000000000000000000000000000000000000000000000000000000000000000" - ], + "topic0": "0xb3813568d9991fc951961fcb4c784893574240a28925604d09fc577c55bb7c32", + "topic1": "0x00000000000000000000000036bde71c97b33cc4729cf772ae268934f7ab70b2", + "topic2": "0x0000000000000000000000004200000000000000000000000000000000000007", + "topic3": "0x0000000000000000000000000000000000000000000000000000000000000000", "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionIndex": 288, "decode": { @@ -584,10 +553,8 @@ "data": "0x00000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be1000000000000000000000000000000000000000000000000000000000000008000010000000000000000000000000000000000000000000000000000000190140000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000000000000000000000000000000000a41635f5fd000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e000000000000000000000000f64da4efa19b42ef2f897a3d533294b892e6d99e00000000000000000000000000000000000000000000000002c68af0bb1400000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logIndex": 628, "removed": false, - "topics": [ - "0xcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a", - "0x0000000000000000000000004200000000000000000000000000000000000010" - ], + "topic0": "0xcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a", + "topic1": "0x0000000000000000000000004200000000000000000000000000000000000010", "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionIndex": 288, "decode": { @@ -664,10 +631,8 @@ "data": "0x00000000000000000000000000000000000000000000000002c68af0bb140000", "logIndex": 629, "removed": false, - "topics": [ - "0x8ebb2ec2465bdb2a06a66fc37a0963af8a2a6a1479d81d56fdb8cbb98096d546", - "0x00000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be1" - ], + "topic0": "0x8ebb2ec2465bdb2a06a66fc37a0963af8a2a6a1479d81d56fdb8cbb98096d546", + "topic1": "0x00000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be1", "transactionHash": "0x992b6abf0773cd45c2349b19c87834a0cc13869a2c649ddddd691d1a5e34053b", "transactionIndex": 288, "decode": { @@ -1053,4 +1018,4 @@ ] }, "assetsEnriched": {} -} \ No newline at end of file +}