Closed gibbs-shih closed 5 months ago
evidences
content 欄位 (殼)
新增 evidence 欄位: report_address, report_name, evidence_type: "0"
文件
schema
db
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "newItemId",
"type": "uint256"
},
{
"indexed": true,
"internalType": "int256",
"name": "_ispublic",
"type": "int256"
},
{
"indexed": false,
"internalType": "string",
"name": "reportName",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "startTime",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "endTime",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "creator",
"type": "address"
}
],
"name": "ReportNFTMinted",
"type": "event"
},
"data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000065d6e2320000000000000000000000000000000000000000000000000000000065d6e23400000000000000000000000087b966e36cc1f3a2b855ffff904f6f6acaaec1db0000000000000000000000000000000000000000000000000000000000000042307836363639373237333734356637323635373036663732373430303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000",
emit ReportNFTMinted(recipient, newItemId, _ispublic, reportName, startTime, endTime, msg.sender)
用提供的abi 及 emit function 幫我解析 data report name
從您提供的ABI和data中,我們可以解析出`reportName`。首先,我們需要從data中找到`reportName`的位置。在ABI中,`reportName`是一個非索引的字符串類型,它在data字段中的位置是動態的。
給定的data是這樣的:
0x 0000000000000000000000000000000000000000000000000000000000000080 // reportName的偏移量 0000000000000000000000000000000000000000000000000000000065d6e232 // startTime 0000000000000000000000000000000000000000000000000000000065d6e234 // endTime 00000000000000000000000087b966e36cc1f3a2b855ffff904f6f6acaaec1db // creator 0000000000000000000000000000000000000000000000000000000000000042 // reportName字符串長度 3078363636393732373337343566373236353730366637323734303030303030 // reportName數據部分開始 3030303030303030303030303030303030303030303030303030303030303030 // reportName數據部分繼續 303030303030303030303030303030303030303030303030303030 // reportName數據部分結束和填充
從這段data中,我們可以看到:
- `reportName`的偏移量是128(0x80),表示`reportName`數據部分從第128個字節(位元第256)開始。
- `reportName`的長度是66(0x42),表示接下來的66個字節(132位元)是`reportName`的數據。
- `reportName`數據部分是從`0x3078363636393732373337343566373236353730366637323734303030303030...`開始的。
現在,我們需要將這些十六進制數據轉換成字符串。根據長度(66個字節),我們只需要前132個十六進制值,因為每2個十六進制值表示一個字符。
轉換前132個十六進制值:
307836363639373237333734356637323635373036663732373430303030303030303030303030303030303030303030303030303030303030303030303030303030
轉換成ASCII字符:
0x66697273745f7265706f72740000000000000000000000000000000000000000
這還不是最終的字符串,因為這裡面包含了十六進制表示的ASCII碼。將上述十六進制ASCII碼轉換成字符,我們得到:
first_report
因此,`reportName`是"first_report"。
0xd339efa6a650d7a3b38deceb896920bd8c268090b3bd14dc30ae131fe5181b41
logs中第2筆
"topics": [
"0xa27e08d11fb016ae5a274b7425b3ee72c33fc7863a7f3fad3279ec3e99114a28",
"0x0000000000000000000000002390b5b1da7a78266111143d503d50c4636f5680",
"0x0000000000000000000000000000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],調整 parseReportNameAddress, 有 report address 參數後要更新長度
不符合要求長度或內容 return null
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "newItemId",
"type": "uint256"
},
{
"indexed": true,
"internalType": "int256",
"name": "_ispublic",
"type": "int256"
},
{
"indexed": false,
"internalType": "string",
"name": "reportName",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "startTime",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "endTime",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "creator",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "report_address",
"type": "address"
}
],
"name": "ReportNFTMinted",
"type": "event"
},```
"topics": [
"0x70aaa564acddc70038bac90c4acbc2e43cfc636482f2a60678e8d6324fa4e2db", // event hash
"0x0000000000000000000000002390b5b1da7a78266111143d503d50c4636f5680", // recipient
"0x0000000000000000000000000000000000000000000000000000000000000001", // newItemId
"0x0000000000000000000000000000000000000000000000000000000000000000" // _ispublic
],
"data": "0x 00000000000000000000000000000000000000000000000000000000000000a0 // reportName偏移量 0000000000000000000000000000000000000000000000000000000065d6e232 // startTime 0000000000000000000000000000000000000000000000000000000065d6e234 // endTime 0000000000000000000000002390b5b1da7a78266111143d503d50c4636f5680 // creator 00000000000000000000000008a0c2b08e262a5521608f36b7bad07cfd9d29c6 // report_address 0000000000000000000000000000000000000000000000000000000000000042 // 指向這裡開始, 動態參數的開始是它的長度, 接著是實際的數據長度及填充 307836363639373237333734356637323635373036663732373430303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000"
更新 parseReportNameAddress function, provide reportName and reportAddress
更新 parsers 解析
成功自行塞入content
每執行完一次 crawl report, 不論該次有沒有塞content, 都會等待3分鐘再繼續執行
每一次執行會等待該次中所有要塞的content都塞完才結束
分別同步執行 crawler, parser / schedulePutReport
take about 28 hr
yang
程式碼evidences
content 欄位 (殼)