Skip to content

Commit

Permalink
fix: unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ponyjackal committed Apr 2, 2024
1 parent 54ed49e commit bef79b2
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 177 deletions.
5 changes: 1 addition & 4 deletions src/contextualizers/bridges/opStack/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
175 changes: 62 additions & 113 deletions src/contextualizers/test/transactions/cryptopunks-0xd0d8cbaa.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"blockHash": "0xcb1c733462728a33fcab4dfa358c80c7204b52e4517cb91e55cceb41e2dbd05c",
"blockNumber": 19385111,
"burntFees": "7803812510214654",
"decode": {
"decoded": {
"fragment": {
"type": "function",
"inputs": [
Expand Down Expand Up @@ -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,
Expand All @@ -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",
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -107,15 +107,15 @@
"0x6e947ba373a53bd41139d68e8dfb4fb0472767b6": {
"received": [
{
"asset": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed",
"contract": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed",
"id": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed",
"type": "erc20",
"value": "79907887473934231137403"
}
],
"sent": [
{
"asset": "0x4200000000000000000000000000000000000006",
"contract": "0x4200000000000000000000000000000000000006",
"id": "0x4200000000000000000000000000000000000006",
"type": "erc20",
"value": "300000000000000000"
Expand Down
Loading

0 comments on commit bef79b2

Please sign in to comment.