Skip to content

Commit

Permalink
0xv3 alternative event hash (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
linhnt3400 authored Oct 4, 2024
1 parent b6759b9 commit bedc184
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/tradelogs/migrations/000013_update_0xv3_event_hash.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UPDATE tradelogs SET event_hash = '0x0000000000000000000000000000000000000000000000000000000000000000'
WHERE contract_address = '0x7966af62034313d87ede39380bf60f1a84c62be7'
3 changes: 3 additions & 0 deletions pkg/parser/zxrfqv3/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type Parser struct {
l *zap.SugaredLogger
}

const altEventHash = "0x0000000000000000000000000000000000000000000000000000000000000000"

func MustNewParserWithDeployer(cache *tracecall.Cache, ethClient *ethclient.Client, deployerAddress common.Address, contractAbiSupported ...ContractABI) *Parser {
if isZeroAddress(deployerAddress) {
log.Fatalf("deployer Address is zero Address")
Expand Down Expand Up @@ -153,6 +155,7 @@ func (p *Parser) buildOrderByLog(log ethereumTypes.Log, blockTime uint64) (stora
tradeLog.TxHash = log.TxHash.Hex()
tradeLog.Timestamp = blockTime * 1000
tradeLog.ContractAddress = log.Address.Hex()
tradeLog.EventHash = altEventHash
orderHash, err := getOrderHash(log.Data)
if err != nil {
return storage.TradeLog{}, fmt.Errorf("get order hash error %w", err)
Expand Down
1 change: 1 addition & 0 deletions pkg/parser/zxrfqv3/test/expected_rfq.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"contract_address": "0x7966aF62034313D87Ede39380bf60f1A84c62BE7",
"block_number": 20285760,
"tx_hash": "0xb244877d0cf0badcf2ac82dbb3cbf338b420ab5d1c6e6630fce4a4874121e427",
"event_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"log_index": 380,
"timestamp": 1000,
"expiration_date": 1720731029
Expand Down

0 comments on commit bedc184

Please sign in to comment.